* decided to officially commit my recent update patches *

- fixed gc ciso games to show and launch via WFL. thanks CokeCookie for getting me to fix it. note banners do not show for ciso games unless you use a custom gc banner.
- added (for wii u vwii) to be able to select Wii U channel as the exit to choice either via main cfg pg 4 exit to option or home menu>exit to menu and select wii u menu. 
- removed priiloader and bootmii as exit to options when on wii u vwii
- added random select game option. manually edit wiiflow_lite.ini and under [GENERAL] set "random_select" to yes then while in wiiflow lite main screen hold B and press '-' to have WFL random select a game instead of random boot a game.
- removed region change from savenand emulation types. why? because according to overjoy's commit he said it didn't work yet. it was for a future version of d2x cios when davebaol added it to d2x cios. i looked at all the d2x cios commits from that date to present and didn't see that it was ever added. if i'm wrong someone let me know and i will add it back into wfl.
- made some small bootup changes in case of errors on bootup.
- made some changes to the way wiiflow lite handles emunand switching and other minor emunand code editing.
This commit is contained in:
fledge68 2017-09-21 22:03:41 +00:00
parent 3bdc947c7b
commit 9e85032382
36 changed files with 676 additions and 422 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

@ -106,7 +106,7 @@ bool Identify(u64 titleid)
break; break;
} }
} }
gprintf("AHBPROT: %d, Key ID: %u\n", AHBRPOT_Patched(), keyId); gprintf("AHBPROT: %d, Key ID: %u\n", AHBPROT_Patched(), keyId);
free(tmdBuffer); free(tmdBuffer);
free(tikBuffer); free(tikBuffer);
free(certBuffer); free(certBuffer);

View File

