From cc7c5a9917f170416aa2f2cd9227dca187de8b70 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Tue, 10 Jul 2012 00:18:37 +0000 Subject: [PATCH] -changed homebrew loading yet again, not as safe as previous way but maybe working better for bigger homebrew --- source/homebrew/homebrew.cpp | 16 ++++++---------- source/menu/menu_game.cpp | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index ef856d16..86ddf945 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -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 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)); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index befaa495..1ea69153 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -886,7 +886,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) ISFS_Deinitialize(); USBStorage_Deinit(); - MEM2_clear(); + //MEM2_clear(); BootHomebrew(title); }