Skip to content

Instantly share code, notes, and snippets.

View profi200's full-sized avatar

profi200

View GitHub Profile
// License: Do what you want. I don't care.
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cinttypes>
#include "lodepng.h"
// 0 = libretro GBA color, 1 = mGBA GBA color, 2 = libretro DS phat, 3 = libretro DS phat white.
static u8 crc7(const u8 *data, u32 len)
{
u32 crc = 0; // u32 to avoid "and rX, rX, #0xFF" in the bit loop.
while(len--)
{
crc ^= *data++;
for(u32 i = 0; i < 8; i++)
{
if(crc & 0x80u) crc ^= 0x89u;
crc <<= 1;
#include <string.h>
#include "mem_map.h"
#include "types.h"
#include "util.h"
#include "arm9/hardware/gamecard.h"
#include "arm9/ncch.h"
#include "arm9/hardware/crypto.h"
#include "arm9/hardware/timer.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
@profi200
profi200 / gbaEepromSaveFix.c
Last active March 30, 2023 20:23
A tool to fix wrong byte order GBA EEPROM saves as created by some emulators.
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// Compile with "gcc -std=c17 -O2 -fstrict-aliasing -ffunction-sections -Wall -Wl,--gc-sections gbaEepromSaveFix.c -o gbaEepromSaveFix"
int main(int argc, char *argv[])
{
int res = 0;
@profi200
profi200 / main.c
Created July 4, 2022 15:46
ips_artifact_fixer
#include <stdio.h>
#include <3ds.h>
#define REVERSE_INTERVAL (60u * 15)
static void setLcdFill(const u32 val)
{
3 MiB:
vector: 15926306
struct: 16319471
1 KiB:
vector: 5597
struct: 5758
128 bytes:
vector: 1057/1085
@ u32 pcTest(void)
@ Expected result is pc + 8 but it's pc + 10 on ARM7.
BEGIN_ASM_FUNC pcTest
ldr pc, =pcTest_mov + 2
pcTest_mov:
mov r0, pc
bx lr
END_ASM_FUNC
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Compile with "gcc -std=c17 -O2 -fstrict-aliasing -ffunction-sections -Wall -Wl,--gc-sections codecCoeffConvert.c -o codecCoeffConvert -lm"
int main(int argc, char *argv[])