have smpackage read theme from static.ini in case the game hasn't been run yet to create preferences.ini
This commit is contained in:
@@ -8,13 +8,12 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
|
|
||||||
|
|
||||||
const RString DEFAULTS_INI_PATH = "Data/Defaults.ini"; // these can be overridden
|
|
||||||
//PREFERENCES_INI_PATH // overlay on Defaults.ini, contains the user's choices
|
|
||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
const RString STATIC_INI_PATH = "Data/Static.ini"; // overlay on the 2 above, can't be overridden
|
|
||||||
const RString TYPE_TXT_FILE = "Data/Type.txt";
|
//DEFAULTS_INI_PATH = "Data/Defaults.ini"; // these can be overridden
|
||||||
|
//PREFERENCES_INI_PATH // overlay on Defaults.ini, contains the user's choices
|
||||||
|
//STATIC_INI_PATH = "Data/Static.ini"; // overlay on the 2 above, can't be overridden
|
||||||
|
//TYPE_TXT_FILE = "Data/Type.txt";
|
||||||
|
|
||||||
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ const RString SpecialFiles::BASE_LANGUAGE = "en";
|
|||||||
const RString SpecialFiles::METRICS_FILE = "metrics.ini";
|
const RString SpecialFiles::METRICS_FILE = "metrics.ini";
|
||||||
const RString SpecialFiles::CACHE_DIR = "Cache/";
|
const RString SpecialFiles::CACHE_DIR = "Cache/";
|
||||||
const RString SpecialFiles::BASE_THEME_NAME = "default";
|
const RString SpecialFiles::BASE_THEME_NAME = "default";
|
||||||
|
const RString SpecialFiles::DEFAULTS_INI_PATH = "Data/Defaults.ini";
|
||||||
|
const RString SpecialFiles::STATIC_INI_PATH = "Data/Static.ini";
|
||||||
|
const RString SpecialFiles::TYPE_TXT_FILE = "Data/Type.txt";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ namespace SpecialFiles
|
|||||||
extern const RString METRICS_FILE;
|
extern const RString METRICS_FILE;
|
||||||
extern const RString CACHE_DIR;
|
extern const RString CACHE_DIR;
|
||||||
extern const RString BASE_THEME_NAME;
|
extern const RString BASE_THEME_NAME;
|
||||||
|
extern const RString DEFAULTS_INI_PATH;
|
||||||
|
extern const RString STATIC_INI_PATH;
|
||||||
|
extern const RString TYPE_TXT_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,19 +71,41 @@ BOOL CSmpackageApp::InitInstance()
|
|||||||
|
|
||||||
// TODO: Use PrefsManager to get the current language instead? PrefsManager would
|
// TODO: Use PrefsManager to get the current language instead? PrefsManager would
|
||||||
// need to be split up to reduce dependencies
|
// need to be split up to reduce dependencies
|
||||||
IniFile ini;
|
RString sTheme = SpecialFiles::BASE_THEME_NAME;
|
||||||
|
|
||||||
|
{
|
||||||
|
RString sType = "Preferences";
|
||||||
|
GetFileContents( SpecialFiles::TYPE_TXT_FILE, sType, true );
|
||||||
|
IniFile ini;
|
||||||
|
if( ini.ReadFile(SpecialFiles::STATIC_INI_PATH) )
|
||||||
|
{
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
if( ini.GetValue(sType, "Theme", sTheme) )
|
||||||
|
break;
|
||||||
|
if( ini.GetValue(sType, "Fallback", sType) )
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RString sLanguage;
|
RString sLanguage;
|
||||||
bool bPseudoLocalize = false;
|
bool bPseudoLocalize = false;
|
||||||
bool bShowLogOutput = false;
|
bool bShowLogOutput = false;
|
||||||
bool bLogToDisk = false;
|
bool bLogToDisk = false;
|
||||||
if( ini.ReadFile(SpecialFiles::PREFERENCES_INI_PATH) )
|
|
||||||
{
|
{
|
||||||
|
IniFile ini;
|
||||||
|
if( ini.ReadFile(SpecialFiles::PREFERENCES_INI_PATH) )
|
||||||
|
{
|
||||||
|
ini.GetValue( "Options", "Theme", sTheme );
|
||||||
ini.GetValue( "Options", "Language", sLanguage );
|
ini.GetValue( "Options", "Language", sLanguage );
|
||||||
ini.GetValue( "Options", "PseudoLocalize", bPseudoLocalize );
|
ini.GetValue( "Options", "PseudoLocalize", bPseudoLocalize );
|
||||||
ini.GetValue( "Options", "ShowLogOutput", bShowLogOutput );
|
ini.GetValue( "Options", "ShowLogOutput", bShowLogOutput );
|
||||||
ini.GetValue( "Options", "LogToDisk", bLogToDisk );
|
ini.GetValue( "Options", "LogToDisk", bLogToDisk );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
THEME->SwitchThemeAndLanguage( SpecialFiles::BASE_THEME_NAME, sLanguage, bPseudoLocalize );
|
THEME->SwitchThemeAndLanguage( sTheme, sLanguage, bPseudoLocalize );
|
||||||
LOG->SetShowLogOutput( bShowLogOutput );
|
LOG->SetShowLogOutput( bShowLogOutput );
|
||||||
LOG->SetLogToDisk( bLogToDisk );
|
LOG->SetLogToDisk( bLogToDisk );
|
||||||
LOG->SetInfoToDisk( true );
|
LOG->SetInfoToDisk( true );
|
||||||
|
|||||||
Reference in New Issue
Block a user