#include "global.h" /* ----------------------------------------------------------------------------- Class: PrefsManager Desc: See Header. Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. Chris Danford Chris Gomez ----------------------------------------------------------------------------- */ #include "PrefsManager.h" #include "IniFile.h" #include "GameState.h" #include "RageDisplay.h" #include "RageUtil.h" #include "arch/arch.h" /* for default driver specs */ #include "RageSoundReader_Resample.h" /* for ResampleQuality */ #include "RageFile.h" #include "ProductInfo.h" #define STEPMANIA_INI_PATH "Data/StepMania.ini" #define STATIC_INI_PATH "Data/Static.ini" PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program const float DEFAULT_SOUND_VOLUME = 1.00f; const CString DEFAULT_LIGHTS_DRIVER = "Null"; bool g_bAutoRestart = false; PrefsManager::PrefsManager() { #ifdef DEBUG m_bWindowed = true; #else m_bWindowed = false; #endif m_iDisplayWidth = 640; m_iDisplayHeight = 480; m_iDisplayColorDepth = 16; m_iTextureColorDepth = 16; // default to 16 for better preformance on slower cards m_iMovieColorDepth = 16; m_iMaxTextureResolution = 2048; m_iRefreshRate = REFRESH_DEFAULT; m_bOnlyDedicatedMenuButtons = false; #ifdef DEBUG m_bShowStats = true; #else m_bShowStats = false; #endif m_bShowBanners = true ; m_BackgroundMode = BGMODE_ANIMATIONS; m_iNumBackgrounds = 8; m_bShowDanger = true; m_fBGBrightness = 0.8f; m_bMenuTimer = true; m_iNumArcadeStages = 3; m_bEventMode = false; m_bAutoPlay = false; m_fJudgeWindowScale = 1.0f; m_fLifeDifficultyScale = 1.0f; m_fJudgeWindowMarvelousSeconds = 0.0225f; m_fJudgeWindowPerfectSeconds = 0.045f; m_fJudgeWindowGreatSeconds = 0.090f; m_fJudgeWindowGoodSeconds = 0.135f; m_fJudgeWindowBooSeconds = 0.180f; m_fJudgeWindowOKSeconds = 0.250f; // allow enough time to take foot off and put back on m_fJudgeWindowMineSeconds = 0.135f; m_fJudgeWindowAttackSeconds = 0.135f; m_fLifeDeltaMarvelousPercentChange = +0.008f; m_fLifeDeltaPerfectPercentChange = +0.008f; m_fLifeDeltaGreatPercentChange = +0.004f; m_fLifeDeltaGoodPercentChange = +0.000f; m_fLifeDeltaBooPercentChange = -0.040f; m_fLifeDeltaMissPercentChange = -0.080f; m_fLifeDeltaOKPercentChange = +0.008f; m_fLifeDeltaNGPercentChange = -0.080f; m_fLifeDeltaMinePercentChange = -0.160f; m_iRegenComboAfterFail = 10; // cumulative m_iRegenComboAfterMiss = 5; // cumulative m_iMaxRegenComboAfterFail = 10; m_iMaxRegenComboAfterMiss = 10; m_bTwoPlayerRecovery = true; m_bDelayedEscape = true; m_bInstructions = true; m_bShowDontDie = true; m_bShowSelectGroup = true; m_bShowNative = true; m_bArcadeOptionsNavigation = false; m_bSoloSingle = false; m_bDelayedTextureDelete = true; m_bTexturePreload = false; m_bDelayedScreenLoad = false; m_BannerCache = BNCACHE_LOW_RES; m_MusicWheelUsesSections = ALWAYS; m_iMusicWheelSwitchSpeed = 10; m_bEasterEggs = true; m_iMarvelousTiming = 2; m_iCoinMode = COIN_HOME; m_iCoinsPerCredit = 1; m_Premium = NO_PREMIUM; m_iBoostAppPriority = -1; m_bSmoothLines = false; m_ShowSongOptions = YES; m_bDancePointsForOni = false; m_bPercentageScoring = false; m_fMinPercentageForHighScore = 0.5f; m_bShowLyrics = true; m_bAutogenMissingTypes = true; m_bAutogenGroupCourses = true; m_bBreakComboToGetItem = false; m_ShowDancingCharacters = CO_OFF; m_bUseUnlockSystem = false; m_bFirstRun = true; m_bAutoMapOnJoyChange = true; m_fGlobalOffsetSeconds = 0; m_bShowBeginnerHelper = false; m_bEndlessBreakEnabled = true; m_iEndlessNumStagesUntilBreak = 5; m_iEndlessBreakLength = 5; // set to 0 so people aren't shocked at first m_iProgressiveLifebar = 0; m_iProgressiveNonstopLifebar = 0; m_iProgressiveStageLifebar = 0; /* DDR Extreme-style extra stage support. * Default off so people used to the current behavior (or those with extra * stage CRS files) don't get it changed around on them. */ m_bPickExtraStage = false; m_bComboContinuesBetweenSongs = false; // default to old sort order m_iCourseSortOrder = COURSE_SORT_SONGS; m_bMoveRandomToEnd = false; m_iScoringType = SCORING_MAX2; m_iGetRankingName = RANKING_ON; m_fLongVerSongSeconds = 60*2.5f; // Dynamite Rave is 2:55 m_fMarathonVerSongSeconds = 60*5.f; /* 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 = false; m_bVsync = true; m_sLanguage = ""; // ThemeManager will deal with this invalid language m_iCenterImageTranslateX = 0; m_iCenterImageTranslateY = 0; m_fCenterImageScaleX = 1; m_fCenterImageScaleY = 1; m_bAttractSound = true; m_bDemonstrationSound = true; m_bAllowExtraStage = true; g_bAutoRestart = false; /* XXX: Set these defaults for individual consoles using VideoCardDefaults.ini. */ #ifdef _XBOX m_bInterlaced = true; m_bPAL = false; m_fScreenPosX = 0 ; m_fScreenPosY = 0 ; m_fScreenWidth = 640 ; m_fScreenHeight = 480 ; #else m_bInterlaced = false; #endif m_sSoundDrivers = DEFAULT_SOUND_DRIVER_LIST; /* Number of frames to write ahead; usually 44100 frames per second. * (Number of millisec would be more flexible, but it's more useful to * specify numbers directly.) This is purely a troubleshooting option * and is not honored by all sound drivers. */ m_iSoundWriteAhead = 0; m_sMovieDrivers = DEFAULT_MOVIE_DRIVER_LIST; // StepMania.cpp sets these on first run: m_sVideoRenderers = ""; #if defined(WIN32) m_iLastSeenMemory = 0; #endif m_fSoundVolume = DEFAULT_SOUND_VOLUME; m_sLightsDriver = DEFAULT_LIGHTS_DRIVER; /* This is experimental: let's see if preloading helps people's skipping. * If it doesn't do anything useful, it'll be removed. */ m_bSoundPreloadAll = false; m_iSoundResampleQuality = RageSoundReader_Resample::RESAMP_NORMAL; m_bAllowUnacceleratedRenderer = false; m_bThreadedInput = true; m_bScreenTestMode = false; m_sIgnoredMessageWindows = ""; m_sCoursesToShowRanking = ""; m_bLogging = true; m_bForceLogFlush = false; #ifdef DEBUG m_bShowLogOutput = true; #else m_bShowLogOutput = false; #endif m_bTimestamping = false; m_bLogCheckpoints = false; for( int p=0; p