1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
28 // Header file for Id Engine's Page Manager
\r
31 #include "src/lib/16_head.h"
\r
32 #include "src/lib/16_hc.h"
\r
33 #include "src/lib/16_mm.h"
\r
34 #include "src/lib/16_ca.h"
\r
37 //#define __PM__NOHOGEMS__
\r
38 /*// NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024
\r
39 #define EMSPageSize 16384
\r
40 #define EMSPageSizeSeg (EMSPageSize >> 4)
\r
41 #define EMSPageSizeKB (EMSPageSize >> 10)
\r
42 #define EMSFrameCount 4
\r
43 #define PMPageSize 4096
\r
44 #define PMPageSizeSeg (PMPageSize >> 4)
\r
45 #define PMPageSizeKB (PMPageSize >> 10)
\r
46 #define PMEMSSubPage (EMSPageSize / PMPageSize)
\r
48 #define PMMinMainMem 10 // Min acceptable # of pages from main
\r
49 #define PMMaxMainMem 100 // Max number of pages in main memory
\r
51 #define PMThrashThreshold 1 // Number of page thrashes before panic mode
\r
52 #define PMUnThrashThreshold 5 // Number of non-thrashing frames before leaving panic mode
\r
69 dword offset; // Offset of chunk into file
\r
70 word length; // Length of the chunk
\r
72 int xmsPage; // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle
\r
74 PMLockType locked; // If set, this page can't be purged
\r
75 int emsPage; // If in EMS, logical page/offset into page
\r
76 int mainPage; // If in Main, index into handle array
\r
78 dword lastHit; // Last frame number of hit
\r
83 int baseEMSPage; // Base EMS page for this phys frame
\r
84 dword lastHit; // Last frame number of hit
\r
87 extern boolean XMSPresent,EMSPresent;
\r
88 extern word XMSPagesAvail,EMSPagesAvail;
\r
90 extern word ChunksInFile,
\r
91 PMSpriteStart,PMSoundStart;
\r
92 extern PageListStruct far *PMPages;*///moved to src/lib/typdefst.h
\r
94 #define PM_GetSoundPage(v) PM_GetPage(gvar->pm.fi.PMSoundStart + (v), gvar)
\r
95 #define PM_GetSpritePage(v) PM_GetPage(gvar->pm.fi.PMSpriteStart + (v), gvar)
\r
97 #define PM_LockMainMem(gvar) PM_SetMainMemPurge(0, gvar)
\r
98 #define PM_UnlockMainMem(gvar) PM_SetMainMemPurge(3, gvar)
\r
101 extern char PageFileName[13];
\r
104 extern void PM_Startup(global_game_variables_t *gvar),
\r
105 PM_Shutdown(global_game_variables_t *gvar),
\r
106 PM_Reset(global_game_variables_t *gvar),
\r
107 PM_Preload(boolean (*update)(word current,word total), global_game_variables_t *gvar),
\r
108 PM_NextFrame(global_game_variables_t *gvar),
\r
109 PM_SetPageLock(int pagenum,PMLockType lock, global_game_variables_t *gvar),
\r
110 PM_SetMainPurge(int level),
\r
111 PM_CheckMainMem(global_game_variables_t *gvar);
\r
112 extern memptr PM_GetPageAddress(int pagenum, global_game_variables_t *gvar),
\r
113 PM_GetPage(int pagenum, global_game_variables_t *gvar); // Use this one to cache page
\r
115 void PM_SetMainMemPurge(int level, global_game_variables_t *gvar);
\r
116 void PML_StartupMainMem(global_game_variables_t *gvar);
\r