-changed homebrew loading yet again, not as safe as previous

way but maybe working better for bigger homebrew
This commit is contained in:
fix94.1 2012-07-10 00:18:37 +00:00
parent 5a2efc4e3b
commit cc7c5a9917
2 changed files with 7 additions and 11 deletions

View File

@ -24,8 +24,8 @@ extern const u32 stub_bin_size;
typedef void (*entrypoint) (void);
extern "C" { void __exception_closeall(); }
u8 *tmpbuffer = NULL;
u32 tmpbuffer_size = 0;
u32 buffer_size = 0;
static vector<string> Arguments;
static u32 stubtitlepositions[8] = { 0x80001bf2, 0x80001bf3, 0x80001c06, 0x80001c07,
@ -62,9 +62,9 @@ int LoadHomebrew(const char *filepath)
u32 filesize = ftell(file);
rewind(file);
tmpbuffer_size = filesize;
tmpbuffer = (u8*)MEM1_alloc(tmpbuffer_size);
fread(tmpbuffer, 1, tmpbuffer_size, file);
buffer_size = filesize;
fread(EXECUTE_ADDR, 1, buffer_size, file);
DCFlushRange(EXECUTE_ADDR, buffer_size);
fclose(file);
return 1;
@ -141,16 +141,12 @@ int BootHomebrew(u64 chan_title)
{
writeStub(chan_title);
struct __argv args;
if (!IsDollZ(tmpbuffer))
if (!IsDollZ(EXECUTE_ADDR))
SetupARGV(&args);
memcpy(BOOTER_ADDR, app_booter_bin, app_booter_bin_size);
DCFlushRange(BOOTER_ADDR, app_booter_bin_size);
memcpy(EXECUTE_ADDR, tmpbuffer, tmpbuffer_size);
DCFlushRange(EXECUTE_ADDR, tmpbuffer_size);
MEM1_free(tmpbuffer);
entrypoint entry = (entrypoint)BOOTER_ADDR;
memmove(ARGS_ADDR, &args, sizeof(args));

View File

@ -886,7 +886,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
ISFS_Deinitialize();
USBStorage_Deinit();
MEM2_clear();
//MEM2_clear();
BootHomebrew(title);
}