@ -1166,9 +1166,11 @@ void Nand::PatchAHB()
} }
} }
/* if AHB protection is currently disabled then call PatchAHB above */
/* to set the ES_MODULE to keep it disabled for the next IOS */
void Nand::Patch_AHB() void Nand::Patch_AHB()
{ {
if(AHBRPOT_Patched()) if(AHBPROT_Patched())
{ {
// Disable memory protection // Disable memory protection
write16(MEM_PROT, 0); write16(MEM_PROT, 0);

View File

@ -74,9 +74,9 @@ public:
bool EmulationEnabled(void); bool EmulationEnabled(void);
void Set_Partition(u32 partition) { Partition = partition; }; void Set_Partition(u32 partition) { Partition = partition; };
void Set_FullMode(bool fullmode) { FullMode = fullmode ? 0x100 : 0; }; void Set_FullMode(bool fullmode) { FullMode = fullmode ? 0x100 : 0; };// 00000001 00000000
void Set_RCMode(bool rcmode) { FullMode = rcmode ? 0x40 : 0; }; void Set_RCMode(bool rcmode) { FullMode = rcmode ? 0x40 : 0; };//00000000 01000000
void Set_SSMode(bool ssmode) { FullMode = ssmode ? 0x60 : 0; }; void Set_SSMode(bool ssmode) { FullMode = ssmode ? 0x60 : 0; };//00000000 01100000
void Patch_AHB(); void Patch_AHB();
void Init_ISFS(); void Init_ISFS();

View File

@ -52,6 +52,8 @@ void GC_Disc::init(const char *path)
} }
else else
{ {
if(strstr(GamePath, ".ciso") != NULL)
return;
GameType = TYPE_ISO; GameType = TYPE_ISO;
f = fopen(GamePath, "rb"); f = fopen(GamePath, "rb");
if(f == NULL) if(f == NULL)

View File

@ -643,7 +643,7 @@ void CCoverFlow::stopCoverLoader(bool empty)
m_items[i].state = STATE_Loading; m_items[i].state = STATE_Loading;
} }
} }
//gprintf("Coverflow stopped!\n"); gprintf("Coverflow stopped!\n");
} }
} }
@ -657,7 +657,7 @@ void CCoverFlow::startCoverLoader(void)
LWP_CreateThread(&coverLoaderThread, (void*(*)(void*))CCoverFlow::_coverLoader, LWP_CreateThread(&coverLoaderThread, (void*(*)(void*))CCoverFlow::_coverLoader,
(void*)this, coverThreadStack, coverThreadStackSize, 30); (void*)this, coverThreadStack, coverThreadStackSize, 30);
//gprintf("Coverflow started!\n"); gprintf("Coverflow started!\n");
} }
void CCoverFlow::clear(void) void CCoverFlow::clear(void)
@ -2074,6 +2074,15 @@ bool CCoverFlow::mouseOver(int x, int y)
return m_vid.stencilVal(x, y) == (int)m_range / 2 + 1; return m_vid.stencilVal(x, y) == (int)m_range / 2 + 1;
} }
void CCoverFlow::setSelected(int i)
{
LockMutex lock(m_mutex);
m_moved = true;
_loadAllCovers(i);
_updateAllTargets(true);
select();
}
bool CCoverFlow::findId(const char *id, bool instant, bool path) bool CCoverFlow::findId(const char *id, bool instant, bool path)
{ {
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -2611,7 +2620,6 @@ bool CCoverFlow::fullCoverCached(const char *id)
bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover) bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
{ {
gprintf("loading %s cover\n", box ? (blankBoxCover ? "blank" : "box") : "flat");
if(!m_loadingCovers) return false; if(!m_loadingCovers) return false;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565; u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;

View File

@ -56,6 +56,7 @@ public:
void simulateOtherScreenFormat(bool s); void simulateOtherScreenFormat(bool s);
// Commands // Commands
void tick(void); void tick(void);
void setSelected(int i);
bool findId(const char *id, bool instant = false, bool path = false); bool findId(const char *id, bool instant = false, bool path = false);
void pageUp(void); void pageUp(void);
void pageDown(void); void pageDown(void);
@ -207,7 +208,7 @@ private:
} ATTRIBUTE_PACKED; } ATTRIBUTE_PACKED;
struct CCover// should be SCover because it's a struct struct CCover// should be SCover because it's a struct
{ {
u32 index; u32 index;// index is the number of the item in CItem list
Vector3D scale; Vector3D scale;
Vector3D targetScale; Vector3D targetScale;
Vector3D angle; Vector3D angle;

View File

@ -199,7 +199,7 @@ void CVideo::init(void)
m_rmode->viXOrigin += hoffset; m_rmode->viXOrigin += hoffset;
/* Widescreen Fix by tueidj, WiiU Check by crediar, thanks alot */ /* Widescreen Fix by tueidj, WiiU Check by crediar, thanks alot */
if(m_wide && AHBRPOT_Patched() && IsOnWiiU()) if(m_wide && AHBPROT_Patched() && IsOnWiiU())
{ {
write32(0xd8006a0, 0x30000004); write32(0xd8006a0, 0x30000004);
mask32(0xd8006a8, 0, 2); mask32(0xd8006a8, 0, 2);

View File

@ -131,8 +131,10 @@ static void Create_Wii_EXT_List(char *FullPath)
u8 gc_disc[1]; u8 gc_disc[1];
const char *FST_APPEND = "sys/boot.bin"; const char *FST_APPEND = "sys/boot.bin";
const u8 FST_APPEND_SIZE = strlen(FST_APPEND); const u8 FST_APPEND_SIZE = strlen(FST_APPEND);
static const u8 CISO_MAGIC[8] = {'C','I','S','O',0x00,0x00,0x20,0x00};
static void Create_GC_List(char *FullPath) static void Create_GC_List(char *FullPath)
{ {
u32 hdr_offset = 0x00;
FILE *fp = fopen(FullPath, "rb"); FILE *fp = fopen(FullPath, "rb");
if(!fp && strstr(FullPath, "/root") != NULL) //fst folder if(!fp && strstr(FullPath, "/root") != NULL) //fst folder
{ {
@ -143,12 +145,19 @@ static void Create_GC_List(char *FullPath)
if(fp) if(fp)
{ {
fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp); fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp);
//check for CISO disc image and change offset to read the true header
if(!memcmp((void*)&gc_hdr, CISO_MAGIC, sizeof(CISO_MAGIC)))
{
hdr_offset = 0x8000;
fseek(fp, hdr_offset, SEEK_SET);
fread((void*)&gc_hdr, 1, sizeof(gc_discHdr), fp);
}
if(gc_hdr.magic == GC_MAGIC) if(gc_hdr.magic == GC_MAGIC)
{ {
AddISO((const char*)gc_hdr.id, (const char*)gc_hdr.title, AddISO((const char*)gc_hdr.id, (const char*)gc_hdr.title,
FullPath, 0x000000, TYPE_GC_GAME); FullPath, 0x000000, TYPE_GC_GAME);
/* Check for disc 2 */ /* Check for disc 2 */
fseek(fp, 6, SEEK_SET); fseek(fp, hdr_offset + 0x06, SEEK_SET);
fread(gc_disc, 1, 1, fp); fread(gc_disc, 1, 1, fp);
if(gc_disc[0]) if(gc_disc[0])
{ {

View File

@ -62,7 +62,7 @@ bool loadIOS(int ios, bool MountDevices)
ShutdownBeforeExit(); ShutdownBeforeExit();
NandHandle.Patch_AHB(); //No AHBPROT for the next IOS NandHandle.Patch_AHB(); //No AHBPROT for the next IOS
ret = IOS_ReloadIOS(ios) == 0; ret = IOS_ReloadIOS(ios) == 0;
gprintf("AHBPROT after IOS Reload: %u\n", AHBRPOT_Patched()); gprintf("AHBPROT after IOS Reload: %u\n", AHBPROT_Patched());
NandHandle.Init_ISFS(); NandHandle.Init_ISFS();
WDVD_Init(); WDVD_Init();
} }

View File

@ -79,12 +79,12 @@ void Sys_ExitTo(int option)
//magic word to force wii menu in priiloader. //magic word to force wii menu in priiloader.
if(ExitOption == EXIT_TO_MENU) if(ExitOption == EXIT_TO_MENU)
{ {
*Priiloader_CFG1 = 0x50756E65; *Priiloader_CFG1 = 0x50756E65;// Pune
*Priiloader_CFG2 = 0x50756E65; *Priiloader_CFG2 = 0x50756E65;
} }
else if(ExitOption == EXIT_TO_PRIILOADER) else if(ExitOption == EXIT_TO_PRIILOADER)
{ {
*Priiloader_CFG1 = 0x4461636F; *Priiloader_CFG1 = 0x4461636F;// Daco
*Priiloader_CFG2 = 0x4461636F; *Priiloader_CFG2 = 0x4461636F;
} }
else else
@ -98,8 +98,8 @@ void Sys_ExitTo(int option)
void Sys_Exit(void) void Sys_Exit(void)
{ {
if(ExitOption == EXIT_TO_DISABLE) //if(ExitOption == EXIT_TO_DISABLE)
return; // return;
/* Shutdown Inputs */ /* Shutdown Inputs */
Close_Inputs(); Close_Inputs();
@ -123,6 +123,8 @@ void Sys_Exit(void)
WII_LaunchTitle(HBC_JODI); WII_LaunchTitle(HBC_JODI);
WII_LaunchTitle(HBC_HAXX); WII_LaunchTitle(HBC_HAXX);
} }
else if(ExitOption == EXIT_TO_WIIU)
WII_LaunchTitle(WIIU_CHANNEL);
/* else Return to Menu */ /* else Return to Menu */
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
exit(1); exit(1);
@ -145,7 +147,7 @@ void Sys_Init(void)
SYS_SetPowerCallback(__Sys_PowerCallback); SYS_SetPowerCallback(__Sys_PowerCallback);
} }
bool AHBRPOT_Patched(void) bool AHBPROT_Patched(void)
{ {
return (*HW_AHBPROT == 0xFFFFFFFF); return (*HW_AHBPROT == 0xFFFFFFFF);
} }
@ -215,16 +217,16 @@ bool Sys_DolphinMode(void)
return DolphinMode; return DolphinMode;
} }
bool hw_check = false; bool hw_checked = false;
bool on_hw = false; bool on_hw = false;
bool Sys_HW_Access(void) bool Sys_HW_Access(void)
{ {
if(hw_check == true) if(hw_checked == true)
return on_hw; return on_hw;
check_neek2o(); check_neek2o();
on_hw = AHBRPOT_Patched() && (!Sys_DolphinMode() && !neek2o()); on_hw = AHBPROT_Patched() && (!Sys_DolphinMode() && !neek2o());
hw_check = true; hw_checked = true;
return on_hw; return on_hw;
} }

View File

@ -15,14 +15,16 @@ extern "C" {
#define HBC_HAXX 0x0001000148415858ULL #define HBC_HAXX 0x0001000148415858ULL
#define RETURN_CHANNEL 0x0001000857494948ULL #define RETURN_CHANNEL 0x0001000857494948ULL
#define SYSTEM_MENU 0x0000000100000002ULL #define SYSTEM_MENU 0x0000000100000002ULL
#define WIIU_CHANNEL 0x0001000248435641ULL//HCVA
enum enum
{ {
PRIILOADER_DEF = 0, PRIILOADER_DEF = 0,
EXIT_TO_MENU, EXIT_TO_MENU,
EXIT_TO_HBC, EXIT_TO_HBC,
EXIT_TO_WIIU,
EXIT_TO_PRIILOADER, EXIT_TO_PRIILOADER,
EXIT_TO_DISABLE, //EXIT_TO_DISABLE,
EXIT_TO_BOOTMII, EXIT_TO_BOOTMII,
EXIT_TO_WFNK2O, EXIT_TO_WFNK2O,
EXIT_TO_SMNK2O, EXIT_TO_SMNK2O,
@ -43,7 +45,7 @@ void Sys_SetNeekPath(const char*);
void Open_Inputs(void); void Open_Inputs(void);
void Close_Inputs(void); void Close_Inputs(void);
bool AHBRPOT_Patched(void); bool AHBPROT_Patched(void);
bool IsOnWiiU(void); bool IsOnWiiU(void);
/* All our extern C stuff */ /* All our extern C stuff */

View File

@ -81,7 +81,8 @@ int main(int argc, char **argv)
m_vid.waitMessage(0.15f); m_vid.waitMessage(0.15f);
Open_Inputs(); Open_Inputs();
mainMenu.init(); if(mainMenu.init())
{
if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode()) if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode())
{ {
if(useMainIOS || !DeviceHandle.UsablePartitionMounted()) if(useMainIOS || !DeviceHandle.UsablePartitionMounted())
@ -109,7 +110,8 @@ int main(int argc, char **argv)
//if mainMenu.init set exit=true then mainMenu.main while loop does nothing and returns to here to exit wiiflow //if mainMenu.init set exit=true then mainMenu.main while loop does nothing and returns to here to exit wiiflow
} }
//Exit WiiFlow, no game booted... //Exit WiiFlow, no game booted...
mainMenu.cleanup();// cleanup and clear memory mainMenu.cleanup();// removes all sounds, fonts, images, coverflow, plugin stuff, source menu and clear memory
}
ShutdownBeforeExit();// unmount devices and close inputs ShutdownBeforeExit();// unmount devices and close inputs
Sys_Exit(); Sys_Exit();
return 0; return 0;

View File

@ -107,7 +107,7 @@ static void GrabINIFiles(char *FullPath)
INI_List.push_back(FullPath); INI_List.push_back(FullPath);
} }
void CMenu::init() bool CMenu::init()
{ {
SoundHandle.Init(); SoundHandle.Init();
m_gameSound.SetVoice(1); m_gameSound.SetVoice(1);
@ -126,16 +126,25 @@ void CMenu::init()
break; break;
} }
} }
if(drive == check)//No apps/wiiflow folder found
{
for(int i = SD; i <= USB8; i++) // Find the first writable partition
if(DeviceHandle.IsInserted(i) && DeviceHandle.GetFSType(i) != PART_FS_WBFS)
{
drive = DeviceName[i];
break;
}
}
_loadDefaultFont();// load default font
if(drive == check) // Should not happen if(drive == check) // Should not happen
{ {
_buildMenus(); /* Could not find a device to save configuration files on! */
error(_fmt("errboot4", L"No apps/wiiflow directory found!")); //m_exit = true;
m_exit = true; return false;
return;
} }
_loadDefaultFont();// load default font
/* Handle apps dir first, so handling wiiflow.ini does not fail */ /* Handle apps dir first, so handling wiiflow.ini does not fail */
m_appDir = fmt("%s:/%s", drive, APPS_DIR); m_appDir = fmt("%s:/%s", drive, APPS_DIR);
gprintf("Wiiflow boot.dol Location: %s\n", m_appDir.c_str()); gprintf("Wiiflow boot.dol Location: %s\n", m_appDir.c_str());
@ -143,6 +152,7 @@ void CMenu::init()
/* Load/Create wiiflow.ini so we can get settings to start Gecko and Network */ /* Load/Create wiiflow.ini so we can get settings to start Gecko and Network */
m_cfg.load(fmt("%s/" CFG_FILENAME, m_appDir.c_str())); m_cfg.load(fmt("%s/" CFG_FILENAME, m_appDir.c_str()));
show_mem = m_cfg.getBool("DEBUG", "show_mem", false);
/* Check if we want WiFi Gecko */ /* Check if we want WiFi Gecko */
m_use_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko", false); m_use_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko", false);
WiFiDebugger.SetBuffer(m_use_wifi_gecko); WiFiDebugger.SetBuffer(m_use_wifi_gecko);
@ -181,16 +191,12 @@ void CMenu::init()
break; break;
} }
if(drive == check && DeviceHandle.IsInserted(SD))//if no available USB partition then force SD if(drive == check && DeviceHandle.IsInserted(SD))//if no available USB partition then force SD
{
drive = DeviceName[SD]; drive = DeviceName[SD];
//show error msg later to keep form calling _buildMenus() twice
}
else if(drive == check) else if(drive == check)
{ {
_buildMenus(); /* No available usb partitions for data and no SD inserted! */
error(_fmt("errboot6", L"No available usb partitions for data and no SD inserted!\nExiting.")); //m_exit = true;
m_exit = true; return false;
return;
} }
} }
else else
@ -306,8 +312,7 @@ void CMenu::init()
/* Emu nands init even if not being used */ /* Emu nands init even if not being used */
memset(emu_nands_dir, 0, 64); memset(emu_nands_dir, 0, 64);
strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64); strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64);
_checkEmuNandSettings(false);// emu nand _checkEmuNandSettings();
_checkEmuNandSettings(true);// saves nand
/* Cache Reload Checks */ /* Cache Reload Checks */
int ini_rev = m_cfg.getInt("GENERAL", "ini_rev", 0); int ini_rev = m_cfg.getInt("GENERAL", "ini_rev", 0);
@ -417,10 +422,6 @@ void CMenu::init()
m_music_info = m_cfg.getBool("GENERAL", "display_music_info", false); m_music_info = m_cfg.getBool("GENERAL", "display_music_info", false);
/* Init Button Manager and build the menus */ /* Init Button Manager and build the menus */
m_btnMgr.init();
m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true));
show_mem = m_cfg.getBool("DEBUG", "show_mem", false);
_buildMenus(); _buildMenus();
if(drive == DeviceName[SD] && onUSB) if(drive == DeviceName[SD] && onUSB)
error(_fmt("errboot5", L"data_on_usb=yes and No available usb partitions for data!\nUsing SD.")); error(_fmt("errboot5", L"data_on_usb=yes and No available usb partitions for data!\nUsing SD."));
@ -428,6 +429,7 @@ void CMenu::init()
/* Check if locked, set return to, set exit to, and init multi threading */ /* Check if locked, set return to, set exit to, and init multi threading */
m_locked = m_cfg.getString("GENERAL", "parent_code", "").size() >= 4; m_locked = m_cfg.getString("GENERAL", "parent_code", "").size() >= 4;
/* Switch the WFLA and DWFA when using official wiiflow */
if(m_cfg.getString("GENERAL", "returnto", "WFLA") == "DWFA") if(m_cfg.getString("GENERAL", "returnto", "WFLA") == "DWFA")
m_cfg.setString("GENERAL", "returnto", "WFLA"); m_cfg.setString("GENERAL", "returnto", "WFLA");
@ -436,7 +438,7 @@ void CMenu::init()
stat(fmt("%s:/bootmii/armboot.bin",DeviceName[SD]), &dummy) != 0 || stat(fmt("%s:/bootmii/armboot.bin",DeviceName[SD]), &dummy) != 0 ||
stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) != 0)) stat(fmt("%s:/bootmii/ppcboot.elf", DeviceName[SD]), &dummy) != 0))
exit_to = EXIT_TO_HBC; exit_to = EXIT_TO_HBC;
Sys_ExitTo(exit_to); Sys_ExitTo(exit_to + 1);
LWP_MutexInit(&m_mutex, 0); LWP_MutexInit(&m_mutex, 0);
@ -470,6 +472,7 @@ void CMenu::init()
); );
} }
} }
return true;
} }
bool cleaned_up = false; bool cleaned_up = false;
@ -939,6 +942,8 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
void CMenu::_buildMenus(void) void CMenu::_buildMenus(void)
{ {
m_btnMgr.init();
m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true));
// Default fonts // Default fonts
theme.btnFont = _font("GENERAL", "button_font", BUTTONFONT); theme.btnFont = _font("GENERAL", "button_font", BUTTONFONT);
theme.btnFontColor = m_theme.getColor("GENERAL", "button_font_color", 0xD0BFDFFF); theme.btnFontColor = m_theme.getColor("GENERAL", "button_font_color", 0xD0BFDFFF);
@ -2286,13 +2291,9 @@ bool CMenu::_loadChannelList(void)
{ {
NANDemuView = true; NANDemuView = true;
string emuPath; string emuPath;
int emuPartition = _FindEmuPart(emuPath, false, false);//check if exist & has sysconf, settings.txt, & RFL_DB.dat int emuPartition = _FindEmuPart(emuPath, false, false);// check if emunand folder exist and on FAT
if(emuPartition >= 0) if(emuPartition >= 0)
{ {
/* copy real NAND sysconf, settings.txt, & RFL_DB.dat if you want to, they are replaced if they already exist */
NandHandle.PreNandCfg(m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false),
m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false));
currentPartition = emuPartition; currentPartition = emuPartition;
string cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]); string cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]);
bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache"); bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");

View File

@ -35,7 +35,7 @@ class CMenu
{ {
public: public:
CMenu(); CMenu();
void init(); bool init();
void error(const wstringEx &msg); void error(const wstringEx &msg);
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)); }
int main(void); int main(void);
@ -1183,7 +1183,8 @@ private:
int _FindEmuPart(string &emuPath, bool searchvalid, bool savesnand); int _FindEmuPart(string &emuPath, bool searchvalid, bool savesnand);
bool _checkSave(string id, bool nand); bool _checkSave(string id, bool nand);
bool _TestEmuNand(int epart, const char *path, bool indept); bool _TestEmuNand(int epart, const char *path, bool indept);
void _checkEmuNandSettings(bool savesnand); void _checkEmuNandSettings(void);
void _FullNandCheck(void);
void _listEmuNands(const char *path, vector<string> &emuNands); void _listEmuNands(const char *path, vector<string> &emuNands);
static u32 _downloadCheatFileAsync(void *obj); static u32 _downloadCheatFileAsync(void *obj);
@ -1211,14 +1212,14 @@ private:
static const SOption _ChannelsType[3]; static const SOption _ChannelsType[3];
static const SOption _NandEmu[2]; static const SOption _NandEmu[2];
static const SOption _SaveEmu[5]; static const SOption _SaveEmu[4];
static const SOption _GlobalSaveEmu[4]; static const SOption _GlobalSaveEmu[3];
static const SOption _AspectRatio[3]; static const SOption _AspectRatio[3];
static const SOption _NinEmuCard[5]; static const SOption _NinEmuCard[5];
static const SOption _vidModePatch[4]; static const SOption _vidModePatch[4];
static const SOption _debugger[3]; static const SOption _debugger[3];
static const SOption _hooktype[8]; static const SOption _hooktype[8];
static const SOption _exitTo[5]; static const SOption _exitTo[3];
static map<u8, u8> _installed_cios; static map<u8, u8> _installed_cios;
typedef map<u8, u8>::iterator CIOSItr; typedef map<u8, u8>::iterator CIOSItr;

