From 84f983f4ee1ea0142a241e835799edef538e3a39 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 2 Jan 2017 17:18:20 +0000 Subject: [PATCH] updated boot code to support 64DD and Aleck64 roms (Saving still not supported) --- src/menu.c | 85 ++++++++++++++++++++++++++--------------------------- src/utils.c | 8 ++--- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/src/menu.c b/src/menu.c index 9174e2c..4863180 100644 --- a/src/menu.c +++ b/src/menu.c @@ -195,7 +195,7 @@ static resolution_t res = RESOLUTION_320x240; //background sprites sprite_t *loadPng(u8 *png_filename); sprite_t *background; //background -sprite_t *background0; //splash screen +sprite_t *splashscreen; //splash screen //config file theme settings u32 border_color_1 = 0xFFFFFFFF; //hex 0xRRGGBBAA AA=transparenxy @@ -2463,21 +2463,22 @@ int readCheatFile(char *filename, u32 *cheat_lists[2]) return repeater; // Ok or repeater error } -void timing(display_context_t disp) -{ - unsigned char tmp[32]; +//TODO: UNUSED CODE, WHAT IS IS FOR? +// void timing(display_context_t disp) +// { +// unsigned char tmp[32]; - IO_WRITE(PI_STATUS_REG, 0x02); +// IO_WRITE(PI_STATUS_REG, 0x02); - u32 pi0 = IO_READ(PI_BSD_DOM1_LAT_REG); - u32 pi1 = IO_READ(PI_BSD_DOM1_PWD_REG); - u32 pi2 = IO_READ(PI_BSD_DOM1_PGS_REG); - u32 pi3 = IO_READ(PI_BSD_DOM1_RLS_REG); +// u32 pi0 = IO_READ(PI_BSD_DOM1_LAT_REG); +// u32 pi1 = IO_READ(PI_BSD_DOM1_PWD_REG); +// u32 pi2 = IO_READ(PI_BSD_DOM1_PGS_REG); +// u32 pi3 = IO_READ(PI_BSD_DOM1_RLS_REG); - printText("timing dom1:", 3, -1, disp); - sprintf(tmp, "lat=%x pwd=%x\npgs=%x rls=%x", pi0, pi1, pi2, pi3); - printText(tmp, 3, -1, disp); -} +// printText("timing dom1:", 3, -1, disp); +// sprintf(tmp, "lat=%x pwd=%x\npgs=%x rls=%x", pi0, pi1, pi2, pi3); +// printText(tmp, 3, -1, disp); +// } void bootRom(display_context_t disp, int silent) { @@ -2620,9 +2621,11 @@ void drawTextInput(display_context_t disp, char *msg) void drawConfirmBox(display_context_t disp) { drawBoxNumber(disp, 5); - display_show(disp); + if (sound_on) + playSound(3); + printText(" ", 9, 9, disp); printText("Confirmation required:", 9, -1, disp); printText(" ", 9, -1, disp); @@ -2633,9 +2636,6 @@ void drawConfirmBox(display_context_t disp) printText(" ", 9, -1, disp); printText(" B Cancel", 9, -1, disp); - if (sound_on) - playSound(3); - sleep(500); } @@ -3261,6 +3261,9 @@ void showAboutScreen(display_context_t disp) drawBoxNumber(disp, 2); display_show(disp); + if (sound_on) + playSound(2); + printText("Altra64: v0.1.8.6.1.2", 9, 8, disp); sprintf(firmware_str, "ED64 firmware: v%03x", evd_getFirmVersion()); printText(firmware_str, 9, -1, disp); @@ -3277,10 +3280,7 @@ void showAboutScreen(display_context_t disp) printText("ShaunTaylor", 9, -1, disp); printText("Conle", 9, -1, disp); - if (sound_on) - playSound(2); - - //sleep(500); + sleep(500); } void loadFile(display_context_t disp) @@ -4613,10 +4613,11 @@ int main(void) //load soundsystem audio_init(44100, 2); sndInit(); - - timer_init(); } + + timer_init(); + //background display_init(res, DEPTH_32_BPP, 3, GAMMA_NONE, ANTIALIAS_RESAMPLE); @@ -4626,31 +4627,15 @@ int main(void) //Grab a render buffer while (!(disp = display_lock())) ; + //backgrounds from ramfs/libdragonfs if (!fast_boot) { - background0 = read_sprite("rom://sprites/splash.sprite"); - graphics_draw_sprite(disp, 0, 0, background0); //start-picture + splashscreen = read_sprite("rom://sprites/splash.sprite"); + graphics_draw_sprite(disp, 0, 0, splashscreen); //start-picture display_show(disp); - } - char background_path[64]; - sprintf(background_path, "/ED64/wallpaper/%s", background_image); - int found; - FatRecord rec_tmpf; - found = fatFindRecord(background_path, &rec_tmpf, 0); - if (found == 0) - { - background = loadPng(background_path); - } - else - { - background = read_sprite("rom://sprites/background.sprite"); - } - - if (!fast_boot) - { if (sound_on) { playSound(1); @@ -4660,10 +4645,22 @@ int main(void) sleep(10); } } - - //sleep(2000); //splash screen duration } + char background_path[64]; + sprintf(background_path, "/ED64/wallpaper/%s", background_image); + + FatRecord rec_tmpf; + if (fatFindRecord(background_path, &rec_tmpf, 0) == 0) + { + background = loadPng(background_path); + } + else + { + background = read_sprite("rom://sprites/background.sprite"); + } + + //todo: if bgm is enabled, we should start it... //sndPlayBGM("rom://bgm21.it"); diff --git a/src/utils.c b/src/utils.c index c985c55..ee42c7d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -772,20 +772,20 @@ void simulate_boot(u32 cic_chip, u8 gBootCic, u32 *cheat_lists[2]) { ".byte 0x3F;" // NUS-CIC-6101 ".byte 0x3F;" // NUS-CIC-6102 ".byte 0x78;" // NUS-CIC-6103 - ".byte 0x00;" // Unused + ".byte 0xAC;" // Unused NUS-CIC-5101 hacked to 4 0xAC seed ".byte 0x91;" // NUS-CIC-6105 ".byte 0x85;" // NUS-CIC-6106 - ".byte 0x00;" // Unused + ".byte 0xDD;" // NUS-CIC-5167 "cic_patch_offsets:" ".byte 0x00;" // Unused ".byte 0x30;" // CIC-NUS-6101 ".byte 0x2C;" // CIC-NUS-6102 ".byte 0x20;" // CIC-NUS-6103 - ".byte 0x00;" // Unused + ".byte 0x30;" // Unused NUS-CIC-5101 hacked to 4 same patch offset like 6101 ".byte 0x8C;" // CIC-NUS-6105 ".byte 0x60;" // CIC-NUS-6106 - ".byte 0x00;" // Unused + ".byte 0x30;" // NUS-CIC-5167 // These instructions are copied to RSP IMEM; we don't execute them. "imem_start:"