diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 04f959e5bf..0ff8310001 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -25,6 +25,8 @@ #include "Notes.h" #include "GameState.h" #include "BannerCache.h" +#include "RageFile.h" +#include "arch/arch.h" /* Amount to increase meter ranges to make them difficult: */ const int DIFFICULT_METER_CHANGE = 2; @@ -85,6 +87,8 @@ int Course::GetMeter() const if( m_iMeter != -1 ) return m_iMeter + GAMESTATE->m_bDifficultCourses? DifficultMeterRamp:0; + LOG->Trace( "Course file '%s' contains a song '%s%s%s' that is not present", + m_sPath.c_str(), sGroup.c_str(), sGroup.size()? SLASH:"", sSong.c_str()); vector ci; GetCourseInfo( GAMESTATE->GetCurrentStyleDef()->m_NotesType, ci ); @@ -265,7 +269,7 @@ void Course::Save() { ASSERT( !m_bIsAutogen ); - FILE* fp = fopen( m_sPath, "w" ); + FILE* fp = Ragefopen( m_sPath, "w" ); if( fp == NULL ) { LOG->Warn( "Could not write course file '%s'.", m_sPath.c_str() ); @@ -290,7 +294,7 @@ void Course::Save() fprintf( fp, "#SONG:*" ); break; case Entry::random_within_group: - fprintf( fp, "#SONG:%s/*", entry.group_name.c_str() ); + fprintf( fp, "#SONG:" + entry.group_name + SLASH "*" ); break; case Entry::best: fprintf( fp, "#SONG:BEST%d", entry.players_index+1 ); diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 3eb51e8c67..59261945c5 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -17,6 +17,7 @@ #include #include using namespace std; +#include "RageFile.h" //constructor, can specify pathname here instead of using SetPath later IniFile::IniFile(CString inipath) @@ -40,7 +41,8 @@ void IniFile::SetPath(CString newpath) // returns true if successful, false otherwise bool IniFile::ReadFile() { - FILE *f = fopen(path, "r"); +LOG->Trace("INI: Reading '%s'",path.c_str() ); + FILE *f = Ragefopen(path, "r"); if (f == NULL) { @@ -55,6 +57,7 @@ bool IniFile::ReadFile() { buf[sizeof(buf)-1]=0; CString line(buf); +// LOG->Trace("Read line '%s'", line.c_str()); if(line.size() >= 3 && line[0] == '\xef' && @@ -70,6 +73,7 @@ bool IniFile::ReadFile() continue; StripCrnl(line); +// LOG->Trace("Stripped: '%s'", line.c_str()); if (line.substr(0, 2) == "//" || line.substr(0) == "#") continue; /* comment */ @@ -97,7 +101,7 @@ bool IniFile::ReadFile() // writes data stored in class to ini file void IniFile::WriteFile() { - FILE* fp = fopen( path, "w" ); + FILE* fp = Ragefopen( path, "w" ); if( fp == NULL ) return; diff --git a/stepmania/src/NotesLoaderBMS.cpp b/stepmania/src/NotesLoaderBMS.cpp index 7a99995f35..86c783436c 100644 --- a/stepmania/src/NotesLoaderBMS.cpp +++ b/stepmania/src/NotesLoaderBMS.cpp @@ -8,7 +8,7 @@ #include "RageLog.h" #include "GameManager.h" #include "RageException.h" -#include +#include "RageFile.h" // BMS encoding: tap-hold // 4&8panel: Player1 Player2 @@ -67,8 +67,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out ) NoteData* pNoteData = new NoteData; pNoteData->SetNumTracks( MAX_NOTE_TRACKS ); - ifstream file(sPath); - if( !file.good() ) + Rageifstream file(sPath); + if( file.bad() ) RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); CString line; @@ -284,8 +284,8 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) CString sPath = out.GetSongDir() + arrayBMSFileNames[0]; - ifstream file(sPath); - if( !file.good() ) + Rageifstream file(sPath); + if( file.bad() ) RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); CString line; @@ -423,8 +423,8 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) // open the song file again and and look for this tag's value - ifstream file(sPath); - if( !file.good() ) + Rageifstream file(sPath); + if( file.bad() ) RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); CString line; @@ -485,8 +485,8 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) // open the song file again and and look for this tag's value - ifstream file(sPath); - if( !file.good() ) + Rageifstream file(sPath); + if( file.bad() ) RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); CString line; diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index 09c89732d7..3b44b10be4 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -4,6 +4,7 @@ #include "RageUtil.h" #include "GameManager.h" #include "RageLog.h" +#include "RageFile.h" #include #include @@ -113,7 +114,7 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache) { unsigned i; - FILE* fp = fopen( sPath, "w" ); + FILE* fp = Ragefopen( sPath, "w" ); if( fp == NULL ) { LOG->Warn( "Error opening song file '%s' for writing: %s", sPath.c_str(), strerror(errno) ); diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index fa0f19a13c..03eb1758c3 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -12,11 +12,12 @@ */ #include "arch/ArchHooks/ArchHooks.h" +#include "arch/arch.h" #include "RageLog.h" #include "RageUtil.h" #include "RageTimer.h" #include "PrefsManager.h" -#include +#include "RageFile.h" #include RageLog* LOG; // global and accessable from anywhere in the program @@ -62,10 +63,10 @@ RageLog* LOG; // global and accessable from anywhere in the program map LogMaps; // constants -#define LOG_FILE_NAME "log.txt" -#define INFO_FILE_NAME "info.txt" +#define LOG_PATH BASE_PATH "log.txt" +#define INFO_PATH BASE_PATH "info.txt" -#if defined(WIN32) +#if defined(_WINDOWS) extern unsigned long version_num; extern const char *version_time; #endif @@ -84,12 +85,12 @@ enum { RageLog::RageLog() { // delete old log files - remove( LOG_FILE_NAME ); - remove( INFO_FILE_NAME ); + remove( LOG_PATH ); + remove( INFO_PATH ); // Open log file and leave it open. - m_fileLog = fopen( LOG_FILE_NAME, "w" ); - m_fileInfo = fopen( INFO_FILE_NAME, "w" ); + m_fileLog = Ragefopen( LOG_PATH, "w" ); + m_fileInfo = Ragefopen( INFO_PATH, "w" ); #if defined(_MSC_VER) this->Trace( "Last compiled on %s.", __TIMESTAMP__ ); @@ -102,7 +103,7 @@ RageLog::RageLog() this->Trace( "Log starting %.4d-%.2d-%.2d %.2d:%.2d:%.2d", 1900+now->tm_year, now->tm_mon, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec ); this->Trace( "" ); -#if defined(WIN32) +#if defined(_WINDOWS) this->Info("Compiled %s (build %i)", version_time, version_num); #endif } @@ -199,7 +200,7 @@ void RageLog::Write( int where, CString str) printf("%s\n", str.c_str() ); -#ifdef DEBUG +//#ifdef DEBUG Flush(); #else if( (PREFSMAN && PREFSMAN->m_bDebugMode) || (where & WRITE_TO_INFO) ) diff --git a/stepmania/src/SDLx-0.02.rar b/stepmania/src/SDLx-0.02.rar new file mode 100644 index 0000000000..5d4884911b Binary files /dev/null and b/stepmania/src/SDLx-0.02.rar differ diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 63f441e4fd..1ccb1aacf9 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -73,30 +73,27 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "StepMania___Xbox_Debug" -# PROP BASE Intermediate_Dir "StepMania___Xbox_Debug" -# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "StepMania___Xbox_Debug___VC6" -# PROP Intermediate_Dir "StepMania___Xbox_Debug___VC6" +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" -# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib -# ADD LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" -# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib +# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP +# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP XBE=imagebld.exe # ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe" XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO @@ -161,23 +158,29 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP Target_Dir "" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c +# SUBTRACT CPP /Fr BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" # SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib -# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" -# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib +# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF +# SUBTRACT LINK32 /pdb:none /map /debug XBE=imagebld.exe # ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /testid:"123456" /testname:"" /stack:0x10000 /debug /out:"../default.xbe" /titleinfo:"" XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO # Begin Special Build Tool -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +IntDir=.\StepMania___Xbox_Release +TargetDir=\stepmania\stepmania +TargetName=default +SOURCE="$(InputPath)" +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -450,6 +453,25 @@ SOURCE=.\RageException.h # End Source File # Begin Source File +SOURCE=.\RageFile.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\RageFile.h +# End Source File +# Begin Source File + SOURCE=.\RageInput.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -616,6 +638,8 @@ SOURCE=.\RageSoundReader_SDL_Sound.cpp !ELSEIF "$(CFG)" == "StepMania - Xbox Debug" +# PROP Exclude_From_Build 1 + !ELSEIF "$(CFG)" == "StepMania - Win32 Release" !ELSEIF "$(CFG)" == "StepMania - Xbox Release" @@ -629,6 +653,44 @@ SOURCE=.\RageSoundReader_SDL_Sound.h # End Source File # Begin Source File +SOURCE=.\RageSoundReader_Vorbisfile.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\RageSoundReader_Vorbisfile.h + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=.\RageSoundResampler.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -1556,6 +1618,10 @@ SOURCE=.\arch\LoadingWindow\LoadingWindow.h # End Source File # Begin Source File +SOURCE=.\arch\LoadingWindow\LoadingWindow_Null.h +# End Source File +# Begin Source File + SOURCE=.\arch\LoadingWindow\LoadingWindow_SDL.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -1614,6 +1680,8 @@ SOURCE=.\arch\Sound\DSoundHelpers.cpp !ELSEIF "$(CFG)" == "StepMania - Xbox Debug" +# PROP Exclude_From_Build 1 + !ELSEIF "$(CFG)" == "StepMania - Win32 Release" !ELSEIF "$(CFG)" == "StepMania - Xbox Release" @@ -1637,6 +1705,8 @@ SOURCE=.\arch\Sound\RageSoundDriver_DSound.cpp !ELSEIF "$(CFG)" == "StepMania - Xbox Debug" +# PROP Exclude_From_Build 1 + !ELSEIF "$(CFG)" == "StepMania - Win32 Release" !ELSEIF "$(CFG)" == "StepMania - Xbox Release" @@ -1894,6 +1964,27 @@ SOURCE=.\arch\InputHandler\InputHandler_DirectInputHelper.h # End Source File # Begin Source File +SOURCE=.\arch\InputHandler\InputHandler_SDL.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\arch\InputHandler\InputHandler_SDL.h +# End Source File +# Begin Source File + SOURCE=.\arch\InputHandler\InputHandler_Win32_Pump.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -2013,6 +2104,23 @@ SOURCE=.\arch\MovieTexture\MovieTexture_Null.h # Begin Source File SOURCE=.\arch\LowLevelWindow\LowLevelWindow.h + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\arch\LowLevelWindow\LowLevelWindow_Null.h # End Source File # Begin Source File @@ -2026,12 +2134,27 @@ SOURCE=.\arch\LowLevelWindow\LowLevelWindow_SDL.cpp !ELSEIF "$(CFG)" == "StepMania - Xbox Release" +# PROP Exclude_From_Build 1 + !ENDIF # End Source File # Begin Source File SOURCE=.\arch\LowLevelWindow\LowLevelWindow_SDL.h + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +# PROP Exclude_From_Build 1 + +!ENDIF + # End Source File # End Group # Begin Source File