-fixed a stupid bug with the new boot method of stuff :P

This commit is contained in:
fix94.1 2012-12-08 18:45:48 +00:00
parent 3029c59e13
commit 11276dbcbb
4 changed files with 23 additions and 22 deletions

View File

@ -34,6 +34,8 @@
/* External WiiFlow Game Booter */ /* External WiiFlow Game Booter */
static the_CFG *BooterConfig = (the_CFG*)0x93100000; static the_CFG *BooterConfig = (the_CFG*)0x93100000;
#define EXT_ADDR ((u8*)0x80B00000)
#define EXT_ENTRY ((entry)EXT_ADDR)
extern "C" { extern "C" {
u8 configbytes[2]; u8 configbytes[2];
@ -76,10 +78,10 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
memcpy(BooterConfig, &normalCFG, sizeof(the_CFG)); memcpy(BooterConfig, &normalCFG, sizeof(the_CFG));
DCFlushRange(BooterConfig, sizeof(the_CFG)); DCFlushRange(BooterConfig, sizeof(the_CFG));
/* Copy in booter */ /* Copy in booter */
memcpy(BOOTER_ADDR, booter, booter_size); memcpy(EXT_ADDR, booter, booter_size);
DCFlushRange(BOOTER_ADDR, booter_size); DCFlushRange(EXT_ADDR, booter_size);
/* Boot it */ /* Boot it */
JumpToBooter(); JumpToEntry(EXT_ENTRY);
} }
extern FragList *frag_list; extern FragList *frag_list;

View File

@ -31,6 +31,7 @@
#include "devicemounter/DeviceHandler.hpp" #include "devicemounter/DeviceHandler.hpp"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
#include "fileOps/fileOps.h" #include "fileOps/fileOps.h"
#include "homebrew/homebrew.h"
#include "loader/utils.h" #include "loader/utils.h"
#include "loader/disc.h" #include "loader/disc.h"
#include "loader/sys.h" #include "loader/sys.h"
@ -153,7 +154,7 @@ u8 *loader_bin = NULL;
u32 loader_size = 0; u32 loader_size = 0;
extern "C" { extern void __exception_closeall(); } extern "C" { extern void __exception_closeall(); }
static gconfig *DEVO_CONFIG = (gconfig*)0x80000020; static gconfig *DEVO_CONFIG = (gconfig*)0x80000020;
#define DEVO_Entry ((void(*)())loader_bin) #define DEVO_ENTRY ((entry)loader_bin)
bool DEVO_Installed(const char *path) bool DEVO_Installed(const char *path)
{ {
@ -296,10 +297,8 @@ void DEVO_Boot()
DCFlushRange(loader_bin, ALIGN32(loader_size)); DCFlushRange(loader_bin, ALIGN32(loader_size));
MEM2_free(tmp_buffer); MEM2_free(tmp_buffer);
gprintf("%s\n", (loader_bin+4)); gprintf("%s\n", (loader_bin+4));
/* cleaning up and load bin */ /* Boot that binary */
gprintf("Jumping to Entry 0x%08x\n", loader_bin); JumpToEntry(DEVO_ENTRY);
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
__lwp_thread_stopmultitasking(DEVO_Entry);
} }

View File

@ -9,6 +9,11 @@
#include "homebrew.h" #include "homebrew.h"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
#define EXECUTE_ADDR ((u8 *)0x92000000)
#define BOOTER_ADDR ((u8 *)0x93000000)
#define ARGS_ADDR ((u8 *)0x93200000)
#define BOOTER_ENTRY ((entry)BOOTER_ADDR)
using namespace std; using namespace std;
extern const u8 app_booter_bin[]; extern const u8 app_booter_bin[];
@ -110,9 +115,9 @@ void writeStub()
DCFlushRange((void*)0x80001800, stub_bin_size); DCFlushRange((void*)0x80001800, stub_bin_size);
} }
int BootHomebrew() void BootHomebrew()
{ {
struct __argv args; __argv args;
if(!IsDollZ(EXECUTE_ADDR) && !IsSpecialELF(EXECUTE_ADDR)) if(!IsDollZ(EXECUTE_ADDR) && !IsSpecialELF(EXECUTE_ADDR))
SetupARGV(&args); SetupARGV(&args);
else else
@ -124,14 +129,12 @@ int BootHomebrew()
memmove(ARGS_ADDR, &args, sizeof(args)); memmove(ARGS_ADDR, &args, sizeof(args));
DCFlushRange(ARGS_ADDR, sizeof(args) + args.length); DCFlushRange(ARGS_ADDR, sizeof(args) + args.length);
JumpToBooter(); JumpToEntry(BOOTER_ENTRY);
return 0;
} }
#define BOOTER_ENTRY ((void(*)())BOOTER_ADDR) void JumpToEntry(entry EntryPoint)
void JumpToBooter()
{ {
/* cleaning up and load bin */ gprintf("Jumping to %08x\n", EntryPoint);
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
__lwp_thread_stopmultitasking(BOOTER_ENTRY); __lwp_thread_stopmultitasking(EntryPoint);
} }

View File

@ -2,15 +2,12 @@
#ifndef _BOOTHOMEBREW_H_ #ifndef _BOOTHOMEBREW_H_
#define _BOOTHOMEBREW_H_ #define _BOOTHOMEBREW_H_
#define EXECUTE_ADDR ((u8 *)0x92000000) typedef void (*entry)(void);
#define BOOTER_ADDR ((u8 *)0x93000000)
#define ARGS_ADDR ((u8 *)0x93200000)
int BootHomebrew(); void BootHomebrew();
int SetupARGV(struct __argv * args);
void AddBootArgument(const char * arg); void AddBootArgument(const char * arg);
int LoadHomebrew(const char * filepath); int LoadHomebrew(const char * filepath);
void JumpToBooter(); void JumpToEntry(entry EntryPoint);
void writeStub(); void writeStub();
#endif #endif