-shutdown IOS subsystems as we do in wii games and channels also

if we boot homebrew and devolution
-fixed stupid bug which may made a problem with devolution (thanks
stfour for finding it)
-dont init mload on waninkokos cIOS which is older than r18
This commit is contained in:
fix94.1 2012-07-17 11:30:08 +00:00
parent 6ae58ae3de
commit c3c02ac862
5 changed files with 26 additions and 11 deletions

View File

@ -2,6 +2,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ogc/machine/processor.h>
#include "gc.h"
#include "gecko.h"
#include "fileOps.h"
@ -127,6 +128,7 @@ void DML_New_WriteOptions()
// Devolution
u8 *loader_bin = NULL;
extern void __exception_closeall();
static gconfig *DEVO_CONFIG = (gconfig*)0x80000020;
#define DEVO_Entry() ((void(*)(void))loader_bin)()
@ -144,7 +146,7 @@ bool DEVO_Installed(const char* path)
return devo;
}
void DEVO_SetOptions(const char *path, const char *partition, const char* loader, bool memcard_emu)
void DEVO_SetOptions(const char *path, const char *partition, const char* loader, const char *gameID, bool memcard_emu)
{
//Read in loader.bin
char loader_path[256];
@ -162,14 +164,10 @@ void DEVO_SetOptions(const char *path, const char *partition, const char* loader
//start writing cfg to mem
struct stat st;
char full_path[256];
int data_fd;
char gameID[7];
stat(path, &st);
FILE *iso_file = fopen(path, "rb");
fread(&gameID, 1, 6, iso_file);
fseek(f, 0, SEEK_SET);
fread((u8*)0x80000000, 1, 32, iso_file);
fclose(iso_file);
@ -181,6 +179,7 @@ void DEVO_SetOptions(const char *path, const char *partition, const char* loader
DEVO_CONFIG->disc1_cluster = st.st_ino;
// make sure these directories exist, they are required for Devolution to function correctly
char full_path[256];
snprintf(full_path, sizeof(full_path), "%s:/apps", partition);
fsop_MakeFolder(full_path);
snprintf(full_path, sizeof(full_path), "%s:/apps/gc_devo", partition);
@ -235,8 +234,14 @@ void DEVO_Boot()
{
// the Devolution blob has an ID string at offset 4
puts((const char*)loader_bin + 4);
gprintf("WiiFlow GC: Devolution initialized. Booting game...\n \n");
gprintf("WiiFlow GC: Devolution initialized. Booting game...\n");
/* Shutdown IOS subsystems */
u32 level = IRQ_Disable();
__IOS_ShutdownSubsystems();
__exception_closeall();
DEVO_Entry();
IRQ_Restore(level);
}

View File

@ -64,7 +64,7 @@ typedef struct global_config
} gconfig;
bool DEVO_Installed(const char* path);
void DEVO_SetOptions(const char* path, const char *partition, const char *loader, bool memcard_emu);
void DEVO_SetOptions(const char* path, const char *partition, const char *loader, const char *gameID, bool memcard_emum);
void DEVO_Boot();

View File

@ -152,7 +152,11 @@ int BootHomebrew(u64 chan_title)
memmove(ARGS_ADDR, &args, sizeof(args));
DCFlushRange(ARGS_ADDR, sizeof(args) + args.length);
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
/* Shutdown IOS subsystems */
u32 level = IRQ_Disable();
__IOS_ShutdownSubsystems();
__exception_closeall();
entry();
IRQ_Restore(level);
return 0;
}

View File

@ -93,11 +93,17 @@ bool loadIOS(int ios, bool launch_game)
bool iosOK = IOS_ReloadIOS(ios) == 0;
ISFS_Initialize();
gprintf("%s, Current IOS: %i Base: %i\n", iosOK ? "OK" : "FAILED!", IOS_GetVersion(), get_ios_base());
gprintf("%s, Current IOS: %i\n", iosOK ? "OK" : "FAILED!", IOS_GetVersion());
if(is_ios_type(IOS_TYPE_HERMES, IOS_GetVersion()))
{
load_ehc_module_ex();
else if(is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()))
gprintf("Hermes cIOS Base IOS%i\n", get_ios_base());
}
else if(is_ios_type(IOS_TYPE_WANIN, IOS_GetVersion()) && IOS_GetRevision() >= 18)
{
load_dip_249();
gprintf("Waninkoko cIOS Base IOS%i\n", get_ios_base());
}
if(launch_game)
{

View File

@ -861,7 +861,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
{
loader = 2;
bool memcard_emu = m_gcfg2.getBool(id, "devo_memcard_emu", false);
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], m_dataDir.c_str(), memcard_emu);
DEVO_SetOptions(path.c_str(), DeviceName[currentPartition], m_dataDir.c_str(), id.c_str(), memcard_emu);
}
m_gcfg1.save(true);