diff --git a/stepmania/src/StepMania-net2003.sln b/stepmania/src/StepMania-net2003.sln index 6e84e913fe..abf806d1f8 100644 --- a/stepmania/src/StepMania-net2003.sln +++ b/stepmania/src/StepMania-net2003.sln @@ -1,8 +1,4 @@ Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StepMania", "StepMania-net2003.vcproj", "{670745A6-106B-420D-A2A9-D4F89A23986E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -10,12 +6,6 @@ Global Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution - {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.ActiveCfg = Debug|Win32 - {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.Build.0 = Debug|Win32 - {670745A6-106B-420D-A2A9-D4F89A23986E}.FastDebug.ActiveCfg = FastDebug|Win32 - {670745A6-106B-420D-A2A9-D4F89A23986E}.FastDebug.Build.0 = FastDebug|Win32 - {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.ActiveCfg = Release|Win32 - {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution DPBuild = 5 diff --git a/stepmania/src/smpackage-net2003.sln b/stepmania/src/smpackage-net2003.sln index 978a5a3529..bac59da923 100644 --- a/stepmania/src/smpackage-net2003.sln +++ b/stepmania/src/smpackage-net2003.sln @@ -1,6 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smpackage", "smpackage-net2003.vcproj", "{6B369A92-8DDF-487C-A589-614987544197}" ProjectSection(ProjectDependencies) = postProject + {F8FE2773-87CB-402F-8DC8-A80837C3E24C} = {F8FE2773-87CB-402F-8DC8-A80837C3E24C} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipArchive", "smpackage\ZipArchive\ZipArchive-net2003.vcproj", "{F8FE2773-87CB-402F-8DC8-A80837C3E24C}" diff --git a/stepmania/src/smpackage-net2003.vcproj b/stepmania/src/smpackage-net2003.vcproj index 35265703d0..56d30ee2bb 100644 --- a/stepmania/src/smpackage-net2003.vcproj +++ b/stepmania/src/smpackage-net2003.vcproj @@ -41,7 +41,7 @@ Name="VCCustomBuildTool"/> + RelativePath="smpackage.ICO"> + RelativePath="res\smpackage.ico"> @@ -490,13 +490,10 @@ - - + Value="smpackage\smpackage.rc"/> diff --git a/stepmania/src/smpackage/MainMenuDlg.cpp b/stepmania/src/smpackage/MainMenuDlg.cpp index 30315080ce..84d69888cc 100644 --- a/stepmania/src/smpackage/MainMenuDlg.cpp +++ b/stepmania/src/smpackage/MainMenuDlg.cpp @@ -15,6 +15,7 @@ #include "archutils/Win32/SpecialDirs.h" #include "SpecialFiles.h" #include "ProductInfo.h" +#include ".\mainmenudlg.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -56,6 +57,7 @@ BEGIN_MESSAGE_MAP(MainMenuDlg, CDialog) //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BUTTON_LAUNCH_GAME, OnBnClickedButtonLaunchGame) ON_BN_CLICKED(IDC_VIEW_STATISTICS, OnBnClickedViewStatistics) + ON_BN_CLICKED(IDC_CLEAR_CACHE, OnBnClickedClearCache) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -236,8 +238,8 @@ void MainMenuDlg::OnBnClickedClearPreferences() void MainMenuDlg::OnBnClickedButtonLaunchGame() { // TODO: Add your control notification handler code here - SMPackageUtil::LaunchGame(); - exit(0); + if( SMPackageUtil::LaunchGame() ) + exit(0); } void MainMenuDlg::OnBnClickedViewStatistics() @@ -248,3 +250,9 @@ void MainMenuDlg::OnBnClickedViewStatistics() if( NULL == ::ShellExecute( this->m_hWnd, "open", sFile, "", "", SW_SHOWNORMAL ) ) MessageBox( "Failed to open '" + sFile + "': " + GetLastErrorString() ); } + +void MainMenuDlg::OnBnClickedClearCache() +{ + // TODO: Add your control notification handler code here + ASSERT(0); +} diff --git a/stepmania/src/smpackage/MainMenuDlg.h b/stepmania/src/smpackage/MainMenuDlg.h index 026b54e976..57cbfb52b0 100644 --- a/stepmania/src/smpackage/MainMenuDlg.h +++ b/stepmania/src/smpackage/MainMenuDlg.h @@ -50,6 +50,7 @@ protected: public: afx_msg void OnBnClickedButtonLaunchGame(); afx_msg void OnBnClickedViewStatistics(); + afx_msg void OnBnClickedClearCache(); }; //{{AFX_INSERT_LOCATION}} diff --git a/stepmania/src/smpackage/SMPackageUtil.cpp b/stepmania/src/smpackage/SMPackageUtil.cpp index 9788bbf089..ff333902f8 100644 --- a/stepmania/src/smpackage/SMPackageUtil.cpp +++ b/stepmania/src/smpackage/SMPackageUtil.cpp @@ -161,7 +161,7 @@ bool SMPackageUtil::IsValidPackageDirectory( RString path ) return true; } -void SMPackageUtil::LaunchGame() +bool SMPackageUtil::LaunchGame() { PROCESS_INFORMATION pi; STARTUPINFO si; @@ -173,8 +173,8 @@ void SMPackageUtil::LaunchGame() sFile = "Program\\" + sFile; if( !DoesFileExist(sFile) ) { - MessageBox( NULL, "Error", "Could not find " PRODUCT_NAME ".exe", MB_ICONEXCLAMATION ); - return; + MessageBox( NULL, "Could not find " PRODUCT_NAME ".exe", "Error", MB_ICONEXCLAMATION ); + return false; } } @@ -190,4 +190,5 @@ void SMPackageUtil::LaunchGame() &si, // pointer to STARTUPINFO &pi // pointer to PROCESS_INFORMATION ); + return true; } diff --git a/stepmania/src/smpackage/resource.h b/stepmania/src/smpackage/resource.h index 88c393cd9f..df86fef3c0 100644 --- a/stepmania/src/smpackage/resource.h +++ b/stepmania/src/smpackage/resource.h @@ -52,6 +52,8 @@ #define IDC_EDIT_DEFAULT 1029 #define IDC_CLEAR_KEYMAPS 1029 #define IDC_VIEW_STATISTICS 1030 +#define IDC_CLEAR_KEYMAPS2 1031 +#define IDC_CLEAR_CACHE 1031 #define IDC_BUTTON_REFRESH 1035 #define IDC_BUTTON_SAVE 1036 #define IDC_BUTTON_OVERRIDE 1037 diff --git a/stepmania/src/smpackage/smpackage.cpp b/stepmania/src/smpackage/smpackage.cpp index 2c4f4fcd16..8cf783aab0 100644 --- a/stepmania/src/smpackage/smpackage.cpp +++ b/stepmania/src/smpackage/smpackage.cpp @@ -11,6 +11,7 @@ #include "smpackageUtil.h" #include "MainMenuDlg.h" #include "RageFileManager.h" +#include "arch/arch.h" #ifdef _DEBUG @@ -44,27 +45,20 @@ CSmpackageApp theApp; ///////////////////////////////////////////////////////////////////////////// // CSmpackageApp initialization +#include "RageLog.h" +#include "RageFileManager.h" BOOL CSmpackageApp::InitInstance() { - // Make sure the current directory is the root program directory + /* Almost everything uses this to read and write files. Load this early. */ + FILEMAN = new RageFileManager( "" ); + FILEMAN->MountInitialFilesystems(); - // change dir to path of the execuctable - TCHAR szFullAppPath[MAX_PATH]; - GetModuleFileName(NULL, szFullAppPath, MAX_PATH); - - // strip off executable name - LPSTR pLastBackslash = strrchr(szFullAppPath, '\\'); - *pLastBackslash = '\0'; // terminate the string + /* Set this up next. Do this early, since it's needed for RageException::Throw. */ + LOG = new RageLog(); - /* If "Program" is the top-level directory, strip it off. */ - pLastBackslash = strrchr( szFullAppPath, '\\' ); - if( pLastBackslash && !stricmp(pLastBackslash, "\\Program") ) - *pLastBackslash = '\0'; - SetCurrentDirectory(szFullAppPath); - - if( DoesFileExist("Songs") ) // this is a SM or DWI program directory + if( DoesFileExist("Songs") ) // this is a SM program directory { // make sure it's in the list of install directories TCHAR szCurrentDirectory[MAX_PATH]; diff --git a/stepmania/src/smpackage/smpackage.rc b/stepmania/src/smpackage/smpackage.rc index 783e65f926..76c52ca2e2 100644 --- a/stepmania/src/smpackage/smpackage.rc +++ b/stepmania/src/smpackage/smpackage.rc @@ -155,23 +155,23 @@ BEGIN IDC_STATIC,18,144,196,17 END -IDD_MENU DIALOGEX 0, 0, 332, 310 +IDD_MENU DIALOGEX 0, 0, 334, 303 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,289,50,14 + DEFPUSHBUTTON "Exit",IDOK,277,282,50,14 CONTROL 140,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38 - GROUPBOX "Installation",IDC_STATIC,7,41,318,28 + GROUPBOX "Installation",IDC_STATIC,7,41,320,28 PUSHBUTTON "Edit Installations",IDC_EDIT_INSTALLATIONS,241,49,75,15 - GROUPBOX "Create and Share",IDC_STATIC,7,198,318,86 - PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,15,213,75,15 + GROUPBOX "Create and Share",IDC_STATIC,7,219,320,57 + PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,15,234,75,15 LTEXT "Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more.", - IDC_STATIC,104,212,215,18 - PUSHBUTTON "Create Song",IDC_CREATE_SONG,15,260,75,15 - LTEXT "Choose this option to create a new song in StepMania from your favorite mp3 or ogg music file.", - IDC_STATIC,103,259,215,20 - GROUPBOX "Game Settings",IDC_STATIC,7,109,318,87 + IDC_STATIC,104,233,215,18 + PUSHBUTTON "Create Song",IDC_CREATE_SONG,15,255,75,15 + LTEXT "Create a new song in StepMania from your favorite mp3 or ogg music file.", + IDC_STATIC,103,254,215,20 + GROUPBOX "Troubleshooting",IDC_STATIC,7,109,320,109 PUSHBUTTON "Change Preferences",IDC_CHANGE_PREFERENCES,16,120,75,15 PUSHBUTTON "Open Preferences",IDC_OPEN_PREFERENCES,16,152,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.", @@ -182,11 +182,14 @@ BEGIN ES_READONLY LTEXT "Erase all of your keyboard and joystick mappings if you've made a mistake.", IDC_STATIC,104,174,214,18 - PUSHBUTTON "Launch Game",IDC_BUTTON_LAUNCH_GAME,189,289,70,14 + PUSHBUTTON "Launch Game",IDC_BUTTON_LAUNCH_GAME,189,282,70,14 PUSHBUTTON "View Statistics",IDC_VIEW_STATISTICS,16,85,75,15 - LTEXT "View high scores and usage statistics and other saved from your play.", + LTEXT "View high scores and usage statistics and other data saved from your play.", IDC_STATIC,103,84,215,20 - GROUPBOX "Statistics",IDC_STATIC,7,72,318,35 + GROUPBOX "Statistics",IDC_STATIC,7,72,320,35 + PUSHBUTTON "Clear Cache",IDC_CLEAR_CACHE,16,196,75,15 + LTEXT "Erase the song and course cache. Use this if you change a song file and the change isn't showing in-game.", + IDC_STATIC,104,196,214,18 END IDD_ENTER_COMMENT DIALOGEX 0, 0, 312, 202 @@ -350,9 +353,9 @@ BEGIN IDD_MENU, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 325 + RIGHTMARGIN, 327 TOPMARGIN, 7 - BOTTOMMARGIN, 303 + BOTTOMMARGIN, 296 END IDD_ENTER_COMMENT, DIALOG diff --git a/stepmania/src/smpackage/smpackageUtil.h b/stepmania/src/smpackage/smpackageUtil.h index b065f9eda9..f9f4bafd2d 100644 --- a/stepmania/src/smpackage/smpackageUtil.h +++ b/stepmania/src/smpackage/smpackageUtil.h @@ -15,7 +15,7 @@ namespace SMPackageUtil RString GetPackageDirectory(RString path); bool IsValidPackageDirectory(RString path); - void LaunchGame(); + bool LaunchGame(); } #endif