Skip to content

Instantly share code, notes, and snippets.

View profi200's full-sized avatar

profi200

View GitHub Profile
//#include "types.h"
#include <stdio.h>
#include <inttypes.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "hardware/spi.h"
#include "pico/bootrom.h"
#define LED_PIN (25u)
@profi200
profi200 / ssp.c
Last active October 28, 2020 16:24
devkitARM bare metal stack protector
#include "types.h"
#include "arm11/debug.h"
// Needs to be marked as used to work with LTO.
// The used attribute also overrides the newlib symbol.
// This is for debugging purposes only. For security this value needs to be random!
__attribute__((used)) uintptr_t __stack_chk_guard = 0x2D9B1A0E;
"BRXJB2" 2899 - Vattroller X - Taikenban (Japan) (Demo) (Kiosk, GameCube)
"BMVE01" 2898 - Mario Pinball Land (USA) (Kiosk, GameCube)
"!none" 2900 - Commandos 2 (Japan) (Proto)
"!none" x325 - Metal Slug - Super Vehicle-001 (Japan) (En) (Proto)
"MRDK01" x114 - Mario vs. Donkey Kong (USA) (Demo) (Kiosk, GameCube)
"AZWJ01" 2901 - Made in Wario (Japan) (Demo) (Kiosk, GameCube)
"!none" x326 - Metal Slug Advance (Japan) (Beta)
1, 2 and 5, 6 have their maker code mistakenly included in the game code ("serial").
text:FFFFB088 @ FirmBlacklist firmSectionBlacklist[8]
text:FFFFB088 firmSectionBlacklist:FirmBlacklist <0x7FFB800, 0x7FFFC00>
text:FFFFB088 @ DATA XREF: verifyFirmSections+A↑o
text:FFFFB088 @ text:off_FFFFA4A0↑o ...
text:FFFFB088 FirmBlacklist <0xFFF00000, 0xFFF03000>
text:FFFFB088 FirmBlacklist <0xFFF03000, 0xFFF04000>
text:FFFFB088 FirmBlacklist <0x80F8000, 0x8100000>
text:FFFFB088 FirmBlacklist <0x8000000, 0x8000040>
text:FFFFB088 FirmBlacklist <0x20000000, 0x28000000>
text:FFFFB088 FirmBlacklist <0xFFF00000, 0x20000000>
@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;
#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 / texcopy.c
Created April 26, 2020 14:46
Texture copy measurements originally done for Corgi3DS
static u32 counter = 1;
stopProfiling();
GFX_deinit(false);
TIMER_sleepMs(1000);
*((vu32*)0x10140140) = 0; // REG_CFG11_GPUPROT
*((vu32*)0x10141200) = 0x1007F; // REG_CFG11_GPU_CNT
IRQ_registerHandler(IRQ_PPF, 14, 0, true, NULL);
__cpsid(i);
static void *const dsts[4] = {(void*)VRAM_BASE, (void*)0x1F000000, (void*)DSP_MEM_BASE, (void*)FCRAM_BASE};
@profi200
profi200 / vblank_test.s
Created April 26, 2020 12:04
VBlank time test for citra
#include "asmfunc.h"
.arm
.cpu mpcore
.fpu vfpv2
@ u32 vblankTest(void)
ASM_FUNC vblankTest
[TEXUNIT_CONFIG] = 00011000, MASK = FFFF00FF
[TEXUNIT0_BORDER_COLOR] = 00000000
[TEXUNIT0_DIM] = 00000000
[TEXUNIT0_PARAM] = 00000000
[TEXUNIT0_LOD] = 00000000
[TEXUNIT0_ADDR1] = 00000000
[TEXUNIT0_ADDR2] = 00000000
[TEXUNIT0_ADDR3] = 00000000
[TEXUNIT0_ADDR4] = 00000000
[TEXUNIT0_ADDR5] = 00000000
@profi200
profi200 / crypto.c
Created April 13, 2020 15:30
Some crypto measurements for Corgi3DS.
void setupStuff(bool sha, u32 aesMode)
{
if(!sha)
{
REG_AESCNT = (AES_INPUT_BIG | AES_INPUT_NORMAL)<<23;
static const u32 whatever[4] = {0x12345678, 0x87654321, 0x12345678, 0x87654321};
for(u32 i = 0; i < 4; i++) REG_AESCTR[i] = whatever[i];
REG_NDMA3_SRC_ADDR = 0;
REG_NDMA3_DST_ADDR = REG_AESWRFIFO;