View File

@ -12,12 +12,10 @@ template <class T> static inline T loopNum(T i, T s)
return (i + s) % s; return (i + s) % s;
} }
const CMenu::SOption CMenu::_exitTo[5] = { const CMenu::SOption CMenu::_exitTo[3] = {
{ "def", L"Default" },
{ "menu", L"System Menu" }, { "menu", L"System Menu" },
{ "hbc", L"HBC" }, { "hbc", L"HBC" },
{ "prii", L"Priiloader" }, { "wiiu", L"Wii U Menu" },
{ "bootmii", L"BootMii" }
}; };
void CMenu::_hideConfig4(bool instant) void CMenu::_hideConfig4(bool instant)
@ -102,7 +100,7 @@ int CMenu::_config4(void)
{ {
int exit_to = (int)loopNum((u32)m_cfg.getInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo)); int exit_to = (int)loopNum((u32)m_cfg.getInt("GENERAL", "exit_to", 0) + 1, ARRAY_SIZE(CMenu::_exitTo));
m_cfg.setInt("GENERAL", "exit_to", exit_to); m_cfg.setInt("GENERAL", "exit_to", exit_to);
Sys_ExitTo(exit_to); Sys_ExitTo(exit_to + 1);
_showConfig4(); _showConfig4();
} }
else if (m_btnMgr.selected(m_config4BtnSaveFavMode)) else if (m_btnMgr.selected(m_config4BtnSaveFavMode))

View File

