functions moved
This commit is contained in:
@@ -13,20 +13,14 @@
|
|||||||
|
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
#include "NoteSkinManager.h"
|
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
#include "RageDisplay.h"
|
#include "RageDisplay.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "GameDef.h"
|
|
||||||
#include "AnnouncerManager.h"
|
|
||||||
#include "ThemeManager.h"
|
|
||||||
#include "GameConstantsAndTypes.h"
|
|
||||||
#include "arch/arch.h" /* for default driver specs */
|
#include "arch/arch.h" /* for default driver specs */
|
||||||
#include "RageSoundReader_Resample.h" /* for ResampleQuality */
|
#include "RageSoundReader_Resample.h" /* for ResampleQuality */
|
||||||
|
|
||||||
#define STEPMANIA_INI_PATH BASE_PATH "Data" SLASH "StepMania.ini"
|
#define STEPMANIA_INI_PATH BASE_PATH "Data" SLASH "StepMania.ini"
|
||||||
#define GAMEPREFS_INI_PATH BASE_PATH "Data" SLASH "GamePrefs.ini"
|
|
||||||
|
|
||||||
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
||||||
|
|
||||||
@@ -435,44 +429,3 @@ void PrefsManager::SaveGlobalPrefsToDisk()
|
|||||||
|
|
||||||
ini.WriteFile();
|
ini.WriteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrefsManager::ReadGamePrefsFromDisk()
|
|
||||||
{
|
|
||||||
if( !GAMESTATE )
|
|
||||||
return;
|
|
||||||
|
|
||||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
|
||||||
IniFile ini;
|
|
||||||
ini.SetPath( GAMEPREFS_INI_PATH );
|
|
||||||
ini.ReadFile(); // it's OK if this fails
|
|
||||||
|
|
||||||
CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName;
|
|
||||||
|
|
||||||
// if these calls fail, the three strings will keep the initial values set above.
|
|
||||||
ini.GetValue( sGameName, "Announcer", sAnnouncer );
|
|
||||||
ini.GetValue( sGameName, "Theme", sTheme );
|
|
||||||
ini.GetValue( sGameName, "DefaultModifiers", m_sDefaultModifiers );
|
|
||||||
|
|
||||||
// it's OK to call these functions with names that don't exist.
|
|
||||||
ANNOUNCER->SwitchAnnouncer( sAnnouncer );
|
|
||||||
THEME->SwitchThemeAndLanguage( sTheme, m_sLanguage );
|
|
||||||
|
|
||||||
// NOTESKIN->SwitchNoteSkin( sNoteSkin );
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrefsManager::SaveGamePrefsToDisk()
|
|
||||||
{
|
|
||||||
if( !GAMESTATE )
|
|
||||||
return;
|
|
||||||
|
|
||||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
|
||||||
IniFile ini;
|
|
||||||
ini.SetPath( GAMEPREFS_INI_PATH );
|
|
||||||
ini.ReadFile(); // it's OK if this fails
|
|
||||||
|
|
||||||
ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() );
|
|
||||||
ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() );
|
|
||||||
ini.SetValue( sGameName, "DefaultModifiers", m_sDefaultModifiers );
|
|
||||||
|
|
||||||
ini.WriteFile();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ void ScreenOptionsMaster::ExportOptions()
|
|||||||
/* Save preferences. */
|
/* Save preferences. */
|
||||||
LOG->Trace("ROW_CONFIG used; saving ...");
|
LOG->Trace("ROW_CONFIG used; saving ...");
|
||||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||||
PREFSMAN->SaveGamePrefsToDisk();
|
SaveGamePrefsToDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ChangeMask & OPT_RESET_GAME )
|
if( ChangeMask & OPT_RESET_GAME )
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
|
#include "StepMania.h"
|
||||||
|
|
||||||
static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so )
|
static void GetDefaultModifiers( PlayerOptions &po, SongOptions &so )
|
||||||
{
|
{
|
||||||
@@ -104,14 +105,14 @@ static void GameSel( int &sel, bool ToSel, const CStringArray &choices )
|
|||||||
if( !stricmp(choices[i], sCurGameName) )
|
if( !stricmp(choices[i], sCurGameName) )
|
||||||
sel = i;
|
sel = i;
|
||||||
} else {
|
} else {
|
||||||
PREFSMAN->SaveGamePrefsToDisk();
|
SaveGamePrefsToDisk();
|
||||||
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
|
INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game
|
||||||
|
|
||||||
vector<Game> aGames;
|
vector<Game> aGames;
|
||||||
GAMEMAN->GetEnabledGames( aGames );
|
GAMEMAN->GetEnabledGames( aGames );
|
||||||
GAMESTATE->m_CurGame = aGames[sel];
|
GAMESTATE->m_CurGame = aGames[sel];
|
||||||
|
|
||||||
PREFSMAN->ReadGamePrefsFromDisk();
|
ReadGamePrefsFromDisk();
|
||||||
INPUTMAPPER->ReadMappingsFromDisk();
|
INPUTMAPPER->ReadMappingsFromDisk();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user