2010-12-31 00:49:22 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
#include "StartUpProcess.h"
|
2011-06-14 19:53:19 +02:00
|
|
|
#include "GUI/gui.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "video.h"
|
|
|
|
#include "audio.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "themes/CTheme.h"
|
|
|
|
#include "gecko.h"
|
2019-11-11 21:00:00 +01:00
|
|
|
#include "wpad.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "Controls/DeviceHandler.hpp"
|
|
|
|
#include "wad/nandtitle.h"
|
2012-05-06 12:59:58 +02:00
|
|
|
#include "SystemMenu/SystemMenuResources.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "system/IosLoader.h"
|
2019-08-26 19:53:21 +02:00
|
|
|
#include "libs/libruntimeiospatch/runtimeiospatch.h"
|
2011-05-28 21:52:00 +02:00
|
|
|
#include "utils/timer.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "settings/CSettings.h"
|
|
|
|
#include "settings/CGameSettings.h"
|
|
|
|
#include "settings/CGameStatistics.h"
|
2011-06-03 22:31:09 +02:00
|
|
|
#include "settings/CGameCategories.hpp"
|
2012-01-08 19:24:46 +01:00
|
|
|
#include "settings/GameTitles.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "usbloader/usbstorage2.h"
|
2011-06-14 19:53:19 +02:00
|
|
|
#include "usbloader/MountGamePartition.h"
|
|
|
|
#include "usbloader/GameBooter.hpp"
|
|
|
|
#include "usbloader/GameList.h"
|
|
|
|
#include "utils/tools.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
#include "sys.h"
|
2015-04-04 18:04:30 +02:00
|
|
|
#include "svnrev.h"
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2019-08-26 19:53:21 +02:00
|
|
|
extern bool isWiiVC; // in sys.cpp
|
|
|
|
|
2010-12-31 00:49:22 +01:00
|
|
|
StartUpProcess::StartUpProcess()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
//! Load default font for the next text outputs
|
|
|
|
Theme::LoadFont("");
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
background = new GuiImage(screenwidth, screenheight, (GXColor) {0, 0, 0, 255});
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GXImageData = Resources::GetImageData("gxlogo.png");
|
|
|
|
GXImage = new GuiImage(GXImageData);
|
|
|
|
GXImage->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
|
|
|
|
GXImage->SetPosition(screenwidth/2, screenheight/2-50);
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
titleTxt = new GuiText("Loading...", 24, (GXColor) {255, 255, 255, 255});
|
|
|
|
titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
|
|
|
|
titleTxt->SetPosition(screenwidth/2, screenheight/2+30);
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
messageTxt = new GuiText(" ", 22, (GXColor) {255, 255, 255, 255});
|
|
|
|
messageTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
|
|
|
|
messageTxt->SetPosition(screenwidth/2, screenheight/2+60);
|
2011-11-20 11:46:07 +01:00
|
|
|
|
2015-06-28 16:13:52 +02:00
|
|
|
versionTxt = new GuiText(" ", 18, (GXColor) {255, 255, 255, 255});
|
2015-04-04 18:04:30 +02:00
|
|
|
versionTxt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
|
|
|
versionTxt->SetPosition(20, screenheight-20);
|
|
|
|
|
|
|
|
#ifdef FULLCHANNEL
|
2015-07-05 16:44:24 +02:00
|
|
|
versionTxt->SetTextf("v3.0c Rev. %s", GetRev());
|
2015-04-04 18:04:30 +02:00
|
|
|
#else
|
2015-07-05 16:44:24 +02:00
|
|
|
versionTxt->SetTextf("v3.0 Rev. %s", GetRev());
|
2015-04-04 18:04:30 +02:00
|
|
|
#endif
|
|
|
|
|
2019-08-26 19:53:21 +02:00
|
|
|
#if 1 // enable if you release a modded version - enabled by default to differentiate official releases
|
2015-07-05 16:44:24 +02:00
|
|
|
versionTxt->SetTextf("v3.0 Rev. %s mod", GetRev());
|
2015-04-04 18:04:30 +02:00
|
|
|
#endif
|
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
cancelTxt = new GuiText("Press B to cancel", 18, (GXColor) {255, 255, 255, 255});
|
|
|
|
cancelTxt->SetAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
|
|
|
|
cancelTxt->SetPosition(screenwidth/2, screenheight/2+90);
|
|
|
|
|
|
|
|
trigB = new GuiTrigger;
|
|
|
|
trigB->SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
|
|
|
|
|
|
|
cancelBtn = new GuiButton(0, 0);
|
|
|
|
cancelBtn->SetTrigger(trigB);
|
|
|
|
|
|
|
|
drawCancel = false;
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
StartUpProcess::~StartUpProcess()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
delete background;
|
|
|
|
delete GXImageData;
|
|
|
|
delete GXImage;
|
|
|
|
delete titleTxt;
|
2011-12-28 10:55:00 +01:00
|
|
|
delete messageTxt;
|
2015-04-04 18:04:30 +02:00
|
|
|
delete versionTxt;
|
2011-11-20 11:46:07 +01:00
|
|
|
delete cancelTxt;
|
|
|
|
delete cancelBtn;
|
|
|
|
delete trigB;
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
2011-06-14 19:53:19 +02:00
|
|
|
int StartUpProcess::ParseArguments(int argc, char *argv[])
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
int quickBoot = -1;
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
//! The arguments override
|
|
|
|
for(int i = 0; i < argc; ++i)
|
|
|
|
{
|
|
|
|
if(!argv[i]) continue;
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
gprintf("Boot argument %i: %s\n", i+1, argv[i]);
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
char *ptr = strcasestr(argv[i], "-ios=");
|
|
|
|
if(ptr)
|
2013-10-01 23:13:08 +02:00
|
|
|
{
|
|
|
|
if(atoi(ptr+strlen("-ios=")) == 58)
|
|
|
|
Settings.LoaderIOS = 58;
|
|
|
|
else
|
|
|
|
Settings.LoaderIOS = LIMIT(atoi(ptr+strlen("-ios=")), 200, 255);
|
|
|
|
Settings.UseArgumentIOS = ON;
|
|
|
|
}
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
ptr = strcasestr(argv[i], "-usbport=");
|
|
|
|
if(ptr)
|
|
|
|
{
|
|
|
|
Settings.USBPort = LIMIT(atoi(ptr+strlen("-usbport=")), 0, 2);
|
|
|
|
}
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2014-05-04 16:42:52 +02:00
|
|
|
ptr = strcasestr(argv[i], "-mountusb=");
|
|
|
|
if(ptr)
|
|
|
|
{
|
|
|
|
Settings.USBAutoMount = LIMIT(atoi(ptr+strlen("-mountusb=")), 0, 1);
|
|
|
|
}
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(strlen(argv[i]) == 6 && strchr(argv[i], '=') == 0 && strchr(argv[i], '-') == 0)
|
|
|
|
quickBoot = i;
|
|
|
|
}
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return quickBoot;
|
2011-06-14 19:53:19 +02:00
|
|
|
}
|
|
|
|
|
2010-12-31 00:49:22 +01:00
|
|
|
void StartUpProcess::TextFade(int direction)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(direction > 0)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < 255; i += direction)
|
|
|
|
{
|
|
|
|
messageTxt->SetAlpha(i);
|
|
|
|
Draw();
|
|
|
|
}
|
|
|
|
messageTxt->SetAlpha(255);
|
|
|
|
Draw();
|
|
|
|
}
|
|
|
|
else if(direction < 0)
|
|
|
|
{
|
|
|
|
for(int i = 255; i > 0; i += direction)
|
|
|
|
{
|
|
|
|
messageTxt->SetAlpha(i);
|
|
|
|
Draw();
|
|
|
|
}
|
|
|
|
messageTxt->SetAlpha(0);
|
|
|
|
Draw();
|
|
|
|
}
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void StartUpProcess::SetTextf(const char * format, ...)
|
|
|
|
{
|
|
|
|
char * tmp = NULL;
|
|
|
|
va_list va;
|
|
|
|
va_start(va, format);
|
|
|
|
if((vasprintf(&tmp, format, va) >= 0) && tmp)
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
|
|
|
TextFade(-40);
|
|
|
|
gprintf(tmp);
|
|
|
|
messageTxt->SetText(tmp);
|
|
|
|
TextFade(40);
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
va_end(va);
|
|
|
|
|
|
|
|
if(tmp)
|
2011-07-26 00:28:22 +02:00
|
|
|
free(tmp);
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool StartUpProcess::USBSpinUp()
|
|
|
|
{
|
2011-11-20 11:46:07 +01:00
|
|
|
drawCancel = true;
|
2011-07-26 00:28:22 +02:00
|
|
|
Timer countDown;
|
2013-03-17 14:48:15 +01:00
|
|
|
bool started0 = false;
|
|
|
|
bool started1 = false;
|
|
|
|
|
|
|
|
const DISC_INTERFACE * handle0 = NULL;
|
|
|
|
const DISC_INTERFACE * handle1 = NULL;
|
|
|
|
if(Settings.USBPort == 0 || Settings.USBPort == 2)
|
|
|
|
handle0 = DeviceHandler::GetUSB0Interface();
|
|
|
|
if(Settings.USBPort == 1 || Settings.USBPort == 2)
|
|
|
|
handle1 = DeviceHandler::GetUSB1Interface();
|
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
// wait 20 sec for the USB to spin up...stupid slow ass HDD
|
2011-07-26 00:28:22 +02:00
|
|
|
do
|
|
|
|
{
|
2013-03-17 14:48:15 +01:00
|
|
|
if(handle0)
|
|
|
|
started0 = (handle0->startup() && handle0->isInserted());
|
|
|
|
|
|
|
|
if(handle1)
|
|
|
|
started1 = (handle1->startup() && handle1->isInserted());
|
|
|
|
|
|
|
|
if( (!handle0 || started0)
|
|
|
|
&& (!handle1 || started1)) {
|
2011-07-26 00:28:22 +02:00
|
|
|
break;
|
2013-03-17 14:48:15 +01:00
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
|
|
|
|
UpdatePads();
|
|
|
|
for(int i = 0; i < 4; ++i)
|
|
|
|
cancelBtn->Update(&userInput[i]);
|
|
|
|
|
|
|
|
if(cancelBtn->GetState() == STATE_CLICKED)
|
|
|
|
break;
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
messageTxt->SetTextf("Waiting for HDD: %i sec left\n", 20-(int)countDown.elapsed());
|
|
|
|
Draw();
|
|
|
|
usleep(50000);
|
|
|
|
}
|
|
|
|
while(countDown.elapsed() < 20.f);
|
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
drawCancel = false;
|
|
|
|
|
2013-03-17 14:48:15 +01:00
|
|
|
return (started0 || started1);
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
2011-06-14 19:53:19 +02:00
|
|
|
int StartUpProcess::Run(int argc, char *argv[])
|
2010-12-31 00:49:22 +01:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
int quickGameBoot = ParseArguments(argc, argv);
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
StartUpProcess Process;
|
2010-12-31 00:49:22 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
int ret = Process.Execute();
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(quickGameBoot != -1)
|
|
|
|
return QuickGameBoot(argv[quickGameBoot]);
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return ret;
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
2011-06-14 19:53:19 +02:00
|
|
|
int StartUpProcess::Execute()
|
2010-12-31 00:49:22 +01:00
|
|
|
{
|
2011-07-23 21:49:51 +02:00
|
|
|
Settings.EntryIOS = IOS_GetVersion();
|
2012-05-06 12:59:58 +02:00
|
|
|
|
2019-11-11 21:00:00 +01:00
|
|
|
// Reloading to IOS 249 fixes compatibility issues with old forwarders
|
|
|
|
IosLoader::ReloadIosSafe(249);
|
|
|
|
|
|
|
|
// Reload to the default IOS or the IOS set in meta.xml
|
2014-04-25 17:34:53 +02:00
|
|
|
SetTextf("Loading application cIOS %s\n", Settings.UseArgumentIOS ? "requested in meta.xml" : "");
|
|
|
|
if(IosLoader::LoadAppCios() < 0)
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
2014-04-25 17:34:53 +02:00
|
|
|
SetTextf("Failed loading any cIOS. Trying with IOS58 + AHB access...");
|
|
|
|
|
|
|
|
// We can allow now operation without cIOS in channel mode with AHB access
|
|
|
|
if(!AHBPROT_DISABLED || (AHBPROT_DISABLED && IOS_GetVersion() != 58))
|
2013-10-01 23:13:08 +02:00
|
|
|
{
|
2014-04-25 17:34:53 +02:00
|
|
|
SetTextf("Failed loading IOS 58. USB Loader GX requires a cIOS or IOS 58 with AHB access. Exiting...\n");
|
|
|
|
sleep(5);
|
|
|
|
Sys_BackToLoader();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-04-04 18:04:30 +02:00
|
|
|
Settings.LoaderIOS = 58;
|
2014-04-25 17:34:53 +02:00
|
|
|
SetTextf("Running on IOS 58. Wii disc based games and some channels will not work.");
|
2013-10-01 23:13:08 +02:00
|
|
|
sleep(5);
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
2019-11-11 21:00:00 +01:00
|
|
|
|
2014-04-25 17:34:53 +02:00
|
|
|
if(!AHBPROT_DISABLED && IOS_GetVersion() < 200)
|
|
|
|
{
|
|
|
|
SetTextf("Failed loading IOS %i. USB Loader GX requires a cIOS or IOS58 with AHB access. Exiting...\n", IOS_GetVersion());
|
|
|
|
sleep(5);
|
|
|
|
Sys_BackToLoader();
|
|
|
|
}
|
|
|
|
|
2013-10-01 23:13:08 +02:00
|
|
|
SetTextf("Using %sIOS %i\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
|
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
SetupPads();
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
SetTextf("Initialize sd card\n");
|
|
|
|
DeviceHandler::Instance()->MountSD();
|
|
|
|
|
2019-08-26 19:53:21 +02:00
|
|
|
// Do not mount USB if not needed. USB is not available with WiiU WiiVC injected channel.
|
|
|
|
if(Settings.USBAutoMount == ON && !isWiiVC)
|
2014-04-25 17:34:53 +02:00
|
|
|
{
|
|
|
|
SetTextf("Initialize usb device\n");
|
|
|
|
USBSpinUp();
|
|
|
|
DeviceHandler::Instance()->MountAllUSB(false);
|
|
|
|
}
|
2014-05-04 16:42:52 +02:00
|
|
|
|
|
|
|
SetTextf("Loading config files\n");
|
|
|
|
|
|
|
|
gprintf("\tLoading config...%s\n", Settings.Load() ? "done" : "failed");
|
2011-07-26 00:28:22 +02:00
|
|
|
gprintf("\tLoading language...%s\n", Settings.LoadLanguage(Settings.language_path, CONSOLE_DEFAULT) ? "done" : "failed");
|
|
|
|
gprintf("\tLoading game settings...%s\n", GameSettings.Load(Settings.ConfigPath) ? "done" : "failed");
|
|
|
|
gprintf("\tLoading game statistics...%s\n", GameStatistics.Load(Settings.ConfigPath) ? "done" : "failed");
|
2013-10-01 23:13:08 +02:00
|
|
|
gprintf("\tLoading game categories...%s\n", GameCategories.Load(Settings.ConfigPath) ? "done" : "failed");
|
|
|
|
if(Settings.CacheTitles)
|
|
|
|
gprintf("\tLoading cached titles...%s\n", GameTitles.ReadCachedTitles(Settings.titlestxt_path) ? "done" : "failed (using default)");
|
2019-08-26 19:53:21 +02:00
|
|
|
|
|
|
|
// Reload to user's settings if different than current IOS, and if not using an injected WiiU WiiVC IOS255 (fw.img)
|
|
|
|
if(Settings.LoaderIOS != IOS_GetVersion() && !isWiiVC)
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
2019-11-11 21:00:00 +01:00
|
|
|
SetTextf("Reloading to config files cIOS...\n");
|
2013-10-01 23:13:08 +02:00
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
// Unmount devices
|
2011-07-26 00:28:22 +02:00
|
|
|
DeviceHandler::DestroyInstance();
|
2014-04-25 17:34:53 +02:00
|
|
|
if(Settings.USBAutoMount == ON)
|
|
|
|
USBStorage2_Deinit();
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
// Shut down pads
|
2019-11-11 21:00:00 +01:00
|
|
|
Wpad_Disconnect();
|
2011-11-20 11:46:07 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
// Loading now the cios setup in the settings
|
|
|
|
IosLoader::LoadAppCios();
|
|
|
|
|
2013-10-01 23:13:08 +02:00
|
|
|
SetTextf("Reloaded into cIOS %i R%i\n", IOS_GetVersion(), IOS_GetRevision());
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-11-20 11:46:07 +01:00
|
|
|
// Re-Mount devices
|
2013-10-01 23:13:08 +02:00
|
|
|
SetTextf("Reinitializing devices...\n");
|
2011-07-26 00:28:22 +02:00
|
|
|
DeviceHandler::Instance()->MountSD();
|
2014-04-25 17:34:53 +02:00
|
|
|
if(Settings.USBAutoMount == ON)
|
|
|
|
{
|
|
|
|
USBSpinUp();
|
|
|
|
DeviceHandler::Instance()->MountAllUSB(false);
|
|
|
|
}
|
2011-11-20 11:46:07 +01:00
|
|
|
|
|
|
|
// Start pads again
|
|
|
|
SetupPads();
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
|
|
|
|
2012-05-06 12:59:58 +02:00
|
|
|
if(!IosLoader::IsHermesIOS() && !IosLoader::IsD2X())
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
|
|
|
Settings.USBPort = 0;
|
|
|
|
}
|
|
|
|
else if(Settings.USBPort == 1 && USBStorage2_GetPort() != Settings.USBPort)
|
|
|
|
{
|
2019-08-26 19:53:21 +02:00
|
|
|
if(Settings.USBAutoMount == ON && !isWiiVC)
|
2014-04-25 17:34:53 +02:00
|
|
|
{
|
|
|
|
SetTextf("Changing USB Port to %i\n", Settings.USBPort);
|
|
|
|
DeviceHandler::Instance()->UnMountAllUSB();
|
|
|
|
DeviceHandler::Instance()->MountAllUSB();
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
|
|
|
else if(Settings.USBPort == 2)
|
|
|
|
{
|
2019-08-26 19:53:21 +02:00
|
|
|
if(Settings.USBAutoMount == ON && !isWiiVC)
|
2014-04-25 17:34:53 +02:00
|
|
|
{
|
|
|
|
SetTextf("Mounting USB Port to 1\n");
|
|
|
|
DeviceHandler::Instance()->MountUSBPort1();
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
2013-10-01 23:13:08 +02:00
|
|
|
|
2019-08-26 19:53:21 +02:00
|
|
|
// enable isfs permission if using Hermes v4 without AHB, or WiiU WiiVC (IOS255 fw.img)
|
|
|
|
if(IOS_GetVersion() < 200 || (IosLoader::IsHermesIOS() && IOS_GetRevision() == 4) || isWiiVC)
|
2013-10-01 23:13:08 +02:00
|
|
|
{
|
|
|
|
SetTextf("Patching %sIOS%d...\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
|
2019-08-26 19:53:21 +02:00
|
|
|
if (IosPatch_RUNTIME(!isWiiVC, false, false, isWiiVC, false) == ERROR_PATCH)
|
2013-10-01 23:13:08 +02:00
|
|
|
gprintf("Patching %sIOS%d failed!\n", IOS_GetVersion() >= 200 ? "c" : "", IOS_GetVersion());
|
|
|
|
else
|
|
|
|
NandTitles.Get(); // get NAND channel's titles
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
// We only initialize once for the whole session
|
|
|
|
ISFS_Initialize();
|
|
|
|
|
2013-10-01 23:13:08 +02:00
|
|
|
// Check MIOS version
|
|
|
|
SetTextf("Checking installed MIOS... ");
|
|
|
|
IosLoader::GetMIOSInfo();
|
|
|
|
|
2012-05-06 12:59:58 +02:00
|
|
|
SetTextf("Loading resources\n");
|
|
|
|
// Do not allow banner grid mode without AHBPROT
|
|
|
|
// this function does nothing if it was already initiated before
|
|
|
|
if( !SystemMenuResources::Instance()->IsLoaded() && !SystemMenuResources::Instance()->Init()
|
|
|
|
&& Settings.gameDisplay == BANNERGRID_MODE)
|
|
|
|
{
|
|
|
|
Settings.gameDisplay = LIST_MODE;
|
|
|
|
Settings.GameWindowMode = GAMEWINDOW_DISC;
|
|
|
|
}
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
gprintf("\tLoading font...%s\n", Theme::LoadFont(Settings.ConfigPath) ? "done" : "failed (using default)");
|
|
|
|
gprintf("\tLoading theme...%s\n", Theme::Load(Settings.theme) ? "done" : "failed (using default)");
|
|
|
|
|
|
|
|
//! Init the rest of the System
|
|
|
|
Sys_Init();
|
|
|
|
InitAudio();
|
|
|
|
setlocale(LC_CTYPE, "C-UTF-8");
|
|
|
|
setlocale(LC_MESSAGES, "C-UTF-8");
|
2012-02-05 19:38:26 +01:00
|
|
|
AdjustOverscan(Settings.AdjustOverscanX, Settings.AdjustOverscanY);
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
return 0;
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void StartUpProcess::Draw()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
background->Draw();
|
|
|
|
GXImage->Draw();
|
|
|
|
titleTxt->Draw();
|
|
|
|
messageTxt->Draw();
|
2015-04-04 18:04:30 +02:00
|
|
|
versionTxt->Draw();
|
2011-11-20 11:46:07 +01:00
|
|
|
if(drawCancel)
|
|
|
|
cancelTxt->Draw();
|
2011-07-26 00:28:22 +02:00
|
|
|
Menu_Render();
|
2010-12-31 00:49:22 +01:00
|
|
|
}
|
2011-06-14 19:53:19 +02:00
|
|
|
|
|
|
|
int StartUpProcess::QuickGameBoot(const char * gameID)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
MountGamePartition(false);
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
struct discHdr *header = NULL;
|
|
|
|
for(int i = 0; i < gameList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp((char *) gameList[i]->id, gameID, 6) == 0)
|
|
|
|
header = gameList[i];
|
|
|
|
}
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!header)
|
|
|
|
return -1;
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GameStatistics.SetPlayCount(header->id, GameStatistics.GetPlayCount(header->id)+1);
|
|
|
|
GameStatistics.Save();
|
2011-06-14 19:53:19 +02:00
|
|
|
|
2011-12-22 23:44:48 +01:00
|
|
|
return GameBooter::BootGame(header);
|
2011-06-14 19:53:19 +02:00
|
|
|
}
|