X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftypdefst.h;h=6aeed5248cbbfb0d5ac67e9b14f8e42d3cea5fa5;hb=a85b9bbe1d5e346f24b40fa12c68b9487d6b4a71;hp=76082c56a58fd26d009dff616d1c6bc3f0cfe49e;hpb=4c7ecb54bd2cb284aa34e72b80bf7c0de120026a;p=16.git diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 76082c56..6aeed524 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -100,10 +100,9 @@ typedef struct typedef struct { -// int showmemhandle; - int profilehandle,debughandle; + int profilehandle,debughandle,showmemhandle; int heaphandle; -} handle_t; +} loghandle_t; typedef struct { @@ -120,9 +119,13 @@ typedef struct word pn; } pan_t; +//video +#define NUMCHUNKS 3016 //keen + typedef struct { char old_mode; //old video mode before game! + byte grneeded[NUMCHUNKS]; page_t page[MAXPAGE]; //pointer to root page[0] word vmem_remain; //remaining video memory byte num_of_pages; //number of actual pages @@ -132,6 +135,12 @@ typedef struct //0000word startclk; float clk, tickclk; //timer } video_t; +//from 16_mm +//========================================================================== + +#define MAXBLOCKS 1024 +#define MAXUMBS 12 + typedef struct mmblockstruct { word start,length; @@ -143,15 +152,10 @@ typedef struct mmblockstruct struct mmblockstruct far *next; } mmblocktype; -//from 16_mm -//========================================================================== - -#define MAXBLOCKS 1024 -#define MAXUMBS 12 - typedef struct { dword nearheap,farheap,EMSmem,XMSmem,mainmem; +// boolean PMStarted, MainPresent, EMSPresent, XMSPresent; } mminfotype; typedef struct @@ -166,10 +170,9 @@ typedef struct #ifdef __WATCOMC__ void __near *nearheap; #endif - //byte EMS_status; - unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; - unsigned int EMSVer; + unsigned int EMSVer; word numUMBs,UMBbase[MAXUMBS]; + word totalEMSpages, freeEMSpages, EMSpagesmapped, EMSHandle, EMSPageFrame; //dword numUMBs,UMBbase[MAXUMBS]; //huge mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew; mmblocktype far mmblocks[MAXBLOCKS],far *mmhead,far *mmfree,far *mmrover,far *mmnew; @@ -177,15 +180,164 @@ typedef struct //========================================================================== + +//from 16_pm +//========================================================================== + +// NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024 +#define EMSPageSize 16384 +#define EMSPageSizeSeg (EMSPageSize >> 4) +#define EMSPageSizeKB (EMSPageSize >> 10) +#define EMSFrameCount 4 +#define PMPageSize 4096 +#define PMPageSizeSeg (PMPageSize >> 4) +#define PMPageSizeKB (PMPageSize >> 10) +#define PMEMSSubPage (EMSPageSize / PMPageSize) + +#define PMMinMainMem 10 // Min acceptable # of pages from main +#define PMMaxMainMem 100 // Max number of pages in main memory + +#define PMThrashThreshold 1 // Number of page thrashes before panic mode +#define PMUnThrashThreshold 5 // Number of non-thrashing frames before leaving panic mode + +typedef enum + { + pml_Unlocked, + pml_Locked + } PMLockType; + +typedef enum + { + pmba_Unused = 0, + pmba_Used = 1, + pmba_Allocated = 2 + } PMBlockAttr; + +typedef struct + { + dword offset; // Offset of chunk into file + word length; // Length of the chunk + + int xmsPage; // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle + + PMLockType locked; // If set, this page can't be purged + int emsPage; // If in EMS, logical page/offset into page + int mainPage; // If in Main, index into handle array + + dword lastHit; // Last frame number of hit + } PageListStruct; + +typedef struct + { + int baseEMSPage; // Base EMS page for this phys frame + dword lastHit; // Last frame number of hit + } EMSListStruct; + +// Main Mem specific variables +typedef struct +{ + boolean MainPresent; + memptr MainMemPages[PMMaxMainMem]; + PMBlockAttr MainMemUsed[PMMaxMainMem]; + int MainPagesAvail; +} pm_mmi_t; + +// EMS specific variables +typedef struct +{ + boolean EMSPresent; + unsigned int EMSVer; + word EMSAvail,EMSPagesAvail,EMSHandle, + EMSPageFrame,EMSPhysicalPage; + word totalEMSpages, freeEMSpages, EMSpagesmapped; + EMSListStruct EMSList[EMSFrameCount]; +} pm_emmi_t; + +// XMS specific variables +typedef struct +{ + boolean XMSPresent; + word XMSAvail,XMSPagesAvail,XMSHandle; + dword XMSDriver; //TODO: changed to word + int XMSProtectPage;// = -1; +} pm_xmmi_t; + +// File specific variables +typedef struct +{ + char PageFileName[13];// = {"VSWAP."}; + int PageFile;// = -1; + word ChunksInFile; + word PMSpriteStart,PMSoundStart; +} pm_fi_t; + +// General usage variables +typedef struct +{ + boolean PMStarted, + PMPanicMode, + PMThrashing; + word XMSPagesUsed, + EMSPagesUsed, + MainPagesUsed, + PMNumBlocks; + long PMFrameCount; + PageListStruct far *PMPages; + __SEGA *PMSegPages; + pm_mmi_t mm; + pm_emmi_t emm; + pm_xmmi_t xmm; + pm_fi_t fi; +} pm_t; + +//========================================================================== + +//from 16_ca +//========================================================================== + +#define NUMMAPS 4//39 +#define MAPPLANES 3 + +typedef struct +{ + word bit0,bit1; // 0-255 is a character, > is a pointer to a node +} huffnode; + +typedef struct +{ + int mapon, mapnum; + __SEGA *mapsegs[4]; + __SEGA *mapheaderseg[NUMMAPS]; + __SEGA *tinf; +} ca_mapinfo_t; + +typedef struct +{ + int maphandle[4]; // handle to MAPTEMP / GAMEMAPS +} ca_handle_t; + +typedef struct +{ + byte ca_levelbit,ca_levelnum; + ca_handle_t file; //files to open + ca_mapinfo_t camap; + //_seg *grsegs[NUMCHUNKS]; + //byte far grneeded[NUMCHUNKS]; + //huffnode huffnode; +} ca_t; + +//========================================================================== + //actual global game varables! typedef struct { - video_t video; // video settings variable + video_t video; // video settings variable + ca_t ca; // ca stuff + pm_t pm; // pm stuff byte *pee; // message for fps - handle_t handle; //handles for file logging + loghandle_t handle; //handles for file logging kurokku_t kurokku; //clock struct - mminfo_t mm; - mminfotype mmi; + mminfo_t mm; mminfotype mmi; } global_game_variables_t; #endif /* _TYPEDEFSTRUCT_H_ */