-fixed network init issue for (hopefully) everyone

This commit is contained in:
fix94.1 2012-02-02 11:18:09 +00:00
parent 4e03333ef6
commit e8ee7548a6
4 changed files with 46 additions and 32 deletions

View File

@ -1,2 +0,0 @@
#include "alt_ios.h"
int mainIOS = 249;

View File

@ -677,6 +677,7 @@ private:
void _showConfig4(void);
void _showConfigAdv(void);
void _showConfigSnd(void);
void _enableNandEmu(bool fromconfig);
void _showGame(void);
void _showDownload(void);
void _showCode(void);

View File

@ -17,6 +17,42 @@ static inline int loopNum(int i, int s)
const int CMenu::_nbCfgPages = 6;
static const int g_curPage = 1;
void CMenu::_enableNandEmu(bool fromconfig)
{
bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
gprintf("i: %i\n",i);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
if(!disable)
{
Nand::Instance()->Disable_Emu();
bool isD2XnewerThanV6 = false;
iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS);
if (iosInfo->version > 6)
isD2XnewerThanV6 = true;
Nand::Instance()->Enable_Emu();
u8 limiter = 0;
s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1;
if (!fromconfig)
direction = 0;
currentPartition = loopNum(currentPartition + direction, (int)USB8);
while(!DeviceHandler::Instance()->IsInserted(currentPartition) ||
(m_current_view == COVERFLOW_CHANNEL && (DeviceHandler::Instance()->GetFSType(currentPartition) != PART_FS_FAT ||
(!isD2XnewerThanV6 && DeviceHandler::Instance()->PathToDriveType(m_appDir.c_str()) == currentPartition) ||
(!isD2XnewerThanV6 && DeviceHandler::Instance()->PathToDriveType(m_dataDir.c_str()) == currentPartition))) ||
(m_current_view == COVERFLOW_HOMEBREW && DeviceHandler::Instance()->GetFSType(currentPartition) == PART_FS_WBFS))
{
currentPartition = loopNum(currentPartition + direction, (int)USB8);
if (limiter > 10) break;
limiter++;
}
gprintf("Next item: %s\n", DeviceName[currentPartition]);
m_cfg.setInt(_domainFromView(), "partition", currentPartition);
}
}
void CMenu::_hideConfig(bool instant)
{
m_btnMgr.hide(m_configLblTitle, instant);
@ -149,7 +185,10 @@ int CMenu::_config1(void)
{
_mainLoopCommon();
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
{
_enableNandEmu(false);
break;
}
else if (BTN_UP_PRESSED)
m_btnMgr.up();
else if (BTN_DOWN_PRESSED)
@ -169,7 +208,10 @@ int CMenu::_config1(void)
if (BTN_A_PRESSED)
{
if (m_btnMgr.selected(m_configBtnBack))
{
_enableNandEmu(false);
break;
}
else if (m_btnMgr.selected(m_configBtnDownload))
{
m_cf.stopCoverLoader(true);
@ -201,36 +243,7 @@ int CMenu::_config1(void)
}
else if (!m_locked && (m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM)))
{
bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
gprintf("i: %i\n",i);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
if(!disable)
{
Nand::Instance()->Disable_Emu();
bool isD2XnewerThanV6 = false;
iosinfo_t * iosInfo = cIOSInfo::GetInfo(mainIOS);
if (iosInfo->version > 6)
isD2XnewerThanV6 = true;
Nand::Instance()->Enable_Emu();
u8 limiter = 0;
s8 direction = m_btnMgr.selected(m_configBtnPartitionP) ? 1 : -1;
currentPartition = loopNum(currentPartition + direction, (int)USB8);
while(!DeviceHandler::Instance()->IsInserted(currentPartition) ||
(m_current_view == COVERFLOW_CHANNEL && (DeviceHandler::Instance()->GetFSType(currentPartition) != PART_FS_FAT ||
(!isD2XnewerThanV6 && DeviceHandler::Instance()->PathToDriveType(m_appDir.c_str()) == currentPartition) ||
(!isD2XnewerThanV6 && DeviceHandler::Instance()->PathToDriveType(m_dataDir.c_str()) == currentPartition))) ||
(m_current_view == COVERFLOW_HOMEBREW && DeviceHandler::Instance()->GetFSType(currentPartition) == PART_FS_WBFS))
{
currentPartition = loopNum(currentPartition + direction, (int)USB8);
if (limiter > 10) break;
limiter++;
}
gprintf("Next item: %s\n", DeviceName[currentPartition]);
m_cfg.setInt(_domainFromView(), "partition", currentPartition);
}
_enableNandEmu(true);
_showConfig();
}
else if (!m_locked && (m_btnMgr.selected(m_configBtnEmulationP) || m_btnMgr.selected(m_configBtnEmulationM)))

View File

@ -17,6 +17,7 @@
#include "wifi_gecko.h"
#include <fstream>
#include "lockMutex.hpp"
#include "nand.hpp"
#include <ogc/lwp_watchdog.h>
#include <time.h>
@ -274,6 +275,7 @@ s32 CMenu::_networkComplete(s32 ok, void *usrData)
int CMenu::_initNetwork()
{
Nand::Instance()->Disable_Emu();
while (net_get_status() == -EBUSY || m_thrdNetwork) {}; // Async initialization may be busy, wait to see if it succeeds.
if (m_networkInit) return 0;
if (!_isNetworkAvailable()) return -2;