more transparent m_DWIPath
This commit is contained in:
+9
-37
@@ -594,6 +594,12 @@ static bool ImageIsLoadable( const CString &sPath )
|
|||||||
/* Songs in BlacklistImages will never be autodetected as song images. */
|
/* Songs in BlacklistImages will never be autodetected as song images. */
|
||||||
void Song::TidyUpData()
|
void Song::TidyUpData()
|
||||||
{
|
{
|
||||||
|
m_sSongDir.Replace( '\\', '/' );
|
||||||
|
m_sBannerFile.Replace( '\\', '/' );
|
||||||
|
m_sLyricsFile.Replace( '\\', '/' );
|
||||||
|
m_sBackgroundFile.Replace( '\\', '/' );
|
||||||
|
m_sCDTitleFile.Replace( '\\', '/' );
|
||||||
|
|
||||||
if( !HasMusic() )
|
if( !HasMusic() )
|
||||||
{
|
{
|
||||||
CStringArray arrayPossibleMusic;
|
CStringArray arrayPossibleMusic;
|
||||||
@@ -1530,33 +1536,8 @@ int Song::GetNumTimesPlayed( MemoryCard card ) const
|
|||||||
return iTotalNumTimesPlayed;
|
return iTotalNumTimesPlayed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search semantics for all song files:
|
/* Note that supplying a path relative to the top-level directory is only for compatibility
|
||||||
*
|
* with DWI. We prefer paths relative to the song directory. */
|
||||||
* If the path doesn't have any directory separators, it's a filename in the
|
|
||||||
* song directory.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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
|
CString Song::GetMusicPath() const
|
||||||
{
|
{
|
||||||
/* If there's no path in the music file, the file is in the same directory
|
/* If there's no path in the music file, the file is in the same directory
|
||||||
@@ -1564,11 +1545,6 @@ CString Song::GetMusicPath() const
|
|||||||
if( m_sMusicFile.Find(SLASH[0]) == -1)
|
if( m_sMusicFile.Find(SLASH[0]) == -1)
|
||||||
return m_sSongDir+m_sMusicFile;
|
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+SLASH+m_sMusicFile;
|
|
||||||
|
|
||||||
/* Otherwise, it's relative to the top of the SM directory (the CWD), so
|
/* Otherwise, it's relative to the top of the SM directory (the CWD), so
|
||||||
* return it directly. */
|
* return it directly. */
|
||||||
return m_sMusicFile;
|
return m_sMusicFile;
|
||||||
@@ -1590,12 +1566,8 @@ CString Song::GetLyricsPath() const
|
|||||||
|
|
||||||
CString Song::GetCDTitlePath() const
|
CString Song::GetCDTitlePath() const
|
||||||
{
|
{
|
||||||
if( m_sCDTitleFile.Find('/') == -1)
|
if( m_sCDTitleFile.Find(SLASH[0]) != -1 )
|
||||||
return m_sSongDir+m_sCDTitleFile;
|
return m_sSongDir+m_sCDTitleFile;
|
||||||
|
|
||||||
if( PREFSMAN->m_DWIPath!="" && m_sSongDir.Left(PREFSMAN->m_DWIPath.GetLength()) == PREFSMAN->m_DWIPath )
|
|
||||||
return PREFSMAN->m_DWIPath+SLASH+m_sCDTitleFile;
|
|
||||||
|
|
||||||
return m_sCDTitleFile;
|
return m_sCDTitleFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,10 +146,6 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld )
|
|||||||
{
|
{
|
||||||
RageTimer tm;
|
RageTimer tm;
|
||||||
LoadStepManiaSongDir( SONGS_DIR, ld );
|
LoadStepManiaSongDir( SONGS_DIR, ld );
|
||||||
|
|
||||||
if( PREFSMAN->m_DWIPath != "" )
|
|
||||||
LoadStepManiaSongDir( PREFSMAN->m_DWIPath + "/Songs", ld );
|
|
||||||
|
|
||||||
LOG->Trace( "Found %d songs in %f seconds.", (int)m_pSongs.size(), tm.GetDeltaTime() );
|
LOG->Trace( "Found %d songs in %f seconds.", (int)m_pSongs.size(), tm.GetDeltaTime() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1145,9 +1141,6 @@ bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredG
|
|||||||
const CString sCourseSuffix = sPreferredGroup + SLASH + (bExtra2 ? "extra2" : "extra1") + ".crs";
|
const CString sCourseSuffix = sPreferredGroup + SLASH + (bExtra2 ? "extra2" : "extra1") + ".crs";
|
||||||
CString sCoursePath = SONGS_DIR + sCourseSuffix;
|
CString sCoursePath = SONGS_DIR + sCourseSuffix;
|
||||||
|
|
||||||
if( !DoesFileExist(sCoursePath) && PREFSMAN->m_DWIPath.size() )
|
|
||||||
sCoursePath = PREFSMAN->m_DWIPath + SLASH "Songs" SLASH + sCourseSuffix;
|
|
||||||
|
|
||||||
/* Couldn't find course in DWI path or alternative song folders */
|
/* Couldn't find course in DWI path or alternative song folders */
|
||||||
if( !DoesFileExist(sCoursePath) )
|
if( !DoesFileExist(sCoursePath) )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -828,6 +828,7 @@ int main(int argc, char* argv[])
|
|||||||
/* Set up alternative filesystem trees. */
|
/* Set up alternative filesystem trees. */
|
||||||
for( unsigned i=0; i<PREFSMAN->m_asAdditionalSongFolders.size(); i++ )
|
for( unsigned i=0; i<PREFSMAN->m_asAdditionalSongFolders.size(); i++ )
|
||||||
FILEMAN->Mount( "dir", PREFSMAN->m_asAdditionalSongFolders[i], "Songs" );
|
FILEMAN->Mount( "dir", PREFSMAN->m_asAdditionalSongFolders[i], "Songs" );
|
||||||
|
FILEMAN->Mount( "dir", PREFSMAN->m_DWIPath, "" );
|
||||||
|
|
||||||
GAMEMAN = new GameManager;
|
GAMEMAN = new GameManager;
|
||||||
THEME = new ThemeManager;
|
THEME = new ThemeManager;
|
||||||
|
|||||||
Reference in New Issue
Block a user