updated boot code to support 64DD and Aleck64 roms

(Saving still not supported)
This commit is contained in:
Robin Jones 2017-01-02 17:18:20 +00:00
parent f765603e76
commit 84f983f4ee
2 changed files with 45 additions and 48 deletions

View File

@ -195,7 +195,7 @@ static resolution_t res = RESOLUTION_320x240;
//background sprites //background sprites
sprite_t *loadPng(u8 *png_filename); sprite_t *loadPng(u8 *png_filename);
sprite_t *background; //background sprite_t *background; //background
sprite_t *background0; //splash screen sprite_t *splashscreen; //splash screen
//config file theme settings //config file theme settings
u32 border_color_1 = 0xFFFFFFFF; //hex 0xRRGGBBAA AA=transparenxy 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 return repeater; // Ok or repeater error
} }
void timing(display_context_t disp) //TODO: UNUSED CODE, WHAT IS IS FOR?
{ // void timing(display_context_t disp)
unsigned char tmp[32]; // {
// 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 pi0 = IO_READ(PI_BSD_DOM1_LAT_REG);
u32 pi1 = IO_READ(PI_BSD_DOM1_PWD_REG); // u32 pi1 = IO_READ(PI_BSD_DOM1_PWD_REG);
u32 pi2 = IO_READ(PI_BSD_DOM1_PGS_REG); // u32 pi2 = IO_READ(PI_BSD_DOM1_PGS_REG);
u32 pi3 = IO_READ(PI_BSD_DOM1_RLS_REG); // u32 pi3 = IO_READ(PI_BSD_DOM1_RLS_REG);
printText("timing dom1:", 3, -1, disp); // printText("timing dom1:", 3, -1, disp);
sprintf(tmp, "lat=%x pwd=%x\npgs=%x rls=%x", pi0, pi1, pi2, pi3); // sprintf(tmp, "lat=%x pwd=%x\npgs=%x rls=%x", pi0, pi1, pi2, pi3);
printText(tmp, 3, -1, disp); // printText(tmp, 3, -1, disp);
} // }
void bootRom(display_context_t disp, int silent) 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) void drawConfirmBox(display_context_t disp)
{ {
drawBoxNumber(disp, 5); drawBoxNumber(disp, 5);
display_show(disp); display_show(disp);
if (sound_on)
playSound(3);
printText(" ", 9, 9, disp); printText(" ", 9, 9, disp);
printText("Confirmation required:", 9, -1, disp); printText("Confirmation required:", 9, -1, disp);
printText(" ", 9, -1, disp); printText(" ", 9, -1, disp);
@ -2633,9 +2636,6 @@ void drawConfirmBox(display_context_t disp)
printText(" ", 9, -1, disp); printText(" ", 9, -1, disp);
printText(" B Cancel", 9, -1, disp); printText(" B Cancel", 9, -1, disp);
if (sound_on)
playSound(3);
sleep(500); sleep(500);
} }
@ -3261,6 +3261,9 @@ void showAboutScreen(display_context_t disp)
drawBoxNumber(disp, 2); drawBoxNumber(disp, 2);
display_show(disp); display_show(disp);
if (sound_on)
playSound(2);
printText("Altra64: v0.1.8.6.1.2", 9, 8, disp); printText("Altra64: v0.1.8.6.1.2", 9, 8, disp);
sprintf(firmware_str, "ED64 firmware: v%03x", evd_getFirmVersion()); sprintf(firmware_str, "ED64 firmware: v%03x", evd_getFirmVersion());
printText(firmware_str, 9, -1, disp); printText(firmware_str, 9, -1, disp);
@ -3277,10 +3280,7 @@ void showAboutScreen(display_context_t disp)
printText("ShaunTaylor", 9, -1, disp); printText("ShaunTaylor", 9, -1, disp);
printText("Conle", 9, -1, disp); printText("Conle", 9, -1, disp);
if (sound_on) sleep(500);
playSound(2);
//sleep(500);
} }
void loadFile(display_context_t disp) void loadFile(display_context_t disp)
@ -4613,10 +4613,11 @@ int main(void)
//load soundsystem //load soundsystem
audio_init(44100, 2); audio_init(44100, 2);
sndInit(); sndInit();
timer_init();
} }
timer_init();
//background //background
display_init(res, DEPTH_32_BPP, 3, GAMMA_NONE, ANTIALIAS_RESAMPLE); display_init(res, DEPTH_32_BPP, 3, GAMMA_NONE, ANTIALIAS_RESAMPLE);
@ -4626,31 +4627,15 @@ int main(void)
//Grab a render buffer //Grab a render buffer
while (!(disp = display_lock())) while (!(disp = display_lock()))
; ;
//backgrounds from ramfs/libdragonfs //backgrounds from ramfs/libdragonfs
if (!fast_boot) if (!fast_boot)
{ {
background0 = read_sprite("rom://sprites/splash.sprite"); splashscreen = read_sprite("rom://sprites/splash.sprite");
graphics_draw_sprite(disp, 0, 0, background0); //start-picture graphics_draw_sprite(disp, 0, 0, splashscreen); //start-picture
display_show(disp); 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) if (sound_on)
{ {
playSound(1); playSound(1);
@ -4660,10 +4645,22 @@ int main(void)
sleep(10); 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... //todo: if bgm is enabled, we should start it...
//sndPlayBGM("rom://bgm21.it"); //sndPlayBGM("rom://bgm21.it");

View File

@ -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-6101
".byte 0x3F;" // NUS-CIC-6102 ".byte 0x3F;" // NUS-CIC-6102
".byte 0x78;" // NUS-CIC-6103 ".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 0x91;" // NUS-CIC-6105
".byte 0x85;" // NUS-CIC-6106 ".byte 0x85;" // NUS-CIC-6106
".byte 0x00;" // Unused ".byte 0xDD;" // NUS-CIC-5167
"cic_patch_offsets:" "cic_patch_offsets:"
".byte 0x00;" // Unused ".byte 0x00;" // Unused
".byte 0x30;" // CIC-NUS-6101 ".byte 0x30;" // CIC-NUS-6101
".byte 0x2C;" // CIC-NUS-6102 ".byte 0x2C;" // CIC-NUS-6102
".byte 0x20;" // CIC-NUS-6103 ".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 0x8C;" // CIC-NUS-6105
".byte 0x60;" // CIC-NUS-6106 ".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. // These instructions are copied to RSP IMEM; we don't execute them.
"imem_start:" "imem_start:"