-added check for homebrew if the wiiflow loader channel is

installed, if not just return to system menu
-removed return_to_wiiflow from wiiflow.ini, not needed anymore
This commit is contained in:
fix94.1 2012-05-27 16:37:52 +00:00
parent 78f5b89437
commit bf26e129d9
4 changed files with 43 additions and 26 deletions

View File

@ -27,6 +27,9 @@ static u8 *homebrewbuffer = EXECUTE_ADDR;
static u32 homebrewsize = 0;
static vector<string> Arguments;
static u32 stubtitlepositions[8] = { 0x80001bf2, 0x80001bf3, 0x80001c06, 0x80001c07,
0x80001bfa, 0x80001bfb, 0x80001c0a, 0x80001c0b };
bool IsDollZ (u8 *buff)
{
u8 dollz_stamp[] = {0x3C};
@ -104,7 +107,35 @@ static int SetupARGV(struct __argv * args)
return 0;
}
int BootHomebrew(bool wiiflow_stub)
static void writeStub(u64 chan_title)
{
u8 i;
u32 digit;
char title[2][9];
snprintf(title[0], sizeof(title[0]), "%08x", TITLE_UPPER(chan_title));
snprintf(title[1], sizeof(title[1]), "%08x", TITLE_LOWER(chan_title));
/* Clear potential homebrew channel stub */
memset((void*)0x80001800, 0, 0x1800);
/* Copy our own stub into memory */
memcpy((void*)0x80001800, stub_bin, stub_bin_size);
/* Write in the Title ID we got */
for(i = 0; i < 4; i++)
{
sscanf(&title[0][i*2], "%02x", &digit);
//gprintf("%x\n", digit);
*(vu8*)stubtitlepositions[i] = digit;
sscanf(&title[1][i*2], "%02x", &digit);
//gprintf("%x\n", digit);
*(vu8*)stubtitlepositions[i+4] = digit;
}
DCFlushRange((void*)0x80001800, stub_bin_size);
}
int BootHomebrew(u64 chan_title)
{
struct __argv args;
if (!IsDollZ(homebrewbuffer))
@ -118,28 +149,7 @@ int BootHomebrew(bool wiiflow_stub)
memmove(ARGS_ADDR, &args, sizeof(args));
DCFlushRange(ARGS_ADDR, sizeof(args) + args.length);
if(wiiflow_stub)
{
/* Clear potential homebrew channel stub */
memset((void*)0x80001800, 0, 0x1800);
/* Copy our own stub into memory */
memcpy((void*)0x80001800, stub_bin, stub_bin_size);
/* Lower Title ID */
*(vu8*)0x80001bf2 = 0x00;
*(vu8*)0x80001bf3 = 0x01;
*(vu8*)0x80001c06 = 0x00;
*(vu8*)0x80001c07 = 0x08;
/* Upper Title ID */
*(vu8*)0x80001bfa = 0x57;
*(vu8*)0x80001bfb = 0x49;
*(vu8*)0x80001c0a = 0x49;
*(vu8*)0x80001c0b = 0x48;
DCFlushRange((void*)0x80001800, stub_bin_size);
}
writeStub(chan_title);
/* Shutdown IOS subsystems */
u32 level = IRQ_Disable();

View File

@ -1,7 +1,7 @@
#ifndef _BOOTHOMEBREW_H_
#define _BOOTHOMEBREW_H_
int BootHomebrew(bool wiiflow_stub);
int BootHomebrew(u64 chan_title);
void AddBootArgument(const char * arg);
int LoadHomebrew(const char * filepath);

View File

@ -10,6 +10,8 @@ extern "C" {
#define HBC_108 0x00010001af1bf516ULL
#define HBC_JODI 0x0001000148415858ULL
#define HBC_HAXX 0x000100014a4f4449ULL
#define RETURN_CHANNEL 0x0001000857494948ULL
#define SYSTEM_MENU 0x0000000100000002ULL
#define PRIILOADER_DEF 0
#define EXIT_TO_MENU 1

View File

@ -771,10 +771,14 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
{
bool wiiflow_stub = m_cfg.getBool("HOMEBREW", "return_to_wiiflow", true);
Nand::Instance()->Disable_Emu();
m_reload = true;
Channels channel;
u64 title = SYSTEM_MENU;
if(channel.GetRequestedIOS(RETURN_CHANNEL) != 0)
title = RETURN_CHANNEL;
gprintf("Filepath of homebrew: %s\n",filepath);
m_gcfg1.save(true);
@ -803,8 +807,9 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
gprintf("Boot argument: %s\n", arguments[i].c_str());
AddBootArgument(arguments[i].c_str());
}
gprintf("Return to Channel: %08x %08x\n", TITLE_UPPER(title), TITLE_LOWER(title));
gprintf("Booting Homebrew application...\n");
BootHomebrew(wiiflow_stub);
BootHomebrew(title);
}
int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id)