Skip to content

Commit

Permalink
- Fix memory issues when returning to menu by clearing some of the re…
Browse files Browse the repository at this point in the history
…compiler cache

- Remove unnecessary menu2 makefiles
  • Loading branch information
emukidid committed Nov 15, 2017
1 parent 4398ba5 commit 75e1bfb
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 140 deletions.
2 changes: 1 addition & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CC = powerpc-eabi-gcc
CXX = powerpc-eabi-g++
AS = powerpc-eabi-as

LTO = #-flto # Uncomment to use link-time optimization
LTO = -flto # Uncomment to use link-time optimization
DEBUG_FLAGS += #-DPROFILE #-DSHOW_DEBUG #-DDEBUGON #-DPRINTGECKO #-DGLN64_SDLOG #-DSHOW_STATS #-DNO_BT
FEATURES += #-DUSE_EXPANSION #-DUSE_TLB_CACHE #-DUSE_ROM_CACHE_L1 #-DEMBEDDED_FONTS

Expand Down
120 changes: 0 additions & 120 deletions Makefile.menu2

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile.menu2_gc

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile.menu2_wii

This file was deleted.

2 changes: 1 addition & 1 deletion Rice_GX/TextureManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CTextureManager gTextureManager;
#ifdef __GX__
//Note: Rice's tex mem usage isn't calculated correctly because it assumes 32bit textures.
//TODO: Revisit cache handling once Enhanced & Framebuffer textures are implemented.
DWORD g_maxTextureMemUsage = 2*GX_TEXTURE_CACHE_SIZE;
DWORD g_maxTextureMemUsage = GX_TEXTURE_CACHE_SIZE;
DWORD g_amountToFree = (512*1024);
bool g_bUseSetTextureMem = true;
#else //__GX__
Expand Down
2 changes: 2 additions & 0 deletions menu/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern "C" {
#include "../fileBrowser/fileBrowser-libfat.h"
#include "../fileBrowser/fileBrowser-CARD.h"
#include "../main/guifuncs.h"
#include "../r4300/Recomp-Cache.h"
}

void Func_LoadROM();
Expand Down Expand Up @@ -256,6 +257,7 @@ void Func_PlayGame()
new_frame();
new_vi();
go();
RecompCache_Release(4*1024*1024);
#ifdef DEBUGON
_break();
#endif
Expand Down
2 changes: 2 additions & 0 deletions menu/MiniMenuFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern "C" {
#include "../fileBrowser/fileBrowser.h"
#include "../fileBrowser/fileBrowser-libfat.h"
#include "../fileBrowser/fileBrowser-CARD.h"
#include "../r4300/Recomp-Cache.h"
}

void Func_MMResetROM();
Expand Down Expand Up @@ -511,6 +512,7 @@ void Func_MMPlayGame()
_break();
#endif
go();
RecompCache_Release(4*1024*1024);
#ifdef DEBUGON
_break();
#endif
Expand Down
4 changes: 4 additions & 0 deletions r4300/Recomp-Cache-Heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ static void release(int minNeeded){
}
}

void RecompCache_Release(int bytesRequired) {
release(bytesRequired);
}

void RecompCache_Alloc(unsigned int size, unsigned int address, PowerPC_func* func){
CacheMetaNode* newBlock = malloc( sizeof(CacheMetaNode) );
newBlock->addr = address;
Expand Down
2 changes: 2 additions & 0 deletions r4300/Recomp-Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#else
#define RECOMP_CACHE_SIZE (7*1024*1024)
#endif
#include "ppc/Recompile.h"

void RecompCache_Init(void);
// Allocate and free memory to be used for recompiled code
Expand All @@ -41,6 +42,7 @@ void RecompCache_Init(void);
void RecompCache_Alloc(unsigned int size, unsigned int address, PowerPC_func* func);
void RecompCache_Realloc(PowerPC_func* func, unsigned int new_size);
void RecompCache_Free(unsigned int addr);
void RecompCache_Release(int bytesRequired);
// Update the LRU info of the indicated block
// (call when the block is accessed)
void RecompCache_Update(PowerPC_func* func);
Expand Down

0 comments on commit 75e1bfb

Please # to comment.