-added new option in wiiflow.ini, "force_cios_load", if it is

enabled wiiflow will always reload to the cIOS even if a normal
IOS with AHBPROT is found (disabled by default)
-enabled skip_list_check by default
-cleaned up a bit
This commit is contained in:
fix94.1 2012-08-24 18:01:40 +00:00
parent 99a2f9faad
commit 526d94a360
7 changed files with 74 additions and 79 deletions

View File

@ -30,6 +30,8 @@
#include "gc/gc.hpp" #include "gc/gc.hpp"
#include "fat.h" #include "fat.h"
#include "devicemounter/sdhc.h"
#include "devicemounter/usbstorage_libogc.h"
#include "gecko/gecko.h" #include "gecko/gecko.h"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "loader/utils.h" #include "loader/utils.h"
@ -212,7 +214,7 @@ void DEVO_GetLoader(const char *loader)
void DEVO_SetOptions(const char *isopath, const char *partition, const char *gameID, bool memcard_emu) void DEVO_SetOptions(const char *isopath, const char *partition, const char *gameID, bool memcard_emu)
{ {
// re-mount device we need // re-mount device we need
fatMountSimple(partition, strncasecmp(partition, "sd", 2) ? &__io_usbstorage : &__io_wiisd); fatMountSimple(partition, strncasecmp(partition, "sd", 2) ? &__io_usbstorage_ogc : &__io_sdhc);
//start writing cfg to mem //start writing cfg to mem
struct stat st; struct stat st;

View File

@ -81,23 +81,24 @@ void load_dip_249()
bool loadIOS(int ios, bool launch_game, bool emu_channel) bool loadIOS(int ios, bool launch_game, bool emu_channel)
{ {
#ifndef DOLPHIN bool ret = true;
bool iosOK = true;
if(ios != IOS_GetVersion())
{
m_music.Stop(); m_music.Stop();
Close_Inputs(); Close_Inputs();
DeviceHandler::Instance()->UnMountAll(); DeviceHandler::Instance()->UnMountAll();
WDVD_Close(); WDVD_Close();
USBStorage2_Deinit(); USBStorage2_Deinit();
mload_close();
#ifndef DOLPHIN
mload_close();
if(ios != IOS_GetVersion())
{
gprintf("Reloading into IOS %i from %i...\n", ios, IOS_GetVersion()); gprintf("Reloading into IOS %i from %i...\n", ios, IOS_GetVersion());
Nand::Instance()->DeInit_ISFS(); Nand::Instance()->DeInit_ISFS();
iosOK = IOS_ReloadIOS(ios) == 0; ret = IOS_ReloadIOS(ios) == 0;
Nand::Instance()->Init_ISFS(); Nand::Instance()->Init_ISFS();
gprintf("AHBPROT after IOS Reload: %u\n", (*HW_AHBPROT == 0xFFFFFFFF)); gprintf("AHBPROT after IOS Reload: %u\n", (*HW_AHBPROT == 0xFFFFFFFF));
} }
#endif
IOS_GetCurrentIOSInfo(); IOS_GetCurrentIOSInfo();
if(CurrentIOS.Type == IOS_TYPE_HERMES) if(CurrentIOS.Type == IOS_TYPE_HERMES)
@ -120,9 +121,5 @@ bool loadIOS(int ios, bool launch_game, bool emu_channel)
Open_Inputs(); Open_Inputs();
} }
} }
return ret;
return iosOK;
#else
return true;
#endif
} }

View File

