change PRODUCT_NAME".ini" to "Preferences.ini"

add Clear Preferences and Clear Keymaps to smpackage
This commit is contained in:
Chris Danford
2005-11-12 07:03:49 +00:00
parent ad26458081
commit 7e1cc9ce0f
8 changed files with 99 additions and 43 deletions
+4 -4
View File
@@ -13,7 +13,7 @@
#include "StepMania.h"
const CString DEFAULTS_INI_PATH = "Data/Defaults.ini"; // these can be overridden
const CString STEPMANIA_INI_PATH = "Save/" PRODUCT_NAME ".ini"; // overlay on Defaults.ini, contains the user's choices
const CString PREFERENCES_INI_PATH = "Save/Preferences.ini"; // overlay on Defaults.ini, contains the user's choices
const CString STATIC_INI_PATH = "Data/Static.ini"; // overlay on the 2 above, can't be overridden
const CString TYPE_TXT_FILE = "Data/Type.txt";
@@ -464,8 +464,8 @@ void PrefsManager::RestoreGamePrefs()
void PrefsManager::ReadPrefsFromDisk()
{
ReadPrefsFromFile( DEFAULTS_INI_PATH, GetPreferencesSection() );
ReadPrefsFromFile( STEPMANIA_INI_PATH, "Options" );
ReadGamePrefsFromIni( STEPMANIA_INI_PATH );
ReadPrefsFromFile( PREFERENCES_INI_PATH, "Options" );
ReadGamePrefsFromIni( PREFERENCES_INI_PATH );
ReadPrefsFromFile( STATIC_INI_PATH, GetPreferencesSection() );
if( !m_sCurrentGame.Get().empty() )
@@ -543,7 +543,7 @@ void PrefsManager::SavePrefsToDisk()
{
IniFile ini;
SavePrefsToIni( ini );
ini.WriteFile( STEPMANIA_INI_PATH );
ini.WriteFile( PREFERENCES_INI_PATH );
}
void PrefsManager::SavePrefsToIni( IniFile &ini )
@@ -51,7 +51,7 @@ BOOL ChangeGameSettings::OnInitDialog()
// Fill the radio buttons
//
IniFile ini;
ini.SetPath( STEPMANIA_INI );
ini.SetPath( PREFERENCES_INI );
ini.ReadFile();
CString sValue;
@@ -100,7 +100,7 @@ void ChangeGameSettings::OnOK()
{
// TODO: Add extra validation here
IniFile ini;
ini.SetPath( STEPMANIA_INI );
ini.SetPath( PREFERENCES_INI );
ini.ReadFile();
+51 -11
View File
@@ -10,6 +10,7 @@
#include "ChangeGameSettings.h"
#include "RageUtil.h"
#include "SMPackageUtil.h"
#include ".\mainmenudlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -44,9 +45,11 @@ BEGIN_MESSAGE_MAP(MainMenuDlg, CDialog)
ON_BN_CLICKED(IDC_EXPORT_PACKAGES, OnExportPackages)
ON_BN_CLICKED(IDC_EDIT_INSTALLATIONS, OnEditInstallations)
ON_BN_CLICKED(IDC_ANALYZE_ELEMENTS, OnAnalyzeElements)
ON_BN_CLICKED(IDC_CHANGE_API, OnChangeApi)
ON_BN_CLICKED(IDC_CREATE_SONG, OnCreateSong)
ON_BN_CLICKED(IDC_OPEN_STEPMANIA_INI, OnOpenStepmaniaIni)
ON_BN_CLICKED(IDC_CLEAR_KEYMAPS, OnBnClickedClearKeymaps)
ON_BN_CLICKED(IDC_CHANGE_PREFERENCES, OnBnClickedChangePreferences)
ON_BN_CLICKED(IDC_OPEN_PREFERENCES, OnBnClickedOpenPreferences)
ON_BN_CLICKED(IDC_CLEAR_PREFERENCES, OnBnClickedClearPreferences)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -75,13 +78,6 @@ void MainMenuDlg::OnAnalyzeElements()
int nResponse = dlg.DoModal();
}
void MainMenuDlg::OnChangeApi()
{
// TODO: Add your control notification handler code here
ChangeGameSettings dlg;
int nResponse = dlg.DoModal();
}
CString GetLastErrorString()
{
LPVOID lpMsgBuf;
@@ -192,8 +188,52 @@ BOOL MainMenuDlg::OnInitDialog()
// EXCEPTION: OCX Property Pages should return FALSE
}
void MainMenuDlg::OnOpenStepmaniaIni()
void MainMenuDlg::OnBnClickedClearKeymaps()
{
// TODO: Add your control notification handler code here
::ShellExecute( this->m_hWnd, "open", STEPMANIA_INI, "", "", SW_SHOWNORMAL );
if( !DoesFileExist( KEYMAPS_INI ) )
{
MessageBox( KEYMAPS_INI + " is already cleared." );
}
else
{
if( !DeleteFile( KEYMAPS_INI ) )
MessageBox( "Failed to delete file " + KEYMAPS_INI + "." );
}
}
void MainMenuDlg::OnBnClickedChangePreferences()
{
// TODO: Add your control notification handler code here
ChangeGameSettings dlg;
int nResponse = dlg.DoModal();
}
void MainMenuDlg::OnBnClickedOpenPreferences()
{
// TODO: Add your control notification handler code here
if( !DoesFileExist( PREFERENCES_INI ) )
{
MessageBox( PREFERENCES_INI + " doesn't exist. It will be created next time you start the game." );
}
else
{
if( NULL == ::ShellExecute( this->m_hWnd, "open", PREFERENCES_INI, "", "", SW_SHOWNORMAL ) )
MessageBox( "Failed to open " + PREFERENCES_INI + ": " + GetLastErrorString() );
}
}
void MainMenuDlg::OnBnClickedClearPreferences()
{
// TODO: Add your control notification handler code here
if( !DoesFileExist( PREFERENCES_INI ) )
{
MessageBox( PREFERENCES_INI + " is already cleared." );
}
else
{
if( !DeleteFile( PREFERENCES_INI ) )
MessageBox( "Failed to delete file " + PREFERENCES_INI + "." );
}
}
+5
View File
@@ -42,8 +42,13 @@ protected:
afx_msg void OnCreateSong();
virtual BOOL OnInitDialog();
afx_msg void OnOpenStepmaniaIni();
afx_msg void OnBnClickedClearKeymaps();
afx_msg void OnBnClickedChangePreferences();
afx_msg void OnBnClickedOpenPreferences();
afx_msg void OnBnClickedClearPreferences();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
};
//{{AFX_INSERT_LOCATION}}
+5
View File
@@ -46,12 +46,17 @@
#define IDC_BUTTON_CONVERT 1024
#define IDC_BUTTON_ANALYZE 1025
#define IDC_CHANGE_API 1025
#define IDC_CHANGE_PREFERENCES 1025
#define IDC_BUTTON_EDIT_METRICS 1026
#define IDC_CREATE_SONG 1026
#define IDC_BUTTON_ANALYZE_METRICS 1027
#define IDC_OPEN_STEPMANIA_INI 1027
#define IDC_OPEN_PREFERENCES 1027
#define IDC_EDIT_VALUE 1028
#define IDC_CLEAR_SETTINGS 1028
#define IDC_CLEAR_PREFERENCES 1028
#define IDC_EDIT_DEFAULT 1029
#define IDC_CLEAR_KEYMAPS 1029
#define IDC_BUTTON_REFRESH 1035
#define IDC_BUTTON_SAVE 1036
#define IDC_BUTTON_OVERRIDE 1037
+29 -24
View File
@@ -155,38 +155,43 @@ BEGIN
IDC_STATIC,18,144,196,17
END
IDD_MENU DIALOGEX 0, 0, 332, 317
IDD_MENU DIALOGEX 0, 0, 332, 345
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "StepMania Tools Main Menu"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Exit",IDOK,275,296,50,14
DEFPUSHBUTTON "Exit",IDOK,275,324,50,14
CONTROL 140,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
GROUPBOX "Installations",IDC_STATIC,7,163,318,39
PUSHBUTTON "Edit Installations",IDC_EDIT_INSTALLATIONS,16,178,75,15
LTEXT "Choose this option to edit the list of locations where you have StepMania or DWI installed. When you double-click on a .smzip file, you can choose to install the package to any of these locations.",
IDC_STATIC,104,173,215,25
GROUPBOX ".smzip Packages",IDC_STATIC,7,203,318,40
PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,15,218,75,15
LTEXT "Choose this option to create .smzip files that you can share with other users. A .smzip package can contain songs, courses, themes, background animations, and more.",
IDC_STATIC,104,213,215,25
GROUPBOX "Themes",IDC_STATIC,7,245,318,40
PUSHBUTTON "Theme Tools",IDC_ANALYZE_ELEMENTS,15,260,75,15
LTEXT "Using this feature, you can:\n - Catch redundant and misnamed theme elements\n - Edit theme metrics using a user-friendly interface",
IDC_STATIC,102,255,215,26
GROUPBOX "Songs",IDC_STATIC,7,287,318,34
PUSHBUTTON "Create Song",IDC_CREATE_SONG,16,299,75,15
LTEXT "Choose this option to create a new song in StepMania from your favorite mp3 or ogg music file.",
IDC_STATIC,103,298,215,20
GROUPBOX "Preferences",IDC_STATIC,7,53,318,69
PUSHBUTTON "Change Preferences",IDC_CHANGE_PREFERENCES,16,65,75,15
PUSHBUTTON "Open Preferences",IDC_OPEN_PREFERENCES,16,101,75,15
LTEXT "Using this feature, you can:\n - Change the graphics API that the game will use.\n - Change the sound API that the game will use.\n - Clear all preferences if the game won't start.\n - Open the preferences file to make changes by hand.",
IDC_STATIC,104,67,215,45
PUSHBUTTON "Clear Preferences",IDC_CLEAR_PREFERENCES,16,83,75,15
PUSHBUTTON "Clear Mappings",IDC_CLEAR_KEYMAPS,16,138,75,15
RTEXT "Installation:",IDC_STATIC,37,42,63,9,0,
WS_EX_TRANSPARENT
EDITTEXT IDC_EDIT_INSTALLATION,105,40,220,12,ES_AUTOHSCROLL |
ES_READONLY
GROUPBOX "Installations",IDC_STATIC,7,55,318,42
PUSHBUTTON "Edit Installations",IDC_EDIT_INSTALLATIONS,20,72,70,15
LTEXT "Choose this option to edit the list of locations where you have StepMania or DWI installed. When you double-click on a .smzip file, you can choose to install the package to any of these locations.",
IDC_STATIC,105,67,215,25
GROUPBOX ".smzip Packages",IDC_STATIC,7,100,318,45
PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,19,118,70,15
LTEXT "Choose this option to create .smzip files that you can share with other StepMania and DWI users. A .smzip package can contain songs, courses, themes, background animations, and more.",
IDC_STATIC,105,113,215,25
GROUPBOX "Themes",IDC_STATIC,7,150,318,44
PUSHBUTTON "Theme Tools",IDC_ANALYZE_ELEMENTS,19,168,70,15
LTEXT "Using this feature, you can:\n - Catch redundant and misnamed theme elements\n - Edit theme metrics using a user-friendly interface",
IDC_STATIC,103,163,215,26
GROUPBOX "Game Settings",IDC_STATIC,5,199,320,49
PUSHBUTTON "Change Settings",IDC_CHANGE_API,19,210,70,15
PUSHBUTTON "Open StepMania.ini",IDC_OPEN_STEPMANIA_INI,19,228,70,15
LTEXT "Using this feature, you can:\n - Change the graphics API that StepMania will use.\n - Change the sound API that StepMania will use.",
IDC_STATIC,103,212,215,29
GROUPBOX "Songs",IDC_STATIC,5,252,320,38
PUSHBUTTON "Create Song",IDC_CREATE_SONG,19,267,70,15
LTEXT "Choose this option to create a new song in StepMania from your favorite mp3 or ogg music file.",
IDC_STATIC,103,266,215,23
GROUPBOX "Keyboard / Joystick Mappings",IDC_STATIC,7,123,318,39
LTEXT "Erase all of your keyboard and joystick mappings if you've made a mistake mapping keys in the game and can't get back to change them.",
IDC_STATIC,104,133,214,25
END
IDD_CONVERT_THEME DIALOGEX 0, 0, 332, 258
@@ -397,7 +402,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 325
TOPMARGIN, 7
BOTTOMMARGIN, 310
BOTTOMMARGIN, 338
END
IDD_CONVERT_THEME, DIALOG
+2 -1
View File
@@ -4,7 +4,8 @@
#include "RageUtil.h"
#include "../ProductInfo.h"
static const CString STEPMANIA_INI = "Save\\" + CString(PRODUCT_NAME) + ".ini";
static const CString PREFERENCES_INI = "Save\\Preferences.ini";
static const CString KEYMAPS_INI = "Save\\Keymaps.ini";
void WriteStepManiaInstallDirs( const CStringArray& asInstallDirsToWrite );
void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut );
+1 -1
View File
@@ -331,7 +331,7 @@ Section "Main Section" SecMain
;Delete "$INSTDIR\Save\${PRODUCT_NAME}.ini"
;stepmania_ini_not_present:
;; Move ini into Save\
;Rename "$INSTDIR\Save\${PRODUCT_NAME}.ini" "$INSTDIR\${PRODUCT_NAME}.ini"
;Rename "$INSTDIR\${PRODUCT_NAME}.ini" "$INSTDIR\Save\Preferences.ini"
; Create Start Menu icons
SetShellVarContext current # 'all' doesn't work on Win9x