From 5cd988fe2396afcd232d0e02017900835a258534 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Fri, 10 Aug 2012 13:47:05 +0000 Subject: [PATCH] -fixed banner keeps playing on delete game (issue 117) -small changes on wii game booting --- source/loader/apploader.c | 14 ++++++-------- source/loader/disc.c | 10 +++++++--- source/loader/disc.h | 3 ++- source/menu/menu_game.cpp | 8 ++++---- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/source/loader/apploader.c b/source/loader/apploader.c index d0f8351c..1e6ce907 100644 --- a/source/loader/apploader.c +++ b/source/loader/apploader.c @@ -53,21 +53,20 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc /* Read apploader header */ ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET); - if (ret < 0) + if(ret < 0) return ret; /* Calculate apploader length */ appldr_len = buffer[5] + buffer[6]; - - /* Clear Apploader region (important buffers are under that) */ - memset((void*)0x81200000, 0, 0x500000); /* Read apploader code */ ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20); if(ret < 0) return ret; - + + /* Flush into memory */ DCFlushRange(appldr, appldr_len); + ICInvalidateRange(appldr, appldr_len); /* Set apploader entry function */ app_entry appldr_entry = (app_entry)buffer[4]; @@ -78,7 +77,7 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc /* Initialize apploader */ appldr_init(gprintf); - while (appldr_main(&dst, &len, &offset)) + while(appldr_main(&dst, &len, &offset)) { /* Read data from DVD */ WDVD_Read(dst, len, (u64)(offset << 2)); @@ -86,7 +85,7 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc } free_wip(); - if (hooktype != 0) + if(hooktype != 0) { if(hookpatched) ocarina_do_code(); @@ -99,7 +98,6 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc /* ERROR 002 fix (WiiPower) */ *(u32 *)0x80003140 = *(u32 *)0x80003188; - DCFlushRange((void*)0x80000000, 0x3f00); return 0; diff --git a/source/loader/disc.c b/source/loader/disc.c index ae1cfaa2..0f715914 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -388,7 +388,7 @@ s32 Disc_BootPartition() /* Originally from tueidj - taken from NeoGamma (thx) */ *(vu32*)0xCC003024 = 1; - if (hooktype != 0) + if(hooktype != 0) { asm volatile ( "lis %r3, appentrypoint@h\n" @@ -418,8 +418,9 @@ s32 Disc_BootPartition() return 0; } -void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo) +void Disc_BootWiiGame(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo) { + /* Open Partition */ WDVD_OpenPartition(offset); /* Setup low memory */ @@ -430,6 +431,9 @@ void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 p /* Run apploader */ Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio, returnTo); - appentrypoint = (u32)p_entry; + + /* Boot Game */ + gprintf("Entry Point: 0x%08x\n", appentrypoint); + Disc_BootPartition(); } diff --git a/source/loader/disc.h b/source/loader/disc.h index ed9a13ca..4c15e69f 100644 --- a/source/loader/disc.h +++ b/source/loader/disc.h @@ -109,7 +109,8 @@ s32 Disc_FindPartition(u64 *outbuf); GXRModeObj *Disc_SelectVMode(u8 videoselected, u64 chantitle, u32 *rmode_reg); void Disc_SetVMode(GXRModeObj *rmode, u32 rmode_reg); -void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo); +void Disc_BootWiiGame(u64 offset, u8 vidMode, bool vipatch, bool countryString, + u8 patchVidMode, int aspectRatio, u32 returnTo); #ifdef __cplusplus } diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 1202e2d4..55b197ee 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -493,8 +493,10 @@ void CMenu::_game(bool launch) _hideGame(); if(_wbfsOp(CMenu::WO_REMOVE_GAME)) { - m_gameSound->Stop(); + m_gameSound->FreeMemory(); CheckGameSoundThread(); + ClearGameSoundThreadStack(); + m_banner->DeleteBanner(); break; } _showGame(); @@ -1421,9 +1423,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) return; DisableMEM1allocR(); - RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo); - gprintf("Booting game\n"); - Disc_BootPartition(); + Disc_BootWiiGame(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo); } void CMenu::_initGameMenu(CMenu::SThemeData &theme)