* 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;
}
}
gprintf("AHBPROT: %d, Key ID: %u\n", AHBRPOT_Patched(), keyId);
gprintf("AHBPROT: %d, Key ID: %u\n", AHBPROT_Patched(), keyId);
free(tmdBuffer);
free(tikBuffer);
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()
{
if(AHBRPOT_Patched())
if(AHBPROT_Patched())
{
// Disable memory protection
write16(MEM_PROT, 0);

View File

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

View File

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

View File

@ -643,7 +643,7 @@ void CCoverFlow::stopCoverLoader(bool empty)
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,
(void*)this, coverThreadStack, coverThreadStackSize, 30);
//gprintf("Coverflow started!\n");
gprintf("Coverflow started!\n");
}
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;
}
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)
{
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)
{
gprintf("loading %s cover\n", box ? (blankBoxCover ? "blank" : "box") : "flat");
if(!m_loadingCovers) return false;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;

View File

@ -56,6 +56,7 @@ public:
void simulateOtherScreenFormat(bool s);
// Commands
void tick(void);
void setSelected(int i);
bool findId(const char *id, bool instant = false, bool path = false);
void pageUp(void);
void pageDown(void);
@ -207,7 +208,7 @@ private:
} ATTRIBUTE_PACKED;
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 targetScale;
Vector3D angle;

View File

@ -199,7 +199,7 @@ void CVideo::init(void)
m_rmode->viXOrigin += hoffset;
/* 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);
mask32(0xd8006a8, 0, 2);

View File

@ -131,8 +131,10 @@ static void Create_Wii_EXT_List(char *FullPath)
u8 gc_disc[1];
const char *FST_APPEND = "sys/boot.bin";
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)
{
u32 hdr_offset = 0x00;
FILE *fp = fopen(FullPath, "rb");
if(!fp && strstr(FullPath, "/root") != NULL) //fst folder
{
@ -143,12 +145,19 @@ static void Create_GC_List(char *FullPath)
if(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)
{
AddISO((const char*)gc_hdr.id, (const char*)gc_hdr.title,
FullPath, 0x000000, TYPE_GC_GAME);
/* Check for disc 2 */
fseek(fp, 6, SEEK_SET);
fseek(fp, hdr_offset + 0x06, SEEK_SET);
fread(gc_disc, 1, 1, fp);
if(gc_disc[0])
{

View File

@ -62,7 +62,7 @@ bool loadIOS(int ios, bool MountDevices)
ShutdownBeforeExit();
NandHandle.Patch_AHB(); //No AHBPROT for the next IOS
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();
WDVD_Init();
}

View File

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

View File

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

View File