@ -38,6 +38,7 @@ void Close_Inputs(void);
extern void __exception_setreload(int t); extern void __exception_setreload(int t);
extern int mainIOS; extern int mainIOS;
extern bool useMainIOS;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -22,6 +22,7 @@
#include "memory/memory.h" #include "memory/memory.h"
CMenu *mainMenu; CMenu *mainMenu;
bool useMainIOS;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@ -34,7 +35,6 @@ int main(int argc, char **argv)
Nand::Instance()->Init_ISFS(); Nand::Instance()->Init_ISFS();
MEM2_init(47); //Should be safe to use MEM2_init(47); //Should be safe to use
vid.waitMessage(0.15f);
gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV); gprintf(" \nWelcome to %s (%s-r%s)!\nThis is the debug output.\n", APP_NAME, APP_VERSION, SVN_REV);
char *gameid = NULL; char *gameid = NULL;
@ -92,16 +92,12 @@ int main(int argc, char **argv)
Sys_Init(); Sys_Init();
Sys_ExitTo(EXIT_TO_HBC); Sys_ExitTo(EXIT_TO_HBC);
int ret = 1;
while(ret == 1)
{
Open_Inputs(); //(re)init wiimote Open_Inputs(); //(re)init wiimote
#ifndef DOLPHIN #ifndef DOLPHIN
const DISC_INTERFACE *handle = DeviceHandler::GetUSB0Interface(); const DISC_INTERFACE *handle = DeviceHandler::GetUSB0Interface();
bool deviceAvailable = false; bool deviceAvailable = false;
u8 timeout = 0; u8 timeout = time(NULL);
while(!deviceAvailable && timeout++ != 20) while(!deviceAvailable && time(NULL) - timeout < 20)
{ {
deviceAvailable = (handle->startup() && handle->isInserted()); deviceAvailable = (handle->startup() && handle->isInserted());
if(deviceAvailable) if(deviceAvailable)
@ -112,36 +108,31 @@ int main(int argc, char **argv)
DeviceHandler::Instance()->MountAll(); DeviceHandler::Instance()->MountAll();
if(DeviceHandler::Instance()->IsInserted(SD)) if(DeviceHandler::Instance()->IsInserted(SD))
deviceAvailable = true; deviceAvailable = true;
vid.waitMessage(0.15f);
bool dipOK = Disc_Init() >= 0; bool dipOK = Disc_Init() >= 0;
mainMenu = new CMenu(vid); mainMenu = new CMenu(vid);
mainMenu->init(); mainMenu->init();
if(CurrentIOS.Version != mainIOS && useMainIOS)
iosOK = loadIOS(mainIOS, false, false) && CustomIOS(CurrentIOS.Type);
if(!iosOK) if(!iosOK)
{
mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games."); mainMenu->terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
break;
}
else if(!deviceAvailable) else if(!deviceAvailable)
{
mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!"); mainMenu->terror("errboot2", L"Could not find a device to save configuration files on!");
break;
}
else if(!dipOK) else if(!dipOK)
{
mainMenu->terror("errboot3", L"Could not initialize the DIP module!"); mainMenu->terror("errboot3", L"Could not initialize the DIP module!");
break;
}
else if(gameid != NULL && strlen(gameid) == 6) else if(gameid != NULL && strlen(gameid) == 6)
mainMenu->directlaunch(gameid); mainMenu->directlaunch(gameid);
else else
{ {
if(Emulator_boot) if(Emulator_boot)
mainMenu->m_Emulator_boot = true; mainMenu->m_Emulator_boot = true;
ret = mainMenu->main(); mainMenu->main();
}
} }
mainMenu->cleanup(); mainMenu->cleanup();
DeviceHandler::Instance()->UnMountAll();
Nand::Instance()->DeInit_ISFS(); Nand::Instance()->DeInit_ISFS();
Sys_Exit(); Sys_Exit();
exit(1); exit(1);

View File

@ -213,7 +213,7 @@ void CMenu::init(void)
WriteToSD = m_cfg.getBool("DEBUG", "sd_write_log", false); WriteToSD = m_cfg.getBool("DEBUG", "sd_write_log", false);
bufferMessages = WriteToSD; bufferMessages = WriteToSD;
} }
useMainIOS = m_cfg.getBool("GENERAL", "force_cios_load", false);
bool onUSB = m_cfg.getBool("GENERAL", "data_on_usb", strncmp(drive, "usb", 3) == 0); bool onUSB = m_cfg.getBool("GENERAL", "data_on_usb", strncmp(drive, "usb", 3) == 0);
drive = check; //reset the drive variable for the check drive = check; //reset the drive variable for the check
@ -417,7 +417,7 @@ void CMenu::init(void)
m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str())); m_loc.load(fmt("%s/%s.ini", m_languagesDir.c_str(), m_curLanguage.c_str()));
} }
bool extcheck = m_cfg.getBool("GENERAL", "extended_list_check", false); bool extcheck = m_cfg.getBool("GENERAL", "extended_list_check", false);
bool skipcheck = m_cfg.getBool("GENERAL", "skip_list_check", false); bool skipcheck = m_cfg.getBool("GENERAL", "skip_list_check", true);
m_tempView = false; m_tempView = false;
m_gameList.Init(m_listCacheDir, m_settingsDir, m_loc.getString(m_curLanguage, "gametdb_code", "EN"), m_DMLgameDir, extcheck, skipcheck); m_gameList.Init(m_listCacheDir, m_settingsDir, m_loc.getString(m_curLanguage, "gametdb_code", "EN"), m_DMLgameDir, extcheck, skipcheck);
@ -492,7 +492,7 @@ void CMenu::init(void)
bool cleaned_up = false; bool cleaned_up = false;
void CMenu::cleanup(bool hb) void CMenu::cleanup()
{ {
if(cleaned_up) if(cleaned_up)
return; return;
@ -508,8 +508,6 @@ void CMenu::cleanup(bool hb)
SoundHandler::DestroyInstance(); SoundHandler::DestroyInstance();
soundDeinit(); soundDeinit();
if(!hb)
DeviceHandler::DestroyInstance();
m_vid.cleanup(); m_vid.cleanup();
m_cf.shutdown(); m_cf.shutdown();

View File

@ -28,10 +28,7 @@
using namespace std; using namespace std;
extern "C" extern "C" { extern u8 currentPartition; }
{
extern u8 currentPartition;
}
class CMenu class CMenu
{ {
@ -43,7 +40,7 @@ public:
void terror(const char *key, const wchar_t *msg) { error(_fmt(key, msg)); } void terror(const char *key, const wchar_t *msg) { error(_fmt(key, msg)); }
void exitHandler(int ExitTo); void exitHandler(int ExitTo);
int main(void); int main(void);
void cleanup(bool hb = false); void cleanup(void);
u8 m_current_view; u8 m_current_view;
private: private:
struct SZone struct SZone

View File

@ -866,6 +866,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
m_cfg.save(true); m_cfg.save(true);
cleanup(); cleanup();
DeviceHandler::Instance()->UnMountAll();
#ifndef DOLPHIN #ifndef DOLPHIN
USBStorage2_Deinit(); USBStorage2_Deinit();
USB_Deinitialize(); USB_Deinitialize();
@ -898,10 +899,10 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
m_cfg.save(true); m_cfg.save(true);
Playlog_Delete(); Playlog_Delete();
cleanup(true); // wifi and sd gecko doesnt work anymore after cleanup cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
LoadHomebrew(filepath); LoadHomebrew(filepath);
DeviceHandler::DestroyInstance(); //homebrew loaded, we can unmount devices now DeviceHandler::Instance()->UnMountAll(); //homebrew loaded, we can unmount devices now
AddBootArgument(filepath); AddBootArgument(filepath);
for(u32 i = 0; i < arguments.size(); ++i) for(u32 i = 0; i < arguments.size(); ++i)
AddBootArgument(arguments[i].c_str()); AddBootArgument(arguments[i].c_str());
@ -988,6 +989,12 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool emu_channel)
} }
return LOAD_IOS_SUCCEEDED; return LOAD_IOS_SUCCEEDED;
} }
else
{
DeviceHandler::Instance()->Mount(currentPartition);
DeviceHandler::Instance()->Open_WBFS(currentPartition);
Disc_Init();
}
return LOAD_IOS_NOT_NEEDED; return LOAD_IOS_NOT_NEEDED;
} }
@ -1087,6 +1094,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
m_gcfg2.save(true); m_gcfg2.save(true);
m_cat.save(true); m_cat.save(true);
m_cfg.save(true); m_cfg.save(true);
cleanup();
if(useNK2o && !emu_disabled) if(useNK2o && !emu_disabled)
{ {
@ -1095,12 +1103,11 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup")); error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
Sys_LoadMenu(); Sys_LoadMenu();
} }
cleanup(); DeviceHandler::Instance()->UnMountAll();
Launch_nk(gameTitle, emuPath.c_str()); Launch_nk(gameTitle, emuPath.c_str());
while(1); while(1);
} }
else DeviceHandler::Instance()->UnMountAll();
cleanup();
if(!forwarder) if(!forwarder)
{ {
@ -1366,6 +1373,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
m_cat.save(true); m_cat.save(true);
m_cfg.save(true); m_cfg.save(true);
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
DeviceHandler::Instance()->UnMountAll();
#ifndef DOLPHIN #ifndef DOLPHIN
bool iosLoaded = false; bool iosLoaded = false;
if(!dvd || neek2o()) if(!dvd || neek2o())