Skip to content

Instantly share code, notes, and snippets.

Avatar

profi200

View GitHub Profile
View games.h
{
// 0001 - F-Zero for Game Boy Advance (Japan)
// 0040 - F-Zero - Maximum Velocity (USA, Europe)
// 2733 - Jisu F-Zero Weilai Saiche (China)
// x138 - F-Zero - Maximum Velocity (USA) (Wii U Virtual Console)
{"AFZ", UNSPECIFIED},
// 0002 - Super Mario Advance - Super Mario USA + Mario Brothers (Japan)
// 0049 - Super Mario Advance (USA, Europe)
// 1570 - Chaoji Maliou 2 (China)
View color_correction.c
...
const double inGamma = 4.0;
const double outGamma = 2.2;
//const double contrast = .74851331406341291833644689906823; // GBA
//const double brightness = .25148668593658708166355310093177; // GBA
const double contrast = 1.0; // No-op
const double brightness = 0.0; // No-op
REG_LCD_PDC0_GTBL_IDX = 0;
for(u32 i = 0; i < 256; i++)
{
View fixSaveMode.sh
#!/bin/bash
sed "s/,0x00}/,0xF}/" ./saveMODE.h | sed "s/,0x11}/,0xE}/" | sed "s/,0x21}/,0x0}/" | sed "s/,0x22}/,0x2}/" | sed "s/,0x23}/,0x2}/" | sed "s/,0x32}/,0x8}/" | sed "s/,0x33}/,0x8}/" | sed "s/,0x31}/,0xA}/" | sed "s/{""/ {""/" > saveTypes.h
@profi200
profi200 / gbaEepromSaveFix.c
Last active Jul 13, 2020
A tool to fix wrong byte order GBA EEPROM saves as created by some emulators.
View gbaEepromSaveFix.c
#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;
View main.c
...
// Color bars for accuracy tests.
// Extremely slow drawing!
SetMode(BG2_ON | MODE_3);
vu16 *vram = ((vu16*)0x06000000);
u32 i = 0;
for(; i < 240 * 53; i++) // red
{
vram[i] = (i % 240) * 32 / 240;
}
View main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR (0x68B0D8FF)
@profi200
profi200 / texcopy.c
Created Apr 26, 2020
Texture copy measurements originally done for Corgi3DS
View texcopy.c
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 Apr 26, 2020
VBlank time test for citra
View vblank_test.s
#include "asmfunc.h"
.arm
.cpu mpcore
.fpu vfpv2
@ u32 vblankTest(void)
ASM_FUNC vblankTest
View gpu_init_cmd_list.txt
[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 Apr 13, 2020
Some crypto measurements for Corgi3DS.
View crypto.c
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;
You can’t perform that action at this time.