@ -40,7 +40,7 @@ extern const u8 gc_ogg[];
extern const u32 gc_ogg_size; extern const u32 gc_ogg_size;
bool m_zoom_banner = false; bool m_zoom_banner = false;
bool m_pluginBanner = false; bool m_banner_loaded = false;
s16 m_gameBtnPlayFull; s16 m_gameBtnPlayFull;
s16 m_gameBtnBackFull; s16 m_gameBtnBackFull;
s16 m_gameBtnToggle; s16 m_gameBtnToggle;
@ -130,18 +130,18 @@ const CMenu::SOption CMenu::_NandEmu[2] = {
{ "NANDfull", L"Full" }, { "NANDfull", L"Full" },
}; };
const CMenu::SOption CMenu::_GlobalSaveEmu[4] = { const CMenu::SOption CMenu::_GlobalSaveEmu[3] = {
{ "SaveOffG", L"Off" }, { "SaveOffG", L"Off" },
{ "SavePartG", L"Game save" }, { "SavePartG", L"Game save" },
{ "SaveRegG", L"Regionswitch" }, //{ "SaveRegG", L"Regionswitch" },
{ "SaveFullG", L"Full" }, { "SaveFullG", L"Full" },
}; };
const CMenu::SOption CMenu::_SaveEmu[5] = { const CMenu::SOption CMenu::_SaveEmu[4] = {
{ "SaveDef", L"Default" }, { "SaveDef", L"Default" },
{ "SaveOff", L"Off" }, { "SaveOff", L"Off" },
{ "SavePart", L"Game save" }, { "SavePart", L"Game save" },
{ "SaveReg", L"Regionswitch" }, //{ "SaveReg", L"Regionswitch" },
{ "SaveFull", L"Full" }, { "SaveFull", L"Full" },
}; };
@ -307,7 +307,7 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void) void CMenu::_showGame(void)
{ {
_setBg(m_gameBg, m_gameBgLQ); _setBg(m_gameBg, m_gameBgLQ);
return;
if(!m_zoom_banner) if(!m_zoom_banner)
{ {
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
@ -411,7 +411,7 @@ bool CMenu::_startVideo()
void CMenu::_game(bool launch) void CMenu::_game(bool launch)
{ {
m_pluginBanner = false; m_banner_loaded = false;
bool coverFlipped = false; bool coverFlipped = false;
int cf_version = 1; int cf_version = 1;
string domain; string domain;
@ -658,8 +658,7 @@ void CMenu::_game(bool launch)
_cleanupBanner(); _cleanupBanner();
break; break;
} }
else if((m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull)) else if(m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull))
&& (!NoGameID(hdr->type) || m_pluginBanner))
{ {
m_zoom_banner = m_banner.ToggleZoom(); m_zoom_banner = m_banner.ToggleZoom();
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner); m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
@ -808,26 +807,19 @@ void CMenu::_game(bool launch)
} }
} }
} }
/* show small banner frame if available */
if(!coverFlipped && m_gameLblUser[4] != -1 && (!NoGameID(hdr->type) || m_pluginBanner) && !m_zoom_banner && !m_video_playing)
m_btnMgr.show(m_gameLblUser[4]);
else
m_btnMgr.hide(m_gameLblUser[4]);
/* show regular buttons if pointer is in game zone && banner is not zoomed && trailer video is not playing */ /* showing and hiding buttons based on banner zoomed state */
if(m_show_zone_game && !coverFlipped && (!m_zoom_banner || (NoGameID(hdr->type) && !m_pluginBanner)) && !m_video_playing) if(!m_zoom_banner)
{ {
/* always hide full banner buttons */
m_btnMgr.hide(m_gameBtnPlayFull); m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull); m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull); m_btnMgr.hide(m_gameBtnToggleFull);
if(m_show_zone_game && !coverFlipped && !m_video_playing)
{
m_btnMgr.show(m_gameBtnPlay); m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack); m_btnMgr.show(m_gameBtnBack);
m_btnMgr.show(m_gameBtnToggle);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]);
m_btnMgr.show(m_gameBtnSettings); m_btnMgr.show(m_gameBtnSettings);
m_btnMgr.show(m_gameBtnDelete); m_btnMgr.show(m_gameBtnDelete);
bool b; bool b;
@ -843,21 +835,12 @@ void CMenu::_game(bool launch)
b = m_gcfg1.getBool("ADULTONLY", id, false); b = m_gcfg1.getBool("ADULTONLY", id, false);
m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff); m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff);
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn); m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
} for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)// #4 is used for banner frame
else /* show zoomed banner play and back buttons */ if(m_gameLblUser[i] != -1)
{ m_btnMgr.show(m_gameLblUser[i]);
if(m_zoom_banner && (!NoGameID(hdr->type) || m_pluginBanner) && !m_video_playing)
{
m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToggleFull);
} }
else else
{ {
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
}
m_btnMgr.hide(m_gameBtnFavoriteOn); m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff); m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnAdultOn); m_btnMgr.hide(m_gameBtnAdultOn);
@ -866,11 +849,98 @@ void CMenu::_game(bool launch)
m_btnMgr.hide(m_gameBtnDelete); m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay); m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack); m_btnMgr.hide(m_gameBtnBack);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)
if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]);
}
/* show or hide small banner toggle btn and frame */
if(m_banner_loaded && !m_soundThrdBusy && !coverFlipped && !m_video_playing)
{
/* show only if the game has a banner */
m_btnMgr.show(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
m_btnMgr.show(m_gameLblUser[4]);
}
else
{
m_btnMgr.hide(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
m_btnMgr.hide(m_gameLblUser[4]);
}
}
else // banner zoomed full screen
{
if(m_banner_loaded && !m_soundThrdBusy)// there is a banner
{
m_btnMgr.show(m_gameBtnPlayFull);
m_btnMgr.show(m_gameBtnBackFull);
m_btnMgr.show(m_gameBtnToggleFull);
m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnAdultOn);
m_btnMgr.hide(m_gameBtnAdultOff);
m_btnMgr.hide(m_gameBtnSettings);
m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack);
m_btnMgr.hide(m_gameBtnToggle); m_btnMgr.hide(m_gameBtnToggle);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if (m_gameLblUser[i] != -1) if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]); m_btnMgr.hide(m_gameLblUser[i]);
} }
else // no banner for whatever reason
{
if(!m_soundThrdBusy)
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
}
if(m_show_zone_game && !m_soundThrdBusy)
{
m_btnMgr.show(m_gameBtnPlay);
m_btnMgr.show(m_gameBtnBack);
m_btnMgr.show(m_gameBtnSettings);
m_btnMgr.show(m_gameBtnDelete);
bool b;
if(hdr->type == TYPE_PLUGIN)
b = m_gcfg1.getBool("FAVORITES_PLUGINS", id, false);
else
b = m_gcfg1.getBool("FAVORITES", id, false);
m_btnMgr.show(b ? m_gameBtnFavoriteOn : m_gameBtnFavoriteOff);
m_btnMgr.hide(b ? m_gameBtnFavoriteOff : m_gameBtnFavoriteOn);
if(hdr->type == TYPE_PLUGIN)
b = m_gcfg1.getBool("ADULTONLY_PLUGINS", id, false);
else
b = m_gcfg1.getBool("ADULTONLY", id, false);
m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff);
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 2; ++i)// don't include small banner frame
if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]);
}
else
{
m_btnMgr.hide(m_gameBtnFavoriteOn);
m_btnMgr.hide(m_gameBtnFavoriteOff);
m_btnMgr.hide(m_gameBtnAdultOn);
m_btnMgr.hide(m_gameBtnAdultOff);
m_btnMgr.hide(m_gameBtnSettings);
m_btnMgr.hide(m_gameBtnDelete);
m_btnMgr.hide(m_gameBtnPlay);
m_btnMgr.hide(m_gameBtnBack);
m_btnMgr.hide(m_gameBtnToggle);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]);
}
}
}
} }
if(coverFlipped) if(coverFlipped)
{ {
@ -1225,7 +1295,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
Nintendont_SetOptions(path, id, CheatPath, GClanguage, n_config, n_videomode, vidscale, vidoffset); Nintendont_SetOptions(path, id, CheatPath, GClanguage, n_config, n_videomode, vidscale, vidoffset);
ShutdownBeforeExit(); ShutdownBeforeExit();
loadIOS(58, false); //nintendont NEEDS ios58 loadIOS(58, false); //nintendont NEEDS ios58 and AHBPROT disabled
/* should be a check for error loading IOS58 and AHBPROT disabled */
BootHomebrew(); //regular dol BootHomebrew(); //regular dol
} }
else // loader == DEVOLUTION else // loader == DEVOLUTION
@ -1257,7 +1328,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
DEVO_GetLoader(m_dataDir.c_str()); DEVO_GetLoader(m_dataDir.c_str());
DEVO_SetOptions(path, id, videoMode, GClanguage, memcard_emu, widescreen, activity_led, m_use_wifi_gecko); DEVO_SetOptions(path, id, videoMode, GClanguage, memcard_emu, widescreen, activity_led, m_use_wifi_gecko);
if(AHBRPOT_Patched()) if(AHBPROT_Patched())
loadIOS(58, false); loadIOS(58, false);
else //use cIOS instead to make sure Devolution works anyways else //use cIOS instead to make sure Devolution works anyways
loadIOS(mainIOS, false); loadIOS(mainIOS, false);
@ -1306,8 +1377,9 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
gprintf("Game ID# %s requested IOS %d. User selected %d\n", id.c_str(), gameIOS, userIOS); gprintf("Game ID# %s requested IOS %d. User selected %d\n", id.c_str(), gameIOS, userIOS);
if(neek2o() || (RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB)) if(neek2o() || (RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB))
{ {
bool ret = loadIOS(gameIOS, false); /* doesn't use cIOS so we don't check userIOS */
_netInit(); bool ret = loadIOS(gameIOS, false);//load game requested IOS and patch nothing
_netInit();// needed after IOS change
if(ret == false) if(ret == false)
{ {
error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS));
@ -1316,7 +1388,7 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
return LOAD_IOS_SUCCEEDED; return LOAD_IOS_SUCCEEDED;
} }
if(userIOS) if(userIOS)// if IOS is not 'auto' and set to a specific cIOS then set gameIOS to that cIOS if it's installed
{ {
for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++) for(CIOSItr itr = _installed_cios.begin(); itr != _installed_cios.end(); itr++)
{ {
@ -1327,12 +1399,13 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
} }
} }
} }
else if(gameIOS != 57) else if(gameIOS != 57)// if IOS is 'auto' but gameIOS is not IOS57 then set gameIOS to wiiflow's mainIOS
gameIOS = mainIOS; gameIOS = mainIOS;// mainIOS is usually 249 unless changed by boot args or changed on startup settings menu
gprintf("Changed requested IOS to %d.\n", gameIOS); gprintf("Changed requested IOS to %d.\n", gameIOS);
// remap IOS to CIOS // remap a gameIOS of IOS57 to a cIOS base 57 or if the specific cIOS selected is not installed then
if(gameIOS < 0x64) // remap game IOS to a CIOS with the same base IOS
if(gameIOS < 0x64)// < 100
{ {
if(_installed_cios.size() <= 0) if(_installed_cios.size() <= 0)
{ {
@ -1344,6 +1417,9 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
IOS[1] = 56; IOS[1] = 56;
IOS[2] = 57; IOS[2] = 57;
bool found = false; bool found = false;
// compare the base of each cios to the game ios
// if no match then find the first cios with base 56
// if no match then find the first cios with base 57
for(u8 num = 0; num < 3; num++) for(u8 num = 0; num < 3; num++)
{ {
if(found) if(found)
@ -1363,12 +1439,12 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
if(!found) if(!found)
return LOAD_IOS_FAILED; return LOAD_IOS_FAILED;
} }
/* at this point gameIOS is a cIOS */
if(gameIOS != CurrentIOS.Version) if(gameIOS != CurrentIOS.Version)
{ {
gprintf("Reloading IOS into %d\n", gameIOS); gprintf("Reloading IOS into %d\n", gameIOS);
bool ret = loadIOS(gameIOS, true); bool ret = loadIOS(gameIOS, true);// cIOS patch everything
_netInit(); _netInit();// always seem to do netinit after changing IOS
if(ret == false) if(ret == false)
{ {
error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS)); error(wfmt(_fmt("errgame4", L"Couldn't load IOS %i"), gameIOS));
@ -1424,7 +1500,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
string emuPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); //interesting - there is only a global option for nand emulation - no per game choice
int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1); int emulate_mode = min(max(0, m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 1)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
int userIOS = m_gcfg2.getInt(id, "ios", 0); int userIOS = m_gcfg2.getInt(id, "ios", 0);
@ -1433,6 +1509,15 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
bool use_led = m_gcfg2.getBool(id, "led", false); bool use_led = m_gcfg2.getBool(id, "led", false);
u32 gameIOS = ChannelHandle.GetRequestedIOS(gameTitle); u32 gameIOS = ChannelHandle.GetRequestedIOS(gameTitle);
if(NANDemuView && !neek2o())
{
/* copy real NAND sysconf, settings.txt, & RFL_DB.dat if you want to, they are replaced if they already exist */
NandHandle.PreNandCfg(m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_miis", false),
m_cfg.getBool(CHANNEL_DOMAIN, "real_nand_config", false));
m_cfg.setBool(CHANNEL_DOMAIN, "real_nand_miis", false);
m_cfg.setBool(CHANNEL_DOMAIN, "real_nand_config", false);
}
/* configs no longer needed */ /* configs no longer needed */
m_gcfg1.save(true); m_gcfg1.save(true);
m_gcfg2.save(true); m_gcfg2.save(true);
@ -1471,7 +1556,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!")); error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!"));
_exitWiiflow(); _exitWiiflow();
} }
if(_loadIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED) if(_loadIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED)//in neek2o this will only load the game IOS not a cIOS
{ {
/* error message already shown */ /* error message already shown */
_exitWiiflow(); _exitWiiflow();
@ -1480,7 +1565,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && returnTo != 0) if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && returnTo != 0)
{ {
if(D2X_PatchReturnTo(returnTo) >= 0) if(D2X_PatchReturnTo(returnTo) >= 0)
memset(&returnTo, 0, sizeof(u32)); memset(&returnTo, 0, sizeof(u32));// not needed - always set to 0 in external booter below
} }
if(NANDemuView && !neek2o()) if(NANDemuView && !neek2o())
{ {
@ -1511,7 +1596,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
{ {
setLanguage(language); setLanguage(language);
ocarina_load_code(cheatFile, cheatSize); ocarina_load_code(cheatFile, cheatSize);
NandHandle.Patch_AHB(); /* Identify may takes it */ NandHandle.Patch_AHB(); /* Identify maybe uses it so keep AHBPROT disabled */
PatchIOS(true); /* Patch for everything */ PatchIOS(true); /* Patch for everything */
Identify(gameTitle); Identify(gameTitle);
@ -1537,27 +1622,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(dvd) if(dvd)
{ {
/* TempLoadIOS();// switch to cIOS if using IOS58 and not in neek2o
u32 cover = 0;
if(!neek2o() && !Sys_DolphinMode())
{
if(WDVD_GetCoverStatus(&cover) < 0)
{
error(_t("errgame7", L"WDVDGetCoverStatus Failed!"));
Sys_Exit();
}
if(!(cover & 0x2))
{
error(_t("errgame8", L"Please insert a game disc."));
do
{
WDVD_GetCoverStatus(&cover);
if(BTN_B_PRESSED)
return;
} while(!(cover & 0x2));
}
}*/
TempLoadIOS();
/* Open Disc */ /* Open Disc */
if(Disc_Open(true) < 0) if(Disc_Open(true) < 0)
{ {
@ -1631,47 +1696,61 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u); u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); u8 emulate_mode = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
u8 gameEmuMode = emulate_mode;
if(emulate_mode == 0)// default then use global if(emulate_mode == 0)// default then use global
emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1); emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
else else
emulate_mode--; emulate_mode--;
string emuPath;
int emuPartition = 0;
if(emulate_mode && !dvd && !neek2o()) if(emulate_mode && !dvd && !neek2o())
{ {
emuPartition = _FindEmuPart(emuPath, false, true); string emuPath;
if(emuPartition < 0)//if savepartition and/or nand folder no good int emuPart = _FindEmuPart(emuPath, true, true);
if(emuPart == -1)//if savepartition is unusable
{ {
_hideWaitMessage(); _hideWaitMessage();
error(_t("errgame13", L"EmuNAND for gamesave not found! Using real NAND.")); error(_t("errgame13", L"EmuNAND for gamesave not found! Using real NAND."));
emulate_mode = 0; emulate_mode = 0;
_showWaitMessage(); _showWaitMessage();
} }
if(emulate_mode == 1)//gamesave else
{ {
m_forceext = false; bool need_config = false;
_hideWaitMessage(); bool need_miis = false;
m_exit = false;
/*_AutoExtractSave(id) returns char testpath[MAX_FAT_PATH];
true if the save is already on emu nand (then no extraction) char basepath[MAX_FAT_PATH];
true if the save was successfully extracted snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
false if save is not on real nand (nothing to extract)
false if user chooses to have game create new save*/ // does not check to see if actual tmd exist just if the folder exist
if(!_AutoExtractSave(id)) if(!_checkSave(id, false))//if save is not on emunand
NandHandle.CreateTitleTMD(hdr);//setup emu nand for gamesave {
_showWaitMessage(); NandHandle.CreatePath("%s/import", basepath);
m_exit = true; NandHandle.CreatePath("%s/meta", basepath);
NandHandle.CreatePath("%s/shared1", basepath);
NandHandle.CreatePath("%s/shared2", basepath);
NandHandle.CreatePath("%s/sys", basepath);
NandHandle.CreatePath("%s/title", basepath);
NandHandle.CreatePath("%s/ticket", basepath);
NandHandle.CreatePath("%s/tmp", basepath);
NandHandle.CreateTitleTMD(hdr);//setup emunand for wii gamesave
} }
else if(emulate_mode > 1)//region switch or full if(gameEmuMode == 3)//full per game setting - in case global is not full
{ {
// copy real nand config files to emuNAND //check config files
NandHandle.CreateConfig(); snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
// do region change on emuNAND even if region switch is not selected if(!fsop_FileExist(testpath))
NandHandle.Do_Region_Change(id, false); need_config = true;
// region change is always done because if it was changed last time then this time it may need to be set back snprintf(testpath, sizeof(testpath), "%s/title/00000001/00000002/data/setting.txt", basepath);
// region switch is done later when D2X cIOS is detected if(!fsop_FileExist(testpath))
need_config = true;
// Check Mii's
snprintf(testpath, sizeof(testpath), "%s/shared2/menu/FaceLib/RFL_DB.dat", basepath);
if(!fsop_FileExist(testpath))
need_miis = true;
NandHandle.PreNandCfg(need_miis, need_config);//copy to emunand if needed
}
} }
} }
else else
@ -1714,13 +1793,13 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
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(); wifi and sd gecko doesnt work anymore after cleanup
//this is a temp region change of real nand(rn) for gamesave or off or DVD if tempregionrn is set true //this is a temp region change of real nand(rn) for gamesave or off or DVD if tempregionrn is set true
bool patchregion = false; bool patchregion = false;
if(emulate_mode <= 1 && !neek2o() && m_cfg.getBool("GENERAL", "tempregionrn", false)) if(emulate_mode <= 1 && !neek2o() && m_cfg.getBool("GENERAL", "tempregionrn", false))
{ {
gprintf("Check\n"); gprintf("Temp region change applied\n");
// change real nand region to game ID[3] region. is reset when you turn wii off.
patchregion = NandHandle.Do_Region_Change(id, true); patchregion = NandHandle.Do_Region_Change(id, true);
} }
//load external booter bin file //load external booter bin file
@ -1741,14 +1820,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(CurrentIOS.Type == IOS_TYPE_D2X) if(CurrentIOS.Type == IOS_TYPE_D2X)
{ {
if(returnTo != 0 && !m_directLaunch && D2X_PatchReturnTo(returnTo) >= 0) if(returnTo != 0 && !m_directLaunch && D2X_PatchReturnTo(returnTo) >= 0)
memset(&returnTo, 0, sizeof(u32)); memset(&returnTo, 0, sizeof(u32));//set to null to keep external booter from setting it again if using d2x
if(emulate_mode) if(emulate_mode)
{ {
/* Enable our Emu NAND */ /* Enable our Emu NAND */
DeviceHandle.UnMountAll(); DeviceHandle.UnMountAll();
if(emulate_mode == 2) if(emulate_mode == 2)
NandHandle.Set_RCMode(true);
else if(emulate_mode == 3)
NandHandle.Set_FullMode(true); NandHandle.Set_FullMode(true);
else else
NandHandle.Set_FullMode(false); NandHandle.Set_FullMode(false);
@ -1763,7 +1840,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
} }
/* no more error msgs - clear btns and snds */ /* no more error msgs - clear btns and snds */
cleanup(); //wifi and sd gecko doesnt work anymore after cleanup cleanup();
bool wbfs_partition = false; bool wbfs_partition = false;
if(!dvd) if(!dvd)
@ -1893,19 +1970,20 @@ void CMenu::_gameSoundThread(CMenu *m)
{ {
m->m_soundThrdBusy = true; m->m_soundThrdBusy = true;
m->m_gamesound_changed = false; m->m_gamesound_changed = false;
CurrentBanner.ClearBanner(); CurrentBanner.ClearBanner();//clear current banner from memory
const dir_discHdr *GameHdr = CoverFlow.getHdr();
u8 *custom_bnr_file = NULL; u8 *custom_bnr_file = NULL;
u32 custom_bnr_size = 0; u32 custom_bnr_size = 0;
char custom_banner[256];
custom_banner[255] = '\0';
u8 *cached_bnr_file = NULL; u8 *cached_bnr_file = NULL;
u32 cached_bnr_size = 0; u32 cached_bnr_size = 0;
char cached_banner[256]; char cached_banner[256];
cached_banner[255] = '\0'; cached_banner[255] = '\0';
char custom_banner[256];
custom_banner[255] = '\0'; m_banner_loaded = false;
const dir_discHdr *GameHdr = CoverFlow.getHdr();
if(GameHdr->type == TYPE_PLUGIN) if(GameHdr->type == TYPE_PLUGIN)
{ {
const char *coverDir = NULL; const char *coverDir = NULL;
@ -1922,12 +2000,11 @@ void CMenu::_gameSoundThread(CMenu *m)
if(custom_bnr_file != NULL) if(custom_bnr_file != NULL)
{ {
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_pluginBanner = true; m_banner_loaded = true;
} }
} }
else else
{ {
m_pluginBanner = false;
m_banner.DeleteBanner(); m_banner.DeleteBanner();
m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize()); m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize());
if(m->m_gameSound.IsLoaded()) if(m->m_gameSound.IsLoaded())
@ -1945,7 +2022,10 @@ void CMenu::_gameSoundThread(CMenu *m)
{ {
custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size); custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size);
if(custom_bnr_file != NULL) if(custom_bnr_file != NULL)
{
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file); fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_banner_loaded = true;
}
} }
else /* no custom ID6 or too big, try ID3 */ else /* no custom ID6 or too big, try ID3 */
{ {
@ -1955,17 +2035,26 @@ void CMenu::_gameSoundThread(CMenu *m)
{ {
custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size); custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size);
if(custom_bnr_file != NULL) if(custom_bnr_file != NULL)
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
}
}
}
if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME)
{ {
//get the gc games banner without sound from ISO fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_banner_loaded = true;
}
}
}
}
if(GameHdr->type == TYPE_GC_GAME && custom_bnr_file == NULL)
{
//get the gc game's opening.bnr from ISO - a 96x32 image to add to the gc banner included with wiiflow
GC_Disc_Reader.init(GameHdr->path); GC_Disc_Reader.init(GameHdr->path);
u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner(); u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner();
if(opening_bnr != NULL) if(opening_bnr != NULL)
{
//creategcbanner adds the opening.bnr image and game title to the wiiflow gc banner
m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, GameHdr->title); m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, GameHdr->title);
m_banner_loaded = true;
}
else
m_banner.DeleteBanner();
GC_Disc_Reader.clear(); GC_Disc_Reader.clear();
//get wiiflow gc ogg sound to play with banner //get wiiflow gc ogg sound to play with banner
m->m_gameSound.Load(gc_ogg, gc_ogg_size, false); m->m_gameSound.Load(gc_ogg, gc_ogg_size, false);
@ -1982,7 +2071,10 @@ void CMenu::_gameSoundThread(CMenu *m)
{ {
cached_bnr_file = (u8*)MEM2_lo_alloc(cached_bnr_size); cached_bnr_file = (u8*)MEM2_lo_alloc(cached_bnr_size);
if(cached_bnr_file != NULL) if(cached_bnr_file != NULL)
{
fsop_ReadFileLoc(cached_banner, cached_bnr_size, (void*)cached_bnr_file); fsop_ReadFileLoc(cached_banner, cached_bnr_size, (void*)cached_bnr_file);
m_banner_loaded = true;
}
} }
} }
@ -1991,12 +2083,19 @@ void CMenu::_gameSoundThread(CMenu *m)
else if(cached_bnr_file != NULL) else if(cached_bnr_file != NULL)
CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size, false, true); CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size, false, true);
else if(GameHdr->type == TYPE_WII_GAME) else if(GameHdr->type == TYPE_WII_GAME)
{
_extractBnr(GameHdr); _extractBnr(GameHdr);
m_banner_loaded = true;
}
else if(GameHdr->type == TYPE_CHANNEL || GameHdr->type == TYPE_EMUCHANNEL) else if(GameHdr->type == TYPE_CHANNEL || GameHdr->type == TYPE_EMUCHANNEL)
_extractChannelBnr(TITLE_ID(GameHdr->settings[0], {
GameHdr->settings[1])); _extractChannelBnr(TITLE_ID(GameHdr->settings[0], GameHdr->settings[1]));
m_banner_loaded = true;
}
if(!CurrentBanner.IsValid()) if(!CurrentBanner.IsValid())
{ {
m_banner_loaded = false;
m->m_gameSound.FreeMemory(); m->m_gameSound.FreeMemory();
m_banner.DeleteBanner(); m_banner.DeleteBanner();
CurrentBanner.ClearBanner(); CurrentBanner.ClearBanner();

View File

@ -178,6 +178,9 @@ bool CMenu::_ExitTo(void)
} }
else if(m_btnMgr.selected(m_homeBtnExitToPriiloader)) else if(m_btnMgr.selected(m_homeBtnExitToPriiloader))
{ {
if(IsOnWiiU())
exitHandler(EXIT_TO_WIIU);
else
exitHandler(EXIT_TO_PRIILOADER); exitHandler(EXIT_TO_PRIILOADER);
break; break;
} }
@ -245,7 +248,8 @@ void CMenu::_showExitTo(void)
m_btnMgr.show(m_homeBtnExitToHBC); m_btnMgr.show(m_homeBtnExitToHBC);
m_btnMgr.show(m_homeBtnExitToMenu); m_btnMgr.show(m_homeBtnExitToMenu);
m_btnMgr.show(m_homeBtnExitToPriiloader); m_btnMgr.show(m_homeBtnExitToPriiloader);// exit to wii u on wii u
if(IsOnWiiU() == false)
m_btnMgr.show(m_homeBtnExitToBootmii); m_btnMgr.show(m_homeBtnExitToBootmii);
m_btnMgr.show(m_homeBtnExitToNeek); m_btnMgr.show(m_homeBtnExitToNeek);
@ -335,9 +339,10 @@ void CMenu::_initHomeAndExitToMenu()
m_homeBtnExitToHBC = _addButton("EXIT_TO/HBC", theme.btnFont, L"", 185, 120, 270, 48, theme.btnFontColor); m_homeBtnExitToHBC = _addButton("EXIT_TO/HBC", theme.btnFont, L"", 185, 120, 270, 48, theme.btnFontColor);
m_homeBtnExitToMenu = _addButton("EXIT_TO/MENU", theme.btnFont, L"", 185, 180, 270, 48, theme.btnFontColor); m_homeBtnExitToMenu = _addButton("EXIT_TO/MENU", theme.btnFont, L"", 185, 180, 270, 48, theme.btnFontColor);
m_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 240, 270, 48, theme.btnFontColor); m_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 240, 270, 48, theme.btnFontColor);
m_homeBtnExitToBootmii = _addButton("EXIT_TO/BOOTMII", theme.btnFont, L"", 185, 300, 270, 48, theme.btnFontColor); m_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 300, 270, 48, theme.btnFontColor);
m_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 360, 270, 48, theme.btnFontColor); m_homeBtnExitToBootmii = _addButton("EXIT_TO/BOOTMII", theme.btnFont, L"", 185, 360, 270, 48, theme.btnFontColor);
_setHideAnim(m_homeBtnExitToHBC, "EXIT_TO/HBC", 0, 0, -4.f, 0.f); _setHideAnim(m_homeBtnExitToHBC, "EXIT_TO/HBC", 0, 0, -4.f, 0.f);
_setHideAnim(m_homeBtnExitToMenu, "EXIT_TO/MENU", 0, 0, -4.f, 0.f); _setHideAnim(m_homeBtnExitToMenu, "EXIT_TO/MENU", 0, 0, -4.f, 0.f);
_setHideAnim(m_homeBtnExitToPriiloader, "EXIT_TO/PRIILOADER", 0, 0, -4.f, 0.f); _setHideAnim(m_homeBtnExitToPriiloader, "EXIT_TO/PRIILOADER", 0, 0, -4.f, 0.f);
@ -367,6 +372,9 @@ void CMenu::_textExitTo(void)
m_btnMgr.setText(m_exittoLblTitle, _t("exit_to", L"Exit To")); m_btnMgr.setText(m_exittoLblTitle, _t("exit_to", L"Exit To"));
m_btnMgr.setText(m_homeBtnExitToHBC, _t("hbc", L"Homebrew Channel")); m_btnMgr.setText(m_homeBtnExitToHBC, _t("hbc", L"Homebrew Channel"));
m_btnMgr.setText(m_homeBtnExitToMenu, _t("menu", L"System Menu")); m_btnMgr.setText(m_homeBtnExitToMenu, _t("menu", L"System Menu"));
if(IsOnWiiU())
m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("wiiu", L"Wii U Menu"));
else
m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader")); m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader"));
m_btnMgr.setText(m_homeBtnExitToBootmii, _t("bootmii", L"Bootmii")); m_btnMgr.setText(m_homeBtnExitToBootmii, _t("bootmii", L"Bootmii"));
if(!neek2o()) if(!neek2o())

