-if devolution bin is found and diosmios is not installed

display gamecube coverflow button still
-added possibility to set diosmios video patching way,
video_setting in wiiflow.ini [DML] section, if set to 0
it will disable all video settings of diosmios, if set to 1
it will use the auto setting (default) and if set to 2 it
will force the video mode
This commit is contained in:
fix94.1 2012-07-12 15:53:04 +00:00
parent 8aa08dee60
commit aeafda53a0
8 changed files with 70 additions and 48 deletions

View File

@ -17,7 +17,7 @@
// DIOS-MIOS // DIOS-MIOS
DML_CFG *DMLCfg = NULL; 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, bool force) void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting)
{ {
gprintf("Wiiflow DML: Launch game '%s' through memory (new method)\n", GamePath); gprintf("Wiiflow DML: Launch game '%s' through memory (new method)\n", GamePath);
@ -28,10 +28,12 @@ void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPat
DMLCfg->Magicbytes = 0xD1050CF6; DMLCfg->Magicbytes = 0xD1050CF6;
DMLCfg->CfgVersion = 0x00000001; DMLCfg->CfgVersion = 0x00000001;
if(force) if(videoSetting == 0)
DMLCfg->VideoMode |= DML_VID_FORCE; DMLCfg->VideoMode |= DML_VID_NONE;
else else if(videoSetting == 1)
DMLCfg->VideoMode |= DML_VID_DML_AUTO; DMLCfg->VideoMode |= DML_VID_DML_AUTO;
else
DMLCfg->VideoMode |= DML_VID_FORCE;
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... DMLCfg->Config |= DML_CFG_PADHOOK; //Makes life easier, l+z+b+digital down...
@ -126,6 +128,20 @@ void DML_New_WriteOptions()
// Devolution // Devolution
static gconfig *DEVO_CONFIG = (gconfig*)0x80000020; static gconfig *DEVO_CONFIG = (gconfig*)0x80000020;
bool DEVO_Installed(const char* path)
{
bool devo = false;
char loader_path[256];
snprintf(loader_path, sizeof(loader_path), "%s/loader.bin", path);
FILE *f = fopen(loader_path, "rb");
if(f)
{
devo = true;
fclose(f);
}
return devo;
}
void DEVO_SetOptions(const char *path, const char *partition) void DEVO_SetOptions(const char *path, const char *partition)
{ {
struct stat st; struct stat st;
@ -188,6 +204,26 @@ void DEVO_SetOptions(const char *path, const char *partition)
DCFlushRange(lowmem, 64); DCFlushRange(lowmem, 64);
} }
u8 *loader_bin = NULL;
#define LAUNCH() ((void(*)(void))loader_bin)()
void DEVO_Boot(const char* path)
{
char loader_path[256];
snprintf(loader_path, sizeof(loader_path), "%s/loader.bin", path);
FILE *f = fopen(loader_path, "rb");
if(f)
{
fseek(f, 0, SEEK_END);
u32 size = ftell(f);
rewind(f);
loader_bin = (u8*)MEM2_alloc(size);
fread(loader_bin, 1, size, f);
puts((const char*)loader_bin + 4);
LAUNCH();
}
}
// General // General
#define SRAM_ENGLISH 0 #define SRAM_ENGLISH 0
@ -201,7 +237,7 @@ syssram* __SYS_LockSram();
u32 __SYS_UnlockSram(u32 write); u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void); u32 __SYS_SyncSram(void);
void GC_SetVideoMode(u8 videomode, bool force) void GC_SetVideoMode(u8 videomode, u8 videoSetting)
{ {
syssram *sram; syssram *sram;
sram = __SYS_LockSram(); sram = __SYS_LockSram();
@ -227,32 +263,32 @@ void GC_SetVideoMode(u8 videomode, bool force)
if(videomode == 1) if(videomode == 1)
{ {
if(DMLCfg != NULL && force) if(DMLCfg != NULL && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PAL50; DMLCfg->VideoMode |= DML_VID_FORCE_PAL50;
rmode = &TVPal528IntDf; rmode = &TVPal528IntDf;
} }
else if(videomode == 2) else if(videomode == 2)
{ {
if(DMLCfg != NULL && force) if(DMLCfg != NULL && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_NTSC; DMLCfg->VideoMode |= DML_VID_FORCE_NTSC;
rmode = &TVNtsc480IntDf; rmode = &TVNtsc480IntDf;
} }
else if(videomode == 3) else if(videomode == 3)
{ {
if(DMLCfg != NULL && force) if(DMLCfg != NULL && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PAL60; DMLCfg->VideoMode |= DML_VID_FORCE_PAL60;
rmode = &TVEurgb60Hz480IntDf; rmode = &TVEurgb60Hz480IntDf;
memflag = 5; memflag = 5;
} }
else if(videomode == 4 ||videomode == 6) else if(videomode == 4 ||videomode == 6)
{ {
if(DMLCfg != NULL && force) if(DMLCfg != NULL && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PROG; DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
rmode = &TVNtsc480Prog; rmode = &TVNtsc480Prog;
} }
else if(videomode == 5 || videomode == 7) else if(videomode == 5 || videomode == 7)
{ {
if(DMLCfg != NULL && force) if(DMLCfg != NULL && videoSetting == 2)
DMLCfg->VideoMode |= DML_VID_FORCE_PROG; DMLCfg->VideoMode |= DML_VID_FORCE_PROG;
rmode = &TVNtsc480Prog; rmode = &TVNtsc480Prog;
memflag = 5; memflag = 5;

View File

@ -46,7 +46,7 @@ enum dmlvideomode
DML_VID_PROG_PATCH = (1<<4), 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, bool force); void DML_New_SetOptions(const char *GamePath, char *CheatPath, char *NewCheatPath, bool cheats, bool debugger, u8 NMM, u8 nodisc, u8 DMLvideoMode, u8 videoSetting);
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(); void DML_New_WriteOptions();
@ -63,11 +63,13 @@ typedef struct global_config
u32 disc2_cluster; u32 disc2_cluster;
} gconfig; } gconfig;
bool DEVO_Installed(const char* path);
void DEVO_SetOptions(const char* path, const char *partition); void DEVO_SetOptions(const char* path, const char *partition);
void DEVO_Boot(const char* path);
// General // General
void GC_SetVideoMode(u8 videomode, bool force); void GC_SetVideoMode(u8 videomode, u8 videoSetting);
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);

View File

@ -63,8 +63,6 @@ int main(int argc, char **argv)
else if (argv[i] != NULL && strcasestr(argv[i], "EMULATOR_MAGIC") != NULL) else if (argv[i] != NULL && strcasestr(argv[i], "EMULATOR_MAGIC") != NULL)
Emulator_boot = true; Emulator_boot = true;
} }
Close_Inputs();
// Load Custom IOS // Load Custom IOS
gprintf("Loading cIOS: %d\n", mainIOS); gprintf("Loading cIOS: %d\n", mainIOS);
bool iosOK = loadIOS(mainIOS, false); bool iosOK = loadIOS(mainIOS, false);

View File

@ -23,6 +23,7 @@
#include "cios.hpp" #include "cios.hpp"
#include "loader/playlog.h" #include "loader/playlog.h"
#include "gc/fileOps.h" #include "gc/fileOps.h"
#include "gc/gc.h"
#include "Gekko.h" #include "Gekko.h"
#include "GameTDB.hpp" #include "GameTDB.hpp"
#include "BannerWindow.hpp" #include "BannerWindow.hpp"
@ -267,6 +268,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_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());
@ -367,6 +369,7 @@ void CMenu::init(void)
m_theme.load(fmt("%s.ini", m_themeDataDir.c_str())); m_theme.load(fmt("%s.ini", m_themeDataDir.c_str()));
m_plugin.init(m_pluginsDir); m_plugin.init(m_pluginsDir);
m_devo_installed = DEVO_Installed(m_dataDir.c_str());
u8 defaultMenuLanguage = 7; //English u8 defaultMenuLanguage = 7; //English
switch (CONF_GetLanguage()) switch (CONF_GetLanguage())
{ {

View File

@ -177,6 +177,7 @@ private:
u16 m_mainLblInit; u16 m_mainLblInit;
u16 m_mainLblUser[6]; u16 m_mainLblUser[6];
u8 m_show_dml; u8 m_show_dml;
bool m_devo_installed;
bool m_new_dml; bool m_new_dml;
bool m_GameTDBLoaded; bool m_GameTDBLoaded;
//Main Config menus //Main Config menus

View File

@ -532,7 +532,7 @@ void CMenu::_game(bool launch)
{ {
_hideGame(); _hideGame();
dir_discHdr *hdr = m_cf.getHdr(); dir_discHdr *hdr = m_cf.getHdr();
if(currentPartition != SD && hdr->type == TYPE_GC_GAME && m_show_dml != 1) if(currentPartition != SD && hdr->type == TYPE_GC_GAME && (m_show_dml != 1 || !m_devo_installed))
{ {
bool foundOnSD = false; bool foundOnSD = false;
CList<dir_discHdr> tmplist; CList<dir_discHdr> tmplist;
@ -788,20 +788,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
if(has_enabled_providers() && _initNetwork() == 0) if(has_enabled_providers() && _initNetwork() == 0)
add_game_to_card(id.c_str()); add_game_to_card(id.c_str());
bool devo = false; u8 videoSetting = min(m_cfg.getInt("DML", "video_setting", 1), 2);
u8 *loader_bin = NULL;
FILE *f = fopen(fmt("%s/loader.bin", m_dataDir.c_str()), "rb");
if(f)
{
devo = true;
fseek(f, 0, SEEK_END);
u32 size = ftell(f);
rewind(f);
loader_bin = (u8*)MEM2_alloc(size);
fread(loader_bin, 1, size, f);
puts((const char*)loader_bin + 4);
fclose(f);
}
u8 GClanguage = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); 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; GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt("DML", "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1;
@ -813,7 +800,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
else if((id[3] != 'P') && (DMLvideoMode == 0)) else if((id[3] != 'P') && (DMLvideoMode == 0))
DMLvideoMode = 2; DMLvideoMode = 2;
if(DML) if(m_devo_installed && strcasestr(path.c_str(), "boot.bin") == NULL)
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition]);
else if(DML)
{ {
m_cfg.setString("DML", "current_item", id); m_cfg.setString("DML", "current_item", id);
@ -839,13 +828,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
newPath.erase(newPath.end() - 12, newPath.end()); newPath.erase(newPath.end() - 12, newPath.end());
} }
else else
{
newPath = &path[path.find_first_of(":/")+1]; newPath = &path[path.find_first_of(":/")+1];
if(devo)
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition]);
}
if(m_new_dml) if(m_new_dml)
DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath, cheats, DML_debug, NMM, nodisc, DMLvideoMode, false); DML_New_SetOptions(newPath.c_str(), CheatPath, NewCheatPath, cheats, DML_debug, NMM, nodisc, DMLvideoMode, videoSetting);
else else
DML_Old_SetOptions((char*)path.c_str(), CheatPath, NewCheatPath, cheats); DML_Old_SetOptions((char*)path.c_str(), CheatPath, NewCheatPath, cheats);
@ -868,9 +853,9 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
USBStorage_Deinit(); USBStorage_Deinit();
SDHC_Init(); SDHC_Init();
GC_SetVideoMode(DMLvideoMode, false); GC_SetVideoMode(DMLvideoMode, videoSetting);
GC_SetLanguage(GClanguage); GC_SetLanguage(GClanguage);
if(!devo) if(!m_devo_installed || strcasestr(path.c_str(), "boot.bin") != NULL)
{ {
DML_New_WriteOptions(); DML_New_WriteOptions();
WII_Initialize(); WII_Initialize();
@ -878,10 +863,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
Sys_LoadMenu(); Sys_LoadMenu();
} }
else else
{ DEVO_Boot(m_dataDir.c_str());
#define LAUNCH() ((void(*)(void))loader_bin)()
LAUNCH();
}
} }
void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments) void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)

