forked from sdlpal/sdlpal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
palcfg.h
336 lines (296 loc) · 7.11 KB
/
palcfg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
//
// Copyright (c) 2009-2011, Wei Mingzhi <[email protected]>.
// Copyright (c) 2011-2020, SDLPAL development team.
// All rights reserved.
//
// This file is part of SDLPAL.
//
// SDLPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// palcfg.h: Configuration definition.
// @Author: Lou Yihua <[email protected]>, 2016.
//
#ifndef CONFIG_H
#define CONFIG_H
#include "common.h"
#include "palcommon.h"
#define PAL_MAX_SAMPLERATE 49716
#define PAL_MAX_VOLUME 100
typedef enum tagPALCFG_ITEM
{
PALCFG_ALL_MIN = 0,
PALCFG_BOOLEAN_MIN = PALCFG_ALL_MIN,
/* Booleans */
PALCFG_FULLSCREEN = PALCFG_BOOLEAN_MIN,
PALCFG_KEEPASPECTRATIO,
PALCFG_LAUNCHSETTING,
PALCFG_STEREO,
PALCFG_USESURROUNDOPL,
PALCFG_ENABLEKEYREPEAT,
PALCFG_USETOUCHOVERLAY,
PALCFG_ENABLEAVIPLAY,
PALCFG_ENABLEGLSL,
PALCFG_ENABLEHDR,
/* Booleans */
PALCFG_BOOLEAN_MAX,
PALCFG_INTEGER_MIN = PALCFG_BOOLEAN_MAX,
/* Integers */
PALCFG_SURROUNDOPLOFFSET = PALCFG_INTEGER_MIN,
PALCFG_LOGLEVEL,
PALCFG_AUDIODEVICE,
/* Integers */
PALCFG_INTEGER_MAX,
PALCFG_UNSIGNED_MIN = PALCFG_INTEGER_MAX,
/* Unsigneds */
PALCFG_AUDIOBUFFERSIZE = PALCFG_UNSIGNED_MIN,
PALCFG_OPLSAMPLERATE,
PALCFG_RESAMPLEQUALITY,
PALCFG_SAMPLERATE,
PALCFG_MUSICVOLUME,
PALCFG_SOUNDVOLUME,
PALCFG_WINDOWHEIGHT,
PALCFG_WINDOWWIDTH,
PALCFG_TEXTUREHEIGHT,
PALCFG_TEXTUREWIDTH,
/* Unsigneds */
PALCFG_UNSIGNED_MAX,
PALCFG_STRING_MIN = PALCFG_UNSIGNED_MAX,
/* Strings */
PALCFG_CD = PALCFG_STRING_MIN,
PALCFG_GAMEPATH,
PALCFG_SAVEPATH,
PALCFG_SHADERPATH,
PALCFG_MESSAGEFILE,
PALCFG_FONTFILE,
PALCFG_MUSIC,
PALCFG_OPL_CORE,
PALCFG_OPL_CHIP,
PALCFG_LOGFILE,
PALCFG_RIXEXTRAINIT,
PALCFG_MIDICLIENT,
PALCFG_SCALEQUALITY,
PALCFG_SHADER,
/* Strings */
PALCFG_STRING_MAX,
PALCFG_ALL_MAX = PALCFG_STRING_MAX
} PALCFG_ITEM;
typedef enum tagPALCFG_TYPE
{
PALCFG_STRING,
PALCFG_BOOLEAN,
PALCFG_INTEGER,
PALCFG_UNSIGNED,
} PALCFG_TYPE;
typedef union tagConfigValue
{
LPCSTR sValue;
DWORD uValue;
INT iValue;
BOOL bValue;
} ConfigValue;
typedef struct tagConfigItem
{
PALCFG_ITEM Item;
PALCFG_TYPE Type;
const char* Name;
int NameLength;
const ConfigValue DefaultValue;
const ConfigValue MinValue;
const ConfigValue MaxValue;
} ConfigItem;
typedef struct tagSCREENLAYOUT
{
PAL_POS EquipImageBox;
PAL_POS EquipRoleListBox;
PAL_POS EquipItemName;
PAL_POS EquipItemAmount;
PAL_POS EquipLabels[MAX_PLAYER_EQUIPMENTS];
PAL_POS EquipNames[MAX_PLAYER_EQUIPMENTS];
PAL_POS EquipStatusLabels[5];
PAL_POS EquipStatusValues[5];
PAL_POS RoleName;
PAL_POS RoleImage;
PAL_POS RoleExpLabel;
PAL_POS RoleLevelLabel;
PAL_POS RoleHPLabel;
PAL_POS RoleMPLabel;
PAL_POS RoleStatusLabels[5];
PAL_POS RoleCurrExp;
PAL_POS RoleNextExp;
PAL_POS RoleExpSlash;
PAL_POS RoleLevel;
PAL_POS RoleCurHP;
PAL_POS RoleMaxHP;
PAL_POS RoleHPSlash;
PAL_POS RoleCurMP;
PAL_POS RoleMaxMP;
PAL_POS RoleMPSlash;
PAL_POS RoleStatusValues[5];
PAL_POS RoleEquipImageBoxes[MAX_PLAYER_EQUIPMENTS];
PAL_POS RoleEquipNames[MAX_PLAYER_EQUIPMENTS];
PAL_POS RolePoisonNames[MAX_POISONS];
PAL_POS ExtraItemDescLines;
PAL_POS ExtraMagicDescLines;
} SCREENLAYOUT;
typedef struct tagCONFIGURATION
{
union {
SCREENLAYOUT ScreenLayout;
PAL_POS ScreenLayoutArray[sizeof(SCREENLAYOUT) / sizeof(PAL_POS)];
};
enum {
USE_8x8_FONT = 1,
DISABLE_SHADOW = 2,
} ScreenLayoutFlag[sizeof(SCREENLAYOUT) / sizeof(PAL_POS)];
/* Configurable options */
char *pszGamePath;
char *pszSavePath;
char *pszShaderPath;
char *pszMsgFile;
char *pszFontFile;
char *pszMIDIClient;
char *pszLogFile;
char *pszScaleQuality;
char *pszShader;
DWORD dwWordLength;
DWORD dwScreenWidth;
DWORD dwScreenHeight;
DWORD dwTextureWidth;
DWORD dwTextureHeight;
INT iAudioDevice;
INT iSurroundOPLOffset;
INT iAudioChannels;
INT iSampleRate;
INT iOPLSampleRate;
INT iResampleQuality;
INT iMusicVolume;
INT iSoundVolume;
LOGLEVEL iLogLevel;
MUSICTYPE eMusicType;
CDTYPE eCDType;
OPLCORE_TYPE eOPLCore;
OPLCHIP_TYPE eOPLChip;
WORD wAudioBufferSize;
BOOL fIsWIN95;
BOOL fUseSurroundOPL;
BOOL fKeepAspectRatio;
BOOL fFullScreen;
BOOL fEnableJoyStick;
BOOL fUseCustomScreenLayout;
BOOL fLaunchSetting;
BOOL fEnableKeyRepeat;
BOOL fUseTouchOverlay;
BOOL fEnableAviPlay;
BOOL fEnableGLSL;
BOOL fEnableHDR;
#if USE_RIX_EXTRA_INIT
uint32_t *pExtraFMRegs;
uint8_t *pExtraFMVals;
uint32_t dwExtraLength;
#endif
} CONFIGURATION, *LPCONFIGURATION;
PAL_C_LINKAGE_BEGIN
extern CONFIGURATION gConfig;
void
PAL_LoadConfig(
BOOL fFromFile
);
BOOL
PAL_SaveConfig(
void
);
void
PAL_FreeConfig(
void
);
const char *
PAL_ConfigName(
PALCFG_ITEM item
);
PALCFG_ITEM
PAL_ConfigIndex(
const char *name
);
PALCFG_TYPE
PAL_ConfigType(
PALCFG_ITEM item
);
BOOL
PAL_LimitConfig(
PALCFG_ITEM item,
ConfigValue * pValue
);
ConfigValue
PAL_GetConfigItem(
PALCFG_ITEM item,
BOOL default_value
);
void
PAL_SetConfigItem(
PALCFG_ITEM item,
const ConfigValue value
);
BOOL
PAL_GetConfigBoolean(
PALCFG_ITEM item,
BOOL default_value
);
long
PAL_GetConfigNumber(
PALCFG_ITEM item,
BOOL default_value
);
int
PAL_GetConfigInteger(
PALCFG_ITEM item,
BOOL default_value
);
unsigned int
PAL_GetConfigUnsigned(
PALCFG_ITEM item,
BOOL default_value
);
const char *
PAL_GetConfigString(
PALCFG_ITEM item,
BOOL default_value
);
BOOL
PAL_SetConfigBoolean(
PALCFG_ITEM item,
BOOL value
);
BOOL
PAL_SetConfigNumber(
PALCFG_ITEM item,
long value
);
BOOL
PAL_SetConfigInteger(
PALCFG_ITEM item,
int value
);
BOOL
PAL_SetConfigUnsigned(
PALCFG_ITEM item,
unsigned int value
);
BOOL
PAL_SetConfigString(
PALCFG_ITEM item,
const char *value
);
PAL_C_LINKAGE_END
#endif