/* * 1. $QSTAT_CONFIG * 2. UNIX: $HOME/.qstatrc WIN: $HOME/qstat.cfg * 3. UNIX: sysconfdir/qstat.cfg WIN: qstat.exe-dir/qstat.cfg */ int qsc_load_default_config_files() { int rc = 0; char *filename = NULL, *var; char path[PATH_MAX]; var = getenv("QSTAT_CONFIG"); if ((var != NULL) && (var[0] != '\0')) { rc = try_load_config_file(var, 1); if ((rc == 0) || (rc == -1)) { return (rc); } } var = getenv("HOME"); if ((var != NULL) && (var[0] != '\0')) { int len = strlen(var); if (len > PATH_MAX - strlen(HOME_CONFIG_FILE) + 2) { fprintf(stderr, "Path for HOME \"%s\" too long\n", var); return (-1); } strncpy(path, var, len); path[len] = '\0'; strcat(path, SEP HOME_CONFIG_FILE); rc = try_load_config_file(path, 0); if ((rc == 0) || (rc == -1)) { return (rc); } } #ifdef sysconfdir strcpy(path, sysconfdir SEP CONFIG_FILE); filename = path; #elif defined(_WIN32) // Look in the binaries directory rc = GetModuleFileName(NULL, path, PATH_MAX); if (rc == PATH_MAX) { fprintf(stderr, "Module path too long\n"); return (1); } var = strrchr(path, '\\'); if (var == NULL) { fprintf(stderr, "Unexpected module path \"%s\" (no seperator %s)\n", path, SEP); return (-1); } *var = '\0'; if (strlen(path) >= PATH_MAX - 11) { fprintf(stderr, "Module path \"%s\" too long\n", path); return (-1); } strcat(path, SEP CONFIG_FILE); filename = path; #endif if (filename != NULL) { rc = try_load_config_file(filename, 0); } return (rc); }
void S9xLoadConfigFiles (char **argv, int argc) { static ConfigFile conf; // static because some of its functions return pointers conf.Clear(); bool skip = false; for (int i = 0; i < argc; i++) { if (!strcasecmp(argv[i], "-nostdconf")) { skip = true; break; } } if (!skip) { #ifdef SYS_CONFIG_FILE try_load_config_file(SYS_CONFIG_FILE, conf); S9xParsePortConfig(conf, 0); #endif std::string fname; fname = S9xGetDirectory(DEFAULT_DIR); fname += SLASH_STR S9X_CONF_FILE_NAME; try_load_config_file(fname.c_str(), conf); } else fprintf(stderr, "Skipping standard config files.\n"); for (int i = 0; i < argc - 1; i++) if (!strcasecmp(argv[i], "-conf")) try_load_config_file(argv[++i], conf); // Parse config file here // ROM Settings.ForceInterleaved2 = conf.GetBool("ROM::Interleaved2", false); Settings.ForceInterleaveGD24 = conf.GetBool("ROM::InterleaveGD24", false); Settings.ApplyCheats = conf.GetBool("ROM::Cheat", false); Settings.NoPatch = !conf.GetBool("ROM::Patch", true); Settings.ForceLoROM = conf.GetBool("ROM::LoROM", false); Settings.ForceHiROM = conf.GetBool("ROM::HiROM", false); if (Settings.ForceLoROM) Settings.ForceHiROM = false; Settings.ForcePAL = conf.GetBool("ROM::PAL", false); Settings.ForceNTSC = conf.GetBool("ROM::NTSC", false); if (Settings.ForcePAL) Settings.ForceNTSC = false; if (conf.Exists("ROM::Header")) { Settings.ForceHeader = conf.GetBool("ROM::Header", false); Settings.ForceNoHeader = !Settings.ForceHeader; } if (conf.Exists("ROM::Interleaved")) { Settings.ForceInterleaved = conf.GetBool("ROM::Interleaved", false); Settings.ForceNotInterleaved = !Settings.ForceInterleaved; } rom_filename = conf.GetStringDup("ROM::Filename", NULL); // Sound Settings.SoundSync = conf.GetBool("Sound::Sync", true); Settings.SixteenBitSound = conf.GetBool("Sound::16BitSound", true); Settings.Stereo = conf.GetBool("Sound::Stereo", true); Settings.ReverseStereo = conf.GetBool("Sound::ReverseStereo", false); Settings.SoundPlaybackRate = conf.GetUInt("Sound::Rate", 32000); Settings.SoundInputRate = conf.GetUInt("Sound::InputRate", 32000); Settings.Mute = conf.GetBool("Sound::Mute", false); // Display Settings.SupportHiRes = conf.GetBool("Display::HiRes", true); Settings.Transparency = conf.GetBool("Display::Transparency", true); Settings.DisableGraphicWindows = !conf.GetBool("Display::GraphicWindows", true); Settings.DisplayFrameRate = conf.GetBool("Display::DisplayFrameRate", false); Settings.DisplayWatchedAddresses = conf.GetBool("Display::DisplayWatchedAddresses", false); Settings.DisplayPressedKeys = conf.GetBool("Display::DisplayInput", false); Settings.DisplayMovieFrame = conf.GetBool("Display::DisplayFrameCount", false); Settings.AutoDisplayMessages = conf.GetBool("Display::MessagesInImage", true); Settings.InitialInfoStringTimeout = conf.GetInt ("Display::MessageDisplayTime", 120); // Settings Settings.BSXBootup = conf.GetBool("Settings::BSXBootup", false); Settings.TurboMode = conf.GetBool("Settings::TurboMode", false); Settings.TurboSkipFrames = conf.GetUInt("Settings::TurboFrameSkip", 15); Settings.MovieTruncate = conf.GetBool("Settings::MovieTruncateAtEnd", false); Settings.MovieNotifyIgnored = conf.GetBool("Settings::MovieNotifyIgnored", false); Settings.WrongMovieStateProtection = conf.GetBool("Settings::WrongMovieStateProtection", true); Settings.StretchScreenshots = conf.GetInt ("Settings::StretchScreenshots", 1); Settings.SnapshotScreenshots = conf.GetBool("Settings::SnapshotScreenshots", true); Settings.DontSaveOopsSnapshot = conf.GetBool("Settings::DontSaveOopsSnapshot", false); Settings.AutoSaveDelay = conf.GetUInt("Settings::AutoSaveDelay", 0); if (conf.Exists("Settings::FrameTime")) Settings.FrameTimePAL = Settings.FrameTimeNTSC = conf.GetUInt("Settings::FrameTime", 16667); if (!strcasecmp(conf.GetString("Settings::FrameSkip", "Auto"), "Auto")) Settings.SkipFrames = AUTO_FRAMERATE; else Settings.SkipFrames = conf.GetUInt("Settings::FrameSkip", 0) + 1; // Controls Settings.MouseMaster = conf.GetBool("Controls::MouseMaster", true); Settings.SuperScopeMaster = conf.GetBool("Controls::SuperscopeMaster", true); Settings.JustifierMaster = conf.GetBool("Controls::JustifierMaster", true); Settings.MultiPlayer5Master = conf.GetBool("Controls::MP5Master", true); Settings.UpAndDown = conf.GetBool("Controls::AllowLeftRight", false); if (conf.Exists("Controls::Port1")) parse_controller_spec(0, conf.GetString("Controls::Port1")); if (conf.Exists("Controls::Port2")) parse_controller_spec(1, conf.GetString("Controls::Port2")); if (conf.Exists("Controls::Mouse1Crosshair")) parse_crosshair_spec(X_MOUSE1, conf.GetString("Controls::Mouse1Crosshair")); if (conf.Exists("Controls::Mouse2Crosshair")) parse_crosshair_spec(X_MOUSE2, conf.GetString("Controls::Mouse2Crosshair")); if (conf.Exists("Controls::SuperscopeCrosshair")) parse_crosshair_spec(X_SUPERSCOPE, conf.GetString("Controls::SuperscopeCrosshair")); if (conf.Exists("Controls::Justifier1Crosshair")) parse_crosshair_spec(X_JUSTIFIER1, conf.GetString("Controls::Justifier1Crosshair")); if (conf.Exists("Controls::Justifier2Crosshair")) parse_crosshair_spec(X_JUSTIFIER2, conf.GetString("Controls::Justifier2Crosshair")); // Hack Settings.DisableGameSpecificHacks = !conf.GetBool("Hack::EnableGameSpecificHacks", true); Settings.BlockInvalidVRAMAccessMaster = !conf.GetBool("Hack::AllowInvalidVRAMAccess", false); Settings.HDMATimingHack = conf.GetInt ("Hack::HDMATiming", 100); // Netplay #ifdef NETPLAY_SUPPORT Settings.NetPlay = conf.GetBool("Netplay::Enable"); Settings.Port = NP_DEFAULT_PORT; if (conf.Exists("Netplay::Port")) Settings.Port = -(int) conf.GetUInt("Netplay::Port"); Settings.ServerName[0] = '\0'; if (conf.Exists("Netplay::Server")) conf.GetString("Netplay::Server", Settings.ServerName, 128); #endif // Debug #ifdef DEBUGGER if (conf.GetBool("DEBUG::Debugger", false)) CPU.Flags |= DEBUG_MODE_FLAG; if (conf.GetBool("DEBUG::Trace", false)) { ENSURE_TRACE_OPEN(trace,"trace.log","wb") CPU.Flags |= TRACE_FLAG; } #endif S9xParsePortConfig(conf, 1); S9xVerifyControllers(); }
bool Emulator_Implementation_InitSettings() { LOG_DBG("Emulator_Implementation_InitSettings()"); memset((&Settings), 0, (sizeof(Settings))); currentconfig.Clear(); #ifdef SYS_CONFIG_FILE try_load_config_file(SYS_CONFIG_FILE, currentconfig); #endif //PS3 - General settings if (currentconfig.Exists("PS3General::KeepAspect")) { Settings.PS3KeepAspect = currentconfig.GetBool("PS3General::KeepAspect"); } else { Settings.PS3KeepAspect = true; } if (currentconfig.Exists("PS3General::Smooth")) { Settings.PS3Smooth = currentconfig.GetBool("PS3General::Smooth"); } else { Settings.PS3Smooth = false; } if (currentconfig.Exists("PS3General::OverscanEnabled")) { Settings.PS3OverscanEnabled = currentconfig.GetBool("PS3General::OverscanEnabled"); } else { Settings.PS3OverscanEnabled = false; } if (currentconfig.Exists("PS3General::OverscanAmount")) { Settings.PS3OverscanAmount = currentconfig.GetInt("PS3General::OverscanAmount"); } else { Settings.PS3OverscanAmount = 0; } if (currentconfig.Exists("FCEU::Controlstyle")) { Settings.FCEUControlstyle = currentconfig.GetInt("FCEU::Controlstyle"); control_style = (ControlStyle)(((int)Settings.FCEUControlstyle)); } else { Settings.FCEUControlstyle = CONTROL_STYLE_ORIGINAL; control_style = CONTROL_STYLE_ORIGINAL; } if (currentconfig.Exists("FCEU::DisableSpriteLimitation")) { Settings.FCEUDisableSpriteLimitation = currentconfig.GetBool("FCEU::DisableSpriteLimitation"); FCEUI_DisableSpriteLimitation(Settings.FCEUDisableSpriteLimitation); } else { Settings.FCEUDisableSpriteLimitation = false; } if (currentconfig.Exists("PS3General::PS3CurrentShader")) { Settings.PS3CurrentShader.assign(currentconfig.GetString("PS3General::PS3CurrentShader")); } else { Settings.PS3CurrentShader.assign(DEFAULT_SHADER_FILE); } if (currentconfig.Exists("PS3General::PS3CurrentResolution")) { Settings.PS3CurrentResolution = currentconfig.GetInt("PS3General::PS3CurrentResolution"); } else { Settings.PS3CurrentResolution = NULL; } if (currentconfig.Exists("FCEU::GameGenie")) { Settings.FCEUGameGenie = currentconfig.GetBool("FCEU::GameGenie"); FCEUI_SetGameGenie(Settings.FCEUGameGenie); } else { Settings.FCEUGameGenie = false; } FCEUI_SetGameGenie(Settings.FCEUGameGenie); if (currentconfig.Exists("PS3General::PS3PALTemporalMode60Hz")) { Settings.PS3PALTemporalMode60Hz = currentconfig.GetBool("PS3General::PS3PALTemporalMode60Hz"); } else { Settings.PS3PALTemporalMode60Hz = false; } //RSound Settings if(currentconfig.Exists("RSound::RSoundEnabled")) { Settings.RSoundEnabled = currentconfig.GetBool("RSound::RSoundEnabled"); } else { Settings.RSoundEnabled = false; } if(currentconfig.Exists("RSound::RSoundServerIPAddress")) { Settings.RSoundServerIPAddress = currentconfig.GetString("RSound::RSoundServerIPAddress"); } else { Settings.RSoundServerIPAddress = "0.0.0.0"; } if(currentconfig.Exists("PS3General::Throttled")) { Settings.Throttled = currentconfig.GetInt("PS3General::Throttled"); } else { Settings.Throttled = 1; } // PS3 Path Settings if (currentconfig.Exists("PS3Paths::PathSaveStates")) { Settings.PS3PathSaveStates = currentconfig.GetString("PS3Paths::PathSaveStates"); } else { Settings.PS3PathSaveStates = USRDIR; } if (currentconfig.Exists("PS3Paths::PathSRAM")) { Settings.PS3PathSRAM = currentconfig.GetString("PS3Paths::PathSRAM"); } else { Settings.PS3PathSRAM = USRDIR; } if (currentconfig.Exists("PS3Paths::PathCheats")) { Settings.PS3PathCheats = currentconfig.GetString("PS3Paths::PathCheats"); } else { Settings.PS3PathCheats = USRDIR; } if (currentconfig.Exists("PS3Paths::PathScreenshots")) { Settings.PS3PathScreenshots = currentconfig.GetString("PS3Paths::PathScreenshots"); } else { Settings.PS3PathScreenshots = USRDIR; } if (currentconfig.Exists("PS3Paths::PathROMDirectory")) { Settings.PS3PathROMDirectory = currentconfig.GetString("PS3Paths::PathROMDirectory"); } else { Settings.PS3PathROMDirectory = "/"; } if (currentconfig.Exists("PS3Paths::BaseDirectory")) { Settings.PS3PathBaseDirectory = currentconfig.GetString("PS3Paths::PathBaseDirectory"); } else { Settings.PS3PathBaseDirectory = USRDIR; } if (currentconfig.Exists("PS3General::ControlScheme")) { Settings.ControlScheme = currentconfig.GetInt("PS3General::ControlScheme"); } else { Settings.ControlScheme = CONTROL_SCHEME_DEFAULT; } Emulator_Implementation_SwitchControlScheme(); LOG_DBG("SUCCESS - Emulator_Implementation_InitSettings()"); return true; }
bool Emulator_InitSettings() { LOG_DBG("Emulator_InitSettings()\n"); if (currentconfig == NULL) { currentconfig = new ConfigFile(); } memset((&Settings), 0, (sizeof(Settings))); currentconfig->Clear(); try_load_config_file(SYS_CONFIG_FILE, *currentconfig); //PS3 - General settings if (currentconfig->Exists("PS3General::KeepAspect")) { Settings.PS3KeepAspect = currentconfig->GetBool("PS3General::KeepAspect"); } else { Settings.PS3KeepAspect = true; } Graphics->SetAspectRatio(Settings.PS3KeepAspect); if (currentconfig->Exists("PS3General::Smooth")) { Settings.PS3Smooth = currentconfig->GetBool("PS3General::Smooth"); } else { Settings.PS3Smooth = false; } Graphics->SetSmooth(Settings.PS3Smooth); if (currentconfig->Exists("PS3General::OverscanEnabled")) { Settings.PS3OverscanEnabled = currentconfig->GetBool("PS3General::OverscanEnabled"); } else { Settings.PS3OverscanEnabled = false; } if (currentconfig->Exists("PS3General::OverscanAmount")) { Settings.PS3OverscanAmount = currentconfig->GetInt("PS3General::OverscanAmount"); } else { Settings.PS3OverscanAmount = 0; } Graphics->SetOverscan(Settings.PS3OverscanEnabled, (float)Settings.PS3OverscanAmount/100); if (currentconfig->Exists("GenesisPlus::SixButtonPad")) { Settings.SixButtonPad = currentconfig->GetBool("GenesisPlus::SixButtonPad"); } else { Settings.SixButtonPad = FALSE; } if (currentconfig->Exists("PS3General::DisplayFrameRate")) { Settings.DisplayFrameRate = currentconfig->GetBool("PS3General::DisplayFrameRate"); } else { Settings.DisplayFrameRate = false; } if (currentconfig->Exists("PS3General::Shader")) { Graphics->LoadFragmentShader(currentconfig->GetString("PS3General::Shader")); } else { Graphics->LoadFragmentShader(DEFAULT_SHADER_FILE); } if (currentconfig->Exists("GenesisPlus::BIOS")) { Settings.BIOS = currentconfig->GetString("GenesisPlus::BIOS"); } else { Settings.BIOS = "/dev_hdd0/game/GENP00001/USRDIR/bios.bin"; } if (currentconfig->Exists("PS3General::PS3PALTemporalMode60Hz")) { Settings.PS3PALTemporalMode60Hz = currentconfig->GetBool("PS3General::PS3PALTemporalMode60Hz"); Graphics->SetPAL60Hz(Settings.PS3PALTemporalMode60Hz); } else { Settings.PS3PALTemporalMode60Hz = false; Graphics->SetPAL60Hz(Settings.PS3PALTemporalMode60Hz); } //RSound Settings if(currentconfig->Exists("RSound::RSoundEnabled")) { Settings.RSoundEnabled = currentconfig->GetBool("RSound::RSoundEnabled"); } else { Settings.RSoundEnabled = false; } if(currentconfig->Exists("RSound::RSoundServerIPAddress")) { Settings.RSoundServerIPAddress = currentconfig->GetString("RSound::RSoundServerIPAddress"); } else { Settings.RSoundServerIPAddress = "0.0.0.0"; } if(currentconfig->Exists("PS3General::PS3FontSize")) { Settings.PS3FontSize = currentconfig->GetInt("PS3General::PS3FontSize"); } else { Settings.PS3FontSize = 100; } // PS3 Path Settings if (currentconfig->Exists("PS3Paths::PathSaveStates")) { Settings.PS3PathSaveStates = currentconfig->GetString("PS3Paths::PathSaveStates"); } else { Settings.PS3PathSaveStates = "/dev_hdd0/game/GENP00001/USRDIR/"; } if (currentconfig->Exists("PS3Paths::PathSRAM")) { Settings.PS3PathSRAM = currentconfig->GetString("PS3Paths::PathSRAM"); } else { Settings.PS3PathSRAM = "/dev_hdd0/game/GENP00001/USRDIR/"; } /* if (currentconfig->Exists("PS3Paths::PathScreenshots")) { Settings.PS3PathScreenshots = currentconfig->GetString("PS3Paths::PathScreenshots"); } */ if (currentconfig->Exists("PS3Paths::PathROMDirectory")) { Settings.PS3PathROMDirectory = currentconfig->GetString("PS3Paths::PathROMDirectory"); } else { Settings.PS3PathROMDirectory = "/\0"; } if (currentconfig->Exists("GenesisPlus::ActionReplayROMPath")) { Settings.GameGenieROMPath = currentconfig->GetString("GenesisPlus::ActionReplayROMPath"); } else { Settings.ActionReplayROMPath.assign("/dev_hdd0/game/GENP00001/USRDIR/areplay.bin"); } if (currentconfig->Exists("GenesisPlus::GameGenieROMPath")) { Settings.GameGenieROMPath = currentconfig->GetString("GenesisPlus::GameGenieROMPath"); } else { Settings.GameGenieROMPath.assign("/dev_hdd0/game/GENP00001/USRDIR/ggenie.bin"); } if (currentconfig->Exists("GenesisPlus::SKROMPath")) { Settings.SKROMPath = currentconfig->GetString("GenesisPlus::SKROMPath"); } else { Settings.SKROMPath.assign("/dev_hdd0/game/GENP00001/USRDIR/sk.bin"); } if (currentconfig->Exists("GenesisPlus::SKUpmemROMPath")) { Settings.SKUpmemROMPath = currentconfig->GetString("GenesisPlus::SKUpmemROMPath"); } else { Settings.SKUpmemROMPath.assign("/dev_hdd0/game/GENP00001/USRDIR/sk2chip.bin"); } if (currentconfig->Exists("GenesisPlus::ExtraCart")) { Settings.ExtraCart = currentconfig->GetBool("GenesisPlus::ExtraCart"); } else { Settings.ExtraCart = false; } Emulator_SetExtraCartPaths(); Emulator_Implementation_ButtonMappingSettings(MAP_BUTTONS_OPTION_GETTER); LOG_DBG("SUCCESS - Emulator_InitSettings()\n"); return true; }