-writing DML options now safe into memory, no way that there

an error can occur anymore
This commit is contained in:
fix94.1 2012-05-08 20:38:50 +00:00
parent 7c1093a2b2
commit 5a817f0ce7
3 changed files with 18 additions and 13 deletions

View File

@ -19,6 +19,7 @@
syssram* __SYS_LockSram(); syssram* __SYS_LockSram();
u32 __SYS_UnlockSram(u32 write); u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void); u32 __SYS_SyncSram(void);
DML_CFG *DMLCfg = NULL;
void GC_SetVideoMode(u8 videomode) void GC_SetVideoMode(u8 videomode)
{ {
@ -149,12 +150,11 @@ void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, boo
{ {
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory (new method)\n", GamePath); gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory (new method)\n", GamePath);
DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG)); DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG));
memset(DMLCfg, 0, sizeof(DML_CFG)); memset(DMLCfg, 0, sizeof(DML_CFG));
DMLCfg->Magicbytes = 0xD1050CF6; DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->CfgVersion = 0x00000001; DMLCfg->CfgVersion = 0x00000001;
//DMLCfg->VideoMode |= DML_VID_FORCE;
DMLCfg->VideoMode |= DML_VID_NONE; DMLCfg->VideoMode |= DML_VID_NONE;
DMLCfg->Config |= DML_CFG_ACTIVITY_LED; //Sorry but I like it lol, option will may follow DMLCfg->Config |= DML_CFG_ACTIVITY_LED; //Sorry but I like it lol, option will may follow
@ -196,14 +196,6 @@ void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, boo
if(DMLvideoMode > 3) if(DMLvideoMode > 3)
DMLCfg->VideoMode |= DML_VID_PROG_PATCH; DMLCfg->VideoMode |= DML_VID_PROG_PATCH;
//Write options into memory
memcpy((void *)0xC0001700, DMLCfg, sizeof(DML_CFG));
//DML v1.2+
memcpy((void *)0xC1200000, DMLCfg, sizeof(DML_CFG));
MEM2_free(DMLCfg);
} }
void DML_Old_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats) void DML_Old_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats)
@ -229,16 +221,27 @@ void DML_New_SetBootDiscOption()
{ {
gprintf("Booting GC game\n"); gprintf("Booting GC game\n");
DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG)); DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG));
memset(DMLCfg, 0, sizeof(DML_CFG)); memset(DMLCfg, 0, sizeof(DML_CFG));
DMLCfg->Magicbytes = 0xD1050CF6; DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->CfgVersion = 0x00000001; DMLCfg->CfgVersion = 0x00000001;
DMLCfg->Config |= DML_CFG_BOOT_DISC; DMLCfg->Config |= DML_CFG_BOOT_DISC;
}
void DML_New_WriteOptions()
{
if(DMLCfg == NULL)
return;
//Write options into memory
memcpy((void *)0x80001700, DMLCfg, sizeof(DML_CFG));
DCFlushRange((void *)(0x80001700), sizeof(DML_CFG));
//DML v1.2+ //DML v1.2+
memcpy((void *)0xC1200000, DMLCfg, sizeof(DML_CFG)); memcpy((void *)0x81200000, DMLCfg, sizeof(DML_CFG));
DCFlushRange((void *)(0x81200000), sizeof(DML_CFG));
MEM2_free(DMLCfg); MEM2_free(DMLCfg);
} }

View File

@ -48,9 +48,11 @@ enum dmlvideomode
void GC_SetVideoMode(u8 videomode); void GC_SetVideoMode(u8 videomode);
void GC_SetLanguage(u8 lang); void GC_SetLanguage(u8 lang);
int GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir); int GC_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir);
void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode); void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode);
void DML_Old_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats); void DML_Old_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats);
void DML_New_SetBootDiscOption(); void DML_New_SetBootDiscOption();
void DML_New_WriteOptions();
#endif //GC_H_ #endif //GC_H_
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -761,9 +761,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
USBStorage_Deinit(); USBStorage_Deinit();
SDHC_Init(); SDHC_Init();
memcpy((char *)0x80000000, id, 6);
GC_SetVideoMode(DMLvideoMode); GC_SetVideoMode(DMLvideoMode);
GC_SetLanguage(GClanguage); GC_SetLanguage(GClanguage);
DML_New_WriteOptions();
if(WII_LaunchTitle(0x100000100LL) < 0) if(WII_LaunchTitle(0x100000100LL) < 0)
Sys_LoadMenu(); Sys_LoadMenu();