2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
11 #include <agar/core.h>
15 #include "agar_logger.h"
22 #include "agar_logger.h"
24 # if defined(Q_OS_WIN)
34 #if defined(_USE_AGAR)
35 #include "agar_main.h"
41 #define CONFIG_NAME "conf"
44 //extern _TCHAR* get_parent_dir(_TCHAR* file);
45 BOOL MyWritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, int Value, LPCTSTR lpFileName)
48 my_stprintf_s(String, 32, _T("%d"), Value);
49 return MyWritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
52 BOOL MyWritePrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool Value, LPCTSTR lpFileName)
55 my_stprintf_s(String, 32, _T("%d"), Value ? 1 : 0);
56 return MyWritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
59 bool MyGetPrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool bDefault, LPCTSTR lpFileName)
61 return (MyGetPrivateProfileInt(lpAppName, lpKeyName, bDefault ? 1 : 0, lpFileName) != 0);
68 memset(&config, 0, sizeof(config_t));
69 config.window_mode = 1;
71 #if defined(USE_BOOT_MODE) && defined(BOOT_MODE_DEFAULT)
72 config.boot_mode = BOOT_MODE_DEFAULT;
74 #if defined(USE_CPU_TYPE) && defined(CPU_TYPE_DEFAULT)
75 config.cpu_type = CPU_TYPE_DEFAULT;
77 #if defined(USE_DIPSWITCH) && defined(DIPSWITCH_DEFAULT)
78 config.dipswitch = DIPSWITCH_DEFAULT;
80 #if defined(USE_DEVICE_TYPE) && defined(DEVICE_TYPE_DEFAULT)
81 config.device_type = DEVICE_TYPE_DEFAULT;
83 #if defined(USE_DRIVE_TYPE) && defined(DRIVE_TYPE_DEFAULT)
84 config.drive_type = DRIVE_TYPE_DEFAULT;
87 for(int drv = 0; drv < MAX_FD; drv++) {
88 #if defined(CORRECT_DISK_TIMING_DEFAULT)
89 config.correct_disk_timing[drv] = CORRECT_DISK_TIMING_DEFAULT;
91 config.correct_disk_timing[drv] = true;
93 #if defined(IGNORE_DISK_CRC_DEFAULT)
94 config.ignore_disk_crc[drv] = IGNORE_DISK_CRC_DEFAULT;
97 #elif defined(USE_FD1)
98 for(int drv = 0; drv < MAX_FD; drv++) {
99 config.ignore_disk_crc[drv] = false;
102 #if defined(USE_TAPE)
103 config.wave_shaper = true;
104 config.direct_load_mzt = true;
105 config.baud_high = true;
109 config.sound_frequency = 6; // 48KHz
110 config.sound_latency = 1; // 100msec
111 config.general_sound_level = 0;
112 #if defined(USE_SOUND_DEVICE_TYPE) && defined(SOUND_DEVICE_TYPE_DEFAULT)
113 config.sound_device_type = SOUND_DEVICE_TYPE_DEFAULT;
114 #elif defined(USE_SOUND_DEVICE_TYPE)
115 config.sound_device_type = 0;
120 config.use_direct_input = true;
121 config.disable_dwm = false;
123 config.keyboard_type = 0;
124 for(int i = 0; i < 4; i++) {
125 for(int j = 0; j < 16; j++) {
126 config.joy_buttons[i][j] = (i << 4) | j;
131 #if defined(USE_PRINTER) && defined(PRINTER_DEVICE_TYPE_DEFAULT)
132 config.printer_device_type = PRINTER_DEVICE_TYPE_DEFAULT;
133 #elif defined(USE_PRINTER)
134 config.printer_device_type = 0;
138 #ifndef ONE_BOARD_MICRO_COMPUTER
140 config.use_d3d9 = true;
142 config.stretch_type = 1; // Stretch (Aspect)
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;
154 void load_config(const _TCHAR *config_path)
162 config.boot_mode = MyGetPrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
165 config.cpu_type = MyGetPrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
168 config.dipswitch = MyGetPrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
170 #ifdef USE_DEVICE_TYPE
171 config.device_type = MyGetPrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
173 #ifdef USE_DRIVE_TYPE
174 config.drive_type = MyGetPrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
179 for(drv = 0; drv < MAX_FD; drv++) {
180 memset(name, 0x00, sizeof(name));
181 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
182 config.correct_disk_timing[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
183 config.correct_disk_timing[drv], config_path);
184 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
185 config.ignore_disk_crc[drv] = MyGetPrivateProfileBool(_T("Control"), (const _TCHAR *)name,
186 config.ignore_disk_crc[drv], config_path);
192 config.tape_sound = MyGetPrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
193 config.wave_shaper = MyGetPrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
194 config.direct_load_mzt = MyGetPrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
195 config.baud_high = MyGetPrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
200 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), _T(""), config.initial_cart_dir, _MAX_PATH, config_path);
201 for(drv = 0; drv < MAX_CART; drv++) {
202 for(i = 0; i < MAX_HISTORY; i++) {
204 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
205 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
206 config.recent_cart_path[drv][i], _MAX_PATH, config_path);
211 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), _T(""),
212 config.initial_disk_dir, _MAX_PATH, config_path);
213 // get_parent_dir(config.initial_disk_dir);
214 for(drv = 0; drv < MAX_FD; drv++) {
215 for(i = 0; i < MAX_HISTORY; i++) {
217 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
218 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
219 _T(""), config.recent_disk_path[drv][i], _MAX_PATH, config_path);
224 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
225 _T(""), config.initial_quickdisk_dir, _MAX_PATH, config_path);
226 for(drv = 0; drv < MAX_QD; drv++) {
227 for(i = 0; i < MAX_HISTORY; i++) {
229 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
230 MyGetPrivateProfileString(_T("RecentFiles"), name, _T(""),
231 config.recent_quickdisk_path[drv][i], _MAX_PATH, config_path);
237 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), _T(""),
238 config.initial_tape_dir, _MAX_PATH, config_path);
239 for(i = 0; i < MAX_HISTORY; i++) {
241 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
242 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
243 config.recent_tape_path[i], _MAX_PATH, config_path);
247 #ifdef USE_LASER_DISC
248 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), _T(""),
249 config.initial_laser_disc_dir, _MAX_PATH, config_path);
250 for(int i = 0; i < MAX_HISTORY; i++) {
252 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
253 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
254 config.recent_laser_disc_path[i], _MAX_PATH, config_path);
257 #ifdef USE_BINARY_FILE1
258 MyGetPrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), _T(""),
259 config.initial_binary_dir, _MAX_PATH, config_path);
260 for(drv = 0; drv < MAX_BINARY; drv++) {
261 for(i = 0; i < MAX_HISTORY; i++) {
263 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
264 MyGetPrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, _T(""),
265 config.recent_binary_path[drv][i], _MAX_PATH, config_path);
271 #ifndef ONE_BOARD_MICRO_COMPUTER
272 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
274 config.use_d3d9 = MyGetPrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
275 config.wait_vsync = MyGetPrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
277 config.stretch_type = MyGetPrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
279 config.window_mode = MyGetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
281 #ifdef USE_MONITOR_TYPE
282 config.monitor_type = MyGetPrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
284 #ifdef USE_CRT_FILTER
285 config.crt_filter = MyGetPrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
288 config.scan_line = MyGetPrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
291 #ifdef USE_SCREEN_ROTATE
292 config.rotate_type = MyGetPrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
295 config.use_opengl_scanline = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
296 config.use_opengl_scanline, config_path);
297 config.opengl_scanline_vert = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
298 config.opengl_scanline_vert, config_path);;
299 config.opengl_scanline_horiz = MyGetPrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
300 config.opengl_scanline_horiz, config_path);;
301 config.use_opengl_filters = MyGetPrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
302 config.use_opengl_filters, config_path);
303 config.opengl_filter_num = MyGetPrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
304 config.opengl_filter_num, config_path);
307 config.sound_frequency = MyGetPrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
308 config.sound_latency = MyGetPrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
309 #ifdef USE_SOUND_DEVICE_TYPE
310 config.sound_device_type = MyGetPrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
312 #ifdef USE_SOUND_VOLUME
313 for(int i = 0; i < USE_SOUND_VOLUME; i++) {
315 my_stprintf_s(name, 64, _T("VolumeLeft%d"), i + 1);
316 int tmp_l = MyGetPrivateProfileInt(_T("Sound"), name, config.sound_volume_l[i], config_path);
317 my_stprintf_s(name, 64, _T("VolumeRight%d"), i + 1);
318 int tmp_r = MyGetPrivateProfileInt(_T("Sound"), name, config.sound_volume_r[i], config_path);
319 config.sound_volume_l[i] = max(-40, min(0, tmp_l));
320 config.sound_volume_r[i] = max(-40, min(0, tmp_r));
323 #if !defined(_USE_QT)
324 MyGetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
327 config.general_sound_level = MyGetPrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
328 config.general_sound_level, config_path);
330 config.use_direct_input = MyGetPrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
331 config.disable_dwm = MyGetPrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
333 config.keyboard_type = MyGetPrivateProfileInt(_T("Input"), _T("KeyboardType"), config.keyboard_type, config_path);
334 for(int i = 0; i < 4; i++) {
335 for(int j = 0; j < 16; j++) {
337 my_stprintf_s(name, 64, _T("JoyButtons%d_%d"), i + 1, j + 1);
338 config.joy_buttons[i][j] = MyGetPrivateProfileInt(_T("Input"), name, config.joy_buttons[i][j], config_path);
342 for(i = 0; i < 16; i++) {
344 my_stprintf_s(name, 256, _T("AssignedJoystick"), i + 1);
345 MyGetPrivateProfileString(_T("Input"), (const _TCHAR *)name, _T(""),
346 config.assigned_joystick_name[i], 256, config_path);
351 config.printer_device_type = MyGetPrivateProfileInt(_T("Printer"), _T("DeviceType"), config.printer_device_type, config_path);
352 MyGetPrivateProfileString(_T("Printer"), _T("PrinterDll"), _T("printer.dll"), config.printer_dll_path, _MAX_PATH, config_path);
354 #if defined(_USE_QT) && !defined(Q_OS_WIN)
355 AGAR_DebugLog(AGAR_LOG_INFO, "Read Done.");
359 void save_config(const _TCHAR *config_path)
362 #if !defined(_MSC_VER)
364 FILEIO *pt = new FILEIO;
365 if(pt->Fopen(config_path, FILEIO_WRITE_ASCII) != true) {
375 # ifdef USE_BOOT_MODE
376 MyWritePrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
379 MyWritePrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
382 MyWritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
384 #ifdef USE_DEVICE_TYPE
385 MyWritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
387 #ifdef USE_DRIVE_TYPE
388 MyWritePrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
393 for(drv = 0; drv < MAX_FD; drv++) {
394 memset(name, 0x00, sizeof(name));
395 my_stprintf_s(name, 64, _T("CorrectDiskTiming%d"), drv + 1);
396 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.correct_disk_timing[drv], config_path);
397 my_stprintf_s(name, 64, _T("IgnoreDiskCRC%d"), drv + 1);
398 MyWritePrivateProfileBool(_T("Control"), (const _TCHAR *)name, config.ignore_disk_crc[drv], config_path);
404 MyWritePrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
405 MyWritePrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
406 MyWritePrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
407 MyWritePrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
412 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), config.initial_cart_dir, config_path);
413 for(drv = 0; drv < MAX_CART; drv++) {
414 for(i = 0; i < MAX_HISTORY; i++) {
416 my_stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
417 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name, config.recent_cart_path[drv][i], config_path);
422 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), config.initial_disk_dir, config_path);
423 for(drv = 0; drv < MAX_FD; drv++) {
424 for(i = 0; i < MAX_HISTORY; i++) {
426 my_stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
427 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
428 config.recent_disk_path[drv][i], config_path);
433 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"),
434 config.initial_quickdisk_dir, config_path);
435 for(drv = 0; drv < MAX_QD; drv++) {
436 for(i = 0; i < MAX_HISTORY; i++) {
438 my_stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
439 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
440 config.recent_quickdisk_path[drv][i], config_path);
445 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), config.initial_tape_dir, config_path);
446 for(i = 0; i < MAX_HISTORY; i++) {
448 my_stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
449 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
450 config.recent_tape_path[i], config_path);
453 #ifdef USE_LASER_DISC
454 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), config.initial_laser_disc_dir, config_path);
455 for(int i = 0; i < MAX_HISTORY; i++) {
457 my_stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
458 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
459 config.recent_laser_disc_path[i], config_path);
462 #ifdef USE_BINARY_FILE1
463 MyWritePrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), config.initial_binary_dir, config_path);
464 for(drv = 0; drv < MAX_BINARY; drv++) {
465 for(i = 0; i < MAX_HISTORY; i++) {
467 my_stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
468 MyWritePrivateProfileString(_T("RecentFiles"), (const _TCHAR *)name,
469 config.recent_binary_path[drv][i], config_path);
475 #ifndef ONE_BOARD_MICRO_COMPUTER
476 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
478 MyWritePrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
479 MyWritePrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
481 MyWritePrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
483 MyWritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
485 #ifdef USE_MONITOR_TYPE
486 MyWritePrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
488 #ifdef USE_CRT_FILTER
489 MyWritePrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
492 MyWritePrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
494 #ifdef USE_SCREEN_ROTATE
495 MyWritePrivateProfileInt(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
498 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLScanLine"),
499 config.use_opengl_scanline, config_path);
500 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineVert"),
501 config.opengl_scanline_vert, config_path);;
502 MyWritePrivateProfileBool(_T("Screen"), _T("OpenGLScanLineHoriz"),
503 config.opengl_scanline_horiz, config_path);;
504 MyWritePrivateProfileBool(_T("Screen"), _T("UseOpenGLFilters"),
505 config.use_opengl_filters, config_path);
506 MyWritePrivateProfileInt(_T("Screen"), _T("OpenGLFilterNum"),
507 config.opengl_filter_num, config_path);
511 MyWritePrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
512 MyWritePrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
513 #ifdef USE_SOUND_DEVICE_TYPE
514 MyWritePrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
516 #ifdef USE_SOUND_VOLUME
517 for(int i = 0; i < USE_SOUND_VOLUME; i++) {
519 my_stprintf_s(name, 64, _T("VolumeLeft%d"), i + 1);
520 MyWritePrivateProfileInt(_T("Sound"), name, config.sound_volume_l[i], config_path);
521 my_stprintf_s(name, 64, _T("VolumeRight%d"), i + 1);
522 MyWritePrivateProfileInt(_T("Sound"), name, config.sound_volume_r[i], config_path);
525 #if !defined(_USE_QT)
526 MyWritePrivateProfileString(_T("Sound"), _T("FMGenDll"), config.fmgen_dll_path, config_path);
528 MyWritePrivateProfileInt(_T("Sound"), _T("GeneralSoundLevel"),
529 config.general_sound_level, config_path);
532 MyWritePrivateProfileBool(_T("Input"), _T("UseDirectInput"), config.use_direct_input, config_path);
533 MyWritePrivateProfileBool(_T("Input"), _T("DisableDwm"), config.disable_dwm, config_path);
535 MyWritePrivateProfileInt(_T("Input"), _T("KeyboardType"), config.keyboard_type, config_path);
536 for(int i = 0; i < 4; i++) {
537 for(int j = 0; j < 16; j++) {
539 my_stprintf_s(name, 64, _T("JoyButtons%d_%d"), i + 1, j + 1);
540 MyWritePrivateProfileInt(_T("Input"), name, config.joy_buttons[i][j], config_path);
544 for(i = 0; i < 16; i++) {
546 my_stprintf_s(name, 256, _T("AssignedJoystick%d"), i + 1);
547 MyWritePrivateProfileString(_T("Input"), (const _TCHAR *)name,
548 config.assigned_joystick_name[i], config_path);
554 MyWritePrivateProfileInt(_T("Printer"), _T("DeviceType"), config.printer_device_type, config_path);
556 #if defined(_USE_QT) && !defined(Q_OS_WIN)
557 AGAR_DebugLog(AGAR_LOG_INFO, "Write done.");
561 #define STATE_VERSION 5
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);
601 state_fio->FputInt32(config.printer_device_type);
603 state_fio->FputInt32(config.keyboard_type);
606 bool load_config_state(void *f)
608 FILEIO *state_fio = (FILEIO *)f;
610 if(state_fio->FgetUint32() != STATE_VERSION) {
614 config.boot_mode = state_fio->FgetInt32();
617 config.cpu_type = state_fio->FgetInt32();
620 config.dipswitch = state_fio->FgetUint32();
622 #ifdef USE_DEVICE_TYPE
623 config.device_type = state_fio->FgetInt32();
625 #ifdef USE_DRIVE_TYPE
626 config.drive_type = state_fio->FgetInt32();
629 for(int drv = 0; drv < MAX_FD; drv++) {
630 config.correct_disk_timing[drv] = state_fio->FgetBool();
631 config.ignore_disk_crc[drv] = state_fio->FgetBool();
633 // for(int drv = 0; drv < MAX_FD; drv++) {
634 // config.fdd_hack_fast_transfer[drv] = state_fio->FgetBool();
637 #ifdef USE_MONITOR_TYPE
638 config.monitor_type = state_fio->FgetInt32();
640 #ifdef USE_SOUND_DEVICE_TYPE
641 config.sound_device_type = state_fio->FgetInt32();
644 config.printer_device_type = state_fio->FgetInt32();
646 config.keyboard_type = state_fio->FgetInt32();