WiiFlow_Lite/source/main.cpp

121 lines
3.3 KiB
C++
Raw Normal View History

2012-01-21 21:57:41 +01:00
#include <ogc/system.h>
#include <unistd.h>
#include "const_str.hpp"
#include "booter/external_booter.hpp"
#include "channel/nand.hpp"
#include "channel/nand_save.hpp"
#include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.hpp"
#include "gui/video.hpp"
#include "gui/text.hpp"
#include "homebrew/homebrew.h"
#include "loader/alt_ios_gen.h"
#include "loader/wdvd.h"
#include "loader/alt_ios.h"
#include "loader/sys.h"
#include "loader/wbfs.h"
#include "loader/cios.h"
#include "loader/nk.h"
#include "menu/menu.hpp"
#include "memory/memory.h"
bool useMainIOS = false;
volatile bool NANDemuView = false;
volatile bool networkInit = false;
2012-01-21 21:57:41 +01:00
int main(int argc, char **argv)
{
MEM_init(); //Inits both mem1lo and mem2
mainIOS = DOL_MAIN_IOS;
__exception_setreload(10);
Gecko_Init(); //USB Gecko and SD/WiFi buffer
gprintf(" \nWelcome to %s!\nThis is the debug output.\n", VERSION_STRING.c_str());
2012-10-15 07:12:18 +02:00
m_vid.init(); // Init video
DeviceHandle.Init();
NandHandle.Init();
2012-01-21 21:57:41 +01:00
char *gameid = NULL;
bool Emulator_boot = false;
bool iosOK = true;
2012-01-21 21:57:41 +01:00
for(u8 i = 0; i < argc; i++)
2012-01-21 21:57:41 +01:00
{
if(argv[i] != NULL && strcasestr(argv[i], "ios=") != NULL && strlen(argv[i]) > 4)
2012-01-21 21:57:41 +01:00
{
while(argv[i][0] && !isdigit(argv[i][0]))
argv[i]++;
2012-01-21 21:57:41 +01:00
if (atoi(argv[i]) < 254 && atoi(argv[i]) > 0)
mainIOS = atoi(argv[i]);
}
else if(strlen(argv[i]) == 6)
2012-01-21 21:57:41 +01:00
{
gameid = argv[i];
for(u8 i = 0; i < 5; i++)
{
if(!isalnum(gameid[i]))
2012-01-21 21:57:41 +01:00
gameid = NULL;
}
2012-01-21 21:57:41 +01:00
}
else if(argv[i] != NULL && strcasestr(argv[i], "EMULATOR_MAGIC") != NULL)
Emulator_boot = true;
2012-01-21 21:57:41 +01:00
}
check_neek2o();
/* Init ISFS */
if(neek2o() || Sys_DolphinMode())
NandHandle.Init_ISFS();
else
NandHandle.LoadDefaultIOS(); /* safe reload to preferred IOS */
/* Maybe new IOS and Port settings */
if(InternalSave.CheckSave())
InternalSave.LoadSettings();
/* Handle (c)IOS Loading */
if(neek2o() || Sys_DolphinMode()) /* wont reload anythin */
iosOK = loadIOS(IOS_GetVersion(), false);
else if(useMainIOS && CustomIOS(IOS_GetType(mainIOS))) /* Requested */
iosOK = loadIOS(mainIOS, false) && CustomIOS(CurrentIOS.Type);
2012-01-21 21:57:41 +01:00
// Init
Sys_Init();
Sys_ExitTo(EXIT_TO_HBC);
2012-09-22 15:47:52 +02:00
DeviceHandle.MountAll();
m_vid.waitMessage(0.15f);
2012-01-21 21:57:41 +01:00
Open_Inputs();
mainMenu.init();
if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode())
{
2012-09-22 15:47:52 +02:00
if(useMainIOS || !DeviceHandle.UsablePartitionMounted())
{
useMainIOS = false;
mainMenu.TempLoadIOS();
iosOK = CustomIOS(CurrentIOS.Type);
}
}
if(CurrentIOS.Version == mainIOS)
useMainIOS = true; //Needed for later checks
if(!iosOK)
mainMenu.terror("errboot1", L"No cIOS found!\ncIOS d2x 249 base 56 and 250 base 57 are enough for all your games.");
2012-09-22 15:47:52 +02:00
else if(!DeviceHandle.UsablePartitionMounted())
mainMenu.terror("errboot2", L"Could not find a device to save configuration files on!");
else if(WDVD_Init() < 0)
mainMenu.terror("errboot3", L"Could not initialize the DIP module!");
else
{
writeStub();
if(Emulator_boot)
mainMenu.m_Emulator_boot = true;
if(gameid != NULL && strlen(gameid) == 6)
mainMenu.directlaunch(gameid);
else
mainMenu.main();
}
//Exit WiiFlow, no game booted...
-updating wiiflow lite to beta 4.3.0 -fixed using categories to hide GC disc 2's. Apparently this has never really worked right for some time or ever. -fixed deleting the cached cover texture file for plugin games. Delete cover for plugins only deletes the cached texture file (.wfc) -fixed favorites and adultonly (parental lock) for plugin games. Apparently I may have broke this a few revisions back. -favorites and adultonly for plugin games now have their own domains in gamecfg1- [FAVORITES_PLUGINS] and [ADULTONLY_PLUGINS]. just makes it more organized. -only wii, GC, channels are added to [PLAYCOUNT] and [LAST_PLAYED] in gamecfg1. -now loading gamecfg1 at startup and leaving it loaded till exit. no more loading it and unloading all the time. -fixed scrolling for game_info synopsis, credits, and help text. -made source menu buttons wider for wiiflow default. old 80x80, now 100x80. looks better. -display music info now defaults to off -screensaver_disabled now defaults to yes -show GC view button is now on by default no matter what. the only way it is disabled is if you edit wiiflow.ini manually. this is how all the view buttons work. -removed hiding homebrew button but if wiiflow locked it won't work or in sourceflow it won't show. -dump_list is now under [GENERAL] instead of each view. Also only works for Wii, GC, and channels. -sorting only works for Wii, GC, and Channels now. disabled for sourceflow, plugins, homebrew, and combined view. -now if no games are found a message is shown with the current path so you can see where wiiflow is looking. (except for plugins) -removed auto create emuNAND for emuNAND view if gamelist is empty. just go to settings>NAND settings if you want to extract or disable it. -now when no games are found all buttons at bottom are still accessible allowing you to change the view or go to settings and change current partition or path and even extract your NAND to create a EmuNAND. Or go to Home Menu and Install a Wii or GC game. -removed auto extract NAND to emuNAND when launching a Wii game with EmuNAND save. Now a message is diplayed saying 'emuNAND for saves not found - using real NAND'. -made the speed at which cover titles fade in/out almost instantly. -removed update button from Home Menu. online update code is still there but not used and probably won't be used any more as there just isn't a need for it now. -removed ftp button from Home Menu and all code for the FTP server. I just use WiiXplorer's FTP server. it seems to work better for me. -disabled keep USB Alive thread for now. i think there's a possibilty it might be the cause of my SD/USB files getting corrupted. -removed Btn B and - combo to switch partitions. didn't seem useful anymore. -redid nand emulation settings menu. looks like this now: pg1 Select EmuNAND EmuNAND Enulation Select SaveNAND SaveNAND Emulation pg2 Extract Saves All Missing Extract NAND Select Saves Partition -no longer blocking Select Plugin menu and View icons when using source menu combined view -now Select Plugins Menu is like switching to plugin view but you get to choose the plugins first -now [PLUGIN] partition= is the default partition for all plugins. to change individual plugins add 'romPartition=x' to the plugin ini. x is the partition number 0 thru 8 with SD being 0. this is how my usbloadergx plugin mod works.
2016-10-05 01:44:13 +02:00
mainMenu.cleanup();// cleanup and clear memory
ShutdownBeforeExit();// unmount devices and close inputs
2012-01-21 21:57:41 +01:00
Sys_Exit();
return 0;
}