mirror of https://github.com/PCSX2/pcsx2.git
Likely fix for 30mb memleaks when loading states and resetting the emu.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3181 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
f775d20cbc
commit
403c9d3f2f
|
@ -30,11 +30,12 @@ static bool hwInitialized = false;
|
|||
|
||||
void hwInit()
|
||||
{
|
||||
// [TODO] / FIXME: PCSX2 no longer works on an Init system. It assumes that the
|
||||
// static global vars for the process will be initialized when the process is created, and
|
||||
// then issues *resets only* from then on. All PCSX2
|
||||
if( hwInitialized ) return;
|
||||
|
||||
VifUnpackSSE_Init();
|
||||
vif0Init();
|
||||
vif1Init();
|
||||
|
||||
gsInit();
|
||||
sifInit();
|
||||
|
|
|
@ -25,9 +25,6 @@ vifStruct vif0;
|
|||
vifStruct vif1;
|
||||
tGSTransferStatus GSTransferStatus((STOPPED_MODE<<4) | (STOPPED_MODE<<2) | STOPPED_MODE);
|
||||
|
||||
void vif0Init() { initNewVif(0); }
|
||||
void vif1Init() { initNewVif(1); }
|
||||
|
||||
void vif0Reset()
|
||||
{
|
||||
/* Reset the whole VIF, meaning the internal pcsx2 vars and all the registers */
|
||||
|
|
|
@ -82,13 +82,11 @@ extern vifStruct* vif;
|
|||
extern vifStruct vif0, vif1;
|
||||
extern u8 schedulepath3msk;
|
||||
|
||||
extern void vif0Init();
|
||||
extern void vif0Interrupt();
|
||||
extern void vif0Write32(u32 mem, u32 value);
|
||||
extern void vif0Reset();
|
||||
|
||||
extern void vif1Interrupt();
|
||||
extern void vif1Init();
|
||||
extern void Vif1MskPath3();
|
||||
extern void vif1Write32(u32 mem, u32 value);
|
||||
extern void vif1Reset();
|
||||
|
|
|
@ -52,7 +52,6 @@ struct VIFUnpackFuncTable
|
|||
extern const __aligned16 VIFUnpackFuncTable VIFfuncTable[32];
|
||||
|
||||
extern int nVifUnpack (int idx, u8 *data);
|
||||
extern void initNewVif (int idx);
|
||||
extern void resetNewVif(int idx);
|
||||
|
||||
extern __forceinline void vif0UnpackSetup(u32 *data);
|
||||
|
|
|
@ -36,7 +36,6 @@ typedef void (__fastcall *nVifrecCall)(uptr dest, uptr src);
|
|||
extern void mVUmergeRegs(int dest, int src, int xyzw, bool modXYZW = 0);
|
||||
extern void _nVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
||||
extern void dVifUnpack (int idx, u8 *data, u32 size, bool isFill);
|
||||
extern void dVifInit (int idx);
|
||||
extern void dVifReset (int idx);
|
||||
extern void dVifClose (int idx);
|
||||
extern void VifUnpackSSE_Init();
|
||||
|
@ -94,6 +93,15 @@ struct nVifStruct {
|
|||
BlockBuffer* vifCache; // Block Buffer
|
||||
HashBucket<_tParams>* vifBlocks; // Vif Blocks
|
||||
int numBlocks; // # of Blocks Recompiled
|
||||
|
||||
nVifStruct()
|
||||
{
|
||||
vifCache = NULL;
|
||||
vifBlocks = NULL;
|
||||
numBlocks = 0;
|
||||
recPtr = NULL;
|
||||
recEnd = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
extern __aligned16 nVifStruct nVif[2];
|
||||
|
|
|
@ -21,21 +21,8 @@
|
|||
#include "newVif_UnpackSSE.h"
|
||||
|
||||
static __aligned16 nVifBlock _vBlock = {0};
|
||||
static bool dVifIsInitialized[2] = { false, false };
|
||||
|
||||
void dVifInit(int idx) {
|
||||
nVif[idx].vifCache = NULL;
|
||||
nVif[idx].vifBlocks = NULL;
|
||||
nVif[idx].numBlocks = 0;
|
||||
nVif[idx].recPtr = NULL;
|
||||
nVif[idx].recEnd = NULL;
|
||||
|
||||
dVifIsInitialized[idx] = true;
|
||||
}
|
||||
|
||||
void dVifReset(int idx) {
|
||||
if( !dVifIsInitialized[idx] ) return;
|
||||
|
||||
// If the VIF cache is greater than 12mb, then it's due for a complete reset back
|
||||
// down to a reasonable starting point of 4mb.
|
||||
if( nVif[idx].vifCache && (nVif[idx].vifCache->getAllocSize() > _1mb*12) )
|
||||
|
|
|
@ -87,11 +87,6 @@ void resetNewVif(int idx)
|
|||
if (newVifDynaRec) dVifReset(idx);
|
||||
}
|
||||
|
||||
void initNewVif(int idx) {
|
||||
resetNewVif(idx);
|
||||
if (newVifDynaRec) dVifInit(idx);
|
||||
}
|
||||
|
||||
void closeNewVif(int idx) {
|
||||
if (newVifDynaRec) dVifClose(idx);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue