13
#include <Helpers/Macro.h>
15
#include <CCINIClass.h>
16
#include <MixFileClass.h>
18
#include "Misc/Debug.h"
20
#include <AircraftTypeClass.h>
21
#include <CellClass.h>
22
#include <HouseClass.h>
23
#include <InfantryTypeClass.h>
24
#include <UnitTypeClass.h>
26
#define GFX_DX_HW 0x01l
27
#define GFX_DX_EM 0x02l
29
#define GFX_SU_VRAM 0x00l
30
#define GFX_SU_SYSTEM 0x01l
32
#define GFX_SU_NF3D 0x00l
33
#define GFX_SU_F3D 0x01l
39
static HANDLE hInstance;
44
static bool bTestingRun;
47
static FILE* pLogFile;
49
static int TrackIndex;
51
static DWORD readLength;
52
static char readBuffer[BUFLEN];
53
static const char readDelims[4];
54
static const char readDefval[4];
56
static MixFileClass *aresMIX;
57
static void InitOwnResources();
58
static void UninitOwnResources();
61
static void __stdcall CmdLineParse(char**,int);
63
static void __stdcall ExeRun();
64
static void __stdcall ExeTerminate();
66
static void __stdcall PostGameInit();
68
static void __stdcall RegisterCommands();
71
static void SendPDPlane(
73
CellClass* pDestination,
74
AircraftTypeClass* pPlaneType,
75
TypeList<TechnoTypeClass*>* pTypes,
76
TypeList<int>* pNums);
78
class GlobalControls {
82
static CCINIClass * INI;
84
static void OpenConfig();
85
static void CloseConfig();
86
static void LoadConfig();
88
static void Load(CCINIClass *pINI);
90
static bool Initialized;
91
static bool AllowParallelAIQueues;
93
static byte GFX_DX_Force;
95
static std::bitset<3> AllowBypassBuildLimit;
103
static SurfaceConfig GFX_S_Alternate;
104
static SurfaceConfig GFX_S_Composite;
105
static SurfaceConfig GFX_S_Hidden;
106
static SurfaceConfig GFX_S_Hidden_2;
107
static SurfaceConfig GFX_S_Primary;
108
static SurfaceConfig GFX_S_Sidebar;
109
static SurfaceConfig GFX_S_Tile;
112
static bool RunningOnWindows7OrVista();
117
typedef hash_map <DWORD, size_t> memmap;
118
static hash_map <DWORD, size_t> AllocMap;
121
static void Add(void * _addr, size_t amount) {
122
DWORD addr = (DWORD)_addr;
123
memmap::iterator i = AllocMap.find(addr);
124
if(i != AllocMap.end()) {
125
#ifdef MEMORY_LOGGING
126
Debug::Log("Reallocated a used block of 0x%X bytes @ 0x%X!\n", amount, addr);
129
AllocMap[addr] = amount;
133
static size_t Remove(void * _addr) {
134
DWORD addr = (DWORD)_addr;
135
memmap::iterator i = AllocMap.find(addr);
136
if(i == AllocMap.end()) {
137
#ifdef MEMORY_LOGGING
138
Debug::Log("Deallocated a dud block @ 0x%X!\n", addr);
142
size_t amount = AllocMap[addr];
144
AllocMap.erase(addr);