Skip to content

Commit

Permalink
- minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fledge68 committed Feb 28, 2022
1 parent ef1f601 commit 20a307e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 41 deletions.
Binary file modified out/bins/ext_booter.bin
Binary file not shown.
Binary file modified out/boot.dol
Binary file not shown.
2 changes: 1 addition & 1 deletion source/booter/external_booter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
DCFlushRange(&lowCFG, sizeof(the_CFG));
*EXT_ADDR_CFG = ((u32)lowCFG);
/* Unmount devices etc */
ShutdownBeforeExit();
ShutdownBeforeExit();// before launching wii game or channel via external booter
/* Set proper time */
settime(secs_to_ticks(time(NULL) - 946684800));
/* Copy in booter */
Expand Down
2 changes: 1 addition & 1 deletion source/defines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#define APP_NAME "WiiFlow WFL"
#define APP_VERSION "5.5.3 beta 1"
#define APP_VERSION "5.5.3 beta 2"

#define APP_DATA_DIR "wiiflow"
#define APPS_DIR "apps/wiiflow"
Expand Down
1 change: 0 additions & 1 deletion source/menu/menu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,6 @@ class CMenu
vector<string> _getMetaXML(const char *bootpath);
void _extractBnr(const dir_discHdr *hdr);
void _setCurrentItem(const dir_discHdr *hdr);
void _exitWiiflow();
void exitHandler(int ExitTo);
void _setAA(int aa);
void _loadCFCfg();
Expand Down
3 changes: 2 additions & 1 deletion source/menu/menu_download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,7 @@ int CMenu::_coverDownloader()
int CMenu::_gametdbDownloaderAsync()
{
const string &langCode = m_loc.getString(m_curLanguage, "gametdb_code", "EN");
string gametdb_url = m_cfg.getString("GENERAL", "gametdb_url", GAMETDB_URL);
m_thrdTotal = 3; // Download, save and unzip

m_thrdMessage = _t("dlmsg1", L"Initializing network...");
Expand All @@ -1657,7 +1658,7 @@ int CMenu::_gametdbDownloaderAsync()
m_thrdMessage = _t("dlmsg11", L"Downloading...");
m_thrdMessageAdded = true;
struct download file = {};
downloadfile(fmt(GAMETDB_URL, langCode.c_str()), &file);
downloadfile(fmt(gametdb_url.c_str(), langCode.c_str()), &file);
if(errno == ENOMEM)
return -1;
else if(file.size <= 0)
Expand Down
39 changes: 18 additions & 21 deletions source/menu/menu_game_boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ void CMenu::_launch(const dir_discHdr *hdr)
_launchHomebrew(bootpath, arguments);
}
}
// if we make it here it means the launch failed.
//Exit WiiFlow, no game booted...
cleanup();// cleanup and clear memory
ShutdownBeforeExit();// unmount devices and close inputs. launch game failed.
Sys_Exit();
}

void CMenu::_launchPlugin(dir_discHdr *hdr)
Expand Down Expand Up @@ -275,7 +280,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
if(ret == false)
{
error(_t("errgame14", L"app_booter.bin not found!"));
_exitWiiflow();
return;
}
/* no more error msgs - remove btns and sounds */
cleanup();
Expand All @@ -287,7 +292,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
AddBootArgument(arguments[i].c_str());
}

ShutdownBeforeExit();// wifi and sd gecko doesnt work anymore after
ShutdownBeforeExit();// before launching homebrew or plugin dol
NandHandle.Patch_AHB();
IOS_ReloadIOS(58);
BootHomebrew();
Expand Down Expand Up @@ -519,7 +524,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
if(ret == false)
{
error(_t("errgame14", L"app_booter.bin not found!"));
_exitWiiflow();
return;
}

/* no more error msgs - remove btns and sounds */
Expand Down Expand Up @@ -655,7 +660,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
}

