-now no boot.bin needs to be created to launch a gamecube

game (better for the sd card), requires DML r52 or newer 
to work properly
-added new option in [DML] section, "dml_r52+", you
can set it to no if have a older DML version or want
to use the old boot.bin method instead to launch a gc game
This commit is contained in:
fix94.1 2012-03-10 16:54:57 +00:00
parent ceccdcc4f5
commit 7633ac55c2
4 changed files with 60 additions and 14 deletions

View File

@ -5,6 +5,42 @@ extern "C"
#ifndef GC_H_ #ifndef GC_H_
#define GC_H_ #define GC_H_
typedef struct DML_CFG
{
u32 Magicbytes; //0xD1050CF6
u32 CfgVersion; //0x00000001
u32 VideoMode;
u32 Config;
char GamePath[255];
char CheatPath[255];
} DML_CFG;
enum dmlconfig
{
DML_CFG_CHEATS = (1<<0),
DML_CFG_DEBUGGER = (1<<1),
DML_CFG_DEBUGWAIT = (1<<2),
DML_CFG_NMM = (1<<3),
DML_CFG_NMM_DEBUG = (1<<4),
DML_CFG_GAME_PATH = (1<<5),
DML_CFG_CHEAT_PATH = (1<<6),
DML_CFG_ACTIVITY_LED= (1<<7),
DML_CFG_PADHOOK = (1<<8),
};
enum dmlvideomode
{
DML_VID_DML_AUTO = (0<<16),
DML_VID_FORCE = (1<<16),
DML_VID_NONE = (2<<16),
DML_VID_FORCE_PAL50 = (1<<0),
DML_VID_FORCE_PAL60 = (1<<1),
DML_VID_FORCE_NTSC = (1<<2),
DML_VID_FORCE_PROG = (1<<3),
};
void set_video_mode(int i); void set_video_mode(int i);
void set_language(u8 lang); void set_language(u8 lang);
bool DML_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir); bool DML_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir);

View File

@ -249,6 +249,7 @@ void CMenu::init(void)
} }
else else
m_show_dml = MIOSisDML(); m_show_dml = MIOSisDML();
m_new_dml = m_cfg.getBool("DML", "dml_r52+", true);
m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str()); m_DMLgameDir = sfmt("%%s:/%s", m_cfg.getString("DML", "dir_usb_games", "games").c_str());
m_cfg.getString("NAND", "path", "").c_str(); m_cfg.getString("NAND", "path", "").c_str();

View File

@ -170,6 +170,7 @@ private:
u32 m_mainLblInit; u32 m_mainLblInit;
u32 m_mainLblUser[6]; u32 m_mainLblUser[6];
bool m_show_dml; bool m_show_dml;
bool m_new_dml;
bool m_GameTDBLoaded; bool m_GameTDBLoaded;
//Main Config menus //Main Config menus
u32 m_configLblPage; u32 m_configLblPage;

View File

@ -632,19 +632,27 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
if(DML) if(DML)
{ {
#ifdef DML_THROUGH_MEM /*** Need special DML for this ***/ if(m_new_dml)
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path); {
*(vu32*)0x800A0000 = 0x4e444d4c; gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path);
memcpy((void *)0x800A0004, hdr->path, strlen(hdr->path) + 1); DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG));
DCFlushRange((void *)(0x800A0000), 4); memset(DMLCfg, 0, sizeof(DML_CFG));
ICInvalidateRange((void *)(0x800A0000), 4); DMLCfg->Magicbytes = 0xD1050CF6;
#else DMLCfg->CfgVersion = 0x00000001;
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through boot.bin\n", hdr->path); DMLCfg->VideoMode = DML_VID_NONE;
FILE *f; DMLCfg->Config = DML_CFG_GAME_PATH;
f = fopen("sd:/games/boot.bin", "wb"); snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", hdr->path);
fwrite(hdr->path, 1, strlen(hdr->path) + 1, f); memcpy((void *)0xC0001700, DMLCfg, sizeof(DML_CFG));
fclose(f); MEM2_free(DMLCfg);
#endif }
else
{
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through boot.bin\n", hdr->path);
FILE *f;
f = fopen("sd:/games/boot.bin", "wb");
fwrite(hdr->path, 1, strlen(hdr->path) + 1, f);
fclose(f);
}
DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u); DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
if(DMLvideoMode == 0) if(DMLvideoMode == 0)
@ -676,7 +684,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
//Tell DML to boot the game from sd card //Tell DML to boot the game from sd card
*(vu32*)0x80001800 = 0xB002D105; *(vu32*)0x80001800 = 0xB002D105;
DCFlushRange((void *)(0x80001800), 4); DCFlushRange((void *)(0x80001800), 4);
ICInvalidateRange((void *)(0x80001800), 4); ICInvalidateRange((void *)(0x80001800), 4);
} }
memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6); memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6);