2022-10-11 02:18:42 +00:00
|
|
|
#include "includes/mwcc_decomp.h"
|
2022-10-07 19:02:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
extern void CompilerGetPString(short index, unsigned char *str);
|
|
|
|
extern void CompilerGetCString(short index, char *str);
|
|
|
|
extern unsigned char *CTool_CtoPstr(char *input);
|
|
|
|
|
|
|
|
typedef struct _AllocatorBlock {
|
|
|
|
struct _AllocatorBlock *nextBlock;
|
|
|
|
char **handle;
|
|
|
|
long size;
|
|
|
|
long remaining;
|
|
|
|
} AllocatorBlock;
|
|
|
|
|
|
|
|
typedef struct _Allocator {
|
|
|
|
AllocatorBlock *blockList;
|
|
|
|
long paddingSize;
|
|
|
|
AllocatorBlock *lastBlockUsed;
|
|
|
|
void *ptrToFreeArea;
|
|
|
|
long remaining;
|
|
|
|
} Allocator;
|
|
|
|
|
|
|
|
typedef struct _HeapInfo {
|
|
|
|
long _0;
|
|
|
|
long _4;
|
|
|
|
long _8;
|
|
|
|
long xx_C;
|
|
|
|
long _10;
|
|
|
|
long _14;
|
|
|
|
long _18;
|
|
|
|
} HeapInfo;
|
|
|
|
|
|
|
|
typedef struct _StringNode {
|
|
|
|
struct _StringNode *next;
|
|
|
|
long index;
|
|
|
|
short hash;
|
|
|
|
char data[1];
|
|
|
|
} StringNode;
|
|
|
|
|
|
|
|
typedef struct _GList {
|
|
|
|
char **data;
|
|
|
|
long size;
|
|
|
|
long capacity;
|
|
|
|
long expansion;
|
|
|
|
} GList;
|
|
|
|
|
|
|
|
extern long hash_name_id;
|
|
|
|
extern StringNode **name_hash_nodes;
|
|
|
|
extern void (*GListErrorProc)();
|
|
|
|
|
|
|
|
// extern void GListError();
|
|
|
|
extern int InitGList(GList *list, long capacity);
|
|
|
|
extern void FreeGList(GList *list);
|
|
|
|
extern void LockGList(GList *list);
|
|
|
|
extern void UnlockGList(GList *list);
|
|
|
|
extern void ShrinkGList(GList *list);
|
|
|
|
extern void AppendGListData(GList *list, const void *data, long size);
|
|
|
|
extern void AppendGListNoData(GList *list, long size);
|
|
|
|
extern void AppendGListByte(GList *list, char v);
|
|
|
|
extern void AppendGListWord(GList *list, short v);
|
|
|
|
extern void AppendGListTargetEndianWord(GList *list, short v);
|
|
|
|
extern void AppendGListLong(GList *list, long v);
|
|
|
|
extern void AppendGListTargetEndianLong(GList *list, long v);
|
|
|
|
extern void AppendGListID(GList *list, const char *str);
|
|
|
|
extern void AppendGListName(GList *list, const char *str);
|
|
|
|
extern void RemoveGListData(GList *list, long size);
|
|
|
|
extern char GetGListByte(GList *list);
|
|
|
|
extern short GetGListWord(GList *list);
|
|
|
|
extern long GetGListLong(GList *list);
|
|
|
|
extern short GetGListID(GList *list, char *buf);
|
|
|
|
extern void GetGListData(GList *list, char *buf, long size);
|
|
|
|
// extern long hashpjw(const char *str);
|
|
|
|
// extern short PHash(const unsigned char *str);
|
|
|
|
extern short CHash(const char *str);
|
|
|
|
extern StringNode *GetHashNameNode(const char *str);
|
|
|
|
extern StringNode *GetHashNameNodeHash(const char *str, short hash);
|
|
|
|
extern StringNode *GetHashNameNodeHash2(const char *str, short hash);
|
|
|
|
extern StringNode *GetHashNameNodeExport(const char *str);
|
|
|
|
extern long GetHashNameNodeExportID(StringNode *node);
|
|
|
|
extern StringNode *GetHashNameNodeByID(long id);
|
|
|
|
extern void NameHashExportReset();
|
|
|
|
extern void NameHashWriteNameTable(GList *list);
|
|
|
|
extern void NameHashWriteTargetEndianNameTable(GList *list);
|
|
|
|
extern void InitNameHash();
|
|
|
|
|
|
|
|
typedef void (*heaperror_t)();
|
|
|
|
|
|
|
|
extern long CTool_TotalHeapSize();
|
|
|
|
// extern void getheapinfo(HeapInfo *result, Allocator *heap);
|
|
|
|
extern void CTool_GetHeapInfo(HeapInfo *result, unsigned char heapID);
|
|
|
|
// extern void MoreHeapSpace(Allocator *alloc, long size);
|
|
|
|
extern int initheaps(heaperror_t failureCallback);
|
|
|
|
extern int initgheap(heaperror_t failureCallback);
|
|
|
|
extern heaperror_t getheaperror();
|
|
|
|
extern void setheaperror(heaperror_t failureCallback);
|
|
|
|
// extern void relheap(Allocator *alloc);
|
|
|
|
extern void releaseheaps();
|
|
|
|
extern void releasegheap();
|
|
|
|
extern void releaseoheap();
|
|
|
|
extern char *galloc(long size);
|
|
|
|
extern char *lalloc(long size);
|
|
|
|
extern char *aalloc(long size);
|
|
|
|
extern char *oalloc(long size);
|
|
|
|
extern char *balloc(long size);
|
|
|
|
|
|
|
|
extern void locklheap();
|
|
|
|
extern void unlocklheap();
|
|
|
|
extern void freelheap();
|
|
|
|
extern void freeaheap();
|
|
|
|
extern void freeoheap();
|
|
|
|
extern void freebheap();
|
|
|
|
|
|
|
|
extern char *ScanHex(char *str, long *output, Boolean *overflow);
|
|
|
|
extern char *ScanOct(char *str, long *output, Boolean *overflow);
|
|
|
|
extern char *ScanDec(char *str, long *output, Boolean *overflow);
|
|
|
|
|
|
|
|
// extern char *UnmangleClassname(char *work, char **pNameStart, short *pNameLength, char **a4, short *a5, Boolean a6);
|
|
|
|
// extern char *UnmangleAppend(char *src, char srcLen, char **pOutput, short *pOutputLen);
|
|
|
|
extern void OldUnmangle(char *input, char *output, Boolean flag);
|
|
|
|
|
|
|
|
extern short hash(char *str);
|
|
|
|
extern void memclr(void *buffer, long size);
|
|
|
|
extern void memclrw(void *buffer, long size);
|
|
|
|
extern void CToLowercase(char *src, char *dst);
|
|
|
|
extern int getbit(long v);
|
|
|
|
typedef struct {
|
|
|
|
unsigned long a, b;
|
|
|
|
} WtfWord64; // this has to make sense, somehow... but how?
|
|
|
|
extern void CTool_EndianConvertWord64(WtfWord64 value, unsigned long long *p);
|
|
|
|
extern unsigned short CTool_EndianConvertInPlaceWord16Ptr(unsigned short *p);
|
|
|
|
extern unsigned long CTool_EndianConvertInPlaceWord32Ptr(unsigned long *p);
|
|
|
|
extern void CTool_EndianConvertVector128(); // not correct but idc
|
|
|
|
extern StringNode *CTool_GetPathName(const FSSpec *spec, long *mdDat);
|
|
|
|
extern Boolean strcat_safe(char *dst, const char *src, int maxLen);
|