View File

@ -193,8 +193,8 @@ void CMenu::_showCF(bool refreshList)
m_numCFVersions = min(max(1, m_coverflow.getInt(cf_domain, "number_of_modes", 1)), 15); m_numCFVersions = min(max(1, m_coverflow.getInt(cf_domain, "number_of_modes", 1)), 15);
/* filter list and start coverflow coverloader */ /* filter list and start coverflow coverloader */
_initCF();
_loadCFLayout(min(max(1, _getCFVersion()), (int)m_numCFVersions)); _loadCFLayout(min(max(1, _getCFVersion()), (int)m_numCFVersions));
_initCF();
CoverFlow.applySettings(); CoverFlow.applySettings();
/* display game count unless sourceflow or homebrew */ /* display game count unless sourceflow or homebrew */
@ -256,7 +256,7 @@ int CMenu::main(void)
} }
SetupInput(true); SetupInput(true);
gprintf("start\n"); gprintf("start wiiflow main screen\n");
while(!m_exit) while(!m_exit)
{ {
/* IMPORTANT check if a disc is inserted */ /* IMPORTANT check if a disc is inserted */
@ -608,10 +608,28 @@ int CMenu::main(void)
} }
else if(BTN_MINUS_PRESSED && !CoverFlow.empty()) else if(BTN_MINUS_PRESSED && !CoverFlow.empty())
{ {
/* WiiFlow should boot a random game */
_hideMain(); _hideMain();
srand(time(NULL)); srand(time(NULL));
u16 place = (rand() + rand() + rand()) % CoverFlow.size(); u16 place = (rand() + rand() + rand()) % CoverFlow.size();
if(m_cfg.getBool("GENERAL", "random_select", false))
{
CoverFlow.setSelected(place);
_game(false);
if(m_exit)
break;
if(BTN_B_HELD)
bUsed = true;
if(m_refreshGameList)
{
/* if changes were made to favorites, parental lock, or categories */
_initCF();
m_refreshGameList = false;
}
else
CoverFlow.cancel();
}
else /* WiiFlow should boot a random game */
{
gprintf("Lets boot the random game number %u\n", place); gprintf("Lets boot the random game number %u\n", place);
const dir_discHdr *gameHdr = CoverFlow.getSpecificHdr(place); const dir_discHdr *gameHdr = CoverFlow.getSpecificHdr(place);
if(gameHdr != NULL) if(gameHdr != NULL)
@ -620,6 +638,7 @@ int CMenu::main(void)
_showCF(false); _showCF(false);
} }
} }
}
/* Hide Notice or Letter if times up */ /* Hide Notice or Letter if times up */
if(m_showtimer > 0) if(m_showtimer > 0)
{ {
@ -741,7 +760,7 @@ int CMenu::main(void)
if(!m_cfg.getBool(CHANNEL_DOMAIN, "neek_return_default", false)) if(!m_cfg.getBool(CHANNEL_DOMAIN, "neek_return_default", false))
{ {
string emuPath; string emuPath;
_FindEmuPart(emuPath, false, false); if(_FindEmuPart(emuPath, false, false) >= 0)// make sure emunand folder exists
ReturnPath = NandHandle.Get_NandPath(); ReturnPath = NandHandle.Get_NandPath();
} }
Sys_SetNeekPath(ReturnPath); Sys_SetNeekPath(ReturnPath);

View File

@ -59,7 +59,10 @@ s16 m_nandemuLblUser[4];
TexData m_nandemuBg; TexData m_nandemuBg;
int nandemuPage = 1; int nandemuPage = 1;
int curEmuNand = 0;
int curSavesNand = 0;
vector<string> emuNands;
vector<string> savesNands;
bool m_nandext; bool m_nandext;
bool m_fulldump; bool m_fulldump;
bool m_sgdump; bool m_sgdump;
@ -99,34 +102,125 @@ void CMenu::_listEmuNands(const char *path, vector<string> &emuNands)
sort(emuNands.begin(), emuNands.end()); sort(emuNands.begin(), emuNands.end());
} }
void CMenu::_checkEmuNandSettings(bool savesnand) void CMenu::_checkEmuNandSettings(void)
{ {
/* make sure partition and directory are legal and legit */ u8 i;
const char *emuNand = NULL; string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
int emuPart; int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
if(savesnand) string savesNand = m_cfg.getString(WII_DOMAIN, "current_save_emunand", "default");
int savesPart = m_cfg.getInt(WII_DOMAIN, "savepartition", 0);
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))// current partition no good
{ {
emuNand = m_cfg.getString(WII_DOMAIN, "current_save_emunand", "default").c_str(); for(i = SD; i < MAXDEVICES; i++)// find first usable partition
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition", 0); {
if(DeviceHandle.PartitionUsableForNandEmu(i))
emuPart = i;
} }
if(i == MAXDEVICES)// if no usable partitions found set to SD for now
emuPart = SD;
}
if(!DeviceHandle.PartitionUsableForNandEmu(savesPart))// do same for savesnand partition
{
for(i = SD; i < MAXDEVICES; i++)
{
if(DeviceHandle.PartitionUsableForNandEmu(i))
savesPart = i;
}
if(i == MAXDEVICES)
savesPart = SD;
}
//cfgne8=No valid FAT partition found for NAND Emulation!
_listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands);
curEmuNand = 0;
for(i = 0; i < emuNands.size(); ++i)// find current emunand folder
{
if(emuNands[i] == emuNand)
{
curEmuNand = i;
break;
}
}
if(i == emuNands.size())// didn't find emunand folder so set to default
{
for(i = 0; i < emuNands.size(); ++i)
{
if(emuNands[i] == "default")
{
curEmuNand = i;
break;
}
}
}
_listEmuNands(fmt("%s:/%s", DeviceName[savesPart], emu_nands_dir), savesNands);
curSavesNand = 0;
for(i = 0; i < savesNands.size(); ++i)// find current savesnand folder
{
if(savesNands[i] == savesNand)
{
curSavesNand = i;
break;
}
}
if(i == savesNands.size())// didn't find savesnand folder set to default
{
for(i = 0; i < savesNands.size(); ++i)
{
if(savesNands[i] == "default")
{
curSavesNand = i;
break;
}
}
}
m_cfg.setString(WII_DOMAIN, "current_save_emunand", savesNands[curSavesNand]);
m_cfg.setInt(WII_DOMAIN, "savepartition", savesPart);
m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", emuNands[curEmuNand]);
m_cfg.setInt(CHANNEL_DOMAIN, "partition", emuPart);
// add check if full emulation and if is then check for config and mii files
_FullNandCheck();
}
void CMenu::_FullNandCheck(void)
{
if(neek2o())
return;
for(u8 i = 0; i < 2; i++)
{
int emulate_mode;
if(i == 0)
emulate_mode = m_cfg.getInt(CHANNEL_DOMAIN, "emulation", 0);
else else
emulate_mode = m_cfg.getInt(WII_DOMAIN, "save_emulation", 0);
if((i == 0 && emulate_mode == 1) || (i == 1 && emulate_mode == 2))//full
{ {
emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str(); string emuPath;
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); int emuPart = _FindEmuPart(emuPath, true, i);
} if(emuPart < 0)
const char *tmpPath = fmt("/%s/%s", emu_nands_dir, emuNand); continue;
/* check if partition is FAT && emuNAND directory exist*/ bool need_config = false;
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart) || !_TestEmuNand(emuPart, tmpPath, false)) bool need_miis = false;
{
if(savesnand) char testpath[MAX_FAT_PATH];
{ char basepath[MAX_FAT_PATH];
m_cfg.setString(WII_DOMAIN, "current_save_emunand", "default"); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
m_cfg.getInt(WII_DOMAIN, "savepartition", 0);
} //check config files
else snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
{ if(!fsop_FileExist(testpath))
m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", "default"); need_config = true;
m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0); snprintf(testpath, sizeof(testpath), "%s/title/00000001/00000002/data/setting.txt", basepath);
if(!fsop_FileExist(testpath))
need_config = true;
// Check Mii's
snprintf(testpath, sizeof(testpath), "%s/shared2/menu/FaceLib/RFL_DB.dat", basepath);
if(!fsop_FileExist(testpath))
need_miis = true;
NandHandle.PreNandCfg(need_miis, need_config);//copy to emunand if needed
} }
} }
} }
@ -147,7 +241,7 @@ int CMenu::_FindEmuPart(string &emuPath, bool skipchecks, bool savesnand)
} }
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart)) if(!DeviceHandle.PartitionUsableForNandEmu(emuPart))
return -1; return -1;
else if((skipchecks || _TestEmuNand(emuPart, tmpPath, true)))// true should only be true if emulation set to full else if((skipchecks || _TestEmuNand(emuPart, tmpPath, false)))//check if emunand folder exist
{ {
NandHandle.SetNANDEmu(emuPart); NandHandle.SetNANDEmu(emuPart);
NandHandle.SetPaths(tmpPath, DeviceName[emuPart]); NandHandle.SetPaths(tmpPath, DeviceName[emuPart]);
@ -427,38 +521,10 @@ int CMenu::_NandEmuCfg(void)
{ {
nandemuPage = 1; nandemuPage = 1;
string ExtNand = ""; string ExtNand = "";
vector<string> emuNands;
vector<string> savesNands;
string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand"); string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand");
int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
string savesNand = m_cfg.getString(WII_DOMAIN, "current_save_emunand");
int savesPart = m_cfg.getInt(WII_DOMAIN, "savepartition");
_listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands);
int curEmuNand = 0;
for(u8 i = 0; i < emuNands.size(); ++i)
{
if(emuNands[i] == emuNand)
{
curEmuNand = i;
break;
}
}
_listEmuNands(fmt("%s:/%s", DeviceName[savesPart], emu_nands_dir), savesNands);
int curSavesNand = 0;
for(u8 i = 0; i < savesNands.size(); ++i)
{
if(savesNands[i] == savesNand)
{
curSavesNand = i;
break;
}
}
lwp_t thread = 0; lwp_t thread = 0;
SetupInput(); SetupInput();
_checkEmuNandSettings();
_showNandEmu(); _showNandEmu();
m_thrdStop = false; m_thrdStop = false;
@ -489,11 +555,11 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.click(m_nandemuBtnPageP); m_btnMgr.click(m_nandemuBtnPageP);
_showNandEmu(); _showNandEmu();
} }
else if((BTN_HOME_PRESSED || BTN_B_PRESSED))// && !m_thrdWorking) else if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
break; break;
else if(BTN_UP_PRESSED) else if(BTN_UP_PRESSED && !m_thrdWorking)
m_btnMgr.up(); m_btnMgr.up();
else if(BTN_DOWN_PRESSED) else if(BTN_DOWN_PRESSED && !m_thrdWorking)
m_btnMgr.down(); m_btnMgr.down();
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnEmulationP) || m_btnMgr.selected(m_nandemuBtnEmulationM))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnEmulationP) || m_btnMgr.selected(m_nandemuBtnEmulationM)))
{ {
@ -514,9 +580,20 @@ int CMenu::_NandEmuCfg(void)
m_emuSaveNand = true; m_emuSaveNand = true;
_setPartition(direction); _setPartition(direction);
m_emuSaveNand = false; m_emuSaveNand = false;
_checkEmuNandSettings();// refresh emunands in case the partition was changed
_showNandEmu(); _showNandEmu();
} }
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing)))
{
string emuPath;
int emuPart = _FindEmuPart(emuPath, true, !m_fulldump);
if(emuPart < 0)
{
_hideNandEmu(true);
error(_t("cfgne8", L"No valid FAT partition found for NAND Emulation!"));
_showNandEmu();
}
else // partition usable
{ {
m_fulldump = m_btnMgr.selected(m_nandemuBtnNandDump) ? true : false; m_fulldump = m_btnMgr.selected(m_nandemuBtnNandDump) ? true : false;
m_saveall = m_btnMgr.selected(m_nandemuBtnAll) ? true : false; m_saveall = m_btnMgr.selected(m_nandemuBtnAll) ? true : false;
@ -539,12 +616,16 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND Extractor")); m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND Extractor"));
} }
else else
{
ExtNand = savesNands[curSavesNand];
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game Save Extractor")); m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game Save Extractor"));
}
m_thrdStop = false; m_thrdStop = false;
m_thrdProgress = 0.f; m_thrdProgress = 0.f;
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40);
} }
}
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSelectP) || m_btnMgr.selected(m_nandemuBtnNandSelectM))) else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandSelectP) || m_btnMgr.selected(m_nandemuBtnNandSelectM)))
{ {
s8 direction = m_btnMgr.selected(m_nandemuBtnNandSelectP) ? 1 : -1; s8 direction = m_btnMgr.selected(m_nandemuBtnNandSelectP) ? 1 : -1;
@ -610,6 +691,7 @@ int CMenu::_NandEmuCfg(void)
} }
} }
_hideNandEmu(); _hideNandEmu();
_FullNandCheck();
if(emuNand != m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") || emuNand == ExtNand) if(emuNand != m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") || emuNand == ExtNand)
{ {
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true); m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
@ -621,11 +703,11 @@ int CMenu::_NandEmuCfg(void)
int CMenu::_FlashSave(string gameId) int CMenu::_FlashSave(string gameId)
{ {
int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition"); string emuPath;
char basepath[MAX_FAT_PATH]; if(_FindEmuPart(emuPath, false, true) < 0)// if savenand not found
snprintf(basepath, sizeof(basepath), "%s:/%s/%s", DeviceName[emuPartition], emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str()); return 0;
if(!_checkSave(gameId, false))// if save not on emu nand if(!_checkSave(gameId, false))// if save not on savenand
return 0; return 0;
lwp_t thread = 0; lwp_t thread = 0;
@ -658,11 +740,8 @@ int CMenu::_FlashSave(string gameId)
m_thrdWorking = true; m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandFlasher, (void *)this, 0, 32768, 40); LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandFlasher, (void *)this, 0, 32768, 40);
} }
else if(BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))) if(!m_thrdWorking && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))))
{ break;
_hideNandEmu();
return 1;
}
if(m_thrdMessageAdded) if(m_thrdMessageAdded)
{ {
@ -689,24 +768,49 @@ int CMenu::_FlashSave(string gameId)
} }
} }
_hideNandEmu(); _hideNandEmu();
return 0; return 1;
} }
int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or launching wii game int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or launching wii game
{ {
string emuPath;
int emuPart = _FindEmuPart(emuPath, false, true);
if(m_forceext && emuPart == -1)// if game config force extract and savenand partition unusable
{
m_forceext = false;
return 0;
}
/*else if(emuPart == -2)// emunand folder not found so make it
{
emuPart = _FindEmuPart(emuPath, true, true);
char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
NandHandle.CreatePath("%s/import", basepath);
NandHandle.CreatePath("%s/meta", basepath);
NandHandle.CreatePath("%s/shared1", basepath);
NandHandle.CreatePath("%s/shared2", basepath);
NandHandle.CreatePath("%s/sys", basepath);
NandHandle.CreatePath("%s/title", basepath);
NandHandle.CreatePath("%s/ticket", basepath);
NandHandle.CreatePath("%s/tmp", basepath);
}*/
if(!_checkSave(gameId, true))//if save not on real nand if(!_checkSave(gameId, true))//if save not on real nand
return 0; return 0;
if(!m_forceext && _checkSave(gameId, false))//if not force extract and save is already on emunand if(!m_forceext && _checkSave(gameId, false))//if wii game launch and save is already on emunand
return 1; return 1;
lwp_t thread = 0; lwp_t thread = 0;
SetupInput();
m_thrdStop = false; m_thrdStop = false;
m_thrdMessageAdded = false; m_thrdMessageAdded = false;
m_nandext = false; m_nandext = false;
m_saveExtGameId = gameId;
bool finished = false;
if(!m_forceext) SetupInput();
if(!m_forceext)// if wii game launch show this prompt menu
{ {
m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne24", L"Extract save")); m_btnMgr.setText(m_nandemuBtnExtract, _t("cfgne24", L"Extract save"));
m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne25", L"Create new save")); m_btnMgr.setText(m_nandemuBtnDisable, _t("cfgne25", L"Create new save"));
@ -716,14 +820,12 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
m_btnMgr.show(m_nandemuLblInit); m_btnMgr.show(m_nandemuLblInit);
} }
m_saveExtGameId = gameId;
while(!m_exit) while(!m_exit)
{ {
_mainLoopCommon(); _mainLoopCommon();
if(BTN_UP_PRESSED) if(BTN_UP_PRESSED && !m_thrdWorking)
m_btnMgr.up(); m_btnMgr.up();
else if(BTN_DOWN_PRESSED) else if(BTN_DOWN_PRESSED && !m_thrdWorking)
m_btnMgr.down(); m_btnMgr.down();
else if((BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnExtract)) || m_forceext) else if((BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnExtract)) || m_forceext)
{ {
@ -750,26 +852,11 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
} }
else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnDisable))//create new save else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnDisable))//create new save
{ {
int emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition");
const char *emuPath = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str());
char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath);
NandHandle.CreatePath("%s/import", basepath);
NandHandle.CreatePath("%s/meta", basepath);
NandHandle.CreatePath("%s/shared1", basepath);
NandHandle.CreatePath("%s/shared2", basepath);
NandHandle.CreatePath("%s/sys", basepath);
NandHandle.CreatePath("%s/title", basepath);
NandHandle.CreatePath("%s/ticket", basepath);
NandHandle.CreatePath("%s/tmp", basepath);
_hideNandEmu(); _hideNandEmu();
return 0; return 0;
} }
else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack)) else if(finished && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))))
{ break;
_hideNandEmu();
return 1;
}
if(m_thrdMessageAdded) if(m_thrdMessageAdded)
{ {
@ -784,6 +871,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
if(!m_thrdWorking) if(!m_thrdWorking)
{ {
finished = true;
m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone)); m_btnMgr.setText(m_nandfinLblDialog, wfmt(_fmt("cfgne14", L"Extracted: %d saves / %d files / %d folders"), m_nandexentry, m_filesdone, m_foldersdone));
if(m_dumpsize/0x400 > 0x270f) if(m_dumpsize/0x400 > 0x270f)
m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMB (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2)); m_btnMgr.setText(m_nandemuLblDialog, wfmt(_fmt("cfgne16", L"Total size: %uMB (%d blocks)"), (m_dumpsize/0x100000), (m_dumpsize/0x8000)>>2));
@ -796,27 +884,29 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
} }
} }
_hideNandEmu(); _hideNandEmu();
return 0; return 1;
} }
int CMenu::_NandFlasher(void *obj) int CMenu::_NandFlasher(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
string emuPath;
char source[MAX_FAT_PATH]; char source[MAX_FAT_PATH];
char dest[ISFS_MAXPATH]; char dest[ISFS_MAXPATH];
string emuPath;
int emuPartition = m._FindEmuPart(emuPath, true, true);
const char *SaveGameID = m.m_saveExtGameId.c_str(); const char *SaveGameID = m.m_saveExtGameId.c_str();
int emuPartition = m._FindEmuPart(emuPath, false, true);
int flashID = SaveGameID[0] << 24 | SaveGameID[1] << 16 | SaveGameID[2] << 8 | SaveGameID[3]; int flashID = SaveGameID[0] << 24 | SaveGameID[1] << 16 | SaveGameID[2] << 8 | SaveGameID[3];
/* we know it exist on emunand just need to figure out which folder */
if(_saveExists(fmt("%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID))) if(_saveExists(fmt("%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID)))
{ {
snprintf(source, sizeof(source), "%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID); snprintf(source, sizeof(source), "%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID);
snprintf(dest, sizeof(dest), "/title/00010000/%08x", flashID); snprintf(dest, sizeof(dest), "/title/00010000/%08x", flashID);
} }
else if(_saveExists(fmt("%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID))) else //if(_saveExists(fmt("%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID)))
{ {
snprintf(source, sizeof(source), "%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID); snprintf(source, sizeof(source), "%s:%s/title/00010004/%08x", DeviceName[emuPartition], emuPath.c_str(), flashID);
snprintf(dest, sizeof(dest), "/title/00010004/%08x", flashID); snprintf(dest, sizeof(dest), "/title/00010004/%08x", flashID);
@ -827,7 +917,6 @@ int CMenu::_NandFlasher(void *obj)
m_nandext = true; m_nandext = true;
NandHandle.FlashToNAND(source, dest, _ShowProgress, obj); NandHandle.FlashToNAND(source, dest, _ShowProgress, obj);
m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m_btnMgr.hide(m_nandfilePBar); m_btnMgr.hide(m_nandfilePBar);
m_btnMgr.hide(m_nandfileLblMessage); m_btnMgr.hide(m_nandfileLblMessage);
@ -835,14 +924,14 @@ int CMenu::_NandFlasher(void *obj)
m_btnMgr.hide(m_nandemuLblMessage); m_btnMgr.hide(m_nandemuLblMessage);
m._setDumpMsg(m._t("cfgne30", L"Flashing save files finished!"), 1.f, 1.f); m._setDumpMsg(m._t("cfgne30", L"Flashing save files finished!"), 1.f, 1.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
m.m_thrdWorking = false;
return 0; return 0;
} }
int CMenu::_NandDumper(void *obj) int CMenu::_NandDumper(void *obj)
{ {
CMenu &m = *(CMenu *)obj; CMenu &m = *(CMenu *)obj;
string emuPath;
int emuPartition = -1;
m_nandext = false; m_nandext = false;
m_sgdump = false; m_sgdump = false;
m.m_dumpsize = 0; m.m_dumpsize = 0;
@ -850,43 +939,33 @@ int CMenu::_NandDumper(void *obj)
m.m_foldersdone = 0; m.m_foldersdone = 0;
NandHandle.ResetCounters(); NandHandle.ResetCounters();
emuPartition = m._FindEmuPart(emuPath, true, !m_fulldump);
if(emuPartition < 0)
{
//m.error(m._t("cfgne8", L"No valid FAT partition found for NAND Emulation!"));
m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex);
m_btnMgr.hide(m_nandfilePBar);
m_btnMgr.hide(m_nandfileLblMessage);
m_btnMgr.hide(m_nandemuPBar);
m_btnMgr.hide(m_nandemuLblMessage);
m._setDumpMsg(m._t("cfgne8", L"No valid FAT partition found for NAND Emulation!"), 1.f, 1.f);
LWP_MutexUnlock(m.m_mutex);
return 0;
}
string emuPath;
int emuPartition = m._FindEmuPart(emuPath, true, !m_fulldump);
char basepath[64]; char basepath[64];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str()); snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPartition], emuPath.c_str());
/* create basepath in case it doesn't exist */
NandHandle.CreatePath("%s", basepath);
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setDumpMsg(m._t("cfgne27", L"Calculating space needed for extraction..."), 0.f, 0.f); m._setDumpMsg(m._t("cfgne27", L"Calculating space needed for extraction..."), 0.f, 0.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
if(m_fulldump) if(m_fulldump)/* full nand dump */
{ {
m.m_dumpsize = NandHandle.CalcDumpSpace("/", CMenu::_ShowProgress, obj); m.m_dumpsize = NandHandle.CalcDumpSpace("/", CMenu::_ShowProgress, obj);
m_nandext = true; m_nandext = true;
NandHandle.DoNandDump("/", basepath, CMenu::_ShowProgress, obj); NandHandle.DoNandDump("/", basepath, CMenu::_ShowProgress, obj);
} }
else else /* gamesave(s) dump */
{ {
bool missingOnly = !m_saveall; bool missingOnly = !m_saveall;
vector<string> saveList; vector<string> saveList;
m_sgdump = true; m_sgdump = true;
if(m.m_saveExtGameId.empty()) if(m.m_saveExtGameId.empty())// if not a specified gamesave from game config menu or launching wii game
{ {
/* extract all or missing gamesaves - main emunand settings menu */
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f); m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
@ -899,7 +978,7 @@ int CMenu::_NandDumper(void *obj)
{ {
string id((const char *)m.m_gameList[i].id, 4); string id((const char *)m.m_gameList[i].id, 4);
if(!missingOnly || !m._checkSave(id, false))// all or if save not on emu nand if(!missingOnly || !m._checkSave(id, false))// if all or gamesave not already on emunand
{ {
if(m._checkSave(id, true))// if save on real nand if(m._checkSave(id, true))// if save on real nand
{ {
@ -910,12 +989,13 @@ int CMenu::_NandDumper(void *obj)
} }
} }
} }
else else /*one gamesave extract from game config menu or launching wii game */
{ {
m.m_nandexentry = 1; m.m_nandexentry = 1;
saveList.push_back(m.m_saveExtGameId); saveList.push_back(m.m_saveExtGameId);
} }
/* for loop to calculate SD or HDD space NanHandle will need for the actual savegame(s) dump */
for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i) for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i)
{ {
char source[ISFS_MAXPATH]; char source[ISFS_MAXPATH];
@ -926,6 +1006,7 @@ int CMenu::_NandDumper(void *obj)
m.m_dumpsize = NandHandle.CalcDumpSpace(source, CMenu::_ShowProgress, obj); m.m_dumpsize = NandHandle.CalcDumpSpace(source, CMenu::_ShowProgress, obj);
} }
/* for loop to do the actual savegame(s) dump */
for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i) for(u32 i = 0; i < saveList.size() && !m.m_thrdStop; ++i)
{ {
char source[ISFS_MAXPATH]; char source[ISFS_MAXPATH];
@ -939,7 +1020,6 @@ int CMenu::_NandDumper(void *obj)
} }
} }
m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex); LWP_MutexLock(m.m_mutex);
m_btnMgr.hide(m_nandfilePBar); m_btnMgr.hide(m_nandfilePBar);
m_btnMgr.hide(m_nandfileLblMessage); m_btnMgr.hide(m_nandfileLblMessage);
@ -947,6 +1027,7 @@ int CMenu::_NandDumper(void *obj)
m_btnMgr.hide(m_nandemuLblMessage); m_btnMgr.hide(m_nandemuLblMessage);
m._setDumpMsg(m._t("cfgne19", L"Extraction finished!"), 1.f, 1.f); m._setDumpMsg(m._t("cfgne19", L"Extraction finished!"), 1.f, 1.f);
LWP_MutexUnlock(m.m_mutex); LWP_MutexUnlock(m.m_mutex);
m.m_thrdWorking = false;
return 0; return 0;
} }

