mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 19:59:16 +01:00
-fixed cheats usage for DIOS-MIOS
-added more checks to prevent codedumps on gc banner creation
This commit is contained in:
parent
8b4d6159e2
commit
ea114c638d
@ -19,7 +19,7 @@
|
||||
// DIOS-MIOS
|
||||
DML_CFG *DMLCfg = NULL;
|
||||
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg)
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg)
|
||||
{
|
||||
gprintf("Wiiflow GC: Launch game '%s' through memory (new method)\n", GamePath);
|
||||
|
||||
@ -53,7 +53,7 @@ void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPat
|
||||
if(CheatPath != NULL && NewCheatPath != NULL && cheats)
|
||||
{
|
||||
char *ptr;
|
||||
if(strstr(CheatPath, "sd:/") == NULL)
|
||||
if(strstr(CheatPath, partition) == NULL)
|
||||
{
|
||||
fsop_CopyFile(CheatPath, NewCheatPath, NULL, NULL);
|
||||
ptr = &NewCheatPath[3];
|
||||
|
@ -49,7 +49,7 @@ enum dmlvideomode
|
||||
DML_VID_PROG_PATCH = (1<<4),
|
||||
};
|
||||
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg);
|
||||
void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, const char *partition, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting, bool widescreen, bool new_dm_cfg);
|
||||
void DML_Old_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats);
|
||||
void DML_New_SetBootDiscOption(bool new_dm_cfg);
|
||||
void DML_New_WriteOptions();
|
||||
|
@ -30,8 +30,10 @@ using namespace std;
|
||||
void GC_Disc::init(char *path)
|
||||
{
|
||||
opening_bnr = NULL;
|
||||
FSTable = NULL;
|
||||
|
||||
strncpy(GamePath, path, sizeof(GamePath));
|
||||
FILE *f;
|
||||
FILE *f = NULL;
|
||||
if(strcasestr(GamePath, "boot.bin") != NULL)
|
||||
{
|
||||
GameType = TYPE_FST;
|
||||
@ -39,6 +41,8 @@ void GC_Disc::init(char *path)
|
||||
fst.erase(fst.end() - 8, fst.end());
|
||||
fst.append("fst.bin");
|
||||
f = fopen(fst.c_str(), "rb");
|
||||
if(f == NULL)
|
||||
return;
|
||||
fseek(f, 0, SEEK_END);
|
||||
u32 size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
@ -49,7 +53,11 @@ void GC_Disc::init(char *path)
|
||||
{
|
||||
GameType = TYPE_ISO;
|
||||
f = fopen(GamePath, "rb");
|
||||
if(f == NULL)
|
||||
return;
|
||||
u8 *ReadBuffer = (u8*)MEM2_alloc(0x440);
|
||||
if(ReadBuffer == NULL)
|
||||
return;
|
||||
fread(ReadBuffer, 1, 0x440, f);
|
||||
u32 FSTOffset = *(vu32*)(ReadBuffer+0x424);
|
||||
u32 FSTSize = *(vu32*)(ReadBuffer+0x428);
|
||||
@ -77,6 +85,8 @@ void GC_Disc::clear()
|
||||
void GC_Disc::Read_FST(FILE *f, u32 FST_size)
|
||||
{
|
||||
FSTable = (u8*)MEM2_alloc(FST_size);
|
||||
if(FSTable == NULL)
|
||||
return;
|
||||
fread(FSTable, 1, FST_size, f);
|
||||
|
||||
FSTEnt = *(vu32*)(FSTable+0x08);
|
||||
@ -85,6 +95,8 @@ void GC_Disc::Read_FST(FILE *f, u32 FST_size)
|
||||
|
||||
u8 *GC_Disc::GetGameCubeBanner()
|
||||
{
|
||||
if(FSTable == NULL)
|
||||
return NULL;
|
||||
FILE *f = NULL;
|
||||
FST *fst = (FST *)(FSTable);
|
||||
for(u32 i = 1; i < FSTEnt; ++i)
|
||||
|
@ -835,7 +835,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
if(cheats)
|
||||
{
|
||||
snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
||||
snprintf(NewCheatPath, sizeof(NewCheatPath), "%s/%s/%s", fmt(DML_DIR, "sd"), path.c_str(), fmt("%s.gct", id.c_str()));
|
||||
snprintf(NewCheatPath, sizeof(NewCheatPath), "%s/%s/%s", fmt(DML_DIR, DeviceName[currentPartition]), path.c_str(), fmt("%s.gct", id.c_str()));
|
||||
}
|
||||
string newPath;
|
||||
if(strcasestr(path.c_str(), "boot.bin") != NULL)
|
||||
@ -846,7 +846,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
|
||||
else
|
||||
newPath = &path[path.find_first_of(":/")+1];
|
||||
if(m_new_dml)
|
||||
DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath, cheats, DML_debug, NMM, nodisc, videoMode, videoSetting, DM_Widescreen, m_new_dm_cfg);
|
||||
DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath, DeviceName[currentPartition], cheats, DML_debug, NMM, nodisc, videoMode, videoSetting, DM_Widescreen, m_new_dm_cfg);
|
||||
else
|
||||
DML_Old_SetOptions((char*)path.c_str(), CheatPath, NewCheatPath, cheats);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user