void NesConfigManager::readConfigValue( const char *name, const char* value ) { ConfigManager::readConfigValue( name, value ); Nes &nes = (Nes&)getEmulator(); if( strcmp( name, "nes.game_genie" ) == 0 ) { nes.setGameGenieEnabled( Util_sscandec( value ) ); } else if( strcmp( name, "nes.wiimote_mode" ) == 0 ) { nes.setWiimoteMode( Util_sscandec( value ) ); } else if( strcmp( name, "nes.center_adjust" ) == 0 ) { nes.setCenterAdjust( Util_sscandec( value ) ); } else if( strcmp( name, "nes.sensitivity" ) == 0 ) { nes.setSensitivity( Util_sscandec( value ) ); } else if( strcmp( name, "nes.smoothing" ) == 0 ) { nes.setSmoothing( Util_sscandec( value ) ); } }
void DatabaseManager::readEntryValue( dbEntry *entry, const char* name, const char* value ) { if( !entry ) return; if( !strcmp( name, "wiimoteSupported" ) ) { entry->wiimoteSupported = Util_sscandec( value ); } else if( !strcmp( name, "frameSkip" ) ) { entry->frameSkip = Util_sscandec( value ); } }
void PLATFORM_Initialise(int *argc, char *argv[]) { int i, j; int help_only = FALSE; int scale = 2; for (i = j = 1; i < *argc; i++) { if (strcmp(argv[i], "-scale") == 0) { scale = Util_sscandec(argv[++i]); } else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-scale <n> Scale width and height by <n>"); } argv[j++] = argv[i]; } } *argc = j; if(!help_only) { int config[JAVANVM_InitGraphicsSIZE]; config[JAVANVM_InitGraphicsScalew] = scale; config[JAVANVM_InitGraphicsScaleh] = scale; config[JAVANVM_InitGraphicsScreen_WIDTH] = Screen_WIDTH; config[JAVANVM_InitGraphicsScreen_HEIGHT] = Screen_HEIGHT; config[JAVANVM_InitGraphicsATARI_VISIBLE_WIDTH] = 336; config[JAVANVM_InitGraphicsATARI_LEFT_MARGIN] = 24; JAVANVM_InitGraphics((void *)&config[0]); JAVANVM_InitPalette((void *)&Colours_table[0]); #ifdef SOUND SoundSetup(); #endif } return; }
int SDL_VIDEO_ReadConfig(char *option, char *parameters) { if (strcmp(option, "SCANLINES_PERCENTAGE") == 0) { int value = Util_sscandec(parameters); if (value < 0 || value > 100) return FALSE; else { SDL_VIDEO_scanlines_percentage = value; } } else if (strcmp(option, "INTERPOLATE_SCANLINES") == 0) return (SDL_VIDEO_interpolate_scanlines = Util_sscanbool(parameters)) != -1; else if (strcmp(option, "VIDEO_VSYNC") == 0) return (SDL_VIDEO_vsync = Util_sscanbool(parameters)) != -1; #if HAVE_OPENGL else if (strcmp(option, "VIDEO_ACCEL") == 0) return (currently_opengl = SDL_VIDEO_opengl = Util_sscanbool(parameters)) != -1; else if (SDL_VIDEO_GL_ReadConfig(option, parameters)) { } #endif /* HAVE_OPENGL */ else if (SDL_VIDEO_SW_ReadConfig(option, parameters)) { } else return FALSE; return TRUE; }
void MegaDriveConfigManager::readConfigValue( const char *name, const char* value ) { ConfigManager::readConfigValue( name, value ); MegaDrive &emu = (MegaDrive&)getEmulator(); if( strcmp( name, "md.region" ) == 0 ) { emu.setConsoleRegion( Util_sscandec( value ) ); } }
int Util_sscansdec(char const *s, int *dest) { int minus = FALSE; switch(*s) { case '-': minus = TRUE; /* Fallthrough! */ case '+': ++s; } *dest = Util_sscandec(s); if (*dest == -1) return FALSE; if (minus) *dest = -*dest; return TRUE; }
/* For better handling of the PLATFORM_Configure-recognition... Takes a keySym as integer-string and fills the value into the retval referentially. Authors: B.Schreiber, A.Martinez fixed and cleaned up by joy */ static int SDLKeyBind(int *retval, char *sdlKeySymIntStr) { int ksym; if (retval == NULL || sdlKeySymIntStr == NULL) { return FALSE; } /* make an int out of the keySymIntStr... */ ksym = Util_sscandec(sdlKeySymIntStr); if (ksym > SDLK_FIRST && ksym < SDLK_LAST) { *retval = ksym; return TRUE; } else { return FALSE; } }
void ConfigManager::readConfigValue( const char *name, const char* value ) { Emulator& emu = getEmulator(); char buff[512]; snprintf( buff, sizeof(buff), "%s.screen_width", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.getScreenSize()->w = Util_sscandec( value ); } snprintf( buff, sizeof(buff), "%s.screen_height", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.getScreenSize()->h = Util_sscandec( value ); } if( emu.isRotationSupported() ) { snprintf( buff, sizeof(buff), "%s.rotscreen_width", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.getRotatedScreenSize()->w = Util_sscandec( value ); } snprintf( buff, sizeof(buff), "%s.rotscreen_height", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.getRotatedScreenSize()->h = Util_sscandec( value ); } } snprintf( buff, sizeof(buff), "%s.frameskip", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.setFrameSkip( Util_sscandec( value ) ); } snprintf( buff, sizeof(buff), "%s.doublestrike", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.setDoubleStrikeMode( Util_sscandec( value ) ); } snprintf( buff, sizeof(buff), "%s.volume", emu.getKey() ); if( strcmp( name, buff ) == 0 ) { emu.setVolume( Util_sscandec( value ) ); } }
int Atari800_Initialise(int *argc, char *argv[]) { int i, j; const char *rom_filename = NULL; const char *rom2_filename = NULL; const char *run_direct = NULL; #ifndef BASIC const char *state_file = NULL; #endif #ifdef __PLUS /* Atari800Win PLus doesn't use configuration files, it reads configuration from the Registry */ #ifndef _WX_ int bUpdateRegistry = (*argc > 1); #endif int bTapeFile = FALSE; int nCartType = CARTRIDGE_type; /* It is necessary because of the CARTRIDGE_Start (there must not be the registry-read value available at startup) */ CARTRIDGE_type = CARTRIDGE_NONE; #ifndef _WX_ /* Print the time info in the "Log file" window */ Misc_PrintTime(); /* Force screen refreshing */ g_nTestVal = _GetRefreshRate() - 1; g_ulAtariState = ATARI_UNINITIALIZED; #endif /* _WX_ */ #elif defined(MACOSX) #else /* __PLUS */ const char *rtconfig_filename = NULL; int got_config; int help_only = FALSE; if (*argc > 1) { for (i = j = 1; i < *argc; i++) { if (strcmp(argv[i], "-config") == 0) { rtconfig_filename = argv[++i]; } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) { printf("%s\n", Atari800_TITLE); return FALSE; } else if (strcmp(argv[i], "--usage") == 0 || strcmp(argv[i], "--help") == 0) { argv[j++] = "-help"; } else if (strcmp(argv[i], "-verbose") == 0) { verbose = TRUE; } else { argv[j++] = argv[i]; } } *argc = j; } got_config = CFG_LoadConfig(rtconfig_filename); /* try to find ROM images if the configuration file is not found or it does not specify some ROM paths (blank paths count as specified) */ CFG_FindROMImages("", TRUE); /* current directory */ #if defined(unix) || defined(__unix__) || defined(__linux__) CFG_FindROMImages("/usr/share/atari800", TRUE); #endif if (*argc > 0 && argv[0] != NULL) { char atari800_exe_dir[FILENAME_MAX]; char atari800_exe_rom_dir[FILENAME_MAX]; /* the directory of the Atari800 program */ Util_splitpath(argv[0], atari800_exe_dir, NULL); CFG_FindROMImages(atari800_exe_dir, TRUE); /* "rom" and "ROM" subdirectories of this directory */ Util_catpath(atari800_exe_rom_dir, atari800_exe_dir, "rom"); CFG_FindROMImages(atari800_exe_rom_dir, TRUE); /* skip "ROM" on systems that are known to be case-insensitive */ #if !defined(DJGPP) && !defined(WIN32) Util_catpath(atari800_exe_rom_dir, atari800_exe_dir, "ROM"); CFG_FindROMImages(atari800_exe_rom_dir, TRUE); #endif } /* finally if nothing is found, set some defaults to make the configuration file easier to edit */ if (Util_filenamenotset(CFG_osa_filename)) strcpy(CFG_osa_filename, "atariosa.rom"); if (Util_filenamenotset(CFG_osb_filename)) strcpy(CFG_osb_filename, "atariosb.rom"); if (Util_filenamenotset(CFG_xlxe_filename)) strcpy(CFG_xlxe_filename, "atarixl.rom"); if (Util_filenamenotset(CFG_5200_filename)) strcpy(CFG_5200_filename, "5200.rom"); if (Util_filenamenotset(CFG_basic_filename)) strcpy(CFG_basic_filename, "ataribas.rom"); /* if no configuration file read, try to save one with the defaults */ if (!got_config) CFG_WriteConfig(); #endif /* __PLUS */ for (i = j = 1; i < *argc; i++) { if (strcmp(argv[i], "-atari") == 0) { if (Atari800_machine_type != Atari800_MACHINE_OSA) { Atari800_machine_type = Atari800_MACHINE_OSB; MEMORY_ram_size = 48; } } else if (strcmp(argv[i], "-xl") == 0) { Atari800_machine_type = Atari800_MACHINE_XLXE; MEMORY_ram_size = 64; } else if (strcmp(argv[i], "-xe") == 0) { Atari800_machine_type = Atari800_MACHINE_XLXE; MEMORY_ram_size = 128; } else if (strcmp(argv[i], "-320xe") == 0) { Atari800_machine_type = Atari800_MACHINE_XLXE; MEMORY_ram_size = MEMORY_RAM_320_COMPY_SHOP; } else if (strcmp(argv[i], "-rambo") == 0) { Atari800_machine_type = Atari800_MACHINE_XLXE; MEMORY_ram_size = MEMORY_RAM_320_RAMBO; } else if (strcmp(argv[i], "-5200") == 0) { Atari800_machine_type = Atari800_MACHINE_5200; MEMORY_ram_size = 16; } else if (strcmp(argv[i], "-nobasic") == 0) Atari800_disable_basic = TRUE; else if (strcmp(argv[i], "-basic") == 0) Atari800_disable_basic = FALSE; else if (strcmp(argv[i], "-nopatch") == 0) ESC_enable_sio_patch = FALSE; else if (strcmp(argv[i], "-nopatchall") == 0) #ifdef D_PATCH ESC_enable_sio_patch = Devices_enable_h_patch = Devices_enable_d_patch = Devices_enable_p_patch = Devices_enable_r_patch = FALSE; #else ESC_enable_sio_patch = Devices_enable_h_patch = Devices_enable_p_patch = Devices_enable_r_patch = FALSE; #endif else if (strcmp(argv[i], "-pal") == 0) Atari800_tv_mode = Atari800_TV_PAL; else if (strcmp(argv[i], "-ntsc") == 0) Atari800_tv_mode = Atari800_TV_NTSC; else if (strcmp(argv[i], "-a") == 0) { Atari800_machine_type = Atari800_MACHINE_OSA; MEMORY_ram_size = 48; } else if (strcmp(argv[i], "-b") == 0) { Atari800_machine_type = Atari800_MACHINE_OSB; MEMORY_ram_size = 48; } else if (strcmp(argv[i], "-emuos") == 0) emuos_mode = 2; else if (strcmp(argv[i], "-c") == 0) { if (MEMORY_ram_size == 48) MEMORY_ram_size = 52; } else { /* parameters that take additional argument follow here */ int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-osa_rom") == 0) { if (i_a) Util_strlcpy(CFG_osa_filename, argv[++i], sizeof(CFG_osa_filename)); else a_m = TRUE; } #if 0 /* TBD what to do with R device */ #ifdef R_IO_DEVICE else if (strcmp(argv[i], "-rdevice") == 0) { Devices_enable_r_patch = TRUE; #ifdef R_SERIAL if (i_a && i + 2 < *argc && *argv[i + 1] != '-') { /* optional serial device name */ struct stat statbuf; if (! stat(argv[i + 1], &statbuf)) { if (S_ISCHR(statbuf.st_mode)) { /* only accept devices as serial device */ Util_strlcpy(RDevice_serial_device, argv[++i], FILENAME_MAX); RDevice_serial_enabled = TRUE; } } } #endif /* R_SERIAL */ } #endif #endif else if (strcmp(argv[i], "-osb_rom") == 0) { if (i_a) Util_strlcpy(CFG_osb_filename, argv[++i], sizeof(CFG_osb_filename)); else a_m = TRUE; } else if (strcmp(argv[i], "-xlxe_rom") == 0) { if (i_a) Util_strlcpy(CFG_xlxe_filename, argv[++i], sizeof(CFG_xlxe_filename)); else a_m = TRUE; } else if (strcmp(argv[i], "-5200_rom") == 0) { if (i_a) Util_strlcpy(CFG_5200_filename, argv[++i], sizeof(CFG_5200_filename)); else a_m = TRUE; } else if (strcmp(argv[i], "-basic_rom") == 0) { if (i_a) Util_strlcpy(CFG_basic_filename, argv[++i], sizeof(CFG_basic_filename)); else a_m = TRUE; } else if (strcmp(argv[i], "-cart") == 0) { if (i_a) rom_filename = argv[++i]; else a_m = TRUE; } else if (strcmp(argv[i], "-cart2") == 0) { if (i_a) rom2_filename = argv[++i]; else a_m = TRUE; } else if (strcmp(argv[i], "-run") == 0) { if (i_a) run_direct = argv[++i]; else a_m = TRUE; } else if (strcmp(argv[i], "-mosaic") == 0) { int total_ram = Util_sscandec(argv[++i]); MEMORY_mosaic_enabled = TRUE; MEMORY_mosaic_maxbank = (total_ram - 48)/4 - 1; if (((total_ram - 48) % 4 != 0) || (MEMORY_mosaic_maxbank > 0x3e) || (MEMORY_mosaic_maxbank < 0)) { Log_print("Invalid Mosaic total RAM size"); return FALSE; } if (MEMORY_axlon_enabled) { Log_print("Axlon and Mosaic can not both be enabled, because they are incompatible"); return FALSE; } } else if (strcmp(argv[i], "-axlon") == 0) { int total_ram = Util_sscandec(argv[++i]); int banks = ((total_ram) - 32) / 16; MEMORY_axlon_enabled = TRUE; if (((total_ram - 32) % 16 != 0) || ((banks != 8) && (banks != 16) && (banks != 32) && (banks != 64) && (banks != 128) && (banks != 256))) { Log_print("Invalid Axlon total RAM size"); return FALSE; } if (MEMORY_mosaic_enabled) { Log_print("Axlon and Mosaic can not both be enabled, because they are incompatible"); return FALSE; } MEMORY_axlon_bankmask = banks - 1; } else if (strcmp(argv[i], "-axlon0f") == 0) { MEMORY_axlon_0f_mirror = TRUE; } #ifndef BASIC /* The BASIC version does not support state files, because: 1. It has no ability to save state files, because of lack of UI. 2. It uses a simplified emulation, so the state files would be incompatible with other versions. 3. statesav is not compiled in to make the executable smaller. */ else if (strcmp(argv[i], "-state") == 0) { if (i_a) state_file = argv[++i]; else a_m = TRUE; } else if (strcmp(argv[i], "-refresh") == 0) { if (i_a) { Atari800_refresh_rate = Util_sscandec(argv[++i]); if (Atari800_refresh_rate < 1) { Log_print("Invalid refresh rate, using 1"); Atari800_refresh_rate = 1; } } else a_m = TRUE; } #endif /* BASIC */ #ifdef STEREO_SOUND else if (strcmp(argv[i], "-stereo") == 0) { POKEYSND_stereo_enabled = TRUE; } else if (strcmp(argv[i], "-nostereo") == 0) { POKEYSND_stereo_enabled = FALSE; } #endif /* STEREO_SOUND */ else { /* all options known to main module tried but none matched */ if (strcmp(argv[i], "-help") == 0) { #if !defined(__PLUS) && !defined(MACOSX) help_only = TRUE; Log_print("\t-config <file> Specify Alternate Configuration File"); #endif Log_print("\t-atari Emulate Atari 800"); Log_print("\t-xl Emulate Atari 800XL"); Log_print("\t-xe Emulate Atari 130XE"); Log_print("\t-320xe Emulate Atari 320XE (COMPY SHOP)"); Log_print("\t-rambo Emulate Atari 320XE (RAMBO)"); Log_print("\t-5200 Emulate Atari 5200 Games System"); Log_print("\t-nobasic Turn off Atari BASIC ROM"); Log_print("\t-basic Turn on Atari BASIC ROM"); Log_print("\t-pal Enable PAL TV mode"); Log_print("\t-ntsc Enable NTSC TV mode"); Log_print("\t-osa_rom <file> Load OS A ROM from file"); Log_print("\t-osb_rom <file> Load OS B ROM from file"); Log_print("\t-xlxe_rom <file> Load XL/XE ROM from file"); Log_print("\t-5200_rom <file> Load 5200 ROM from file"); Log_print("\t-basic_rom <fil> Load BASIC ROM from file"); Log_print("\t-cart <file> Install cartridge (raw or CART format)"); Log_print("\t-run <file> Run Atari program (COM, EXE, XEX, BAS, LST)"); #ifndef BASIC Log_print("\t-state <file> Load saved-state file"); Log_print("\t-refresh <rate> Specify screen refresh rate"); #endif Log_print("\t-nopatch Don't patch SIO routine in OS"); Log_print("\t-nopatchall Don't patch OS at all, H: device won't work"); Log_print("\t-a Use OS A"); Log_print("\t-b Use OS B"); Log_print("\t-c Enable RAM between 0xc000 and 0xcfff in Atari 800"); Log_print("\t-axlon <n> Use Atari 800 Axlon memory expansion: <n> k total RAM"); Log_print("\t-axlon0f Use Axlon shadow at 0x0fc0-0x0fff"); Log_print("\t-mosaic <n> Use 400/800 Mosaic memory expansion: <n> k total RAM"); #ifdef R_IO_DEVICE Log_print("\t-rdevice [<dev>] Enable R: emulation (using serial device <dev>)"); #endif Log_print("\t-v Show version/release number"); } /* copy this option for platform/module specific evaluation */ argv[j++] = argv[i]; } /* this is the end of the additional argument check */ if (a_m) { printf("Missing argument for '%s'\n", argv[i]); return FALSE; } } }
int CFG_LoadConfig(const char *alternate_config_filename) { FILE *fp; const char *fname = rtconfig_filename; char string[256]; #ifndef BASIC int was_obsolete_dir = FALSE; #endif #ifdef SUPPORTS_PLATFORM_CONFIGINIT PLATFORM_ConfigInit(); #endif /* if alternate config filename is passed then use it */ if (alternate_config_filename != NULL && *alternate_config_filename > 0) { Util_strlcpy(rtconfig_filename, alternate_config_filename, FILENAME_MAX); } /* else use the default config name under the HOME folder */ else { char *home = getenv("HOME"); if (home != NULL) Util_catpath(rtconfig_filename, home, DEFAULT_CFG_NAME); else strcpy(rtconfig_filename, DEFAULT_CFG_NAME); } fp = fopen(fname, "r"); if (fp == NULL) { Log_print("User config file '%s' not found.", rtconfig_filename); #ifdef SYSTEM_WIDE_CFG_FILE /* try system wide config file */ fname = SYSTEM_WIDE_CFG_FILE; Log_print("Trying system wide config file: %s", fname); fp = fopen(fname, "r"); #endif if (fp == NULL) { Log_print("No configuration file found, will create fresh one from scratch:"); return FALSE; } } if (fgets(string, sizeof(string), fp) != NULL) { Log_print("Using Atari800 config file: %s\nCreated by %s", fname, string); } while (fgets(string, sizeof(string), fp)) { char *ptr; Util_chomp(string); ptr = strchr(string, '='); if (ptr != NULL) { *ptr++ = '\0'; Util_trim(string); Util_trim(ptr); if (SYSROM_ReadConfig(string, ptr)) { } #ifdef BASIC else if (strcmp(string, "ATARI_FILES_DIR") == 0 || strcmp(string, "SAVED_FILES_DIR") == 0 || strcmp(string, "DISK_DIR") == 0 || strcmp(string, "ROM_DIR") == 0 || strcmp(string, "EXE_DIR") == 0 || strcmp(string, "STATE_DIR") == 0) /* do nothing */; #else else if (strcmp(string, "ATARI_FILES_DIR") == 0) { if (UI_n_atari_files_dir >= UI_MAX_DIRECTORIES) Log_print("All ATARI_FILES_DIR slots used!"); else Util_strlcpy(UI_atari_files_dir[UI_n_atari_files_dir++], ptr, FILENAME_MAX); } else if (strcmp(string, "SAVED_FILES_DIR") == 0) { if (UI_n_saved_files_dir >= UI_MAX_DIRECTORIES) Log_print("All SAVED_FILES_DIR slots used!"); else Util_strlcpy(UI_saved_files_dir[UI_n_saved_files_dir++], ptr, FILENAME_MAX); } else if (strcmp(string, "DISK_DIR") == 0 || strcmp(string, "ROM_DIR") == 0 || strcmp(string, "EXE_DIR") == 0 || strcmp(string, "STATE_DIR") == 0) { /* ignore blank and "." values */ if (ptr[0] != '\0' && (ptr[0] != '.' || ptr[1] != '\0')) was_obsolete_dir = TRUE; } #endif else if (strcmp(string, "H1_DIR") == 0) Util_strlcpy(Devices_atari_h_dir[0], ptr, FILENAME_MAX); else if (strcmp(string, "H2_DIR") == 0) Util_strlcpy(Devices_atari_h_dir[1], ptr, FILENAME_MAX); else if (strcmp(string, "H3_DIR") == 0) Util_strlcpy(Devices_atari_h_dir[2], ptr, FILENAME_MAX); else if (strcmp(string, "H4_DIR") == 0) Util_strlcpy(Devices_atari_h_dir[3], ptr, FILENAME_MAX); else if (strcmp(string, "HD_READ_ONLY") == 0) Devices_h_read_only = Util_sscandec(ptr); else if (strcmp(string, "PRINT_COMMAND") == 0) { if (!Devices_SetPrintCommand(ptr)) Log_print("Unsafe PRINT_COMMAND ignored"); } else if (strcmp(string, "SCREEN_REFRESH_RATIO") == 0) Atari800_refresh_rate = Util_sscandec(ptr); else if (strcmp(string, "DISABLE_BASIC") == 0) Atari800_disable_basic = Util_sscanbool(ptr); else if (strcmp(string, "ENABLE_SIO_PATCH") == 0) { ESC_enable_sio_patch = Util_sscanbool(ptr); } else if (strcmp(string, "ENABLE_H_PATCH") == 0) { Devices_enable_h_patch = Util_sscanbool(ptr); } else if (strcmp(string, "ENABLE_P_PATCH") == 0) { Devices_enable_p_patch = Util_sscanbool(ptr); } else if (strcmp(string, "ENABLE_R_PATCH") == 0) { Devices_enable_r_patch = Util_sscanbool(ptr); } else if (strcmp(string, "ENABLE_NEW_POKEY") == 0) { #ifdef SOUND POKEYSND_enable_new_pokey = Util_sscanbool(ptr); #endif /* SOUND */ } else if (strcmp(string, "STEREO_POKEY") == 0) { #ifdef STEREO_SOUND POKEYSND_stereo_enabled = Util_sscanbool(ptr); #ifdef SOUND_THIN_API Sound_desired.channels = POKEYSND_stereo_enabled ? 2 : 1; #endif /* SOUND_THIN_API */ #endif /* STEREO_SOUND */ } else if (strcmp(string, "SPEAKER_SOUND") == 0) { #ifdef CONSOLE_SOUND POKEYSND_console_sound_enabled = Util_sscanbool(ptr); #endif } else if (strcmp(string, "SERIO_SOUND") == 0) { #ifdef SERIO_SOUND POKEYSND_serio_sound_enabled = Util_sscanbool(ptr); #endif } else if (strcmp(string, "MACHINE_TYPE") == 0) { if (strcmp(ptr, "Atari 400/800") == 0 || /* Also recognise legacy values of this parameter */ strcmp(ptr, "Atari OS/A") == 0 || strcmp(ptr, "Atari OS/B") == 0) Atari800_machine_type = Atari800_MACHINE_800; else if (strcmp(ptr, "Atari XL/XE") == 0) Atari800_machine_type = Atari800_MACHINE_XLXE; else if (strcmp(ptr, "Atari 5200") == 0) Atari800_machine_type = Atari800_MACHINE_5200; else Log_print("Invalid machine type: %s", ptr); } else if (strcmp(string, "RAM_SIZE") == 0) { if (strcmp(ptr, "320 (RAMBO)") == 0) MEMORY_ram_size = MEMORY_RAM_320_RAMBO; else if (strcmp(ptr, "320 (COMPY SHOP)") == 0) MEMORY_ram_size = MEMORY_RAM_320_COMPY_SHOP; else { int size = Util_sscandec(ptr); if (MEMORY_SizeValid(size)) MEMORY_ram_size = size; else Log_print("Invalid RAM size: %s", ptr); } } else if (strcmp(string, "DEFAULT_TV_MODE") == 0) { if (strcmp(ptr, "PAL") == 0) Atari800_tv_mode = Atari800_TV_PAL; else if (strcmp(ptr, "NTSC") == 0) Atari800_tv_mode = Atari800_TV_NTSC; else Log_print("Invalid TV Mode: %s", ptr); } else if (strcmp(string, "MOSAIC_RAM_NUM_BANKS") == 0) { int num = Util_sscandec(ptr); if (num >= 0 && num <= 64) MEMORY_mosaic_num_banks = num; else Log_print("Invalid Mosaic RAM number of banks: %s", ptr); } else if (strcmp(string, "AXLON_RAM_NUM_BANKS") == 0) { int num = Util_sscandec(ptr); if (num == 0 || num == 8 || num == 16 || num == 32 || num == 64 || num == 128 || num == 256) MEMORY_axlon_num_banks = num; else Log_print("Invalid Mosaic RAM number of banks: %s", ptr); } else if (strcmp(string, "ENABLE_MAPRAM") == 0) MEMORY_enable_mapram = Util_sscanbool(ptr); else if (strcmp(string, "BUILTIN_BASIC") == 0) Atari800_builtin_basic = Util_sscanbool(ptr); else if (strcmp(string, "KEYBOARD_LEDS") == 0) Atari800_keyboard_leds = Util_sscanbool(ptr); else if (strcmp(string, "F_KEYS") == 0) Atari800_f_keys = Util_sscanbool(ptr); else if (strcmp(string, "BUILTIN_GAME") == 0) Atari800_builtin_game = Util_sscanbool(ptr); else if (strcmp(string, "KEYBOARD_DETACHED") == 0) Atari800_keyboard_detached = Util_sscanbool(ptr); else if (strcmp(string, "1200XL_JUMPER") == 0) Atari800_jumper = Util_sscanbool(ptr); else if (strcmp(string, "CFG_SAVE_ON_EXIT") == 0) { CFG_save_on_exit = Util_sscanbool(ptr); } /* Add module-specific configurations here */ else if (PBI_ReadConfig(string,ptr)) { } else if (CARTRIDGE_ReadConfig(string, ptr)) { } else if (CASSETTE_ReadConfig(string, ptr)) { } else if (RTIME_ReadConfig(string, ptr)) { } #ifdef XEP80_EMULATION else if (XEP80_ReadConfig(string, ptr)) { } #endif #ifdef AF80 else if (AF80_ReadConfig(string,ptr)) { } #endif #if !defined(BASIC) && !defined(CURSES_BASIC) else if (Colours_ReadConfig(string, ptr)) { } else if (ARTIFACT_ReadConfig(string, ptr)) { } else if (Screen_ReadConfig(string, ptr)) { } #endif #ifdef NTSC_FILTER else if (FILTER_NTSC_ReadConfig(string, ptr)) { } #endif #if SUPPORTS_CHANGE_VIDEOMODE else if (VIDEOMODE_ReadConfig(string, ptr)) { } #endif #if defined(SOUND) && defined(SOUND_THIN_API) else if (Sound_ReadConfig(string, ptr)) { } #endif /* defined(SOUND) && defined(SOUND_THIN_API) */ else { #ifdef SUPPORTS_PLATFORM_CONFIGURE if (!PLATFORM_Configure(string, ptr)) { Log_print("Unrecognized variable or bad parameters: '%s=%s'", string, ptr); } #else Log_print("Unrecognized variable: %s", string); #endif } } else { Log_print("Ignored config line: %s", string); } } fclose(fp); #ifndef BASIC if (was_obsolete_dir) { Log_print( "DISK_DIR, ROM_DIR, EXE_DIR and STATE_DIR configuration options\n" "are no longer supported. Please use ATARI_FILES_DIR\n" "and SAVED_FILES_DIR in your Atari800 configuration file."); } #endif return TRUE; }
int SDL_VIDEO_Initialise(int *argc, char *argv[]) { int i, j; int help_only = FALSE; for (i = j = 1; i < *argc; i++) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ if (strcmp(argv[i], "-scanlines") == 0) { if (i_a) { SDL_VIDEO_scanlines_percentage = Util_sscandec(argv[++i]); } else a_m = TRUE; } else if (strcmp(argv[i], "-scanlinesint") == 0) SDL_VIDEO_interpolate_scanlines = TRUE; else if (strcmp(argv[i], "-no-scanlinesint") == 0) SDL_VIDEO_interpolate_scanlines = FALSE; #if HAVE_OPENGL else if (strcmp(argv[i], "-video-accel") == 0) currently_opengl = SDL_VIDEO_opengl = TRUE; else if (strcmp(argv[i], "-no-video-accel") == 0) currently_opengl = SDL_VIDEO_opengl = FALSE; #endif /* HAVE_OPENGL */ else if (strcmp(argv[i], "-vsync") == 0) SDL_VIDEO_vsync = TRUE; else if (strcmp(argv[i], "-no-vsync") == 0) SDL_VIDEO_vsync = FALSE; else { if (strcmp(argv[i], "-help") == 0) { help_only = TRUE; Log_print("\t-scanlines Set visibility of scanlines (0..100)"); Log_print("\t-scanlinesint Enable scanlines interpolation"); Log_print("\t-no-scanlinesint Disable scanlines interpolation"); #if HAVE_OPENGL Log_print("\t-video-accel Use hardware video acceleration"); Log_print("\t-no-video-accel Don't use hardware video acceleration"); #endif /* HAVE_OPENGL */ Log_print("\t-vsync Synchronize display to vertical retrace"); Log_print("\t-no-vsync Don't synchronize display to vertical retrace"); } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } } *argc = j; if (!SDL_VIDEO_SW_Initialise(argc, argv) #if HAVE_OPENGL || !SDL_VIDEO_GL_Initialise(argc, argv) #endif ) return FALSE; if (!help_only) { #ifdef HAVE_WINDOWS_H /* On Windows the DirectX SDL backend is glitchy in windowed modes, but allows for vertical synchronisation in fullscreen modes. Unless the user specified his own backend, use DirectX in fullscreen modes and Windib in windowed modes. */ if (SDL_getenv("SDL_VIDEODRIVER") != NULL) user_video_driver = TRUE; else if (VIDEOMODE_windowed) SDL_putenv("SDL_VIDEODRIVER=windib"); else SDL_putenv("SDL_VIDEODRIVER=directx"); #endif /* HAVE_WINDOWS_H */ SDL_VIDEO_InitSDL(); } return TRUE; }
void StandardDatabaseManager::readEntryValue( dbEntry *ent, const char* name, const char* value ) { if( !ent ) return; DatabaseManager::readEntryValue( ent, name, value ); StandardDbEntry* entry = (StandardDbEntry*)ent; if( !strcmp( name, "profile" ) ) { entry->profile = Util_sscandec( value ); } int x, i; bool btnFound = false; int profileCount = getProfileCount(); for( x = 0; x < profileCount; x++ ) { for( i = 0; !btnFound && i < WII_CONTROLLER_COUNT; i++ ) { for( int j = 0; !btnFound && j < WII_MAP_BUTTON_COUNT; j++ ) { char btnName[64]; // Backward compatibility snprintf( btnName, sizeof(btnName), "btn.%d.%d", i, j ); if( !strcmp( name, btnName ) ) { entry->buttonMap[entry->profile][i][j] = Util_sscandec( value ); btnFound = true; } if( !btnFound ) { snprintf( btnName, sizeof(btnName), "btn.%d.%d.%d", x, i, j ); if( !strcmp( name, btnName ) ) { entry->buttonMap[x][i][j] = Util_sscandec( value ); btnFound = true; } } } } } // Backward compatibility btnFound = false; for( i = 1; !btnFound && i < getMappableButtonCount( entry->profile ); i++ ) { char button[255]; // Backward compatibility snprintf( button, sizeof(button), "btnDesc%d", i ); if( !strcmp( name, button ) ) { Util_strlcpy( entry->buttonDesc[entry->profile][i], value, sizeof(entry->buttonDesc[entry->profile][i]) ); btnFound = true; } } for( x = 0; x < profileCount; x++ ) { for( i = 1; !btnFound && i < getMappableButtonCount( x ); i++ ) { char button[255]; // Backward compatibility snprintf( button, sizeof(button), "btnDesc.%d.%d", x, i ); if( !strcmp( name, button ) ) { Util_strlcpy( entry->buttonDesc[x][i], value, sizeof(entry->buttonDesc[x][i]) ); btnFound = true; } } } }
int VIDEOMODE_ReadConfig(char *option, char *ptr) { if (strcmp(option, "VIDEOMODE_WINDOW_WIDTH") == 0) return (window_resolution.width = Util_sscandec(ptr)) != -1; else if (strcmp(option, "VIDEOMODE_WINDOW_HEIGHT") == 0) return (window_resolution.height = Util_sscandec(ptr)) != -1; else if (strcmp(option, "VIDEOMODE_FULLSCREEN_WIDTH") == 0) return (init_fs_resolution.width = Util_sscandec(ptr)) != -1; else if (strcmp(option, "VIDEOMODE_FULLSCREEN_HEIGHT") == 0) return (init_fs_resolution.height = Util_sscandec(ptr)) != -1; else if (strcmp(option, "VIDEOMODE_WINDOWED") == 0) return (VIDEOMODE_windowed = Util_sscanbool(ptr)) != -1; else if (strcmp(option, "VIDEOMODE_HORIZONTAL_AREA") == 0) { int i = CFG_MatchTextParameter(ptr, horizontal_area_cfg_strings, VIDEOMODE_HORIZONTAL_SIZE); if (i < 0) { VIDEOMODE_horizontal_area = VIDEOMODE_HORIZONTAL_CUSTOM; return (VIDEOMODE_custom_horizontal_area = Util_sscandec(ptr)) != -1 && VIDEOMODE_custom_horizontal_area >= VIDEOMODE_MIN_HORIZONTAL_AREA && VIDEOMODE_custom_horizontal_area <= VIDEOMODE_MAX_HORIZONTAL_AREA; } VIDEOMODE_horizontal_area = i; } else if (strcmp(option, "VIDEOMODE_VERTICAL_AREA") == 0) { int i = CFG_MatchTextParameter(ptr, vertical_area_cfg_strings, VIDEOMODE_VERTICAL_SIZE); if (i < 0) { VIDEOMODE_vertical_area = VIDEOMODE_VERTICAL_CUSTOM; return (VIDEOMODE_custom_vertical_area = Util_sscandec(ptr)) != -1 && VIDEOMODE_custom_vertical_area >= VIDEOMODE_MIN_VERTICAL_AREA && VIDEOMODE_custom_vertical_area <= VIDEOMODE_MAX_VERTICAL_AREA; } VIDEOMODE_vertical_area = i; } else if (strcmp(option, "VIDEOMODE_HORIZONTAL_SHIFT") == 0) return Util_sscansdec(ptr, &VIDEOMODE_horizontal_offset); else if (strcmp(option, "VIDEOMODE_VERTICAL_SHIFT") == 0) return Util_sscansdec(ptr, &VIDEOMODE_vertical_offset); else if (strcmp(option, "VIDEOMODE_STRETCH") == 0) { int i = CFG_MatchTextParameter(ptr, stretch_cfg_strings, VIDEOMODE_STRETCH_SIZE); if (i < 0) { VIDEOMODE_stretch = VIDEOMODE_STRETCH_CUSTOM; return Util_sscandouble(ptr, &VIDEOMODE_custom_stretch) && VIDEOMODE_custom_stretch >= 1.0; } VIDEOMODE_stretch = i; } else if (strcmp(option, "VIDEOMODE_FIT") == 0) { int i = CFG_MatchTextParameter(ptr, fit_cfg_strings, VIDEOMODE_FIT_SIZE); if (i < 0) return FALSE; VIDEOMODE_fit = i; } else if (strcmp(option, "VIDEOMODE_IMAGE_ASPECT") == 0) { int i = CFG_MatchTextParameter(ptr, keep_aspect_cfg_strings, VIDEOMODE_KEEP_ASPECT_SIZE); if (i < 0) return FALSE; VIDEOMODE_keep_aspect = i; } #if SUPPORTS_ROTATE_VIDEOMODE else if (strcmp(option, "VIDEOMODE_ROTATE90") == 0) return (VIDEOMODE_rotate90 = Util_sscanbool(ptr)) != -1; #endif else if (strcmp(option, "VIDEOMODE_HOST_ASPECT_RATIO") == 0) { if (strcmp(ptr, "AUTO") == 0) VIDEOMODE_host_aspect_ratio_w = VIDEOMODE_host_aspect_ratio_h = 0.0; else return ParseAspectRatio(ptr, &VIDEOMODE_host_aspect_ratio_w, &VIDEOMODE_host_aspect_ratio_h); } #if NTSC_FILTER else if (strcmp(option, "VIDEOMODE_NTSC_FILTER") == 0) return (VIDEOMODE_ntsc_filter = Util_sscanbool(ptr)) != -1; #endif #if COLUMN_80 else if (strcmp(option, "VIDEOMODE_80_COLUMN") == 0) return (VIDEOMODE_80_column = Util_sscanbool(ptr)) != -1; #endif else return FALSE; return TRUE; }
int VIDEOMODE_Initialise(int *argc, char *argv[]) { int i, j; for (i = j = 1; i < *argc; i++) { int i_a = (i + 1 < *argc); /* is argument available? */ int a_m = FALSE; /* error, argument missing! */ int a_i = FALSE; /* error, argument invalid! */ if (strcmp(argv[i], "-win-width") == 0) { if (i_a) a_i = (window_resolution.width = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-win-height") == 0) { if (i_a) a_i = (window_resolution.height = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fs-width") == 0) { if (i_a) a_i = (init_fs_resolution.width = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fs-height") == 0) { if (i_a) a_i = (init_fs_resolution.height = Util_sscandec(argv[++i])) == -1; else a_m = TRUE; } else if (strcmp(argv[i], "-fullscreen") == 0) VIDEOMODE_windowed = FALSE; else if (strcmp(argv[i], "-windowed") == 0) VIDEOMODE_windowed = TRUE; else if (strcmp(argv[i], "-horiz-area") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], horizontal_area_cfg_strings, VIDEOMODE_HORIZONTAL_SIZE); if (idx < 0) { VIDEOMODE_horizontal_area = VIDEOMODE_HORIZONTAL_CUSTOM; a_i = (VIDEOMODE_custom_horizontal_area = Util_sscandec(argv[i])) == -1 || VIDEOMODE_custom_horizontal_area < VIDEOMODE_MIN_HORIZONTAL_AREA || VIDEOMODE_custom_horizontal_area > VIDEOMODE_MAX_HORIZONTAL_AREA; } else VIDEOMODE_horizontal_area = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-vert-area") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], vertical_area_cfg_strings, VIDEOMODE_VERTICAL_SIZE); if (idx < 0) { VIDEOMODE_vertical_area = VIDEOMODE_VERTICAL_CUSTOM; a_i = (VIDEOMODE_custom_vertical_area = Util_sscandec(argv[i])) == -1 || VIDEOMODE_custom_vertical_area < VIDEOMODE_MIN_VERTICAL_AREA || VIDEOMODE_custom_vertical_area > VIDEOMODE_MAX_VERTICAL_AREA; } else VIDEOMODE_vertical_area = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-horiz-shift") == 0) { if (i_a) a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_horizontal_offset); else a_m = TRUE; } else if (strcmp(argv[i], "-vert-shift") == 0) { if (i_a) a_i = !Util_sscansdec(argv[++i], &VIDEOMODE_vertical_offset); else a_m = TRUE; } else if (strcmp(argv[i], "-stretch") == 0) { if (i_a) { int idx = CFG_MatchTextParameter(argv[++i], stretch_cfg_strings, VIDEOMODE_STRETCH_SIZE); if (idx < 0) { VIDEOMODE_stretch = VIDEOMODE_STRETCH_CUSTOM; a_i = !Util_sscandouble(argv[i], &VIDEOMODE_custom_stretch) || VIDEOMODE_custom_stretch < 1.0; } else VIDEOMODE_stretch = idx; } else a_m = TRUE; } else if (strcmp(argv[i], "-fit-screen") == 0) { if (i_a) { if ((VIDEOMODE_fit = CFG_MatchTextParameter(argv[++i], fit_cfg_strings, VIDEOMODE_FIT_SIZE)) < 0) a_i = TRUE; } else a_m = TRUE; } else if (strcmp(argv[i], "-image-aspect") == 0) { if (i_a) { if ((VIDEOMODE_keep_aspect = CFG_MatchTextParameter(argv[++i], keep_aspect_cfg_strings, VIDEOMODE_KEEP_ASPECT_SIZE)) < 0) a_i = TRUE; } else a_m = TRUE; } #if SUPPORTS_ROTATE_VIDEOMODE else if (strcmp(argv[i], "-rotate90") == 0) VIDEOMODE_rotate90 = TRUE; else if (strcmp(argv[i], "-no-rotate90") == 0) VIDEOMODE_rotate90 = FALSE; #endif /* SUPPORTS_ROTATE_VIDEOMODE */ else if (strcmp(argv[i], "-host-aspect-ratio") == 0) { if (i_a) { if (strcmp(argv[++i], "auto") == 0) VIDEOMODE_host_aspect_ratio_w = VIDEOMODE_host_aspect_ratio_h = 0.0; else a_i = !ParseAspectRatio(argv[i], &VIDEOMODE_host_aspect_ratio_w, &VIDEOMODE_host_aspect_ratio_h); } else a_m = TRUE; } #if NTSC_FILTER else if (strcmp(argv[i], "-ntscemu") == 0) VIDEOMODE_ntsc_filter = TRUE; else if (strcmp(argv[i], "-no-ntscemu") == 0) VIDEOMODE_ntsc_filter = FALSE; #endif /* NTSC_FILTER */ #if COLUMN_80 else if (strcmp(argv[i], "-80column") == 0) VIDEOMODE_80_column = TRUE; else if (strcmp(argv[i], "-no-80column") == 0) VIDEOMODE_80_column = FALSE; #endif /* COLUMN_80 */ else { if (strcmp(argv[i], "-help") == 0) { Log_print("\t-win-width <num> Host window width"); Log_print("\t-win-height <num> Host window height"); Log_print("\t-fs-width <num> Host fullscreen width"); Log_print("\t-fs-height <num> Host fullscreen height"); Log_print("\t-fullscreen Run fullscreen"); Log_print("\t-windowed Run in window"); Log_print("\t-horiz-area narrow|tv|full|<number>"); Log_print("\t Set horizontal view area"); Log_print("\t-vert-area short|tv|full|<number>"); Log_print("\t Set vertical view area"); Log_print("\t-horiz-shift <num> Set horizontal shift of the visible area (-%i..%i)", VIDEOMODE_MAX_HORIZONTAL_AREA, VIDEOMODE_MAX_HORIZONTAL_AREA); Log_print("\t-vert-shift <num> Set vertical shift of the visible area (-%i..%i)", VIDEOMODE_MAX_VERTICAL_AREA, VIDEOMODE_MAX_VERTICAL_AREA); Log_print("\t-stretch none|integral|full|<number>"); Log_print("\t Set method of image stretching"); Log_print("\t-fit-screen width|height|both"); Log_print("\t Set method of image fitting the screen"); Log_print("\t-image-aspect none|square-pixels|real"); Log_print("\t Set image aspect ratio"); #if SUPPORTS_ROTATE_VIDEOMODE Log_print("\t-rotate90 Rotate the screen sideways"); Log_print("\t-no-rotate90 Don't rotate the screen"); #endif /* SUPPORTS_ROTATE_VIDEOMODE */ Log_print("\t-host-aspect-ratio auto|<w>:<h>"); Log_print("\t Set host display aspect ratio"); #if NTSC_FILTER Log_print("\t-ntscemu Enable NTSC composite video filter"); Log_print("\t-no-ntscemu Disable NTSC composite video filter"); #endif #if COLUMN_80 Log_print("\t-80column Show output of an 80 column card, if present"); Log_print("\t-no-80column Show standard screen output"); #endif } argv[j++] = argv[i]; } if (a_m) { Log_print("Missing argument for '%s'", argv[i]); return FALSE; } else if (a_i) { Log_print("Invalid argument for '%s'", argv[--i]); return FALSE; } } *argc = j; #ifdef XEP80_EMULATION display_modes[VIDEOMODE_MODE_XEP80].asp_ratio = xep80_aspect_ratio_ntsc; #endif return TRUE; }