#ifndef PREFSMANAGER_H #define PREFSMANAGER_H #include "Preference.h" class IniFile; /** @brief How many songs can be played during a normal game max? * * This assumes no extra stages, no event mode, no course modes. */ const int MAX_SONGS_PER_PLAY = 7; enum MusicWheelUsesSections { MusicWheelUsesSections_NEVER, MusicWheelUsesSections_ALWAYS, MusicWheelUsesSections_ABC_ONLY, NUM_MusicWheelUsesSections, MusicWheelUsesSections_Invalid }; /** @brief The options for allowing the W1 timing. */ enum AllowW1 { ALLOW_W1_NEVER, /**< The W1 timing is not used. */ ALLOW_W1_COURSES_ONLY, /**< The W1 timing is used for courses only. */ ALLOW_W1_EVERYWHERE, /**< The W1 timing is used for all modes. */ 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 }; 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 BackgroundCacheMode { BGCACHE_OFF, BGCACHE_LOW_RES_PRELOAD, // preload low-res on start BGCACHE_LOW_RES_LOAD_ON_DEMAND, // preload low-res on screen load BGCACHE_FULL, NUM_BackgroundCacheMode, BackgroundCacheMode_Invalid }; */ enum HighResolutionTextures { HighResolutionTextures_Auto, HighResolutionTextures_ForceOff, HighResolutionTextures_ForceOn, NUM_HighResolutionTextures, HighResolutionTextures_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 DefaultFailType { FAIL_IMMEDIATE, FAIL_IMMEDIATECONTINUE, FAIL_ENDOFSONG, FAIL_OFF, NUM_DefaultFailType, DefaultFailType_Invalid }; /** @brief Holds user-chosen preferences that are saved between sessions. */ class PrefsManager { public: PrefsManager(); ~PrefsManager(); void Init(); void SetCurrentGame( const RString &sGame ); RString GetCurrentGame() { return m_sCurrentGame; } protected: Preference m_sCurrentGame; public: // Game-specific prefs. Copy these off and save them every time the game changes Preference m_sAnnouncer; Preference m_sTheme; Preference m_sDefaultModifiers; protected: void StoreGamePrefs(); void RestoreGamePrefs(); struct GamePrefs { // See GamePrefs::GamePrefs in PrefsManager.cpp for some default settings GamePrefs(); RString m_sAnnouncer; RString m_sTheme; RString m_sDefaultModifiers; }; map m_mapGameNameToGamePrefs; public: Preference m_bWindowed; Preference m_iDisplayWidth; Preference m_iDisplayHeight; Preference m_fDisplayAspectRatio; Preference m_iDisplayColorDepth; Preference m_iTextureColorDepth; Preference m_iMovieColorDepth; Preference m_HighResolutionTextures; Preference m_iMaxTextureResolution; Preference m_iRefreshRate; Preference m_bAllowMultitexture; Preference m_bShowStats; Preference m_bShowBanners; Preference m_bHiddenSongs; Preference m_bVsync; Preference m_bInterlaced; Preference m_bPAL; Preference m_bDelayedTextureDelete; Preference m_bDelayedModelDelete; Preference m_BannerCache; //Preference m_BackgroundCache; Preference m_bFastLoad; Preference m_bFastLoadAdditionalSongs; Preference m_bOnlyDedicatedMenuButtons; Preference m_bMenuTimer; Preference m_fLifeDifficultyScale; // Whoever added these: Please add a comment saying what they do. -Chris Preference m_iRegenComboAfterMiss; Preference m_bMercifulDrain; // negative life deltas are scaled by the players life percentage Preference m_bMinimum1FullSongInCourses; // FEoS for 1st song, FailImmediate thereafter Preference m_bFailOffInBeginner; Preference m_bFailOffForFirstStageEasy; Preference m_bMercifulBeginner; // don't subtract from percent score or grade DP, larger W5 window Preference m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage Preference m_bDelayedBack; Preference m_bShowInstructions; // how to play a mode Preference m_bShowCaution; Preference m_bShowNativeLanguage; Preference m_iArcadeOptionsNavigation; Preference m_MusicWheelUsesSections; Preference m_iMusicWheelSwitchSpeed; Preference m_AllowW1; // this should almost always be on, given use cases. -aj Preference m_bEventMode; Preference m_iCoinsPerCredit; Preference m_iSongsPerPlay; Preference m_bDelayedCreditsReconcile; // zuh? Preference m_ShowSongOptions; Preference m_bDancePointsForOni; Preference m_bPercentageScoring; Preference m_fMinPercentageForMachineSongHighScore; Preference m_fMinPercentageForMachineCourseHighScore; Preference m_bDisqualification; Preference m_bAutogenSteps; Preference m_bAutogenGroupCourses; Preference m_bOnlyPreferredDifficulties; Preference m_bBreakComboToGetItem; Preference m_bLockCourseDifficulties; Preference m_ShowDancingCharacters; Preference m_bUseUnlockSystem; Preference m_fGlobalOffsetSeconds; Preference m_iProgressiveLifebar; Preference m_iProgressiveStageLifebar; Preference m_iProgressiveNonstopLifebar; Preference m_bShowBeginnerHelper; Preference m_bDisableScreenSaver; Preference m_sLanguage; Preference m_sMemoryCardProfileSubdir; // the directory on a memory card to look in for a profile Preference m_iProductID; // Saved in HighScore to track what software version a score came from. Preference m_iCenterImageTranslateX; Preference m_iCenterImageTranslateY; Preference m_fCenterImageAddWidth; Preference m_fCenterImageAddHeight; Preference m_AttractSoundFrequency; Preference m_bAllowExtraStage; Preference m_iMaxHighScoresPerListForMachine; Preference m_iMaxHighScoresPerListForPlayer; Preference m_bAllowMultipleHighScoreWithSameName; Preference m_bCelShadeModels; Preference m_bPreferredSortUsesGroups; // Number of seconds it takes for a button on the controller to release // after pressed. Preference m_fPadStickSeconds; // Useful for non 4:3 displays and resolutions < 640x480 where texels don't // map directly to pixels. Preference m_bForceMipMaps; Preference m_bTrilinearFiltering; // has no effect without mipmaps on Preference m_bAnisotropicFiltering; // has no effect without mipmaps on. Not mutually exclusive with trilinear. // 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. Preference m_bSignProfileData; // course ranking Preference m_CourseSortOrder; Preference m_bSubSortByNumSteps; Preference m_GetRankingName; Preference m_sAdditionalSongFolders; Preference m_sAdditionalCourseFolders; Preference m_sAdditionalFolders; // failsafe Preference m_sDefaultTheme; Preference m_sLastSeenVideoDriver; Preference m_sVideoRenderers; // StepMania.cpp sets these on first run based on the card Preference m_bSmoothLines; Preference m_iSoundWriteAhead; Preference m_iSoundDevice; Preference m_iSoundPreferredSampleRate; Preference m_sLightsStepsDifficulty; Preference m_bAllowUnacceleratedRenderer; Preference m_bThreadedInput; Preference m_bThreadedMovieDecode; Preference m_sTestInitialScreen; Preference m_bDebugLights; Preference m_bMonkeyInput; Preference m_sMachineName; Preference m_sCoursesToShowRanking; /** @brief Enable some quirky behavior used by some older versions of StepMania. */ Preference m_bQuirksMode; // Preference m_sDefaultFailType; // XXX: Fix fail bug? // Debug: Preference m_bLogToDisk; Preference m_bForceLogFlush; Preference m_bShowLogOutput; Preference m_bLogSkips; Preference m_bLogCheckpoints; Preference m_bShowLoadingWindow; Preference m_bPseudoLocalize; #if !defined(WITHOUT_NETWORKING) Preference m_bEnableScoreboard; //Alows disabling of scoreboard in network play #endif void ReadPrefsFromIni( const IniFile &ini, const RString &sSection, bool bIsStatic ); void ReadGamePrefsFromIni( const RString &sIni ); void ReadDefaultsFromIni( const IniFile &ini, const RString &sSection ); void SavePrefsToIni( IniFile &ini ); void ReadPrefsFromDisk(); void SavePrefsToDisk(); void ResetToFactoryDefaults(); RString GetPreferencesSection() const; // Lua void PushSelf( lua_State *L ); protected: void ReadPrefsFromFile( const RString &sIni, const RString &sSection, bool bIsStatic ); void ReadDefaultsFromFile( const RString &sIni, const RString &sSection ); }; /* 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 that * pointer anyway). */ extern bool g_bAutoRestart; extern PrefsManager* PREFSMAN; // global and accessable from anywhere in our program #endif /** * @file * @author Chris Danford, Chris Gomez (c) 2001-2004 * @section LICENSE * 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. */