From f45e70c7d3d8a5a34aa14d76a1e79cc013f66163 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Wed, 18 Jul 2012 16:43:28 +0000 Subject: [PATCH] -changed a few things about isfs and usb, also removed the disable mem2 wrap --- source/loader/alt_ios.cpp | 2 +- source/loader/disc.c | 3 --- source/memory/mem2.cpp | 13 +++---------- source/memory/mem2.hpp | 1 - source/menu/menu_game.cpp | 25 ++++++++++++------------- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/source/loader/alt_ios.cpp b/source/loader/alt_ios.cpp index 6120302b..50c50a04 100644 --- a/source/loader/alt_ios.cpp +++ b/source/loader/alt_ios.cpp @@ -85,11 +85,11 @@ bool loadIOS(int ios, bool launch_game) Close_Inputs(); DeviceHandler::Instance()->UnMountAll(); - WDVD_Close(); USBStorage2_Deinit(); mload_close(); + ISFS_Deinitialize(); bool iosOK = IOS_ReloadIOS(ios) == 0; ISFS_Initialize(); diff --git a/source/loader/disc.c b/source/loader/disc.c index 49a4d739..b90762c1 100644 --- a/source/loader/disc.c +++ b/source/loader/disc.c @@ -407,9 +407,6 @@ void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 p { WDVD_OpenPartition(offset); - /* hide cios devices */ - shadow_mload(); - /* Setup low memory */ __Disc_SetLowMem(); diff --git a/source/memory/mem2.cpp b/source/memory/mem2.cpp index d8ba0a36..f73f6c9d 100644 --- a/source/memory/mem2.cpp +++ b/source/memory/mem2.cpp @@ -11,8 +11,6 @@ // Forbid the use of MEM2 through malloc u32 MALLOC_MEM2 = 0; -int wrapMEM2 = 1; - static CMEM2Alloc g_mem2gp; extern "C" @@ -96,15 +94,10 @@ unsigned int MEM2_freesize() return g_mem2gp.FreeSize(); } -void MEM2_wrap(int v) -{ - wrapMEM2 = v; -} - void *__wrap_malloc(size_t size) { void *p; - if(wrapMEM2 && (SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || size >= MEM2_PRIORITY_SIZE)) + if(SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || size >= MEM2_PRIORITY_SIZE) { p = g_mem2gp.allocate(size); if(p != 0) @@ -120,7 +113,7 @@ void *__wrap_malloc(size_t size) void *__wrap_calloc(size_t n, size_t size) { void *p; - if(wrapMEM2 && (SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || (n * size) >= MEM2_PRIORITY_SIZE)) + if(SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || (n * size) >= MEM2_PRIORITY_SIZE) { p = g_mem2gp.allocate(n * size); if (p != 0) @@ -143,7 +136,7 @@ void *__wrap_calloc(size_t n, size_t size) void *__wrap_memalign(size_t a, size_t size) { void *p; - if(wrapMEM2 && (SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || size >= MEM2_PRIORITY_SIZE)) + if(SYS_GetArena1Lo() >= MAX_MEM1_ARENA_LO || size >= MEM2_PRIORITY_SIZE) { p = MEM2_memalign(a, size); if (p != 0) diff --git a/source/memory/mem2.hpp b/source/memory/mem2.hpp index f2f13095..18cec0e6 100644 --- a/source/memory/mem2.hpp +++ b/source/memory/mem2.hpp @@ -21,7 +21,6 @@ void MEM2_init(unsigned int mem2Size); void MEM2_cleanup(void); void MEM2_clear(void); void MEM2_free(void *p); -void MEM2_wrap(int v); void *MEM2_alloc(unsigned int s); void *MEM2_memalign(unsigned int a, unsigned int s); void *MEM2_realloc(void *p, unsigned int s); diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index b53ceed7..4e723ed4 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -869,8 +869,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) m_cfg.save(true); cleanup(); #ifndef DOLPHIN - ISFS_Deinitialize(); USBStorage2_Deinit(); + USB_Deinitialize(); SDHC_Init(); #endif GC_SetVideoMode(videoMode, videoSetting); @@ -901,17 +901,15 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) Playlog_Delete(); cleanup(); // wifi and sd gecko doesnt work anymore after cleanup - MEM2_wrap(0); LoadHomebrew(filepath); AddBootArgument(filepath); for(u32 i = 0; i < arguments.size(); ++i) AddBootArgument(arguments[i].c_str()); #ifndef DOLPHIN - ISFS_Deinitialize(); USBStorage2_Deinit(); + USB_Deinitialize(); #endif - //MEM2_clear(); BootHomebrew(title); } @@ -1121,9 +1119,6 @@ void CMenu::_launchChannel(dir_discHdr *hdr) _loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str())); ocarina_load_code(cheatFile.get(), cheatSize); } -#ifndef DOLPHIN - ISFS_Deinitialize(); -#endif if(forwarder) { WII_Initialize(); @@ -1402,18 +1397,22 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) return; } } -#ifndef DOLPHIN - ISFS_Deinitialize(); - USBStorage2_Deinit(); - if(currentPartition == 0) - SDHC_Init(); -#endif /* Find game partition offset */ u64 offset; s32 ret = Disc_FindPartition(&offset); if(ret < 0) return; +#ifndef DOLPHIN + shadow_mload(); + + USBStorage2_Deinit(); + USB_Deinitialize(); + + if(currentPartition == 0) + SDHC_Init(); +#endif + RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo); gprintf("Booting game\n"); Disc_BootPartition();