View File

@ -411,6 +411,8 @@ void CMenu::update_pThread(u64 added)
} }
} }
/* only installs channel wads to emunand and mios wads to real nand */
/* several places gecko prints are used but no error msg to the user is displayed */
void CMenu::_Wad(const char *wad_path) void CMenu::_Wad(const char *wad_path)
{ {
if(wad_path == NULL) if(wad_path == NULL)
@ -436,10 +438,21 @@ void CMenu::_Wad(const char *wad_path)
} }
vector<string> emuNands; vector<string> emuNands;
string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand"); string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
_listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands);
int curEmuNand = 0; int curEmuNand = 0;
string emuPath;
int emuPart = 0;
if(!mios)
{
emuPart = _FindEmuPart(emuPath, false, false);
if(emuPart < 0)
{
//cfgne8=No valid FAT partition found for NAND Emulation!
//error
return;
}
_listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands);
for(u8 i = 0; i < emuNands.size(); ++i) for(u8 i = 0; i < emuNands.size(); ++i)
{ {
if(emuNands[i] == emuNand) if(emuNands[i] == emuNand)
@ -448,9 +461,9 @@ void CMenu::_Wad(const char *wad_path)
break; break;
} }
} }
m_btnMgr.setText(m_wadLblDialog, wfmt(_fmt("wad7", L"Ready to install %s\nChoose emuNAND and then click Go."), (strrchr(wad_path, '/')+1))); m_btnMgr.setText(m_wadLblDialog, wfmt(_fmt("wad7", L"Ready to install %s\nChoose emuNAND and then click Go."), (strrchr(wad_path, '/')+1)));
m_btnMgr.setText(m_wadLblNandSelectVal, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand")); m_btnMgr.setText(m_wadLblNandSelectVal, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand"));
}
_showWad(); _showWad();
while(!m_exit) while(!m_exit)
@ -476,8 +489,8 @@ void CMenu::_Wad(const char *wad_path)
/* mios is real nand, chans are emu */ /* mios is real nand, chans are emu */
if(mios == false) if(mios == false)
{ {
const char *emu_char = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str()); const char *emu_char = fmt("/%s/%s", emu_nands_dir, emuNands[curEmuNand].c_str());
NandHandle.SetPaths(emu_char, DeviceName[currentPartition]); NandHandle.SetPaths(emu_char, DeviceName[emuPart]);
} }
_start_pThread(); _start_pThread();
m_thrdMessage = _t("wad4", L"Installing WAD, please wait..."); m_thrdMessage = _t("wad4", L"Installing WAD, please wait...");
@ -498,12 +511,15 @@ void CMenu::_Wad(const char *wad_path)
} }
} }
} }
if(!mios)
{
if(m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") == emuNand) if(m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") == emuNand)
{ {
m_refreshGameList = true; m_refreshGameList = true;
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true); m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
} }
m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", emuNand);//restore it m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", emuNand);//restore it
}
_hideWad(); _hideWad();
/* onscreen message might be onscreen still */ /* onscreen message might be onscreen still */
m_btnMgr.hide(m_wbfsLblMessage); m_btnMgr.hide(m_wbfsLblMessage);

