Files
itgmania212121/stepmania/src/PrefsManager.h
T

348 lines
12 KiB
C++
Raw Normal View History

2004-06-08 01:24:17 +00:00
/* PrefsManager - Holds user-chosen preferences that are saved between sessions. */
#ifndef PREFSMANAGER_H
#define PREFSMANAGER_H
2002-02-28 19:40:40 +00:00
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
2004-01-20 03:32:48 +00:00
#include "Grade.h" // for NUM_GRADE_TIERS
2004-12-04 08:21:54 +00:00
#include "Preference.h"
2004-09-13 03:58:39 +00:00
class IniFile;
2002-02-28 19:40:40 +00:00
class PrefsManager
{
public:
PrefsManager();
~PrefsManager();
2004-12-07 10:04:19 +00:00
IPreference *GetPreferenceByName( const CString &sName );
2002-02-28 19:40:40 +00:00
void Init();
2002-07-11 19:02:26 +00:00
// GameOptions (ARE saved between sessions)
2004-12-04 08:21:54 +00:00
Preference<bool> m_bWindowed;
Preference<int> m_iDisplayWidth;
Preference<int> m_iDisplayHeight;
Preference<int> m_iDisplayColorDepth;
Preference<int> m_iTextureColorDepth;
Preference<int> m_iMovieColorDepth;
Preference<int> m_iMaxTextureResolution;
Preference<int> m_iRefreshRate;
Preference<float> m_fDisplayAspectRatio;
2004-12-04 08:21:54 +00:00
Preference<bool> m_bShowStats;
Preference<bool> m_bShowBanners;
2002-07-11 19:02:26 +00:00
2004-12-04 10:35:50 +00:00
enum { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES };
Preference<int> m_iBackgroundMode;
Preference<int> m_iNumBackgrounds;
Preference<float> m_fBGBrightness;
Preference<bool> m_bHiddenSongs;
Preference<bool> m_bVsync;
Preference<bool> m_bInterlaced;
Preference<bool> m_bPAL;
Preference<bool> m_bDelayedTextureDelete;
Preference<bool> m_bTexturePreload;
Preference<bool> m_bDelayedScreenLoad;
Preference<bool> m_bDelayedModelDelete;
enum { BNCACHE_OFF, BNCACHE_LOW_RES, BNCACHE_FULL };
Preference<int> m_iBannerCache;
Preference<bool> m_bPalettedBannerCache;
Preference<bool> m_bFastLoad;
2004-01-11 23:33:56 +00:00
2004-12-04 10:35:50 +00:00
Preference<bool> m_bOnlyDedicatedMenuButtons;
Preference<bool> m_bMenuTimer;
Preference<bool> m_bShowDanger;
2004-01-20 07:09:44 +00:00
2004-12-04 10:35:50 +00:00
Preference<float> m_fJudgeWindowScale;
Preference<float> m_fJudgeWindowAdd; // this is useful for compensating for changes in sampling rate between devices
Preference<float> m_fJudgeWindowSecondsMarvelous;
Preference<float> m_fJudgeWindowSecondsPerfect;
Preference<float> m_fJudgeWindowSecondsGreat;
Preference<float> m_fJudgeWindowSecondsGood;
Preference<float> m_fJudgeWindowSecondsBoo;
Preference<float> m_fJudgeWindowSecondsOK;
Preference<float> m_fJudgeWindowSecondsMine;
Preference<float> m_fJudgeWindowSecondsAttack;
Preference<float> m_fLifeDifficultyScale;
Preference<float> m_fLifeDeltaPercentChangeMarvelous;
Preference<float> m_fLifeDeltaPercentChangePerfect;
Preference<float> m_fLifeDeltaPercentChangeGreat;
Preference<float> m_fLifeDeltaPercentChangeGood;
Preference<float> m_fLifeDeltaPercentChangeBoo;
Preference<float> m_fLifeDeltaPercentChangeMiss;
Preference<float> m_fLifeDeltaPercentChangeHitMine;
Preference<float> m_fLifeDeltaPercentChangeOK;
Preference<float> m_fLifeDeltaPercentChangeNG;
2004-01-11 23:33:56 +00:00
// tug meter used in rave
2004-01-20 07:09:44 +00:00
float m_fTugMeterPercentChangeMarvelous;
float m_fTugMeterPercentChangePerfect;
float m_fTugMeterPercentChangeGreat;
float m_fTugMeterPercentChangeGood;
float m_fTugMeterPercentChangeBoo;
float m_fTugMeterPercentChangeMiss;
float m_fTugMeterPercentChangeHitMine;
float m_fTugMeterPercentChangeOK;
float m_fTugMeterPercentChangeNG;
// Whoever added these: Please add a comment saying what they do. -Chris
2003-10-13 00:06:49 +00:00
int m_iRegenComboAfterFail;
int m_iRegenComboAfterMiss;
int m_iMaxRegenComboAfterFail;
int m_iMaxRegenComboAfterMiss;
2003-10-13 03:20:05 +00:00
bool m_bTwoPlayerRecovery;
2004-01-20 07:09:44 +00:00
bool m_bMercifulDrain; // negative life deltas are scaled by the players life percentage
2004-06-26 17:28:02 +00:00
bool m_bMinimum1FullSongInCourses; // FEoS for 1st song, FailImmediate thereafter
2004-01-11 23:33:56 +00:00
2004-01-20 07:09:44 +00:00
// percent score (the number that is shown on the screen and saved to memory card)
int m_iPercentScoreWeightMarvelous;
int m_iPercentScoreWeightPerfect;
int m_iPercentScoreWeightGreat;
int m_iPercentScoreWeightGood;
int m_iPercentScoreWeightBoo;
int m_iPercentScoreWeightMiss;
int m_iPercentScoreWeightHitMine;
int m_iPercentScoreWeightOK;
int m_iPercentScoreWeightNG;
2004-01-11 23:33:56 +00:00
2004-01-20 07:09:44 +00:00
// grades are calculated based on a percentage, but might have different weights than the percent score
int m_iGradeWeightMarvelous;
int m_iGradeWeightPerfect;
int m_iGradeWeightGreat;
int m_iGradeWeightGood;
int m_iGradeWeightBoo;
int m_iGradeWeightMiss;
int m_iGradeWeightHitMine;
int m_iGradeWeightOK;
int m_iGradeWeightNG;
int m_iNumGradeTiersUsed;
2004-03-13 18:35:25 +00:00
float m_fGradePercent[NUM_GRADE_TIERS]; // the minimum percent necessary achieve a grade
2004-01-20 07:09:44 +00:00
bool m_bGradeTier02IsAllPerfects; // DDR special case. If true, m_fGradePercentTier[GRADE_TIER_2] is ignored
float m_fSuperMeterPercentChangeMarvelous;
float m_fSuperMeterPercentChangePerfect;
float m_fSuperMeterPercentChangeGreat;
float m_fSuperMeterPercentChangeGood;
float m_fSuperMeterPercentChangeBoo;
float m_fSuperMeterPercentChangeMiss;
float m_fSuperMeterPercentChangeHitMine;
float m_fSuperMeterPercentChangeOK;
float m_fSuperMeterPercentChangeNG;
bool m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage
2004-01-11 23:33:56 +00:00
bool m_bAutoPlay;
2004-12-04 06:09:30 +00:00
bool m_bDelayedBack;
bool m_bShowInstructions, m_bShowSelectGroup;
Preference<bool> m_bShowCaution;
2004-12-04 06:09:30 +00:00
bool m_bShowNativeLanguage;
bool m_bArcadeOptionsNavigation;
2003-09-28 07:13:12 +00:00
enum MusicWheelUsesSections { NEVER, ALWAYS, ABC_ONLY } m_MusicWheelUsesSections;
2003-01-21 06:51:35 +00:00
int m_iMusicWheelSwitchSpeed;
bool m_bEasterEggs;
int m_iMarvelousTiming;
Preference<bool> m_bEventMode;
2003-01-19 04:44:22 +00:00
int m_iCoinsPerCredit;
int m_iNumArcadeStages;
// These options have weird interactions depending on m_bEventMode,
// so wrap them.
CoinMode m_CoinMode;
2003-11-09 01:09:35 +00:00
Premium m_Premium;
CoinMode GetCoinMode();
Premium GetPremium();
2004-05-07 08:08:11 +00:00
bool m_bDelayedCreditsReconcile;
bool m_bPickExtraStage;
bool m_bComboContinuesBetweenSongs;
float m_fLongVerSongSeconds;
float m_fMarathonVerSongSeconds;
2003-04-21 22:36:45 +00:00
enum Maybe { ASK = -1, NO = 0, YES = 1 };
Maybe m_ShowSongOptions;
bool m_bSoloSingle;
bool m_bDancePointsForOni; //DDR-Extreme style dance points instead of max2 percent
2003-10-05 05:18:48 +00:00
bool m_bPercentageScoring;
float m_fMinPercentageForMachineSongHighScore;
float m_fMinPercentageForMachineCourseHighScore;
2004-03-28 20:08:43 +00:00
bool m_bDisqualification;
bool m_bShowLyrics;
2004-02-10 21:10:23 +00:00
bool m_bAutogenSteps;
bool m_bAutogenGroupCourses;
bool m_bBreakComboToGetItem;
2004-01-21 01:33:29 +00:00
bool m_bLockCourseDifficulties;
enum CharacterOption { CO_OFF = 0, CO_RANDOM = 1, CO_SELECT = 2};
CharacterOption m_ShowDancingCharacters;
bool m_bUseUnlockSystem;
bool m_bFirstRun;
bool m_bAutoMapOnJoyChange;
float m_fGlobalOffsetSeconds;
2003-07-29 12:42:38 +00:00
int m_iProgressiveLifebar;
2003-07-31 15:07:48 +00:00
int m_iProgressiveStageLifebar;
int m_iProgressiveNonstopLifebar;
2003-08-20 09:17:56 +00:00
bool m_bShowBeginnerHelper;
2003-09-29 12:32:12 +00:00
bool m_bEndlessBreakEnabled;
int m_iEndlessNumStagesUntilBreak;
int m_iEndlessBreakLength;
2004-02-17 07:16:58 +00:00
bool m_bDisableScreenSaver;
2003-08-19 08:01:15 +00:00
CString m_sLanguage;
CString m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile
int m_iProductID; // Saved in HighScore to track what software version a score came from.
2003-12-07 08:19:10 +00:00
CString m_sDefaultLocalProfileID[NUM_PLAYERS];
2004-06-06 01:50:21 +00:00
bool m_bMemoryCards;
CString m_sMemoryCardOsMountPoint[NUM_PLAYERS]; // if set, always use the device that mounts to this point
int m_iMemoryCardUsbBus[NUM_PLAYERS]; // look for this bus when assigning cards. -1 = match any
int m_iMemoryCardUsbPort[NUM_PLAYERS]; // look for this port when assigning cards. -1 = match any
int m_iMemoryCardUsbLevel[NUM_PLAYERS]; // look for this level when assigning cards. -1 = match any
2003-10-11 07:47:34 +00:00
int m_iCenterImageTranslateX;
int m_iCenterImageTranslateY;
int m_fCenterImageAddWidth;
int m_fCenterImageAddHeight;
2003-12-28 19:46:50 +00:00
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
2003-10-17 08:03:46 +00:00
bool m_bAllowExtraStage;
2004-03-01 02:45:29 +00:00
bool m_bHideDefaultNoteSkin;
int m_iMaxHighScoresPerListForMachine;
int m_iMaxHighScoresPerListForPlayer;
2004-06-18 11:02:40 +00:00
bool m_bCelShadeModels;
2004-07-28 16:04:19 +00:00
/* experimental: force a specific update rate. This prevents big
* animation jumps on frame skips. */
float m_fConstantUpdateDeltaSeconds; // 0 to disable
// Number of seconds it takes for a button on the controller to release
// after pressed.
float m_fPadStickSeconds;
// Useful for non 4:3 displays and resolutions < 640x480 where texels don't
// map directly to pixels.
bool m_bForceMipMaps;
2004-05-18 09:05:21 +00:00
bool m_bTrilinearFiltering; // has no effect without mipmaps on
bool m_bAnisotropicFiltering; // has no effect without mipmaps on. Not mutually exclusive with trilinear.
2004-04-24 07:54:18 +00:00
// If true, then signatures created when writing profile data
// and verified when reading profile data. Leave this false if
// you want to use a profile on different machines that don't
// have the same key, or else the profile's data will be discarded.
bool m_bSignProfileData;
/* Editor prefs: */
bool m_bEditorShowBGChangesPlay;
// course ranking
2003-09-28 07:13:12 +00:00
enum CourseSortOrders { COURSE_SORT_SONGS, COURSE_SORT_METER, COURSE_SORT_METER_SUM, COURSE_SORT_RANK } m_iCourseSortOrder;
bool m_bMoveRandomToEnd;
2004-06-02 07:07:12 +00:00
bool m_bSubSortByNumSteps;
enum GetRankingName { RANKING_OFF, RANKING_ON, RANKING_LIST } m_iGetRankingName;
// scoring type; SCORING_MAX2 should always be first
2003-09-28 07:13:12 +00:00
enum ScoringTypes { SCORING_MAX2, SCORING_5TH } m_iScoringType;
2003-01-18 04:26:25 +00:00
/* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */
int m_iBoostAppPriority;
CString m_sAdditionalSongFolders;
CString m_sAdditionalFolders;
2002-05-27 08:23:27 +00:00
2003-05-31 21:34:07 +00:00
CString m_sLastSeenVideoDriver;
CString m_sLastSeenInputDevices;
#if defined(WIN32)
int m_iLastSeenMemory;
#endif
2003-06-05 19:29:27 +00:00
CString m_sVideoRenderers;
2003-12-20 21:29:55 +00:00
bool m_bSmoothLines;
CString m_sSoundDrivers;
2004-02-21 00:14:38 +00:00
int m_iSoundWriteAhead;
2004-07-17 21:22:36 +00:00
CString m_iSoundDevice;
2004-02-21 00:14:38 +00:00
float m_fSoundVolume;
int m_iSoundResampleQuality;
CString m_sInputDrivers;
2003-09-02 04:51:36 +00:00
CString m_sMovieDrivers;
2003-11-16 04:45:12 +00:00
CString m_sLightsDriver;
CString m_sLightsStepsDifficulty;
bool m_bBlinkGameplayButtonLightsOnNote;
bool m_bAllowUnacceleratedRenderer;
2003-07-13 20:21:04 +00:00
bool m_bThreadedInput;
2004-04-02 23:14:29 +00:00
bool m_bThreadedMovieDecode;
2003-12-18 21:16:43 +00:00
bool m_bScreenTestMode;
2004-02-16 05:35:06 +00:00
CString m_sMachineName;
2002-12-13 22:06:30 +00:00
2003-07-07 03:51:20 +00:00
CString m_sIgnoredMessageWindows;
CString m_sCoursesToShowRanking;
/* Debug: */
2004-02-27 00:56:51 +00:00
bool m_bLogToDisk;
bool m_bForceLogFlush;
bool m_bShowLogOutput;
bool m_bTimestamping;
2004-01-17 23:22:08 +00:00
bool m_bLogSkips;
bool m_bLogCheckpoints;
2004-02-15 22:56:51 +00:00
bool m_bShowLoadingWindow;
/* Game-specific prefs: */
2003-06-25 05:02:42 +00:00
CString m_sDefaultModifiers;
// Virtual keyboard
bool m_bEnableVirtualKeyboard;
#if defined(XBOX)
// Virtual memory preferences
bool m_bEnableVirtualMemory;
int m_iPageFileSize; // page file size in megabytes
int m_iPageSize; // page size in kilobytes
int m_iPageThreshold; // threshold in kilobytes where virtual memory will be used
bool m_bLogVirtualMemory; // (under debug) log the virtual memory allocation, etc.
#endif
2003-10-08 08:01:41 +00:00
void ReadGlobalPrefsFromDisk();
2003-10-05 05:18:48 +00:00
void SaveGlobalPrefsToDisk() const;
2002-05-27 08:23:27 +00:00
void ResetToFactoryDefaults();
//
// For self-registering prefs
//
static void Subscribe( IPreference *p );
static void Unsubscribe( IPreference *p );
protected:
void ReadPrefsFromFile( CString sIni );
2004-09-13 03:58:39 +00:00
2002-02-28 19:40:40 +00:00
};
2004-09-13 03:58:39 +00:00
2003-10-16 08:55:32 +00:00
/* This is global, because it can be accessed by crash handlers and error handlers
* that are run after PREFSMAN shuts down (and probably don't want to deref tht
* pointer anyway). */
extern bool g_bAutoRestart;
2002-02-28 19:40:40 +00:00
2002-05-27 08:23:27 +00:00
extern PrefsManager* PREFSMAN; // global and accessable from anywhere in our program
#endif
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.
*/