-lets keep sd card inited on gamecube disc launch, not that

we have NMM installed and then cant use it because of stopped sd ;)
-changed gc launch a little bit, now also saves playcount of
gamecube disc and uses same video and language options 
for gamecube discs as for dml
This commit is contained in:
fix94.1 2012-03-19 18:08:48 +00:00
parent 8d11ae4c1d
commit 8b7cf87550
2 changed files with 35 additions and 47 deletions

View File

@ -82,9 +82,7 @@ u8 get_wii_language()
void GC_SetLanguage(u8 lang) void GC_SetLanguage(u8 lang)
{ {
if (lang == 0) if (lang == 0)
{
lang = get_wii_language(); lang = get_wii_language();
}
else else
lang--; lang--;
@ -120,16 +118,21 @@ void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, boo
DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG)); DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG));
memset(DMLCfg, 0, sizeof(DML_CFG)); memset(DMLCfg, 0, sizeof(DML_CFG));
snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", GamePath);
DMLCfg->Magicbytes = 0xD1050CF6; DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->CfgVersion = 0x00000001; DMLCfg->CfgVersion = 0x00000001;
DMLCfg->VideoMode |= DML_VID_NONE; DMLCfg->VideoMode |= DML_VID_NONE;
DMLCfg->Config |= DML_CFG_GAME_PATH;
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
DMLCfg->Config |= DML_CFG_PADHOOK; //Makes life easier, l+z+b+digital down...
if(cheats) if(GamePath != NULL)
{
snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", GamePath);
DMLCfg->Config |= DML_CFG_GAME_PATH;
}
if(CheatPath != NULL && NewCheatPath != NULL && cheats)
{ {
char *ptr; char *ptr;
if(strstr(CheatPath, "sd:/") == NULL) if(strstr(CheatPath, "sd:/") == NULL)
@ -140,10 +143,11 @@ void DML_New_SetOptions(char *GamePath, char *CheatPath, char *NewCheatPath, boo
else else
ptr = &CheatPath[3]; ptr = &CheatPath[3];
strncpy(DMLCfg->CheatPath, ptr, sizeof(DMLCfg->CheatPath)); strncpy(DMLCfg->CheatPath, ptr, sizeof(DMLCfg->CheatPath));
DMLCfg->Config |= DML_CFG_CHEATS;
DMLCfg->Config |= DML_CFG_CHEAT_PATH; DMLCfg->Config |= DML_CFG_CHEAT_PATH;
} }
if(cheats)
DMLCfg->Config |= DML_CFG_CHEATS;
if(debugger) if(debugger)
DMLCfg->Config |= DML_CFG_DEBUGGER; DMLCfg->Config |= DML_CFG_DEBUGGER;
if(NMM > 0) if(NMM > 0)

View File

@ -641,27 +641,31 @@ extern "C" {extern void USBStorage_Deinit(void);}
void CMenu::_launchGC(dir_discHdr *hdr, bool DML) void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
{ {
m_gameSound.Stop();
char* id = (char *)hdr->hdr.id; char* id = (char *)hdr->hdr.id;
Nand::Instance()->Disable_Emu();
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
if(has_enabled_providers() && _initNetwork() == 0) if(has_enabled_providers() && _initNetwork() == 0)
add_game_to_card(id); add_game_to_card(id);
u8 DMLvideoMode = 0; u8 DMLvideoMode = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
u8 GClanguage = 0; DMLvideoMode = (DMLvideoMode == 0) ? min((u32)m_cfg.getInt("DML", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1u) : DMLvideoMode-1;
u8 GClanguage = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt("DML", "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1;
if(DML) if(DML)
{ {
m_cfg.setString("DML", "current_item", id);
char CheatPath[256]; char CheatPath[256];
char NewCheatPath[255]; char NewCheatPath[255];
u8 NMM = min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u); u8 NMM = min((u32)m_gcfg2.getInt(id, "dml_nmm", 0), ARRAY_SIZE(CMenu::_NMM) - 1u);
if(NMM == 0) NMM = (NMM == 0) ? m_cfg.getInt("DML", "dml_nmm", 0) : NMM-1;
NMM = m_cfg.getInt("DML", "dml_nmm", 0);
else
NMM--;
u8 nodisc = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u); u8 nodisc = min((u32)m_gcfg2.getInt(id, "no_disc_patch", 0), ARRAY_SIZE(CMenu::_NoDVD) - 1u);
if(nodisc == 0) nodisc = (nodisc == 0) ? m_cfg.getInt("DML", "no_disc_patch", 0) : nodisc-1;
nodisc = m_cfg.getInt("DML", "no_disc_patch", 0);
else
nodisc--;
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("DML", "cheat", false)); bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("DML", "cheat", false));
bool DML_debug = m_gcfg2.getBool(id, "debugger", false); bool DML_debug = m_gcfg2.getBool(id, "debugger", false);
@ -675,20 +679,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
DML_New_SetOptions(hdr->path, CheatPath, NewCheatPath, cheats, DML_debug, NMM, nodisc); DML_New_SetOptions(hdr->path, CheatPath, NewCheatPath, cheats, DML_debug, NMM, nodisc);
else else
DML_Old_SetOptions(hdr->path, CheatPath, NewCheatPath, cheats); DML_Old_SetOptions(hdr->path, CheatPath, NewCheatPath, cheats);
DMLvideoMode = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
if(DMLvideoMode == 0)
DMLvideoMode = min((u32)m_cfg.getInt("DML", "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalDMLvideoModes) - 1u);
else
DMLvideoMode--;
GClanguage = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
if(GClanguage == 0)
GClanguage = min((u32)m_cfg.getInt("DML", "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u);
else
GClanguage--;
m_cfg.setString("DML", "current_item", id);
m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1);
m_gcfg1.setUInt("LASTPLAYED", id, time(NULL));
if(!nodisc || !m_new_dml) if(!nodisc || !m_new_dml)
{ {
@ -700,6 +690,16 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
else else
gprintf("Booting GC game\n"); gprintf("Booting GC game\n");
m_gcfg1.save(true);
m_gcfg2.save(true);
m_cat.save(true);
m_cfg.save(true);
cleanup();
Close_Inputs();
USBStorage_Deinit();
SDHC_Init();
memcpy((char *)0x80000000, id, 6); memcpy((char *)0x80000000, id, 6);
if(((id[3] == 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 1)) if(((id[3] == 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 1))
GC_SetVideoMode(1); GC_SetVideoMode(1);
@ -710,22 +710,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
m_gcfg1.save(true);
m_gcfg2.save(true);
m_cat.save(true);
m_cfg.save(true);
CheckGameSoundThread();
cleanup();
Close_Inputs();
USBStorage_Deinit();
if(DML)
SDHC_Init();
_hideWaitMessage();
Nand::Instance()->Disable_Emu();
if(WII_LaunchTitle(0x100000100LL) < 0) if(WII_LaunchTitle(0x100000100LL) < 0)
Sys_LoadMenu(); Sys_LoadMenu();
} }