@ -81,35 +81,37 @@ int main(int argc, char **argv)
m_vid.waitMessage(0.15f);
Open_Inputs();
mainMenu.init();
if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode())
if(mainMenu.init())
{
if(useMainIOS || !DeviceHandle.UsablePartitionMounted())
if(CurrentIOS.Version != mainIOS && !neek2o() && !Sys_DolphinMode())
{
useMainIOS = false;
mainMenu.TempLoadIOS();
iosOK = CustomIOS(CurrentIOS.Type);
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.");
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(gameid != NULL && strlen(gameid) == 6)
mainMenu.directlaunch(gameid);
else
mainMenu.main();
//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...
mainMenu.cleanup();// removes all sounds, fonts, images, coverflow, plugin stuff, source menu and clear memory
}
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.");
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(gameid != NULL && strlen(gameid) == 6)
mainMenu.directlaunch(gameid);
else
mainMenu.main();
//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...
mainMenu.cleanup();// cleanup and clear memory
ShutdownBeforeExit();// unmount devices and close inputs
Sys_Exit();
return 0;

View File

@ -107,7 +107,7 @@ static void GrabINIFiles(char *FullPath)
INI_List.push_back(FullPath);
}
void CMenu::init()
bool CMenu::init()
{
SoundHandle.Init();
m_gameSound.SetVoice(1);
@ -126,16 +126,25 @@ void CMenu::init()
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
{
_buildMenus();
error(_fmt("errboot4", L"No apps/wiiflow directory found!"));
m_exit = true;
return;
/* Could not find a device to save configuration files on! */
//m_exit = true;
return false;
}
_loadDefaultFont();// load default font
/* Handle apps dir first, so handling wiiflow.ini does not fail */
m_appDir = fmt("%s:/%s", drive, APPS_DIR);
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 */
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 */
m_use_wifi_gecko = m_cfg.getBool("DEBUG", "wifi_gecko", false);
WiFiDebugger.SetBuffer(m_use_wifi_gecko);
@ -177,20 +187,16 @@ void CMenu::init()
for(u8 i = USB1; i <= USB8; i++)
{
if(DeviceHandle.IsInserted(i) && DeviceHandle.GetFSType(i) != PART_FS_WBFS)
drive = DeviceName[i];
break;
drive = DeviceName[i];
break;
}
if(drive == check && DeviceHandle.IsInserted(SD))//if no available USB partition then force SD
{
drive = DeviceName[SD];
//show error msg later to keep form calling _buildMenus() twice
}
else if(drive == check)
{
_buildMenus();
error(_fmt("errboot6", L"No available usb partitions for data and no SD inserted!\nExiting."));
m_exit = true;
return;
/* No available usb partitions for data and no SD inserted! */
//m_exit = true;
return false;
}
}
else
@ -306,8 +312,7 @@ void CMenu::init()
/* Emu nands init even if not being used */
memset(emu_nands_dir, 0, 64);
strncpy(emu_nands_dir, IsOnWiiU() ? "vwiinands" : "nands", 64);
_checkEmuNandSettings(false);// emu nand
_checkEmuNandSettings(true);// saves nand
_checkEmuNandSettings();
/* Cache Reload Checks */
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);
/* 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();
if(drive == DeviceName[SD] && onUSB)
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 */
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")
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/ppcboot.elf", DeviceName[SD]), &dummy) != 0))
exit_to = EXIT_TO_HBC;
Sys_ExitTo(exit_to);
Sys_ExitTo(exit_to + 1);
LWP_MutexInit(&m_mutex, 0);
@ -470,6 +472,7 @@ void CMenu::init()
);
}
}
return true;
}
bool cleaned_up = false;
@ -939,6 +942,8 @@ void CMenu::_loadCFLayout(int version, bool forceAA, bool otherScrnFmt)
void CMenu::_buildMenus(void)
{
m_btnMgr.init();
m_btnMgr.setRumble(m_cfg.getBool("GENERAL", "rumble", true));
// Default fonts
theme.btnFont = _font("GENERAL", "button_font", BUTTONFONT);
theme.btnFontColor = m_theme.getColor("GENERAL", "button_font_color", 0xD0BFDFFF);
@ -2286,13 +2291,9 @@ bool CMenu::_loadChannelList(void)
{
NANDemuView = true;
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)
{
/* 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;
string cacheDir = fmt("%s/%s_channels.db", m_listCacheDir.c_str(), DeviceName[currentPartition]);
bool updateCache = m_cfg.getBool(CHANNEL_DOMAIN, "update_cache");

View File

@ -35,7 +35,7 @@ class CMenu
{
public:
CMenu();
void init();
bool init();
void error(const wstringEx &msg);
void terror(const char *key, const wchar_t *msg) { error(_fmt(key, msg)); }
int main(void);
@ -1183,7 +1183,8 @@ private:
int _FindEmuPart(string &emuPath, bool searchvalid, bool savesnand);
bool _checkSave(string id, bool nand);
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);
static u32 _downloadCheatFileAsync(void *obj);
@ -1211,14 +1212,14 @@ private:
static const SOption _ChannelsType[3];
static const SOption _NandEmu[2];
static const SOption _SaveEmu[5];
static const SOption _GlobalSaveEmu[4];
static const SOption _SaveEmu[4];
static const SOption _GlobalSaveEmu[3];
static const SOption _AspectRatio[3];
static const SOption _NinEmuCard[5];
static const SOption _vidModePatch[4];
static const SOption _debugger[3];
static const SOption _hooktype[8];
static const SOption _exitTo[5];
static const SOption _exitTo[3];
static map<u8, u8> _installed_cios;
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;
}
const CMenu::SOption CMenu::_exitTo[5] = {
{ "def", L"Default" },
const CMenu::SOption CMenu::_exitTo[3] = {
{ "menu", L"System Menu" },
{ "hbc", L"HBC" },
{ "prii", L"Priiloader" },
{ "bootmii", L"BootMii" }
{ "wiiu", L"Wii U Menu" },
};
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));
m_cfg.setInt("GENERAL", "exit_to", exit_to);
Sys_ExitTo(exit_to);
Sys_ExitTo(exit_to + 1);
_showConfig4();
}
else if (m_btnMgr.selected(m_config4BtnSaveFavMode))

View File

@ -40,7 +40,7 @@ extern const u8 gc_ogg[];
extern const u32 gc_ogg_size;
bool m_zoom_banner = false;
bool m_pluginBanner = false;
bool m_banner_loaded = false;
s16 m_gameBtnPlayFull;
s16 m_gameBtnBackFull;
s16 m_gameBtnToggle;
@ -130,18 +130,18 @@ const CMenu::SOption CMenu::_NandEmu[2] = {
{ "NANDfull", L"Full" },
};
const CMenu::SOption CMenu::_GlobalSaveEmu[4] = {
const CMenu::SOption CMenu::_GlobalSaveEmu[3] = {
{ "SaveOffG", L"Off" },
{ "SavePartG", L"Game save" },
{ "SaveRegG", L"Regionswitch" },
//{ "SaveRegG", L"Regionswitch" },
{ "SaveFullG", L"Full" },
};
const CMenu::SOption CMenu::_SaveEmu[5] = {
const CMenu::SOption CMenu::_SaveEmu[4] = {
{ "SaveDef", L"Default" },
{ "SaveOff", L"Off" },
{ "SavePart", L"Game save" },
{ "SaveReg", L"Regionswitch" },
//{ "SaveReg", L"Regionswitch" },
{ "SaveFull", L"Full" },
};
@ -307,7 +307,7 @@ void CMenu::_hideGame(bool instant)
void CMenu::_showGame(void)
{
_setBg(m_gameBg, m_gameBgLQ);
return;
if(!m_zoom_banner)
{
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
@ -411,7 +411,7 @@ bool CMenu::_startVideo()
void CMenu::_game(bool launch)
{
m_pluginBanner = false;
m_banner_loaded = false;
bool coverFlipped = false;
int cf_version = 1;
string domain;
@ -658,8 +658,7 @@ void CMenu::_game(bool launch)
_cleanupBanner();
break;
}
else if((m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull))
&& (!NoGameID(hdr->type) || m_pluginBanner))
else if(m_btnMgr.selected(m_gameBtnToggle) || m_btnMgr.selected(m_gameBtnToggleFull))
{
m_zoom_banner = m_banner.ToggleZoom();
m_cfg.setBool(_domainFromView(), "show_full_banner", m_zoom_banner);
@ -808,68 +807,139 @@ 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 */
if(m_show_zone_game && !coverFlipped && (!m_zoom_banner || (NoGameID(hdr->type) && !m_pluginBanner)) && !m_video_playing)
/* showing and hiding buttons based on banner zoomed state */
if(!m_zoom_banner)
{
/* always hide full banner buttons */
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
m_btnMgr.show(m_gameBtnPlay);
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_gameBtnDelete);
bool b;
if(hdr->type == TYPE_PLUGIN)
b = m_gcfg1.getBool("FAVORITES_PLUGINS", id, false);
if(m_show_zone_game && !coverFlipped && !m_video_playing)
{
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)// #4 is used for banner frame
if(m_gameLblUser[i] != -1)
m_btnMgr.show(m_gameLblUser[i]);
}
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);
{
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);
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
b = m_gcfg1.getBool("ADULTONLY", id, false);
m_btnMgr.show(b ? m_gameBtnAdultOn : m_gameBtnAdultOff);
m_btnMgr.hide(b ? m_gameBtnAdultOff : m_gameBtnAdultOn);
{
m_btnMgr.hide(m_gameBtnToggle);
if(m_gameLblUser[4] != -1)
m_btnMgr.hide(m_gameLblUser[4]);
}
}
else /* show zoomed banner play and back buttons */
else // banner zoomed full screen
{
if(m_zoom_banner && (!NoGameID(hdr->type) || m_pluginBanner) && !m_video_playing)
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);
for(u8 i = 0; i < ARRAY_SIZE(m_gameLblUser) - 1; ++i)
if (m_gameLblUser[i] != -1)
m_btnMgr.hide(m_gameLblUser[i]);
}
else
else // no banner for whatever reason
{
m_btnMgr.hide(m_gameBtnPlayFull);
m_btnMgr.hide(m_gameBtnBackFull);
m_btnMgr.hide(m_gameBtnToggleFull);
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]);
}
}
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)
@ -1225,7 +1295,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
Nintendont_SetOptions(path, id, CheatPath, GClanguage, n_config, n_videomode, vidscale, vidoffset);
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
}
else // loader == DEVOLUTION
@ -1257,7 +1328,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
DEVO_GetLoader(m_dataDir.c_str());
DEVO_SetOptions(path, id, videoMode, GClanguage, memcard_emu, widescreen, activity_led, m_use_wifi_gecko);
if(AHBRPOT_Patched())
if(AHBPROT_Patched())
loadIOS(58, false);
else //use cIOS instead to make sure Devolution works anyways
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);
if(neek2o() || (RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB))
{
bool ret = loadIOS(gameIOS, false);
_netInit();
/* doesn't use cIOS so we don't check userIOS */
bool ret = loadIOS(gameIOS, false);//load game requested IOS and patch nothing
_netInit();// needed after IOS change
if(ret == false)
{
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;
}
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++)
{
@ -1327,12 +1399,13 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
}
}
}
else if(gameIOS != 57)
gameIOS = mainIOS;
else if(gameIOS != 57)// if IOS is 'auto' but gameIOS is not IOS57 then set gameIOS to wiiflow's 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);
// remap IOS to CIOS
if(gameIOS < 0x64)
// remap a gameIOS of IOS57 to a cIOS base 57 or if the specific cIOS selected is not installed then
// remap game IOS to a CIOS with the same base IOS
if(gameIOS < 0x64)// < 100
{
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[2] = 57;
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++)
{
if(found)
@ -1363,12 +1439,12 @@ int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)
if(!found)
return LOAD_IOS_FAILED;
}
/* at this point gameIOS is a cIOS */
if(gameIOS != CurrentIOS.Version)
{
gprintf("Reloading IOS into %d\n", gameIOS);
bool ret = loadIOS(gameIOS, true);
_netInit();
bool ret = loadIOS(gameIOS, true);// cIOS patch everything
_netInit();// always seem to do netinit after changing IOS
if(ret == false)
{
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.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 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);
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 */
m_gcfg1.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!"));
_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 */
_exitWiiflow();
@ -1480,7 +1565,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && 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())
{
@ -1511,7 +1596,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
{
setLanguage(language);
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 */
Identify(gameTitle);
@ -1537,27 +1622,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(dvd)
{
/*
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();
TempLoadIOS();// switch to cIOS if using IOS58 and not in neek2o
/* Open Disc */
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 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
emulate_mode = min(max(0, m_cfg.getInt(WII_DOMAIN, "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
else
emulate_mode--;
string emuPath;
int emuPartition = 0;
if(emulate_mode && !dvd && !neek2o())
{
emuPartition = _FindEmuPart(emuPath, false, true);
if(emuPartition < 0)//if savepartition and/or nand folder no good
string emuPath;
int emuPart = _FindEmuPart(emuPath, true, true);
if(emuPart == -1)//if savepartition is unusable
{
_hideWaitMessage();
error(_t("errgame13", L"EmuNAND for gamesave not found! Using real NAND."));
emulate_mode = 0;
_showWaitMessage();
}
if(emulate_mode == 1)//gamesave
else
{
m_forceext = false;
_hideWaitMessage();
m_exit = false;
/*_AutoExtractSave(id) returns
true if the save is already on emu nand (then no extraction)
true if the save was successfully extracted
false if save is not on real nand (nothing to extract)
false if user chooses to have game create new save*/
if(!_AutoExtractSave(id))
NandHandle.CreateTitleTMD(hdr);//setup emu nand for gamesave
_showWaitMessage();
m_exit = true;
}
else if(emulate_mode > 1)//region switch or full
{
// copy real nand config files to emuNAND
NandHandle.CreateConfig();
// do region change on emuNAND even if region switch is not selected
NandHandle.Do_Region_Change(id, false);
// region change is always done because if it was changed last time then this time it may need to be set back
// region switch is done later when D2X cIOS is detected
bool need_config = false;
bool need_miis = false;
char testpath[MAX_FAT_PATH];
char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
// does not check to see if actual tmd exist just if the folder exist
if(!_checkSave(id, false))//if save is not on emunand
{
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);
NandHandle.CreateTitleTMD(hdr);//setup emunand for wii gamesave
}
if(gameEmuMode == 3)//full per game setting - in case global is not full
{
//check config files
snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
if(!fsop_FileExist(testpath))
need_config = true;
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
}
}
}
else
@ -1714,13 +1793,13 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg)
m_gcfg2.save(true);
m_cat.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
bool patchregion = 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);
}
//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(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)
{
/* Enable our Emu NAND */
DeviceHandle.UnMountAll();
if(emulate_mode == 2)
NandHandle.Set_RCMode(true);
else if(emulate_mode == 3)
NandHandle.Set_FullMode(true);
else
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 */
cleanup(); //wifi and sd gecko doesnt work anymore after cleanup
cleanup();
bool wbfs_partition = false;
if(!dvd)
@ -1893,19 +1970,20 @@ void CMenu::_gameSoundThread(CMenu *m)
{
m->m_soundThrdBusy = true;
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;
u32 custom_bnr_size = 0;
char custom_banner[256];
custom_banner[255] = '\0';
u8 *cached_bnr_file = NULL;
u32 cached_bnr_size = 0;
char cached_banner[256];
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)
{
const char *coverDir = NULL;
@ -1922,12 +2000,11 @@ void CMenu::_gameSoundThread(CMenu *m)
if(custom_bnr_file != NULL)
{
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_pluginBanner = true;
m_banner_loaded = true;
}
}
else
{
m_pluginBanner = false;
m_banner.DeleteBanner();
m->m_gameSound.Load(m_plugin.GetBannerSound(GameHdr->settings[0]), m_plugin.GetBannerSoundSize());
if(m->m_gameSound.IsLoaded())
@ -1945,7 +2022,10 @@ void CMenu::_gameSoundThread(CMenu *m)
{
custom_bnr_file = (u8*)MEM2_lo_alloc(custom_bnr_size);
if(custom_bnr_file != NULL)
{
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_banner_loaded = true;
}
}
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);
if(custom_bnr_file != NULL)
{
fsop_ReadFileLoc(custom_banner, custom_bnr_size, (void*)custom_bnr_file);
m_banner_loaded = true;
}
}
}
}
if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME)
if(GameHdr->type == TYPE_GC_GAME && custom_bnr_file == NULL)
{
//get the gc games banner without sound from ISO
//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);
u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner();
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_loaded = true;
}
else
m_banner.DeleteBanner();
GC_Disc_Reader.clear();
//get wiiflow gc ogg sound to play with banner
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);
if(cached_bnr_file != NULL)
{
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)
CurrentBanner.SetBanner(cached_bnr_file, cached_bnr_size, false, true);
else if(GameHdr->type == TYPE_WII_GAME)
{
_extractBnr(GameHdr);
m_banner_loaded = true;
}
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())
{
m_banner_loaded = false;
m->m_gameSound.FreeMemory();
m_banner.DeleteBanner();
CurrentBanner.ClearBanner();

View File

@ -178,7 +178,10 @@ bool CMenu::_ExitTo(void)
}
else if(m_btnMgr.selected(m_homeBtnExitToPriiloader))
{
exitHandler(EXIT_TO_PRIILOADER);
if(IsOnWiiU())
exitHandler(EXIT_TO_WIIU);
else
exitHandler(EXIT_TO_PRIILOADER);
break;
}
else if(m_btnMgr.selected(m_homeBtnExitToBootmii))
@ -245,8 +248,9 @@ void CMenu::_showExitTo(void)
m_btnMgr.show(m_homeBtnExitToHBC);
m_btnMgr.show(m_homeBtnExitToMenu);
m_btnMgr.show(m_homeBtnExitToPriiloader);
m_btnMgr.show(m_homeBtnExitToBootmii);
m_btnMgr.show(m_homeBtnExitToPriiloader);// exit to wii u on wii u
if(IsOnWiiU() == false)
m_btnMgr.show(m_homeBtnExitToBootmii);
m_btnMgr.show(m_homeBtnExitToNeek);
for(u8 i = 0; i < ARRAY_SIZE(m_exittoLblUser); ++i)
@ -335,9 +339,10 @@ void CMenu::_initHomeAndExitToMenu()
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_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", 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_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 360, 270, 48, theme.btnFontColor);
m_homeBtnExitToNeek = _addButton("EXIT_TO/NEEK", theme.btnFont, L"", 185, 240, 270, 48, theme.btnFontColor);
m_homeBtnExitToPriiloader = _addButton("EXIT_TO/PRIILOADER", theme.btnFont, L"", 185, 300, 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_homeBtnExitToMenu, "EXIT_TO/MENU", 0, 0, -4.f, 0.f);
_setHideAnim(m_homeBtnExitToPriiloader, "EXIT_TO/PRIILOADER", 0, 0, -4.f, 0.f);
@ -367,7 +372,10 @@ void CMenu::_textExitTo(void)
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_homeBtnExitToMenu, _t("menu", L"System Menu"));
m_btnMgr.setText(m_homeBtnExitToPriiloader, _t("prii", L"Priiloader"));
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_homeBtnExitToBootmii, _t("bootmii", L"Bootmii"));
if(!neek2o())
m_btnMgr.setText(m_homeBtnExitToNeek, _t("neek2o", L"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);
/* filter list and start coverflow coverloader */
_initCF();
_loadCFLayout(min(max(1, _getCFVersion()), (int)m_numCFVersions));
_initCF();
CoverFlow.applySettings();
/* display game count unless sourceflow or homebrew */
@ -256,7 +256,7 @@ int CMenu::main(void)
}
SetupInput(true);
gprintf("start\n");
gprintf("start wiiflow main screen\n");
while(!m_exit)
{
/* IMPORTANT check if a disc is inserted */
@ -608,16 +608,35 @@ int CMenu::main(void)
}
else if(BTN_MINUS_PRESSED && !CoverFlow.empty())
{
/* WiiFlow should boot a random game */
_hideMain();
srand(time(NULL));
u16 place = (rand() + rand() + rand()) % CoverFlow.size();
gprintf("Lets boot the random game number %u\n", place);
const dir_discHdr *gameHdr = CoverFlow.getSpecificHdr(place);
if(gameHdr != NULL)
_launch(gameHdr);
/* Shouldnt happen */
_showCF(false);
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);
const dir_discHdr *gameHdr = CoverFlow.getSpecificHdr(place);
if(gameHdr != NULL)
_launch(gameHdr);
/* Shouldnt happen */
_showCF(false);
}
}
}
/* Hide Notice or Letter if times up */
@ -741,8 +760,8 @@ int CMenu::main(void)
if(!m_cfg.getBool(CHANNEL_DOMAIN, "neek_return_default", false))
{
string emuPath;
_FindEmuPart(emuPath, false, false);
ReturnPath = NandHandle.Get_NandPath();
if(_FindEmuPart(emuPath, false, false) >= 0)// make sure emunand folder exists
ReturnPath = NandHandle.Get_NandPath();
}
Sys_SetNeekPath(ReturnPath);
}