Nintendont_SetOptions(path, id, CheatPath, GClanguage, n_config, n_videomode, vidscale, vidoffset, netprofile);
ShutdownBeforeExit();
ShutdownBeforeExit();// before launching nintendont
NandHandle.Patch_AHB();
IOS_ReloadIOS(58);
BootHomebrew(); //regular dol
Expand Down Expand Up @@ -687,7 +692,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);
ShutdownBeforeExit();
ShutdownBeforeExit();// before launching devolution
NandHandle.Patch_AHB();
IOS_ReloadIOS(58);
DEVO_Boot();
Expand Down Expand Up @@ -780,7 +785,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
m_cat.save(true);
m_cfg.save(true);
cleanup();//no more error messages we can now cleanup
ShutdownBeforeExit();
ShutdownBeforeExit();// before wii_launch channel
WII_Initialize();
WII_LaunchTitle(gameTitle);
}
Expand Down Expand Up @@ -877,7 +882,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if(!Load_Neek2o_Kernel())
{
error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));//kernal.bin not found
_exitWiiflow();
return;
}
else
{
Expand All @@ -888,7 +893,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
nkrtrn = "NK2O";
u32 nkreturnTo = nkrtrn[0] << 24 | nkrtrn[1] << 16 | nkrtrn[2] << 8 | nkrtrn[3];
cleanup();
ShutdownBeforeExit();
ShutdownBeforeExit();// before using neek2o to launch a channel
if(IsOnWiiU())
Launch_nk(gameTitle, NandHandle.Get_NandPath(), ((u64)(0x00010002) << 32) | (nkreturnTo & 0xFFFFFFFF));
else
Expand All @@ -902,14 +907,14 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
if(ExternalBooter_LoadBins(m_binsDir.c_str()) == false)
{
error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!"));
_exitWiiflow();
return;
}

/* load selected cIOS if necessary */
if(_loadGameIOS(gameIOS, userIOS, id, !NANDemuView) == LOAD_IOS_FAILED)
{
/* error message already shown */
_exitWiiflow();
return;
}

/* if d2x cios patch returnto */
Expand All @@ -936,7 +941,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
{
NandHandle.Disable_Emu();
error(_t("errgame5", L"Enabling emu failed!"));
_exitWiiflow();
return;
}
DeviceHandle.MountAll();
}
Expand Down Expand Up @@ -1202,7 +1207,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(ExternalBooter_LoadBins(m_binsDir.c_str()) == false)
{
error(_t("errgame15", L"Missing ext_loader.bin or ext_booter.bin!"));
_exitWiiflow();
return;
}

/* load selected cIOS if necessary */
Expand All @@ -1211,7 +1216,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
if(_loadGameIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
{
/* error message already shown */
_exitWiiflow();
return;
}
}

Expand Down Expand Up @@ -1284,11 +1289,3 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)

Sys_Exit();
}

void CMenu::_exitWiiflow()
{
//Exit WiiFlow, no game booted...
cleanup();// cleanup and clear memory
ShutdownBeforeExit();// unmount devices and close inputs
Sys_Exit();
}
5 changes: 5 additions & 0 deletions source/menu/menu_home.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ bool CMenu::_Home(void)
}
else if(BTN_HOME_PRESSED)
{
if(BTN_B_HELD)// reboot wiiflow if B button held and HOME button pressed.
{
m_reload = true;
return true;
}
if(isWiiVC)
{
exitHandler(EXIT_TO_MENU);
Expand Down
22 changes: 6 additions & 16 deletions source/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,16 +464,8 @@ int CMenu::main(void)
}
if(BTN_HOME_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_mainBtnHome)))
{
if(m_sourceflow)//back to base tier or exit sourceflow
if(m_sourceflow)// open Source Menu Editor Menu
{
/*if(!_srcTierBack(true))// if already on base tier exit sourceflow
{
_restoreSrcTiers();
m_sourceflow = false;
}
_getCustomBgTex();
_setMainBg();
_showCF(true);//refresh coverflow or sourceflow list*/
_hideMain();
_SM_Editor();
if(BTN_B_HELD)
Expand All @@ -484,19 +476,18 @@ int CMenu::main(void)
_setMainBg();
_showCF(true);
}
else
else // open Home Menu
{
_hideMain();
/* Home menu */
if(_Home())
break;// exit wiiflow
break;// if exit or shutdown option was selected then exit wiiflow
if(prevTheme != m_themeName)
{
/* new theme - exit wiiflow and reload */
fsop_deleteFolder(fmt("%s/sourceflow", m_cacheDir.c_str()));
m_cfg.remove(SOURCEFLOW_DOMAIN, "numbers");
m_cfg.remove(SOURCEFLOW_DOMAIN, "tiers");
m_reload = true;
m_reload = true;// reload for new theme
break;
}
if(BTN_B_HELD)
Expand Down Expand Up @@ -558,7 +549,7 @@ int CMenu::main(void)
fsop_deleteFolder(fmt("%s/sourceflow", m_cacheDir.c_str()));
m_cfg.remove(SOURCEFLOW_DOMAIN, "numbers");
m_cfg.remove(SOURCEFLOW_DOMAIN, "tiers");
m_reload = true;
m_reload = true;// reload for new theme
break;
}
if(BTN_B_HELD)
Expand Down Expand Up @@ -969,8 +960,7 @@ int CMenu::main(void)
CoverFlow.mouse(chan, -1, -1);
}
}
ScanInput();
if(m_reload || BTN_B_HELD)// rebooting wiiflow
if(m_reload)// rebooting wiiflow (forced in Home Menu or new theme)
{
vector<string> arguments = _getMetaXML(fmt("%s/boot.dol", m_appDir.c_str()));
_launchHomebrew(fmt("%s/boot.dol", m_appDir.c_str()), arguments);
Expand Down

0 comments on commit 20a307e

Please sign in to comment.