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 #ifdef USE_MONITOR_TYPE
391 config.monitor_type = GetPrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
393 #ifdef USE_CRT_FILTER
394 config.crt_filter = GetPrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
397 config.scan_line = GetPrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
400 #ifdef USE_SCREEN_ROTATE
401 config.rotate_type = GetPrivateProfileBool(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
405 config.sound_frequency = GetPrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
406 config.sound_latency = GetPrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
407 #ifdef USE_SOUND_DEVICE_TYPE
408 config.sound_device_type = GetPrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
410 #if defined(DATAREC_SOUND) && defined(USE_TAPE)
411 // config.cmt_sound = GetPrivateProfileBool(_T("Sound"), _T("CMT"), false, config_path);
412 // config.cmt_volume = GetPrivateProfileInt(_T("Sound"), _T("CMTVolume"), 0x1800, config_path);
414 // GetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
416 #if defined(_USE_AGAR) || defined(_USE_QT)
417 config_path->Fclose();
419 AGAR_DebugLog(AGAR_LOG_INFO, "Read Done.");
427 #if defined(_USE_AGAR) || defined(_USE_QT)
428 char app_path2[_MAX_PATH], *ptr;
429 FILEIO *config_path = new FILEIO();
432 //GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
433 memset(app_path2, 0x00, _MAX_PATH);
434 cpp_confdir.copy(app_path2, _MAX_PATH, 0);
436 strncat(app_path2, CONFIG_NAME, _MAX_PATH);
437 strncat(app_path2, ".ini", _MAX_PATH);
439 AGAR_DebugLog(AGAR_LOG_INFO, "Try to write config: %s", app_path2);
440 if(config_path->Fopen(app_path2, FILEIO_WRITE_ASCII) != true) return;
442 _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH], *ptr;
443 memset(config_path, 0x00, _MAX_PATH);
444 GetModuleFileName(NULL, config_path, _MAX_PATH);
445 GetFullPathName(config_path, _MAX_PATH, app_path, &ptr);
447 _stprintf_s(config_path, _MAX_PATH, _T("%s%s.ini"), app_path, _T(CONFIG_NAME));
450 WritePrivateProfileBool(_T("Control"), _T("UseDirectInput"), config.use_direct_input, config_path);
451 WritePrivateProfileBool(_T("Control"), _T("DisableDwm"), config.disable_dwm, config_path);
453 # ifdef USE_BOOT_MODE
454 WritePrivateProfileInt(_T("Control"), _T("BootMode"), config.boot_mode, config_path);
457 WritePrivateProfileInt(_T("Control"), _T("CPUType"), config.cpu_type, config_path);
460 WritePrivateProfileInt(_T("Control"), _T("DipSwitch"), config.dipswitch, config_path);
462 #ifdef USE_DEVICE_TYPE
463 WritePrivateProfileInt(_T("Control"), _T("DeviceType"), config.device_type, config_path);
465 #ifdef USE_DRIVE_TYPE
466 WritePrivateProfileInt(_T("Control"), _T("DriveType"), config.drive_type, config_path);
471 for(drv = 0; drv < 8; drv++) {
472 memset(_tag, 0x00, sizeof(_tag));
473 _stprintf_s(_tag, 64, _T("IgnoreCRC_%d"), drv + 1);
474 WritePrivateProfileBool(_T("Control"), _tag, config.ignore_crc[drv], config_path);
480 WritePrivateProfileBool(_T("Control"), _T("TapeSound"), config.tape_sound, config_path);
481 WritePrivateProfileBool(_T("Control"), _T("WaveShaper"), config.wave_shaper, config_path);
482 WritePrivateProfileBool(_T("Control"), _T("DirectLoadMZT"), config.direct_load_mzt, config_path);
483 WritePrivateProfileBool(_T("Control"), _T("BaudHigh"), config.baud_high, config_path);
488 WritePrivateProfileString(_T("RecentFiles"), _T("InitialCartDir"), config.initial_cart_dir, config_path);
489 for(drv = 0; drv < MAX_CART; drv++) {
490 for(i = 0; i < MAX_HISTORY; i++) {
492 _stprintf_s(name, 64, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
493 // sprintf(name, _T("RecentCartPath%d_%d"), drv + 1, i + 1);
494 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_cart_path[drv][i], config_path);
499 WritePrivateProfileString(_T("RecentFiles"), _T("InitialDiskDir"), config.initial_disk_dir, config_path);
500 for(drv = 0; drv < MAX_FD; drv++) {
501 for(i = 0; i < MAX_HISTORY; i++) {
503 // sprintf(name, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
504 _stprintf_s(name, 64, _T("RecentDiskPath%d_%d"), drv + 1, i + 1);
505 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_disk_path[drv][i], config_path);
510 WritePrivateProfileString(_T("RecentFiles"), _T("InitialQuickDiskDir"), config.initial_quickdisk_dir, config_path);
511 for(drv = 0; drv < MAX_QD; drv++) {
512 for(i = 0; i < MAX_HISTORY; i++) {
514 _stprintf_s(name, 64, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
515 // sprintf(name, _T("RecentQuickDiskPath%d_%d"), drv + 1, i + 1);
516 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_quickdisk_path[drv][i], config_path);
521 WritePrivateProfileString(_T("RecentFiles"), _T("InitialTapeDir"), config.initial_tape_dir, config_path);
522 for(i = 0; i < MAX_HISTORY; i++) {
524 // sprintf(name, _T("RecentTapePath1_%d"), i + 1);
525 _stprintf_s(name, 64, _T("RecentTapePath1_%d"), i + 1);
526 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_tape_path[i], config_path);
529 #ifdef USE_LASER_DISC
530 WritePrivateProfileString(_T("RecentFiles"), _T("InitialLaserDiscDir"), config.initial_laser_disc_dir, config_path);
531 for(int i = 0; i < MAX_HISTORY; i++) {
533 // sprintf(name, _T("RecentLaserDiscPath1_%d"), i + 1);
534 _stprintf_s(name, 64, _T("RecentLaserDiscPath1_%d"), i + 1);
535 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_laser_disc_path[i], config_path);
538 #ifdef USE_BINARY_FILE1
539 WritePrivateProfileString(_T("RecentFiles"), _T("InitialBinaryDir"), config.initial_binary_dir, config_path);
540 for(drv = 0; drv < MAX_BINARY; drv++) {
541 for(i = 0; i < MAX_HISTORY; i++) {
543 // sprintf(name, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
544 _stprintf_s(name, 64, _T("RecentBinaryPath%d_%d"), drv + 1, i + 1);
545 WritePrivateProfileString(_T("RecentFiles"), name, config.recent_binary_path[drv][i], config_path);
551 #if !(defined(USE_BITMAP) || defined(USE_LED))
552 WritePrivateProfileInt(_T("Screen"), _T("WindowMode"), config.window_mode, config_path);
553 WritePrivateProfileBool(_T("Screen"), _T("UseD3D9"), config.use_d3d9, config_path);
554 WritePrivateProfileBool(_T("Screen"), _T("WaitVSync"), config.wait_vsync, config_path);
555 WritePrivateProfileInt(_T("Screen"), _T("StretchType"), config.stretch_type, config_path);
557 #ifdef USE_MONITOR_TYPE
558 WritePrivateProfileInt(_T("Screen"), _T("MonitorType"), config.monitor_type, config_path);
560 #ifdef USE_CRT_FILTER
561 WritePrivateProfileBool(_T("Screen"), _T("CRTFilter"), config.crt_filter, config_path);
564 WritePrivateProfileBool(_T("Screen"), _T("ScanLine"), config.scan_line, config_path);
566 #ifdef USE_SCREEN_ROTATE
567 WritePrivateProfileBool(_T("Screen"), _T("RotateType"), config.rotate_type, config_path);
571 WritePrivateProfileInt(_T("Sound"), _T("Frequency"), config.sound_frequency, config_path);
572 WritePrivateProfileInt(_T("Sound"), _T("Latency"), config.sound_latency, config_path);
573 #ifdef USE_SOUND_DEVICE_TYPE
574 WritePrivateProfileInt(_T("Sound"), _T("DeviceType"), config.sound_device_type, config_path);
576 #if defined(DATAREC_SOUND) && defined(USE_TAPE)
577 // WritePrivateProfileBool(_T("Sound"), _T("CMT"), config.cmt_sound, config_path);
578 // WritePrivateProfileInt(_T("Sound"), _T("CMTVolume"), config.cmt_volume, config_path);
580 #if defined(_USE_AGAR) || defined(_USE_QT)
581 config_path->Fclose();
583 AGAR_DebugLog(AGAR_LOG_INFO, "Write done.");
588 #define STATE_VERSION 1
590 void save_config_state(void *f)
592 FILEIO *state_fio = (FILEIO *)f;
595 state_fio->FputUint32(STATE_VERSION);
598 state_fio->FputInt32(config.boot_mode);
601 state_fio->FputInt32(config.cpu_type);
604 state_fio->FputUint32(config.dipswitch);
606 #ifdef USE_DEVICE_TYPE
607 state_fio->FputInt32(config.device_type);
609 #ifdef USE_DRIVE_TYPE
610 state_fio->FputInt32(config.drive_type);
613 for(drv = 0; drv < 8; drv++) state_fio->FputBool(config.ignore_crc[drv]);
615 #ifdef USE_MONITOR_TYPE
616 state_fio->FputInt32(config.monitor_type);
618 #ifdef USE_SOUND_DEVICE_TYPE
619 state_fio->FputInt32(config.sound_device_type);
623 bool load_config_state(void *f)
625 FILEIO *state_fio = (FILEIO *)f;
628 if(state_fio->FgetUint32() != STATE_VERSION) {
632 config.boot_mode = state_fio->FgetInt32();
635 config.cpu_type = state_fio->FgetInt32();
638 config.dipswitch = state_fio->FgetUint32();
640 #ifdef USE_DEVICE_TYPE
641 config.device_type = state_fio->FgetInt32();
643 #ifdef USE_DRIVE_TYPE
644 config.drive_type = state_fio->FgetInt32();
647 for(drv = 0; drv < 8; drv++) config.ignore_crc[drv] = state_fio->FgetBool();
649 #ifdef USE_MONITOR_TYPE
650 config.monitor_type = state_fio->FgetInt32();
652 #ifdef USE_SOUND_DEVICE_TYPE
653 config.sound_device_type = state_fio->FgetInt32();