-we should read in the loader.bin before closing the devices :P

This commit is contained in:
fix94.1 2012-07-12 16:02:51 +00:00
parent aeafda53a0
commit b4dbfeaa1d
3 changed files with 27 additions and 25 deletions

View File

@ -126,7 +126,9 @@ void DML_New_WriteOptions()
// Devolution
u8 *loader_bin = NULL;
static gconfig *DEVO_CONFIG = (gconfig*)0x80000020;
#define LAUNCH() ((void(*)(void))loader_bin)()
bool DEVO_Installed(const char* path)
{
@ -142,8 +144,23 @@ bool DEVO_Installed(const char* path)
return devo;
}
void DEVO_SetOptions(const char *path, const char *partition)
void DEVO_SetOptions(const char *path, const char *partition, const char* loader)
{
//Read in loader.bin
char loader_path[256];
snprintf(loader_path, sizeof(loader_path), "%s/loader.bin", loader);
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);
fclose(f);
}
//start writing cfg to mem
struct stat st;
char full_path[256];
int data_fd;
@ -204,24 +221,11 @@ void DEVO_SetOptions(const char *path, const char *partition)
DCFlushRange(lowmem, 64);
}
u8 *loader_bin = NULL;
#define LAUNCH() ((void(*)(void))loader_bin)()
void DEVO_Boot(const char* path)
void DEVO_Boot()
{
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);
// the Devolution blob has an ID string at offset 4
puts((const char*)loader_bin + 4);
LAUNCH();
}
}

View File

@ -64,8 +64,8 @@ typedef struct global_config
} gconfig;
bool DEVO_Installed(const char* path);
void DEVO_SetOptions(const char* path, const char *partition);
void DEVO_Boot(const char* path);
void DEVO_SetOptions(const char* path, const char *partition, const char *loader);
void DEVO_Boot();
// General

View File

@ -801,7 +801,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
DMLvideoMode = 2;
if(m_devo_installed && strcasestr(path.c_str(), "boot.bin") == NULL)
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition]);
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], m_dataDir.c_str());
else if(DML)
{
m_cfg.setString("DML", "current_item", id);
@ -814,13 +814,11 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
nodisc = (nodisc == 0) ? m_cfg.getInt("DML", "no_disc_patch", 0) : nodisc-1;
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("DML", "cheat", false));
bool DML_debug = m_gcfg2.getBool(id, "debugger", false);
if(cheats)
{
snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
snprintf(NewCheatPath, sizeof(NewCheatPath), "%s/%s/%s", fmt(DML_DIR, "sd"), path.c_str(), fmt("%s.gct", id.c_str()));
}
string newPath;
if(strcasestr(path.c_str(), "boot.bin") != NULL)
{
@ -863,7 +861,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
Sys_LoadMenu();
}
else
DEVO_Boot(m_dataDir.c_str());
DEVO_Boot();
}
void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)