View File

@ -59,7 +59,10 @@ s16 m_nandemuLblUser[4];
TexData m_nandemuBg;
int nandemuPage = 1;
int curEmuNand = 0;
int curSavesNand = 0;
vector<string> emuNands;
vector<string> savesNands;
bool m_nandext;
bool m_fulldump;
bool m_sgdump;
@ -99,34 +102,125 @@ void CMenu::_listEmuNands(const char *path, vector<string> &emuNands)
sort(emuNands.begin(), emuNands.end());
}
void CMenu::_checkEmuNandSettings(bool savesnand)
void CMenu::_checkEmuNandSettings(void)
{
/* make sure partition and directory are legal and legit */
const char *emuNand = NULL;
int emuPart;
if(savesnand)
u8 i;
string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
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();
emuPart = m_cfg.getInt(WII_DOMAIN, "savepartition", 0);
}
else
{
emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str();
emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
}
const char *tmpPath = fmt("/%s/%s", emu_nands_dir, emuNand);
/* check if partition is FAT && emuNAND directory exist*/
if(!DeviceHandle.PartitionUsableForNandEmu(emuPart) || !_TestEmuNand(emuPart, tmpPath, false))
{
if(savesnand)
for(i = SD; i < MAXDEVICES; i++)// find first usable partition
{
m_cfg.setString(WII_DOMAIN, "current_save_emunand", "default");
m_cfg.getInt(WII_DOMAIN, "savepartition", 0);
if(DeviceHandle.PartitionUsableForNandEmu(i))
emuPart = i;
}
else
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++)
{
m_cfg.setString(CHANNEL_DOMAIN, "current_emunand", "default");
m_cfg.getInt(CHANNEL_DOMAIN, "partition", 0);
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
emulate_mode = m_cfg.getInt(WII_DOMAIN, "save_emulation", 0);
if((i == 0 && emulate_mode == 1) || (i == 1 && emulate_mode == 2))//full
{
string emuPath;
int emuPart = _FindEmuPart(emuPath, true, i);
if(emuPart < 0)
continue;
bool need_config = false;
bool need_miis = false;
char testpath[MAX_FAT_PATH];
char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:%s", DeviceName[emuPart], emuPath.c_str());
//check config files
snprintf(testpath, sizeof(testpath), "%s/shared2/sys/SYSCONF", basepath);
if(!fsop_FileExist(testpath))
need_config = true;
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))
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.SetPaths(tmpPath, DeviceName[emuPart]);
@ -427,38 +521,10 @@ int CMenu::_NandEmuCfg(void)
{
nandemuPage = 1;
string ExtNand = "";
vector<string> emuNands;
vector<string> savesNands;
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;
SetupInput();
_checkEmuNandSettings();
_showNandEmu();
m_thrdStop = false;
@ -489,11 +555,11 @@ int CMenu::_NandEmuCfg(void)
m_btnMgr.click(m_nandemuBtnPageP);
_showNandEmu();
}
else if((BTN_HOME_PRESSED || BTN_B_PRESSED))// && !m_thrdWorking)
else if((BTN_HOME_PRESSED || BTN_B_PRESSED) && !m_thrdWorking)
break;
else if(BTN_UP_PRESSED)
else if(BTN_UP_PRESSED && !m_thrdWorking)
m_btnMgr.up();
else if(BTN_DOWN_PRESSED)
else if(BTN_DOWN_PRESSED && !m_thrdWorking)
m_btnMgr.down();
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnEmulationP) || m_btnMgr.selected(m_nandemuBtnEmulationM)))
{
@ -514,36 +580,51 @@ int CMenu::_NandEmuCfg(void)
m_emuSaveNand = true;
_setPartition(direction);
m_emuSaveNand = false;
_checkEmuNandSettings();// refresh emunands in case the partition was changed
_showNandEmu();
}
else if(BTN_A_PRESSED && (m_btnMgr.selected(m_nandemuBtnNandDump) || m_btnMgr.selected(m_nandemuBtnAll) || m_btnMgr.selected(m_nandemuBtnMissing)))
{
m_fulldump = m_btnMgr.selected(m_nandemuBtnNandDump) ? true : false;
m_saveall = m_btnMgr.selected(m_nandemuBtnAll) ? true : false;
m_btnMgr.hide(m_nandemuBtnBack);
_hideNandEmu(true);
m_btnMgr.show(m_nandemuLblTitle);
m_btnMgr.show(m_nandfilePBar);
m_btnMgr.show(m_nandemuPBar);
m_btnMgr.show(m_nandfileLblMessage);
m_btnMgr.show(m_nandemuLblMessage);
m_btnMgr.show(m_nandfileLblDialog);
m_btnMgr.show(m_nandemuLblDialog);
m_btnMgr.setText(m_nandemuLblMessage, L"");
m_btnMgr.setText(m_nandfileLblMessage, L"");
m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall Progress:"));
if(m_fulldump)
string emuPath;
int emuPart = _FindEmuPart(emuPath, true, !m_fulldump);
if(emuPart < 0)
{
ExtNand = emuNands[curEmuNand];
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND Extractor"));
_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_saveall = m_btnMgr.selected(m_nandemuBtnAll) ? true : false;
m_btnMgr.hide(m_nandemuBtnBack);
_hideNandEmu(true);
m_btnMgr.show(m_nandemuLblTitle);
m_btnMgr.show(m_nandfilePBar);
m_btnMgr.show(m_nandemuPBar);
m_btnMgr.show(m_nandfileLblMessage);
m_btnMgr.show(m_nandemuLblMessage);
m_btnMgr.show(m_nandfileLblDialog);
m_btnMgr.show(m_nandemuLblDialog);
m_btnMgr.setText(m_nandemuLblMessage, L"");
m_btnMgr.setText(m_nandfileLblMessage, L"");
m_btnMgr.setText(m_nandemuLblDialog, _t("cfgne11", L"Overall Progress:"));
if(m_fulldump)
{
ExtNand = emuNands[curEmuNand];
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne12", L"NAND Extractor"));
}
else
{
ExtNand = savesNands[curSavesNand];
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game Save Extractor"));
}
m_thrdStop = false;
m_thrdProgress = 0.f;
m_thrdWorking = true;
LWP_CreateThread(&thread, (void *(*)(void *))CMenu::_NandDumper, (void *)this, 0, 32768, 40);
}
else
m_btnMgr.setText(m_nandemuLblTitle, _t("cfgne13", L"Game Save Extractor"));
m_thrdStop = false;
m_thrdProgress = 0.f;
m_thrdWorking = true;
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)))
{
@ -610,6 +691,7 @@ int CMenu::_NandEmuCfg(void)
}
}
_hideNandEmu();
_FullNandCheck();
if(emuNand != m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") || emuNand == ExtNand)
{
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
@ -621,11 +703,11 @@ int CMenu::_NandEmuCfg(void)
int CMenu::_FlashSave(string gameId)
{
int emuPartition = m_cfg.getInt(WII_DOMAIN, "savepartition");
char basepath[MAX_FAT_PATH];
snprintf(basepath, sizeof(basepath), "%s:/%s/%s", DeviceName[emuPartition], emu_nands_dir, m_cfg.getString(WII_DOMAIN, "current_save_emunand").c_str());
string emuPath;
if(_FindEmuPart(emuPath, false, true) < 0)// if savenand not found
return 0;
if(!_checkSave(gameId, false))// if save not on emu nand
if(!_checkSave(gameId, false))// if save not on savenand
return 0;
lwp_t thread = 0;
@ -658,11 +740,8 @@ int CMenu::_FlashSave(string gameId)
m_thrdWorking = true;
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)))
{
_hideNandEmu();
return 1;
}
if(!m_thrdWorking && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))))
break;
if(m_thrdMessageAdded)
{
@ -689,24 +768,49 @@ int CMenu::_FlashSave(string gameId)
}
}
_hideNandEmu();
return 0;
return 1;
}
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
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;
lwp_t thread = 0;
SetupInput();
m_thrdStop = false;
m_thrdMessageAdded = 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_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_saveExtGameId = gameId;
while(!m_exit)
{
_mainLoopCommon();
if(BTN_UP_PRESSED)
if(BTN_UP_PRESSED && !m_thrdWorking)
m_btnMgr.up();
else if(BTN_DOWN_PRESSED)
else if(BTN_DOWN_PRESSED && !m_thrdWorking)
m_btnMgr.down();
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
{
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();
return 0;
}
else if(BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))
{
_hideNandEmu();
return 1;
}
else if(finished && (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_nandemuBtnBack))))
break;
if(m_thrdMessageAdded)
{
@ -784,6 +871,7 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
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));
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));
@ -796,27 +884,29 @@ int CMenu::_AutoExtractSave(string gameId)// called from wii game config menu or
}
}
_hideNandEmu();
return 0;
return 1;
}
int CMenu::_NandFlasher(void *obj)
{
CMenu &m = *(CMenu *)obj;
string emuPath;
char source[MAX_FAT_PATH];
char dest[ISFS_MAXPATH];
const char *SaveGameID = m.m_saveExtGameId.c_str();
int emuPartition = m._FindEmuPart(emuPath, false, true);
string emuPath;
int emuPartition = m._FindEmuPart(emuPath, true, true);
const char *SaveGameID = m.m_saveExtGameId.c_str();
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)))
{
snprintf(source, sizeof(source), "%s:%s/title/00010000/%08x", DeviceName[emuPartition], emuPath.c_str(), 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(dest, sizeof(dest), "/title/00010004/%08x", flashID);
@ -827,7 +917,6 @@ int CMenu::_NandFlasher(void *obj)
m_nandext = true;
NandHandle.FlashToNAND(source, dest, _ShowProgress, obj);
m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex);
m_btnMgr.hide(m_nandfilePBar);
m_btnMgr.hide(m_nandfileLblMessage);
@ -835,14 +924,14 @@ int CMenu::_NandFlasher(void *obj)
m_btnMgr.hide(m_nandemuLblMessage);
m._setDumpMsg(m._t("cfgne30", L"Flashing save files finished!"), 1.f, 1.f);
LWP_MutexUnlock(m.m_mutex);
m.m_thrdWorking = false;
return 0;
}
int CMenu::_NandDumper(void *obj)
{
CMenu &m = *(CMenu *)obj;
string emuPath;
int emuPartition = -1;
m_nandext = false;
m_sgdump = false;
m.m_dumpsize = 0;
@ -850,43 +939,33 @@ int CMenu::_NandDumper(void *obj)
m.m_foldersdone = 0;
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];
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);
m._setDumpMsg(m._t("cfgne27", L"Calculating space needed for extraction..."), 0.f, 0.f);
LWP_MutexUnlock(m.m_mutex);
if(m_fulldump)
if(m_fulldump)/* full nand dump */
{
m.m_dumpsize = NandHandle.CalcDumpSpace("/", CMenu::_ShowProgress, obj);
m_nandext = true;
NandHandle.DoNandDump("/", basepath, CMenu::_ShowProgress, obj);
}
else
else /* gamesave(s) dump */
{
bool missingOnly = !m_saveall;
vector<string> saveList;
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);
m._setDumpMsg(m._t("cfgne18", L"Listing game saves to extract..."), 0.f, 0.f);
LWP_MutexUnlock(m.m_mutex);
@ -899,7 +978,7 @@ int CMenu::_NandDumper(void *obj)
{
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
{
@ -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;
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)
{
char source[ISFS_MAXPATH];
@ -926,6 +1006,7 @@ int CMenu::_NandDumper(void *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)
{
char source[ISFS_MAXPATH];
@ -939,7 +1020,6 @@ int CMenu::_NandDumper(void *obj)
}
}
m.m_thrdWorking = false;
LWP_MutexLock(m.m_mutex);
m_btnMgr.hide(m_nandfilePBar);
m_btnMgr.hide(m_nandfileLblMessage);
@ -947,6 +1027,7 @@ int CMenu::_NandDumper(void *obj)
m_btnMgr.hide(m_nandemuLblMessage);
m._setDumpMsg(m._t("cfgne19", L"Extraction finished!"), 1.f, 1.f);
LWP_MutexUnlock(m.m_mutex);
m.m_thrdWorking = false;
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)
{
if(wad_path == NULL)
@ -436,21 +438,32 @@ void CMenu::_Wad(const char *wad_path)
}
vector<string> emuNands;
string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand");
int emuPart = m_cfg.getInt(CHANNEL_DOMAIN, "partition");
_listEmuNands(fmt("%s:/%s", DeviceName[emuPart], emu_nands_dir), emuNands);
string emuNand = m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default");
int curEmuNand = 0;
for(u8 i = 0; i < emuNands.size(); ++i)
string emuPath;
int emuPart = 0;
if(!mios)
{
if(emuNands[i] == emuNand)
emuPart = _FindEmuPart(emuPath, false, false);
if(emuPart < 0)
{
curEmuNand = i;
break;
//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)
{
if(emuNands[i] == emuNand)
{
curEmuNand = i;
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_wadLblNandSelectVal, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand"));
}
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"));
_showWad();
while(!m_exit)
@ -476,8 +489,8 @@ void CMenu::_Wad(const char *wad_path)
/* mios is real nand, chans are emu */
if(mios == false)
{
const char *emu_char = fmt("/%s/%s", emu_nands_dir, m_cfg.getString(CHANNEL_DOMAIN, "current_emunand", "default").c_str());
NandHandle.SetPaths(emu_char, DeviceName[currentPartition]);
const char *emu_char = fmt("/%s/%s", emu_nands_dir, emuNands[curEmuNand].c_str());
NandHandle.SetPaths(emu_char, DeviceName[emuPart]);
}
_start_pThread();
m_thrdMessage = _t("wad4", L"Installing WAD, please wait...");
@ -498,12 +511,15 @@ void CMenu::_Wad(const char *wad_path)
}
}
}
if(m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") == emuNand)
if(!mios)
{
m_refreshGameList = true;
m_cfg.setBool(CHANNEL_DOMAIN, "update_cache", true);
if(m_cfg.getString(CHANNEL_DOMAIN, "current_emunand") == emuNand)
{
m_refreshGameList = 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();
/* onscreen message might be onscreen still */
m_btnMgr.hide(m_wbfsLblMessage);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -137,7 +137,7 @@ int OggDecoder::Seek(int 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)
return -1;

View File

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

View File

@ -84,7 +84,7 @@ int SoundDecoder::Rewind()
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);
CurPos += ret;
@ -123,7 +123,7 @@ void SoundDecoder::Decode()
while(done < SoundBlockSize)
{
int ret = Read(&write_buf[done], SoundBlockSize-done, Tell());
int ret = Read(&write_buf[done], SoundBlockSize-done);
if(ret <= 0)
{

View File

@ -51,7 +51,7 @@ public:
SoundDecoder(const char * filepath);
SoundDecoder(const u8 * buffer, int size);
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 Seek(int pos) { CurPos = pos; return file_fd->seek(CurPos, SEEK_SET); };
virtual int Rewind();

View File

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

View File

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

View File

@ -203,7 +203,7 @@ bool GuiSound::Load(const u8 *snd, u32 len, bool isallocated)
if(snd == NULL || len == 0)
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);
sound = (u8*)snd;
@ -245,7 +245,7 @@ bool GuiSound::LoadSoundEffect(const u8 * snd, u32 len)
sound = tmpsnd;
int read = decoder.Read(sound+done, 4096, done);
int read = decoder.Read(sound+done, 4096);
if(read <= 0)
break;

View File

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

View File

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