X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftypdefst.h;h=d6cc2b9a635d4de6a3b6b03bef390828b577a2be;hb=ad7c0e46f0b70f0e601b162411a3e95e788b45f1;hp=70012de8fbd730a9320a8f9de054cd86b7bd3c5e;hpb=60cc0187c31516a481c58b86d7e9e6e6740b40f5;p=16.git diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 70012de8..d6cc2b9a 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -120,7 +120,7 @@ typedef struct } pan_t; //video -#define NUMCHUNKS 3016 //keen +#define NUMCHUNKS 416 //keen typedef struct { @@ -135,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; @@ -146,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 @@ -169,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; @@ -180,33 +180,150 @@ 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;//,XMSVer; + dword XMSDriver; + 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; - __segment *mapsegs[4]; - __segment *mapheaderseg[NUMMAPS]; - __segment *tinf; -} mapinfo_t; + __SEGA *mapsegs[4]; + __SEGA *mapheaderseg[NUMMAPS]; + __SEGA *tinf; +} ca_mapinfo_t; typedef struct { int maphandle[4]; // handle to MAPTEMP / GAMEMAPS -} handle_t; +} ca_handle_t; typedef struct { byte ca_levelbit,ca_levelnum; - handle_t file; //files to open - mapinfo_t map; - //_seg *grsegs[NUMCHUNKS]; - //byte far grneeded[NUMCHUNKS]; - //huffnode huffnode; + ca_handle_t file; //files to open + ca_mapinfo_t camap; + __SEGA *grsegs[NUMCHUNKS]; + byte far grneeded[NUMCHUNKS]; + huffnode huffnode; } ca_t; //========================================================================== @@ -216,10 +333,12 @@ typedef struct { video_t video; // video settings variable ca_t ca; // ca stuff - byte *pee; // message for fps + pm_t pm; // pm stuff loghandle_t handle; //handles for file logging kurokku_t kurokku; //clock struct mminfo_t mm; mminfotype mmi; } global_game_variables_t; +extern char global_temp_status_text[512]; + #endif /* _TYPEDEFSTRUCT_H_ */