*First attempt to fix the weird startup problems and wiitdb issue (Testversion 3)

This commit is contained in:
dimok321 2010-01-17 09:49:26 +00:00
parent bc68840faf
commit ca9455aa53
3 changed files with 79 additions and 58 deletions

View File

@ -39,6 +39,37 @@ void HaltCheck()
usleep(50);
}
void ReloadHDD_Settings()
{
if(strstr(bootDevice, "USB:") != 0)
{
CFG_Load();
int ios = 249;
switch(Settings.cios)
{
case ios249:
ios = 249;
break;
case ios222:
ios = 222;
break;
case ios250:
ios = 250;
break;
}
if(ios != IOS_GetVersion())
Sys_ChangeIos(ios);
}
if(strstr(Settings.ogg_path, "USB:/") != 0)
{
bgMusic->Load(Settings.ogg_path);
bgMusic->Play();
}
// open database if available, load titles if needed
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride == 1 ? true: false, true);
}
int CheckPartition()
{
s32 ret2 = -1;
@ -157,19 +188,11 @@ static void * CheckDevices (void *arg)
{
if(CheckHDD() >= 0)
{
// open database if needed, load titles if needed
if(isInserted(bootDevice))
OpenXMLDatabase(Settings.titlestxt_path,Settings.db_language, Settings.db_JPtoEN, true, Settings.titlesOverride == 1 ? true: false, true);
checkthreadState = 1;
LWP_SetThreadPriority(LWP_GetSelf(), 0);
if(strstr(Settings.ogg_path, "USB:/") != 0)
{
bgMusic->Load(Settings.ogg_path);
bgMusic->Play();
}
ReloadHDD_Settings();
checkthreadState = 1;
}
}

View File

@ -248,14 +248,14 @@ s32 IOS_ReloadIOSsafe(int ios)
if (ios222rev == -69)
ios222rev = getIOSrev(0x00000001000000dell);
if (ios222rev >= 0 && (ios222rev != 4 && ios222rev != 5))return -2;
if (ios222rev >= 0 && !(ios222rev >= 4 && ios222rev < 65280)) return -2;
}
else if (ios==223)
{
if (ios223rev == -69)
ios223rev = getIOSrev(0x00000001000000dfll);
if (ios223rev >= 0 && (ios223rev != 4 && ios223rev != 5))return -2;
if (ios223rev >= 0 && !(ios223rev >= 4 && ios223rev < 65280)) return -2;
}
else if (ios==249)
{
@ -284,12 +284,12 @@ s32 IOS_ReloadIOSsafe(int ios)
s32 CheckForCIOS()
{
gprintf("\n\tChecking for stub IOS");
s32 ret = -1;
s32 ios222rev = getIOSrev(0x00000001000000dell);
s32 ios249rev = getIOSrev(0x00000001000000f9ll);
s32 ret = 1;
ios222rev = getIOSrev(0x00000001000000dell);
ios249rev = getIOSrev(0x00000001000000f9ll);
//if we don't like either of the cIOS then scram
if (!(ios222rev==4 || ios222rev==5 || (ios249rev>=9 && ios249rev<65280)))
if (!((ios222rev >= 4 && ios222rev < 65280) || (ios249rev >=9 && ios249rev < 65280)))
{
InitTextVideo();
printf("\x1b[2J");
@ -316,15 +316,15 @@ s32 CheckForCIOS()
}
}
printf("\n\tReloading ios 249...");
ret = IOS_ReloadIOSsafe(249);
//Needed for Settings load of HDD
printf("\n\tReloading ios 222...");
ret = IOS_ReloadIOSsafe(222);
printf("%d", ret);
if (ret < 0)
{
printf("\n\tIOS 249 failed, reloading ios 222...");
ret = IOS_ReloadIOSsafe(222);
printf("\n\tIOS 222 failed, reloading ios 249...");
ret = IOS_ReloadIOSsafe(249);
printf("%d", ret);
if (ret < 0) {
printf("\n\tIOS 222 failed, reloading ios 250...");
@ -336,6 +336,7 @@ s32 CheckForCIOS()
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
}
}
}
else
{
SDCard_Init();
@ -344,7 +345,6 @@ s32 CheckForCIOS()
load_ehc_module();
SDCard_deInit();
}
}
return ret;
}
@ -352,45 +352,43 @@ s32 CheckForCIOS()
int LoadAppCIOS()
{
s32 ret = 1;
bool IOS_Reloaded = false;
/* Load Custom IOS */
if (Settings.cios == ios222 && IOS_GetVersion() != 222)
{
printf("\n\tReloading IOS to config setting (%d)...", ios222 ? 222 : 223);
SDCard_deInit();// unmount SD for reloading IOS
USBDevice_deInit();// unmount USB for reloading IOS
USBStorage_Deinit();
ret = IOS_ReloadIOSsafe(ios222 ? 222 : 223);
if (Settings.cios == ios222 && IOS_GetVersion() != 222)
{
printf("\n\tReloading IOS to config setting (222)...");
ret = IOS_ReloadIOSsafe(222);
printf("%d", ret);
if (ret < 0)
{
Settings.cios = ios249;
IOS_ReloadIOSsafe(249);
}
SDCard_Init();
USBDevice_Init(); // and mount USB:/
if(ret >= 0)
load_ehc_module();
IOS_Reloaded = true;
}
else if ((Settings.cios == ios249 && IOS_GetVersion() != 249) ||
(Settings.cios == ios250 && IOS_GetVersion() != 250))
if ((Settings.cios == ios249 && IOS_GetVersion() != 249)
|| (Settings.cios == ios250 && IOS_GetVersion() != 250))
{
printf("\n\tReloading IOS to config setting (%d)...", ios249 ? 249 : 250);
SDCard_deInit();// unmount SD for reloading IOS
USBDevice_deInit();// unmount USB for reloading IOS
USBStorage_Deinit();
ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
printf("\n\tReloading IOS to config setting (%d)...", (Settings.cios == ios249) ? 249 : 250);
ret = IOS_ReloadIOSsafe((Settings.cios == ios249) ? 249 : 250);
printf("%d", ret);
if (ret < 0) {
Settings.cios = ios222;
ret = IOS_ReloadIOSsafe(222);
SDCard_Init();
load_ehc_module();
}
IOS_Reloaded = true;
}
else SDCard_Init(); // now mount SD:/ //no need to keep mindlessly mounting and unmounting SD card
USBDevice_Init(); // and mount USB:/
}
SDCard_Init();
if(IOS_GetVersion() == 222 && IOS_Reloaded)
load_ehc_module();
USBDevice_Init();
return ret;
}