-fixed neek mode wii game loading

-fixed emu nand game loading if the external booter is on the same partition as the emu nand
This commit is contained in:
fix94.1 2013-12-24 15:35:59 +00:00
parent 6b663fe2d9
commit bca5b4dc8e
5 changed files with 35 additions and 23 deletions

View File

@ -40,7 +40,6 @@
static the_CFG *BooterConfig = (the_CFG*)0x93100000;
#define EXT_ADDR ((u8*)0x80B00000)
#define EXT_ENTRY ((entry)EXT_ADDR)
#define BOOTER_ADDR ((u8*)0x93100000) /* temporary location */
extern "C" {
u8 configbytes[2];
@ -54,6 +53,7 @@ extern u8 *codelistend;
extern u32 gameconfsize;
extern u32 *gameconf;
u8 *booter_ptr = NULL;
size_t booter_size = 0;
the_CFG normalCFG;
@ -84,7 +84,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
/* Unmount devices etc */
ShutdownBeforeExit();
/* Copy in booter */
memcpy(EXT_ADDR, BOOTER_ADDR, booter_size);
memcpy(EXT_ADDR, booter_ptr, booter_size);
DCFlushRange(EXT_ADDR, booter_size);
/* Copy CFG into new memory region */
memcpy(BooterConfig, &normalCFG, sizeof(the_CFG));
@ -102,8 +102,9 @@ bool ExternalBooter_LoadBooter(const char *booter_path)
fsop_GetFileSizeBytes(booter_path, &booter_size);
if(booter_size > 0)
{
fsop_ReadFileLoc(booter_path, booter_size, BOOTER_ADDR);
return true;
booter_ptr = fsop_ReadFile(booter_path, &booter_size);
if(booter_ptr != NULL)
return true;
}
return false;
}

View File

@ -164,10 +164,10 @@ void CVideo::init(void)
}
/* GX Init */
m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[0] = MEM_K0_TO_K1(MEM1_memalign(32, VIDEO_GetFrameBufferSize(m_rmode)));
m_frameBuf[1] = MEM_K0_TO_K1(MEM1_memalign(32, VIDEO_GetFrameBufferSize(m_rmode)));
m_curFB = 0;
m_fifo = memalign(32, DEFAULT_FIFO_SIZE);
m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE);
memset(m_fifo, 0, DEFAULT_FIFO_SIZE);
GX_Init(m_fifo, DEFAULT_FIFO_SIZE);
GX_SetCopyClear(CColor(0), 0x00FFFFFF);
@ -197,7 +197,7 @@ void CVideo::init(void)
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
for(u32 i = 0; i < 8; i++)
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0+i, GX_TEX_ST, GX_F32, 0);
m_stencil = memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight);
/* Configure Video */
@ -295,13 +295,13 @@ void CVideo::cleanup(void)
free(m_defaultWaitMessages[i].data);
m_defaultWaitMessages[i].data = NULL;
}
free(MEM_K1_TO_K0(m_frameBuf[0]));
MEM1_free(MEM_K1_TO_K0(m_frameBuf[0]));
m_frameBuf[0] = NULL;
free(MEM_K1_TO_K0(m_frameBuf[1]));
MEM1_free(MEM_K1_TO_K0(m_frameBuf[1]));
m_frameBuf[1] = NULL;
free(m_stencil);
MEM1_free(m_stencil);
m_stencil = NULL;
free(m_fifo);
MEM1_free(m_fifo);
m_fifo = NULL;
}

View File

@ -55,6 +55,15 @@ void ListGenerator::CloseConfigs()
CustomTitles.unload();
}
/*
static const u32 LIST_TMP_SIZE = 5000;
dir_discHdr *tmpList = NULL;
u32 tmpListPos = 0;
static void AddToList(const dir_discHdr *element)
{
}
*/
static void AddISO(const char *GameID, const char *GameTitle, const char *GamePath,
u32 GameColor, u8 Type)
{

View File

@ -28,13 +28,13 @@ volatile bool networkInit = false;
int main(int argc, char **argv)
{
MEM_init(); //Inits both mem1lo and mem2
mainIOS = DOL_MAIN_IOS;
__exception_setreload(10);
Gecko_Init(); //USB Gecko and SD/WiFi buffer
gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str());
m_vid.init(); // Init video
MEM_init(); //Inits both mem1lo and mem2
DeviceHandle.Init();
NandHandle.Init();

View File

@ -1220,8 +1220,11 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
while(1) usleep(500);
}
}
if(WII_Launch == false && ExternalBooter_LoadBooter(fmt("%s/ext_booter.bin", m_binsDir.c_str())) == false)
Sys_Exit();
if(_loadIOS(gameIOS, userIOS, id, !NAND_Emu) == LOAD_IOS_FAILED)
Sys_Exit();
if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && returnTo != 0)
{
if(D2X_PatchReturnTo(returnTo) >= 0)
@ -1256,11 +1259,9 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
NandHandle.Patch_AHB(); /* Identify may takes it */
PatchIOS(true); /* Patch for everything */
Identify(gameTitle);
if(ExternalBooter_LoadBooter(fmt("%s/ext_booter.bin", m_binsDir.c_str())) == true)
{
ExternalBooter_ChannelSetup(gameTitle, use_dol);
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL, use_led);
}
ExternalBooter_ChannelSetup(gameTitle, use_dol);
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL, use_led);
}
Sys_Exit();
}
@ -1449,11 +1450,14 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
m_cfg.save(true);
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
if(ExternalBooter_LoadBooter(fmt("%s/ext_booter.bin", m_binsDir.c_str())) == false)
Sys_Exit();
if((!dvd || neek2o()) && !Sys_DolphinMode())
{
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
Sys_Exit();
}
if(CurrentIOS.Type == IOS_TYPE_D2X)
{
if(returnTo != 0 && !m_directLaunch && D2X_PatchReturnTo(returnTo) >= 0)
@ -1497,11 +1501,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
free(gameconfig);
}
if(ExternalBooter_LoadBooter(fmt("%s/ext_booter.bin", m_binsDir.c_str())) == true)
{
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
}
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
Sys_Exit();
}