mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-fixed memory leak in download manager
-keep AHBPROT patched out on channel load -only if no cIOS is found boot a real nand channel with a normal IOS
This commit is contained in:
parent
e564058569
commit
a8ba1f8e49
@ -73,7 +73,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
||||
normalCFG.wip_list = get_wip_list();
|
||||
normalCFG.wip_count = get_wip_count();
|
||||
|
||||
ShutdownBeforeExit();
|
||||
ShutdownBeforeExit(BootType == TYPE_CHANNEL);
|
||||
/* Copy CFG into new memory region */
|
||||
memcpy(BooterConfig, &normalCFG, sizeof(the_CFG));
|
||||
DCFlushRange(BooterConfig, sizeof(the_CFG));
|
||||
@ -103,9 +103,9 @@ void ExternalBooter_ChannelSetup(u64 title)
|
||||
memcpy(&normalCFG.title, &title, sizeof(u64));
|
||||
}
|
||||
|
||||
void ShutdownBeforeExit()
|
||||
void ShutdownBeforeExit(bool KeepPatches)
|
||||
{
|
||||
DeviceHandle.UnMountAll();
|
||||
NandHandle.DeInit_ISFS();
|
||||
NandHandle.DeInit_ISFS(KeepPatches);
|
||||
WDVD_Close();
|
||||
}
|
||||
|
@ -32,6 +32,6 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
||||
int aspectRatio, u32 returnTo, u8 BootType);
|
||||
void ExternalBooter_ChannelSetup(u64 title);
|
||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID);
|
||||
void ShutdownBeforeExit();
|
||||
void ShutdownBeforeExit(bool KeepPatches = false);
|
||||
|
||||
#endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "loader/fs.h"
|
||||
#include "loader/fst.h"
|
||||
#include "loader/utils.h"
|
||||
#include "loader/sys.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "memory/memory.h"
|
||||
#include "unzip/lz77.h"
|
||||
@ -105,7 +106,7 @@ bool Identify(u64 titleid)
|
||||
break;
|
||||
}
|
||||
}
|
||||
gprintf("Key ID: %u\n", keyId);
|
||||
gprintf("AHBPROT: %d, Key ID: %u\n", AHBRPOT_Patched(), keyId);
|
||||
free(tmdBuffer);
|
||||
free(tikBuffer);
|
||||
free(certBuffer);
|
||||
|
@ -1073,11 +1073,11 @@ void Nand::Init_ISFS()
|
||||
}
|
||||
}
|
||||
|
||||
void Nand::DeInit_ISFS()
|
||||
void Nand::DeInit_ISFS(bool KeepPatches)
|
||||
{
|
||||
gprintf("Deinit ISFS\n");
|
||||
ISFS_Deinitialize();
|
||||
if(AccessPatched)
|
||||
if(AccessPatched && !KeepPatches)
|
||||
{
|
||||
Disable_ISFS_Patches();
|
||||
AccessPatched = false;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
|
||||
void Patch_AHB();
|
||||
void Init_ISFS();
|
||||
void DeInit_ISFS();
|
||||
void DeInit_ISFS(bool KeepPatches = false);
|
||||
|
||||
const char * Get_NandPath(void) { return NandPath; };
|
||||
u32 Get_Partition(void) { return Partition; };
|
||||
|
@ -349,8 +349,10 @@ int CMenu::_coverDownloaderMissing(CMenu *m)
|
||||
|
||||
static bool checkPNGBuf(u8 *data)
|
||||
{
|
||||
PNGUPROP imgProp;
|
||||
if(data == NULL)
|
||||
return false;
|
||||
|
||||
PNGUPROP imgProp;
|
||||
IMGCTX ctx = PNGU_SelectImageFromBuffer(data);
|
||||
if (ctx == NULL)
|
||||
return false;
|
||||
@ -363,18 +365,22 @@ static bool checkPNGFile(const char *filename)
|
||||
{
|
||||
u8 *buffer = NULL;
|
||||
FILE *file = fopen(filename, "rb");
|
||||
if (file == NULL) return false;
|
||||
if(file == NULL)
|
||||
return false;
|
||||
fseek(file, 0, SEEK_END);
|
||||
long fileSize = ftell(file);
|
||||
u32 fileSize = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
if (fileSize > 0)
|
||||
if(fileSize > 0)
|
||||
{
|
||||
buffer = (u8*)MEM2_alloc(fileSize);
|
||||
if(buffer != NULL)
|
||||
fread(buffer, 1, fileSize, file);
|
||||
}
|
||||
fclose(file);
|
||||
return buffer == NULL ? false : checkPNGBuf(buffer);
|
||||
bool ret = checkPNGBuf(buffer);
|
||||
if(buffer != NULL)
|
||||
MEM2_free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CMenu::_initAsyncNetwork()
|
||||
|
@ -947,7 +947,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
|
||||
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)
|
||||
if(neek2o() || (RealNAND_Channels && IOS_GetType(mainIOS) == IOS_TYPE_STUB))
|
||||
{
|
||||
if(!loadIOS(gameIOS, false))
|
||||
{
|
||||
@ -1132,6 +1132,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
setLanguage(language);
|
||||
ocarina_load_code(cheatFile, cheatSize);
|
||||
Patch_Channel_Boot(); /* Patch for everything */
|
||||
NandHandle.Patch_AHB(); /* Identify may takes it */
|
||||
Identify(gameTitle);
|
||||
ExternalBooter_ChannelSetup(gameTitle);
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL);
|
||||
|
Loading…
Reference in New Issue
Block a user