~ares-developers/ares/gd03

« back to all changes in this revision

Viewing changes to Ares.h

  • Committer: Renegade
  • Date: 2010-05-29 08:12:17 UTC
  • Revision ID: git-v1:0a1bb6321f04d723afe64d1b843dc87b4da783ec
Creating /trunk/src.

git-svn-id: svn://svn.renegadeprojects.com/ares/trunk@622 859b54a9-7a54-0410-aeb3-f8d2f1fa40fd

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef ARES_H
2
 
#define ARES_H
3
 
 
4
 
//ifndef str
5
 
#define str(x) str_(x)
6
 
#define str_(x) #x
7
 
//endif
8
 
 
9
 
#include <bitset>
10
 
 
11
 
#include <xcompile.h>
12
 
//include <YRPP.h>
13
 
#include <Helpers/Macro.h>
14
 
 
15
 
#include <CCINIClass.h>
16
 
#include <MixFileClass.h>
17
 
 
18
 
#include "Misc/Debug.h"
19
 
 
20
 
#include <AircraftTypeClass.h>
21
 
#include <CellClass.h>
22
 
#include <HouseClass.h>
23
 
#include <InfantryTypeClass.h>
24
 
#include <UnitTypeClass.h>
25
 
 
26
 
#define GFX_DX_HW 0x01l
27
 
#define GFX_DX_EM 0x02l
28
 
 
29
 
#define GFX_SU_VRAM 0x00l
30
 
#define GFX_SU_SYSTEM 0x01l
31
 
 
32
 
#define GFX_SU_NF3D 0x00l
33
 
#define GFX_SU_F3D 0x01l
34
 
 
35
 
class Ares
36
 
{
37
 
public:
38
 
        //Global Options
39
 
        static HANDLE   hInstance;
40
 
 
41
 
        static bool bNoLogo;
42
 
        static bool bNoCD;
43
 
 
44
 
        static bool bTestingRun;
45
 
 
46
 
        static bool bLog;
47
 
        static FILE* pLogFile;
48
 
 
49
 
        static int TrackIndex;
50
 
 
51
 
        static DWORD readLength;
52
 
        static char readBuffer[BUFLEN];
53
 
        static const char readDelims[4];
54
 
        static const char readDefval[4];
55
 
 
56
 
        static MixFileClass *aresMIX;
57
 
        static void InitOwnResources();
58
 
        static void UninitOwnResources();
59
 
 
60
 
        //Callbacks
61
 
        static void __stdcall CmdLineParse(char**,int);
62
 
 
63
 
        static void __stdcall ExeRun();
64
 
        static void __stdcall ExeTerminate();
65
 
 
66
 
        static void __stdcall PostGameInit();
67
 
 
68
 
        static void __stdcall RegisterCommands();
69
 
 
70
 
        //General functions
71
 
        static void SendPDPlane(
72
 
                HouseClass* pOwner,
73
 
                CellClass* pDestination,
74
 
                AircraftTypeClass* pPlaneType,
75
 
                TypeList<TechnoTypeClass*>* pTypes,
76
 
                TypeList<int>* pNums);
77
 
 
78
 
        class GlobalControls {
79
 
        private:
80
 
                GlobalControls() {};
81
 
        public:
82
 
                static CCINIClass * INI;
83
 
 
84
 
                static void OpenConfig();
85
 
                static void CloseConfig();
86
 
                static void LoadConfig();
87
 
 
88
 
                static void Load(CCINIClass *pINI);
89
 
 
90
 
                static bool Initialized;
91
 
                static bool AllowParallelAIQueues;
92
 
 
93
 
                static byte GFX_DX_Force;
94
 
 
95
 
                static std::bitset<3> AllowBypassBuildLimit;
96
 
 
97
 
                class SurfaceConfig {
98
 
                public:
99
 
                        byte Force3D;
100
 
                        byte Memory;
101
 
                };
102
 
 
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;
110
 
        };
111
 
 
112
 
        static bool RunningOnWindows7OrVista();
113
 
};
114
 
 
115
 
class MemMap {
116
 
public:
117
 
        typedef hash_map <DWORD, size_t> memmap;
118
 
        static hash_map <DWORD, size_t> AllocMap;
119
 
        static size_t Total;
120
 
 
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);
127
 
#endif
128
 
                }
129
 
                AllocMap[addr] = amount;
130
 
                Total += amount;
131
 
        }
132
 
 
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);
139
 
#endif
140
 
                        return 0;
141
 
                } else {
142
 
                        size_t amount = AllocMap[addr];
143
 
                        Total -= amount;
144
 
                        AllocMap.erase(addr);
145
 
                        return amount;
146
 
                }
147
 
        }
148
 
};
149
 
 
150
 
#endif