View File

@ -122,7 +122,7 @@ void CMenu::_showMain(void)
m_btnMgr.show(m_mainBtnUsb); m_btnMgr.show(m_mainBtnUsb);
break; break;
default: default:
if(m_show_dml) if(m_show_dml || m_devo_installed)
m_btnMgr.show(m_mainBtnDML); m_btnMgr.show(m_mainBtnDML);
else if (show_channel) else if (show_channel)
m_btnMgr.show(m_mainBtnChannel); m_btnMgr.show(m_mainBtnChannel);
@ -326,7 +326,7 @@ int CMenu::main(void)
u32 lastView = m_current_view; u32 lastView = m_current_view;
if(BTN_UP_PRESSED) if(BTN_UP_PRESSED)
m_current_view = COVERFLOW_USB; m_current_view = COVERFLOW_USB;
else if(BTN_DOWN_PRESSED && m_show_dml) else if(BTN_DOWN_PRESSED && (m_show_dml ||m_devo_installed))
m_current_view = COVERFLOW_DML; m_current_view = COVERFLOW_DML;
else if(BTN_LEFT_PRESSED && show_emu) else if(BTN_LEFT_PRESSED && show_emu)
m_current_view = COVERFLOW_EMU; m_current_view = COVERFLOW_EMU;
@ -360,7 +360,7 @@ int CMenu::main(void)
else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnUsb) || m_btnMgr.selected(m_mainBtnDML) || m_btnMgr.selected(m_mainBtnHomebrew) || m_btnMgr.selected(m_mainBtnEmu)) else if(m_btnMgr.selected(m_mainBtnChannel) || m_btnMgr.selected(m_mainBtnUsb) || m_btnMgr.selected(m_mainBtnDML) || m_btnMgr.selected(m_mainBtnHomebrew) || m_btnMgr.selected(m_mainBtnEmu))
{ {
if(m_current_view == COVERFLOW_USB) if(m_current_view == COVERFLOW_USB)
m_current_view = m_show_dml ? COVERFLOW_DML : (show_channel ? COVERFLOW_CHANNEL : (show_emu ? COVERFLOW_EMU : ((show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB))); m_current_view = (m_show_dml || m_devo_installed) ? COVERFLOW_DML : (show_channel ? COVERFLOW_CHANNEL : (show_emu ? COVERFLOW_EMU : ((show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB)));
else if(m_current_view == COVERFLOW_DML) else if(m_current_view == COVERFLOW_DML)
m_current_view = show_channel ? COVERFLOW_CHANNEL : ((show_emu ? COVERFLOW_EMU : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB)); m_current_view = show_channel ? COVERFLOW_CHANNEL : ((show_emu ? COVERFLOW_EMU : (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_USB));
else if(m_current_view == COVERFLOW_CHANNEL) else if(m_current_view == COVERFLOW_CHANNEL)
@ -782,7 +782,7 @@ int CMenu::main(void)
m_btnMgr.show(m_mainBtnUsb); m_btnMgr.show(m_mainBtnUsb);
break; break;
default: default:
if(m_show_dml) if(m_show_dml || m_devo_installed)
m_btnMgr.show(m_mainBtnDML); m_btnMgr.show(m_mainBtnDML);
else if(show_channel) else if(show_channel)
m_btnMgr.show(m_mainBtnChannel); m_btnMgr.show(m_mainBtnChannel);

View File

@ -211,7 +211,7 @@ bool CMenu::_Source()
} }
if(m_btnMgr.selected(m_sourceBtnDML)) if(m_btnMgr.selected(m_sourceBtnDML))
{ {
if (!m_show_dml) _showSourceNotice(); if (!m_show_dml && !m_devo_installed) _showSourceNotice();
else else
{ {
m_current_view = COVERFLOW_DML; m_current_view = COVERFLOW_DML;
@ -258,7 +258,7 @@ bool CMenu::_Source()
} }
if (source == "dml") if (source == "dml")
{ {
if (!m_show_dml) _showSourceNotice(); if (!m_show_dml && !m_devo_installed) _showSourceNotice();
else else
{ {
m_current_view = COVERFLOW_DML; m_current_view = COVERFLOW_DML;