View File

@ -214,7 +214,7 @@ void AifDecoder::CloseFile()
file_fd = NULL; file_fd = NULL;
} }
int AifDecoder::Read(u8 * buffer, int buffer_size, int) int AifDecoder::Read(u8 * buffer, int buffer_size)
{ {
if(!file_fd) if(!file_fd)
return -1; return -1;

View File

@ -37,7 +37,7 @@ public:
~AifDecoder(); ~AifDecoder();
int GetFormat() { return Format; }; int GetFormat() { return Format; };
int GetSampleRate() { return SampleRate; }; int GetSampleRate() { return SampleRate; };
int Read(u8 *buffer, int buffer_size, int pos); int Read(u8 *buffer, int buffer_size);
protected: protected:
void OpenFile(); void OpenFile();
void CloseFile(); void CloseFile();

View File

@ -111,7 +111,7 @@ void BNSDecoder::CloseFile()
file_fd = NULL; file_fd = NULL;
} }
int BNSDecoder::Read(u8 * buffer, int buffer_size, int) int BNSDecoder::Read(u8 * buffer, int buffer_size)
{ {
if(!SoundData.buffer) if(!SoundData.buffer)
return -1; return -1;

View File

@ -47,7 +47,7 @@ public:
virtual ~BNSDecoder(); virtual ~BNSDecoder();
int GetFormat() { return SoundData.format; }; int GetFormat() { return SoundData.format; };
int GetSampleRate() { return SoundData.frequency; }; int GetSampleRate() { return SoundData.frequency; };
int Read(u8 * buffer, int buffer_size, int pos); int Read(u8 * buffer, int buffer_size);
protected: protected:
void OpenFile(); void OpenFile();
void CloseFile(); void CloseFile();

View File

@ -90,7 +90,7 @@ void Mp3Decoder::OpenFile()
} }
u8 dummybuff[4096]; u8 dummybuff[4096];
int ret = Read((u8 *) &dummybuff, 4096, 0); int ret = Read((u8 *) &dummybuff, 4096);
if(ret <= 0) if(ret <= 0)
{ {
if(file_fd) if(file_fd)
@ -135,7 +135,7 @@ static inline s16 FixedToShort(mad_fixed_t Fixed)
return((s16)Fixed); return((s16)Fixed);
} }
int Mp3Decoder::Read(u8 * buffer, int buffer_size, int) int Mp3Decoder::Read(u8 * buffer, int buffer_size)
{ {
if(!file_fd) if(!file_fd)
return -1; return -1;
@ -212,4 +212,6 @@ int Mp3Decoder::Read(u8 * buffer, int buffer_size, int)
mad_synth_frame(&Synth,&Frame); mad_synth_frame(&Synth,&Frame);
SynthPos = 0; SynthPos = 0;
} }
return 0;
} }

