2020-03-27 21:47:29 +01:00
|
|
|
#ifndef SYSTEM_H
|
|
|
|
#define SYSTEM_H
|
|
|
|
|
2020-05-16 11:56:08 +02:00
|
|
|
extern char* _overlay_buffer; // 0x1C0000
|
|
|
|
extern char* _frontend_buffer; // 0xFB400
|
|
|
|
extern char* _other_buffer; // 0xF3000
|
2020-05-18 20:32:09 +02:00
|
|
|
extern char* _other_buffer2; // 0xE7000
|
2020-05-16 11:56:08 +02:00
|
|
|
|
|
|
|
extern OTTYPE* _OT1; // 0xF3000
|
|
|
|
extern OTTYPE* _OT2; // 0xF7200
|
|
|
|
|
|
|
|
extern char* _primTab1; // 0xFB400
|
|
|
|
extern char* _primTab2; // 0x119400
|
2020-05-18 20:32:09 +02:00
|
|
|
extern char* _replay_buffer; // 0x1FABBC
|
2020-03-27 21:47:29 +01:00
|
|
|
|
2020-10-24 18:35:51 +02:00
|
|
|
extern char gDataFolder[32];
|
|
|
|
|
2020-05-14 08:57:20 +02:00
|
|
|
extern const char* mallocptr_start;
|
|
|
|
|
2020-04-05 00:53:41 +02:00
|
|
|
extern char* mallocptr;
|
2020-05-16 11:56:08 +02:00
|
|
|
|
|
|
|
#ifdef USE_CRT_MALLOC
|
|
|
|
|
|
|
|
extern char* sys_malloc(int size, char* funcname, int line);
|
2020-10-27 16:37:08 +01:00
|
|
|
extern char* sys_tempalloc(int size);
|
|
|
|
extern void sys_tempfree();
|
|
|
|
|
2020-05-16 11:56:08 +02:00
|
|
|
extern void sys_freeall();
|
|
|
|
|
2020-10-27 16:37:08 +01:00
|
|
|
#define D_TEMPFREE() sys_tempfree()
|
|
|
|
#define D_TEMPALLOC(size) sys_tempalloc(size)
|
|
|
|
|
2020-05-16 11:56:08 +02:00
|
|
|
#ifdef _DEBUG
|
2020-10-27 16:37:08 +01:00
|
|
|
#define D_MALLOC(size) sys_malloc(size, __FUNCTION__, __LINE__)
|
|
|
|
|
2020-05-16 11:56:08 +02:00
|
|
|
#else
|
2020-10-27 16:37:08 +01:00
|
|
|
#define D_MALLOC(size) sys_malloc(size, NULL, 0)
|
2020-05-16 11:56:08 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
2020-10-27 16:37:08 +01:00
|
|
|
#define D_MALLOC(size) mallocptr; mallocptr += (size)
|
|
|
|
#define D_TEMPALLOC(size) mallocptr
|
|
|
|
#define D_TEMPFREE()
|
2020-05-16 11:56:08 +02:00
|
|
|
#endif
|
2020-05-14 08:57:20 +02:00
|
|
|
|
|
|
|
#define MALLOC_BEGIN() \
|
|
|
|
{ \
|
2020-09-30 17:42:04 +02:00
|
|
|
const char* _oldmalloc = mallocptr;
|
2020-05-14 08:57:20 +02:00
|
|
|
|
2020-09-30 17:42:04 +02:00
|
|
|
#ifdef __GNUC__
|
2020-05-14 08:57:20 +02:00
|
|
|
#define MALLOC_END() \
|
2020-10-27 16:37:08 +01:00
|
|
|
D_TEMPFREE();\
|
2020-09-30 17:42:04 +02:00
|
|
|
if(mallocptr > _oldmalloc)\
|
2020-10-08 04:42:37 +02:00
|
|
|
printWarning("malloc(%d) in %s, line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __FUNCTION__, __LINE__, (mallocptr-mallocptr_start));\
|
2020-09-30 17:42:04 +02:00
|
|
|
} // MALLOC_BEGIN block
|
|
|
|
#else
|
|
|
|
#define MALLOC_END() \
|
2020-10-27 16:37:08 +01:00
|
|
|
D_TEMPFREE();\
|
2020-09-30 17:42:04 +02:00
|
|
|
if(mallocptr > _oldmalloc)\
|
2020-10-08 04:42:37 +02:00
|
|
|
printWarning("malloc(%d) in " __FUNCTION__ ", line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __LINE__, (mallocptr-mallocptr_start));\
|
2020-09-30 17:42:04 +02:00
|
|
|
} // MALLOC_BEGIN block
|
|
|
|
#endif
|
2020-04-05 00:53:41 +02:00
|
|
|
|
|
|
|
extern int leadAIRequired;
|
|
|
|
extern int leadAILoaded;
|
|
|
|
extern int pathAILoaded;
|
|
|
|
|
2020-04-03 00:44:09 +02:00
|
|
|
extern char* LoadingScreenNames[];
|
|
|
|
|
2020-10-31 02:08:42 +01:00
|
|
|
struct DB
|
2020-03-31 19:09:22 +02:00
|
|
|
{
|
2020-10-31 02:08:42 +01:00
|
|
|
char* primptr;
|
|
|
|
OTTYPE* ot;
|
|
|
|
char* primtab;
|
|
|
|
int id;
|
|
|
|
DRAWENV draw;
|
|
|
|
DISPENV disp;
|
2020-09-26 17:02:13 +02:00
|
|
|
};
|
2020-03-31 19:09:22 +02:00
|
|
|
|
2020-03-28 21:29:37 +01:00
|
|
|
extern DRAW_MODE draw_mode_pal;
|
|
|
|
extern DRAW_MODE draw_mode_ntsc;
|
|
|
|
|
|
|
|
extern DB MPBuff[2][2];
|
|
|
|
extern DB* last;
|
|
|
|
extern DB* current;
|
|
|
|
|
2020-11-06 23:51:00 +01:00
|
|
|
#define OTSIZE 0x1800 /* ordering table size */
|
2020-03-29 01:56:49 +01:00
|
|
|
|
2020-08-26 20:01:55 +02:00
|
|
|
#ifdef USE_32_BIT_ADDR
|
2020-08-29 21:26:36 +02:00
|
|
|
# define PRIMTAB_SIZE 0x50000
|
2020-08-26 20:01:55 +02:00
|
|
|
#else
|
|
|
|
# define PRIMTAB_SIZE 0x1e000
|
|
|
|
#endif
|
|
|
|
|
2020-04-05 15:53:08 +02:00
|
|
|
#define CITYLUMP_DATA1 0
|
|
|
|
#define CITYLUMP_TPAGE 1
|
|
|
|
#define CITYLUMP_DATA2 2
|
|
|
|
#define CITYLUMP_SPOOL 3
|
|
|
|
|
|
|
|
extern int citystart[8];
|
|
|
|
extern XYPAIR citylumps[8][4];
|
|
|
|
|
2020-03-28 21:29:37 +01:00
|
|
|
#ifdef PAL
|
|
|
|
#define draw_mode draw_mode_pal
|
|
|
|
#define video_mode MODE_PAL
|
|
|
|
#else
|
|
|
|
#define draw_mode draw_mode_ntsc
|
|
|
|
#define video_mode MODE_NTSC
|
|
|
|
#endif // PAL
|
|
|
|
|
2020-04-05 15:53:08 +02:00
|
|
|
#define CDSECTOR_SIZE 2048
|
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
extern void ClearMem(char *mem, int size); // 0x0007F3E8
|
|
|
|
|
|
|
|
extern void setMem8(unsigned char *mem, unsigned char val, int size); // 0x0007F47C
|
|
|
|
|
|
|
|
extern void setMem16(unsigned short *mem, unsigned short val, int size); // 0x0007F524
|
|
|
|
|
|
|
|
extern void Init_FileSystem(); // 0x0007F848
|
|
|
|
|
|
|
|
extern void DoCDRetry(); // 0x0007F870
|
|
|
|
|
|
|
|
extern int Loadfile(char *name, char *addr); // 0x0007F354
|
|
|
|
|
|
|
|
extern int LoadfileSeg(char *name, char *addr, int offset, int loadsize); // 0x0007E9D0
|
|
|
|
|
|
|
|
extern void ReportMode(int on); // 0x0007F8B8
|
|
|
|
|
2020-04-05 15:53:08 +02:00
|
|
|
#ifdef PSX
|
2020-03-27 21:47:29 +01:00
|
|
|
extern void loadsectors(char *addr, int sector, int nsectors); // 0x0007F904
|
2020-04-05 15:53:08 +02:00
|
|
|
#else
|
|
|
|
extern void loadsectorsPC(char* filename, char *addr, int sector, int nsectors);
|
|
|
|
#endif // PSX
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
extern void EnableDisplay(); // 0x0007F984
|
|
|
|
|
|
|
|
extern void DisableDisplay(); // 0x0007F9F0
|
|
|
|
|
2020-09-26 20:20:22 +02:00
|
|
|
extern void ClearCurrentDrawBuffers();
|
|
|
|
|
2020-03-27 21:47:29 +01:00
|
|
|
extern void SwapDrawBuffers(); // 0x0007F6FC
|
|
|
|
|
|
|
|
extern void SwapDrawBuffers2(int player); // 0x0007ECF0
|
|
|
|
|
|
|
|
extern void UpdatePadData(); // 0x0007FA10
|
|
|
|
|
|
|
|
extern void SetupDrawBuffers(); // 0x0007EDDC
|
|
|
|
|
|
|
|
extern void SetupDrawBufferData(int num_players); // 0x0007EF0C
|
|
|
|
|
2020-10-31 01:11:58 +01:00
|
|
|
extern void InitaliseDrawEnv(DB *pBuff, int x, int y, int w, int h); // 0x0007F7C0
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
extern void ResetCityType(); // 0x0007F5B4
|
|
|
|
|
2020-10-31 01:11:58 +01:00
|
|
|
extern void SetCityType(CITYTYPE type); // 0x0007F118
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
extern int FileExists(char *filename); // 0x0007F5C8
|
|
|
|
|
2020-10-31 01:11:58 +01:00
|
|
|
extern CDTYPE DiscSwapped(char *filename); // 0x0007F640
|
2020-03-27 21:47:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|