diff --git a/stepmania/src/RageFileManager.cpp b/stepmania/src/RageFileManager.cpp
index 8ac905c489..efa9052315 100644
--- a/stepmania/src/RageFileManager.cpp
+++ b/stepmania/src/RageFileManager.cpp
@@ -209,7 +209,7 @@ static RString GetDirOfExecutable( RString argv0 )
#endif
}
-static void ChangeToDirOfExecutable( RString argv0 )
+static void ChangeToDirOfExecutable( const RString &argv0 )
{
RageFileManagerUtil::sInitialWorkingDirectory = GetCwd();
RageFileManagerUtil::sDirOfExecutable = GetDirOfExecutable( argv0 );
diff --git a/stepmania/src/StepMania-net2003.vcproj b/stepmania/src/StepMania-net2003.vcproj
index 1e70e1e1d3..c7ca00b97d 100644
--- a/stepmania/src/StepMania-net2003.vcproj
+++ b/stepmania/src/StepMania-net2003.vcproj
@@ -1560,6 +1560,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
+
+
+
+
diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp
index ef9ea1cec8..04b69858c2 100644
--- a/stepmania/src/StepMania.dsp
+++ b/stepmania/src/StepMania.dsp
@@ -59,10 +59,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
-TargetDir=\SM Source\stepmania\Program
+TargetDir=\cvs\stepmania\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
-PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
+PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -96,10 +96,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
IntDir=.\../Release6
-TargetDir=\SM Source\stepmania\Program
+TargetDir=\cvs\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
-PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
+PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -1691,6 +1691,14 @@ SOURCE=.\archutils\Win32\arch_time.cpp
# End Source File
# Begin Source File
+SOURCE=.\archutils\Win32\CommandLine.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\archutils\Win32\CommandLine.h
+# End Source File
+# Begin Source File
+
SOURCE=.\archutils\Win32\Crash.cpp
# End Source File
# Begin Source File
diff --git a/stepmania/src/archutils/Win32/CommandLine.cpp b/stepmania/src/archutils/Win32/CommandLine.cpp
new file mode 100644
index 0000000000..75d5010a56
--- /dev/null
+++ b/stepmania/src/archutils/Win32/CommandLine.cpp
@@ -0,0 +1,74 @@
+#include "global.h"
+#include "CommandLine.h"
+#include
+
+/* Ugh. Windows doesn't give us the argv[] parser; all it gives is CommandLineToArgvW,
+ * which is NT-only, so we have to do this ourself. Don't be fancy; only handle double
+ * quotes. */
+int GetWin32CmdLine( char** &argv )
+{
+ char *pCmdLine = GetCommandLine();
+ int argc = 0;
+ argv = NULL;
+
+ int i = 0;
+ while( pCmdLine[i] )
+ {
+ argv = (char **) realloc( argv, (argc+1) * sizeof(char *) );
+ argv[argc] = pCmdLine+i;
+ ++argc;
+
+ /* Skip to the end of this argument. */
+ while( pCmdLine[i] && pCmdLine[i] != ' ' )
+ {
+ if( pCmdLine[i] == '"' )
+ {
+ /* Erase the quote. */
+ memmove( pCmdLine+i, pCmdLine+i+1, strlen(pCmdLine+i+1)+1 );
+
+ /* Skip to the close quote. */
+ while( pCmdLine[i] && pCmdLine[i] != '"' )
+ ++i;
+
+ /* Erase the close quote. */
+ if( pCmdLine[i] == '"' )
+ memmove( pCmdLine+i, pCmdLine+i+1, strlen(pCmdLine+i+1)+1 );
+ }
+ else
+ ++i;
+ }
+
+ if( pCmdLine[i] == ' ' )
+ {
+ pCmdLine[i] = '\0';
+ ++i;
+ }
+ }
+
+ return argc;
+}
+
+/*
+ * (c) 2006 Chris Danford
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons to
+ * whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+ * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/stepmania/src/archutils/Win32/CommandLine.h b/stepmania/src/archutils/Win32/CommandLine.h
new file mode 100644
index 0000000000..fba37bbce0
--- /dev/null
+++ b/stepmania/src/archutils/Win32/CommandLine.h
@@ -0,0 +1,31 @@
+#ifndef CommandLine_H
+#define CommandLine_H
+
+int GetWin32CmdLine( char** &argv );
+
+#endif
+
+/*
+ * (c) 2002-2004 Chris Danford
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons to
+ * whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+ * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
+ * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
+ * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/stepmania/src/archutils/Win32/arch_setup.cpp b/stepmania/src/archutils/Win32/arch_setup.cpp
index 705f7988a3..b2182733be 100644
--- a/stepmania/src/archutils/Win32/arch_setup.cpp
+++ b/stepmania/src/archutils/Win32/arch_setup.cpp
@@ -3,54 +3,9 @@
#ifdef _WINDOWS
# include
#endif
+#include "CommandLine.h"
#if defined(WINDOWS)
-/* Ugh. Windows doesn't give us the argv[] parser; all it gives is CommandLineToArgvW,
- * which is NT-only, so we have to do this ourself. Don't be fancy; only handle double
- * quotes. */
-int GetWin32CmdLine( char** &argv )
-{
- char *pCmdLine = GetCommandLine();
- int argc = 0;
- argv = NULL;
-
- int i = 0;
- while( pCmdLine[i] )
- {
- argv = (char **) realloc( argv, (argc+1) * sizeof(char *) );
- argv[argc] = pCmdLine+i;
- ++argc;
-
- /* Skip to the end of this argument. */
- while( pCmdLine[i] && pCmdLine[i] != ' ' )
- {
- if( pCmdLine[i] == '"' )
- {
- /* Erase the quote. */
- memmove( pCmdLine+i, pCmdLine+i+1, strlen(pCmdLine+i+1)+1 );
-
- /* Skip to the close quote. */
- while( pCmdLine[i] && pCmdLine[i] != '"' )
- ++i;
-
- /* Erase the close quote. */
- if( pCmdLine[i] == '"' )
- memmove( pCmdLine+i, pCmdLine+i+1, strlen(pCmdLine+i+1)+1 );
- }
- else
- ++i;
- }
-
- if( pCmdLine[i] == ' ' )
- {
- pCmdLine[i] = '\0';
- ++i;
- }
- }
-
- return argc;
-}
-
int main( int argc, char* argv[] );
int __stdcall WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, char *pCmdLine, int nCmdShow )
{
diff --git a/stepmania/src/smpackage-net2003.vcproj b/stepmania/src/smpackage-net2003.vcproj
index b7785b621b..4966d0928d 100644
--- a/stepmania/src/smpackage-net2003.vcproj
+++ b/stepmania/src/smpackage-net2003.vcproj
@@ -42,7 +42,7 @@
+
+
+
+
diff --git a/stepmania/src/smpackage/smpackage.cpp b/stepmania/src/smpackage/smpackage.cpp
index 74285475f4..a19ff08be7 100644
--- a/stepmania/src/smpackage/smpackage.cpp
+++ b/stepmania/src/smpackage/smpackage.cpp
@@ -38,17 +38,18 @@ CSmpackageApp theApp;
#include "RageFileManager.h"
#include "archutils/Win32/SpecialDirs.h"
#include "ProductInfo.h"
+#include "archutils/Win32/CommandLine.h"
extern RString GetLastErrorString();
static LocalizedString FAILED_TO_OPEN ( "CSmpackageApp", "Failed to open '%s': %s" );
static LocalizedString THE_FILE_DOES_NOT_EXIST ( "CSmpackageApp", "The file '%s' does not exist. Aborting installation." );
BOOL CSmpackageApp::InitInstance()
{
- TCHAR szCurrentDirectory[MAX_PATH];
- GetCurrentDirectory( ARRAYSIZE(szCurrentDirectory), szCurrentDirectory );
+ char **argv;
+ int argc = GetWin32CmdLine( argv );
/* Almost everything uses this to read and write files. Load this early. */
- FILEMAN = new RageFileManager( szCurrentDirectory );
+ FILEMAN = new RageFileManager( argv[0] );
FILEMAN->MountInitialFilesystems();
/* Set this up next. Do this early, since it's needed for RageException::Throw. */
@@ -56,8 +57,11 @@ BOOL CSmpackageApp::InitInstance()
if( DoesFileExist("Songs") ) // this is a SM program directory
+ {
+ TCHAR szCurrentDirectory[MAX_PATH];
+ GetCurrentDirectory( ARRAYSIZE(szCurrentDirectory), szCurrentDirectory );
SMPackageUtil::AddStepManiaInstallDir( szCurrentDirectory ); // add this if it doesn't already exist
-
+ }
// check if there's a .smzip command line argument
vector arrayCommandLineBits;
@@ -119,12 +123,13 @@ BOOL CSmpackageApp::InitInstance()
// TODO: Use PrefsManager to get the current language instead? PrefsManager would
// need to be split up to reduce dependencies
IniFile ini;
- ini.ReadFile( SpecialFiles::PREFERENCES_INI_PATH );
RString sLanguage;
- ini.GetValue( "Preferences", "Language", sLanguage );
- bool bPseudoLocalize;
- ini.GetValue( "PseudoLocalize", "Language", bPseudoLocalize );
-
+ bool bPseudoLocalize = false;
+ if( ini.ReadFile(SpecialFiles::PREFERENCES_INI_PATH) )
+ {
+ ini.GetValue( "Preferences", "Language", sLanguage );
+ ini.GetValue( "PseudoLocalize", "Language", bPseudoLocalize );
+ }
THEME->SwitchThemeAndLanguage( SpecialFiles::BASE_THEME_NAME, sLanguage, bPseudoLocalize );