OSDN Git Service

[Qt][UI][CONFIG][Win32] Fix crash with Win32/Mingw.
[csp-qt/common_source_project-fm7.git] / source / src / config.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2006.08.18 -
6
7         [ config ]
8 */
9
10 #ifndef _CONFIG_H_
11 #define _CONFIG_H_
12
13 #if defined(_USE_QT)
14 #include <sys/param.h>
15 #include <QtCore/QFile>
16 #include <QtCore/QFileInfo>
17
18 #ifndef _MAX_PATH
19  #define _MAX_PATH 2048
20 #endif
21 #endif
22 #include "vm/vm.h"
23 #include "fileio.h"
24
25 // LOG COMMAND
26 #define EMU_LOG_CPU1        0x00000001
27 #define EMU_LOG_CPU2        0x00000002
28 #define EMU_LOG_CPU3        0x00000004
29 #define EMU_LOG_CPU4        0x00000008
30 #define EMU_LOG_FLOPPY      0x00000010
31 #define EMU_LOG_CMT         0x00000020
32 #define EMU_LOG_QD          0x00000040
33 #define EMU_LOG_CART        0x00000080
34 #define EMU_LOG_BINARY      0x00000100
35 #define EMU_LOG_LASERDISC   0x00000200
36 #define EMU_LOG_DISPLAY     0x00001000
37 #define EMU_LOG_SOUND       0x00002000
38 #define EMU_LOG_KEYBOARD    0x00004000
39 #define EMU_LOG_IO          0x00008000
40 #define EMU_LOG_MEMORY      0x00010000
41 #define EMU_LOG_USR1        0x00020000
42 #define EMU_LOG_USR2        0x00040000
43 #define EMU_LOG_USR3        0x00080000
44 #define EMU_LOG_USR4        0x00100000
45 #define EMU_LOG_USR5        0x00200000
46 #define EMU_LOG_USR6        0x00400000
47 #define EMU_LOG_USR7        0x00800000
48 #define EMU_LOG_USR8        0x01000000
49 #define EMU_LOG_USR9        0x02000000
50 #define EMU_LOG_USR10       0x04000000
51 #define EMU_LOG_GUI         0x08000000
52 #define EMU_LOG_DEBUG       0x10000000
53 #define EMU_LOG_INFO        0x20000000
54 #define EMU_LOG_WARNING     0x40000000
55 #define EMU_LOG_GENERAL     0x80000000
56
57 #define MAX_HISTORY     8
58
59 #if defined(USE_CART2)
60 #define MAX_CART        2
61 #elif defined(USE_CART1)
62 #define MAX_CART        1
63 #endif
64
65 #if defined(USE_FD8)
66 #define MAX_FD          8
67 #elif defined(USE_FD7)
68 #define MAX_FD          7
69 #elif defined(USE_FD6)
70 #define MAX_FD          6
71 #elif defined(USE_FD5)
72 #define MAX_FD          5
73 #elif defined(USE_FD4)
74 #define MAX_FD          4
75 #elif defined(USE_FD3)
76 #define MAX_FD          3
77 #elif defined(USE_FD2)
78 #define MAX_FD          2
79 #elif defined(USE_FD1)
80 #define MAX_FD          1
81 #endif
82
83 #if defined(USE_QD2)
84 #define MAX_QD          2
85 #elif defined(USE_QD1)
86 #define MAX_QD          1
87 #endif
88
89 #if defined(USE_BINARY_FILE2)
90 #define MAX_BINARY      2
91 #elif defined(USE_BINARY_FILE1)
92 #define MAX_BINARY      1
93 #endif
94
95 #ifdef __cplusplus
96 void init_config();
97 void load_config();
98 void save_config();
99 void save_config_state(void *f);
100 bool load_config_state(void *f);
101 #endif
102
103 typedef struct {
104         // control
105 #ifdef USE_BOOT_MODE
106         int boot_mode;
107 #endif
108 #ifdef USE_CPU_TYPE
109         int cpu_type;
110 #endif
111         int cpu_power;
112 #ifdef USE_DIPSWITCH
113         uint32 dipswitch;
114 #endif
115 #ifdef USE_DEVICE_TYPE
116         int device_type;
117 #endif
118 #ifdef USE_DRIVE_TYPE
119         int drive_type;
120 #endif
121 #ifdef USE_FD1
122         bool correct_disk_timing[16];
123         bool ignore_disk_crc[16];
124 #endif
125 #ifdef USE_TAPE
126         bool tape_sound;
127         bool wave_shaper;
128         bool direct_load_mzt;
129         bool baud_high;
130 #endif
131         
132         // recent files
133 #ifdef USE_CART1
134         _TCHAR initial_cart_dir[_MAX_PATH];
135         _TCHAR recent_cart_path[MAX_CART][MAX_HISTORY][_MAX_PATH];
136 #endif
137 #ifdef USE_FD1
138         _TCHAR initial_disk_dir[_MAX_PATH];
139         _TCHAR recent_disk_path[MAX_FD][MAX_HISTORY][_MAX_PATH];
140 #endif
141 #ifdef USE_QD1
142         _TCHAR initial_quickdisk_dir[_MAX_PATH];
143         _TCHAR recent_quickdisk_path[MAX_QD][MAX_HISTORY][_MAX_PATH];
144 #endif
145 #ifdef USE_TAPE
146         _TCHAR initial_tape_dir[_MAX_PATH];
147         _TCHAR recent_tape_path[MAX_HISTORY][_MAX_PATH];
148 #endif
149 #ifdef USE_LASER_DISC
150         _TCHAR initial_laser_disc_dir[_MAX_PATH];
151         _TCHAR recent_laser_disc_path[MAX_HISTORY][_MAX_PATH];
152 #endif
153 #ifdef USE_BINARY_FILE1
154         _TCHAR initial_binary_dir[_MAX_PATH];
155         _TCHAR recent_binary_path[MAX_BINARY][MAX_HISTORY][_MAX_PATH];
156 #endif
157 #ifdef USE_SCREEN_ROTATE
158         bool rotate_type; // FIXME: wanna support +90deg, +180deg and +270deg
159 #endif
160         
161         // screen
162         int window_mode;
163 #ifdef _WIN32
164         bool use_d3d9;
165         bool wait_vsync;
166 #endif
167         int stretch_type;
168 #ifdef USE_MONITOR_TYPE
169         int monitor_type;
170 #endif
171 #ifdef USE_CRT_FILTER
172         BOOL crt_filter;
173 #endif
174 #ifdef USE_SCANLINE
175         bool scan_line;
176 #endif
177         // sound
178         int sound_frequency;
179         int sound_latency;
180         
181         int general_sound_level;
182 #ifdef USE_MULTIPLE_SOUNDCARDS
183         int sound_device_level[USE_MULTIPLE_SOUNDCARDS];
184 #endif
185         bool multiple_speakers; // Effext if multiple sound boards : TRUE = not monoral.
186 #if defined(USE_QT)
187         bool use_opengl_scanline;
188         bool opengl_scanline_vert;
189         bool opengl_scanline_horiz;
190         
191         bool use_opengl_filters;
192         int opengl_filter_num;
193 #endif  
194 #ifdef USE_SOUND_DEVICE_TYPE
195         int sound_device_type;
196 #endif
197         _TCHAR fmgen_dll_path[_MAX_PATH];
198         
199         // input
200 #ifdef _WIN32
201         bool use_direct_input;
202         bool disable_dwm;
203 #endif
204         bool swap_joy_buttons;
205 } config_t;
206
207 extern config_t config;
208
209 #if defined(_USE_AGAR) || defined(_USE_QT)
210
211 # include <string>
212
213 extern bool WritePrivateProfileString(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, char *Value, FILEIO *lpFileName);
214 extern bool WritePrivateProfileInt(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, int Value, FILEIO *lpFileName);
215 extern BOOL WritePrivateProfileBool(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, bool Value, FILEIO *lpFileName);
216 extern std::string GetPrivateProfileStr(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, FILEIO *lpFileName);
217 extern void GetPrivateProfileString(const _TCHAR *section, const _TCHAR *key, const _TCHAR *defaultstr,
218                                                                         char *str, int max_len, FILEIO *p);
219 extern int GetPrivateProfileInt(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, int nDefault, FILEIO *lpFileName);
220 extern bool GetPrivateProfileBool(const _TCHAR *lpAppName, const _TCHAR *lpKeyName, bool bDefault, FILEIO *lpFileName);
221
222 #endif
223
224 #endif
225