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"
|
2002-08-30 06:18:30 +00:00
|
|
|
#include "RageDisplay.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "RageUtil.h"
|
2005-03-14 06:44:38 +00:00
|
|
|
#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"
|
2003-12-19 08:51:47 +00:00
|
|
|
#include "ProductInfo.h"
|
2004-09-13 03:58:39 +00:00
|
|
|
#include "Foreach.h"
|
|
|
|
|
#include "Preference.h"
|
2005-03-13 16:04:06 +00:00
|
|
|
#include "RageLog.h"
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2004-08-22 15:55:23 +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
|
|
|
|
|
//
|
2005-02-05 11:21:13 +00:00
|
|
|
#include "SubscriptionManager.h"
|
2005-02-05 21:40:36 +00:00
|
|
|
template<>
|
2005-02-05 11:21:13 +00:00
|
|
|
set<IPreference*>* SubscriptionManager<IPreference>::s_pSubscribers = NULL;
|
2004-09-13 03:58:39 +00:00
|
|
|
|
2004-09-21 06:07:12 +00:00
|
|
|
void PrefsManager::Subscribe( IPreference *p )
|
2004-09-13 03:58:39 +00:00
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
SubscriptionManager<IPreference>::Subscribe( p );
|
2004-09-13 03:58:39 +00:00
|
|
|
}
|
|
|
|
|
|
2004-11-06 20:36:04 +00:00
|
|
|
void PrefsManager::Unsubscribe( IPreference *p )
|
|
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
SubscriptionManager<IPreference>::Unsubscribe( p );
|
2004-11-06 20:36:04 +00:00
|
|
|
}
|
2004-09-13 03:58:39 +00:00
|
|
|
|
2004-12-07 10:04:19 +00:00
|
|
|
IPreference *PrefsManager::GetPreferenceByName( const CString &sName )
|
|
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
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
|
|
|
#ifdef DEBUG
|
2005-05-30 11:52:56 +00:00
|
|
|
# define TRUE_IF_DEBUG true
|
2004-12-04 08:21:54 +00:00
|
|
|
#else
|
2005-05-30 11:52:56 +00:00
|
|
|
# define TRUE_IF_DEBUG false
|
2004-12-04 08:21:54 +00:00
|
|
|
#endif
|
2005-05-30 11:52:56 +00:00
|
|
|
|
|
|
|
|
PrefsManager::PrefsManager() :
|
|
|
|
|
m_bWindowed ( "Windowed", TRUE_IF_DEBUG),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iDisplayWidth ( "DisplayWidth", 640 ),
|
|
|
|
|
m_iDisplayHeight ( "DisplayHeight", 480 ),
|
|
|
|
|
m_iDisplayColorDepth ( "DisplayColorDepth", 16 ),
|
|
|
|
|
m_iTextureColorDepth ( "TextureColorDepth", 16 ),
|
|
|
|
|
m_iMovieColorDepth ( "MovieColorDepth", 16 ),
|
|
|
|
|
m_iMaxTextureResolution ( "MaxTextureResolution", 2048 ),
|
|
|
|
|
m_iRefreshRate ( "RefreshRate", REFRESH_DEFAULT ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.0f ),
|
|
|
|
|
m_bShowStats ( "ShowStats", TRUE_IF_DEBUG),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bShowBanners ( "ShowBanners", true ),
|
2004-12-04 10:35:50 +00:00
|
|
|
|
2005-05-30 11:52:56 +00:00
|
|
|
m_BackgroundMode ( "BackgroundMode", BGMODE_ANIMATIONS ),
|
|
|
|
|
m_iNumBackgrounds ( "NumBackgrounds", 8 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fBGBrightness ( "BGBrightness", 0.8f ),
|
2005-05-30 11:52:56 +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 ( "HiddenSongs", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bVsync ( "Vsync", true ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bInterlaced ( "Interlaced", false ),
|
2004-12-04 10:35:50 +00:00
|
|
|
/* XXX: Set these defaults for individual consoles using VideoCardDefaults.ini. */
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bPAL ( "PAL", false ),
|
|
|
|
|
m_bDelayedTextureDelete ( "DelayedTextureDelete", true ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bTexturePreload ( "TexturePreload", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bDelayedScreenLoad ( "DelayedScreenLoad", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bDelayedModelDelete ( "DelayedModelDelete", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_BannerCache ( "BannerCache", BNCACHE_LOW_RES_PRELOAD ),
|
|
|
|
|
m_bPalettedBannerCache ( "PalettedBannerCache", false ),
|
2005-06-02 10:08:58 +00:00
|
|
|
m_bFastLoad ( "FastLoad", false ),
|
2004-12-07 01:41:55 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bOnlyDedicatedMenuButtons ( "OnlyDedicatedMenuButtons", false ),
|
|
|
|
|
m_bMenuTimer ( "MenuTimer", true ),
|
|
|
|
|
m_bShowDanger ( "ShowDanger", true ),
|
2004-12-07 01:41:55 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fJudgeWindowScale ( "JudgeWindowScale", 1.0f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fJudgeWindowAdd ( "JudgeWindowAdd", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fJudgeWindowSecondsMarvelous ( "JudgeWindowSecondsMarvelous", 0.0225f ),
|
|
|
|
|
m_fJudgeWindowSecondsPerfect ( "JudgeWindowSecondsPerfect", 0.045f ),
|
|
|
|
|
m_fJudgeWindowSecondsGreat ( "JudgeWindowSecondsGreat", 0.090f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fJudgeWindowSecondsGood ( "JudgeWindowSecondsGood", 0.135f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fJudgeWindowSecondsBoo ( "JudgeWindowSecondsBoo", 0.180f ),
|
|
|
|
|
m_fJudgeWindowSecondsOK ( "JudgeWindowSecondsOK", 0.250f ), // allow enough time to take foot off and put back on
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fJudgeWindowSecondsRoll ( "JudgeWindowSecondsRoll", 0.350f ),
|
|
|
|
|
m_fJudgeWindowSecondsMine ( "JudgeWindowSecondsMine", 0.090f ), // same as great
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fJudgeWindowSecondsAttack ( "JudgeWindowSecondsAttack", 0.135f ),
|
2004-12-07 01:41:55 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fLifeDifficultyScale ( "LifeDifficultyScale", 1.0f ),
|
|
|
|
|
m_fLifeDeltaPercentChangeMarvelous ( "LifeDeltaPercentChangeMarvelous", +0.008f ),
|
|
|
|
|
m_fLifeDeltaPercentChangePerfect ( "LifeDeltaPercentChangePerfect", +0.008f ),
|
|
|
|
|
m_fLifeDeltaPercentChangeGreat ( "LifeDeltaPercentChangeGreat", +0.004f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fLifeDeltaPercentChangeGood ( "LifeDeltaPercentChangeGood", +0.000f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fLifeDeltaPercentChangeBoo ( "LifeDeltaPercentChangeBoo", -0.040f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fLifeDeltaPercentChangeMiss ( "LifeDeltaPercentChangeMiss", -0.080f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fLifeDeltaPercentChangeHitMine ( "LifeDeltaPercentChangeHitMine", -0.160f ),
|
|
|
|
|
m_fLifeDeltaPercentChangeOK ( "LifeDeltaPercentChangeOK", +0.008f ),
|
|
|
|
|
m_fLifeDeltaPercentChangeNG ( "LifeDeltaPercentChangeNG", -0.080f ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fTugMeterPercentChangeMarvelous ( "TugMeterPercentChangeMarvelous", +0.010f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fTugMeterPercentChangePerfect ( "TugMeterPercentChangePerfect", +0.008f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fTugMeterPercentChangeGreat ( "TugMeterPercentChangeGreat", +0.004f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fTugMeterPercentChangeGood ( "TugMeterPercentChangeGood", +0.000f ),
|
|
|
|
|
m_fTugMeterPercentChangeBoo ( "TugMeterPercentChangeBoo", -0.010f ),
|
|
|
|
|
m_fTugMeterPercentChangeMiss ( "TugMeterPercentChangeMiss", -0.020f ),
|
|
|
|
|
m_fTugMeterPercentChangeHitMine ( "TugMeterPercentChangeHitMine", -0.040f ),
|
|
|
|
|
m_fTugMeterPercentChangeOK ( "TugMeterPercentChangeOK", +0.008f ),
|
|
|
|
|
m_fTugMeterPercentChangeNG ( "TugMeterPercentChangeNG", -0.020f ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iRegenComboAfterFail ( "RegenComboAfterFail", 10 ),
|
|
|
|
|
m_iRegenComboAfterMiss ( "RegenComboAfterMiss", 5 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iMaxRegenComboAfterFail ( "MaxRegenComboAfterFail", 10 ),
|
|
|
|
|
m_iMaxRegenComboAfterMiss ( "MaxRegenComboAfterMiss", 10 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bTwoPlayerRecovery ( "TwoPlayerRecovery", true ),
|
|
|
|
|
m_bMercifulDrain ( "MercifulDrain", true ), // negative life deltas are scaled by the players life percentage
|
2005-06-16 22:09:03 +00:00
|
|
|
m_bMinimum1FullSongInCourses ( "Minimum1FullSongInCourses", false ), // FEoS for 1st song, FailImmediate thereafter
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bFailOffInBeginner ( "FailOffInBeginner", false ),
|
|
|
|
|
m_bFailOffForFirstStageEasy ( "FailOffForFirstStageEasy", false ),
|
|
|
|
|
m_bMercifulBeginner ( "MercifulBeginner", false ),
|
2005-04-27 08:52:58 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iPercentScoreWeightMarvelous ( "PercentScoreWeightMarvelous", 3 ),
|
|
|
|
|
m_iPercentScoreWeightPerfect ( "PercentScoreWeightPerfect", 2 ),
|
|
|
|
|
m_iPercentScoreWeightGreat ( "PercentScoreWeightGreat", 1 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iPercentScoreWeightGood ( "PercentScoreWeightGood", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iPercentScoreWeightBoo ( "PercentScoreWeightBoo", 0 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iPercentScoreWeightMiss ( "PercentScoreWeightMiss", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iPercentScoreWeightHitMine ( "PercentScoreWeightHitMine", -2 ),
|
|
|
|
|
m_iPercentScoreWeightOK ( "PercentScoreWeightOK", 3 ),
|
|
|
|
|
m_iPercentScoreWeightNG ( "PercentScoreWeightNG", 0 ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iGradeWeightMarvelous ( "GradeWeightMarvelous", 2 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iGradeWeightPerfect ( "GradeWeightPerfect", 2 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iGradeWeightGreat ( "GradeWeightGreat", 1 ),
|
|
|
|
|
m_iGradeWeightGood ( "GradeWeightGood", 0 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iGradeWeightBoo ( "GradeWeightBoo", -4 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iGradeWeightMiss ( "GradeWeightMiss", -8 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iGradeWeightHitMine ( "GradeWeightHitMine", -8 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iGradeWeightOK ( "GradeWeightOK", 6 ),
|
|
|
|
|
m_iGradeWeightNG ( "GradeWeightNG", 0 ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fSuperMeterPercentChangeMarvelous ( "SuperMeterPercentChangeMarvelous", +0.05f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fSuperMeterPercentChangePerfect ( "SuperMeterPercentChangePerfect", +0.04f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fSuperMeterPercentChangeGreat ( "SuperMeterPercentChangeGreat", +0.02f ),
|
|
|
|
|
m_fSuperMeterPercentChangeGood ( "SuperMeterPercentChangeGood", +0.00f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fSuperMeterPercentChangeBoo ( "SuperMeterPercentChangeBoo", -0.00f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fSuperMeterPercentChangeMiss ( "SuperMeterPercentChangeMiss", -0.20f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fSuperMeterPercentChangeHitMine ( "SuperMeterPercentChangeHitMine", -0.40f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fSuperMeterPercentChangeOK ( "SuperMeterPercentChangeOK", +0.04f ),
|
|
|
|
|
m_fSuperMeterPercentChangeNG ( "SuperMeterPercentChangeNG", -0.20f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bMercifulSuperMeter ( "MercifulSuperMeter", true ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fTimeMeterSecondsChangeMarvelous ( "TimeMeterSecondsChangeMarvelous", +0.1f ),
|
|
|
|
|
m_fTimeMeterSecondsChangePerfect ( "TimeMeterSecondsChangePerfect", 0.0f ),
|
|
|
|
|
m_fTimeMeterSecondsChangeGreat ( "TimeMeterSecondsChangeGreat", -0.5f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fTimeMeterSecondsChangeGood ( "TimeMeterSecondsChangeGood", -1.0f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fTimeMeterSecondsChangeBoo ( "TimeMeterSecondsChangeBoo", -2.0f ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fTimeMeterSecondsChangeMiss ( "TimeMeterSecondsChangeMiss", -4.0f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fTimeMeterSecondsChangeHitMine ( "TimeMeterSecondsChangeHitMine", -2.0f ),
|
|
|
|
|
m_fTimeMeterSecondsChangeOK ( "TimeMeterSecondsChangeOK", -0.0f ),
|
|
|
|
|
m_fTimeMeterSecondsChangeNG ( "TimeMeterSecondsChangeNG", -4.0f ),
|
2005-04-27 07:50:38 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_AutoPlay ( "AutoPlay", PC_HUMAN ),
|
|
|
|
|
m_bDelayedBack ( "DelayedBack", true ),
|
|
|
|
|
m_bShowInstructions ( "ShowInstructions", true ),
|
|
|
|
|
m_bShowSelectGroup ( "ShowSelectGroup", true ),
|
|
|
|
|
m_bShowCaution ( "ShowCaution", true ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bShowNativeLanguage ( "ShowNativeLanguage", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bArcadeOptionsNavigation ( "ArcadeOptionsNavigation", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_MusicWheelUsesSections ( "MusicWheelUsesSections", ALWAYS ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iMusicWheelSwitchSpeed ( "MusicWheelSwitchSpeed", 10 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bEasterEggs ( "EasterEggs", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_MarvelousTiming ( "MarvelousTiming", MARVELOUS_EVERYWHERE ),
|
|
|
|
|
m_bEventMode ( "EventMode", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iCoinsPerCredit ( "CoinsPerCredit", 1 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iSongsPerPlay ( "SongsPerPlay", 3 ),
|
2005-04-28 08:27:40 +00:00
|
|
|
|
2005-05-20 17:45:44 +00:00
|
|
|
m_CoinMode ( "CoinMode", COIN_MODE_HOME ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_Premium ( "Premium", PREMIUM_NONE ),
|
|
|
|
|
m_bDelayedCreditsReconcile ( "DelayedCreditsReconcile", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bPickExtraStage ( "PickExtraStage", false ),
|
2005-04-28 08:27:40 +00:00
|
|
|
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bComboContinuesBetweenSongs ( "ComboContinuesBetweenSongs", false ),
|
|
|
|
|
m_fLongVerSongSeconds ( "LongVerSongSeconds", 60*2.5f ), // Dynamite Rave is 2:55
|
|
|
|
|
m_fMarathonVerSongSeconds ( "MarathonVerSongSeconds", 60*5.f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_ShowSongOptions ( "ShowSongOptions", YES ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bSoloSingle ( "SoloSingle", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bDancePointsForOni ( "DancePointsForOni", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bPercentageScoring ( "PercentageScoring", false ),
|
|
|
|
|
m_fMinPercentageForMachineSongHighScore ( "MinPercentageForMachineSongHighScore", 0.5f ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fMinPercentageForMachineCourseHighScore ( "MinPercentageForMachineCourseHighScore", 0.0001f ), // don't save course scores with 0 percentage
|
|
|
|
|
m_bDisqualification ( "Disqualification", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bShowLyrics ( "ShowLyrics", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bAutogenSteps ( "AutogenSteps", true ),
|
|
|
|
|
m_bAutogenGroupCourses ( "AutogenGroupCourses", true ),
|
|
|
|
|
m_bBreakComboToGetItem ( "BreakComboToGetItem", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bLockCourseDifficulties ( "LockCourseDifficulties", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_ShowDancingCharacters ( "ShowDancingCharacters", CO_OFF ),
|
|
|
|
|
m_bUseUnlockSystem ( "UseUnlockSystem", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bAutoMapOnJoyChange ( "AutoMapOnJoyChange", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fGlobalOffsetSeconds ( "GlobalOffsetSeconds", 0 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iProgressiveLifebar ( "ProgressiveLifebar", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iProgressiveStageLifebar ( "ProgressiveStageLifebar", 0 ),
|
|
|
|
|
m_iProgressiveNonstopLifebar ( "ProgressiveNonstopLifebar", 0 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bShowBeginnerHelper ( "ShowBeginnerHelper", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bEndlessBreakEnabled ( "EndlessBreakEnabled", true ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iEndlessNumStagesUntilBreak ( "EndlessNumStagesUntilBreak", 5 ),
|
|
|
|
|
m_iEndlessBreakLength ( "EndlessBreakLength", 5 ),
|
|
|
|
|
m_bDisableScreenSaver ( "DisableScreenSaver", true ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_sLanguage ( "Language", "" ), // ThemeManager will deal with this invalid language
|
|
|
|
|
m_sMemoryCardProfileSubdir ( "MemoryCardProfileSubdir", PRODUCT_NAME ),
|
|
|
|
|
m_iProductID ( "ProductID", 1 ),
|
|
|
|
|
m_sDefaultLocalProfileIDP1 ( "DefaultLocalProfileIDP1", "" ),
|
|
|
|
|
m_sDefaultLocalProfileIDP2 ( "DefaultLocalProfileIDP2", "" ),
|
|
|
|
|
m_bMemoryCards ( "MemoryCards", false ),
|
|
|
|
|
m_sMemoryCardOsMountPointP1 ( "MemoryCardOsMountPointP1", "" ),
|
|
|
|
|
m_sMemoryCardOsMountPointP2 ( "MemoryCardOsMountPointP2", "" ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iMemoryCardUsbBusP1 ( "MemoryCardUsbBusP1", -1 ),
|
|
|
|
|
m_iMemoryCardUsbBusP2 ( "MemoryCardUsbBusP2", -1 ),
|
|
|
|
|
m_iMemoryCardUsbPortP1 ( "MemoryCardUsbPortP1", -1 ),
|
|
|
|
|
m_iMemoryCardUsbPortP2 ( "MemoryCardUsbPortP2", -1 ),
|
|
|
|
|
m_iMemoryCardUsbLevelP1 ( "MemoryCardUsbLevelP1", -1 ),
|
|
|
|
|
m_iMemoryCardUsbLevelP2 ( "MemoryCardUsbLevelP2", -1 ),
|
|
|
|
|
m_iCenterImageTranslateX ( "CenterImageTranslateX", 0 ),
|
|
|
|
|
m_iCenterImageTranslateY ( "CenterImageTranslateY", 0 ),
|
|
|
|
|
m_fCenterImageAddWidth ( "CenterImageAddWidth", 0 ),
|
|
|
|
|
m_fCenterImageAddHeight ( "CenterImageAddHeight", 0 ),
|
2005-06-11 10:53:16 +00:00
|
|
|
m_AttractSoundFrequency ( "AttractSoundFrequency", ASF_EVERY_TIME ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bAllowExtraStage ( "AllowExtraStage", true ),
|
|
|
|
|
m_bHideDefaultNoteSkin ( "HideDefaultNoteSkin", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iMaxHighScoresPerListForMachine ( "MaxHighScoresPerListForMachine", 10 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iMaxHighScoresPerListForPlayer ( "MaxHighScoresPerListForPlayer", 3 ),
|
|
|
|
|
m_iMaxRecentScoresForMachine ( "MaxRecentScoresForMachine", 100 ),
|
|
|
|
|
m_iMaxRecentScoresForPlayer ( "MaxRecentScoresForPlayer", 20 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
|
|
|
|
|
m_bCelShadeModels ( "CelShadeModels", false ), // Work-In-Progress.. disable by default.
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bPreferredSortUsesGroups ( "PreferredSortUsesGroups", true ),
|
2005-05-16 09:36:32 +00:00
|
|
|
|
2005-05-30 11:52:56 +00:00
|
|
|
m_fConstantUpdateDeltaSeconds ( "ConstantUpdateDeltaSeconds", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_fPadStickSeconds ( "PadStickSeconds", 0 ),
|
|
|
|
|
m_bForceMipMaps ( "ForceMipMaps", 0 ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bTrilinearFiltering ( "TrilinearFiltering", 0 ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bAnisotropicFiltering ( "AnisotropicFiltering", 0 ),
|
2005-05-16 09:36:32 +00:00
|
|
|
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bSignProfileData ( "SignProfileData", false ),
|
|
|
|
|
m_bEditorShowBGChangesPlay ( "EditorShowBGChangesPlay", false ),
|
|
|
|
|
m_CourseSortOrder ( "CourseSortOrder", COURSE_SORT_SONGS ),
|
|
|
|
|
m_bMoveRandomToEnd ( "MoveRandomToEnd", false ),
|
|
|
|
|
m_bSubSortByNumSteps ( "SubSortByNumSteps", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_GetRankingName ( "GetRankingName", RANKING_ON ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_ScoringType ( "ScoringType", SCORING_MAX2 ),
|
|
|
|
|
m_BoostAppPriority ( "BoostAppPriority", BOOST_AUTO ),
|
|
|
|
|
m_sAdditionalSongFolders ( "AdditionalSongFolders", "" ),
|
|
|
|
|
m_sAdditionalFolders ( "AdditionalFolders", "" ),
|
|
|
|
|
m_sLastSeenVideoDriver ( "LastSeenVideoDriver", "" ),
|
|
|
|
|
m_sLastSeenInputDevices ( "LastSeenInputDevices", "" ),
|
2005-05-16 09:36:32 +00:00
|
|
|
#if defined(WIN32)
|
2005-05-30 11:52:56 +00:00
|
|
|
m_iLastSeenMemory ( "LastSeenMemory", 0 ),
|
2005-05-16 09:36:32 +00:00
|
|
|
#endif
|
2005-05-30 11:52:56 +00:00
|
|
|
m_sVideoRenderers ( "VideoRenderers", "" ), // StepMania.cpp sets these on first run:
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bSmoothLines ( "SmoothLines", false ),
|
|
|
|
|
m_sSoundDrivers ( "SoundDrivers", "" ),
|
2005-05-30 11:56:36 +00:00
|
|
|
m_fSoundVolume ( "SoundVolume", -1 ), // default
|
2005-05-19 01:25:38 +00:00
|
|
|
m_iSoundWriteAhead ( "SoundWriteAhead", 0 ),
|
|
|
|
|
m_iSoundDevice ( "SoundDevice", "" ),
|
|
|
|
|
m_SoundResampleQuality ( "SoundResampleQuality", RageSoundReader_Resample::RESAMP_NORMAL ),
|
|
|
|
|
m_sInputDrivers ( "InputDrivers", "" ),
|
|
|
|
|
m_sLightsDriver ( "LightsDriver", "" ),
|
2005-05-30 11:56:36 +00:00
|
|
|
m_sMovieDrivers ( "MovieDrivers", "" ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_sLightsStepsDifficulty ( "LightsStepsDifficulty", "medium" ),
|
|
|
|
|
m_bBlinkGameplayButtonLightsOnNote ( "BlinkGameplayButtonLightsOnNote",false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bAllowUnacceleratedRenderer ( "AllowUnacceleratedRenderer", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bThreadedInput ( "ThreadedInput", true ),
|
|
|
|
|
m_bThreadedMovieDecode ( "ThreadedMovieDecode", true ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bScreenTestMode ( "ScreenTestMode", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bDebugLights ( "DebugLights", false ),
|
|
|
|
|
m_bMonkeyInput ( "MonkeyInput", false ),
|
|
|
|
|
m_sMachineName ( "MachineName", "" ),
|
|
|
|
|
m_sIgnoredMessageWindows ( "IgnoredMessageWindows", "" ),
|
|
|
|
|
m_sCoursesToShowRanking ( "CoursesToShowRanking", "" ),
|
2005-05-16 09:36:32 +00:00
|
|
|
|
|
|
|
|
/* Debug: */
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bLogToDisk ( "LogToDisk", true ),
|
|
|
|
|
m_bForceLogFlush ( "ForceLogFlush", false ),
|
|
|
|
|
m_bShowLogOutput ( "ShowLogOutput", false ),
|
|
|
|
|
m_bTimestamping ( "Timestamping", false ),
|
|
|
|
|
m_bLogSkips ( "LogSkips", false ),
|
2005-05-30 11:52:56 +00:00
|
|
|
m_bLogCheckpoints ( "LogCheckpoints", false ),
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bShowLoadingWindow ( "ShowLoadingWindow", true ),
|
2005-05-16 09:36:32 +00:00
|
|
|
|
|
|
|
|
/* Game-specific prefs: */
|
2005-05-19 01:25:38 +00:00
|
|
|
m_sDefaultModifiers ( "DefaultModifiers", "" )
|
2005-05-16 09:36:32 +00:00
|
|
|
|
|
|
|
|
#if defined(XBOX)
|
|
|
|
|
,
|
2005-05-19 01:25:38 +00:00
|
|
|
m_bEnableVirtualMemory ( "EnableVirtualMemory", true ),
|
|
|
|
|
m_iPageFileSize ( "PageFileSize", 384 ),
|
|
|
|
|
m_iPageSize ( "PageSize", 16 ),
|
|
|
|
|
m_iPageThreshold ( "PageThreshold", 8 ),
|
|
|
|
|
m_bLogVirtualMemory ( "LogVirtualMemory", false )
|
2005-05-16 09:36:32 +00:00
|
|
|
#endif
|
2004-05-16 22:58:05 +00:00
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
ReadGlobalPrefsFromDisk();
|
|
|
|
|
}
|
2005-05-30 11:52:56 +00:00
|
|
|
#undef TRUE_IF_DEBUG
|
2004-05-16 22:58:05 +00:00
|
|
|
|
|
|
|
|
void PrefsManager::Init()
|
2002-02-28 19:40:40 +00:00
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
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
|
|
|
{
|
2004-08-22 15:55:23 +00:00
|
|
|
ReadPrefsFromFile( DEFAULTS_INI_PATH );
|
2004-05-16 22:58:05 +00:00
|
|
|
ReadPrefsFromFile( STEPMANIA_INI_PATH );
|
2004-08-22 15:55:23 +00:00
|
|
|
ReadPrefsFromFile( STATIC_INI_PATH );
|
2004-05-16 22:58:05 +00:00
|
|
|
}
|
2003-10-08 08:01:41 +00:00
|
|
|
|
2004-08-22 15:55:23 +00:00
|
|
|
void PrefsManager::ResetToFactoryDefaults()
|
2004-05-16 22:58:05 +00:00
|
|
|
{
|
2004-08-22 15:55:23 +00:00
|
|
|
// clobber the users prefs by initing then applying defaults
|
|
|
|
|
Init();
|
|
|
|
|
ReadPrefsFromFile( DEFAULTS_INI_PATH );
|
2004-08-22 18:08:06 +00:00
|
|
|
ReadPrefsFromFile( STATIC_INI_PATH );
|
2004-08-22 15:55:23 +00:00
|
|
|
|
|
|
|
|
SaveGlobalPrefsToDisk();
|
2004-05-16 22:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PrefsManager::ReadPrefsFromFile( CString sIni )
|
|
|
|
|
{
|
|
|
|
|
IniFile ini;
|
2004-08-22 15:55:23 +00:00
|
|
|
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 )
|
|
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
|
|
|
|
|
(*p)->ReadFrom( ini );
|
2005-05-06 10:48:32 +00:00
|
|
|
|
2005-05-16 09:36:32 +00:00
|
|
|
// validate
|
2005-05-06 20:41:05 +00:00
|
|
|
m_iSongsPerPlay.Set( clamp(m_iSongsPerPlay.Get(),0,MAX_SONGS_PER_PLAY) );
|
2005-05-16 09:36:32 +00:00
|
|
|
FOREACH_PlayerNumber( pn )
|
|
|
|
|
GetMemoryCardOsMountPoint(pn).Set( FixSlashes(GetMemoryCardOsMountPoint(pn)) );
|
2005-05-31 01:14:30 +00:00
|
|
|
m_BackgroundMode.Set( (BackgroundMode)clamp((int)m_BackgroundMode.Get(),0,(int)NUM_BackgroundMode-1) );
|
2002-02-28 19:40:40 +00:00
|
|
|
}
|
|
|
|
|
|
2005-04-23 22:03:23 +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
|
|
|
|
|
{
|
2005-02-05 11:21:13 +00:00
|
|
|
FOREACHS_CONST( IPreference*, *SubscriptionManager<IPreference>::s_pSubscribers, p )
|
|
|
|
|
(*p)->WriteTo( ini );
|
2002-02-28 19:40:40 +00:00
|
|
|
}
|
2004-05-16 22:58:05 +00:00
|
|
|
|
2005-05-16 09:36:32 +00:00
|
|
|
// wrappers
|
2005-05-16 18:07:01 +00:00
|
|
|
CString PrefsManager::GetSoundDrivers()
|
|
|
|
|
{
|
|
|
|
|
if ( m_sSoundDrivers.Get().empty() )
|
|
|
|
|
return (CString)DEFAULT_SOUND_DRIVER_LIST;
|
|
|
|
|
else
|
|
|
|
|
return m_sSoundDrivers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float PrefsManager::GetSoundVolume()
|
|
|
|
|
{
|
|
|
|
|
if ( m_fSoundVolume==-1 )
|
|
|
|
|
return DEFAULT_SOUND_VOLUME;
|
|
|
|
|
else
|
|
|
|
|
return m_fSoundVolume;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString PrefsManager::GetInputDrivers() {
|
|
|
|
|
if( m_sInputDrivers.Get().empty() )
|
|
|
|
|
return (CString)DEFAULT_INPUT_DRIVER_LIST;
|
|
|
|
|
else
|
|
|
|
|
return m_sInputDrivers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString PrefsManager::GetMovieDrivers()
|
|
|
|
|
{
|
|
|
|
|
if ( m_sMovieDrivers.Get().empty() )
|
|
|
|
|
return (CString)DEFAULT_MOVIE_DRIVER_LIST;
|
|
|
|
|
else
|
|
|
|
|
return m_sMovieDrivers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString PrefsManager::GetLightsDriver() {
|
|
|
|
|
if ( m_sLightsDriver.Get().empty() )
|
|
|
|
|
return (CString)DEFAULT_LIGHTS_DRIVER;
|
|
|
|
|
else
|
|
|
|
|
return m_sLightsDriver;
|
|
|
|
|
}
|
2005-05-16 09:36:32 +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 ); }
|
|
|
|
|
|
2005-02-22 03:36:51 +00:00
|
|
|
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
|
|
|
{
|
2005-02-22 03:36:51 +00:00
|
|
|
pPref->PushValue( L );
|
2005-02-23 01:11:02 +00:00
|
|
|
}
|
|
|
|
|
return 1;
|
2005-02-22 03:36:51 +00:00
|
|
|
}
|
|
|
|
|
static int SetPreference( T* p, lua_State *L )
|
|
|
|
|
{
|
|
|
|
|
CString sName = SArg(1);
|
|
|
|
|
|
|
|
|
|
IPreference *pPref = PREFSMAN->GetPreferenceByName( sName );
|
|
|
|
|
if( pPref == NULL )
|
2005-06-04 01:54:44 +00:00
|
|
|
{
|
2005-02-22 03:36:51 +00:00
|
|
|
LOG->Warn( "GetPreference: unknown preference \"%s\"", sName.c_str() );
|
2005-06-04 01:54:44 +00:00
|
|
|
}
|
2005-02-22 03:36:51 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lua_pushvalue( L, 2 );
|
|
|
|
|
pPref->SetFromStack( L );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2005-02-17 21:35:45 +00:00
|
|
|
|
|
|
|
|
static void Register(lua_State *L)
|
|
|
|
|
{
|
2005-02-22 03:36:51 +00:00
|
|
|
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");
|
2005-06-15 02:21:24 +00:00
|
|
|
PREFSMAN->PushSelf( L );
|
2005-02-17 21:35:45 +00:00
|
|
|
lua_settable(L, LUA_GLOBALSINDEX);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LUA_REGISTER_CLASS( PrefsManager )
|
|
|
|
|
// lua end
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|