2024-07-01 17:52:11 +00:00
|
|
|
/**
|
|
|
|
* @file splice/splotheap.h
|
|
|
|
*/
|
|
|
|
#ifndef SPLICE_SPLOTHEAP_H
|
|
|
|
#define SPLICE_SPLOTHEAP_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2024-11-07 02:33:09 +00:00
|
|
|
typedef void (*PFNDELETE)(void *);
|
2024-11-04 06:04:33 +00:00
|
|
|
|
2024-11-07 02:33:09 +00:00
|
|
|
struct SPLOT
|
|
|
|
{
|
|
|
|
SPLOT *psplotNext;
|
2024-11-04 06:04:33 +00:00
|
|
|
int fAlive;
|
|
|
|
};
|
|
|
|
|
2024-11-07 02:33:09 +00:00
|
|
|
class CSplotheap
|
|
|
|
{
|
2024-11-04 06:04:33 +00:00
|
|
|
private:
|
|
|
|
int m_cb;
|
|
|
|
int m_c;
|
2024-11-07 02:33:09 +00:00
|
|
|
byte *m_ab;
|
|
|
|
SPLOT *m_psplotFree;
|
|
|
|
SPLOT *m_psplotAlloc;
|
|
|
|
SPLOT *m_psplotRecyclable;
|
2024-11-04 06:04:33 +00:00
|
|
|
PFNDELETE m_pfndelete;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void Startup(int cb, int c);
|
|
|
|
void Shutdown(void);
|
|
|
|
int PvAllocUnsafe(void);
|
2024-11-07 02:33:09 +00:00
|
|
|
void *PvAllocClear();
|
2024-11-04 06:04:33 +00:00
|
|
|
int PsplotLookup(int);
|
|
|
|
void UpdateRecyclable(void);
|
|
|
|
void UnmarkAll(void);
|
|
|
|
void FreeGarbage(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CSplotheap g_splotheapPair;
|
|
|
|
extern CSplotheap g_splotheapFrame;
|
|
|
|
extern CSplotheap g_splotheapUnk1;
|
|
|
|
extern CSplotheap g_splotheapProc;
|
|
|
|
extern CSplotheap g_splotheapMethod;
|
|
|
|
|
2024-11-07 02:33:09 +00:00
|
|
|
static void *PvFromPsplot(SPLOT *psplot);
|
|
|
|
static SPLOT *PsplotFromPv(void *pv);
|
|
|
|
static bool FIsPvGarbage(void *pv);
|
|
|
|
static void MarkPvAlive(void *pv);
|
2024-07-01 17:52:11 +00:00
|
|
|
|
2024-07-01 22:16:20 +00:00
|
|
|
#endif // SPLICE_SPLOTHEAP_H
|