- moved SD only to wiiflow save file to possibly speed up wiiflow start up. note very first time will be slow and try to mount a USB drive but afterwards will be fast again.

- removed splash image on start up.
This commit is contained in:
Fledge68 2022-06-17 17:29:09 -05:00
parent 87b6379641
commit 6b1dcabf36
10 changed files with 48 additions and 81 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.3 MiB

View File

@ -35,6 +35,7 @@ u8 cur_ios = 0;
#define BANNER_PATH "/title/00010000/57465346/data/banner.bin"
#define IOS_SAVE_PATH "/title/00010000/57465346/data/ios"
#define PORT_SAVE_PATH "/title/00010000/57465346/data/port"
#define SD_SAVE_PATH "/title/00010000/57465346/data/sdonly"
NandSave::NandSave()
{
@ -62,7 +63,7 @@ bool NandSave::CheckSave()
u32 banner_bin_size = 0;
const u8 *banner_bin = NULL;
u32 entries = 0;
/* May our banner already exist */
/* Maybe our banner already exist */
memset(&ISFS_Path, 0, ISFS_MAXPATH);
strcpy(ISFS_Path, BANNER_PATH);
fd = ISFS_Open(ISFS_Path, ISFS_OPEN_READ);
@ -72,6 +73,9 @@ bool NandSave::CheckSave()
gprintf("Found WiiFlow Save\n");
goto done;
}
// save_bin only contains the tik.bin, tmd.bin, and banner.bin
// tik.bin and tmd.bin are used to install "/title/00010000/57465346/data/banner.bin"
// "/title/00010000/57465346/data/ios and port" are not written until you change them in startup settings menu.
/* extract our archive */
u8_bin = DecompressCopy(save_bin, save_bin_size, &u8_bin_size);
if(u8_bin == NULL || u8_bin_size == 0)
@ -164,6 +168,12 @@ void NandSave::LoadSettings()
u32 size = 0;
memset(&ISFS_Path, 0, ISFS_MAXPATH);
// on very first boot (no save file exist yet)
// "/title/00010000/57465346/data/ios"
// "/title/00010000/57465346/data/port"
// will not exist. wiiflow will simply use useMainIOS and mainIOS defined in main.cpp
// they are only created when you change settings in the startup settings menu.
strcpy(ISFS_Path, IOS_SAVE_PATH);
ios_settings_t *file = (ios_settings_t*)ISFS_GetFile(ISFS_Path, &size, -1);
if(file != NULL && size == sizeof(ios_settings_t))
@ -187,6 +197,16 @@ void NandSave::LoadSettings()
}
if(port != NULL)
MEM2_free(port);
strcpy(ISFS_Path, SD_SAVE_PATH);
u8 *sdonly = ISFS_GetFile(ISFS_Path, &size, -1);
if(sdonly != NULL && size == sizeof(u8))
{
gprintf("Using SD Only Settings from wiiflow save\n");
sdOnly = ((sdonly[0] & 1) == 1);
}
if(sdonly != NULL)
MEM2_free(sdonly);
}
void NandSave::SaveIOS()
@ -204,10 +224,19 @@ void NandSave::SavePort(u8 port)
{
if(loaded == false)
return;
gprintf("Saving Port Settings to wiiflow save\n");
gprintf("Saving Port Setting to wiiflow save\n");
WriteFile(PORT_SAVE_PATH, &port, sizeof(port));
}
void NandSave::SaveSDOnly(bool sd_only)
{
if(loaded == false)
return;
gprintf("Saving SD Only Setting to wiiflow save\n");
u8 sdonly = sd_only ? 1 : 0;
WriteFile(SD_SAVE_PATH, &sdonly, sizeof(sdonly));
}
void NandSave::WriteFile(const char *file_name, u8 *content, u32 size)
{
memset(&ISFS_Path, 0, ISFS_MAXPATH);

View File

@ -33,6 +33,7 @@ public:
void LoadSettings();
void SaveIOS();
void SavePort(u8 port);
void SaveSDOnly(bool sd_only);
private:
void WriteFile(const char *file_name, u8 *content, u32 size);
s32 fd;

View File

@ -475,8 +475,6 @@ void CVideo::render(void)
/* wait animation control */
extern const u8 wfsplash_png[];
extern const u8 wait_01_png[];
extern const u8 wait_02_png[];
extern const u8 wait_03_png[];
@ -691,17 +689,6 @@ void CVideo::waitMessage(const TexData &tex)
GX_End();
}
/* draw and render startup splash screen */
void CVideo::startImage(void)
{
TexData splashTex;
TexHandle.fromPNG(splashTex, wfsplash_png);
waitMessage(splashTex);
render();
TexHandle.Cleanup(splashTex);
}
/* save screenshot */
s32 CVideo::TakeScreenshot(const char *path)
{

View File

@ -72,7 +72,6 @@ public:
int stencilVal(int x, int y);
void setCustomWaitImgs(const char *path, bool loop);
void hideWaitMessage();
void startImage(void);
void waitMessage(float delay);
void waitMessage(const vector<TexData> &tex, float delay);
void waitMessage(const TexData &tex);

View File

@ -51,6 +51,7 @@ bool IsOnWiiU(void);
extern void __exception_setreload(int t);
extern int mainIOS;
extern bool useMainIOS;
extern bool sdOnly;
extern bool isWiiVC;
extern volatile bool NANDemuView;
extern volatile bool networkInit;

View File

@ -24,62 +24,10 @@
bool isWiiVC = false;
bool useMainIOS = true;
bool sdOnly = false;
volatile bool NANDemuView = false;
volatile bool networkInit = false;
/* quick check if we will be using a USB device. */
/* if not then we can skip the 20 second cycle trying to connect a USB device. */
/* this is nice for SD only users */
bool isUsingUSB() {
if(isWiiVC)
return false;
/* First check if the app path exists on the SD card, if not then we're using USB */
struct stat dummy;
string appPath = fmt("%s:/%s", DeviceName[SD], APPS_DIR);
if(DeviceHandle.IsInserted(SD) && DeviceHandle.GetFSType(SD) != PART_FS_WBFS && stat(appPath.c_str(), &dummy) != 0)
{
// No app path exists on SD card, so assuming we're using USB.
return true;
}
/* Check that the config file exists, or we can't do the following checks */
string configPath = fmt("%s/" CFG_FILENAME, appPath.c_str());
if(stat(configPath.c_str(), &dummy) != 0)
{
// The app path is on SD but no config file exists, so assuming we might need USB.
return true;
}
/* Load the config file */
Config m_cfg;// = new Config();
if(!m_cfg.load(configPath.c_str()))
{
// The app path is on SD and a config file exists, but we can't load it, so assuming we might need USB.
return true;
}
/* If any of the sections have partition set > 0, we're on USB */
const char *domains[] = {WII_DOMAIN, GC_DOMAIN, CHANNEL_DOMAIN, PLUGIN_DOMAIN, HOMEBREW_DOMAIN};
for(int i = 0; i < 5; i++)
{
if(!m_cfg.getBool(domains[i], "disable", false) && m_cfg.getInt(domains[i], "partition", SD) != SD)
{
// a domain is enabled and partition is not SD, so assuming we're using USB.
return true;
}
}
/* if sd_only is false, then we're using USB */
if(!m_cfg.getBool("general", "sd_only", true))
{
// sd_only is false, so assuming we're using USB.
return true;
}
gprintf("using SD only, no need for USB mounting.\n");
return false;
}
int main(int argc, char **argv)
{
MEM_init(); //Inits both mem1lo and mem2
@ -93,7 +41,6 @@ int main(int argc, char **argv)
#endif
char *gameid = NULL;
bool showFlashImg = true;
bool wait_loop = false;
char wait_dir[256];
memset(&wait_dir, 0, sizeof(wait_dir));
@ -114,8 +61,6 @@ int main(int argc, char **argv)
}
else if(strcasestr(argv[i], "Waitloop") != NULL)
wait_loop = true;
else if(strcasestr(argv[i], "noflash") != NULL)
showFlashImg = false;
else if(strlen(argv[i]) == 6)
{
gameid = argv[i];
@ -129,9 +74,7 @@ int main(int argc, char **argv)
}
/* Init video */
m_vid.init();
if(showFlashImg && gameid == NULL)// dont show if autobooting a wii game.
m_vid.startImage();
/* check if WiiVC */
WiiDRC_Init();
isWiiVC = WiiDRC_Inited();
@ -196,8 +139,8 @@ int main(int argc, char **argv)
DeviceHandle.MountSD();// mount SD before calling isUsingUSB() duh!
/* mount USB if needed */
DeviceHandle.SetMountUSB(isUsingUSB());
bool usb_mounted = DeviceHandle.MountAllUSB();// only mounts any USB if isUsingUSB()
DeviceHandle.SetMountUSB(!sdOnly && !isWiiVC);
bool usb_mounted = DeviceHandle.MountAllUSB();// only mounts any USB if !sdOnly
/* init wait images and show wait animation */
if(gameid == NULL)// dont show if autobooting a wii game.

View File

@ -187,7 +187,9 @@ bool CMenu::init(bool usb_mounted)
getProxyInfo();
/* Set SD only to off if any usb device is attached */
m_cfg.getBool("GENERAL", "sd_only", usb_mounted ? false : true);// will only set it if this doesn't already exist - very first boot up
bool cfg_sdonly = m_cfg.getBool("GENERAL", "sd_only", usb_mounted ? false : true);// will only set it if this doesn't already exist - very first boot up
if(cfg_sdonly != sdOnly)// done for backwards compatibility with older wiiflow lite's
InternalSave.SaveSDOnly(cfg_sdonly);
/* set default wii games partition in case this is the first boot */
int wp = m_cfg.getInt(WII_DOMAIN, "partition", -1);

View File

@ -87,6 +87,7 @@ void CMenu::_Boot(void)
bool prev_load = cur_load;
u8 prev_ios = cur_ios;
bool prev_sd = m_cfg.getBool("GENERAL", "sd_only");
bool cur_sd = prev_sd;
SetupInput();
_showBoot();
@ -137,18 +138,22 @@ void CMenu::_Boot(void)
}
else if (m_btnMgr.selected(m_bootBtnSDOnly))
{
m_cfg.setBool("GENERAL", "sd_only", !m_cfg.getBool("GENERAL", "sd_only"));
m_btnMgr.setText(m_bootBtnSDOnly, m_cfg.getBool("GENERAL", "sd_only") ? _t("yes", L"Yes") : _t("no", L"No"));
cur_sd = !cur_sd;
m_btnMgr.setText(m_bootBtnSDOnly, cur_sd ? _t("yes", L"Yes") : _t("no", L"No"));
}
}
}
if(cur_sd != prev_sd)
{
InternalSave.SaveSDOnly(cur_sd);
m_cfg.setBool("GENERAL", "sd_only", cur_sd);// backwards compatibity
}
if(prev_load != cur_load || prev_ios != cur_ios)
InternalSave.SaveIOS();
if(set_port != currentPort)
InternalSave.SavePort(set_port);
_hideBoot();
bool cur_sd = m_cfg.getBool("GENERAL", "sd_only");
if(prev_load != cur_load || prev_ios != cur_ios || set_port != currentPort || prev_sd != cur_sd)
{
error(_t("errboot8", L"Press 'A' to reload WiiFlow"));