mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 19:31:58 +01:00
-cleaned up booter code
This commit is contained in:
parent
1f5d72f2a4
commit
1b0f97393f
@ -44,6 +44,8 @@ u32 vmode_reg = 0;
|
|||||||
static u8 Tmd_Buffer[0x49e4 + 0x1C] ALIGNED(32);
|
static u8 Tmd_Buffer[0x49e4 + 0x1C] ALIGNED(32);
|
||||||
extern void __exception_closeall();
|
extern void __exception_closeall();
|
||||||
|
|
||||||
|
entry_point p_entry;
|
||||||
|
|
||||||
void __Disc_SetLowMem()
|
void __Disc_SetLowMem()
|
||||||
{
|
{
|
||||||
/* Setup low memory */
|
/* Setup low memory */
|
||||||
@ -351,8 +353,6 @@ s32 Disc_IsGC(void)
|
|||||||
|
|
||||||
s32 Disc_BootPartition()
|
s32 Disc_BootPartition()
|
||||||
{
|
{
|
||||||
free_wip();
|
|
||||||
|
|
||||||
if (hooktype != 0)
|
if (hooktype != 0)
|
||||||
ocarina_do_code();
|
ocarina_do_code();
|
||||||
|
|
||||||
@ -364,15 +364,12 @@ s32 Disc_BootPartition()
|
|||||||
|
|
||||||
/* Shutdown IOS subsystems */
|
/* Shutdown IOS subsystems */
|
||||||
u32 level = IRQ_Disable();
|
u32 level = IRQ_Disable();
|
||||||
__dsp_shutdown();
|
|
||||||
__IOS_ShutdownSubsystems();
|
__IOS_ShutdownSubsystems();
|
||||||
__exception_closeall();
|
__exception_closeall();
|
||||||
|
|
||||||
/* Originally from tueidj - taken from NeoGamma (thx) */
|
/* Originally from tueidj - taken from NeoGamma (thx) */
|
||||||
*(vu32*)0xCC003024 = 1;
|
*(vu32*)0xCC003024 = 1;
|
||||||
|
|
||||||
gprintf("Jumping to entry point\n");
|
|
||||||
|
|
||||||
if (hooktype != 0)
|
if (hooktype != 0)
|
||||||
{
|
{
|
||||||
asm volatile (
|
asm volatile (
|
||||||
@ -403,28 +400,9 @@ s32 Disc_BootPartition()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Disc_WiiBoot(u32 AppEntryPoint)
|
void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio)
|
||||||
{
|
{
|
||||||
appentrypoint = AppEntryPoint;
|
WDVD_OpenPartition(offset, 0, 0, 0, Tmd_Buffer);
|
||||||
|
|
||||||
/* Boot partition */
|
|
||||||
return Disc_BootPartition();
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload, int aspectRatio)
|
|
||||||
{
|
|
||||||
gprintf("Running Apploader...\n");
|
|
||||||
|
|
||||||
entry_point p_entry;
|
|
||||||
|
|
||||||
if (disableIOSreload)
|
|
||||||
IOSReloadBlock(IOS_GetVersion(), false);
|
|
||||||
else
|
|
||||||
IOSReloadBlock(IOS_GetVersion(), true);
|
|
||||||
|
|
||||||
s32 ret = WDVD_OpenPartition(offset, 0, 0, 0, Tmd_Buffer);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/* Setup low memory */;
|
/* Setup low memory */;
|
||||||
__Disc_SetLowMem();
|
__Disc_SetLowMem();
|
||||||
@ -433,9 +411,7 @@ u32 RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 pa
|
|||||||
__Disc_SelectVMode(vidMode, 0);
|
__Disc_SelectVMode(vidMode, 0);
|
||||||
|
|
||||||
/* Run apploader */
|
/* Run apploader */
|
||||||
ret = Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio);
|
Apploader_Run(&p_entry, vidMode, vmode, vipatch, countryString, patchVidMode, aspectRatio);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return (u32)p_entry;
|
appentrypoint = (u32)p_entry;
|
||||||
}
|
}
|
||||||
|
@ -96,10 +96,9 @@ s32 Disc_Type(bool);
|
|||||||
s32 Disc_IsWii(void);
|
s32 Disc_IsWii(void);
|
||||||
s32 Disc_IsGC(void);
|
s32 Disc_IsGC(void);
|
||||||
s32 Disc_BootPartition();
|
s32 Disc_BootPartition();
|
||||||
s32 Disc_WiiBoot(u32);
|
|
||||||
s32 Disc_FindPartition(u64 *outbuf);
|
s32 Disc_FindPartition(u64 *outbuf);
|
||||||
|
|
||||||
u32 RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, bool disableIOSreload, int aspectRatio);
|
void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1278,6 +1278,11 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disableIOSreload)
|
||||||
|
IOSReloadBlock(IOS_GetVersion(), false);
|
||||||
|
else
|
||||||
|
IOSReloadBlock(IOS_GetVersion(), true);
|
||||||
|
|
||||||
while(net_get_status() == -EBUSY)
|
while(net_get_status() == -EBUSY)
|
||||||
usleep(100);
|
usleep(100);
|
||||||
|
|
||||||
@ -1288,22 +1293,17 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
if(currentPartition == 0)
|
if(currentPartition == 0)
|
||||||
SDHC_Init();
|
SDHC_Init();
|
||||||
|
|
||||||
// clear mem1 main
|
|
||||||
u32 size = (u32)0x80A00000 - (u32)0x80004000;
|
|
||||||
memset((void*)0x80004000, 0, size);
|
|
||||||
DCFlushRange((void*)0x80004000, size);
|
|
||||||
|
|
||||||
gprintf("Booting game\n");
|
gprintf("Booting game\n");
|
||||||
|
usleep(100 * 1000);
|
||||||
|
|
||||||
/* Find game partition offset */
|
/* Find game partition offset */
|
||||||
u64 offset;
|
u64 offset;
|
||||||
Disc_FindPartition(&offset);
|
Disc_FindPartition(&offset);
|
||||||
u32 AppEntryPoint = RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, disableIOSreload, aspectRatio);
|
RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio);
|
||||||
gprintf("\n\nEntry Point is: 0x%08x\n", AppEntryPoint);
|
|
||||||
DeviceHandler::DestroyInstance();
|
DeviceHandler::DestroyInstance();
|
||||||
USBStorage_Deinit();
|
USBStorage_Deinit();
|
||||||
if (Disc_WiiBoot(AppEntryPoint) < 0)
|
free_wip();
|
||||||
Sys_LoadMenu();
|
Disc_BootPartition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenu::_initGameMenu(CMenu::SThemeData &theme)
|
void CMenu::_initGameMenu(CMenu::SThemeData &theme)
|
||||||
@ -1438,7 +1438,7 @@ void CMenu::_playGameSound(void)
|
|||||||
|
|
||||||
CheckGameSoundThread();
|
CheckGameSoundThread();
|
||||||
if(!gameSoundThreadStack.get())
|
if(!gameSoundThreadStack.get())
|
||||||
gameSoundThreadStack = smartMem2Alloc(gameSoundThreadStackSize);
|
gameSoundThreadStack = smartMem1Alloc(gameSoundThreadStackSize);
|
||||||
|
|
||||||
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack.get(), gameSoundThreadStackSize, 60);
|
LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void *)this, gameSoundThreadStack.get(), gameSoundThreadStackSize, 60);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user