Files
itgmania212121/stepmania/src/PrefsManager.cpp
T

542 lines
26 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-02-28 19:40:40 +00:00
/*
-----------------------------------------------------------------------------
Class: PrefsManager
Desc: See Header.
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
2002-02-28 19:40:40 +00:00
Chris Danford
Chris Gomez
2002-02-28 19:40:40 +00:00
-----------------------------------------------------------------------------
*/
#include "PrefsManager.h"
#include "IniFile.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "RageDisplay.h"
#include "RageUtil.h"
2002-12-13 22:06:30 +00:00
#include "arch/arch.h" /* for default driver specs */
2003-09-25 01:37:56 +00:00
#include "RageSoundReader_Resample.h" /* for ResampleQuality */
2003-11-01 22:04:43 +00:00
#include "RageFile.h"
2002-02-28 19:40:40 +00:00
2003-07-22 07:47:27 +00:00
#define STEPMANIA_INI_PATH BASE_PATH "Data" SLASH "StepMania.ini"
2003-10-08 07:28:11 +00:00
#define STATIC_INI_PATH BASE_PATH "Data" SLASH "Static.ini"
2002-02-28 19:40:40 +00:00
2002-05-27 08:23:27 +00:00
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
2002-02-28 19:40:40 +00:00
2003-11-02 21:05:59 +00:00
const float DEFAULT_SOUND_VOLUME = 1.00f;
2003-11-16 04:45:12 +00:00
const CString DEFAULT_LIGHTS_DRIVER = "Null";
2002-02-28 19:40:40 +00:00
2003-10-16 08:55:32 +00:00
bool g_bAutoRestart = false;
2002-02-28 19:40:40 +00:00
PrefsManager::PrefsManager()
{
2003-02-15 05:15:24 +00:00
#ifdef DEBUG
2002-08-17 06:44:04 +00:00
m_bWindowed = true;
#else
2002-05-28 20:01:22 +00:00
m_bWindowed = false;
2002-08-17 06:44:04 +00:00
#endif
m_iDisplayWidth = 640;
m_iDisplayHeight = 480;
m_iDisplayColorDepth = 16;
m_iTextureColorDepth = 16; // default to 16 for better preformance on slower cards
2003-07-09 02:28:56 +00:00
m_iMovieColorDepth = 16;
2003-01-11 20:15:00 +00:00
m_iMaxTextureResolution = 2048;
2002-11-12 09:23:50 +00:00
m_iRefreshRate = REFRESH_DEFAULT;
m_bOnlyDedicatedMenuButtons = false;
2003-02-15 05:15:24 +00:00
#ifdef DEBUG
m_bShowStats = true;
#else
m_bShowStats = false;
#endif
2003-11-13 00:39:36 +00:00
m_bShowBanners = true ;
2002-07-11 19:02:26 +00:00
m_BackgroundMode = BGMODE_ANIMATIONS;
m_iNumBackgrounds = 8;
m_bShowDanger = true;
2002-07-11 19:02:26 +00:00
m_fBGBrightness = 0.8f;
m_bMenuTimer = true;
2002-05-27 08:23:27 +00:00
m_iNumArcadeStages = 3;
2003-04-19 19:05:25 +00:00
m_bEventMode = false;
2002-06-24 22:04:31 +00:00
m_bAutoPlay = false;
m_fJudgeWindowScale = 1.0f;
2003-11-11 07:36:28 +00:00
m_fLifeDifficultyScale = 1.0f;
m_fJudgeWindowMarvelousSeconds = 0.0225f;
m_fJudgeWindowPerfectSeconds = 0.045f;
m_fJudgeWindowGreatSeconds = 0.090f;
m_fJudgeWindowGoodSeconds = 0.135f;
m_fJudgeWindowBooSeconds = 0.180f;
2003-05-31 21:34:07 +00:00
m_fJudgeWindowOKSeconds = 0.250f; // allow enough time to take foot off and put back on
2003-11-10 01:03:47 +00:00
m_fJudgeWindowMineSeconds = 0.135f;
2003-11-17 05:26:29 +00:00
m_fJudgeWindowAttackSeconds = 0.135f;
2003-11-11 07:36:28 +00:00
m_fLifeDeltaMarvelousPercentChange = +0.008f;
m_fLifeDeltaPerfectPercentChange = +0.008f;
m_fLifeDeltaGreatPercentChange = +0.004f;
m_fLifeDeltaGoodPercentChange = +0.000f;
m_fLifeDeltaBooPercentChange = -0.040f;
m_fLifeDeltaMissPercentChange = -0.080f;
m_fLifeDeltaOKPercentChange = +0.008f;
m_fLifeDeltaNGPercentChange = -0.080f;
m_fLifeDeltaMinePercentChange = -0.160f;
2003-10-13 00:06:49 +00:00
m_iRegenComboAfterFail = 10; // cumulative
m_iRegenComboAfterMiss = 5; // cumulative
m_iMaxRegenComboAfterFail = 10;
m_iMaxRegenComboAfterMiss = 10;
2003-10-13 03:20:05 +00:00
m_bTwoPlayerRecovery = true;
2002-08-22 03:35:33 +00:00
m_bDelayedEscape = true;
m_bInstructions = true;
m_bShowDontDie = true;
m_bShowSelectGroup = true;
2003-05-20 04:41:47 +00:00
m_bShowNative = true;
m_bArcadeOptionsNavigation = false;
2003-04-18 23:55:20 +00:00
m_bSoloSingle = false;
m_bDelayedTextureDelete = true;
m_bTexturePreload = false;
2003-05-20 04:42:12 +00:00
m_bDelayedScreenLoad = false;
2003-11-25 22:56:48 +00:00
m_BannerCache = BNCACHE_LOW_RES;
m_MusicWheelUsesSections = ALWAYS;
2003-01-21 06:51:35 +00:00
m_iMusicWheelSwitchSpeed = 10;
m_bEasterEggs = true;
m_iMarvelousTiming = 2;
m_iCoinMode = COIN_HOME;
2003-01-19 04:44:22 +00:00
m_iCoinsPerCredit = 1;
2003-11-09 01:09:35 +00:00
m_Premium = NO_PREMIUM;
2003-01-18 04:26:25 +00:00
m_iBoostAppPriority = -1;
2003-06-05 19:29:27 +00:00
m_bAntiAliasing = false;
2003-04-21 22:36:45 +00:00
m_ShowSongOptions = YES;
m_bDancePointsForOni = false;
2003-10-05 05:18:48 +00:00
m_bPercentageScoring = false;
m_bShowLyrics = true;
m_bAutogenMissingTypes = true;
m_bAutogenGroupCourses = true;
m_bBreakComboToGetItem = false;
m_ShowDancingCharacters = CO_OFF;
m_bUseUnlockSystem = false;
m_bFirstRun = true;
m_bAutoMapOnJoyChange = true;
m_fGlobalOffsetSeconds = 0;
2003-08-20 09:17:56 +00:00
m_bShowBeginnerHelper = false;
2003-09-29 12:32:12 +00:00
m_bEndlessBreakEnabled = true;
m_iEndlessNumStagesUntilBreak = 5;
m_iEndlessBreakLength = 5;
m_bTenFooterInRed = true;
2003-08-20 17:54:26 +00:00
2003-07-29 12:42:38 +00:00
// set to 0 so people aren't shocked at first
m_iProgressiveLifebar = 0;
m_iProgressiveNonstopLifebar = 0;
2003-07-31 15:07:48 +00:00
m_iProgressiveStageLifebar = 0;
/* DDR Extreme-style extra stage support.
* Default off so people used to the current behavior (or those with extra
* stage CRS files) don't get it changed around on them. */
m_bPickExtraStage = false;
m_bComboContinuesBetweenSongs = false;
// default to old sort order
m_iCourseSortOrder = COURSE_SORT_SONGS;
m_bMoveRandomToEnd = false;
m_iScoringType = SCORING_MAX2;
m_iGetRankingName = RANKING_ON;
m_fLongVerSongSeconds = 60*2.5f; // Dynamite Rave is 2:55
m_fMarathonVerSongSeconds = 60*5.f;
2002-08-30 04:28:12 +00:00
/* I'd rather get occasional people asking for support for this even though it's
* already here than lots of people asking why songs aren't being displayed. */
m_bHiddenSongs = false;
2002-09-03 00:22:19 +00:00
m_bVsync = true;
2003-08-19 08:01:15 +00:00
m_sLanguage = ""; // ThemeManager will deal with this invalid language
2003-10-11 07:47:34 +00:00
m_iCenterImageTranslateX = 0;
m_iCenterImageTranslateY = 0;
m_fCenterImageScaleX = 1;
m_fCenterImageScaleY = 1;
2003-10-12 19:45:28 +00:00
m_bAttractSound = true;
2003-10-22 11:40:04 +00:00
m_bDemonstrationSound = true;
2003-10-19 05:49:53 +00:00
m_bAllowExtraStage = true;
2003-10-16 08:55:32 +00:00
g_bAutoRestart = false;
/* XXX: Set these defaults for individual consoles using VideoCardDefaults.ini. */
#ifdef _XBOX
m_bInterlaced = true;
m_bPAL = false;
2003-11-13 00:39:36 +00:00
m_fScreenPosX = 0 ;
m_fScreenPosY = 0 ;
m_fScreenWidth = 640 ;
m_fScreenHeight = 480 ;
#else
m_bInterlaced = false;
#endif
m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST;
2003-09-02 04:51:36 +00:00
m_sMovieDrivers = DEFAULT_MOVIE_DRIVER_LIST;
2003-08-20 17:54:26 +00:00
// StepMania.cpp sets these on first run:
m_sVideoRenderers = "";
#if defined(WIN32)
m_iLastSeenMemory = 0;
#endif
2003-01-11 04:03:21 +00:00
m_fSoundVolume = DEFAULT_SOUND_VOLUME;
2003-11-16 04:45:12 +00:00
m_sLightsDriver = DEFAULT_LIGHTS_DRIVER;
/* This is experimental: let's see if preloading helps people's skipping.
* If it doesn't do anything useful, it'll be removed. */
m_bSoundPreloadAll = false;
2003-09-25 01:37:56 +00:00
m_iSoundResampleQuality = RageSoundReader_Resample::RESAMP_NORMAL;
2003-08-20 17:54:26 +00:00
m_bAllowUnacceleratedRenderer = false;
2003-07-13 20:21:04 +00:00
m_bThreadedInput = true;
2003-07-07 03:51:20 +00:00
m_sIgnoredMessageWindows = "";
2003-08-20 17:54:26 +00:00
m_sCoursesToShowRanking = "";
m_bLogging = true;
m_bForceLogFlush = false;
#ifdef DEBUG
m_bShowLogOutput = true;
#else
m_bShowLogOutput = false;
#endif
m_bTimestamping = false;
m_bLogCheckpoints = false;
2003-10-08 08:01:41 +00:00
ReadGlobalPrefsFromDisk();
2002-02-28 19:40:40 +00:00
}
PrefsManager::~PrefsManager()
{
}
2003-10-08 08:01:41 +00:00
void PrefsManager::ReadGlobalPrefsFromDisk()
2002-02-28 19:40:40 +00:00
{
IniFile ini;
2003-10-08 08:01:41 +00:00
ini.SetPath( STEPMANIA_INI_PATH );
ini.ReadFile();
/* Load this on top of the regular INI; if it exists, any settings listed
* in it will override user settings. */
ini.SetPath( STATIC_INI_PATH );
ini.ReadFile();
2002-02-28 19:40:40 +00:00
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "Windowed", m_bWindowed );
ini.GetValue( "Options", "Interlaced", m_bInterlaced );
#ifdef _XBOX
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "PAL", m_bPAL );
2003-11-13 00:39:36 +00:00
ini.GetValue( "Options", "ScreenPosX", m_fScreenPosX );
ini.GetValue( "Options", "ScreenPosY", m_fScreenPosY );
ini.GetValue( "Options", "ScreenWidth", m_fScreenWidth );
ini.GetValue( "Options", "ScreenHeight", m_fScreenHeight );
#endif
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "DisplayWidth", m_iDisplayWidth );
ini.GetValue( "Options", "DisplayHeight", m_iDisplayHeight );
ini.GetValue( "Options", "DisplayColorDepth", m_iDisplayColorDepth );
ini.GetValue( "Options", "TextureColorDepth", m_iTextureColorDepth );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "MovieColorDepth", m_iMovieColorDepth );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "MaxTextureResolution", m_iMaxTextureResolution );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "RefreshRate", m_iRefreshRate );
ini.GetValue( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowStats", m_bShowStats );
2003-11-13 00:39:36 +00:00
ini.GetValue( "Options", "ShowBanners", m_bShowBanners );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "BackgroundMode", (int&)m_BackgroundMode );
ini.GetValue( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.GetValue( "Options", "ShowDanger", m_bShowDanger );
ini.GetValue( "Options", "BGBrightness", m_fBGBrightness );
ini.GetValue( "Options", "MenuTimer", m_bMenuTimer );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "NumArcadeStages", m_iNumArcadeStages );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "EventMode", m_bEventMode );
ini.GetValue( "Options", "AutoPlay", m_bAutoPlay );
ini.GetValue( "Options", "JudgeWindowScale", m_fJudgeWindowScale );
2003-11-11 07:36:28 +00:00
ini.GetValue( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "JudgeWindowMarvelousSeconds", m_fJudgeWindowMarvelousSeconds );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "JudgeWindowPerfectSeconds", m_fJudgeWindowPerfectSeconds );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "JudgeWindowGreatSeconds", m_fJudgeWindowGreatSeconds );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "JudgeWindowGoodSeconds", m_fJudgeWindowGoodSeconds );
ini.GetValue( "Options", "JudgeWindowBooSeconds", m_fJudgeWindowBooSeconds );
ini.GetValue( "Options", "JudgeWindowOKSeconds", m_fJudgeWindowOKSeconds );
2003-11-10 01:03:47 +00:00
ini.GetValue( "Options", "JudgeWindowMineSeconds", m_fJudgeWindowMineSeconds );
2003-11-17 05:26:29 +00:00
ini.GetValue( "Options", "JudgeWindowAttackSeconds", m_fJudgeWindowAttackSeconds );
2003-11-11 07:36:28 +00:00
ini.GetValue( "Options", "LifeDeltaMarvelousPercentChange", m_fLifeDeltaMarvelousPercentChange );
ini.GetValue( "Options", "LifeDeltaPerfectPercentChange", m_fLifeDeltaPerfectPercentChange );
ini.GetValue( "Options", "LifeDeltaGreatPercentChange", m_fLifeDeltaGreatPercentChange );
ini.GetValue( "Options", "LifeDeltaGoodPercentChange", m_fLifeDeltaGoodPercentChange );
ini.GetValue( "Options", "LifeDeltaBooPercentChange", m_fLifeDeltaBooPercentChange );
ini.GetValue( "Options", "LifeDeltaMissPercentChange", m_fLifeDeltaMissPercentChange );
ini.GetValue( "Options", "LifeDeltaOKPercentChange", m_fLifeDeltaOKPercentChange );
ini.GetValue( "Options", "LifeDeltaNGPercentChange", m_fLifeDeltaNGPercentChange );
ini.GetValue( "Options", "LifeDeltaMinePercentChange", m_fLifeDeltaMinePercentChange );
2003-10-13 00:06:49 +00:00
ini.GetValue( "Options", "RegenComboAfterFail", m_iRegenComboAfterFail );
ini.GetValue( "Options", "RegenComboAfterMiss", m_iRegenComboAfterMiss );
ini.GetValue( "Options", "MaxRegenComboAfterFail", m_iMaxRegenComboAfterFail );
ini.GetValue( "Options", "MaxRegenComboAfterMiss", m_iMaxRegenComboAfterMiss );
2003-10-13 03:20:05 +00:00
ini.GetValue( "Options", "TwoPlayerRecovery", m_bTwoPlayerRecovery );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "DelayedEscape", m_bDelayedEscape );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "HiddenSongs", m_bHiddenSongs );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "Vsync", m_bVsync );
ini.GetValue( "Options", "HowToPlay", m_bInstructions );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "Caution", m_bShowDontDie );
ini.GetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowNative", m_bShowNative );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation );
ini.GetValue( "Options", "DWIPath", m_DWIPath );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete );
ini.GetValue( "Options", "TexturePreload", m_bTexturePreload );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad );
2003-11-25 22:56:48 +00:00
ini.GetValue( "Options", "BannerCache", (int&)m_BannerCache );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "MusicWheelUsesSections", (int&)m_MusicWheelUsesSections );
ini.GetValue( "Options", "MusicWheelSwitchSpeed", m_iMusicWheelSwitchSpeed );
ini.GetValue( "Options", "SoundDrivers", m_sSoundDrivers );
ini.GetValue( "Options", "MovieDrivers", m_sMovieDrivers );
ini.GetValue( "Options", "EasterEggs", m_bEasterEggs );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "MarvelousTiming", (int&)m_iMarvelousTiming );
ini.GetValue( "Options", "SoundVolume", m_fSoundVolume );
2003-11-16 04:45:12 +00:00
ini.GetValue( "Options", "LightsDriver", m_sLightsDriver );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "SoundPreloadAll", m_bSoundPreloadAll );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.GetValue( "Options", "CoinMode", m_iCoinMode );
ini.GetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit );
2003-11-09 01:09:35 +00:00
ini.GetValue( "Options", "Premium", (int&)m_Premium );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "BoostAppPriority", m_iBoostAppPriority );
ini.GetValue( "Options", "PickExtraStage", m_bPickExtraStage );
ini.GetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
ini.GetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
ini.GetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "ShowSongOptions", (int&)m_ShowSongOptions );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
ini.GetValue( "Options", "ThreadedInput", m_bThreadedInput );
ini.GetValue( "Options", "IgnoredMessageWindows", m_sIgnoredMessageWindows );
ini.GetValue( "Options", "SoloSingle", m_bSoloSingle );
ini.GetValue( "Options", "DancePointsForOni", m_bDancePointsForOni );
2003-10-05 05:18:48 +00:00
ini.GetValue( "Options", "PercentageScoring", m_bPercentageScoring );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowLyrics", m_bShowLyrics );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
ini.GetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
ini.GetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowDancingCharacters", (int&)m_ShowDancingCharacters );
ini.GetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder );
ini.GetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
2003-10-02 02:03:29 +00:00
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "ScoringType", (int&)m_iScoringType );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ProgressiveLifebar", m_iProgressiveLifebar );
ini.GetValue( "Options", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "ProgressiveStageLifebar", m_iProgressiveStageLifebar );
2003-10-02 02:03:29 +00:00
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "FirstRun", m_bFirstRun );
ini.GetValue( "Options", "AutoMapJoysticks", m_bAutoMapOnJoyChange );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "VideoRenderers", m_sVideoRenderers );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.GetValue( "Options", "LastSeenInputDevices", m_sLastSeenInputDevices );
#if defined(WIN32)
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking );
ini.GetValue( "Options", "GetRankingName", (int&)m_iGetRankingName);
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "AntiAliasing", m_bAntiAliasing );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper );
ini.GetValue( "Options", "Language", m_sLanguage );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled );
ini.GetValue( "Options", "EndlessStagesUntilBreak", m_iEndlessNumStagesUntilBreak );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "EndlessBreakLength", m_iEndlessBreakLength );
for( int p=0; p<NUM_PLAYERS; p++ )
2003-11-01 22:04:43 +00:00
{
ini.GetValue( "Options", ssprintf("DefaultMachineProfileIDP%d",p+1), m_sDefaultMachineProfileID[p] );
ini.GetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
FixSlashesInPlace( m_sMemoryCardDir[p] );
ini.GetValue( "Options", ssprintf("MemoryCardMountCommandP%d",p+1), m_sMemoryCardMountCommand[p] );
2003-11-01 22:04:43 +00:00
}
2003-07-18 08:04:47 +00:00
2003-10-11 07:47:34 +00:00
ini.GetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
ini.GetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
ini.GetValue( "Options", "CenterImageScaleX", m_fCenterImageScaleX );
ini.GetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
2003-10-12 19:45:28 +00:00
ini.GetValue( "Options", "AttractSound", m_bAttractSound );
2003-10-22 11:40:04 +00:00
ini.GetValue( "Options", "DemonstrationSound", m_bDemonstrationSound );
2003-10-19 05:49:53 +00:00
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
2003-10-16 08:55:32 +00:00
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
2002-06-27 17:49:10 +00:00
CString sAdditionalSongFolders;
if( ini.GetValue( "Options", "AdditionalSongFolders", sAdditionalSongFolders ) )
{
2003-11-01 22:04:43 +00:00
FixSlashesInPlace( sAdditionalSongFolders );
m_asAdditionalSongFolders.clear();
split( sAdditionalSongFolders, ",", m_asAdditionalSongFolders, true );
}
ini.GetValue( "Debug", "Logging", m_bLogging );
ini.GetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
ini.GetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
ini.GetValue( "Debug", "Timestamping", m_bTimestamping );
ini.GetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
2002-02-28 19:40:40 +00:00
}
2003-10-05 05:18:48 +00:00
void PrefsManager::SaveGlobalPrefsToDisk() const
2002-02-28 19:40:40 +00:00
{
IniFile ini;
2003-07-22 07:47:27 +00:00
ini.SetPath( STEPMANIA_INI_PATH );
2002-04-28 20:42:32 +00:00
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "Windowed", m_bWindowed );
ini.SetValue( "Options", "DisplayWidth", m_iDisplayWidth );
ini.SetValue( "Options", "DisplayHeight", m_iDisplayHeight );
ini.SetValue( "Options", "DisplayColorDepth", m_iDisplayColorDepth );
ini.SetValue( "Options", "TextureColorDepth", m_iTextureColorDepth );
ini.SetValue( "Options", "MovieColorDepth", m_iMovieColorDepth );
ini.SetValue( "Options", "MaxTextureResolution", m_iMaxTextureResolution );
ini.SetValue( "Options", "RefreshRate", m_iRefreshRate );
ini.SetValue( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons );
ini.SetValue( "Options", "ShowStats", m_bShowStats );
2003-11-13 00:39:36 +00:00
ini.SetValue( "Options", "ShowBanners", m_bShowBanners );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "BackgroundMode", m_BackgroundMode);
ini.SetValue( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.SetValue( "Options", "ShowDanger", m_bShowDanger );
ini.SetValue( "Options", "BGBrightness", m_fBGBrightness );
ini.SetValue( "Options", "MenuTimer", m_bMenuTimer );
ini.SetValue( "Options", "NumArcadeStages", m_iNumArcadeStages );
ini.SetValue( "Options", "EventMode", m_bEventMode );
ini.SetValue( "Options", "AutoPlay", m_bAutoPlay );
ini.SetValue( "Options", "JudgeWindowScale", m_fJudgeWindowScale );
2003-11-11 07:36:28 +00:00
ini.SetValue( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "JudgeWindowMarvelousSeconds", m_fJudgeWindowMarvelousSeconds );
ini.SetValue( "Options", "JudgeWindowPerfectSeconds", m_fJudgeWindowPerfectSeconds );
ini.SetValue( "Options", "JudgeWindowGreatSeconds", m_fJudgeWindowGreatSeconds );
ini.SetValue( "Options", "JudgeWindowGoodSeconds", m_fJudgeWindowGoodSeconds );
ini.SetValue( "Options", "JudgeWindowBooSeconds", m_fJudgeWindowBooSeconds );
ini.SetValue( "Options", "JudgeWindowOKSeconds", m_fJudgeWindowOKSeconds );
2003-11-10 01:03:47 +00:00
ini.SetValue( "Options", "JudgeWindowMineSeconds", m_fJudgeWindowMineSeconds );
2003-11-17 05:26:29 +00:00
ini.SetValue( "Options", "JudgeWindowAttackSeconds", m_fJudgeWindowAttackSeconds );
2003-11-11 07:36:28 +00:00
ini.SetValue( "Options", "LifeDeltaMarvelousPercentChange", m_fLifeDeltaMarvelousPercentChange );
ini.SetValue( "Options", "LifeDeltaPerfectPercentChange", m_fLifeDeltaPerfectPercentChange );
ini.SetValue( "Options", "LifeDeltaGreatPercentChange", m_fLifeDeltaGreatPercentChange );
ini.SetValue( "Options", "LifeDeltaGoodPercentChange", m_fLifeDeltaGoodPercentChange );
ini.SetValue( "Options", "LifeDeltaBooPercentChange", m_fLifeDeltaBooPercentChange );
ini.SetValue( "Options", "LifeDeltaMissPercentChange", m_fLifeDeltaMissPercentChange );
ini.SetValue( "Options", "LifeDeltaOKPercentChange", m_fLifeDeltaOKPercentChange );
ini.SetValue( "Options", "LifeDeltaNGPercentChange", m_fLifeDeltaNGPercentChange );
ini.SetValue( "Options", "LifeDeltaMinePercentChange", m_fLifeDeltaMinePercentChange );
2003-10-13 00:06:49 +00:00
ini.SetValue( "Options", "RegenComboAfterFail", m_iRegenComboAfterFail );
ini.SetValue( "Options", "RegenComboAfterMiss", m_iRegenComboAfterMiss );
ini.SetValue( "Options", "MaxRegenComboAfterFail", m_iMaxRegenComboAfterFail );
ini.SetValue( "Options", "MaxRegenComboAfterMiss", m_iMaxRegenComboAfterMiss );
2003-10-13 03:20:05 +00:00
ini.SetValue( "Options", "TwoPlayerRecovery", m_bTwoPlayerRecovery );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "DelayedEscape", m_bDelayedEscape );
ini.SetValue( "Options", "HiddenSongs", m_bHiddenSongs );
ini.SetValue( "Options", "Vsync", m_bVsync );
ini.SetValue( "Options", "Interlaced", m_bInterlaced );
#ifdef _XBOX
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "PAL", m_bPAL );
2003-11-13 00:39:36 +00:00
ini.SetValue( "Options", "ScreenPosX", m_fScreenPosX );
ini.SetValue( "Options", "ScreenPosY", m_fScreenPosY );
ini.SetValue( "Options", "ScreenWidth", m_fScreenWidth );
ini.SetValue( "Options", "ScreenHeight", m_fScreenHeight );
#endif
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "HowToPlay", m_bInstructions );
ini.SetValue( "Options", "Caution", m_bShowDontDie );
ini.SetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup );
ini.SetValue( "Options", "ShowNative", m_bShowNative );
ini.SetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation );
ini.SetValue( "Options", "DWIPath", m_DWIPath );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete );
ini.SetValue( "Options", "TexturePreload", m_bTexturePreload );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad );
2003-11-25 22:56:48 +00:00
ini.SetValue( "Options", "BannerCache", m_BannerCache );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "MusicWheelUsesSections", m_MusicWheelUsesSections );
ini.SetValue( "Options", "MusicWheelSwitchSpeed", m_iMusicWheelSwitchSpeed );
ini.SetValue( "Options", "EasterEggs", m_bEasterEggs );
ini.SetValue( "Options", "MarvelousTiming", m_iMarvelousTiming );
ini.SetValue( "Options", "SoundPreloadAll", m_bSoundPreloadAll );
ini.SetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.SetValue( "Options", "CoinMode", m_iCoinMode );
ini.SetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit );
2003-11-09 01:09:35 +00:00
ini.SetValue( "Options", "Premium", m_Premium );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "BoostAppPriority", m_iBoostAppPriority );
ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage );
ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
ini.SetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
ini.SetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
ini.SetValue( "Options", "ShowSongOptions", m_ShowSongOptions );
ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput );
ini.SetValue( "Options", "IgnoredMessageWindows", m_sIgnoredMessageWindows );
ini.SetValue( "Options", "SoloSingle", m_bSoloSingle );
ini.SetValue( "Options", "DancePointsForOni", m_bDancePointsForOni );
2003-10-05 05:18:48 +00:00
ini.SetValue( "Options", "PercentageScoring", m_bPercentageScoring );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics );
ini.SetValue( "Options", "AutogenMissingTypes", m_bAutogenMissingTypes );
ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
ini.SetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
ini.SetValue( "Options", "ShowDancingCharacters", m_ShowDancingCharacters );
ini.SetValue( "Options", "UseUnlockSystem", m_bUseUnlockSystem );
ini.SetValue( "Options", "FirstRun", m_bFirstRun );
ini.SetValue( "Options", "AutoMapJoysticks", m_bAutoMapOnJoyChange );
ini.SetValue( "Options", "VideoRenderers", m_sVideoRenderers );
ini.SetValue( "Options", "LastSeenVideoDriver", m_sLastSeenVideoDriver );
ini.SetValue( "Options", "LastSeenInputDevices", m_sLastSeenInputDevices );
#if defined(WIN32)
ini.SetValue( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
ini.SetValue( "Options", "CoursesToShowRanking", m_sCoursesToShowRanking );
ini.SetValue( "Options", "GetRankingName", m_iGetRankingName);
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "AntiAliasing", m_bAntiAliasing );
ini.SetValue( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
ini.SetValue( "Options", "TenFooterInRed", m_bTenFooterInRed );
ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder );
ini.SetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
ini.SetValue( "Options", "ScoringType", m_iScoringType );
ini.SetValue( "Options", "ProgressiveLifebar", m_iProgressiveLifebar );
ini.SetValue( "Options", "ProgressiveStageLifebar", m_iProgressiveStageLifebar );
ini.SetValue( "Options", "ProgressiveNonstopLifebar", m_iProgressiveNonstopLifebar );
ini.SetValue( "Options", "ShowBeginnerHelper", m_bShowBeginnerHelper );
ini.SetValue( "Options", "Language", m_sLanguage );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "EndlessBreakEnabled", m_bEndlessBreakEnabled );
ini.SetValue( "Options", "EndlessStagesUntilBreak", m_iEndlessNumStagesUntilBreak );
ini.SetValue( "Options", "EndlessBreakLength", m_iEndlessBreakLength );
for( int p=0; p<NUM_PLAYERS; p++ )
2003-11-01 22:04:43 +00:00
{
ini.SetValue( "Options", ssprintf("DefaultMachineProfileIDP%d",p+1), m_sDefaultMachineProfileID[p] );
ini.SetValue( "Options", ssprintf("MemoryCardDirP%d",p+1), m_sMemoryCardDir[p] );
ini.SetValue( "Options", ssprintf("MemoryCardMountCommandP%d",p+1), m_sMemoryCardMountCommand[p] );
2003-11-01 22:04:43 +00:00
}
2003-10-11 07:47:34 +00:00
ini.SetValue( "Options", "CenterImageTranslateX", m_iCenterImageTranslateX );
ini.SetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
ini.SetValue( "Options", "CenterImageScaleX", m_fCenterImageScaleX );
ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
2003-10-12 19:45:28 +00:00
ini.SetValue( "Options", "AttractSound", m_bAttractSound );
2003-10-22 11:40:04 +00:00
ini.SetValue( "Options", "DemonstrationSound", m_bDemonstrationSound );
2003-10-19 05:49:53 +00:00
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
2003-10-16 08:55:32 +00:00
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
2003-10-11 07:47:34 +00:00
/* Only write these if they aren't the default. This ensures that we can change
* the default and have it take effect for everyone (except people who
* tweaked this value). */
if(m_sSoundDrivers != DEFAULT_SOUND_DRIVER_LIST)
ini.SetValue ( "Options", "SoundDrivers", m_sSoundDrivers );
2003-01-11 04:03:21 +00:00
if(m_fSoundVolume != DEFAULT_SOUND_VOLUME)
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "SoundVolume", m_fSoundVolume );
2003-11-16 04:45:12 +00:00
if(m_sLightsDriver != DEFAULT_LIGHTS_DRIVER)
ini.SetValue( "Options", "LightsDriver", m_sLightsDriver );
2003-09-02 04:51:36 +00:00
if(m_sMovieDrivers != DEFAULT_MOVIE_DRIVER_LIST)
ini.SetValue ( "Options", "MovieDrivers", m_sMovieDrivers );
2002-02-28 19:40:40 +00:00
2003-10-02 02:11:47 +00:00
ini.SetValue ( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) );
2002-06-27 17:49:10 +00:00
ini.SetValue( "Debug", "Logging", m_bLogging );
ini.SetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
ini.SetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
ini.SetValue( "Debug", "Timestamping", m_bTimestamping );
ini.SetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
2002-02-28 19:40:40 +00:00
ini.WriteFile();
}