Files
itgmania212121/stepmania/src/PrefsManager.cpp
T

816 lines
37 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
#include "PrefsManager.h"
#include "IniFile.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "RageDisplay.h"
#include "RageUtil.h"
#include "arch/arch_default.h"
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"
#include "ProductInfo.h"
2004-09-13 03:58:39 +00:00
#include "Foreach.h"
#include "Preference.h"
#include "RageLog.h"
2002-02-28 19:40:40 +00:00
#define DEFAULTS_INI_PATH "Data/Defaults.ini" // these can be overridden
#define STEPMANIA_INI_PATH "Data/StepMania.ini" // overlay on Defaults.ini, contains the user's choices
#define STATIC_INI_PATH "Data/Static.ini" // overlay on the 2 above, can't be overridden
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
2004-09-13 03:58:39 +00:00
//
// For self-registering prefs
//
#include "SubscriptionManager.h"
2005-02-05 21:40:36 +00:00
template<>
set<IPreference*>* SubscriptionManager<IPreference>::s_pSubscribers = NULL;
2004-09-13 03:58:39 +00:00
void PrefsManager::Subscribe( IPreference *p )
2004-09-13 03:58:39 +00:00
{
SubscriptionManager<IPreference>::Subscribe( p );
2004-09-13 03:58:39 +00:00
}
void PrefsManager::Unsubscribe( IPreference *p )
{
SubscriptionManager<IPreference>::Unsubscribe( p );
}
2004-09-13 03:58:39 +00:00
2004-12-07 10:04:19 +00:00
IPreference *PrefsManager::GetPreferenceByName( const CString &sName )
{
FOREACHS( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
2004-12-07 10:04:19 +00:00
{
if( !(*p)->GetName().CompareNoCase( sName ) )
return *p;
}
return NULL;
}
2004-09-13 03:58:39 +00:00
2003-10-16 08:55:32 +00:00
bool g_bAutoRestart = false;
2004-12-04 08:21:54 +00:00
PrefsManager::PrefsManager() :
m_bWindowed ( Options, "Windowed",
#ifdef DEBUG
true
#else
false
#endif
),
m_iDisplayWidth ( Options, "DisplayWidth", 640 ),
m_iDisplayHeight ( Options, "DisplayHeight", 480 ),
m_iDisplayColorDepth ( Options, "DisplayColorDepth", 16 ),
m_iTextureColorDepth ( Options, "TextureColorDepth", 16 ),
m_iMovieColorDepth ( Options, "MovieColorDepth", 16 ),
m_iMaxTextureResolution ( Options, "MaxTextureResolution", 2048 ),
m_iRefreshRate ( Options, "RefreshRate", REFRESH_DEFAULT ),
m_fDisplayAspectRatio ( Options, "DisplayAspectRatio", 4/3.0f ),
2004-12-04 08:21:54 +00:00
m_bShowStats ( Options, "ShowStats",
#ifdef DEBUG
true
#else
false
#endif
),
2004-12-04 10:35:50 +00:00
m_bShowBanners ( Options, "ShowBanners", true ),
2005-04-27 07:50:38 +00:00
m_iBackgroundMode ( Options, "BackgroundMode", BGMODE_ANIMATIONS ),
m_iNumBackgrounds ( Options, "NumBackgrounds", 8 ),
2004-12-07 01:41:55 +00:00
m_fBGBrightness ( Options, "BGBrightness", 0.8f ),
m_bHiddenSongs ( Options, "HiddenSongs", false ), /* 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_bVsync ( Options, "Vsync", true ),
2005-04-27 07:50:38 +00:00
m_bInterlaced ( Options, "Interlaced", false ),
2004-12-04 10:35:50 +00:00
/* XXX: Set these defaults for individual consoles using VideoCardDefaults.ini. */
2004-12-07 01:41:55 +00:00
m_bPAL ( Options, "PAL", false ),
m_bDelayedTextureDelete ( Options, "DelayedTextureDelete", true ),
2005-04-27 07:50:38 +00:00
m_bTexturePreload ( Options, "TexturePreload", false ),
2004-12-07 01:41:55 +00:00
m_bDelayedScreenLoad ( Options, "DelayedScreenLoad", false ),
2005-04-27 07:50:38 +00:00
m_bDelayedModelDelete ( Options, "DelayedModelDelete", false ),
m_iBannerCache ( Options, "BannerCache", BNCACHE_LOW_RES_PRELOAD ),
2004-12-07 01:41:55 +00:00
m_bPalettedBannerCache ( Options, "PalettedBannerCache", false ),
m_bFastLoad ( Options, "FastLoad", true ),
2004-12-04 10:35:50 +00:00
m_bOnlyDedicatedMenuButtons ( Options, "OnlyDedicatedMenuButtons", false ),
2004-12-07 01:41:55 +00:00
m_bMenuTimer ( Options, "MenuTimer", true ),
m_bShowDanger ( Options, "ShowDanger", true ),
2004-12-04 10:35:50 +00:00
2004-12-07 01:41:55 +00:00
m_fJudgeWindowScale ( Options, "JudgeWindowScale", 1.0f ),
2005-04-27 07:50:38 +00:00
m_fJudgeWindowAdd ( Options, "JudgeWindowAdd", 0 ),
2004-12-07 01:41:55 +00:00
m_fJudgeWindowSecondsMarvelous ( Options, "JudgeWindowSecondsMarvelous", 0.0225f ),
m_fJudgeWindowSecondsPerfect ( Options, "JudgeWindowSecondsPerfect", 0.045f ),
m_fJudgeWindowSecondsGreat ( Options, "JudgeWindowSecondsGreat", 0.090f ),
2005-04-27 07:50:38 +00:00
m_fJudgeWindowSecondsGood ( Options, "JudgeWindowSecondsGood", 0.135f ),
2004-12-07 01:41:55 +00:00
m_fJudgeWindowSecondsBoo ( Options, "JudgeWindowSecondsBoo", 0.180f ),
m_fJudgeWindowSecondsOK ( Options, "JudgeWindowSecondsOK", 0.250f ), // allow enough time to take foot off and put back on
2005-04-20 01:52:55 +00:00
m_fJudgeWindowSecondsRoll ( Options, "JudgeWindowSecondsRoll", 0.350f ),
2005-04-27 07:50:38 +00:00
m_fJudgeWindowSecondsMine ( Options, "JudgeWindowSecondsMine", 0.090f ), // same as great
2004-12-07 01:41:55 +00:00
m_fJudgeWindowSecondsAttack ( Options, "JudgeWindowSecondsAttack", 0.135f ),
2004-12-04 10:35:50 +00:00
2004-12-07 01:41:55 +00:00
m_fLifeDifficultyScale ( Options, "LifeDifficultyScale", 1.0f ),
m_fLifeDeltaPercentChangeMarvelous ( Options, "LifeDeltaPercentChangeMarvelous", +0.008f ),
m_fLifeDeltaPercentChangePerfect ( Options, "LifeDeltaPercentChangePerfect", +0.008f ),
m_fLifeDeltaPercentChangeGreat ( Options, "LifeDeltaPercentChangeGreat", +0.004f ),
2005-04-27 07:50:38 +00:00
m_fLifeDeltaPercentChangeGood ( Options, "LifeDeltaPercentChangeGood", +0.000f ),
2004-12-07 01:41:55 +00:00
m_fLifeDeltaPercentChangeBoo ( Options, "LifeDeltaPercentChangeBoo", -0.040f ),
2005-04-27 07:50:38 +00:00
m_fLifeDeltaPercentChangeMiss ( Options, "LifeDeltaPercentChangeMiss", -0.080f ),
2004-12-07 01:41:55 +00:00
m_fLifeDeltaPercentChangeHitMine ( Options, "LifeDeltaPercentChangeHitMine", -0.160f ),
m_fLifeDeltaPercentChangeOK ( Options, "LifeDeltaPercentChangeOK", +0.008f ),
m_fLifeDeltaPercentChangeNG ( Options, "LifeDeltaPercentChangeNG", -0.080f ),
2005-04-27 07:50:38 +00:00
m_fTugMeterPercentChangeMarvelous ( Options, "TugMeterPercentChangeMarvelous", +0.010f ),
m_fTugMeterPercentChangePerfect ( Options, "TugMeterPercentChangePerfect", +0.008f ),
m_fTugMeterPercentChangeGreat ( Options, "TugMeterPercentChangeGreat", +0.004f ),
m_fTugMeterPercentChangeGood ( Options, "TugMeterPercentChangeGood", +0.000f ),
m_fTugMeterPercentChangeBoo ( Options, "TugMeterPercentChangeBoo", -0.010f ),
m_fTugMeterPercentChangeMiss ( Options, "TugMeterPercentChangeMiss", -0.020f ),
m_fTugMeterPercentChangeHitMine ( Options, "TugMeterPercentChangeHitMine", -0.040f ),
m_fTugMeterPercentChangeOK ( Options, "TugMeterPercentChangeOK", +0.008f ),
m_fTugMeterPercentChangeNG ( Options, "TugMeterPercentChangeNG", -0.020f ),
m_iRegenComboAfterFail ( Options, "RegenComboAfterFail", 10 ),
m_iRegenComboAfterMiss ( Options, "RegenComboAfterMiss", 5 ),
m_iMaxRegenComboAfterFail ( Options, "MaxRegenComboAfterFail", 10 ),
m_iMaxRegenComboAfterMiss ( Options, "MaxRegenComboAfterMiss", 10 ),
m_bTwoPlayerRecovery ( Options, "TwoPlayerRecovery", true ),
m_bMercifulDrain ( Options, "MercifulDrain", true ), // negative life deltas are scaled by the players life percentage
m_bMinimum1FullSongInCourses ( Options, "Minimum1FullSongInCourses", false ), // FEoS for 1st song, FailImmediate thereafter
m_bFailOffInBeginner ( Options, "FailOffInBeginner", false ),
m_bFailOffForFirstStageEasy ( Options, "FailOffForFirstStageEasy", false ),
2005-04-27 08:52:58 +00:00
m_bMercifulBeginner ( Options, "MercifulBeginner", false ),
2005-04-27 07:50:38 +00:00
m_iPercentScoreWeightMarvelous ( Options, "PercentScoreWeightMarvelous", 3 ),
m_iPercentScoreWeightPerfect ( Options, "PercentScoreWeightPerfect", 2 ),
m_iPercentScoreWeightGreat ( Options, "PercentScoreWeightGreat", 1 ),
m_iPercentScoreWeightGood ( Options, "PercentScoreWeightGood", 0 ),
m_iPercentScoreWeightBoo ( Options, "PercentScoreWeightBoo", 0 ),
m_iPercentScoreWeightMiss ( Options, "PercentScoreWeightMiss", 0 ),
m_iPercentScoreWeightOK ( Options, "PercentScoreWeightOK", 3 ),
m_iPercentScoreWeightNG ( Options, "PercentScoreWeightNG", 0 ),
m_iPercentScoreWeightHitMine ( Options, "PercentScoreWeightHitMine", -2 ),
m_iGradeWeightMarvelous ( Options, "GradeWeightMarvelous", 2 ),
m_iGradeWeightPerfect ( Options, "GradeWeightPerfect", 2 ),
m_iGradeWeightGreat ( Options, "GradeWeightGreat", 1 ),
m_iGradeWeightGood ( Options, "GradeWeightGood", 0 ),
m_iGradeWeightBoo ( Options, "GradeWeightBoo", -4 ),
m_iGradeWeightMiss ( Options, "GradeWeightMiss", -8 ),
m_iGradeWeightHitMine ( Options, "GradeWeightHitMine", -8 ),
m_iGradeWeightOK ( Options, "GradeWeightOK", 6 ),
m_iGradeWeightNG ( Options, "GradeWeightNG", 0 ),
m_fSuperMeterPercentChangeMarvelous ( Options, "SuperMeterPercentChangeMarvelous", +0.05f ),
m_fSuperMeterPercentChangePerfect ( Options, "SuperMeterPercentChangePerfect", +0.04f ),
m_fSuperMeterPercentChangeGreat ( Options, "SuperMeterPercentChangeGreat", +0.02f ),
m_fSuperMeterPercentChangeGood ( Options, "SuperMeterPercentChangeGood", +0.00f ),
m_fSuperMeterPercentChangeBoo ( Options, "SuperMeterPercentChangeBoo", -0.00f ),
m_fSuperMeterPercentChangeMiss ( Options, "SuperMeterPercentChangeMiss", -0.20f ),
m_fSuperMeterPercentChangeHitMine ( Options, "SuperMeterPercentChangeHitMine", -0.40f ),
m_fSuperMeterPercentChangeOK ( Options, "SuperMeterPercentChangeOK", +0.04f ),
m_fSuperMeterPercentChangeNG ( Options, "SuperMeterPercentChangeNG", -0.20f ),
m_bMercifulSuperMeter ( Options, "MercifulSuperMeter", true ),
2005-04-28 02:49:39 +00:00
m_fTimeMeterSecondsChangeMarvelous ( Options, "TimeMeterSecondsChangeMarvelous", 0.0f ),
m_fTimeMeterSecondsChangePerfect ( Options, "TimeMeterSecondsChangePerfect", -0.1f ),
2005-04-27 07:50:38 +00:00
m_fTimeMeterSecondsChangeGreat ( Options, "TimeMeterSecondsChangeGreat", -0.5f ),
m_fTimeMeterSecondsChangeGood ( Options, "TimeMeterSecondsChangeGood", -1.0f ),
m_fTimeMeterSecondsChangeBoo ( Options, "TimeMeterSecondsChangeBoo", -2.0f ),
m_fTimeMeterSecondsChangeMiss ( Options, "TimeMeterSecondsChangeMiss", -4.0f ),
m_fTimeMeterSecondsChangeHitMine ( Options, "TimeMeterSecondsChangeHitMine", -2.0f ),
m_fTimeMeterSecondsChangeOK ( Options, "TimeMeterSecondsChangeOK", -0.0f ),
m_fTimeMeterSecondsChangeNG ( Options, "TimeMeterSecondsChangeNG", -4.0f ),
m_bAutoPlay ( Options, "AutoPlay", false ),
m_bDelayedBack ( Options, "DelayedBack", true ),
m_bShowInstructions ( Options, "ShowInstructions", true ),
m_bShowCaution ( Options, "ShowCaution", true ),
m_bShowSelectGroup ( Options, "ShowSelectGroup", true ),
m_bShowNativeLanguage ( Options, "ShowNativeLanguage", true ),
m_bArcadeOptionsNavigation ( Options, "ArcadeOptionsNavigation", false ),
m_MusicWheelUsesSections ( Options, "MusicWheelUsesSections", ALWAYS ),
m_iMusicWheelSwitchSpeed ( Options, "MusicWheelSwitchSpeed", 10 ),
m_bEasterEggs ( Options, "EasterEggs", true ),
m_iMarvelousTiming ( Options, "MarvelousTiming", MARVELOUS_EVERYWHERE ),
m_bEventMode ( Options, "EventMode", false ),
m_iCoinsPerCredit ( Options, "CoinsPerCredit", 1 ),
m_iNumArcadeStages ( Options, "SongsPerPlay", 3 ),
m_fGlobalOffsetSeconds ( Options, "GlobalOffsetSeconds", 0 )
{
Init();
ReadGlobalPrefsFromDisk();
}
void PrefsManager::Init()
2002-02-28 19:40:40 +00:00
{
2004-06-18 11:02:40 +00:00
m_bCelShadeModels = false; // Work-In-Progress.. disable by default.
2005-04-27 07:50:38 +00:00
m_fConstantUpdateDeltaSeconds = 0;
2003-04-18 23:55:20 +00:00
m_bSoloSingle = false;
m_CoinMode = COIN_HOME;
m_Premium = PREMIUM_NONE;
2004-05-07 08:08:11 +00:00
m_bDelayedCreditsReconcile = false;
2003-01-18 04:26:25 +00:00
m_iBoostAppPriority = -1;
2003-12-20 21:29:55 +00:00
m_bSmoothLines = 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_fMinPercentageForMachineSongHighScore = 0.5f;
2005-04-03 08:12:45 +00:00
m_fMinPercentageForMachineCourseHighScore = 0.0001f; // don't save course scores with 0 percentage
2004-03-28 20:08:43 +00:00
m_bDisqualification = false;
m_bShowLyrics = true;
2004-02-10 21:10:23 +00:00
m_bAutogenSteps = true;
m_bAutogenGroupCourses = true;
m_bBreakComboToGetItem = false;
2004-01-21 01:33:29 +00:00
m_bLockCourseDifficulties = true;
m_ShowDancingCharacters = CO_OFF;
m_bUseUnlockSystem = false;
m_bFirstRun = true;
m_bAutoMapOnJoyChange = true;
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;
2004-03-15 02:32:51 +00:00
m_bDisableScreenSaver = 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;
2004-06-02 07:07:12 +00:00
m_bSubSortByNumSteps = false;
m_iScoringType = SCORING_MAX2;
m_iGetRankingName = RANKING_ON;
m_fLongVerSongSeconds = 60*2.5f; // Dynamite Rave is 2:55
m_fMarathonVerSongSeconds = 60*5.f;
2004-12-04 10:35:50 +00:00
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_fCenterImageAddWidth = 0;
m_fCenterImageAddHeight = 0;
2003-10-11 07:47:34 +00:00
m_iAttractSoundFrequency = 1;
2003-10-19 05:49:53 +00:00
m_bAllowExtraStage = true;
2004-03-01 02:45:29 +00:00
m_bHideDefaultNoteSkin = false;
m_iMaxHighScoresPerListForMachine = 10;
m_iMaxHighScoresPerListForPlayer = 3;
m_iMaxRecentScoresForMachine = 100;
m_iMaxRecentScoresForPlayer = 20;
2005-04-25 09:03:24 +00:00
m_bAllowMultipleHighScoreWithSameName = true;
m_fPadStickSeconds = 0;
m_bForceMipMaps = false;
2004-05-18 09:05:21 +00:00
m_bTrilinearFiltering = false;
m_bAnisotropicFiltering = false;
2003-10-16 08:55:32 +00:00
g_bAutoRestart = false;
m_bSignProfileData = false;
m_bEditorShowBGChangesPlay = false;
m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST;
2003-12-02 20:52:10 +00:00
/* Number of frames to write ahead; usually 44100 frames per second.
* (Number of millisec would be more flexible, but it's more useful to
* specify numbers directly.) This is purely a troubleshooting option
* and is not honored by all sound drivers. */
m_iSoundWriteAhead = 0;
2004-07-17 21:22:36 +00:00
m_iSoundDevice = "";
2004-02-21 00:14:38 +00:00
m_fSoundVolume = DEFAULT_SOUND_VOLUME;
m_iSoundResampleQuality = RageSoundReader_Resample::RESAMP_NORMAL;
m_sInputDrivers = DEFAULT_INPUT_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-11-16 04:45:12 +00:00
m_sLightsDriver = DEFAULT_LIGHTS_DRIVER;
2004-05-20 19:05:37 +00:00
m_sLightsStepsDifficulty = "medium";
m_bBlinkGameplayButtonLightsOnNote = false;
m_bAllowUnacceleratedRenderer = false;
2003-07-13 20:21:04 +00:00
m_bThreadedInput = true;
2004-04-08 20:36:44 +00:00
m_bThreadedMovieDecode = true;
2003-12-18 21:16:43 +00:00
m_bScreenTestMode = false;
2004-02-16 05:35:06 +00:00
m_sMachineName = "NoName";
2003-07-07 03:51:20 +00:00
m_sIgnoredMessageWindows = "";
2003-08-20 17:54:26 +00:00
m_sCoursesToShowRanking = "";
2004-02-27 00:56:51 +00:00
m_bLogToDisk = true;
m_bForceLogFlush = false;
#ifdef DEBUG
m_bShowLogOutput = true;
#else
m_bShowLogOutput = false;
#endif
m_bTimestamping = false;
2004-01-17 23:22:08 +00:00
m_bLogSkips = false;
m_bLogCheckpoints = false;
2004-02-15 22:56:51 +00:00
m_bShowLoadingWindow = true;
2004-06-06 01:50:21 +00:00
m_bMemoryCards = false;
FOREACH_PlayerNumber( p )
{
m_iMemoryCardUsbBus[p] = -1;
m_iMemoryCardUsbPort[p] = -1;
m_iMemoryCardUsbLevel[p] = -1;
}
2004-10-03 05:27:52 +00:00
m_sMemoryCardProfileSubdir = PRODUCT_NAME;
m_iProductID = 1;
2004-09-13 03:58:39 +00:00
#if defined(XBOX)
m_bEnableVirtualMemory = true;
m_iPageFileSize = 384;
m_iPageSize = 16;
m_iPageThreshold = 8;
m_bLogVirtualMemory = false;
#endif
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
(*p)->LoadDefault();
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
{
ReadPrefsFromFile( DEFAULTS_INI_PATH );
ReadPrefsFromFile( STEPMANIA_INI_PATH );
ReadPrefsFromFile( STATIC_INI_PATH );
}
2003-10-08 08:01:41 +00:00
void PrefsManager::ResetToFactoryDefaults()
{
// clobber the users prefs by initing then applying defaults
Init();
m_bFirstRun = false;
ReadPrefsFromFile( DEFAULTS_INI_PATH );
2004-08-22 18:08:06 +00:00
ReadPrefsFromFile( STATIC_INI_PATH );
SaveGlobalPrefsToDisk();
}
void PrefsManager::ReadPrefsFromFile( CString sIni )
{
IniFile ini;
if( !ini.ReadFile(sIni) )
return;
2002-02-28 19:40:40 +00:00
2005-02-19 01:59:31 +00:00
ReadGlobalPrefsFromIni( ini );
}
void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini )
{
2004-06-18 11:02:40 +00:00
ini.GetValue( "Options", "CelShadeModels", m_bCelShadeModels );
2004-07-28 16:04:19 +00:00
ini.GetValue( "Options", "ConstantUpdateDeltaSeconds", m_fConstantUpdateDeltaSeconds );
2005-04-27 07:50:38 +00:00
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "SoundDrivers", m_sSoundDrivers );
2003-12-02 20:52:10 +00:00
ini.GetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead );
2004-07-17 21:22:36 +00:00
ini.GetValue( "Options", "SoundDevice", m_iSoundDevice );
ini.GetValue( "Options", "InputDrivers", m_sInputDrivers );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "MovieDrivers", m_sMovieDrivers );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "SoundVolume", m_fSoundVolume );
2003-11-16 04:45:12 +00:00
ini.GetValue( "Options", "LightsDriver", m_sLightsDriver );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.GetValue( "Options", "CoinMode", (int&)m_CoinMode );
2005-04-27 07:50:38 +00:00
m_iCoinsPerCredit = max( (int)m_iCoinsPerCredit, 1);
2003-11-09 01:09:35 +00:00
ini.GetValue( "Options", "Premium", (int&)m_Premium );
2004-05-07 08:08:11 +00:00
ini.GetValue( "Options", "DelayedCreditsReconcile", m_bDelayedCreditsReconcile );
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 );
2004-05-20 19:05:37 +00:00
ini.GetValue( "Options", "LightsStepsDifficulty", m_sLightsStepsDifficulty );
ini.GetValue( "Options", "BlinkGameplayButtonLightsOnNote", m_bBlinkGameplayButtonLightsOnNote );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
ini.GetValue( "Options", "ThreadedInput", m_bThreadedInput );
2004-04-02 23:14:29 +00:00
ini.GetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
2003-12-18 21:16:43 +00:00
ini.GetValue( "Options", "ScreenTestMode", m_bScreenTestMode );
2004-02-16 05:35:06 +00:00
ini.GetValue( "Options", "MachineName", m_sMachineName );
2003-10-02 02:03:29 +00:00
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 );
ini.GetValue( "Options", "MinPercentageForMachineSongHighScore", m_fMinPercentageForMachineSongHighScore );
ini.GetValue( "Options", "MinPercentageForMachineCourseHighScore", m_fMinPercentageForMachineCourseHighScore );
2004-03-28 20:08:43 +00:00
ini.GetValue( "Options", "Disqualification", m_bDisqualification );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowLyrics", m_bShowLyrics );
2004-02-10 21:10:23 +00:00
ini.GetValue( "Options", "AutogenSteps", m_bAutogenSteps );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
ini.GetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
2004-01-21 01:33:29 +00:00
ini.GetValue( "Options", "LockCourseDifficulties", m_bLockCourseDifficulties );
2003-10-02 02:03:29 +00:00
ini.GetValue( "Options", "ShowDancingCharacters", (int&)m_ShowDancingCharacters );
2003-10-02 02:11:47 +00:00
ini.GetValue( "Options", "CourseSortOrder", (int&)m_iCourseSortOrder );
ini.GetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
2004-06-02 07:07:12 +00:00
ini.GetValue( "Options", "SubSortByNumSteps", m_bSubSortByNumSteps );
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: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);
2004-06-02 07:07:12 +00:00
ini.GetValue( "Options", "SmoothLines", m_bSmoothLines );
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 );
2004-02-17 07:16:58 +00:00
ini.GetValue( "Options", "DisableScreenSaver", m_bDisableScreenSaver );
ini.GetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir );
ini.GetValue( "Options", "ProductID", m_iProductID );
2004-06-06 01:50:21 +00:00
ini.GetValue( "Options", "MemoryCards", m_bMemoryCards );
FOREACH_PlayerNumber( p )
2003-11-01 22:04:43 +00:00
{
2003-12-07 08:19:10 +00:00
ini.GetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.GetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
FixSlashesInPlace( m_sMemoryCardOsMountPoint[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
ini.GetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[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", "CenterImageAddWidth", m_fCenterImageAddWidth );
ini.GetValue( "Options", "CenterImageAddHeight", m_fCenterImageAddHeight );
2003-12-28 19:46:50 +00:00
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
2003-10-19 05:49:53 +00:00
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
2004-03-01 02:45:29 +00:00
ini.GetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
ini.GetValue( "Options", "MaxHighScoresPerListForMachine", m_iMaxHighScoresPerListForMachine );
ini.GetValue( "Options", "MaxHighScoresPerListForPlayer", m_iMaxHighScoresPerListForPlayer );
ini.GetValue( "Options", "MaxRecentScoresForMachine", m_iMaxRecentScoresForMachine );
ini.GetValue( "Options", "MaxRecentScoresForPlayer", m_iMaxRecentScoresForPlayer );
2005-04-25 09:03:24 +00:00
ini.GetValue( "Options", "AllowMultipleHighScoreWithSameName", m_bAllowMultipleHighScoreWithSameName );
ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
ini.GetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
2004-05-18 09:05:21 +00:00
ini.GetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
ini.GetValue( "Options", "AnisotropicFiltering", m_bAnisotropicFiltering );
2003-10-16 08:55:32 +00:00
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.GetValue( "Options", "SignProfileData", m_bSignProfileData );
ini.GetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay );
ini.GetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders );
ini.GetValue( "Options", "AdditionalFolders", m_sAdditionalFolders );
FixSlashesInPlace(m_sAdditionalSongFolders);
FixSlashesInPlace(m_sAdditionalFolders);
#if defined(XBOX)
ini.GetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
ini.GetValue( "Options", "PageFileSize", m_iPageFileSize );
ini.GetValue( "Options", "PageSize", m_iPageSize );
ini.GetValue( "Options", "PageThreshold", m_iPageThreshold );
ini.GetValue( "Debug", "LogVirtualMemory", m_bLogVirtualMemory );
#endif
2004-02-27 00:56:51 +00:00
ini.GetValue( "Debug", "LogToDisk", m_bLogToDisk );
ini.GetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
ini.GetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
ini.GetValue( "Debug", "Timestamping", m_bTimestamping );
2004-01-17 23:22:08 +00:00
ini.GetValue( "Debug", "LogSkips", m_bLogSkips );
ini.GetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
2004-02-15 22:56:51 +00:00
ini.GetValue( "Debug", "ShowLoadingWindow", m_bShowLoadingWindow );
2004-09-13 03:58:39 +00:00
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
(*p)->ReadFrom( ini );
2002-02-28 19:40:40 +00:00
}
void PrefsManager::SaveGlobalPrefsToDisk() const
2002-02-28 19:40:40 +00:00
{
IniFile ini;
2005-02-19 01:59:31 +00:00
SaveGlobalPrefsToIni( ini );
ini.WriteFile( STEPMANIA_INI_PATH );
}
2002-04-28 20:42:32 +00:00
2005-02-19 01:59:31 +00:00
void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const
{
2004-06-18 11:02:40 +00:00
ini.SetValue( "Options", "CelShadeModels", m_bCelShadeModels );
2004-07-28 16:04:19 +00:00
ini.SetValue( "Options", "ConstantUpdateDeltaSeconds", m_fConstantUpdateDeltaSeconds );
2004-12-04 10:35:50 +00:00
ini.SetValue( "Options", "BackgroundMode", m_iBackgroundMode);
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "NumBackgrounds", m_iNumBackgrounds);
ini.SetValue( "Options", "BGBrightness", m_fBGBrightness );
2005-04-27 07:50:38 +00:00
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "JudgeWindowScale", m_fJudgeWindowScale );
ini.SetValue( "Options", "JudgeWindowAdd", m_fJudgeWindowAdd );
2004-01-20 07:09:44 +00:00
ini.SetValue( "Options", "JudgeWindowSecondsMarvelous", m_fJudgeWindowSecondsMarvelous );
ini.SetValue( "Options", "JudgeWindowSecondsPerfect", m_fJudgeWindowSecondsPerfect );
ini.SetValue( "Options", "JudgeWindowSecondsGreat", m_fJudgeWindowSecondsGreat );
ini.SetValue( "Options", "JudgeWindowSecondsGood", m_fJudgeWindowSecondsGood );
ini.SetValue( "Options", "JudgeWindowSecondsBoo", m_fJudgeWindowSecondsBoo );
ini.SetValue( "Options", "JudgeWindowSecondsOK", m_fJudgeWindowSecondsOK );
2005-04-20 01:52:55 +00:00
ini.SetValue( "Options", "JudgeWindowSecondsRoll", m_fJudgeWindowSecondsRoll );
2004-01-20 07:09:44 +00:00
ini.SetValue( "Options", "JudgeWindowSecondsMine", m_fJudgeWindowSecondsMine );
ini.SetValue( "Options", "JudgeWindowSecondsAttack", m_fJudgeWindowSecondsAttack );
ini.SetValue( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale );
2004-01-20 07:09:44 +00:00
ini.SetValue( "Options", "LifeDeltaPercentChangeMarvelous", m_fLifeDeltaPercentChangeMarvelous );
ini.SetValue( "Options", "LifeDeltaPercentChangePerfect", m_fLifeDeltaPercentChangePerfect );
ini.SetValue( "Options", "LifeDeltaPercentChangeGreat", m_fLifeDeltaPercentChangeGreat );
ini.SetValue( "Options", "LifeDeltaPercentChangeGood", m_fLifeDeltaPercentChangeGood );
ini.SetValue( "Options", "LifeDeltaPercentChangeBoo", m_fLifeDeltaPercentChangeBoo );
ini.SetValue( "Options", "LifeDeltaPercentChangeMiss", m_fLifeDeltaPercentChangeMiss );
ini.SetValue( "Options", "LifeDeltaPercentChangeHitMine", m_fLifeDeltaPercentChangeHitMine );
ini.SetValue( "Options", "LifeDeltaPercentChangeOK", m_fLifeDeltaPercentChangeOK );
ini.SetValue( "Options", "LifeDeltaPercentChangeNG", m_fLifeDeltaPercentChangeNG );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "HiddenSongs", m_bHiddenSongs );
ini.SetValue( "Options", "Vsync", m_bVsync );
ini.SetValue( "Options", "Interlaced", m_bInterlaced );
ini.SetValue( "Options", "PAL", m_bPAL );
2005-04-27 07:50:38 +00:00
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 );
ini.SetValue( "Options", "DelayedModelDelete", m_bDelayedModelDelete );
2004-12-04 10:35:50 +00:00
ini.SetValue( "Options", "BannerCache", m_iBannerCache );
2004-09-04 04:19:04 +00:00
ini.SetValue( "Options", "PalettedBannerCache", m_bPalettedBannerCache );
2003-12-31 09:32:21 +00:00
ini.SetValue( "Options", "FastLoad", m_bFastLoad );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.SetValue( "Options", "CoinMode", m_CoinMode );
2003-11-09 01:09:35 +00:00
ini.SetValue( "Options", "Premium", m_Premium );
2004-05-07 08:08:11 +00:00
ini.SetValue( "Options", "DelayedCreditsReconcile", m_bDelayedCreditsReconcile );
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 );
2004-05-20 19:05:37 +00:00
ini.SetValue( "Options", "LightsStepsDifficulty", m_sLightsStepsDifficulty );
ini.SetValue( "Options", "BlinkGameplayButtonLightsOnNote", m_bBlinkGameplayButtonLightsOnNote );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput );
2004-04-02 23:14:29 +00:00
ini.SetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
2003-12-18 21:16:43 +00:00
ini.SetValue( "Options", "ScreenTestMode", m_bScreenTestMode );
2004-02-16 05:35:06 +00:00
ini.SetValue( "Options", "MachineName", m_sMachineName );
2003-10-02 02:11:47 +00:00
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 );
ini.SetValue( "Options", "MinPercentageForMachineSongHighScore", m_fMinPercentageForMachineSongHighScore );
ini.SetValue( "Options", "MinPercentageForMachineCourseHighScore", m_fMinPercentageForMachineCourseHighScore );
2004-03-28 20:08:43 +00:00
ini.SetValue( "Options", "Disqualification", m_bDisqualification );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "ShowLyrics", m_bShowLyrics );
2004-02-10 21:10:23 +00:00
ini.SetValue( "Options", "AutogenSteps", m_bAutogenSteps );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "AutogenGroupCourses", m_bAutogenGroupCourses );
ini.SetValue( "Options", "BreakComboToGetItem", m_bBreakComboToGetItem );
2004-01-21 01:33:29 +00:00
ini.SetValue( "Options", "LockCourseDifficulties", m_bLockCourseDifficulties );
2003-10-02 02:11:47 +00:00
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);
2004-06-02 07:07:12 +00:00
ini.SetValue( "Options", "SmoothLines", m_bSmoothLines );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "CourseSortOrder", m_iCourseSortOrder );
ini.SetValue( "Options", "MoveRandomToEnd", m_bMoveRandomToEnd );
2004-06-02 07:07:12 +00:00
ini.SetValue( "Options", "SubSortByNumSteps", m_bSubSortByNumSteps );
2003-10-02 02:11:47 +00:00
ini.SetValue( "Options", "ScoringType", m_iScoringType );
2003-08-20 17:54:26 +00:00
2003-10-02 02:11:47 +00:00
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 );
2004-02-17 07:16:58 +00:00
ini.SetValue( "Options", "DisableScreenSaver", m_bDisableScreenSaver );
ini.SetValue( "Options", "MemoryCardProfileSubdir", m_sMemoryCardProfileSubdir );
ini.SetValue( "Options", "ProductID", m_iProductID );
2004-06-06 01:50:21 +00:00
ini.SetValue( "Options", "MemoryCards", m_bMemoryCards );
FOREACH_PlayerNumber( p )
2003-11-01 22:04:43 +00:00
{
2003-12-07 08:19:10 +00:00
ini.SetValue( "Options", ssprintf("DefaultLocalProfileIDP%d",p+1), m_sDefaultLocalProfileID[p] );
ini.SetValue( "Options", ssprintf("MemoryCardOsMountPointP%d",p+1), m_sMemoryCardOsMountPoint[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbBusP%d",p+1), m_iMemoryCardUsbBus[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbPortP%d",p+1), m_iMemoryCardUsbPort[p] );
ini.SetValue( "Options", ssprintf("MemoryCardUsbLevelP%d",p+1), m_iMemoryCardUsbLevel[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", "CenterImageAddWidth", m_fCenterImageAddWidth );
ini.SetValue( "Options", "CenterImageAddHeight", m_fCenterImageAddHeight );
2003-12-28 19:46:50 +00:00
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
2003-10-19 05:49:53 +00:00
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
2004-03-01 02:45:29 +00:00
ini.SetValue( "Options", "HideDefaultNoteSkin", m_bHideDefaultNoteSkin );
ini.SetValue( "Options", "MaxHighScoresPerListForMachine", m_iMaxHighScoresPerListForMachine );
ini.SetValue( "Options", "MaxHighScoresPerListForPlayer", m_iMaxHighScoresPerListForPlayer );
ini.SetValue( "Options", "MaxRecentScoresForMachine", m_iMaxRecentScoresForMachine );
ini.SetValue( "Options", "MaxRecentScoresForPlayer", m_iMaxRecentScoresForPlayer );
2005-04-25 09:03:24 +00:00
ini.SetValue( "Options", "AllowMultipleHighScoreWithSameName", m_bAllowMultipleHighScoreWithSameName );
ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
ini.SetValue( "Options", "ForceMipMaps", m_bForceMipMaps );
2004-05-18 09:05:21 +00:00
ini.SetValue( "Options", "TrilinearFiltering", m_bTrilinearFiltering );
ini.SetValue( "Options", "AnisotropicFiltering", m_bAnisotropicFiltering );
2003-10-16 08:55:32 +00:00
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.SetValue( "Options", "SignProfileData", m_bSignProfileData );
2003-12-02 20:52:10 +00:00
ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead );
2004-07-17 21:22:36 +00:00
ini.SetValue( "Options", "SoundDevice", m_iSoundDevice );
2003-10-11 07:47:34 +00:00
ini.SetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay );
/* 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 );
if(m_sInputDrivers != DEFAULT_INPUT_DRIVER_LIST)
ini.SetValue ( "Options", "InputDrivers", m_sInputDrivers );
2003-09-02 04:51:36 +00:00
if(m_sMovieDrivers != DEFAULT_MOVIE_DRIVER_LIST)
ini.SetValue ( "Options", "MovieDrivers", m_sMovieDrivers );
if(m_sLightsDriver != DEFAULT_LIGHTS_DRIVER)
ini.SetValue( "Options", "LightsDriver", m_sLightsDriver );
2002-02-28 19:40:40 +00:00
ini.SetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders);
ini.SetValue( "Options", "AdditionalFolders", m_sAdditionalFolders);
2002-06-27 17:49:10 +00:00
#if defined(XBOX)
ini.SetValue( "Options", "EnableVirtualMemory", m_bEnableVirtualMemory );
ini.SetValue( "Options", "PageFileSize", m_iPageFileSize );
ini.SetValue( "Options", "PageSize", m_iPageSize );
ini.SetValue( "Options", "PageThreshold", m_iPageThreshold );
#endif
2004-02-27 00:56:51 +00:00
ini.SetValue( "Debug", "LogToDisk", m_bLogToDisk );
ini.SetValue( "Debug", "ForceLogFlush", m_bForceLogFlush );
ini.SetValue( "Debug", "ShowLogOutput", m_bShowLogOutput );
ini.SetValue( "Debug", "Timestamping", m_bTimestamping );
2004-01-17 23:22:08 +00:00
ini.SetValue( "Debug", "LogSkips", m_bLogSkips );
ini.SetValue( "Debug", "LogCheckpoints", m_bLogCheckpoints );
2004-02-15 22:56:51 +00:00
ini.SetValue( "Debug", "ShowLoadingWindow", m_bShowLoadingWindow );
#if defined(XBOX)
ini.SetValue( "Debug", "LogVirtualMemory", m_bLogVirtualMemory );
#endif
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
(*p)->WriteTo( ini );
2002-02-28 19:40:40 +00:00
}
2005-02-17 21:35:45 +00:00
// lua start
#include "LuaBinding.h"
template<class T>
class LunaPrefsManager : public Luna<T>
{
public:
LunaPrefsManager() { LUA->Register( Register ); }
static int GetPreference( T* p, lua_State *L )
{
CString sName = SArg(1);
IPreference *pPref = PREFSMAN->GetPreferenceByName( sName );
if( pPref == NULL )
{
LOG->Warn( "GetPreference: unknown preference \"%s\"", sName.c_str() );
lua_pushnil( L );
}
else
2005-02-23 01:11:02 +00:00
{
pPref->PushValue( L );
2005-02-23 01:11:02 +00:00
}
return 1;
}
static int SetPreference( T* p, lua_State *L )
{
CString sName = SArg(1);
IPreference *pPref = PREFSMAN->GetPreferenceByName( sName );
if( pPref == NULL )
LOG->Warn( "GetPreference: unknown preference \"%s\"", sName.c_str() );
else
{
lua_pushvalue( L, 2 );
pPref->SetFromStack( L );
}
return 0;
}
2005-02-17 21:35:45 +00:00
static void Register(lua_State *L)
{
ADD_METHOD( GetPreference )
ADD_METHOD( SetPreference )
2005-02-17 21:35:45 +00:00
Luna<T>::Register( L );
// Add global singleton if constructed already. If it's not constructed yet,
// then we'll register it later when we reinit Lua just before
// initializing the display.
if( PREFSMAN )
{
lua_pushstring(L, "PREFSMAN");
PREFSMAN->PushSelf( LUA->L );
lua_settable(L, LUA_GLOBALSINDEX);
}
}
};
LUA_REGISTER_CLASS( PrefsManager )
// lua end
2005-01-17 04:05:40 +00:00
#include "LuaFunctions.h"
int LuaFunc_GetPreference( lua_State *L )
{
REQ_ARGS( "GetPreference", 1 );
REQ_ARG( "GetPreference", 1, string );
CString sName;
LuaHelpers::PopStack( sName, NULL );
IPreference *pPref = PREFSMAN->GetPreferenceByName( sName );
if( pPref == NULL )
{
LOG->Warn( "GetPreference: unknown preference \"%s\"", sName.c_str() );
lua_pushnil( L );
}
else
pPref->PushValue( L );
return 1;
}
LuaFunction( GetPreference ); /* register it */
2005-01-26 07:34:20 +00:00
LuaFunction_NoArgs( EventMode, PREFSMAN->m_bEventMode )
LuaFunction_NoArgs( ShowCaution, PREFSMAN->m_bShowCaution )
2005-01-17 04:05:40 +00:00
2004-06-08 01:24:17 +00:00
/*
* (c) 2001-2004 Chris Danford, Chris Gomez
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/