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];
171 _TCHAR config_path[_MAX_PATH];
173 memset(config_path, 0x00, _MAX_PATH);
174 memset(app_path, 0x00, _MAX_PATH);
176 strncpy(app_path , cpp_confdir.c_str(), _MAX_PATH);
177 #elif defined(_MSC_VER)
178 GetModuleFileName(NULL, config_path, _MAX_PATH);
179 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
180 if(ptr != NULL) *ptr = _T('\0');
182 my_stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
186 config.boot_mode = MyGetPrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
189 config.cpu_type = MyGetPrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
192 config.dipswitch = MyGetPrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
194 #ifdef USE_DEVICE_TYPE
195 config.device_type = MyGetPrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
197 #ifdef USE_DRIVE_TYPE
198 config.drive_type = MyGetPrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
203 for(drv = 0; drv < MAX_FD; drv++) {
204 memset(name, 0x00, sizeof(name));
205 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
206 config.correct_disk_timing[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
207 config.correct_disk_timing[drv], config_path);
208 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
209 config.ignore_disk_crc[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
210 config.ignore_disk_crc[drv], config_path);
216 config.tape_sound = MyGetPrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
217 config.wave_shaper = MyGetPrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
218 config.direct_load_mzt = MyGetPrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
219 config.baud_high = MyGetPrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
224 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), _T(""), config.initial_cart_dir, _MAX_PATH, config_path);
225 for(drv = 0; drv < MAX_CART; drv++) {
226 for(i = 0; i < MAX_HISTORY; i++) {
228 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
229 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
230 config.recent_cart_path[drv][i], _MAX_PATH, config_path);
235 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), _T(""),
236 config.initial_disk_dir, _MAX_PATH, config_path);
237 // get_parent_dir(config.initial_disk_dir);
238 for(drv = 0; drv < MAX_FD; drv++) {
239 for(i = 0; i < MAX_HISTORY; i++) {
241 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
242 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
243 _T(""), config.recent_disk_path[drv][i], _MAX_PATH, config_path);
248 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
249 _T(""), config.initial_quickdisk_dir, _MAX_PATH, config_path);
250 for(drv = 0; drv < MAX_QD; drv++) {
251 for(i = 0; i < MAX_HISTORY; i++) {
253 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
254 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
255 config.recent_quickdisk_path[drv][i], _MAX_PATH, config_path);
261 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), _T(""),
262 config.initial_tape_dir, _MAX_PATH, config_path);
263 for(i = 0; i < MAX_HISTORY; i++) {
265 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
266 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
267 config.recent_tape_path[i], _MAX_PATH, config_path);
271 #ifdef USE_LASER_DISC
272 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), _T(""),
273 config.initial_laser_disc_dir, _MAX_PATH, config_path);
274 for(int i = 0; i < MAX_HISTORY; i++) {
276 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
277 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
278 config.recent_laser_disc_path[i], _MAX_PATH, config_path);
281 #ifdef USE_BINARY_FILE1
282 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), _T(""),
283 config.initial_binary_dir, _MAX_PATH, config_path);
284 for(drv = 0; drv < MAX_BINARY; drv++) {
285 for(i = 0; i < MAX_HISTORY; i++) {
287 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
288 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
289 config.recent_binary_path[drv][i], _MAX_PATH, config_path);
295 #ifndef ONE_BOARD_MICRO_COMPUTER
296 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
298 config.use_d3d9 = MyGetPrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
299 config.wait_vsync = MyGetPrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
301 config.stretch_type = MyGetPrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
303 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
305 #ifdef USE_MONITOR_TYPE
306 config.monitor_type = MyGetPrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
308 #ifdef USE_CRT_FILTER
309 config.crt_filter = MyGetPrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
312 config.scan_line = MyGetPrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
315 #ifdef USE_SCREEN_ROTATE
316 config.rotate_type = MyGetPrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
319 config.use_opengl_scanline = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
320 config.use_opengl_scanline, config_path);
321 config.opengl_scanline_vert = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
322 config.opengl_scanline_vert, config_path);;
323 config.opengl_scanline_horiz = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
324 config.opengl_scanline_horiz, config_path);;
325 config.use_opengl_filters = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
326 config.use_opengl_filters, config_path);
327 config.opengl_filter_num = MyGetPrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
328 config.opengl_filter_num, config_path);
331 config.sound_frequency = MyGetPrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
332 config.sound_latency = MyGetPrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
333 #ifdef USE_SOUND_DEVICE_TYPE
334 config.sound_device_type = MyGetPrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
336 #if !defined(_USE_QT)
337 MyGetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
340 config.multiple_speakers = MyGetPrivateProfileBool(_T("Sound"), _T("MultipleSpeakers"),
341 config.multiple_speakers, config_path);
342 config.general_sound_level = MyGetPrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
343 config.general_sound_level, config_path);
344 #ifdef USE_MULTIPLE_SOUNDCARDS
348 for(ii = 0; ii < USE_MULTIPLE_SOUNDCARDS; ii++) {
349 memset(_tag, 0x00, sizeof(_tag));
350 my_stprintf_s(_tag, 64, _T("DeviceVolumeLevel_%d"), ii + 1);
351 config.sound_device_level[ii] = MyGetPrivateProfileInt(_T("Sound"), (const _TCHAR *)_tag, config.sound_device_level[ii], config_path);
356 config.use_direct_input = MyGetPrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
357 config.disable_dwm = MyGetPrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
359 config.swap_joy_buttons = MyGetPrivateProfileBool(_T("Input"), _T("SwapJoyButtons"), config.swap_joy_buttons, config_path);
360 #if defined(_USE_QT) && !defined(Q_OS_WIN)
361 AGAR_DebugLog(AGAR_LOG_INFO, "Read Done.");
369 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
370 memset(config_path, 0x00, _MAX_PATH);
371 memset(app_path, 0x00, _MAX_PATH);
373 strncpy(app_path , cpp_confdir.c_str(), _MAX_PATH);
374 #elif defined(_MSC_VER)
375 GetModuleFileName(NULL, config_path, _MAX_PATH);
376 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
377 if(ptr != NULL) *ptr = _T('\0');
379 my_stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
380 #if !defined(_MSC_VER)
382 FILEIO *pt = new FILEIO;
383 if(pt->Fopen(config_path, FILEIO_WRITE_ASCII) != true) {
393 # ifdef USE_BOOT_MODE
394 MyWritePrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
397 MyWritePrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
400 MyWritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
402 #ifdef USE_DEVICE_TYPE
403 MyWritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
405 #ifdef USE_DRIVE_TYPE
406 MyWritePrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
411 for(drv = 0; drv < MAX_FD; drv++) {
412 memset(name, 0x00, sizeof(name));
413 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
414 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.correct_disk_timing[drv], config_path);
415 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
416 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.ignore_disk_crc[drv], config_path);
422 MyWritePrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
423 MyWritePrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
424 MyWritePrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
425 MyWritePrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
430 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), config.initial_cart_dir, config_path);
431 for(drv = 0; drv < MAX_CART; drv++) {
432 for(i = 0; i < MAX_HISTORY; i++) {
434 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
435 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, config.recent_cart_path[drv][i], config_path);
440 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), config.initial_disk_dir, config_path);
441 for(drv = 0; drv < MAX_FD; drv++) {
442 for(i = 0; i < MAX_HISTORY; i++) {
444 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
445 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
446 config.recent_disk_path[drv][i], config_path);
451 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
452 config.initial_quickdisk_dir, config_path);
453 for(drv = 0; drv < MAX_QD; drv++) {
454 for(i = 0; i < MAX_HISTORY; i++) {
456 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
457 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
458 config.recent_quickdisk_path[drv][i], config_path);
463 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), config.initial_tape_dir, config_path);
464 for(i = 0; i < MAX_HISTORY; i++) {
466 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
467 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
468 config.recent_tape_path[i], config_path);
471 #ifdef USE_LASER_DISC
472 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), config.initial_laser_disc_dir, config_path);
473 for(int i = 0; i < MAX_HISTORY; i++) {
475 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
476 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
477 config.recent_laser_disc_path[i], config_path);
480 #ifdef USE_BINARY_FILE1
481 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), config.initial_binary_dir, config_path);
482 for(drv = 0; drv < MAX_BINARY; drv++) {
483 for(i = 0; i < MAX_HISTORY; i++) {
485 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
486 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
487 config.recent_binary_path[drv][i], config_path);
493 #ifndef ONE_BOARD_MICRO_COMPUTER
494 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
496 MyWritePrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
497 MyWritePrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
499 MyWritePrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
501 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
503 #ifdef USE_MONITOR_TYPE
504 MyWritePrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
506 #ifdef USE_CRT_FILTER
507 MyWritePrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
510 MyWritePrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
512 #ifdef USE_SCREEN_ROTATE
513 MyWritePrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
516 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
517 config.use_opengl_scanline, config_path);
518 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
519 config.opengl_scanline_vert, config_path);;
520 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
521 config.opengl_scanline_horiz, config_path);;
522 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
523 config.use_opengl_filters, config_path);
524 MyWritePrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
525 config.opengl_filter_num, config_path);
529 MyWritePrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
530 MyWritePrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
531 #ifdef USE_SOUND_DEVICE_TYPE
532 MyWritePrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
534 #if !defined(_USE_QT)
535 MyWritePrivateProfileString(_T("Sound"), _T("FMGenDll"), config.fmgen_dll_path, config_path);
537 MyWritePrivateProfileBool(_T("Sound"), _T("MultipleSpeakers"),
538 config.multiple_speakers, config_path);
539 MyWritePrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
540 config.general_sound_level, config_path);
541 #ifdef USE_MULTIPLE_SOUNDCARDS
545 for(ii = 0; ii < USE_MULTIPLE_SOUNDCARDS; ii++) {
546 memset(_tag, 0x00, sizeof(_tag));
547 my_stprintf_s(_tag, 64, _T("DeviceVolumeLevel_%d"), ii + 1);
548 MyWritePrivateProfileInt(_T("Sound"), (const _TCHAR *)_tag, config.sound_device_level[ii], config_path);
554 MyWritePrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
555 MyWritePrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
557 MyWritePrivateProfileBool(_T("Input"), _T("SwapJoyButtons"), config.swap_joy_buttons, config_path);
558 #if defined(_USE_QT) && !defined(Q_OS_WIN)
559 AGAR_DebugLog(AGAR_LOG_INFO, "Write done.");
563 #define STATE_VERSION 3
565 void save_config_state(void *f)
567 FILEIO *state_fio = (FILEIO *)f;
570 state_fio->FputUint32(STATE_VERSION);
573 state_fio->FputInt32(config.boot_mode);
576 state_fio->FputInt32(config.cpu_type);
579 state_fio->FputUint32(config.dipswitch);
581 #ifdef USE_DEVICE_TYPE
582 state_fio->FputInt32(config.device_type);
584 #ifdef USE_DRIVE_TYPE
585 state_fio->FputInt32(config.drive_type);
588 for(int drv = 0; drv < MAX_FD; drv++) {
589 state_fio->FputBool(config.correct_disk_timing[drv]);
590 state_fio->FputBool(config.ignore_disk_crc[drv]);
592 // for(int drv = 0; drv < MAX_FD; drv++) {
593 // state_fio->FputBool(config.fdd_hack_fast_transfer[drv]);
596 #ifdef USE_MONITOR_TYPE
597 state_fio->FputInt32(config.monitor_type);
599 #ifdef USE_SOUND_DEVICE_TYPE
600 state_fio->FputInt32(config.sound_device_type);
605 bool load_config_state(void *f)
607 FILEIO *state_fio = (FILEIO *)f;
609 if(state_fio->FgetUint32() != STATE_VERSION) {
613 config.boot_mode = state_fio->FgetInt32();
616 config.cpu_type = state_fio->FgetInt32();
619 config.dipswitch = state_fio->FgetUint32();
621 #ifdef USE_DEVICE_TYPE
622 config.device_type = state_fio->FgetInt32();
624 #ifdef USE_DRIVE_TYPE
625 config.drive_type = state_fio->FgetInt32();
628 for(int drv = 0; drv < MAX_FD; drv++) {
629 config.correct_disk_timing[drv] = state_fio->FgetBool();
630 config.ignore_disk_crc[drv] = state_fio->FgetBool();
632 // for(int drv = 0; drv < MAX_FD; drv++) {
633 // config.fdd_hack_fast_transfer[drv] = state_fio->FgetBool();
636 #ifdef USE_MONITOR_TYPE
637 config.monitor_type = state_fio->FgetInt32();
639 #ifdef USE_SOUND_DEVICE_TYPE
640 config.sound_device_type = state_fio->FgetInt32();