2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
11 #include <agar/core.h>
15 #include "agar_logger.h"
19 //# include <SDL/SDL.h>
23 #include "agar_logger.h"
34 #if defined(_USE_AGAR)
35 #include "agar_main.h"
41 #define CONFIG_NAME "conf"
44 #if defined(_USE_AGAR) || defined(_USE_QT)
45 bool WritePrivateProfileString(char *lpAppName, char *lpKeyName, char *Value, FILEIO *lpFileName)
51 s = s + lpKeyName + "=";
54 lpFileName->Fwrite((void *)s.c_str(), s.length(), 1);
58 bool WritePrivateProfileInt(char *lpAppName, char *lpKeyName, int Value, FILEIO *lpFileName)
63 memset(valuebuf, 0x00, 256);
65 l = snprintf(valuebuf, 254, "%d", Value);
66 if((l <= 0) || (l >= 253)) return false;
69 s = s + lpKeyName + "=";
70 s = s + valuebuf + "\n";
71 lpFileName->Fwrite((void *)s.c_str(), s.length(), 1);
76 BOOL WritePrivateProfileBool(char *lpAppName, char *lpKeyName, bool Value, FILEIO *lpFileName)
80 return WritePrivateProfileInt(lpAppName, lpKeyName, v, lpFileName);
85 std::string GetPrivateProfileStr(char *lpAppName, char *lpKeyName, FILEIO *lpFileName)
88 char ibuf[4096 + 102];
92 std::string::size_type pos;
98 key = key + lpKeyName;
99 AGAR_DebugLog(AGAR_LOG_DEBUG, "Try App: %s Key: %s", lpAppName, lpKeyName);
100 lpFileName->Fseek(0, FILEIO_SEEK_SET);
107 if(l_len > (4096 + 100)) { // Too long, read dummy.
108 c = (char)lpFileName->Fgetc();
109 if((c != EOF) && (c != '\n') && (c != '\0')) continue;
112 c = (char)lpFileName->Fgetc();
113 if((c == EOF) || (c == '\n') || (c == '\0')) break;
121 //AGAR_DebugLog(AGAR_LOG_DEBUG, "Got: %s %d chars.\n", got_str.c_str(), i);
122 key_str = key_str + "=";
123 pos = got_str.find(key_str);
124 if(pos != std::string::npos) break;
125 if(c == EOF) return "";
128 got_str.erase(0, pos + key_str.length());
129 //AGAR_DebugLog(AGAR_LOG_DEBUG, "Ok. Got %s = %s.\n", key, got_str.c_str());
133 void GetPrivateProfileString(char *section, char *key, char *defaultstr, char *str, int max_len, FILEIO *p)
135 std::string sp = GetPrivateProfileStr(section, key, p);
136 // printf("Got: %s\n", sp.c_str());
138 if((!sp.empty()) && (max_len > 1)){
139 strncpy(str, sp.c_str(), max_len);
141 strncpy(str, defaultstr, max_len);
143 printf("Got: %s\n", str);
147 int GetPrivateProfileInt(char *lpAppName, char *lpKeyName, int nDefault, FILEIO *lpFileName)
150 std::string s = GetPrivateProfileStr(lpAppName,lpKeyName, lpFileName);
155 i = strtol(s.c_str(), NULL, 10);
157 printf("Got: %d\n", i);
163 bool GetPrivateProfileBool(char *lpAppName, char *lpKeyName, bool bDefault, FILEIO *lpFileName)
166 return (GetPrivateProfileInt(lpAppName, lpKeyName, bDefault ? 1 : 0, lpFileName) != 0);
170 extern _TCHAR* get_parent_dir(_TCHAR* file);
171 BOOL WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, int Value, LPCTSTR lpFileName)
174 _stprintf_s(String, 32, _T("%d"), Value);
175 return WritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
178 BOOL WritePrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool Value, LPCTSTR lpFileName)
181 _stprintf_s(String, 32, _T("%d"), Value ? 1 : 0);
182 return WritePrivateProfileString(lpAppName, lpKeyName, String, lpFileName);
185 BOOL GetPrivateProfileBool(LPCTSTR lpAppName, LPCTSTR lpKeyName, bool bDefault, LPCTSTR lpFileName)
187 return (GetPrivateProfileInt(lpAppName, lpKeyName, bDefault ? 1 : 0, lpFileName) != 0);
195 memset(&config, 0, sizeof(config_t));
197 config.use_direct_input = true;
198 config.disable_dwm = false;
200 #if !(defined(USE_BITMAP) || defined(USE_LED))
201 config.use_d3d9 = true;
202 config.stretch_type = 1; // Stretch (Aspect)
204 config.sound_frequency = 6; // 48KHz
205 config.sound_latency = 1; // 100msec
207 #if defined(USE_TAPE)
208 config.wave_shaper = true;
209 config.direct_load_mzt = true;
210 config.baud_high = true;
212 #if defined(USE_BOOT_MODE) && defined(BOOT_MODE_DEFAULT)
213 config.boot_mode = BOOT_MODE_DEFAULT;
215 #if defined(USE_CPU_TYPE) && defined(CPU_TYPE_DEFAULT)
216 config.cpu_type = CPU_TYPE_DEFAULT;
218 #if defined(USE_DIPSWITCH) && defined(DIPSWITCH_DEFAULT)
219 config.dipswitch = DIPSWITCH_DEFAULT;
221 #if defined(USE_DEVICE_TYPE) && defined(DEVICE_TYPE_DEFAULT)
222 config.device_type = DEVICE_TYPE_DEFAULT;
225 # if defined(IGNORE_CRC_DEFAULT)
226 for(i = 0; i < 8; i++) config.ignore_crc[i] = IGNORE_CRC_DEFAULT;
228 for(i = 0; i < 8; i++) config.ignore_crc[i] = false;
231 #if defined(USE_SOUND_DEVICE_TYPE) && defined(SOUND_DEVICE_TYPE_DEFAULT)
232 config.sound_device_type = SOUND_DEVICE_TYPE_DEFAULT;
238 // 3 = WHG + OPN (+PSG)
240 // 5 = THG + OPN (+PSG)
241 // 6 = THG + WHG (+PSG)
242 // 7 = THG + WHG + OPN (+PSG)
244 config.sound_device_type = 0; // WITHOUT PSG?
245 #elif defined(_FM7) || defined(_FMNEW7) || defined(_FM77) || defined(_FM77L4) || defined(_FM77L2)
246 config.sound_device_type = 0; // PSG ONLY
247 #elif defined(_FM77AV) || defined(_FM77AV20) || defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
248 config.sound_device_type = 1; // OPN
260 #if defined(_USE_AGAR) || defined(_USE_QT)
261 char app_path2[_MAX_PATH], *ptr;
262 FILEIO *config_path = new FILEIO();
264 memset(app_path2, 0x00, _MAX_PATH);
265 cpp_confdir.copy(app_path2, _MAX_PATH, 0);
267 strncat(app_path2, CONFIG_NAME, _MAX_PATH);
268 strncat(app_path2, ".ini", _MAX_PATH);
270 AGAR_DebugLog(AGAR_LOG_INFO, "Try to read config: %s", app_path2);
271 if(!config_path->Fopen(app_path2, FILEIO_READ_ASCII)) return;
273 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
274 memset(config_path, 0x00, _MAX_PATH);
275 GetModuleFileName(NULL, config_path, _MAX_PATH);
276 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
278 _stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
283 config.use_direct_input = GetPrivateProfileBool(_T("Control"), _T("UseDirectInput"), config.use_direct_input, config_path);
284 config.disable_dwm = GetPrivateProfileBool(_T("Control"), _T("DisableDwm"), config.disable_dwm, config_path);
287 config.boot_mode = GetPrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
290 config.cpu_type = GetPrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
293 config.dipswitch = GetPrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
295 #ifdef USE_DEVICE_TYPE
296 config.device_type = GetPrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
298 #ifdef USE_DRIVE_TYPE
299 config.drive_type = GetPrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
304 for(drv = 0; drv < 8; drv++) {
305 memset(_tag, 0x00, sizeof(_tag));
306 _stprintf_s(_tag, 64, _T("IgnoreCRC_%d"), drv + 1);
307 config.ignore_crc[drv] = GetPrivateProfileBool(_T("Control"), _tag, config.ignore_crc[drv], config_path);
312 config.tape_sound = GetPrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
313 config.wave_shaper = GetPrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
314 config.direct_load_mzt = GetPrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
315 config.baud_high = GetPrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
320 GetPrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), _T(""), config.initial_cart_dir, _MAX_PATH, config_path);
321 for(drv = 0; drv < MAX_CART; drv++) {
322 for(i = 0; i < MAX_HISTORY; i++) {
324 _stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
325 // sprintf(name, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
326 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_cart_path[drv][i], _MAX_PATH, config_path);
331 GetPrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), _T(""), config.initial_disk_dir, _MAX_PATH, config_path);
332 get_parent_dir(config.initial_disk_dir);
333 for(drv = 0; drv < MAX_FD; drv++) {
334 for(i = 0; i < MAX_HISTORY; i++) {
336 // sprintf(name, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
337 _stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
338 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_disk_path[drv][i], _MAX_PATH, config_path);
343 GetPrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"), _T(""), config.initial_quickdisk_dir, _MAX_PATH, config_path);
344 for(drv = 0; drv < MAX_QD; drv++) {
345 for(i = 0; i < MAX_HISTORY; i++) {
347 // sprintf(name, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
348 _stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
349 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_quickdisk_path[drv][i], _MAX_PATH, config_path);
354 GetPrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), _T(""), config.initial_tape_dir, _MAX_PATH, config_path);
355 for(i = 0; i < MAX_HISTORY; i++) {
357 // sprintf(name, _T("RecentTapePath1_%d"), i + 1);
358 _stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
359 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_tape_path[i], _MAX_PATH, config_path);
362 #ifdef USE_LASER_DISC
363 GetPrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), _T(""), config.initial_laser_disc_dir, _MAX_PATH, config_path);
364 for(int i = 0; i < MAX_HISTORY; i++) {
366 // sprintf(name, _T("RecentLaserDiscPath1_%d"), i + 1);
367 _stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
368 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_laser_disc_path[i], _MAX_PATH, config_path);
371 #ifdef USE_BINARY_FILE1
372 GetPrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), _T(""), config.initial_binary_dir, _MAX_PATH, config_path);
373 for(drv = 0; drv < MAX_BINARY; drv++) {
374 for(i = 0; i < MAX_HISTORY; i++) {
376 // sprintf(name, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
377 _stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
378 GetPrivateProfileString(_T("RecentFiles"), name, _T(""), config.recent_binary_path[drv][i], _MAX_PATH, config_path);
384 #if !(defined(USE_BITMAP) || defined(USE_LED))
385 config.window_mode = GetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
386 config.use_d3d9 = GetPrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
387 config.wait_vsync = GetPrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
388 config.stretch_type = GetPrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
390 config.window_mode = GetPrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
392 #ifdef USE_MONITOR_TYPE
393 config.monitor_type = GetPrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
395 #ifdef USE_CRT_FILTER
396 config.crt_filter = GetPrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
399 config.scan_line = GetPrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
402 #ifdef USE_SCREEN_ROTATE
403 config.rotate_type = GetPrivateProfileBool(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
407 config.sound_frequency = GetPrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
408 config.sound_latency = GetPrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
409 #ifdef USE_SOUND_DEVICE_TYPE
410 config.sound_device_type = GetPrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
412 #if defined(DATAREC_SOUND) && defined(USE_TAPE)
413 // config.cmt_sound = GetPrivateProfileBool(_T("Sound"), _T("CMT"), false, config_path);
414 // config.cmt_volume = GetPrivateProfileInt(_T("Sound"), _T("CMTVolume"), 0x1800, config_path);
416 // GetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
418 #if defined(_USE_AGAR) || defined(_USE_QT)
419 config_path->Fclose();
421 AGAR_DebugLog(AGAR_LOG_INFO, "Read Done.");
429 #if defined(_USE_AGAR) || defined(_USE_QT)
430 char app_path2[_MAX_PATH], *ptr;
431 FILEIO *config_path = new FILEIO();
434 //GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
435 memset(app_path2, 0x00, _MAX_PATH);
436 cpp_confdir.copy(app_path2, _MAX_PATH, 0);
438 strncat(app_path2, CONFIG_NAME, _MAX_PATH);
439 strncat(app_path2, ".ini", _MAX_PATH);
441 AGAR_DebugLog(AGAR_LOG_INFO, "Try to write config: %s", app_path2);
442 if(config_path->Fopen(app_path2, FILEIO_WRITE_ASCII) != true) return;
444 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
445 memset(config_path, 0x00, _MAX_PATH);
446 GetModuleFileName(NULL, config_path, _MAX_PATH);
447 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
449 _stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
452 WritePrivateProfileBool(_T("Control"), _T("UseDirectInput"), config.use_direct_input, config_path);
453 WritePrivateProfileBool(_T("Control"), _T("DisableDwm"), config.disable_dwm, config_path);
455 # ifdef USE_BOOT_MODE
456 WritePrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
459 WritePrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
462 WritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
464 #ifdef USE_DEVICE_TYPE
465 WritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
467 #ifdef USE_DRIVE_TYPE
468 WritePrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
473 for(drv = 0; drv < 8; drv++) {
474 memset(_tag, 0x00, sizeof(_tag));
475 _stprintf_s(_tag, 64, _T("IgnoreCRC_%d"), drv + 1);
476 WritePrivateProfileBool(_T("Control"), _tag, config.ignore_crc[drv], config_path);
482 WritePrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
483 WritePrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
484 WritePrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
485 WritePrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
490 WritePrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), config.initial_cart_dir, config_path);
491 for(drv = 0; drv < MAX_CART; drv++) {
492 for(i = 0; i < MAX_HISTORY; i++) {
494 _stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
495 // sprintf(name, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
496 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_cart_path[drv][i], config_path);
501 WritePrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), config.initial_disk_dir, config_path);
502 for(drv = 0; drv < MAX_FD; drv++) {
503 for(i = 0; i < MAX_HISTORY; i++) {
505 // sprintf(name, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
506 _stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
507 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_disk_path[drv][i], config_path);
512 WritePrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"), config.initial_quickdisk_dir, config_path);
513 for(drv = 0; drv < MAX_QD; drv++) {
514 for(i = 0; i < MAX_HISTORY; i++) {
516 _stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
517 // sprintf(name, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
518 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_quickdisk_path[drv][i], config_path);
523 WritePrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), config.initial_tape_dir, config_path);
524 for(i = 0; i < MAX_HISTORY; i++) {
526 // sprintf(name, _T("RecentTapePath1_%d"), i + 1);
527 _stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
528 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_tape_path[i], config_path);
531 #ifdef USE_LASER_DISC
532 WritePrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), config.initial_laser_disc_dir, config_path);
533 for(int i = 0; i < MAX_HISTORY; i++) {
535 // sprintf(name, _T("RecentLaserDiscPath1_%d"), i + 1);
536 _stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
537 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_laser_disc_path[i], config_path);
540 #ifdef USE_BINARY_FILE1
541 WritePrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), config.initial_binary_dir, config_path);
542 for(drv = 0; drv < MAX_BINARY; drv++) {
543 for(i = 0; i < MAX_HISTORY; i++) {
545 // sprintf(name, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
546 _stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
547 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_binary_path[drv][i], config_path);
553 #if !(defined(USE_BITMAP) || defined(USE_LED))
554 WritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
555 WritePrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
556 WritePrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
557 WritePrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
559 WritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
561 #ifdef USE_MONITOR_TYPE
562 WritePrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
564 #ifdef USE_CRT_FILTER
565 WritePrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
568 WritePrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
570 #ifdef USE_SCREEN_ROTATE
571 WritePrivateProfileBool(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
575 WritePrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
576 WritePrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
577 #ifdef USE_SOUND_DEVICE_TYPE
578 WritePrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
580 #if defined(DATAREC_SOUND) && defined(USE_TAPE)
581 // WritePrivateProfileBool(_T("Sound"), _T("CMT"), config.cmt_sound, config_path);
582 // WritePrivateProfileInt(_T("Sound"), _T("CMTVolume"), config.cmt_volume, config_path);
584 #if defined(_USE_AGAR) || defined(_USE_QT)
585 config_path->Fclose();
587 AGAR_DebugLog(AGAR_LOG_INFO, "Write done.");
592 #define STATE_VERSION 1
594 void save_config_state(void *f)
596 FILEIO *state_fio = (FILEIO *)f;
599 state_fio->FputUint32(STATE_VERSION);
602 state_fio->FputInt32(config.boot_mode);
605 state_fio->FputInt32(config.cpu_type);
608 state_fio->FputUint32(config.dipswitch);
610 #ifdef USE_DEVICE_TYPE
611 state_fio->FputInt32(config.device_type);
613 #ifdef USE_DRIVE_TYPE
614 state_fio->FputInt32(config.drive_type);
617 for(drv = 0; drv < 8; drv++) state_fio->FputBool(config.ignore_crc[drv]);
619 #ifdef USE_MONITOR_TYPE
620 state_fio->FputInt32(config.monitor_type);
622 #ifdef USE_SOUND_DEVICE_TYPE
623 state_fio->FputInt32(config.sound_device_type);
627 bool load_config_state(void *f)
629 FILEIO *state_fio = (FILEIO *)f;
632 if(state_fio->FgetUint32() != STATE_VERSION) {
636 config.boot_mode = state_fio->FgetInt32();
639 config.cpu_type = state_fio->FgetInt32();
642 config.dipswitch = state_fio->FgetUint32();
644 #ifdef USE_DEVICE_TYPE
645 config.device_type = state_fio->FgetInt32();
647 #ifdef USE_DRIVE_TYPE
648 config.drive_type = state_fio->FgetInt32();
651 for(drv = 0; drv < 8; drv++) config.ignore_crc[drv] = state_fio->FgetBool();
653 #ifdef USE_MONITOR_TYPE
654 config.monitor_type = state_fio->FgetInt32();
656 #ifdef USE_SOUND_DEVICE_TYPE
657 config.sound_device_type = state_fio->FgetInt32();