Files
itgmania212121/stepmania/src/PrefsManager.h
T

310 lines
10 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
2004-12-04 08:21:54 +00:00
#include "Preference.h"
2004-09-13 03:58:39 +00:00
class IniFile;
2005-05-06 10:48:32 +00:00
const int MAX_SONGS_PER_PLAY = 7;
2006-10-07 05:52:45 +00:00
enum MusicWheelUsesSections { MusicWheelUsesSections_NEVER, MusicWheelUsesSections_ALWAYS, MusicWheelUsesSections_ABC_ONLY, NUM_MusicWheelUsesSections, MusicWheelUsesSections_Invalid };
enum AllowW1 { ALLOW_W1_NEVER, ALLOW_W1_COURSES_ONLY, ALLOW_W1_EVERYWHERE, NUM_AllowW1, AllowW1_Invalid };
enum Maybe { Maybe_ASK, Maybe_NO, Maybe_YES, NUM_Maybe, Maybe_Invalid };
enum GetRankingName { RANKING_OFF, RANKING_ON, RANKING_LIST, NUM_GetRankingName, GetRankingName_Invalid };
2006-10-07 07:43:18 +00:00
enum RandomBackgroundMode
{
BGMODE_OFF,
BGMODE_ANIMATIONS,
BGMODE_RANDOMMOVIES,
NUM_RandomBackgroundMode,
RandomBackgroundMode_Invalid
};
enum ShowDancingCharacters
{
SDC_Off,
SDC_Random,
SDC_Select,
NUM_ShowDancingCharacters,
ShowDancingCharacters_Invalid
};
enum BannerCacheMode
{
BNCACHE_OFF,
BNCACHE_LOW_RES_PRELOAD, // preload low-res on start
BNCACHE_LOW_RES_LOAD_ON_DEMAND, // preload low-res on screen load
BNCACHE_FULL,
NUM_BannerCacheMode,
BannerCacheMode_Invalid
};
enum AttractSoundFrequency
{
ASF_NEVER,
ASF_EVERY_TIME,
ASF_EVERY_2_TIMES,
ASF_EVERY_3_TIMES,
ASF_EVERY_4_TIMES,
ASF_EVERY_5_TIMES,
NUM_AttractSoundFrequency,
AttractSoundFrequency_Invalid
};
enum CourseSortOrders
{
COURSE_SORT_PREFERRED,
COURSE_SORT_SONGS,
COURSE_SORT_METER,
COURSE_SORT_METER_SUM,
COURSE_SORT_RANK,
NUM_CourseSortOrders,
CourseSortOrders_Invalid
};
enum ScoringType
{
SCORING_NEW,
SCORING_OLD,
NUM_ScoringType,
ScoringType_Invalid
};
2002-02-28 19:40:40 +00:00
class PrefsManager
{
public:
PrefsManager();
~PrefsManager();
void Init();
2006-01-22 01:00:06 +00:00
void SetCurrentGame( const RString &sGame );
RString GetCurrentGame() { return m_sCurrentGame; }
protected:
2006-01-22 01:00:06 +00:00
Preference<RString> m_sCurrentGame;
public:
// Game-specific prefs. Copy these off and save them every time the game changes
2006-01-22 01:00:06 +00:00
Preference<RString> m_sAnnouncer;
Preference<RString> m_sTheme;
Preference<RString> m_sDefaultModifiers;
protected:
void StoreGamePrefs();
void RestoreGamePrefs();
struct GamePrefs
{
// See GamePrefs::GamePrefs in PrefsManager.cpp for some default settings
GamePrefs();
2006-01-22 01:00:06 +00:00
RString m_sAnnouncer;
RString m_sTheme;
RString m_sDefaultModifiers;
};
2006-01-22 01:00:06 +00:00
map<RString, GamePrefs> m_mapGameNameToGamePrefs;
public:
2004-12-04 08:21:54 +00:00
Preference<bool> m_bWindowed;
Preference<int> m_iDisplayWidth;
Preference<int> m_iDisplayHeight;
Preference<float> m_fDisplayAspectRatio;
2004-12-04 08:21:54 +00:00
Preference<int> m_iDisplayColorDepth;
Preference<int> m_iTextureColorDepth;
Preference<int> m_iMovieColorDepth;
Preference<int> m_iMaxTextureResolution;
Preference<int> m_iRefreshRate;
2005-11-07 03:59:05 +00:00
Preference<bool> m_bAllowMultitexture;
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
Preference<bool> m_bHiddenSongs;
Preference<bool> m_bVsync;
Preference<bool> m_bInterlaced;
Preference<bool> m_bPAL;
Preference<bool> m_bDelayedTextureDelete;
Preference<bool> m_bDelayedModelDelete;
2006-10-07 07:43:18 +00:00
Preference<BannerCacheMode> m_BannerCache;
2004-12-04 10:35:50 +00:00
Preference<bool> m_bPalettedBannerCache;
Preference<bool> m_bFastLoad;
Preference<bool> m_bFastLoadAdditionalSongs;
2004-01-11 23:33:56 +00:00
2004-12-04 10:35:50 +00:00
Preference<bool> m_bOnlyDedicatedMenuButtons;
Preference<bool> m_bMenuTimer;
2004-01-20 07:09:44 +00:00
2004-12-04 10:35:50 +00:00
Preference<float> m_fLifeDifficultyScale;
2004-01-11 23:33:56 +00:00
2004-01-20 07:09:44 +00:00
// Whoever added these: Please add a comment saying what they do. -Chris
2005-04-27 07:50:38 +00:00
Preference<int> m_iRegenComboAfterMiss;
Preference<bool> m_bMercifulDrain; // negative life deltas are scaled by the players life percentage
2005-06-16 22:09:03 +00:00
Preference<bool> m_bMinimum1FullSongInCourses; // FEoS for 1st song, FailImmediate thereafter
2005-04-27 07:50:38 +00:00
Preference<bool> m_bFailOffInBeginner;
Preference<bool> m_bFailOffForFirstStageEasy;
Preference<bool> m_bMercifulBeginner; // don't subtract from percent score or grade DP, larger W5 window
2006-03-20 19:38:47 +00:00
Preference<bool> m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage
2005-04-27 07:50:38 +00:00
Preference<bool> m_bDelayedBack;
Preference<bool> m_bShowInstructions;
Preference<bool> m_bShowSelectGroup;
Preference<bool> m_bShowCaution;
2005-04-27 07:50:38 +00:00
Preference<bool> m_bShowNativeLanguage;
Preference<bool> m_bArcadeOptionsNavigation;
2006-10-07 07:43:18 +00:00
Preference<MusicWheelUsesSections> m_MusicWheelUsesSections;
2005-04-27 07:50:38 +00:00
Preference<int> m_iMusicWheelSwitchSpeed;
2006-10-07 07:43:18 +00:00
Preference<AllowW1> m_AllowW1;
Preference<bool> m_bEventMode;
2005-04-27 07:50:38 +00:00
Preference<int> m_iCoinsPerCredit;
2005-04-28 08:27:40 +00:00
Preference<int> m_iSongsPerPlay;
Preference<bool> m_bDelayedCreditsReconcile;
Preference<bool> m_bPickExtraStage;
2005-04-28 08:27:40 +00:00
Preference<bool> m_bComboContinuesBetweenSongs;
2006-10-07 07:43:18 +00:00
Preference<Maybe> m_ShowSongOptions;
Preference<bool> m_bDancePointsForOni;
2005-04-28 08:27:40 +00:00
Preference<bool> m_bPercentageScoring;
Preference<float> m_fMinPercentageForMachineSongHighScore;
Preference<float> m_fMinPercentageForMachineCourseHighScore;
Preference<bool> m_bDisqualification;
Preference<bool> m_bAutogenSteps;
Preference<bool> m_bAutogenGroupCourses;
Preference<bool> m_bBreakComboToGetItem;
Preference<bool> m_bLockCourseDifficulties;
2006-10-07 07:43:18 +00:00
Preference<ShowDancingCharacters> m_ShowDancingCharacters;
2005-04-28 08:27:40 +00:00
Preference<bool> m_bUseUnlockSystem;
2005-02-22 04:00:14 +00:00
Preference<float> m_fGlobalOffsetSeconds;
2005-04-28 08:27:40 +00:00
Preference<int> m_iProgressiveLifebar;
Preference<int> m_iProgressiveStageLifebar;
Preference<int> m_iProgressiveNonstopLifebar;
Preference<bool> m_bShowBeginnerHelper;
Preference<bool> m_bDisableScreenSaver;
2006-01-22 01:00:06 +00:00
Preference<RString> m_sLanguage;
Preference<RString> m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile
2005-04-28 08:27:40 +00:00
Preference<int> m_iProductID; // Saved in HighScore to track what software version a score came from.
Preference<int> m_iCenterImageTranslateX;
Preference<int> m_iCenterImageTranslateY;
Preference<int> m_fCenterImageAddWidth;
Preference<int> m_fCenterImageAddHeight;
2006-10-07 07:43:18 +00:00
Preference<AttractSoundFrequency> m_AttractSoundFrequency;
2005-04-28 08:27:40 +00:00
Preference<bool> m_bAllowExtraStage;
Preference<bool> m_bHideDefaultNoteSkin;
Preference<int> m_iMaxHighScoresPerListForMachine;
Preference<int> m_iMaxHighScoresPerListForPlayer;
Preference<int> m_iMaxRecentScoresForMachine;
Preference<int> m_iMaxRecentScoresForPlayer;
Preference<bool> m_bAllowMultipleHighScoreWithSameName;
Preference<bool> m_bCelShadeModels;
2005-05-09 17:33:22 +00:00
Preference<bool> m_bPreferredSortUsesGroups;
// Number of seconds it takes for a button on the controller to release
// after pressed.
2005-05-16 09:36:32 +00:00
Preference<float> m_fPadStickSeconds;
// Useful for non 4:3 displays and resolutions < 640x480 where texels don't
// map directly to pixels.
2005-05-16 09:36:32 +00:00
Preference<bool> m_bForceMipMaps;
Preference<bool> m_bTrilinearFiltering; // has no effect without mipmaps on
Preference<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.
2005-05-16 09:36:32 +00:00
Preference<bool> m_bSignProfileData;
// course ranking
2006-10-07 07:43:18 +00:00
Preference<CourseSortOrders> m_CourseSortOrder;
2005-05-16 09:36:32 +00:00
Preference<bool> m_bSubSortByNumSteps;
2006-10-07 07:43:18 +00:00
Preference<GetRankingName> m_GetRankingName;
2006-10-07 07:43:18 +00:00
Preference<ScoringType> m_ScoringType;
2006-01-22 01:00:06 +00:00
Preference<RString> m_sAdditionalSongFolders;
2006-08-14 20:05:35 +00:00
Preference<RString> m_sAdditionalCourseFolders;
2006-01-22 01:00:06 +00:00
Preference<RString> m_sAdditionalFolders;
2002-05-27 08:23:27 +00:00
2006-01-22 01:00:06 +00:00
Preference<RString> m_sLastSeenVideoDriver;
Preference<RString> m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card
2005-05-16 09:36:32 +00:00
Preference<bool> m_bSmoothLines;
Preference<float> m_fSoundVolume;
2005-05-16 09:36:32 +00:00
Preference<int> m_iSoundWriteAhead;
2006-01-22 01:00:06 +00:00
Preference<RString> m_iSoundDevice;
2005-10-23 22:11:48 +00:00
Preference<int> m_iSoundPreferredSampleRate;
2006-01-22 01:00:06 +00:00
Preference<RString> m_sLightsStepsDifficulty;
2005-05-16 09:36:32 +00:00
Preference<bool> m_bAllowUnacceleratedRenderer;
Preference<bool> m_bThreadedInput;
Preference<bool> m_bThreadedMovieDecode;
Preference<bool> m_bScreenTestMode;
Preference<bool> m_bDebugLights;
Preference<bool> m_bMonkeyInput;
2006-01-22 01:00:06 +00:00
Preference<RString> m_sMachineName;
Preference<RString> m_sCoursesToShowRanking;
/* Debug: */
2005-05-16 09:36:32 +00:00
Preference<bool> m_bLogToDisk;
Preference<bool> m_bForceLogFlush;
Preference<bool> m_bShowLogOutput;
Preference<bool> m_bLogSkips;
Preference<bool> m_bLogCheckpoints;
Preference<bool> m_bShowLoadingWindow;
2006-01-06 20:18:15 +00:00
Preference<bool> m_bPseudoLocalize;
2005-08-15 02:10:57 +00:00
#if !defined(WITHOUT_NETWORKING)
Preference<bool> m_bEnableScoreboard; //Alows disabling of scoreboard in network play
#endif
2005-05-16 09:36:32 +00:00
// wrappers
float GetSoundVolume();
void ReadPrefsFromIni( const IniFile &ini, const RString &sSection, bool bIsStatic );
2006-01-22 01:00:06 +00:00
void ReadGamePrefsFromIni( const RString &sIni );
void ReadDefaultsFromIni( const IniFile &ini, const RString &sSection );
void SavePrefsToIni( IniFile &ini );
2005-02-19 01:59:31 +00:00
2005-10-27 04:54:45 +00:00
void ReadPrefsFromDisk();
void SavePrefsToDisk();
2002-05-27 08:23:27 +00:00
void ResetToFactoryDefaults();
2006-01-22 01:00:06 +00:00
RString GetPreferencesSection() const;
2005-02-17 21:35:45 +00:00
// Lua
void PushSelf( lua_State *L );
protected:
void ReadPrefsFromFile( const RString &sIni, const RString &sSection, bool bIsStatic );
2006-01-22 01:00:06 +00:00
void ReadDefaultsFromFile( const RString &sIni, const RString &sSection );
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
2005-12-19 00:26:43 +00:00
* that are run after PREFSMAN shuts down (and probably don't want to deref that
2003-10-16 08:55:32 +00:00
* 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.
*/