View File

@ -36,7 +36,7 @@ public:
int GetFormat() { return Format; }; int GetFormat() { return Format; };
int GetSampleRate() { return SampleRate; }; int GetSampleRate() { return SampleRate; };
int Rewind(); int Rewind();
int Read(u8 * buffer, int buffer_size, int pos); int Read(u8 * buffer, int buffer_size);
protected: protected:
void OpenFile(); void OpenFile();
struct mad_stream Stream; struct mad_stream Stream;

View File

@ -137,7 +137,7 @@ int OggDecoder::Seek(int pos)
return ov_raw_seek(&ogg_file, pos); return ov_raw_seek(&ogg_file, pos);
} }
int OggDecoder::Read(u8 * buffer, int buffer_size, int) int OggDecoder::Read(u8 * buffer, int buffer_size)
{ {
if(!file_fd) if(!file_fd)
return -1; return -1;

View File

@ -37,7 +37,7 @@ public:
int GetFormat(); int GetFormat();
int GetSampleRate(); int GetSampleRate();
int Rewind(); int Rewind();
int Read(u8 * buffer, int buffer_size, int pos); int Read(u8 * buffer, int buffer_size);
int Tell(); int Tell();
int Seek(int pos); int Seek(int pos);
protected: protected:

View File

@ -84,7 +84,7 @@ int SoundDecoder::Rewind()
return 0; return 0;
} }
int SoundDecoder::Read(u8 * buffer, int buffer_size, int) int SoundDecoder::Read(u8 * buffer, int buffer_size)
{ {
int ret = file_fd->read(buffer, buffer_size); int ret = file_fd->read(buffer, buffer_size);
CurPos += ret; CurPos += ret;
@ -123,7 +123,7 @@ void SoundDecoder::Decode()
while(done < SoundBlockSize) while(done < SoundBlockSize)
{ {
int ret = Read(&write_buf[done], SoundBlockSize-done, Tell()); int ret = Read(&write_buf[done], SoundBlockSize-done);
if(ret <= 0) if(ret <= 0)
{ {

View File

@ -51,7 +51,7 @@ public:
SoundDecoder(const char * filepath); SoundDecoder(const char * filepath);
SoundDecoder(const u8 * buffer, int size); SoundDecoder(const u8 * buffer, int size);
virtual ~SoundDecoder(); virtual ~SoundDecoder();
virtual int Read(u8 * buffer, int buffer_size, int pos); virtual int Read(u8 * buffer, int buffer_size);
virtual int Tell() { return CurPos; }; virtual int Tell() { return CurPos; };
virtual int Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); }; virtual int Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); };
virtual int Rewind(); virtual int Rewind();

View File

@ -152,7 +152,7 @@ void WavDecoder::CloseFile()
file_fd = NULL; file_fd = NULL;
} }
int WavDecoder::Read(u8 * buffer, int buffer_size, int) int WavDecoder::Read(u8 * buffer, int buffer_size)
{ {
if(!file_fd) if(!file_fd)
return -1; return -1;

View File

@ -84,7 +84,7 @@ public:
~WavDecoder(); ~WavDecoder();
int GetFormat() { return Format; }; int GetFormat() { return Format; };
int GetSampleRate() { return SampleRate; }; int GetSampleRate() { return SampleRate; };
int Read(u8 * buffer, int buffer_size, int pos); int Read(u8 * buffer, int buffer_size);
protected: protected:
void OpenFile(); void OpenFile();
void CloseFile(); void CloseFile();

View File

@ -203,7 +203,7 @@ bool GuiSound::Load(const u8 *snd, u32 len, bool isallocated)
if(snd == NULL || len == 0) if(snd == NULL || len == 0)
return false; return false;
if(!isallocated && memcmp(snd, "RIFF", 4) == 0) if(!isallocated && memcmp(snd, "RIFF", 4) == 0)// "RIFF" is in WAV files
return LoadSoundEffect(snd, len); return LoadSoundEffect(snd, len);
sound = (u8*)snd; sound = (u8*)snd;
@ -245,7 +245,7 @@ bool GuiSound::LoadSoundEffect(const u8 * snd, u32 len)
sound = tmpsnd; sound = tmpsnd;
int read = decoder.Read(sound+done, 4096, done); int read = decoder.Read(sound+done, 4096);
if(read <= 0) if(read <= 0)
break; break;

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1"> <app version="1">
<name> WiiFlow Lite</name> <name>WiiFlow Lite</name>
<coder>Fledge68</coder> <coder>Fledge68</coder>
<version>4.4.0 r1130</version> <version>4.4.0 r1135</version>
<release_date>20161412000000</release_date> <release_date>20172109000000</release_date>
<short_description>USB Loader app</short_description> <short_description>USB Loader app</short_description>
<long_description> <long_description>
WiiFlow Lite is a app for loading games from a USB Device, SD card, or an actual Disc. WiiFlow Lite is a app for loading backup games from a USB Device or SD card.
It dispays your games in a coverflow with 3D full box covers. It displays your games in a coverflow with 3D full box covers.
Key features: Key features:
* Emulated NAND support * Emulated NAND support

View File

@ -455,3 +455,4 @@ wifiplayers= Wifi Players
wii=Wii wii=Wii
wiichannels=Offical Wii Channels wiichannels=Offical Wii Channels
wiiware=WiiWare wiiware=WiiWare
wiiu=Wii U Menu