diff --git a/source/gc/gc.c b/source/gc/gc.c index 95a99a9e..876db8bb 100644 --- a/source/gc/gc.c +++ b/source/gc/gc.c @@ -127,7 +127,7 @@ void DML_New_WriteOptions() // Devolution -u8 *loader_bin = NULL; +u8 *loader_bin = (u8*)0x93100000; extern void __exception_closeall(); static gconfig *DEVO_CONFIG = (gconfig*)0x80000020; #define DEVO_Entry() ((void(*)(void))loader_bin)() @@ -147,7 +147,7 @@ bool DEVO_Installed(const char* path) } void DEVO_SetOptions(const char *path, const char *partition, const char* loader, const char *gameID, bool memcard_emu) -{ +{ //Read in loader.bin char loader_path[256]; snprintf(loader_path, sizeof(loader_path), "%s/loader.bin", loader); @@ -157,8 +157,9 @@ void DEVO_SetOptions(const char *path, const char *partition, const char* loader fseek(f, 0, SEEK_END); u32 size = ftell(f); rewind(f); - loader_bin = (u8*)MEM2_alloc(size); + memset(loader_bin, 0, size); fread(loader_bin, 1, size, f); + DCFlushRange(loader_bin, size); fclose(f); } @@ -232,16 +233,16 @@ void DEVO_SetOptions(const char *path, const char *partition, const char* loader void DEVO_Boot() { - // the Devolution blob has an ID string at offset 4 + u32 cookie; puts((const char*)loader_bin + 4); gprintf("WiiFlow GC: Devolution initialized. Booting game...\n"); - /* Shutdown IOS subsystems */ - u32 level = IRQ_Disable(); - __IOS_ShutdownSubsystems(); + /* cleaning up and load dol */ + SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); + _CPU_ISR_Disable(cookie); __exception_closeall(); DEVO_Entry(); - IRQ_Restore(level); + _CPU_ISR_Restore(cookie); } diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index 82cbe91e..264698fc 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -147,16 +147,17 @@ int BootHomebrew(u64 chan_title) memcpy(BOOTER_ADDR, app_booter_bin, app_booter_bin_size); DCFlushRange(BOOTER_ADDR, app_booter_bin_size); - entrypoint entry = (entrypoint)BOOTER_ADDR; + entrypoint exeEntryPoint = (entrypoint)BOOTER_ADDR; + u32 cookie; memmove(ARGS_ADDR, &args, sizeof(args)); DCFlushRange(ARGS_ADDR, sizeof(args) + args.length); - /* Shutdown IOS subsystems */ - u32 level = IRQ_Disable(); - __IOS_ShutdownSubsystems(); + /* cleaning up and load dol */ + SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); + _CPU_ISR_Disable(cookie); __exception_closeall(); - entry(); - IRQ_Restore(level); + exeEntryPoint(); + _CPU_ISR_Restore(cookie); return 0; } diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 479fc365..2c250dc3 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -871,13 +871,13 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) #ifndef DOLPHIN USBStorage2_Deinit(); USB_Deinitialize(); - SDHC_Init(); #endif GC_SetVideoMode(videoMode, videoSetting); GC_SetLanguage(GClanguage); if(loader == 2) DEVO_Boot(); + SDHC_Init(); DML_New_WriteOptions(); WII_Initialize(); if(WII_LaunchTitle(0x100000100LL) < 0) @@ -887,7 +887,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) void CMenu::_launchHomebrew(const char *filepath, vector arguments) { Nand::Instance()->Disable_Emu(); - m_reload = true; Channels channel; u64 title = SYSTEM_MENU; @@ -906,9 +905,11 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) AddBootArgument(filepath); for(u32 i = 0; i < arguments.size(); ++i) AddBootArgument(arguments[i].c_str()); + #ifndef DOLPHIN USBStorage2_Deinit(); USB_Deinitialize(); + SDHC_Close(); #endif BootHomebrew(title); }