2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
11 #include <agar/core.h>
15 #include "agar_logger.h"
22 #include <QStringList>
24 #include "agar_logger.h"
26 # if defined(Q_OS_WIN)
39 #if defined(_USE_AGAR)
40 #include "agar_main.h"
46 #define CONFIG_NAME "conf"
49 //extern _TCHAR* get_parent_dir(_TCHAR* file);
50 BOOL MyWritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, int Value, LPCTSTR lpFileName)
53 my_stprintf_s(String, 32, _T("%d"), Value);
54 return MyWritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
57 BOOL MyWritePrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool Value, LPCTSTR lpFileName)
60 my_stprintf_s(String, 32, _T("%d"), Value ? 1 : 0);
61 return MyWritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
64 bool MyGetPrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool bDefault, LPCTSTR lpFileName)
66 return (MyGetPrivateProfileInt(lpAppName, lpKeyName, bDefault ? 1 : 0, lpFileName) != 0);
73 memset(&config, 0, sizeof(config_t));
74 config.window_mode = 1;
76 config.use_direct_input = true;
77 config.disable_dwm = false;
79 config.swap_joy_buttons = false;
81 #ifndef ONE_BOARD_MICRO_COMPUTER
83 config.use_d3d9 = true;
85 config.stretch_type = 1; // Stretch (Aspect)
87 config.sound_frequency = 6; // 48KHz
88 config.sound_latency = 1; // 100msec
91 config.wave_shaper = true;
92 config.direct_load_mzt = true;
93 config.baud_high = true;
95 #if defined(USE_BOOT_MODE) && defined(BOOT_MODE_DEFAULT)
96 config.boot_mode = BOOT_MODE_DEFAULT;
98 #if defined(USE_CPU_TYPE) && defined(CPU_TYPE_DEFAULT)
99 config.cpu_type = CPU_TYPE_DEFAULT;
101 #if defined(USE_DIPSWITCH) && defined(DIPSWITCH_DEFAULT)
102 config.dipswitch = DIPSWITCH_DEFAULT;
104 #if defined(USE_DEVICE_TYPE) && defined(DEVICE_TYPE_DEFAULT)
105 config.device_type = DEVICE_TYPE_DEFAULT;
108 for(int drv = 0; drv < MAX_FD; drv++) {
109 #if defined(CORRECT_DISK_TIMING_DEFAULT)
110 config.correct_disk_timing[drv] = CORRECT_DISK_TIMING_DEFAULT;
112 config.correct_disk_timing[drv] = true;
114 #if defined(IGNORE_DISK_CRC_DEFAULT)
115 config.ignore_disk_crc[drv] = IGNORE_DISK_CRC_DEFAULT;
118 #elif defined(USE_FD1)
119 for(int drv = 0; drv < MAX_FD; drv++) {
120 config.ignore_disk_crc[drv] = false;
123 #if defined(USE_SOUND_DEVICE_TYPE) && defined(SOUND_DEVICE_TYPE_DEFAULT)
124 config.sound_device_type = SOUND_DEVICE_TYPE_DEFAULT;
130 // 3 = WHG + OPN (+PSG)
132 // 5 = THG + OPN (+PSG)
133 // 6 = THG + WHG (+PSG)
134 // 7 = THG + WHG + OPN (+PSG)
136 config.sound_device_type = 0; // WITHOUT PSG?
137 #elif defined(_FM7) || defined(_FMNEW7) || defined(_FM77) || defined(_FM77L4) || defined(_FM77L2)
138 config.sound_device_type = 0; // PSG ONLY
139 #elif defined(_FM77AV) || defined(_FM77AV20) || defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
140 config.sound_device_type = 1; // OPN
142 config.multiple_speakers = false;
143 config.general_sound_level = 0;
146 config.use_opengl_scanline = false;
147 config.opengl_scanline_vert = false;
148 config.opengl_scanline_horiz = false;
149 config.use_opengl_filters = false;
150 config.opengl_filter_num = 0;
152 #ifdef USE_MULTIPLE_SOUNDCARDS
155 for(ii = 0; ii < USE_MULTIPLE_SOUNDCARDS; ii++) {
156 config.sound_device_level[ii] = 0;
170 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
171 memset(config_path, 0x00, _MAX_PATH);
172 memset(app_path, 0x00, _MAX_PATH);
174 strncpy(app_path , cpp_confdir.c_str(), _MAX_PATH);
175 #elif defined(_MSC_VER)
176 GetModuleFileName(NULL, config_path, _MAX_PATH);
177 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
178 if(ptr != NULL) *ptr = _T('\0');
180 my_stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
184 config.boot_mode = MyGetPrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
187 config.cpu_type = MyGetPrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
190 config.dipswitch = MyGetPrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
192 #ifdef USE_DEVICE_TYPE
193 config.device_type = MyGetPrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
195 #ifdef USE_DRIVE_TYPE
196 config.drive_type = MyGetPrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
201 for(drv = 0; drv < MAX_FD; drv++) {
202 memset(name, 0x00, sizeof(name));
203 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
204 config.correct_disk_timing[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
205 config.correct_disk_timing[drv], config_path);
206 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
207 config.ignore_disk_crc[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
208 config.ignore_disk_crc[drv], config_path);
214 config.tape_sound = MyGetPrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
215 config.wave_shaper = MyGetPrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
216 config.direct_load_mzt = MyGetPrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
217 config.baud_high = MyGetPrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
222 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), _T(""), config.initial_cart_dir, _MAX_PATH, config_path);
223 for(drv = 0; drv < MAX_CART; drv++) {
224 for(i = 0; i < MAX_HISTORY; i++) {
226 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
227 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
228 config.recent_cart_path[drv][i], _MAX_PATH, config_path);
233 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), _T(""),
234 config.initial_disk_dir, _MAX_PATH, config_path);
235 // get_parent_dir(config.initial_disk_dir);
236 for(drv = 0; drv < MAX_FD; drv++) {
237 for(i = 0; i < MAX_HISTORY; i++) {
239 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
240 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
241 _T(""), config.recent_disk_path[drv][i], _MAX_PATH, config_path);
246 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
247 _T(""), config.initial_quickdisk_dir, _MAX_PATH, config_path);
248 for(drv = 0; drv < MAX_QD; drv++) {
249 for(i = 0; i < MAX_HISTORY; i++) {
251 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
252 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
253 config.recent_quickdisk_path[drv][i], _MAX_PATH, config_path);
259 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), _T(""),
260 config.initial_tape_dir, _MAX_PATH, config_path);
261 for(i = 0; i < MAX_HISTORY; i++) {
263 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
264 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
265 config.recent_tape_path[i], _MAX_PATH, config_path);
269 #ifdef USE_LASER_DISC
270 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), _T(""),
271 config.initial_laser_disc_dir, _MAX_PATH, config_path);
272 for(int i = 0; i < MAX_HISTORY; i++) {
274 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
275 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
276 config.recent_laser_disc_path[i], _MAX_PATH, config_path);
279 #ifdef USE_BINARY_FILE1
280 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), _T(""),
281 config.initial_binary_dir, _MAX_PATH, config_path);
282 for(drv = 0; drv < MAX_BINARY; drv++) {
283 for(i = 0; i < MAX_HISTORY; i++) {
285 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
286 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
287 config.recent_binary_path[drv][i], _MAX_PATH, config_path);
293 #ifndef ONE_BOARD_MICRO_COMPUTER
294 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
296 config.use_d3d9 = MyGetPrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
297 config.wait_vsync = MyGetPrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
299 config.stretch_type = MyGetPrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
301 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
303 #ifdef USE_MONITOR_TYPE
304 config.monitor_type = MyGetPrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
306 #ifdef USE_CRT_FILTER
307 config.crt_filter = MyGetPrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
310 config.scan_line = MyGetPrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
313 #ifdef USE_SCREEN_ROTATE
314 config.rotate_type = MyGetPrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
317 config.use_opengl_scanline = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
318 config.use_opengl_scanline, config_path);
319 config.opengl_scanline_vert = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
320 config.opengl_scanline_vert, config_path);;
321 config.opengl_scanline_horiz = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
322 config.opengl_scanline_horiz, config_path);;
323 config.use_opengl_filters = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
324 config.use_opengl_filters, config_path);
325 config.opengl_filter_num = MyGetPrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
326 config.opengl_filter_num, config_path);
329 config.sound_frequency = MyGetPrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
330 config.sound_latency = MyGetPrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
331 #ifdef USE_SOUND_DEVICE_TYPE
332 config.sound_device_type = MyGetPrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
334 #if !defined(_USE_QT)
335 MyGetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
338 config.multiple_speakers = MyGetPrivateProfileBool(_T("Sound"), _T("MultipleSpeakers"),
339 config.multiple_speakers, config_path);
340 config.general_sound_level = MyGetPrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
341 config.general_sound_level, config_path);
342 #ifdef USE_MULTIPLE_SOUNDCARDS
346 for(ii = 0; ii < USE_MULTIPLE_SOUNDCARDS; ii++) {
347 memset(_tag, 0x00, sizeof(_tag));
348 my_stprintf_s(_tag, 64, _T("DeviceVolumeLevel_%d"), ii + 1);
349 config.sound_device_level[ii] = MyGetPrivateProfileInt(_T("Sound"), (const _TCHAR *)_tag, config.sound_device_level[ii], config_path);
354 config.use_direct_input = MyGetPrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
355 config.disable_dwm = MyGetPrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
357 config.swap_joy_buttons = MyGetPrivateProfileBool(_T("Input"), _T("SwapJoyButtons"), config.swap_joy_buttons, config_path);
358 #if defined(_USE_QT) && !defined(Q_OS_WIN)
359 AGAR_DebugLog(AGAR_LOG_INFO, "Read Done.");
367 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
368 memset(config_path, 0x00, _MAX_PATH);
369 memset(app_path, 0x00, _MAX_PATH);
371 strncpy(app_path , cpp_confdir.c_str(), _MAX_PATH);
372 #elif defined(_MSC_VER)
373 GetModuleFileName(NULL, config_path, _MAX_PATH);
374 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
375 if(ptr != NULL) *ptr = _T('\0');
377 my_stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
378 #if !defined(_MSC_VER)
380 FILEIO *pt = new FILEIO;
381 if(pt->Fopen(config_path, FILEIO_WRITE_ASCII) != true) {
391 # ifdef USE_BOOT_MODE
392 MyWritePrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
395 MyWritePrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
398 MyWritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
400 #ifdef USE_DEVICE_TYPE
401 MyWritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
403 #ifdef USE_DRIVE_TYPE
404 MyWritePrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
409 for(drv = 0; drv < MAX_FD; drv++) {
410 memset(name, 0x00, sizeof(name));
411 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
412 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.correct_disk_timing[drv], config_path);
413 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
414 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.ignore_disk_crc[drv], config_path);
420 MyWritePrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
421 MyWritePrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
422 MyWritePrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
423 MyWritePrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
428 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), config.initial_cart_dir, config_path);
429 for(drv = 0; drv < MAX_CART; drv++) {
430 for(i = 0; i < MAX_HISTORY; i++) {
432 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
433 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, config.recent_cart_path[drv][i], config_path);
438 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), config.initial_disk_dir, config_path);
439 for(drv = 0; drv < MAX_FD; drv++) {
440 for(i = 0; i < MAX_HISTORY; i++) {
442 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
443 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
444 config.recent_disk_path[drv][i], config_path);
449 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
450 config.initial_quickdisk_dir, config_path);
451 for(drv = 0; drv < MAX_QD; drv++) {
452 for(i = 0; i < MAX_HISTORY; i++) {
454 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
455 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
456 config.recent_quickdisk_path[drv][i], config_path);
461 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), config.initial_tape_dir, config_path);
462 for(i = 0; i < MAX_HISTORY; i++) {
464 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
465 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
466 config.recent_tape_path[i], config_path);
469 #ifdef USE_LASER_DISC
470 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), config.initial_laser_disc_dir, config_path);
471 for(int i = 0; i < MAX_HISTORY; i++) {
473 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
474 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
475 config.recent_laser_disc_path[i], config_path);
478 #ifdef USE_BINARY_FILE1
479 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), config.initial_binary_dir, config_path);
480 for(drv = 0; drv < MAX_BINARY; drv++) {
481 for(i = 0; i < MAX_HISTORY; i++) {
483 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
484 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
485 config.recent_binary_path[drv][i], config_path);
491 #ifndef ONE_BOARD_MICRO_COMPUTER
492 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
494 MyWritePrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
495 MyWritePrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
497 MyWritePrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
499 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
501 #ifdef USE_MONITOR_TYPE
502 MyWritePrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
504 #ifdef USE_CRT_FILTER
505 MyWritePrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
508 MyWritePrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
510 #ifdef USE_SCREEN_ROTATE
511 MyWritePrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
514 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
515 config.use_opengl_scanline, config_path);
516 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
517 config.opengl_scanline_vert, config_path);;
518 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
519 config.opengl_scanline_horiz, config_path);;
520 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
521 config.use_opengl_filters, config_path);
522 MyWritePrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
523 config.opengl_filter_num, config_path);
527 MyWritePrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
528 MyWritePrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
529 #ifdef USE_SOUND_DEVICE_TYPE
530 MyWritePrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
532 #if !defined(_USE_QT)
533 MyWritePrivateProfileString(_T("Sound"), _T("FMGenDll"), config.fmgen_dll_path, config_path);
535 MyWritePrivateProfileBool(_T("Sound"), _T("MultipleSpeakers"),
536 config.multiple_speakers, config_path);
537 MyWritePrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
538 config.general_sound_level, config_path);
539 #ifdef USE_MULTIPLE_SOUNDCARDS
543 for(ii = 0; ii < USE_MULTIPLE_SOUNDCARDS; ii++) {
544 memset(_tag, 0x00, sizeof(_tag));
545 my_stprintf_s(_tag, 64, _T("DeviceVolumeLevel_%d"), ii + 1);
546 MyWritePrivateProfileInt(_T("Sound"), (const _TCHAR *)_tag, config.sound_device_level[ii], config_path);
552 MyWritePrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
553 MyWritePrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
555 MyWritePrivateProfileBool(_T("Input"), _T("SwapJoyButtons"), config.swap_joy_buttons, config_path);
556 #if defined(_USE_QT) && !defined(Q_OS_WIN)
557 AGAR_DebugLog(AGAR_LOG_INFO, "Write done.");
561 #define STATE_VERSION 3
563 void save_config_state(void *f)
565 FILEIO *state_fio = (FILEIO *)f;
568 state_fio->FputUint32(STATE_VERSION);
571 state_fio->FputInt32(config.boot_mode);
574 state_fio->FputInt32(config.cpu_type);
577 state_fio->FputUint32(config.dipswitch);
579 #ifdef USE_DEVICE_TYPE
580 state_fio->FputInt32(config.device_type);
582 #ifdef USE_DRIVE_TYPE
583 state_fio->FputInt32(config.drive_type);
586 for(int drv = 0; drv < MAX_FD; drv++) {
587 state_fio->FputBool(config.correct_disk_timing[drv]);
588 state_fio->FputBool(config.ignore_disk_crc[drv]);
590 // for(int drv = 0; drv < MAX_FD; drv++) {
591 // state_fio->FputBool(config.fdd_hack_fast_transfer[drv]);
594 #ifdef USE_MONITOR_TYPE
595 state_fio->FputInt32(config.monitor_type);
597 #ifdef USE_SOUND_DEVICE_TYPE
598 state_fio->FputInt32(config.sound_device_type);
603 bool load_config_state(void *f)
605 FILEIO *state_fio = (FILEIO *)f;
607 if(state_fio->FgetUint32() != STATE_VERSION) {
611 config.boot_mode = state_fio->FgetInt32();
614 config.cpu_type = state_fio->FgetInt32();
617 config.dipswitch = state_fio->FgetUint32();
619 #ifdef USE_DEVICE_TYPE
620 config.device_type = state_fio->FgetInt32();
622 #ifdef USE_DRIVE_TYPE
623 config.drive_type = state_fio->FgetInt32();
626 for(int drv = 0; drv < MAX_FD; drv++) {
627 config.correct_disk_timing[drv] = state_fio->FgetBool();
628 config.ignore_disk_crc[drv] = state_fio->FgetBool();
630 // for(int drv = 0; drv < MAX_FD; drv++) {
631 // config.fdd_hack_fast_transfer[drv] = state_fio->FgetBool();
634 #ifdef USE_MONITOR_TYPE
635 config.monitor_type = state_fio->FgetInt32();
637 #ifdef USE_SOUND_DEVICE_TYPE
638 config.sound_device_type = state_fio->FgetInt32();