1 /*****************************************************************************
2 ** $Source: /cygdrive/d/Private/_SVNROOT/bluemsx/blueMSX/Src/Emulator/Properties.h,v $
3 **
4 ** $Revision: 1.80 $
5 **
6 ** $Date: 2009-07-07 02:38:25 $
7 **
8 ** More info: http://www.bluemsx.com
9 **
10 ** Copyright (C) 2003-2006 Daniel Vik
11 **
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License as published by
14 ** the Free Software Foundation; either version 2 of the License, or
15 ** (at your option) any later version.
16 **
17 ** This program is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ** GNU General Public License for more details.
21 **
22 ** You should have received a copy of the GNU General Public License
23 ** along with this program; if not, write to the Free Software
24 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 **
26 ******************************************************************************
27 */
28 #ifndef PROPERTIES_H
29 #define PROPERTIES_H
30 
31 #include "AudioMixer.h"
32 #include "VideoRender.h"
33 #include "MediaDb.h"
34 
35 #define PROP_MAX_DISKS  34
36 #define PROP_MAX_CARTS  2
37 #define PROP_MAX_TAPES  1
38 
39 #define PROP_MAXPATH 512
40 
41 #define CARTNAME_SNATCHER    "The Snatcher Cartridge"
42 #define CARTNAME_SDSNATCHER  "SD-Snatcher Cartridge"
43 #define CARTNAME_SCCMIRRORED "SCC Mirrored Cartridge"
44 #define CARTNAME_SCCEXPANDED "SCC Expanded Cartridge"
45 #define CARTNAME_SCC         "SCC Cartridge"
46 #define CARTNAME_SCCPLUS     "SCC-I Cartridge"
47 #define CARTNAME_FMPAC       "FM-PAC Cartridge"
48 #define CARTNAME_PAC         "PAC Cartridge"
49 #define CARTNAME_SONYHBI55   "Sony HBI-55"
50 #define CARTNAME_EXTRAM16KB  "16kB External RAM"
51 #define CARTNAME_EXTRAM32KB  "32kB External RAM"
52 #define CARTNAME_EXTRAM48KB  "48kB External RAM"
53 #define CARTNAME_EXTRAM64KB  "64kB External RAM"
54 #define CARTNAME_EXTRAM512KB "512kB External RAM"
55 #define CARTNAME_EXTRAM1MB   "1MB External RAM"
56 #define CARTNAME_EXTRAM2MB   "2MB External RAM"
57 #define CARTNAME_EXTRAM4MB   "4MB External RAM"
58 #define CARTNAME_MEGARAM128  "128kB MegaRAM"
59 #define CARTNAME_MEGARAM256  "256kB MegaRAM"
60 #define CARTNAME_MEGARAM512  "512kB MegaRAM"
61 #define CARTNAME_MEGARAM768  "768kB MegaRAM"
62 #define CARTNAME_MEGARAM2M   "2MB MegaRAM"
63 #define CARTNAME_GAMEREADER  "Game Reader"
64 #define CARTNAME_SUNRISEIDE  "Sunrise IDE"
65 #define CARTNAME_BEERIDE     "Beer IDE"
66 #define CARTNAME_GIDE        "GIDE"
67 #define CARTNAME_GOUDASCSI   "Gouda SCSI"
68 #define CARTNAME_NMS1210     "NMS1210"
69 #define CARTNAME_JOYREXPSG   "Joyrex PSG"
70 #define CARTNAME_MEGASCSI128 "128kB MEGA-SCSI"
71 #define CARTNAME_MEGASCSI256 "256kB MEGA-SCSI"
72 #define CARTNAME_MEGASCSI512 "512kB MEGA-SCSI"
73 #define CARTNAME_MEGASCSI1MB "1MB MEGA-SCSI"
74 #define CARTNAME_ESERAM128   "128kB Ese-RAM"
75 #define CARTNAME_ESERAM256   "256kB Ese-RAM"
76 #define CARTNAME_ESERAM512   "512kB Ese-RAM"
77 #define CARTNAME_ESERAM1MB   "1MB Ese-RAM"
78 #define CARTNAME_NOWINDDOS1  "Nowind MSXDOS1"
79 #define CARTNAME_NOWINDDOS2  "Nowind MSXDOS2"
80 #define CARTNAME_MEGAFLSHSCC "MegaFlashRomScc"
81 #define CARTNAME_MEGAFLSHSCCPLUS "MegaFlashRomSccPlus"
82 #define CARTNAME_WAVESCSI128 "128kB WAVE-SCSI"
83 #define CARTNAME_WAVESCSI256 "256kB WAVE-SCSI"
84 #define CARTNAME_WAVESCSI512 "512kB WAVE-SCSI"
85 #define CARTNAME_WAVESCSI1MB "1MB WAVE-SCSI"
86 #define CARTNAME_ESESCC128   "128kB Ese-SCC"
87 #define CARTNAME_ESESCC256   "256kB Ese-SCC"
88 #define CARTNAME_ESESCC512   "512kB Ese-SCC"
89 
90 typedef enum {
91     PROP_EMULATION = 0,
92     PROP_VIDEO,
93     PROP_SOUND,
94     PROP_PERFORMANCE,
95     PROP_SETTINGS,
96     PROP_DISK,
97     PROP_APEARANCE,
98     PROP_PORTS,
99 	PROP_D3D
100 } PropPage;
101 
102 typedef enum {
103     P_KBD_EUROPEAN = 0,
104     P_KBD_RUSSIAN,
105     P_KBD_JAPANESE,
106     P_KBD_KOREAN
107 } PropKeyboardLanguage;
108 
109 enum {
110     P_LPT_NONE = 0,
111     P_LPT_SIMPL,
112     P_LPT_FILE,
113     P_LPT_HOST
114 };
115 
116 enum {
117     P_COM_NONE = 0,
118     P_COM_FILE,
119     P_COM_HOST
120 };
121 
122 enum {
123     P_MIDI_NONE = 0,
124     P_MIDI_FILE,
125     P_MIDI_HOST
126 };
127 
128 enum {
129     P_LPT_RAW,
130     P_LPT_MSXPRN,
131     P_LPT_SVIPRN,
132     P_LPT_EPSONFX80
133 };
134 
135 enum {
136     P_EMU_SYNCIGNORE = -1,
137     P_EMU_SYNCNONE = 0,
138     P_EMU_SYNCAUTO,
139     P_EMU_SYNCFRAMES,
140     P_EMU_SYNCTOVBLANK,
141     P_EMU_SYNCTOVBLANKASYNC,
142 };
143 
144 enum {
145     P_VDP_SYNCAUTO = 0,
146     P_VDP_SYNC50HZ,
147     P_VDP_SYNC60HZ
148 };
149 
150 enum {
151     P_VIDEO_COLOR = 0,
152     P_VIDEO_BW,
153     P_VIDEO_GREEN,
154     P_VIDEO_AMBER,
155     P_VIDEO_MONCOUNT
156 };
157 
158 enum {
159     P_VIDEO_PALNONE = 0,
160     P_VIDEO_PALMON,
161     P_VIDEO_PALYC,
162     P_VIDEO_PALNYC,
163     P_VIDEO_PALCOMP,
164     P_VIDEO_PALNCOMP,
165     P_VIDEO_PALSCALE2X,
166     P_VIDEO_PALHQ2X,
167     P_VIDEO_PALCOUNT
168 };
169 
170 enum {
171     P_VIDEO_SIZEX1 = 0,
172     P_VIDEO_SIZEX2,
173     P_VIDEO_SIZEFULLSCREEN
174 };
175 
176 enum {
177     P_VIDEO_FREQ_AUTO,
178     P_VIDEO_FREQ_50HZ,
179     P_VIDEO_FREQ_60HZ
180 };
181 
182 enum {
183     P_SOUND_DRVNONE = 0,
184     P_SOUND_DRVWMM,
185     P_SOUND_DRVDIRECTX
186 };
187 
188 enum {
189     P_VIDEO_DRVDIRECTX_VIDEO = 0,
190     P_VIDEO_DRVDIRECTX,
191     P_VIDEO_DRVGDI,
192     P_VIDEO_DRVDIRECTX_D3D
193 };
194 
195 enum {
196     P_VIDEO_DRVSDLGL = 0,
197     P_VIDEO_DRVSDLGL_NODIRT,
198     P_VIDEO_DRVSDL
199 };
200 
201 enum {
202     P_CDROM_DRVNONE = 0,
203     P_CDROM_DRVIOCTL,
204     P_CDROM_DRVASPI
205 };
206 
207 #define MAX_HISTORY 30
208 
209 typedef struct {
210     char statsDefDir[PROP_MAXPATH];
211     char machineName[PROP_MAXPATH];
212     char shortcutProfile[PROP_MAXPATH];
213     int  enableFdcTiming;
214     int  noSpriteLimits;
215     int  frontSwitch;
216     int  audioSwitch;
217     int  pauseSwitch;
218     int  speed;
219     int  ejectMediaOnExit;
220     int  registerFileTypes;
221     int  disableWinKeys;
222     int  priorityBoost;
223     int  syncMethod;
224     int  syncMethodGdi;
225     int  syncMethodD3D;
226     int  syncMethodDirectX;
227     int  vdpSyncMode;
228     int  reverseEnable;
229     int  reverseMaxTime;
230 } EmulationProperties;
231 
232 typedef struct {
233 		int linearFiltering;
234 		int extendBorderColor;
235 		int forceHighRes;
236 
237 		int aspectRatioType;
238 		int cropType;
239 
240 		int cropLeft;
241 		int cropRight;
242 		int cropTop;
243 		int cropBottom;
244 } D3DProperties;
245 
246 typedef struct {
247     int monitorColor;
248     int monitorType;
249     int windowSize;
250     int windowSizeInitial;
251     int windowSizeChanged;
252     int windowX;
253     int windowY;
254     int driver;
255     int frameSkip;
256     struct {
257         int width;
258         int height;
259         int bitDepth;
260     } fullscreen;
261     int maximizeIsFullscreen;
262     int frequency;
263     int deInterlace;
264     int blendFrames;
265     int horizontalStretch;
266     int verticalStretch;
267     int contrast;
268     int brightness;
269     int saturation;
270     int scanlinesEnable;
271     int scanlinesPct;
272     int colorSaturationEnable;
273     int colorSaturationWidth;
274     int gamma;
275     int detectActiveMonitor;
276     int captureFps;
277     int captureSize;
278 	D3DProperties d3d;
279 } VideoProperties;
280 
281 enum {
282 	P_D3D_AR_AUTO = 0,
283 	P_D3D_AR_STRETCH,
284 	P_D3D_AR_PAL,
285 	P_D3D_AR_NTSC,
286 	P_D3D_AR_1
287 };
288 
289 enum {
290 	P_D3D_RES_AUTO = 0,
291 	P_D3D_RES_256,
292 	P_D3D_RES_512
293 };
294 
295 enum {
296 	P_D3D_CROP_SIZE_NONE = 0,
297 	P_D3D_CROP_SIZE_MSX1,
298 	P_D3D_CROP_SIZE_MSX1_PLUS_8,
299 	P_D3D_CROP_SIZE_MSX2,
300 	P_D3D_CROP_SIZE_MSX2_PLUS_8,
301 	P_D3D_CROP_SIZE_CUSTOM
302 };
303 
304 
305 
306 
307 typedef struct {
308     int disabled;
309     int inputIndex;
310     char inputName[256];
311 } VideoInProperties;
312 
313 typedef struct {
314     int enable;
315     int volume;
316     int pan;
317 } MixerChannel;
318 
319 typedef struct {
320     int enableY8950;
321     int enableYM2413;
322     int enableMoonsound;
323     int moonsoundSRAMSize;
324     int ym2413Oversampling;
325     int y8950Oversampling;
326     int moonsoundOversampling;
327 } SoundChip;
328 
329 typedef struct {
330     int  driver;
331     int  bufSize;
332     int  stabilizeDSoundTiming;
333     SoundChip chip;
334     int  stereo;
335     int  masterVolume;
336     int  masterEnable;
337     MixerChannel mixerChannel[MIXER_CHANNEL_TYPE_COUNT];
338     int  log[PROP_MAXPATH];
339     struct {
340         int  type;
341         char name[256];
342         char desc[256];
343         char fileName[PROP_MAXPATH];
344         int  channel;
345     } YkIn;
346     struct {
347         int  type;
348         char name[256];
349         char desc[256];
350         char fileName[PROP_MAXPATH];
351     } MidiIn;
352     struct {
353         int  type;
354         char name[256];
355         char desc[256];
356         char fileName[PROP_MAXPATH];
357         int  mt32ToGm;
358     } MidiOut;
359 } SoundProperties;
360 
361 typedef struct {
362 	int POV0isAxes;
363 } JoystickGeneric;
364 
365 typedef struct {
366     char type[64];
367     int  typeId;
368     int  autofire;
369 }  JoystickProperties;
370 
371 typedef struct {
372     char configFile[PROP_MAXPATH];
373     int enableKeyboardQuirk;
374 } KeyboardProperties;
375 
376 typedef struct {
377     char fileName[PROP_MAXPATH];
378     char fileNameInZip[PROP_MAXPATH];
379     char directory[PROP_MAXPATH];
380     int  extensionFilter;
381     int  type;
382 } FileProperties;
383 
384 typedef struct {
385     FileProperties carts[PROP_MAX_CARTS];
386     FileProperties disks[PROP_MAX_DISKS];
387     FileProperties tapes[PROP_MAX_TAPES];
388 } Media;
389 
390 typedef struct {
391     int enableDos2;
392     int enablePhantomDrives;
393     int enableOtherDiskRoms;
394     int partitionNumber;
395     int ignoreBootFlag;
396 } NoWindProperties;
397 
398 typedef struct {
399     RomType defaultType;
400     char    defDir[PROP_MAXPATH];
401     char    defDirSEGA[PROP_MAXPATH];
402     char    defDirCOLECO[PROP_MAXPATH];
403     char    defDirSVI[PROP_MAXPATH];
404     int     autoReset;
405     int     quickStartDrive;
406 } CartridgeProperties;
407 
408 typedef struct {
409     char defDir[PROP_MAXPATH];
410     char defHdDir[PROP_MAXPATH];
411     int  autostartA;
412     int  quickStartDrive;
413     int  cdromMethod;
414     int  cdromDrive;
415 } DiskdriveProperties;
416 
417 typedef struct {
418     char defDir[PROP_MAXPATH];
419     int showCustomFiles;
420     int readOnly;
421     int rewindAfterInsert;
422 } CassetteProperties;
423 
424 typedef struct {
425 #ifndef NO_FILE_HISTORY
426     int     count;
427     char    cartridge[2][MAX_HISTORY][PROP_MAXPATH];
428     RomType cartridgeType[2][MAX_HISTORY];
429     char    diskdrive[2][MAX_HISTORY][PROP_MAXPATH];
430     char    cassette[1][MAX_HISTORY][PROP_MAXPATH];
431 #endif
432     char    quicksave[PROP_MAXPATH];
433     char    videocap[PROP_MAXPATH];
434 } FileHistory;
435 
436 typedef struct {
437     struct {
438         int  type;
439         int  emulation;
440         char name[256];
441         char portName[PROP_MAXPATH];
442         char fileName[PROP_MAXPATH];
443     } Lpt;
444     struct {
445         int  type;
446         char name[256];
447         char portName[PROP_MAXPATH];
448         char fileName[PROP_MAXPATH];
449     } Com;
450     struct {
451         int disabled;
452         int ethIndex;
453         char macAddress[64];
454     } Eth;
455 } PortProperties;
456 
457 #define DLG_MAX_ID 32
458 
459 typedef struct {
460     char language[64];
461 
462     int portable;
463     int disableScreensaver;
464     int showStatePreview;
465     int usePngScreenshots;
466     char themeName[128];
467     struct {
468         long left;
469         long top;
470         long width;
471         long height;
472     } windowPos[DLG_MAX_ID];
473 } Settings;
474 
475 typedef struct Properties {
476     EmulationProperties emulation;
477     VideoProperties     video;
478     VideoInProperties   videoIn;
479     SoundProperties     sound;
480     JoystickGeneric     joystick;
481     JoystickProperties  joy1;
482     JoystickProperties  joy2;
483     KeyboardProperties  keyboard;
484     CartridgeProperties cartridge;
485     DiskdriveProperties diskdrive;
486     Media               media;
487     CassetteProperties  cassette;
488     FileHistory         filehistory;
489     PortProperties      ports;
490     int                 language;
491     Settings            settings;
492     NoWindProperties    nowind;
493 } Properties;
494 
495 Properties* propCreate(int useDefault,
496                        int langType,
497                        PropKeyboardLanguage kbdLang,
498                        int syncMode,
499                        const char* themeName);
500 void propSave(Properties* pProperties);
501 void propDestroy(Properties* pProperties);
502 
503 void propertiesSetDirectory(const char* defDir, const char* altDir);
504 
505 Properties* propGetGlobalProperties();
506 
507 #endif
508