-changed a few things about isfs and usb, also removed

the disable mem2 wrap
This commit is contained in:
fix94.1 2012-07-18 16:43:28 +00:00
parent 5640028b17
commit f45e70c7d3
5 changed files with 16 additions and 28 deletions

View File

@ -85,11 +85,11 @@ bool loadIOS(int ios, bool launch_game)
Close_Inputs(); Close_Inputs();
DeviceHandler::Instance()->UnMountAll(); DeviceHandler::Instance()->UnMountAll();
WDVD_Close(); WDVD_Close();
USBStorage2_Deinit(); USBStorage2_Deinit();
mload_close(); mload_close();
ISFS_Deinitialize();
bool iosOK = IOS_ReloadIOS(ios) == 0; bool iosOK = IOS_ReloadIOS(ios) == 0;
ISFS_Initialize(); ISFS_Initialize();

View File

@ -407,9 +407,6 @@ void RunApploader(u64 offset, u8 vidMode, bool vipatch, bool countryString, u8 p
{ {
WDVD_OpenPartition(offset); WDVD_OpenPartition(offset);
/* hide cios devices */
shadow_mload();
/* Setup low memory */ /* Setup low memory */
__Disc_SetLowMem(); __Disc_SetLowMem();

View File

@ -11,8 +11,6 @@
// Forbid the use of MEM2 through malloc // Forbid the use of MEM2 through malloc
u32 MALLOC_MEM2 = 0; u32 MALLOC_MEM2 = 0;
int wrapMEM2 = 1;
static CMEM2Alloc g_mem2gp; static CMEM2Alloc g_mem2gp;
extern "C" extern "C"
@ -96,15 +94,10 @@ unsigned int MEM2_freesize()
return g_mem2gp.FreeSize(); return g_mem2gp.FreeSize();
} }
void MEM2_wrap(int v)
{
wrapMEM2 = v;
}
void *__wrap_malloc(size_t size) void *__wrap_malloc(size_t size)
{ {
void *p; 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); p = g_mem2gp.allocate(size);
if(p != 0) if(p != 0)
@ -120,7 +113,7 @@ void *__wrap_malloc(size_t size)
void *__wrap_calloc(size_t n, size_t size) void *__wrap_calloc(size_t n, size_t size)
{ {
void *p; 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); p = g_mem2gp.allocate(n * size);
if (p != 0) 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 *__wrap_memalign(size_t a, size_t size)
{ {
void *p; 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); p = MEM2_memalign(a, size);
if (p != 0) if (p != 0)

View File

@ -21,7 +21,6 @@ void MEM2_init(unsigned int mem2Size);
void MEM2_cleanup(void); void MEM2_cleanup(void);
void MEM2_clear(void); void MEM2_clear(void);
void MEM2_free(void *p); void MEM2_free(void *p);
void MEM2_wrap(int v);
void *MEM2_alloc(unsigned int s); void *MEM2_alloc(unsigned int s);
void *MEM2_memalign(unsigned int a, unsigned int s); void *MEM2_memalign(unsigned int a, unsigned int s);
void *MEM2_realloc(void *p, unsigned int s); void *MEM2_realloc(void *p, unsigned int s);

View File

@ -869,8 +869,8 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
m_cfg.save(true); m_cfg.save(true);
cleanup(); cleanup();
#ifndef DOLPHIN #ifndef DOLPHIN
ISFS_Deinitialize();
USBStorage2_Deinit(); USBStorage2_Deinit();
USB_Deinitialize();
SDHC_Init(); SDHC_Init();
#endif #endif
GC_SetVideoMode(videoMode, videoSetting); GC_SetVideoMode(videoMode, videoSetting);
@ -901,17 +901,15 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
Playlog_Delete(); Playlog_Delete();
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
MEM2_wrap(0);
LoadHomebrew(filepath); LoadHomebrew(filepath);
AddBootArgument(filepath); AddBootArgument(filepath);
for(u32 i = 0; i < arguments.size(); ++i) for(u32 i = 0; i < arguments.size(); ++i)
AddBootArgument(arguments[i].c_str()); AddBootArgument(arguments[i].c_str());
#ifndef DOLPHIN #ifndef DOLPHIN
ISFS_Deinitialize();
USBStorage2_Deinit(); USBStorage2_Deinit();
USB_Deinitialize();
#endif #endif
//MEM2_clear();
BootHomebrew(title); 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())); _loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
ocarina_load_code(cheatFile.get(), cheatSize); ocarina_load_code(cheatFile.get(), cheatSize);
} }
#ifndef DOLPHIN
ISFS_Deinitialize();
#endif
if(forwarder) if(forwarder)
{ {
WII_Initialize(); WII_Initialize();
@ -1402,18 +1397,22 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
return; return;
} }
} }
#ifndef DOLPHIN
ISFS_Deinitialize();
USBStorage2_Deinit();
if(currentPartition == 0)
SDHC_Init();
#endif
/* Find game partition offset */ /* Find game partition offset */
u64 offset; u64 offset;
s32 ret = Disc_FindPartition(&offset); s32 ret = Disc_FindPartition(&offset);
if(ret < 0) if(ret < 0)
return; return;
#ifndef DOLPHIN
shadow_mload();
USBStorage2_Deinit();
USB_Deinitialize();
if(currentPartition == 0)
SDHC_Init();
#endif
RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo); RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo);
gprintf("Booting game\n"); gprintf("Booting game\n");
Disc_BootPartition(); Disc_BootPartition();