From 32cd3b0cd247f5348ae781387044d5763ff4bf2e Mon Sep 17 00:00:00 2001 From: yardape8000 Date: Fri, 11 May 2012 03:37:56 +0000 Subject: [PATCH] Allow wifi-gecko to work close to game launch --- source/loader/disc.c | 2 ++ source/loader/wdvd.c | 6 ++++++ source/menu/menu_error.cpp | 3 ++- source/menu/menu_game.cpp | 19 +++++++++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/source/loader/disc.c b/source/loader/disc.c index 54ae450b..4c793cc7 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -286,8 +286,10 @@ s32 Disc_Wait(void) s32 Disc_SetUSB(const u8 *id) { + //gprintf("Trying set_frag_list\n"); if (id) return set_frag_list((u8 *) id); + //gprintf("Trying WDVD_SetUSBMode\n"); return WDVD_SetUSBMode(wbfsDev, (u8 *) id, -1); } diff --git a/source/loader/wdvd.c b/source/loader/wdvd.c index e4f5f799..7384ab1e 100644 --- a/source/loader/wdvd.c +++ b/source/loader/wdvd.c @@ -335,6 +335,12 @@ s32 WDVD_SetFragList(int device, void *fraglist, int size) inbuf[2] = (u32)fraglist; inbuf[3] = size; + //int i; + //for (i = 0; i < 8; i++) + // gprintf("inbuf[%d] = %X\n", i, inbuf[i]); + //ghexdump(fraglist, size); + //gprintf("\n"); + DCFlushRange(fraglist, size); s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SETFRAG, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf)); if (ret < 0) return ret; diff --git a/source/menu/menu_error.cpp b/source/menu/menu_error.cpp index a4e246a0..09ff35b8 100644 --- a/source/menu/menu_error.cpp +++ b/source/menu/menu_error.cpp @@ -28,9 +28,10 @@ void CMenu::error(const wstringEx &msg) _hideWaitMessage(); m_btnMgr.setText(m_errorLblMessage, msg, true); _showError(); + + gprintf(msg.toUTF8().c_str()); do { - gprintf(msg.toUTF8().c_str()); _mainLoopCommon(); } while (!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED); _hideError(false); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 04d839a4..64b5b0f7 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -18,6 +18,9 @@ #include "channel_launcher.h" #include "devicemounter/sdhc.h" +#include +#include + #include "loader/frag.h" #include "loader/fst.h" @@ -508,7 +511,7 @@ void CMenu::_game(bool launch) Playlog_Delete(); } - gprintf("Launching game\n"); + gprintf("Launching game %s\n", id.c_str()); _launch(hdr); if(m_exit || bootHB) break; @@ -793,6 +796,8 @@ int CMenu::_loadIOS(u8 ios, string id) int gameIOS = 0; int userIOS = 0; + gprintf("Game ID# %s requested IOS %d\n", id.c_str(), ios); + if (m_gcfg2.getInt(id, "ios", &userIOS) && _installed_cios.size() > 0) { for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++) @@ -995,6 +1000,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) { string id = string((const char *) hdr->hdr.id); Nand::Instance()->Disable_Emu(); + bool using_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko"); if (dvd) { @@ -1195,7 +1201,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) app_gameconfig_load((u8 *) &hdr->hdr.id, gameconfig.get(), gameconfigSize); ocarina_load_code((u8 *) &hdr->hdr.id, cheatFile.get(), cheatSize); - net_wc24cleanup(); + if (!using_wifi_gecko) + net_wc24cleanup(); bool iosLoaded = false; @@ -1208,6 +1215,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) iosLoaded = true; } + if (iosLoaded && using_wifi_gecko) + { + _initAsyncNetwork(); + while(net_get_status() == -EBUSY); + } + if(emuSave) { if(iosLoaded) ISFS_Deinitialize(); @@ -1273,7 +1286,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) } } + while(net_get_status() == -EBUSY); cleanup(); + // wifi-gecko can no longer function after cleanup Close_Inputs(); USBStorage_Deinit(); if(currentPartition == 0)