fix DWIPath loading for songs that have a normal layout;
some DWI's have relative paths that don't begin with ".\ Song.cpp
This commit is contained in:
@@ -176,7 +176,7 @@ void LifeMeterBattery::Refresh()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textNumLives.SetText( ssprintf("x%d", m_iLivesLeft) );
|
||||
m_textNumLives.SetText( ssprintf("%d", m_iLivesLeft) );
|
||||
m_sprBattery.SetState( 3 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ RageDisplay::RageDisplay( HWND hWnd )
|
||||
HRESULT hr;
|
||||
if( FAILED( hr = m_pd3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_DeviceCaps) ) )
|
||||
{
|
||||
throw RageException(
|
||||
throw RageException(
|
||||
"There was an error while initializing your video card.\n\n"
|
||||
"Your system is reporting that Direct3D8 hardware acceleration\n"
|
||||
"is not available. In most cases, you can download an updated\n"
|
||||
|
||||
@@ -41,7 +41,6 @@ const int MAX_NUM_VERTICIES = MAX_NUM_QUADS*4; // 4 verticies per quad
|
||||
// verticies and not indexing. In fact, drawing indexed primitives is about 30% slower.
|
||||
//
|
||||
|
||||
|
||||
class RageDisplay
|
||||
{
|
||||
friend class RageTexture;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#pragma comment(lib, "dinput8.lib")
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
|
||||
//#define HAVE_DDK
|
||||
#define HAVE_DDK
|
||||
#ifdef HAVE_DDK
|
||||
#pragma comment(lib, "setupapi.lib")
|
||||
#pragma comment(lib, "hid.lib")
|
||||
|
||||
@@ -102,6 +102,7 @@ void RageLog::Warn( const char *fmt, ...)
|
||||
"WARNING: %s\n"
|
||||
"/////////////////////////////////////////",
|
||||
sBuff );
|
||||
warnings.Add( sBuff );
|
||||
}
|
||||
|
||||
void RageLog::Flush()
|
||||
|
||||
@@ -30,6 +30,10 @@ public:
|
||||
|
||||
protected:
|
||||
FILE* m_fileLog;
|
||||
/* Let's keep a list of all warnings, so we can display them later.
|
||||
* We could write this to a file, instead, but for now let's not
|
||||
* clutter the top dir ... */
|
||||
CStringArray warnings;
|
||||
};
|
||||
|
||||
extern RageLog* LOG; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -17,12 +17,20 @@
|
||||
#include "RageException.h"
|
||||
|
||||
|
||||
#include "bass/bass.h"
|
||||
#pragma comment(lib, "bass/bass.lib")
|
||||
|
||||
|
||||
RageSound* SOUND = NULL;
|
||||
|
||||
#if 0
|
||||
RageSound::RageSound( HWND hWnd ) { }
|
||||
RageSound::~RageSound() { }
|
||||
void RageSound::PlayOnceStreamed( CString sPath ) { }
|
||||
void RageSound::PlayOnceStreamedFromDir( CString sDir ) { }
|
||||
#else
|
||||
|
||||
#pragma comment(lib, "bass/bass.lib")
|
||||
|
||||
#include "bass/bass.h"
|
||||
|
||||
|
||||
|
||||
RageSound::RageSound( HWND hWnd )
|
||||
{
|
||||
@@ -113,3 +121,4 @@ void RageSound::PlayOnceStreamedFromDir( CString sDir )
|
||||
PlayOnceStreamed( sDir + arraySoundFiles[index] );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -83,19 +83,58 @@ ScreenGraphicOptions::ScreenGraphicOptions() :
|
||||
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","graphic options music") );
|
||||
}
|
||||
|
||||
int ScreenGraphicOptions::CurrentRefresh() const
|
||||
{
|
||||
int RefreshOption = m_iSelectedOption[0][GO_REFRESH_RATE];
|
||||
switch( RefreshOption )
|
||||
{
|
||||
case 0: return RageDisplay::REFRESH_DEFAULT;break;
|
||||
case 1: return RageDisplay::REFRESH_MAX; break;
|
||||
default:
|
||||
return atoi( g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[RefreshOption] );
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenGraphicOptions::UpdateRefreshRates()
|
||||
{
|
||||
#if 0
|
||||
CArray<int,int> hz;
|
||||
|
||||
int OldSetting = CurrentRefresh();
|
||||
|
||||
/* XXX: We're hardcoded to 16bpp in StepMania.cpp; if we add a bpp option
|
||||
* this needs to be changed. */
|
||||
DISPLAY->GetHzAtResolution(HorizRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]],
|
||||
VertRes[m_iSelectedOption[0][GO_DISPLAY_RESOLUTION]], 16 /* XXX */, hz);
|
||||
|
||||
/* Disable all refresh rates (except DEFAULT/MAX). */
|
||||
/* Set the refresh to default. If we can find the old selection in the
|
||||
* new data, we'll set it to that later. */
|
||||
|
||||
int i;
|
||||
for(i = 0; i < g_GraphicOptionsLines[GO_REFRESH_RATE].iNumOptions; ++i)
|
||||
DimOption(GO_REFRESH_RATE, i, true);
|
||||
OptionRowData &opt = g_GraphicOptionsLines[GO_REFRESH_RATE];
|
||||
opt.iNumOptions = 2;
|
||||
int OldSettingNo = RageDisplay::REFRESH_DEFAULT;
|
||||
|
||||
for(i = 2; i < MAX_OPTIONS_PER_LINE; ++i)
|
||||
opt.szOptionsText[i][0] = 0;
|
||||
|
||||
for(i = 0; i < hz.GetSize(); ++i)
|
||||
{
|
||||
if(hz[i] < 60) continue;
|
||||
sprintf(opt.szOptionsText[opt.iNumOptions], "%i", hz[i]);
|
||||
opt.iNumOptions++;
|
||||
if( hz[i] == OldSetting )
|
||||
OldSettingNo = i;
|
||||
}
|
||||
|
||||
m_iSelectedOption[0][GO_REFRESH_RATE] =
|
||||
m_iSelectedOption[1][GO_REFRESH_RATE] = OldSettingNo;
|
||||
|
||||
InitOptionsText();
|
||||
#endif
|
||||
/* Disable all refresh rates (except DEFAULT/MAX). */
|
||||
// for(i = 0; i < g_GraphicOptionsLines[GO_REFRESH_RATE].iNumOptions; ++i)
|
||||
// DimOption(GO_REFRESH_RATE, i, true);
|
||||
|
||||
/* If we're windowed, leave all refresh rates dimmed, but don't
|
||||
* change the actual selection. */
|
||||
@@ -103,29 +142,29 @@ void ScreenGraphicOptions::UpdateRefreshRates()
|
||||
return;
|
||||
|
||||
/* Enable MAX and DEFAULT. */
|
||||
DimOption(GO_REFRESH_RATE, 0, false);
|
||||
DimOption(GO_REFRESH_RATE, 1, false);
|
||||
// DimOption(GO_REFRESH_RATE, 0, false);
|
||||
// DimOption(GO_REFRESH_RATE, 1, false);
|
||||
|
||||
/* Enable refresh rates. As we go, remember the highest
|
||||
* refresh found. */
|
||||
for(i = 0; i < hz.GetSize(); ++i)
|
||||
/* for(i = 0; i < hz.GetSize(); ++i)
|
||||
{
|
||||
for(int j = 1; j < g_GraphicOptionsLines[GO_REFRESH_RATE].iNumOptions; ++j)
|
||||
{
|
||||
if(atoi(g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[j]) != hz[i])
|
||||
continue;
|
||||
|
||||
*/
|
||||
/* This refresh is available. */
|
||||
DimOption(GO_REFRESH_RATE, j, false);
|
||||
/* DimOption(GO_REFRESH_RATE, j, false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If current refresh is no longer valid, set it to default. */
|
||||
int CurSel = m_iSelectedOption[0][GO_REFRESH_RATE];
|
||||
if(m_OptionDim[GO_REFRESH_RATE][CurSel])
|
||||
m_iSelectedOption[0][GO_REFRESH_RATE] =
|
||||
m_iSelectedOption[1][GO_REFRESH_RATE] = RageDisplay::REFRESH_DEFAULT;
|
||||
*/ /* If current refresh is no longer valid, set it to default. */
|
||||
// int CurSel = m_iSelectedOption[0][GO_REFRESH_RATE];
|
||||
// if(m_OptionDim[GO_REFRESH_RATE][CurSel])
|
||||
// m_iSelectedOption[0][GO_REFRESH_RATE] =
|
||||
// m_iSelectedOption[1][GO_REFRESH_RATE] = RageDisplay::REFRESH_DEFAULT;
|
||||
PositionUnderlines();
|
||||
}
|
||||
|
||||
@@ -176,7 +215,7 @@ void ScreenGraphicOptions::ImportOptions()
|
||||
}
|
||||
|
||||
m_iSelectedOption[0][GO_BGMODE] = PREFSMAN->m_BackgroundMode;
|
||||
m_iSelectedOption[0][GO_BGBRIGHTNESS] = (int)( PREFSMAN->m_fBGBrightness*10+0.5f );
|
||||
m_iSelectedOption[0][GO_BGBRIGHTNESS] = int(roundf( PREFSMAN->m_fBGBrightness*10 ));
|
||||
m_iSelectedOption[0][GO_MOVIEDECODEMS] = PREFSMAN->m_iMovieDecodeMS-1;
|
||||
m_iSelectedOption[0][GO_BGIFNOBANNER] = PREFSMAN->m_bUseBGIfNoBanner ? 1:0;
|
||||
m_iSelectedOption[0][GO_VSYNC] = PREFSMAN->m_bVsync ? 1:0;
|
||||
@@ -200,21 +239,15 @@ void ScreenGraphicOptions::ExportOptions()
|
||||
case 2: PREFSMAN->m_iTextureResolution = 1024; break;
|
||||
default: ASSERT(0); PREFSMAN->m_iTextureResolution = 512; break;
|
||||
}
|
||||
|
||||
switch( m_iSelectedOption[0][GO_REFRESH_RATE] )
|
||||
|
||||
int RefreshOption = m_iSelectedOption[0][GO_REFRESH_RATE];
|
||||
|
||||
switch( RefreshOption )
|
||||
{
|
||||
case 0: PREFSMAN->m_iRefreshRate = RageDisplay::REFRESH_DEFAULT;break;
|
||||
case 1: PREFSMAN->m_iRefreshRate = RageDisplay::REFRESH_MAX; break;
|
||||
case 2: PREFSMAN->m_iRefreshRate = 60; break;
|
||||
case 3: PREFSMAN->m_iRefreshRate = 70; break;
|
||||
case 4: PREFSMAN->m_iRefreshRate = 72; break;
|
||||
case 5: PREFSMAN->m_iRefreshRate = 75; break;
|
||||
case 6: PREFSMAN->m_iRefreshRate = 80; break;
|
||||
case 7: PREFSMAN->m_iRefreshRate = 85; break;
|
||||
case 8: PREFSMAN->m_iRefreshRate = 90; break;
|
||||
case 9: PREFSMAN->m_iRefreshRate = 100; break;
|
||||
case 10:PREFSMAN->m_iRefreshRate = 120; break;
|
||||
default: ASSERT(0); PREFSMAN->m_iRefreshRate = 0; break;
|
||||
default:
|
||||
PREFSMAN->m_iRefreshRate = atoi( g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[RefreshOption] );
|
||||
}
|
||||
|
||||
PREFSMAN->m_BackgroundMode = PrefsManager::BackgroundMode( m_iSelectedOption[0][GO_BGMODE] );
|
||||
|
||||
@@ -8,15 +8,10 @@
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef SCREEN_GRAPHIC_OPTIONS_H
|
||||
#define SCREEN_GRAPHIC_OPTIONS_H
|
||||
|
||||
#include "Screen.h"
|
||||
#include "ScreenOptions.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "RandomSample.h"
|
||||
#include "TransitionFade.h"
|
||||
#include "Quad.h"
|
||||
|
||||
|
||||
class ScreenGraphicOptions : public ScreenOptions
|
||||
{
|
||||
@@ -32,4 +27,7 @@ private:
|
||||
|
||||
void GoToNextState();
|
||||
void GoToPrevState();
|
||||
int CurrentRefresh() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
+37
-12
@@ -921,27 +921,48 @@ int Song::GetNumTimesPlayed() const
|
||||
return iTotalNumTimesPlayed;
|
||||
}
|
||||
|
||||
/* Music paths and CDTitle paths for DWIs loaded fro ma DWI tree are
|
||||
* relative to the top of the tree.
|
||||
/* Search semantics for all song files:
|
||||
*
|
||||
* Files not loaded from a DWI tree may still have a path; if they
|
||||
* do, they're relative to the top SM directory (the cwd), so leave
|
||||
* them alone.
|
||||
* If the path doesn't have any directory separators, it's a filename in the
|
||||
* song directory.
|
||||
*
|
||||
* (Actually, I'm not sure if any files ever have a relative path--
|
||||
* one not beginning with .\--so only prepend the song path if it's
|
||||
* relative.)
|
||||
* If it does, it's relative to the top directory of the tree it was loaded
|
||||
* from, eg ".\music\stuff\song.ogg". Most of the time, that's the SM tree,
|
||||
* and that's the PWD, so just return it directly. If the file was originally
|
||||
* loaded from the DWIPath, it's relative to that, so prepend it.
|
||||
*
|
||||
* We can't do this stuff at load time, since these paths may
|
||||
* contain colons, and we can't store colons in our cache.
|
||||
* Some DWI's do have relative paths that don't start with ".\".
|
||||
*/
|
||||
|
||||
/* We only follow this for song files and cdtitles; it's for compatibility
|
||||
* with DWI. We prefer paths relative to the song directory; only support
|
||||
* that for all other paths. */
|
||||
|
||||
/* Note: Prepending the dwipath is ugly. The first impression might be to
|
||||
* add a Song::TopFilePath, but don't do that--we have too much stuff in there
|
||||
* already. We don't really need it; this is the only place it'd be used. What
|
||||
* we *should* be doing is prepending this path when we first load the song.
|
||||
* However, dwipaths are usually like "c:\games\dwi", and we can't store colons
|
||||
* in SM's; they'll get interpreted as delimiters. So:
|
||||
* XXX: Add some kind of escape character to SM's.
|
||||
*
|
||||
* -glenn */
|
||||
|
||||
CString Song::GetMusicPath() const
|
||||
{
|
||||
/* If there's no path in the music file, the file is in the same directory
|
||||
* as the song. (This is the preferred configuration.) */
|
||||
if( m_sMusicFile.Find('\\') == -1)
|
||||
return m_sSongDir+m_sMusicFile;
|
||||
|
||||
/* The file has a path. If it was loaded from the m_DWIPath, it's relative
|
||||
* to that. */
|
||||
if( PREFSMAN->m_DWIPath!="" && m_sSongDir.Left(PREFSMAN->m_DWIPath.GetLength()) == PREFSMAN->m_DWIPath )
|
||||
return PREFSMAN->m_DWIPath+"\\"+m_sMusicFile;
|
||||
|
||||
return m_sMusicFile.Left(2) == ".\\"? m_sMusicFile : m_sSongDir+m_sMusicFile;
|
||||
/* Otherwise, it's relative to the top of the SM directory (the CWD), so
|
||||
* return it directly. */
|
||||
return m_sMusicFile;
|
||||
}
|
||||
|
||||
CString Song::GetBannerPath() const
|
||||
@@ -955,11 +976,15 @@ CString Song::GetBackgroundPath() const
|
||||
}
|
||||
CString Song::GetCDTitlePath() const
|
||||
{
|
||||
if( m_sCDTitleFile.Find('\\') == -1)
|
||||
return m_sSongDir+m_sCDTitleFile;
|
||||
|
||||
if( PREFSMAN->m_DWIPath!="" && m_sSongDir.Left(PREFSMAN->m_DWIPath.GetLength()) == PREFSMAN->m_DWIPath )
|
||||
return PREFSMAN->m_DWIPath+"\\"+m_sCDTitleFile;
|
||||
|
||||
return m_sMusicFile.Left(2) == ".\\" ? m_sCDTitleFile : m_sSongDir+m_sCDTitleFile;
|
||||
return m_sCDTitleFile;
|
||||
}
|
||||
|
||||
CString Song::GetMovieBackgroundPath() const
|
||||
{
|
||||
return m_sSongDir+m_sMovieBackgroundFile;
|
||||
|
||||
@@ -40,6 +40,7 @@ RSC=rc.exe
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c
|
||||
@@ -78,7 +79,8 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../../smpackage-debug.exe" /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../smpackage-debug.exe" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /incremental:no
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user