Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

PrefsManager.h

Go to the documentation of this file.
00001 /* PrefsManager - Holds user-chosen preferences that are saved between sessions. */ 00002 00003 #ifndef PREFSMANAGER_H 00004 #define PREFSMANAGER_H 00005 00006 #include "PlayerNumber.h" 00007 #include "GameConstantsAndTypes.h" 00008 #include "Grade.h" // for NUM_GRADE_TIERS 00009 #include "Preference.h" 00010 class IniFile; 00011 00012 class PrefsManager 00013 { 00014 public: 00015 PrefsManager(); 00016 ~PrefsManager(); 00017 IPreference *GetPreferenceByName( const CString &sName ); 00018 00019 void Init(); 00020 00021 // GameOptions (ARE saved between sessions) 00022 Preference<bool> m_bWindowed; 00023 Preference<int> m_iDisplayWidth; 00024 Preference<int> m_iDisplayHeight; 00025 Preference<int> m_iDisplayColorDepth; 00026 Preference<int> m_iTextureColorDepth; 00027 Preference<int> m_iMovieColorDepth; 00028 Preference<int> m_iMaxTextureResolution; 00029 Preference<int> m_iRefreshRate; 00030 Preference<float> m_fDisplayAspectRatio; 00031 Preference<bool> m_bShowStats; 00032 Preference<bool> m_bShowBanners; 00033 00034 enum { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES }; 00035 Preference<int> m_iBackgroundMode; 00036 Preference<int> m_iNumBackgrounds; 00037 Preference<float> m_fBGBrightness; 00038 Preference<bool> m_bHiddenSongs; 00039 Preference<bool> m_bVsync; 00040 Preference<bool> m_bInterlaced; 00041 Preference<bool> m_bPAL; 00042 Preference<bool> m_bDelayedTextureDelete; 00043 Preference<bool> m_bTexturePreload; 00044 Preference<bool> m_bDelayedScreenLoad; 00045 Preference<bool> m_bDelayedModelDelete; 00046 enum { BNCACHE_OFF, BNCACHE_LOW_RES, BNCACHE_FULL }; 00047 Preference<int> m_iBannerCache; 00048 Preference<bool> m_bPalettedBannerCache; 00049 Preference<bool> m_bFastLoad; 00050 00051 Preference<bool> m_bOnlyDedicatedMenuButtons; 00052 Preference<bool> m_bMenuTimer; 00053 Preference<bool> m_bShowDanger; 00054 00055 Preference<float> m_fJudgeWindowScale; 00056 Preference<float> m_fJudgeWindowAdd; // this is useful for compensating for changes in sampling rate between devices 00057 Preference<float> m_fJudgeWindowSecondsMarvelous; 00058 Preference<float> m_fJudgeWindowSecondsPerfect; 00059 Preference<float> m_fJudgeWindowSecondsGreat; 00060 Preference<float> m_fJudgeWindowSecondsGood; 00061 Preference<float> m_fJudgeWindowSecondsBoo; 00062 Preference<float> m_fJudgeWindowSecondsOK; 00063 Preference<float> m_fJudgeWindowSecondsMine; 00064 Preference<float> m_fJudgeWindowSecondsAttack; 00065 00066 Preference<float> m_fLifeDifficultyScale; 00067 Preference<float> m_fLifeDeltaPercentChangeMarvelous; 00068 Preference<float> m_fLifeDeltaPercentChangePerfect; 00069 Preference<float> m_fLifeDeltaPercentChangeGreat; 00070 Preference<float> m_fLifeDeltaPercentChangeGood; 00071 Preference<float> m_fLifeDeltaPercentChangeBoo; 00072 Preference<float> m_fLifeDeltaPercentChangeMiss; 00073 Preference<float> m_fLifeDeltaPercentChangeHitMine; 00074 Preference<float> m_fLifeDeltaPercentChangeOK; 00075 Preference<float> m_fLifeDeltaPercentChangeNG; 00076 00077 // tug meter used in rave 00078 float m_fTugMeterPercentChangeMarvelous; 00079 float m_fTugMeterPercentChangePerfect; 00080 float m_fTugMeterPercentChangeGreat; 00081 float m_fTugMeterPercentChangeGood; 00082 float m_fTugMeterPercentChangeBoo; 00083 float m_fTugMeterPercentChangeMiss; 00084 float m_fTugMeterPercentChangeHitMine; 00085 float m_fTugMeterPercentChangeOK; 00086 float m_fTugMeterPercentChangeNG; 00087 00088 // Whoever added these: Please add a comment saying what they do. -Chris 00089 int m_iRegenComboAfterFail; 00090 int m_iRegenComboAfterMiss; 00091 int m_iMaxRegenComboAfterFail; 00092 int m_iMaxRegenComboAfterMiss; 00093 bool m_bTwoPlayerRecovery; 00094 bool m_bMercifulDrain; // negative life deltas are scaled by the players life percentage 00095 bool m_bMinimum1FullSongInCourses; // FEoS for 1st song, FailImmediate thereafter 00096 00097 // percent score (the number that is shown on the screen and saved to memory card) 00098 int m_iPercentScoreWeightMarvelous; 00099 int m_iPercentScoreWeightPerfect; 00100 int m_iPercentScoreWeightGreat; 00101 int m_iPercentScoreWeightGood; 00102 int m_iPercentScoreWeightBoo; 00103 int m_iPercentScoreWeightMiss; 00104 int m_iPercentScoreWeightHitMine; 00105 int m_iPercentScoreWeightOK; 00106 int m_iPercentScoreWeightNG; 00107 00108 // grades are calculated based on a percentage, but might have different weights than the percent score 00109 int m_iGradeWeightMarvelous; 00110 int m_iGradeWeightPerfect; 00111 int m_iGradeWeightGreat; 00112 int m_iGradeWeightGood; 00113 int m_iGradeWeightBoo; 00114 int m_iGradeWeightMiss; 00115 int m_iGradeWeightHitMine; 00116 int m_iGradeWeightOK; 00117 int m_iGradeWeightNG; 00118 00119 int m_iNumGradeTiersUsed; 00120 float m_fGradePercent[NUM_GRADE_TIERS]; // the minimum percent necessary achieve a grade 00121 bool m_bGradeTier02IsAllPerfects; // DDR special case. If true, m_fGradePercentTier[GRADE_TIER_2] is ignored 00122 00123 float m_fSuperMeterPercentChangeMarvelous; 00124 float m_fSuperMeterPercentChangePerfect; 00125 float m_fSuperMeterPercentChangeGreat; 00126 float m_fSuperMeterPercentChangeGood; 00127 float m_fSuperMeterPercentChangeBoo; 00128 float m_fSuperMeterPercentChangeMiss; 00129 float m_fSuperMeterPercentChangeHitMine; 00130 float m_fSuperMeterPercentChangeOK; 00131 float m_fSuperMeterPercentChangeNG; 00132 bool m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage 00133 00134 bool m_bAutoPlay; 00135 bool m_bDelayedBack; 00136 bool m_bShowInstructions, m_bShowCaution, m_bShowSelectGroup; 00137 bool m_bShowNativeLanguage; 00138 bool m_bArcadeOptionsNavigation; 00139 enum MusicWheelUsesSections { NEVER, ALWAYS, ABC_ONLY } m_MusicWheelUsesSections; 00140 int m_iMusicWheelSwitchSpeed; 00141 bool m_bEasterEggs; 00142 int m_iMarvelousTiming; 00143 bool m_bEventMode; 00144 int m_iCoinsPerCredit; 00145 int m_iNumArcadeStages; 00146 00147 // These options have weird interactions depending on m_bEventMode, 00148 // so wrap them. 00149 CoinMode m_CoinMode; 00150 Premium m_Premium; 00151 CoinMode GetCoinMode(); 00152 Premium GetPremium(); 00153 00154 bool m_bDelayedCreditsReconcile; 00155 bool m_bPickExtraStage; 00156 bool m_bComboContinuesBetweenSongs; 00157 float m_fLongVerSongSeconds; 00158 float m_fMarathonVerSongSeconds; 00159 enum Maybe { ASK = -1, NO = 0, YES = 1 }; 00160 Maybe m_ShowSongOptions; 00161 bool m_bSoloSingle; 00162 bool m_bDancePointsForOni; //DDR-Extreme style dance points instead of max2 percent 00163 bool m_bPercentageScoring; 00164 float m_fMinPercentageForMachineSongHighScore; 00165 float m_fMinPercentageForMachineCourseHighScore; 00166 bool m_bDisqualification; 00167 bool m_bShowLyrics; 00168 bool m_bAutogenSteps; 00169 bool m_bAutogenGroupCourses; 00170 bool m_bBreakComboToGetItem; 00171 bool m_bLockCourseDifficulties; 00172 enum CharacterOption { CO_OFF = 0, CO_RANDOM = 1, CO_SELECT = 2}; 00173 CharacterOption m_ShowDancingCharacters; 00174 bool m_bUseUnlockSystem; 00175 bool m_bFirstRun; 00176 bool m_bAutoMapOnJoyChange; 00177 float m_fGlobalOffsetSeconds; 00178 int m_iProgressiveLifebar; 00179 int m_iProgressiveStageLifebar; 00180 int m_iProgressiveNonstopLifebar; 00181 bool m_bShowBeginnerHelper; 00182 bool m_bEndlessBreakEnabled; 00183 int m_iEndlessNumStagesUntilBreak; 00184 int m_iEndlessBreakLength; 00185 bool m_bDisableScreenSaver; 00186 CString m_sLanguage; 00187 CString m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile 00188 int m_iProductID; // Saved in HighScore to track what software version a score came from. 00189 CString m_sDefaultLocalProfileID[NUM_PLAYERS]; 00190 bool m_bMemoryCards; 00191 CString m_sMemoryCardOsMountPoint[NUM_PLAYERS]; // if set, always use the device that mounts to this point 00192 int m_iMemoryCardUsbBus[NUM_PLAYERS]; // look for this bus when assigning cards. -1 = match any 00193 int m_iMemoryCardUsbPort[NUM_PLAYERS]; // look for this port when assigning cards. -1 = match any 00194 int m_iMemoryCardUsbLevel[NUM_PLAYERS]; // look for this level when assigning cards. -1 = match any 00195 bool m_bMemoryCardsMountOnlyWhenNecessary; 00196 int m_iCenterImageTranslateX; 00197 int m_iCenterImageTranslateY; 00198 int m_fCenterImageAddWidth; 00199 int m_fCenterImageAddHeight; 00200 int m_iAttractSoundFrequency; // 0 = never, 1 = every time 00201 bool m_bAllowExtraStage; 00202 bool m_bHideDefaultNoteSkin; 00203 int m_iMaxHighScoresPerListForMachine; 00204 int m_iMaxHighScoresPerListForPlayer; 00205 bool m_bCelShadeModels; 00206 00207 /* experimental: force a specific update rate. This prevents big 00208 * animation jumps on frame skips. */ 00209 float m_fConstantUpdateDeltaSeconds; // 0 to disable 00210 00211 // Number of seconds it takes for a button on the controller to release 00212 // after pressed. 00213 float m_fPadStickSeconds; 00214 00215 // Useful for non 4:3 displays and resolutions < 640x480 where texels don't 00216 // map directly to pixels. 00217 bool m_bForceMipMaps; 00218 bool m_bTrilinearFiltering; // has no effect without mipmaps on 00219 bool m_bAnisotropicFiltering; // has no effect without mipmaps on. Not mutually exclusive with trilinear. 00220 00221 // If true, then signatures created when writing profile data 00222 // and verified when reading profile data. Leave this false if 00223 // you want to use a profile on different machines that don't 00224 // have the same key, or else the profile's data will be discarded. 00225 bool m_bSignProfileData; 00226 00227 /* Editor prefs: */ 00228 bool m_bEditorShowBGChangesPlay; 00229 00230 // course ranking 00231 enum CourseSortOrders { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder; 00232 bool m_bMoveRandomToEnd; 00233 bool m_bSubSortByNumSteps; 00234 enum GetRankingName { RANKING_OFF, RANKING_ON, RANKING_LIST } m_iGetRankingName; 00235 00236 // scoring type; SCORING_MAX2 should always be first 00237 enum ScoringTypes { SCORING_MAX2, SCORING_5TH } m_iScoringType; 00238 00239 /* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */ 00240 int m_iBoostAppPriority; 00241 00242 CString m_sAdditionalSongFolders; 00243 CString m_sAdditionalFolders; 00244 00245 CString m_sLastSeenVideoDriver; 00246 CString m_sLastSeenInputDevices; 00247 #if defined(WIN32) 00248 int m_iLastSeenMemory; 00249 #endif 00250 CString m_sVideoRenderers; 00251 bool m_bSmoothLines; 00252 CString m_sSoundDrivers; 00253 int m_iSoundWriteAhead; 00254 CString m_iSoundDevice; 00255 float m_fSoundVolume; 00256 int m_iSoundResampleQuality; 00257 CString m_sInputDrivers; 00258 CString m_sMovieDrivers; 00259 CString m_sLightsDriver; 00260 CString m_sLightsStepsDifficulty; 00261 bool m_bBlinkGameplayButtonLightsOnNote; 00262 bool m_bAllowUnacceleratedRenderer; 00263 bool m_bThreadedInput; 00264 bool m_bThreadedMovieDecode; 00265 bool m_bScreenTestMode; 00266 CString m_sMachineName; 00267 00268 CString m_sIgnoredMessageWindows; 00269 00270 CString m_sCoursesToShowRanking; 00271 00272 /* Debug: */ 00273 bool m_bLogToDisk; 00274 bool m_bForceLogFlush; 00275 bool m_bShowLogOutput; 00276 bool m_bTimestamping; 00277 bool m_bLogSkips; 00278 bool m_bLogCheckpoints; 00279 bool m_bShowLoadingWindow; 00280 00281 /* Game-specific prefs: */ 00282 CString m_sDefaultModifiers; 00283 00284 // Virtual keyboard 00285 bool m_bEnableVirtualKeyboard; 00286 00287 #if defined(XBOX) 00288 // Virtual memory preferences 00289 bool m_bEnableVirtualMemory; 00290 int m_iPageFileSize; // page file size in megabytes 00291 int m_iPageSize; // page size in kilobytes 00292 int m_iPageThreshold; // threshold in kilobytes where virtual memory will be used 00293 bool m_bLogVirtualMemory; // (under debug) log the virtual memory allocation, etc. 00294 #endif 00295 00296 void ReadGlobalPrefsFromDisk(); 00297 void SaveGlobalPrefsToDisk() const; 00298 00299 void ResetToFactoryDefaults(); 00300 00301 // 00302 // For self-registering prefs 00303 // 00304 static void Subscribe( IPreference *p ); 00305 static void Unsubscribe( IPreference *p ); 00306 00307 protected: 00308 void ReadPrefsFromFile( CString sIni ); 00309 00310 }; 00311 00312 00313 00314 00315 /* This is global, because it can be accessed by crash handlers and error handlers 00316 * that are run after PREFSMAN shuts down (and probably don't want to deref tht 00317 * pointer anyway). */ 00318 extern bool g_bAutoRestart; 00319 00320 extern PrefsManager* PREFSMAN; // global and accessable from anywhere in our program 00321 00322 #endif 00323 00324 /* 00325 * (c) 2001-2004 Chris Danford, Chris Gomez 00326 * All rights reserved. 00327 * 00328 * Permission is hereby granted, free of charge, to any person obtaining a 00329 * copy of this software and associated documentation files (the 00330 * "Software"), to deal in the Software without restriction, including 00331 * without limitation the rights to use, copy, modify, merge, publish, 00332 * distribute, and/or sell copies of the Software, and to permit persons to 00333 * whom the Software is furnished to do so, provided that the above 00334 * copyright notice(s) and this permission notice appear in all copies of 00335 * the Software and that both the above copyright notice(s) and this 00336 * permission notice appear in supporting documentation. 00337 * 00338 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00339 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00340 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00341 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00342 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00343 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00344 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00345 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00346 * PERFORMANCE OF THIS SOFTWARE. 00347 */

Generated on Thu Jan 27 20:57:27 2005 for StepMania by doxygen 1.3.7