diff --git a/source/gc/gc.h b/source/gc/gc.h index 3109fe5f..7464dec2 100644 --- a/source/gc/gc.h +++ b/source/gc/gc.h @@ -5,6 +5,42 @@ extern "C" #ifndef 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_language(u8 lang); bool DML_GameIsInstalled(char *discid, const char* partition, const char* dmlgamedir); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 12a54aae..43210304 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -249,6 +249,7 @@ void CMenu::init(void) } else 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_cfg.getString("NAND", "path", "").c_str(); diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index b5d4c44f..d8dd9c93 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -170,6 +170,7 @@ private: u32 m_mainLblInit; u32 m_mainLblUser[6]; bool m_show_dml; + bool m_new_dml; bool m_GameTDBLoaded; //Main Config menus u32 m_configLblPage; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index e7f2d052..c07653b9 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -632,19 +632,27 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML) if(DML) { - #ifdef DML_THROUGH_MEM /*** Need special DML for this ***/ - gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path); - *(vu32*)0x800A0000 = 0x4e444d4c; - memcpy((void *)0x800A0004, hdr->path, strlen(hdr->path) + 1); - DCFlushRange((void *)(0x800A0000), 4); - ICInvalidateRange((void *)(0x800A0000), 4); - #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); - #endif + if(m_new_dml) + { + gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path); + DML_CFG *DMLCfg = (DML_CFG*)MEM2_alloc(sizeof(DML_CFG)); + memset(DMLCfg, 0, sizeof(DML_CFG)); + DMLCfg->Magicbytes = 0xD1050CF6; + DMLCfg->CfgVersion = 0x00000001; + DMLCfg->VideoMode = DML_VID_NONE; + DMLCfg->Config = DML_CFG_GAME_PATH; + snprintf(DMLCfg->GamePath, sizeof(DMLCfg->GamePath), "/games/%s/game.iso", hdr->path); + memcpy((void *)0xC0001700, DMLCfg, sizeof(DML_CFG)); + MEM2_free(DMLCfg); + } + 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); if(DMLvideoMode == 0) @@ -676,7 +684,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML) //Tell DML to boot the game from sd card *(vu32*)0x80001800 = 0xB002D105; DCFlushRange((void *)(0x80001800), 4); - ICInvalidateRange((void *)(0x80001800), 4); + ICInvalidateRange((void *)(0x80001800), 4); } memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6);