eliminate duped code in smpackage
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
// ChangeGameSettings.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "ChangeGameSettings.h"
|
||||
#include "IniFile.h"
|
||||
#include "SMPackageUtil.h"
|
||||
#include "SpecialFiles.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -51,10 +54,9 @@ BOOL ChangeGameSettings::OnInitDialog()
|
||||
// Fill the radio buttons
|
||||
//
|
||||
IniFile ini;
|
||||
ini.SetPath( PREFERENCES_INI );
|
||||
ini.ReadFile();
|
||||
ini.ReadFile( SpecialFiles::PREFERENCES_INI_PATH );
|
||||
|
||||
CString sValue;
|
||||
RString sValue;
|
||||
|
||||
|
||||
sValue = "";
|
||||
@@ -102,35 +104,34 @@ void ChangeGameSettings::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
IniFile ini;
|
||||
ini.SetPath( PREFERENCES_INI );
|
||||
ini.ReadFile();
|
||||
|
||||
ini.ReadFile( SpecialFiles::PREFERENCES_INI_PATH );
|
||||
|
||||
|
||||
if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_OPENGL) )
|
||||
ini.SetValue( "Options", "VideoRenderers", "opengl" );
|
||||
ini.SetValue( "Options", "VideoRenderers", (RString)"opengl" );
|
||||
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_DIRECT3D) )
|
||||
ini.SetValue( "Options", "VideoRenderers", "d3d" );
|
||||
ini.SetValue( "Options", "VideoRenderers", (RString)"d3d" );
|
||||
else
|
||||
ini.SetValue( "Options", "VideoRenderers", "" );
|
||||
ini.SetValue( "Options", "VideoRenderers", RString() );
|
||||
|
||||
|
||||
if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_DIRECTSOUND_HARDWARE) )
|
||||
ini.SetValue( "Options", "SoundDrivers", "DirectSound" );
|
||||
ini.SetValue( "Options", "SoundDrivers", (RString)"DirectSound" );
|
||||
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_DIRECTSOUND_SOFTWARE) )
|
||||
ini.SetValue( "Options", "SoundDrivers", "DirectSound-sw" );
|
||||
ini.SetValue( "Options", "SoundDrivers", (RString)"DirectSound-sw" );
|
||||
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_WAVEOUT) )
|
||||
ini.SetValue( "Options", "SoundDrivers", "WaveOut" );
|
||||
ini.SetValue( "Options", "SoundDrivers", (RString)"WaveOut" );
|
||||
else if( BST_CHECKED == IsDlgButtonChecked(IDC_RADIO_SOUND_NULL) )
|
||||
ini.SetValue( "Options", "SoundDrivers", "null" );
|
||||
ini.SetValue( "Options", "SoundDrivers", (RString)"null" );
|
||||
else
|
||||
ini.SetValue( "Options", "SoundDrivers", "" );
|
||||
ini.SetValue( "Options", "SoundDrivers", RString() );
|
||||
|
||||
|
||||
ini.SetValue( "Options", "LogToDisk", BST_CHECKED == IsDlgButtonChecked(IDC_CHECK_LOG_TO_DISK) );
|
||||
ini.SetValue( "Options", "ShowLogWindow", BST_CHECKED == IsDlgButtonChecked(IDC_CHECK_SHOW_LOG_WINDOW) );
|
||||
|
||||
|
||||
ini.WriteFile();
|
||||
ini.WriteFile( SpecialFiles::PREFERENCES_INI_PATH );
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// EditInsallations.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "EditInsallations.h"
|
||||
@@ -53,10 +55,10 @@ BOOL EditInsallations::OnInitDialog()
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
|
||||
CStringArray asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
m_list.AddString( asInstallDirs[i] );
|
||||
vector<RString> vs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( vs );
|
||||
for( unsigned i=0; i<vs.size(); i++ )
|
||||
m_list.AddString( vs[i] );
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
@@ -114,13 +116,14 @@ void EditInsallations::OnButtonAdd()
|
||||
|
||||
void EditInsallations::OnOK()
|
||||
{
|
||||
m_asReturnedInstallDirs.clear();
|
||||
m_vsReturnedInstallDirs.clear();
|
||||
|
||||
for( int i=0; i<m_list.GetCount(); i++ )
|
||||
{
|
||||
CString sDir;
|
||||
m_list.GetText( i, sDir );
|
||||
m_asReturnedInstallDirs.push_back( sDir );
|
||||
RString s = sDir;
|
||||
m_vsReturnedInstallDirs.push_back( s );
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
|
||||
@@ -16,7 +16,7 @@ class EditInsallations : public CDialog
|
||||
public:
|
||||
EditInsallations(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
CStringArray m_asReturnedInstallDirs;
|
||||
vector<RString> m_vsReturnedInstallDirs;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(EditInsallations)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// EnterComment.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "EnterComment.h"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// EnterName.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "EnterName.h"
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
// MainMenuDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "MainMenuDlg.h"
|
||||
#include "EditInsallations.h"
|
||||
#include "SmpackageExportDlg.h"
|
||||
#include "onvertThemeDlg.h"
|
||||
#include "ChangeGameSettings.h"
|
||||
#include "RageUtil.h"
|
||||
#include "SMPackageUtil.h"
|
||||
#include ".\mainmenudlg.h"
|
||||
#include "mainmenudlg.h"
|
||||
#include "archutils/Win32/SpecialDirs.h"
|
||||
#include "SpecialFiles.h"
|
||||
#include "ProductInfo.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -44,7 +48,6 @@ BEGIN_MESSAGE_MAP(MainMenuDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(MainMenuDlg)
|
||||
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_CREATE_SONG, OnCreateSong)
|
||||
ON_BN_CLICKED(IDC_CLEAR_KEYMAPS, OnBnClickedClearKeymaps)
|
||||
ON_BN_CLICKED(IDC_CHANGE_PREFERENCES, OnBnClickedChangePreferences)
|
||||
@@ -52,6 +55,7 @@ BEGIN_MESSAGE_MAP(MainMenuDlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_CLEAR_PREFERENCES, OnBnClickedClearPreferences)
|
||||
//}}AFX_MSG_MAP
|
||||
ON_BN_CLICKED(IDC_BUTTON_LAUNCH_GAME, OnBnClickedButtonLaunchGame)
|
||||
ON_BN_CLICKED(IDC_VIEW_STATISTICS, OnBnClickedViewStatistics)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -72,14 +76,7 @@ void MainMenuDlg::OnEditInstallations()
|
||||
int nResponse = dlg.DoModal();
|
||||
}
|
||||
|
||||
void MainMenuDlg::OnAnalyzeElements()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
ConvertThemeDlg dlg;
|
||||
int nResponse = dlg.DoModal();
|
||||
}
|
||||
|
||||
CString GetLastErrorString()
|
||||
RString GetLastErrorString()
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
FormatMessage(
|
||||
@@ -96,7 +93,7 @@ CString GetLastErrorString()
|
||||
// Process any inserts in lpMsgBuf.
|
||||
// ...
|
||||
// Display the string.
|
||||
CString s = (LPCTSTR)lpMsgBuf;
|
||||
RString s = (LPCTSTR)lpMsgBuf;
|
||||
// Free the buffer.
|
||||
LocalFree( lpMsgBuf );
|
||||
|
||||
@@ -114,21 +111,13 @@ void MainMenuDlg::OnCreateSong()
|
||||
"Music file (*.mp3;*.ogg)|*.mp3;*.ogg|||"
|
||||
);
|
||||
int iRet = dialog.DoModal();
|
||||
CString sMusicFile = dialog.GetPathName();
|
||||
RString sMusicFile = dialog.GetPathName();
|
||||
if( iRet != IDOK )
|
||||
return;
|
||||
|
||||
CString sFileNameNoExt, sExt, sThrowAway;
|
||||
splitrelpath(
|
||||
sMusicFile,
|
||||
sThrowAway,
|
||||
sFileNameNoExt,
|
||||
sExt
|
||||
);
|
||||
|
||||
BOOL bSuccess;
|
||||
|
||||
CString sSongDirectory = "Songs\\My Creations\\";
|
||||
RString sSongDirectory = "Songs\\My Creations\\";
|
||||
bSuccess = CreateDirectory( sSongDirectory, NULL );
|
||||
if( !bSuccess )
|
||||
{
|
||||
@@ -144,7 +133,7 @@ void MainMenuDlg::OnCreateSong()
|
||||
}
|
||||
}
|
||||
|
||||
sSongDirectory += sFileNameNoExt;
|
||||
sSongDirectory += Basename( sMusicFile );
|
||||
bSuccess = CreateDirectory( sSongDirectory, NULL ); // CreateDirectory doesn't like a trailing slash
|
||||
if( !bSuccess )
|
||||
{
|
||||
@@ -153,7 +142,7 @@ void MainMenuDlg::OnCreateSong()
|
||||
}
|
||||
sSongDirectory += "\\";
|
||||
|
||||
CString sNewMusicFile = sSongDirectory + sFileNameNoExt + "." + sExt;
|
||||
RString sNewMusicFile = sSongDirectory + Basename(sMusicFile);
|
||||
bSuccess = CopyFile( sMusicFile, sNewMusicFile, TRUE );
|
||||
if( !bSuccess )
|
||||
{
|
||||
@@ -162,7 +151,8 @@ void MainMenuDlg::OnCreateSong()
|
||||
}
|
||||
|
||||
// create a blank .sm file
|
||||
CString sNewSongFile = sSongDirectory + sFileNameNoExt + ".sm";
|
||||
RString sNewSongFile = sMusicFile;
|
||||
SetExtension( sNewSongFile, "sm" );
|
||||
FILE *fp = fopen( sNewSongFile, "w" );
|
||||
if( fp == NULL )
|
||||
{
|
||||
@@ -182,8 +172,8 @@ BOOL MainMenuDlg::OnInitDialog()
|
||||
TCHAR szCurDir[MAX_PATH];
|
||||
GetCurrentDirectory( ARRAYSIZE(szCurDir), szCurDir );
|
||||
GetDlgItem( IDC_EDIT_INSTALLATION )->SetWindowText( szCurDir );
|
||||
AddStepManiaInstallDir( szCurDir );
|
||||
SetDefaultInstallDir( szCurDir );
|
||||
SMPackageUtil::AddStepManiaInstallDir( szCurDir );
|
||||
SMPackageUtil::SetDefaultInstallDir( szCurDir );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
@@ -193,14 +183,14 @@ void MainMenuDlg::OnBnClickedClearKeymaps()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
if( !DoesFileExist( KEYMAPS_INI ) )
|
||||
if( !DoesFileExist( SpecialFiles::KEYMAPS_PATH ) )
|
||||
{
|
||||
MessageBox( KEYMAPS_INI + " is already cleared." );
|
||||
MessageBox( SpecialFiles::KEYMAPS_PATH + " is already cleared." );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !DeleteFile( KEYMAPS_INI ) )
|
||||
MessageBox( "Failed to delete file " + KEYMAPS_INI + "." );
|
||||
if( !DeleteFile( SpecialFiles::KEYMAPS_PATH ) )
|
||||
MessageBox( "Failed to delete file " + SpecialFiles::KEYMAPS_PATH + "." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,38 +204,47 @@ void MainMenuDlg::OnBnClickedChangePreferences()
|
||||
void MainMenuDlg::OnBnClickedOpenPreferences()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
if( !DoesFileExist( PREFERENCES_INI ) )
|
||||
if( !DoesFileExist( SpecialFiles::PREFERENCES_INI_PATH ) )
|
||||
{
|
||||
MessageBox( PREFERENCES_INI + " doesn't exist. It will be created next time you start the game." );
|
||||
MessageBox( SpecialFiles::PREFERENCES_INI_PATH + " 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() );
|
||||
if( NULL == ::ShellExecute( this->m_hWnd, "open", SpecialFiles::PREFERENCES_INI_PATH, "", "", SW_SHOWNORMAL ) )
|
||||
MessageBox( "Failed to open " + SpecialFiles::PREFERENCES_INI_PATH + ": " + GetLastErrorString() );
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenuDlg::OnBnClickedClearPreferences()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
if( !DoesFileExist( PREFERENCES_INI ) )
|
||||
if( !DoesFileExist( SpecialFiles::PREFERENCES_INI_PATH ) )
|
||||
{
|
||||
MessageBox( PREFERENCES_INI + " is already cleared." );
|
||||
MessageBox( SpecialFiles::PREFERENCES_INI_PATH + " is already cleared." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !DeleteFile( PREFERENCES_INI ) )
|
||||
if( !DeleteFile( SpecialFiles::PREFERENCES_INI_PATH ) )
|
||||
{
|
||||
MessageBox( "Failed to delete file " + PREFERENCES_INI + "." );
|
||||
MessageBox( "Failed to delete file " + SpecialFiles::PREFERENCES_INI_PATH + "." );
|
||||
return;
|
||||
}
|
||||
|
||||
MessageBox( PREFERENCES_INI + " cleared." );
|
||||
MessageBox( SpecialFiles::PREFERENCES_INI_PATH + " cleared." );
|
||||
}
|
||||
|
||||
void MainMenuDlg::OnBnClickedButtonLaunchGame()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
LaunchGame();
|
||||
SMPackageUtil::LaunchGame();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void MainMenuDlg::OnBnClickedViewStatistics()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
RString sPersonalDir = GetMyDocumentsDir();
|
||||
RString sFile = sPersonalDir + PRODUCT_ID +"/Save/MachineProfile/Stats.xml";
|
||||
if( NULL == ::ShellExecute( this->m_hWnd, "open", sFile, "", "", SW_SHOWNORMAL ) )
|
||||
MessageBox( "Failed to open '" + sFile + "': " + GetLastErrorString() );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ protected:
|
||||
//{{AFX_MSG(MainMenuDlg)
|
||||
afx_msg void OnExportPackages();
|
||||
afx_msg void OnEditInstallations();
|
||||
afx_msg void OnAnalyzeElements();
|
||||
afx_msg void OnChangeApi();
|
||||
afx_msg void OnCreateSong();
|
||||
virtual BOOL OnInitDialog();
|
||||
@@ -50,6 +49,7 @@ protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedButtonLaunchGame();
|
||||
afx_msg void OnBnClickedViewStatistics();
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SMPackageInstallDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "SMPackageInstallDlg.h"
|
||||
@@ -11,6 +13,8 @@
|
||||
#include "IniFile.h"
|
||||
#include "UninstallOld.h"
|
||||
#include <algorithm>
|
||||
#include "RageFileManager.h"
|
||||
#include "RageFileDriverZip.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -18,6 +22,8 @@
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
static const RString TEMP_MOUNT_POINT = "/@package/";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSMPackageInstallDlg dialog
|
||||
|
||||
@@ -56,7 +62,7 @@ END_MESSAGE_MAP()
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSMPackageInstallDlg message handlers
|
||||
|
||||
static bool CompareStringNoCase( const CString &s1, const CString &s2 )
|
||||
static bool CompareStringNoCase( const RString &s1, const RString &s2 )
|
||||
{
|
||||
return s1.CompareNoCase( s2 ) < 0;
|
||||
}
|
||||
@@ -72,12 +78,17 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
int i;
|
||||
// mount the zip
|
||||
if( !FILEMAN->Mount( "zip", m_sPackagePath, TEMP_MOUNT_POINT ) )
|
||||
{
|
||||
AfxMessageBox( ssprintf("'%s' is not a valid zip archive.", m_sPackagePath), MB_ICONSTOP );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
//
|
||||
// Set the text of the first Edit box
|
||||
//
|
||||
CString sMessage1 = ssprintf(
|
||||
RString sMessage1 = ssprintf(
|
||||
"You have chosen to install the Stepmania package:\r\n"
|
||||
"\r\n"
|
||||
"\t%s\r\n"
|
||||
@@ -92,35 +103,11 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
//
|
||||
// Set the text of the second Edit box
|
||||
//
|
||||
try
|
||||
{
|
||||
m_zip.Open( m_sPackagePath, CZipArchive::zipOpenReadOnly );
|
||||
}
|
||||
catch (CException* e)
|
||||
{
|
||||
AfxMessageBox( ssprintf("'%s' is not a valid zip archive.", m_sPackagePath), MB_ICONSTOP );
|
||||
e->Delete();
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
{
|
||||
vector<CString> vs;
|
||||
for( i=0; i<m_zip.GetCount(); i++ )
|
||||
{
|
||||
CZipFileHeader fh;
|
||||
m_zip.GetFileInfo(fh, (WORD)i);
|
||||
|
||||
if( fh.IsDirectory() )
|
||||
continue;
|
||||
if( !fh.GetFileName().CompareNoCase( "smzip.ctl" ) )
|
||||
continue;
|
||||
vs.push_back( fh.GetFileName() );
|
||||
}
|
||||
|
||||
sort( vs.begin(), vs.end(), CompareStringNoCase );
|
||||
|
||||
vector<RString> vs;
|
||||
GetDirListingRecursive( TEMP_MOUNT_POINT, "*.*", vs );
|
||||
CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE2);
|
||||
CString sText = "\t" + join( "\r\n\t", vs );
|
||||
RString sText = "\t" + join( "\r\n\t", vs );
|
||||
pEdit2->SetWindowText( sText );
|
||||
}
|
||||
|
||||
@@ -128,7 +115,7 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
//
|
||||
// Set the text of the third Edit box
|
||||
//
|
||||
CString sMessage3 = "The package will be installed in the following Stepmania program folder:\r\n";
|
||||
RString sMessage3 = "The package will be installed in the following Stepmania program folder:\r\n";
|
||||
|
||||
// Set the message
|
||||
CEdit* pEdit3 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE3);
|
||||
@@ -174,42 +161,30 @@ void CSMPackageInstallDlg::OnPaint()
|
||||
|
||||
bool CSMPackageInstallDlg::CheckPackages()
|
||||
{
|
||||
CZipWordArray ar;
|
||||
m_zip.FindMatches("smzip.ctl", ar);
|
||||
if( ar.GetSize() != 1 )
|
||||
IniFile ini;
|
||||
if( !ini.ReadFile(TEMP_MOUNT_POINT + "smzip.ctl") )
|
||||
return true;
|
||||
|
||||
CZipMemFile control;
|
||||
m_zip.ExtractFile( ar[0], control );
|
||||
|
||||
char *buf = new char[control.GetLength()];
|
||||
control.Seek( 0, CZipAbstractFile::begin );
|
||||
control.Read(buf, control.GetLength());
|
||||
IniFile ini;
|
||||
ini.ReadBuf( CString(buf, control.GetLength()) );
|
||||
delete[] buf;
|
||||
|
||||
int version = 0;
|
||||
ini.GetValueI( "SMZIP", "Version", version );
|
||||
ini.GetValue( "SMZIP", "Version", version );
|
||||
if( version != 1 )
|
||||
return true;
|
||||
|
||||
int cnt = 0;
|
||||
ini.GetValueI( "Packages", "NumPackages", cnt );
|
||||
ini.GetValue( "Packages", "NumPackages", cnt );
|
||||
|
||||
int i;
|
||||
CStringArray Directories;
|
||||
for( i = 0; i < cnt; ++i )
|
||||
vector<RString> Directories;
|
||||
for( int i = 0; i < cnt; ++i )
|
||||
{
|
||||
CString path;
|
||||
RString path;
|
||||
if( !ini.GetValue( "Packages", ssprintf("%i", i), path) )
|
||||
continue;
|
||||
|
||||
/* Does this directory exist? */
|
||||
if( !IsADirectory(path) )
|
||||
if( !FILEMAN->IsADirectory(path) )
|
||||
continue;
|
||||
|
||||
if( !IsValidPackageDirectory(path) )
|
||||
if( !SMPackageUtil::IsValidPackageDirectory(path) )
|
||||
continue;
|
||||
|
||||
Directories.push_back(path);
|
||||
@@ -230,13 +205,13 @@ bool CSMPackageInstallDlg::CheckPackages()
|
||||
|
||||
char cwd_[MAX_PATH];
|
||||
_getcwd(cwd_, MAX_PATH);
|
||||
CString cwd(cwd_);
|
||||
RString cwd(cwd_);
|
||||
if( cwd[cwd.GetLength()-1] != '\\' )
|
||||
cwd += "\\";
|
||||
|
||||
for( i = 0; i < (int) Directories.size(); ++i )
|
||||
{
|
||||
CString path = cwd+Directories[i];
|
||||
RString path = cwd+Directories[i];
|
||||
char buf[1024];
|
||||
memcpy(buf, path, path.GetLength()+1);
|
||||
buf[path.GetLength()+1] = 0;
|
||||
@@ -267,8 +242,12 @@ void CSMPackageInstallDlg::OnOK()
|
||||
m_comboDir.EnableWindow( FALSE );
|
||||
m_buttonEdit.EnableWindow( FALSE );
|
||||
|
||||
CString sInstallDir;
|
||||
m_comboDir.GetWindowText( sInstallDir );
|
||||
RString sInstallDir;
|
||||
{
|
||||
CString s;
|
||||
m_comboDir.GetWindowText( s );
|
||||
sInstallDir = s;
|
||||
}
|
||||
|
||||
int iSelectedInstallDirIndex = m_comboDir.GetCurSel();
|
||||
if( iSelectedInstallDirIndex == -1 )
|
||||
@@ -277,20 +256,24 @@ void CSMPackageInstallDlg::OnOK()
|
||||
return;
|
||||
}
|
||||
|
||||
SetDefaultInstallDir( iSelectedInstallDirIndex );
|
||||
SMPackageUtil::SetDefaultInstallDir( iSelectedInstallDirIndex );
|
||||
|
||||
// Show comment (if any)
|
||||
CString sComment = m_zip.GetGlobalComment();
|
||||
bool DontShowComment;
|
||||
if( sComment != "" && (!GetPref("DontShowComment", DontShowComment) || !DontShowComment) )
|
||||
{
|
||||
ShowComment commentDlg;
|
||||
commentDlg.m_sComment = sComment;
|
||||
int nResponse = commentDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
return; // cancelled
|
||||
if( commentDlg.m_bDontShow )
|
||||
SetPref( "DontShowComment", true );
|
||||
RageFileDriverZip zip;
|
||||
zip.Load( m_sPackagePath );
|
||||
RString sComment = zip.GetGlobalComment();
|
||||
bool DontShowComment;
|
||||
if( sComment != "" && (!SMPackageUtil::GetPref("DontShowComment", DontShowComment) || !DontShowComment) )
|
||||
{
|
||||
ShowComment commentDlg;
|
||||
commentDlg.m_sComment = sComment;
|
||||
int nResponse = commentDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
return; // cancelled
|
||||
if( commentDlg.m_bDontShow )
|
||||
SMPackageUtil::SetPref( "DontShowComment", true );
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for installed packages that should be deleted before installing. */
|
||||
@@ -299,7 +282,9 @@ void CSMPackageInstallDlg::OnOK()
|
||||
|
||||
|
||||
// Unzip the SMzip package into the Stepmania installation folder
|
||||
for( int i=0; i<m_zip.GetCount(); i++ )
|
||||
vector<RString> vs;
|
||||
GetDirListingRecursive( TEMP_MOUNT_POINT, "*.*", vs );
|
||||
for( unsigned i=0; i<vs.size(); i++ )
|
||||
{
|
||||
// Throw some text up so the user has something to look at during the long pause.
|
||||
CEdit* pEdit1 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE1);
|
||||
@@ -312,12 +297,12 @@ void CSMPackageInstallDlg::OnOK()
|
||||
//Show the hided progress bar
|
||||
if(!pProgress1->IsWindowVisible())
|
||||
{
|
||||
pProgress1->ShowWindow(SW_SHOWNORMAL);
|
||||
pProgress1->ShowWindow(SW_SHOWNORMAL);
|
||||
}
|
||||
//Initialize the progress bar and update the window 1 time (it's enough)
|
||||
if(!ProgressInit)
|
||||
{
|
||||
pProgress1->SetRange( 0, m_zip.GetCount());
|
||||
pProgress1->SetRange( 0, vs.size() );
|
||||
pProgress1->SetStep(1);
|
||||
pProgress1->SetPos(0);
|
||||
SendMessage( WM_PAINT );
|
||||
@@ -328,28 +313,18 @@ void CSMPackageInstallDlg::OnOK()
|
||||
retry_unzip:
|
||||
|
||||
// Extract the files
|
||||
try
|
||||
{
|
||||
// skip extracting "thumbs.db" files
|
||||
CZipFileHeader fhInfo;
|
||||
if( m_zip.GetFileInfo(fhInfo, (WORD)i) )
|
||||
{
|
||||
CString sFileName = fhInfo.GetFileName();
|
||||
sFileName.MakeLower();
|
||||
if( sFileName.Find("thumbs.db") != -1 )
|
||||
continue; // skip to next file
|
||||
}
|
||||
const RString sFile = vs[i];
|
||||
// skip extracting "thumbs.db" files
|
||||
if( Basename(sFile).CompareNoCase("thumbs.db") == 0 )
|
||||
continue;
|
||||
|
||||
m_zip.ExtractFile( (WORD)i, sInstallDir, true ); // extract file to current directory
|
||||
pProgress1->StepIt(); //increase the progress bar of 1 step
|
||||
}
|
||||
catch (CException* e)
|
||||
RString sBareFile = sFile;
|
||||
sBareFile.erase( sBareFile.begin(), sBareFile.begin()+TEMP_MOUNT_POINT.length() );
|
||||
RString sTo = sInstallDir + sTo;
|
||||
if( !FileCopy( sFile, sTo ) )
|
||||
{
|
||||
char szError[4096];
|
||||
e->GetErrorMessage( szError, sizeof(szError) );
|
||||
e->Delete();
|
||||
|
||||
switch( MessageBox( szError, "Error Extracting File", MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION ) )
|
||||
RString sError = ssprintf( "Error copying file '%s'", sBareFile.c_str() );
|
||||
switch( MessageBox( sError, "Error Extracting File", MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION ) )
|
||||
{
|
||||
case IDABORT:
|
||||
exit(1);
|
||||
@@ -362,6 +337,8 @@ retry_unzip:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pProgress1->StepIt(); //increase the progress bar of 1 step
|
||||
}
|
||||
|
||||
AfxMessageBox( "Package installed successfully!" );
|
||||
@@ -378,7 +355,7 @@ void CSMPackageInstallDlg::OnButtonEdit()
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
WriteStepManiaInstallDirs( dlg.m_asReturnedInstallDirs );
|
||||
SMPackageUtil::WriteStepManiaInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
RefreshInstallationList();
|
||||
}
|
||||
}
|
||||
@@ -388,8 +365,8 @@ void CSMPackageInstallDlg::RefreshInstallationList()
|
||||
{
|
||||
m_comboDir.ResetContent();
|
||||
|
||||
CStringArray asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
vector<RString> asInstallDirs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( asInstallDirs );
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
m_comboDir.AddString( asInstallDirs[i] );
|
||||
m_comboDir.SetCurSel( 0 ); // guaranteed to be at least one item
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSMPackageInstallDlg dialog
|
||||
|
||||
#include "ZipArchive\ZipArchive.h"
|
||||
|
||||
|
||||
class CSMPackageInstallDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
@@ -40,8 +37,7 @@ protected:
|
||||
bool CheckPackages();
|
||||
|
||||
HICON m_hIcon;
|
||||
CString m_sPackagePath;
|
||||
CZipArchive m_zip;
|
||||
RString m_sPackagePath;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSMPackageInstallDlg)
|
||||
|
||||
@@ -1,49 +1,50 @@
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "SMPackageUtil.h"
|
||||
#include "Registry.h"
|
||||
#include "../ProductInfo.h"
|
||||
#include "archutils/Win32/RegistryAccess.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
void WriteStepManiaInstallDirs( const CStringArray& asInstallDirsToWrite )
|
||||
void SMPackageUtil::WriteStepManiaInstallDirs( const vector<RString>& asInstallDirsToWrite )
|
||||
{
|
||||
CRegistry Reg;
|
||||
Reg.SetRootKey(HKEY_LOCAL_MACHINE);
|
||||
Reg.SetKey("Software\\StepMania\\smpackage\\Installations", TRUE); // create if not already present
|
||||
RString sKey = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage\\Installations";
|
||||
|
||||
unsigned i;
|
||||
|
||||
for( i=0; i<100; i++ )
|
||||
{
|
||||
CString sName = ssprintf("%d",i);
|
||||
RString sName = ssprintf("%d",i);
|
||||
// Reg.DeleteKey( sName ); // delete key is broken in this library, so just write over it with ""
|
||||
Reg.WriteString( sName, "" );
|
||||
RegistryAccess::SetRegValue( sKey, sName, RString() );
|
||||
}
|
||||
|
||||
for( i=0; i<asInstallDirsToWrite.size(); i++ )
|
||||
{
|
||||
CString sName = ssprintf("%d",i);
|
||||
Reg.WriteString( sName, asInstallDirsToWrite[i] );
|
||||
RString sName = ssprintf("%d",i);
|
||||
RegistryAccess::SetRegValue( sKey, sName, asInstallDirsToWrite[i] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut )
|
||||
void SMPackageUtil::GetStepManiaInstallDirs( vector<RString>& asInstallDirsOut )
|
||||
{
|
||||
asInstallDirsOut.clear();
|
||||
|
||||
CRegistry Reg;
|
||||
Reg.SetRootKey(HKEY_LOCAL_MACHINE);
|
||||
Reg.SetKey("Software\\StepMania\\smpackage\\Installations", TRUE); // create if not already present
|
||||
RString sKey = "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage\\Installations";
|
||||
|
||||
for( int i=0; i<100; i++ )
|
||||
{
|
||||
CString sName = ssprintf("%d",i);
|
||||
RString sName = ssprintf("%d",i);
|
||||
|
||||
CString sPath = Reg.ReadString( sName, "" );
|
||||
RString sPath;
|
||||
if( !RegistryAccess::GetRegValue(sKey, sName, sPath) )
|
||||
continue;
|
||||
|
||||
if( sPath == "" ) // read failed
|
||||
continue; // skip
|
||||
|
||||
CString sProgramDir = sPath+"\\Program";
|
||||
RString sProgramDir = sPath+"\\Program";
|
||||
if( !DoesFileExist(sProgramDir) )
|
||||
continue; // skip
|
||||
|
||||
@@ -54,9 +55,9 @@ void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut )
|
||||
WriteStepManiaInstallDirs( asInstallDirsOut );
|
||||
}
|
||||
|
||||
void AddStepManiaInstallDir( CString sNewInstallDir )
|
||||
void SMPackageUtil::AddStepManiaInstallDir( RString sNewInstallDir )
|
||||
{
|
||||
CStringArray asInstallDirs;
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
|
||||
bool bAlreadyInList = false;
|
||||
@@ -75,24 +76,23 @@ void AddStepManiaInstallDir( CString sNewInstallDir )
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
void SetDefaultInstallDir( int iInstallDirIndex )
|
||||
void SMPackageUtil::SetDefaultInstallDir( int iInstallDirIndex )
|
||||
{
|
||||
// move the specified index to the top of the list
|
||||
CStringArray asInstallDirs;
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
ASSERT( iInstallDirIndex >= 0 && iInstallDirIndex < asInstallDirs.size() );
|
||||
CString sDefaultInstallDir = asInstallDirs[iInstallDirIndex];
|
||||
ASSERT( iInstallDirIndex >= 0 && iInstallDirIndex < (int)asInstallDirs.size() );
|
||||
RString sDefaultInstallDir = asInstallDirs[iInstallDirIndex];
|
||||
asInstallDirs.erase( asInstallDirs.begin()+iInstallDirIndex );
|
||||
asInstallDirs.insert( asInstallDirs.begin(), sDefaultInstallDir );
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
void SetDefaultInstallDir( CString sInstallDir )
|
||||
void SMPackageUtil::SetDefaultInstallDir( RString sInstallDir )
|
||||
{
|
||||
CStringArray asInstallDirs;
|
||||
vector<RString> asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
|
||||
bool bAlreadyInList = false;
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
{
|
||||
if( asInstallDirs[i].CompareNoCase(sInstallDir) == 0 )
|
||||
@@ -103,32 +103,24 @@ void SetDefaultInstallDir( CString sInstallDir )
|
||||
}
|
||||
}
|
||||
|
||||
bool GetPref( CString name, bool &val )
|
||||
bool SMPackageUtil::GetPref( RString name, bool &val )
|
||||
{
|
||||
CRegistry Reg;
|
||||
Reg.SetRootKey(HKEY_LOCAL_MACHINE);
|
||||
Reg.SetKey("Software\\StepMania\\smpackage", FALSE); // don't create if not already present
|
||||
return Reg.Read( name, val );
|
||||
return RegistryAccess::GetRegValue( "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage", name, val );
|
||||
}
|
||||
|
||||
bool SetPref( CString name, bool val )
|
||||
bool SMPackageUtil::SetPref( RString name, bool val )
|
||||
{
|
||||
CRegistry Reg;
|
||||
Reg.SetRootKey(HKEY_LOCAL_MACHINE);
|
||||
Reg.SetKey("Software\\StepMania\\smpackage", TRUE); // don't create if not already present
|
||||
Reg.WriteBool( name, val );
|
||||
return false;
|
||||
|
||||
return RegistryAccess::SetRegValue( "HKEY_LOCAL_MACHINE\\Software\\StepMania\\smpackage", name, val );
|
||||
}
|
||||
|
||||
/* Get a package directory. For most paths, this is the first two components. For
|
||||
* songs and note skins, this is the first three. */
|
||||
CString GetPackageDirectory(CString path)
|
||||
RString SMPackageUtil::GetPackageDirectory(RString path)
|
||||
{
|
||||
if( path.Find("CVS") != -1 )
|
||||
return ""; // skip
|
||||
|
||||
CStringArray Parts;
|
||||
vector<RString> Parts;
|
||||
split( path, "\\", Parts );
|
||||
|
||||
unsigned NumParts = 2;
|
||||
@@ -139,18 +131,17 @@ CString GetPackageDirectory(CString path)
|
||||
|
||||
Parts.erase(Parts.begin() + NumParts, Parts.end());
|
||||
|
||||
CString ret = join( "\\", Parts );
|
||||
RString ret = join( "\\", Parts );
|
||||
if( !IsADirectory(ret) )
|
||||
return "";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool IsValidPackageDirectory(CString path)
|
||||
bool SMPackageUtil::IsValidPackageDirectory( RString path )
|
||||
{
|
||||
/* Make sure the path contains only second-level directories, and doesn't
|
||||
* contain any ".", "..", "...", etc. dirs. */
|
||||
CStringArray Parts;
|
||||
vector<RString> Parts;
|
||||
split( path, "\\", Parts, true );
|
||||
if( Parts.size() == 0 )
|
||||
return false;
|
||||
@@ -170,13 +161,13 @@ bool IsValidPackageDirectory(CString path)
|
||||
return true;
|
||||
}
|
||||
|
||||
void LaunchGame()
|
||||
void SMPackageUtil::LaunchGame()
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
|
||||
CString sFile = PRODUCT_NAME ".exe";
|
||||
RString sFile = PRODUCT_NAME ".exe";
|
||||
if( !DoesFileExist(sFile) )
|
||||
{
|
||||
sFile = "Program\\" + sFile;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// ShowComment.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "ShowComment.h"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SmpackageExportDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "SmpackageExportDlg.h"
|
||||
@@ -11,6 +13,7 @@
|
||||
#include "smpackageUtil.h"
|
||||
#include "EditInsallations.h"
|
||||
#include "IniFile.h"
|
||||
#include "RageFileDriverMemory.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
@@ -76,9 +79,9 @@ BOOL CSmpackageExportDlg::OnInitDialog()
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
CString ReplaceInvalidFileNameChars( CString sOldFileName )
|
||||
RString ReplaceInvalidFileNameChars( RString sOldFileName )
|
||||
{
|
||||
CString sNewFileName = sOldFileName;
|
||||
RString sNewFileName = sOldFileName;
|
||||
const char charsToReplace[] = {
|
||||
' ', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
|
||||
'+', '=', '[', ']', '{', '}', '|', ':', '\"', '\\',
|
||||
@@ -89,38 +92,7 @@ CString ReplaceInvalidFileNameChars( CString sOldFileName )
|
||||
return sNewFileName;
|
||||
}
|
||||
|
||||
void GetFilePaths( CString sDirOrFile, vector<CString> &asPathToFilesOut )
|
||||
{
|
||||
vector<CString> asDirectoriesToExplore;
|
||||
|
||||
// HACK:
|
||||
// Must use backslashes in the path, or else WinZip and WinRAR don't see the files.
|
||||
// Not sure if this is ZipArchive's fault.
|
||||
|
||||
if( IsADirectory(sDirOrFile) && sDirOrFile.Right(1) != "\\" )
|
||||
{
|
||||
sDirOrFile += "\\";
|
||||
sDirOrFile += "*.*";
|
||||
}
|
||||
|
||||
if( IsAFile(sDirOrFile) )
|
||||
{
|
||||
asPathToFilesOut.push_back( sDirOrFile );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GetDirListing( sDirOrFile, asPathToFilesOut, false, true );
|
||||
GetDirListing( sDirOrFile, asDirectoriesToExplore, true, true );
|
||||
while( asDirectoriesToExplore.size() > 0 )
|
||||
{
|
||||
GetDirListing( asDirectoriesToExplore[0] + "\\*.*", asPathToFilesOut, false, true );
|
||||
GetDirListing( asDirectoriesToExplore[0] + "\\*.*", asDirectoriesToExplore, true, true );
|
||||
asDirectoriesToExplore.erase( asDirectoriesToExplore.begin() );
|
||||
}
|
||||
}
|
||||
|
||||
CString GetDesktopPath()
|
||||
RString GetDesktopPath()
|
||||
{
|
||||
static TCHAR strNull[2] = _T("");
|
||||
static TCHAR strPath[MAX_PATH];
|
||||
@@ -145,14 +117,14 @@ CString GetDesktopPath()
|
||||
return strPath;
|
||||
}
|
||||
|
||||
bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExport, CString sComment )
|
||||
static bool ExportPackage( RString sPackageName, const vector<RString>& asDirectoriesToExport, RString sComment )
|
||||
{
|
||||
CZipArchive zip;
|
||||
|
||||
//
|
||||
// Create the package zip file
|
||||
//
|
||||
const CString sPackagePath = GetDesktopPath() + "\\" + sPackageName;
|
||||
const RString sPackagePath = GetDesktopPath() + "\\" + sPackageName;
|
||||
try
|
||||
{
|
||||
zip.Open( sPackagePath, CZipArchive::zipCreate );
|
||||
@@ -169,31 +141,35 @@ bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExp
|
||||
zip.SetGlobalComment( sComment );
|
||||
|
||||
/* Find files to add to zip. */
|
||||
unsigned i;
|
||||
vector<CString> asFilePaths;
|
||||
for( i=0; i<asDirectoriesToExport.size(); i++ )
|
||||
GetFilePaths( asDirectoriesToExport[i], asFilePaths );
|
||||
vector<RString> asFilePaths;
|
||||
for( unsigned i=0; i<asDirectoriesToExport.size(); i++ )
|
||||
GetDirListingRecursive( asDirectoriesToExport[i], "*.*", asFilePaths );
|
||||
|
||||
// Must use backslashes in the path, or else WinZip and WinRAR don't see the files.
|
||||
// Not sure if this is ZipArchive's fault.
|
||||
//;XXX
|
||||
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetValueI( "SMZIP", "Version", 1 );
|
||||
ini.SetValue( "SMZIP", "Version", 1 );
|
||||
|
||||
set<CString> Directories;
|
||||
set<RString> Directories;
|
||||
for( i=0; i<asFilePaths.size(); i++ )
|
||||
{
|
||||
const CString name = GetPackageDirectory( asFilePaths[i] );
|
||||
const RString name = SMPackageUtil::GetPackageDirectory( asFilePaths[i] );
|
||||
if( name != "" )
|
||||
Directories.insert( name );
|
||||
}
|
||||
|
||||
set<CString>::const_iterator it;
|
||||
set<RString>::const_iterator it;
|
||||
int num = 0;
|
||||
for( it = Directories.begin(); it != Directories.end(); ++it )
|
||||
ini.SetValue( "Packages", ssprintf("%i", num++), *it );
|
||||
ini.SetValueI( "Packages", "NumPackages", num );
|
||||
ini.SetValue( "Packages", "NumPackages", num );
|
||||
|
||||
CString buf;
|
||||
ini.WriteBuf(buf);
|
||||
RageFileObjMem f;
|
||||
ini.WriteFile( f );
|
||||
RString buf = f.GetString();
|
||||
|
||||
CZipMemFile control;
|
||||
control.Write( buf.GetBuffer(0), buf.GetLength() );
|
||||
@@ -207,7 +183,7 @@ bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExp
|
||||
//
|
||||
for( unsigned j=0; j<asFilePaths.size(); j++ )
|
||||
{
|
||||
CString sFilePath = asFilePaths[j];
|
||||
RString sFilePath = asFilePaths[j];
|
||||
|
||||
// don't export "thumbs.db" files or "CVS" folders
|
||||
if( sFilePath.Find("CVS")!=-1 )
|
||||
@@ -215,12 +191,12 @@ bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExp
|
||||
if( sFilePath.Find("Thumbs.db")!=-1 )
|
||||
continue; // skip
|
||||
|
||||
CString sDir, sFName, sExt;
|
||||
splitrelpath( sFilePath, sDir, sFName, sExt );
|
||||
RString sExt = GetExtension( sFilePath );
|
||||
bool bUseCompression = true;
|
||||
if( sExt.CompareNoCase("avi")==0 ||
|
||||
sExt.CompareNoCase("mpeg")==0 ||
|
||||
sExt.CompareNoCase("mpg")==0 ||
|
||||
sExt.CompareNoCase("mp3")==0 ||
|
||||
sExt.CompareNoCase("ogg")==0 ||
|
||||
sExt.CompareNoCase("gif")==0 ||
|
||||
sExt.CompareNoCase("jpg")==0 ||
|
||||
@@ -244,10 +220,10 @@ bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExp
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSmpackageExportDlg::MakeComment( CString &comment )
|
||||
bool CSmpackageExportDlg::MakeComment( RString &comment )
|
||||
{
|
||||
bool DontAskForComment;
|
||||
if( GetPref("DontAskForComment", DontAskForComment) && DontAskForComment )
|
||||
if( SMPackageUtil::GetPref("DontAskForComment", DontAskForComment) && DontAskForComment )
|
||||
{
|
||||
comment = "";
|
||||
return true;
|
||||
@@ -260,14 +236,14 @@ bool CSmpackageExportDlg::MakeComment( CString &comment )
|
||||
|
||||
comment = commentDlg.m_sEnteredComment;
|
||||
if( commentDlg.m_bDontAsk )
|
||||
SetPref( "DontAskForComment", true );
|
||||
SMPackageUtil::SetPref( "DontAskForComment", true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSmpackageExportDlg::OnButtonExportAsOne()
|
||||
{
|
||||
CStringArray asPaths;
|
||||
vector<RString> asPaths;
|
||||
GetCheckedPaths( asPaths );
|
||||
|
||||
if( asPaths.size() == 0 )
|
||||
@@ -282,7 +258,7 @@ void CSmpackageExportDlg::OnButtonExportAsOne()
|
||||
}
|
||||
|
||||
// Generate a package name
|
||||
CString sPackageName;
|
||||
RString sPackageName;
|
||||
EnterName nameDlg;
|
||||
int nResponse = nameDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
@@ -291,7 +267,7 @@ void CSmpackageExportDlg::OnButtonExportAsOne()
|
||||
sPackageName = ReplaceInvalidFileNameChars( sPackageName+".smzip" );
|
||||
|
||||
// Generate a comment
|
||||
CString sComment;
|
||||
RString sComment;
|
||||
if( !MakeComment(sComment) )
|
||||
return; // cancelled
|
||||
|
||||
@@ -301,7 +277,7 @@ void CSmpackageExportDlg::OnButtonExportAsOne()
|
||||
|
||||
void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
{
|
||||
CStringArray asPaths;
|
||||
vector<RString> asPaths;
|
||||
GetCheckedPaths( asPaths );
|
||||
|
||||
if( asPaths.size() == 0 )
|
||||
@@ -311,25 +287,24 @@ void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
}
|
||||
|
||||
// Generate a comment
|
||||
CString sComment;
|
||||
RString sComment;
|
||||
if( !MakeComment(sComment) )
|
||||
return; // cancelled
|
||||
|
||||
bool bAllSucceeded = true;
|
||||
CStringArray asExportedPackages;
|
||||
CStringArray asFailedPackages;
|
||||
vector<RString> asExportedPackages;
|
||||
vector<RString> asFailedPackages;
|
||||
for( unsigned i=0; i<asPaths.size(); i++ )
|
||||
{
|
||||
// Generate a package name for every path
|
||||
CString sPath = asPaths[i];
|
||||
RString sPath = asPaths[i];
|
||||
|
||||
CString sPackageName;
|
||||
CStringArray asPathBits;
|
||||
RString sPackageName;
|
||||
vector<RString> asPathBits;
|
||||
split( sPath, "\\", asPathBits, true );
|
||||
sPackageName = asPathBits[ asPathBits.size()-1 ] + ".smzip";
|
||||
sPackageName = ReplaceInvalidFileNameChars( sPackageName );
|
||||
|
||||
CStringArray asPathsToExport;
|
||||
vector<RString> asPathsToExport;
|
||||
asPathsToExport.push_back( sPath );
|
||||
|
||||
if( ExportPackage( sPackageName, asPathsToExport, sComment ) )
|
||||
@@ -338,7 +313,7 @@ void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
asFailedPackages.push_back( sPackageName );
|
||||
}
|
||||
|
||||
CString sMessage;
|
||||
RString sMessage;
|
||||
if( asFailedPackages.size() == 0 )
|
||||
sMessage = ssprintf("Successfully exported the package%s '%s' to your Desktop.", asFailedPackages.size()>1?"s":"", join("', '",asExportedPackages) );
|
||||
else
|
||||
@@ -349,7 +324,7 @@ void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
void CSmpackageExportDlg::OnButtonPlay()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
LaunchGame();
|
||||
SMPackageUtil::LaunchGame();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -390,7 +365,7 @@ void CSmpackageExportDlg::GetCheckedTreeItems( CArray<HTREEITEM,HTREEITEM>& aChe
|
||||
aCheckedItemsOut.Add( aItems[i] );
|
||||
}
|
||||
|
||||
void CSmpackageExportDlg::GetCheckedPaths( CStringArray& aPathsOut )
|
||||
void CSmpackageExportDlg::GetCheckedPaths( vector<RString>& aPathsOut )
|
||||
{
|
||||
CArray<HTREEITEM,HTREEITEM> aItems;
|
||||
|
||||
@@ -399,15 +374,15 @@ void CSmpackageExportDlg::GetCheckedPaths( CStringArray& aPathsOut )
|
||||
{
|
||||
HTREEITEM item = aItems[i];
|
||||
|
||||
CString sPath;
|
||||
RString sPath;
|
||||
|
||||
while( item )
|
||||
{
|
||||
sPath = m_tree.GetItemText(item) + '\\' + sPath;
|
||||
sPath = (LPCTSTR)m_tree.GetItemText(item) + '\\' + sPath;
|
||||
item = m_tree.GetParentItem(item);
|
||||
}
|
||||
|
||||
sPath.TrimRight('\\'); // strip off last slash
|
||||
TrimRight( sPath, "\\" ); // strip off last slash
|
||||
|
||||
aPathsOut.push_back( sPath );
|
||||
}
|
||||
@@ -421,7 +396,7 @@ void CSmpackageExportDlg::OnButtonEdit()
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
WriteStepManiaInstallDirs( dlg.m_asReturnedInstallDirs );
|
||||
SMPackageUtil::WriteStepManiaInstallDirs( dlg.m_vsReturnedInstallDirs );
|
||||
RefreshInstallationList();
|
||||
RefreshTree();
|
||||
}
|
||||
@@ -431,8 +406,8 @@ void CSmpackageExportDlg::RefreshInstallationList()
|
||||
{
|
||||
m_comboDir.ResetContent();
|
||||
|
||||
CStringArray asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
vector<RString> asInstallDirs;
|
||||
SMPackageUtil::GetStepManiaInstallDirs( asInstallDirs );
|
||||
for( unsigned i=0; i<asInstallDirs.size(); i++ )
|
||||
{
|
||||
m_comboDir.AddString( asInstallDirs[i] );
|
||||
@@ -450,14 +425,18 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
{
|
||||
m_tree.DeleteAllItems();
|
||||
|
||||
CString sDir;
|
||||
m_comboDir.GetWindowText( sDir );
|
||||
RString sDir;
|
||||
{
|
||||
CString s;
|
||||
m_comboDir.GetWindowText( s );
|
||||
sDir = s;
|
||||
}
|
||||
|
||||
SetCurrentDirectory( sDir );
|
||||
|
||||
// Add announcers
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Announcers" );
|
||||
GetDirListing( "Announcers\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
@@ -466,7 +445,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add characters
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Characters" );
|
||||
GetDirListing( "Characters\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
@@ -475,7 +454,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add themes
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Themes" );
|
||||
GetDirListing( "Themes\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
@@ -484,7 +463,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add BGAnimations
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "BGAnimations" );
|
||||
GetDirListing( "BGAnimations\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
@@ -493,7 +472,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add RandomMovies
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "RandomMovies" );
|
||||
GetDirListing( "RandomMovies\\*.avi", as1, false, false );
|
||||
GetDirListing( "RandomMovies\\*.mpg", as1, false, false );
|
||||
@@ -504,7 +483,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add visualizations
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Visualizations" );
|
||||
GetDirListing( "Visualizations\\*.avi", as1, false, false );
|
||||
GetDirListing( "Visualizations\\*.mpg", as1, false, false );
|
||||
@@ -515,7 +494,7 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
|
||||
// Add courses
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Courses" );
|
||||
GetDirListing( "Courses\\*.crs", as1, false, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
@@ -530,12 +509,12 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
// Add NoteSkins
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "NoteSkins" );
|
||||
GetDirListing( "NoteSkins\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
vector<RString> as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "NoteSkins\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( unsigned j=0; j<as2.size(); j++ )
|
||||
@@ -547,12 +526,12 @@ void CSmpackageExportDlg::RefreshTree()
|
||||
// Add Songs
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
vector<RString> as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Songs" );
|
||||
GetDirListing( "Songs\\*.*", as1, true, false );
|
||||
for( unsigned i=0; i<as1.size(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
vector<RString> as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "Songs\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( unsigned j=0; j<as2.size(); j++ )
|
||||
|
||||
@@ -42,8 +42,8 @@ protected:
|
||||
void RefreshTree();
|
||||
void GetTreeItems( CArray<HTREEITEM,HTREEITEM>& aItemsOut );
|
||||
void GetCheckedTreeItems( CArray<HTREEITEM,HTREEITEM>& aCheckedItemsOut );
|
||||
void GetCheckedPaths( CStringArray& aCheckedItemsOut );
|
||||
bool MakeComment( CString &comment );
|
||||
void GetCheckedPaths( vector<RString>& aCheckedItemsOut );
|
||||
bool MakeComment( RString &comment );
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CSmpackageExportDlg)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
#define CStringArray vector<CString>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
// http : www.ittiger.net
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "TreeCtrlEx.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// UninstallOld.cpp : implementation file
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "UninstallOld.h"
|
||||
|
||||
@@ -13,14 +13,10 @@
|
||||
#define IDD_EDIT_INSTALLATIONS 138
|
||||
#define IDD_MENU 139
|
||||
#define MENU 140
|
||||
#define IDD_CONVERT_THEME 142
|
||||
#define IDD_EDIT_METRICS 145
|
||||
#define EDIT_METRICS 146
|
||||
#define IDD_ENTER_COMMENT 146
|
||||
#define IDD_SHOW_COMMENT 147
|
||||
#define IDD_UNINSTALL_OLD_PACKAGES 148
|
||||
#define IDD_CHANGE_GAME_SETTINGS 149
|
||||
#define CONVERTTHEME 149
|
||||
#define IDC_LIST_SONGS 1000
|
||||
#define IDC_LIST 1000
|
||||
#define IDC_BUTTON_PLAY 1001
|
||||
@@ -41,7 +37,6 @@
|
||||
#define IDC_BUTTON_MAKE_DEFAULT 1020
|
||||
#define IDC_EXPORT_PACKAGES 1022
|
||||
#define IDC_LIST_THEMES 1023
|
||||
#define IDC_ANALYZE_ELEMENTS 1023
|
||||
#define IDC_EDIT_INSTALLATIONS 1024
|
||||
#define IDC_BUTTON_CONVERT 1024
|
||||
#define IDC_BUTTON_ANALYZE 1025
|
||||
@@ -56,6 +51,7 @@
|
||||
#define IDC_CLEAR_PREFERENCES 1028
|
||||
#define IDC_EDIT_DEFAULT 1029
|
||||
#define IDC_CLEAR_KEYMAPS 1029
|
||||
#define IDC_VIEW_STATISTICS 1030
|
||||
#define IDC_BUTTON_REFRESH 1035
|
||||
#define IDC_BUTTON_SAVE 1036
|
||||
#define IDC_BUTTON_OVERRIDE 1037
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// smpackage.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#define CO_EXIST_WITH_MFC
|
||||
#include "global.h"
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "smpackageExportDlg.h"
|
||||
@@ -8,6 +10,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "smpackageUtil.h"
|
||||
#include "MainMenuDlg.h"
|
||||
#include "RageFileManager.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -66,32 +69,32 @@ BOOL CSmpackageApp::InitInstance()
|
||||
// make sure it's in the list of install directories
|
||||
TCHAR szCurrentDirectory[MAX_PATH];
|
||||
GetCurrentDirectory( MAX_PATH, szCurrentDirectory );
|
||||
AddStepManiaInstallDir( szCurrentDirectory );
|
||||
SMPackageUtil::AddStepManiaInstallDir( szCurrentDirectory );
|
||||
}
|
||||
|
||||
|
||||
// check if there's a .smzip command line argument
|
||||
CStringArray arrayCommandLineBits;
|
||||
vector<RString> arrayCommandLineBits;
|
||||
split( ::GetCommandLine(), "\"", arrayCommandLineBits );
|
||||
for( unsigned i=0; i<arrayCommandLineBits.size(); i++ )
|
||||
{
|
||||
CString sPath = arrayCommandLineBits[i];
|
||||
sPath.TrimLeft();
|
||||
sPath.TrimRight();
|
||||
CString sPathLower = sPath;
|
||||
RString sPath = arrayCommandLineBits[i];
|
||||
TrimLeft( sPath );
|
||||
TrimRight( sPath );
|
||||
RString sPathLower = sPath;
|
||||
sPathLower.MakeLower();
|
||||
|
||||
// test to see if this is a smzip file
|
||||
if( sPathLower.Right(3) == "zip" )
|
||||
{
|
||||
if( !DoesFileExist(sPath) )
|
||||
if( !FILEMAN->DoesFileExist(sPath) )
|
||||
{
|
||||
AfxMessageBox( ssprintf("The file '%s' does not exist. Aborting installation.",sPath), MB_ICONERROR );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// We found a zip package. Prompt the user to install it!
|
||||
CSMPackageInstallDlg dlg( sPath );
|
||||
CSMPackageInstallDlg dlg( CString(sPath.c_str()) );
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
@@ -109,6 +112,8 @@ BOOL CSmpackageApp::InitInstance()
|
||||
}
|
||||
}
|
||||
|
||||
FILEMAN = new RageFileManager( "" );
|
||||
|
||||
|
||||
// Show the Manager Dialog
|
||||
MainMenuDlg dlg;
|
||||
@@ -116,6 +121,9 @@ BOOL CSmpackageApp::InitInstance()
|
||||
// if (nResponse == IDOK)
|
||||
|
||||
|
||||
SAFE_DELETE( FILEMAN );
|
||||
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
|
||||
@@ -155,91 +155,38 @@ BEGIN
|
||||
IDC_STATIC,18,144,196,17
|
||||
END
|
||||
|
||||
IDD_MENU DIALOGEX 0, 0, 332, 345
|
||||
IDD_MENU DIALOGEX 0, 0, 332, 310
|
||||
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,324,50,14
|
||||
DEFPUSHBUTTON "Exit",IDOK,275,289,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
|
||||
GROUPBOX "Installation",IDC_STATIC,7,41,318,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
|
||||
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,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
|
||||
IDC_STATIC,103,259,215,20
|
||||
GROUPBOX "Game Settings",IDC_STATIC,7,109,318,87
|
||||
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.",
|
||||
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 |
|
||||
IDC_STATIC,104,123,215,45
|
||||
PUSHBUTTON "Clear Preferences",IDC_CLEAR_PREFERENCES,16,136,75,15
|
||||
PUSHBUTTON "Clear Mappings",IDC_CLEAR_KEYMAPS,16,175,75,15
|
||||
EDITTEXT IDC_EDIT_INSTALLATION,16,51,219,12,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
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
|
||||
PUSHBUTTON "Launch Game",IDC_BUTTON_LAUNCH_GAME,189,324,70,14
|
||||
END
|
||||
|
||||
IDD_CONVERT_THEME DIALOGEX 0, 0, 332, 258
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Theme Elements"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,275,237,50,14
|
||||
CONTROL 149,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
|
||||
LISTBOX IDC_LIST_THEMES,7,44,88,186,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Tools",IDC_STATIC,105,41,220,189
|
||||
LTEXT "Check for redundant or possibly midnamed theme elements.",
|
||||
IDC_STATIC,110,75,210,11
|
||||
PUSHBUTTON "Analyze Elements",IDC_BUTTON_ANALYZE,165,55,95,15,
|
||||
WS_DISABLED
|
||||
LTEXT "Edit theme metrics with a user-friendly interface.",
|
||||
IDC_STATIC,110,116,210,10
|
||||
PUSHBUTTON "Edit Metrics",IDC_BUTTON_EDIT_METRICS,165,96,95,15,
|
||||
WS_DISABLED
|
||||
LTEXT "Check for redundant or possibly midnamed theme metrics.",
|
||||
IDC_STATIC,109,158,210,10
|
||||
PUSHBUTTON "Analyze Metrics",IDC_BUTTON_ANALYZE_METRICS,165,138,95,
|
||||
15,WS_DISABLED
|
||||
END
|
||||
|
||||
IDD_EDIT_METRICS DIALOG 0, 0, 332, 234
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Edit Theme Metrics"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
PUSHBUTTON "Close",IDC_BUTTON_CLOSE,275,213,50,14
|
||||
CONTROL 146,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
|
||||
EDITTEXT IDC_EDIT_VALUE,217,95,108,50,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | WS_DISABLED
|
||||
LTEXT "Value",IDC_STATIC,218,83,88,9
|
||||
EDITTEXT IDC_EDIT_DEFAULT,217,161,108,48,ES_MULTILINE |
|
||||
ES_AUTOVSCROLL | ES_READONLY
|
||||
LTEXT "Default Value",IDC_STATIC,218,148,88,9
|
||||
PUSHBUTTON "Override",IDC_BUTTON_OVERRIDE,217,45,60,14,WS_DISABLED
|
||||
PUSHBUTTON "Remove Override",IDC_BUTTON_REMOVE,217,64,60,14,
|
||||
WS_DISABLED
|
||||
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
|
||||
TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER |
|
||||
WS_TABSTOP,7,44,203,165
|
||||
PUSHBUTTON "Save",IDC_BUTTON_SAVE,203,213,56,14
|
||||
PUSHBUTTON "Explanation",IDC_BUTTON_HELP,65,214,71,13
|
||||
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 "View Statistics",IDC_VIEW_STATISTICS,16,85,75,15
|
||||
LTEXT "View high scores and usage statistics and other saved from your play.",
|
||||
IDC_STATIC,103,84,215,20
|
||||
GROUPBOX "Statistics",IDC_STATIC,7,72,318,35
|
||||
END
|
||||
|
||||
IDD_ENTER_COMMENT DIALOGEX 0, 0, 312, 202
|
||||
@@ -405,23 +352,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 325
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 338
|
||||
END
|
||||
|
||||
IDD_CONVERT_THEME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 325
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 251
|
||||
END
|
||||
|
||||
IDD_EDIT_METRICS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 325
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 227
|
||||
BOTTOMMARGIN, 303
|
||||
END
|
||||
|
||||
IDD_ENTER_COMMENT, DIALOG
|
||||
@@ -467,8 +398,6 @@ END
|
||||
INSTALL BITMAP "install.bmp"
|
||||
MANAGE BITMAP "manage.bmp"
|
||||
MENU BITMAP "menu.bmp"
|
||||
EDIT_METRICS BITMAP "editmetrics.bmp"
|
||||
CONVERTTHEME BITMAP "converttheme.bmp"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
#ifndef SMPACKAGE_UTIL_H
|
||||
#define SMPACKAGE_UTIL_H
|
||||
#ifndef SMPackageUtil_H
|
||||
#define SMPackageUtil_H
|
||||
|
||||
#include "RageUtil.h"
|
||||
#include "../ProductInfo.h"
|
||||
namespace SMPackageUtil
|
||||
{
|
||||
void WriteStepManiaInstallDirs( const vector<RString>& asInstallDirsToWrite );
|
||||
void GetStepManiaInstallDirs( vector<RString>& asInstallDirsOut );
|
||||
void AddStepManiaInstallDir( RString sNewInstallDir );
|
||||
void SetDefaultInstallDir( int iInstallDirIndex );
|
||||
void SetDefaultInstallDir( RString sInstallDir );
|
||||
|
||||
static const CString PREFERENCES_INI = "Save\\Preferences.ini";
|
||||
static const CString KEYMAPS_INI = "Save\\Keymaps.ini";
|
||||
bool GetPref( RString name, bool &val );
|
||||
bool SetPref( RString name, bool val );
|
||||
|
||||
void WriteStepManiaInstallDirs( const CStringArray& asInstallDirsToWrite );
|
||||
void GetStepManiaInstallDirs( CStringArray& asInstallDirsOut );
|
||||
void AddStepManiaInstallDir( CString sNewInstallDir );
|
||||
void SetDefaultInstallDir( int iInstallDirIndex );
|
||||
void SetDefaultInstallDir( CString sInstallDir );
|
||||
RString GetPackageDirectory(RString path);
|
||||
bool IsValidPackageDirectory(RString path);
|
||||
|
||||
bool GetPref( CString name, bool &val );
|
||||
bool SetPref( CString name, bool val );
|
||||
|
||||
CString GetPackageDirectory(CString path);
|
||||
bool IsValidPackageDirectory(CString path);
|
||||
|
||||
void LaunchGame();
|
||||
void LaunchGame();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user