3 // Header file for Id Engine's Page Manager
\r
6 // NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024
\r
7 #define EMSPageSize 16384
\r
8 #define EMSPageSizeSeg (EMSPageSize >> 4)
\r
9 #define EMSPageSizeKB (EMSPageSize >> 10)
\r
10 #define EMSFrameCount 4
\r
11 #define PMPageSize 4096
\r
12 #define PMPageSizeSeg (PMPageSize >> 4)
\r
13 #define PMPageSizeKB (PMPageSize >> 10)
\r
14 #define PMEMSSubPage (EMSPageSize / PMPageSize)
\r
16 #define PMMinMainMem 10 // Min acceptable # of pages from main
\r
17 #define PMMaxMainMem 100 // Max number of pages in main memory
\r
19 #define PMThrashThreshold 1 // Number of page thrashes before panic mode
\r
20 #define PMUnThrashThreshold 5 // Number of non-thrashing frames before leaving panic mode
\r
37 longword offset; // Offset of chunk into file
\r
38 word length; // Length of the chunk
\r
40 int xmsPage; // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle
\r
42 PMLockType locked; // If set, this page can't be purged
\r
43 int emsPage; // If in EMS, logical page/offset into page
\r
44 int mainPage; // If in Main, index into handle array
\r
46 longword lastHit; // Last frame number of hit
\r
51 int baseEMSPage; // Base EMS page for this phys frame
\r
52 longword lastHit; // Last frame number of hit
\r
55 extern boolean XMSPresent,EMSPresent;
\r
56 extern word XMSPagesAvail,EMSPagesAvail;
\r
58 extern word ChunksInFile,
\r
59 PMSpriteStart,PMSoundStart;
\r
60 extern PageListStruct far *PMPages;
\r
62 #define PM_GetSoundPage(v) PM_GetPage(PMSoundStart + (v))
\r
63 #define PM_GetSpritePage(v) PM_GetPage(PMSpriteStart + (v))
\r
65 #define PM_LockMainMem() PM_SetMainMemPurge(0)
\r
66 #define PM_UnlockMainMem() PM_SetMainMemPurge(3)
\r
69 extern char PageFileName[13];
\r
72 extern void PM_Startup(void),
\r
75 PM_Preload(boolean (*update)(word current,word total)),
\r
77 PM_SetPageLock(int pagenum,PMLockType lock),
\r
78 PM_SetMainPurge(int level),
\r
79 PM_CheckMainMem(void);
\r
80 extern memptr PM_GetPageAddress(int pagenum),
\r
81 PM_GetPage(int pagenum); // Use this one to cache page
\r
83 void PM_SetMainMemPurge(int level);
\r