runs on Xbox
This commit is contained in:
@@ -12,13 +12,14 @@
|
||||
|
||||
#include "AnnouncerManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
AnnouncerManager* ANNOUNCER = NULL; // global object accessable from anywhere in the program
|
||||
|
||||
|
||||
const CString EMPTY_ANNOUNCER_NAME = "Empty";
|
||||
const CString ANNOUNCERS_DIR = "Announcers/";
|
||||
const CString ANNOUNCERS_DIR = BASE_PATH "Announcers" SLASH;
|
||||
|
||||
/* XXX: move to RageUtil when I feel like spending 20 minutes recompiling */
|
||||
/* Return true if "dir" is empty or does not exist. */
|
||||
@@ -69,7 +70,7 @@ bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName )
|
||||
|
||||
CString AnnouncerManager::GetAnnouncerDirFromName( CString sAnnouncerName )
|
||||
{
|
||||
return ANNOUNCERS_DIR + sAnnouncerName + "/";
|
||||
return ANNOUNCERS_DIR + sAnnouncerName + SLASH;
|
||||
}
|
||||
|
||||
void AnnouncerManager::SwitchAnnouncer( CString sNewAnnouncerName )
|
||||
@@ -115,8 +116,8 @@ CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName
|
||||
|
||||
const CString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName);
|
||||
|
||||
if( !DirectoryIsEmpty(AnnouncerPath+sFolderName+"/") )
|
||||
return AnnouncerPath+sFolderName+"/";
|
||||
if( !DirectoryIsEmpty(AnnouncerPath+sFolderName+SLASH) )
|
||||
return AnnouncerPath+sFolderName+SLASH;
|
||||
|
||||
/* Search for the announcer folder in the list of aliases. */
|
||||
int i;
|
||||
@@ -125,14 +126,14 @@ CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName
|
||||
if(sFolderName.CompareNoCase(aliases[i][0]))
|
||||
continue; /* no match */
|
||||
|
||||
if( !DirectoryIsEmpty(AnnouncerPath+aliases[i][1]+"/") )
|
||||
return AnnouncerPath+aliases[i][1]+"/";
|
||||
if( !DirectoryIsEmpty(AnnouncerPath+aliases[i][1]+SLASH) )
|
||||
return AnnouncerPath+aliases[i][1]+SLASH;
|
||||
}
|
||||
|
||||
/* No announcer directory matched. In debug, create the directory by
|
||||
* its preferred name. */
|
||||
#ifdef DEBUG
|
||||
LOG->Trace( "The announcer in \"%s\" is missing the folder '%s'.",
|
||||
LOG->Trace( "The announcer in '%s' is missing the folder '%s'.",
|
||||
AnnouncerPath.c_str(), sFolderName.c_str() );
|
||||
// MessageBeep( MB_OK );
|
||||
CreateDirectories( AnnouncerPath+sFolderName );
|
||||
|
||||
@@ -52,8 +52,8 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
|
||||
{
|
||||
Unload();
|
||||
|
||||
if( !sAniDir.empty() && sAniDir.Right(1) != "/" )
|
||||
sAniDir += "/";
|
||||
if( !sAniDir.empty() && sAniDir.Right(1) != SLASH )
|
||||
sAniDir += SLASH;
|
||||
|
||||
ASSERT( IsADirectory(sAniDir) );
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ActorUtil.h"
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
|
||||
const float PARTICLE_SPEED = 300;
|
||||
@@ -409,7 +410,7 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
||||
/*
|
||||
CString sDir, sFName, sExt;
|
||||
splitrelpath( sPath, sDir, sFName, sExt );
|
||||
CString sIniPath = sDir+"/"+sFName+".ini";
|
||||
CString sIniPath = sDir+SLASH+sFName+".ini";
|
||||
IniFile ini;
|
||||
ini.SetPath( sIniPath );
|
||||
if( ini.ReadFile() )
|
||||
@@ -454,11 +455,12 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
||||
{
|
||||
Init();
|
||||
if( sAniDir.Right(1) != "/" )
|
||||
sAniDir += "/";
|
||||
if( sAniDir.Right(1) != SLASH )
|
||||
sAniDir += SLASH;
|
||||
|
||||
ASSERT( IsADirectory(sAniDir) );
|
||||
|
||||
@@ -471,8 +473,12 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
||||
|
||||
CString sFile;
|
||||
ini.GetValue( sLayer, "File", sFile );
|
||||
FixSlashesInPlace( sFile );
|
||||
|
||||
CString sPath = sAniDir+sFile;
|
||||
LOG->Trace( "old path is '%s'", sPath.c_str() );
|
||||
CollapsePath( sPath );
|
||||
LOG->Trace( "new path is '%s'", sPath.c_str() );
|
||||
|
||||
if( sFile.CompareNoCase("songbackground")==0 )
|
||||
{
|
||||
@@ -506,17 +512,21 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
|
||||
GetDirListing( sPath + "*", asElementPaths, false, true );
|
||||
if(asElementPaths.size() == 0)
|
||||
{
|
||||
CString sError = ssprintf("In the ini file for BGAnimation '%s', the specified File '%s' does not exist.", sAniDir.c_str(), sFile.c_str());
|
||||
if( DISPLAY->IsWindowed() )
|
||||
HOOKS->MessageBoxOK( ssprintf("In the ini file for BGAnimation '%s', the specified File '%s' does not exist.", sAniDir.c_str(), sFile.c_str()) );
|
||||
HOOKS->MessageBoxOK( sError );
|
||||
LOG->Warn( sError );
|
||||
return;
|
||||
}
|
||||
if(asElementPaths.size() > 1)
|
||||
{
|
||||
if( DISPLAY->IsWindowed() )
|
||||
HOOKS->MessageBoxOK( ssprintf(
|
||||
CString sError = ssprintf(
|
||||
"There is more than one file that matches "
|
||||
"'%s/%s'. Please remove all but one of these matches.",
|
||||
sAniDir.c_str(), sFile.c_str() ) );
|
||||
sAniDir.c_str(), sFile.c_str() );
|
||||
if( DISPLAY->IsWindowed() )
|
||||
HOOKS->MessageBoxOK( sError );
|
||||
LOG->Warn( sError );
|
||||
}
|
||||
sPath = asElementPaths[0];
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "NoteTypes.h"
|
||||
#include <math.h> // for fmodf
|
||||
#include "DancingCharacters.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
const float FADE_SECONDS = 1.0f;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "arch/arch.h"
|
||||
#include "RageDisplay.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
@@ -19,6 +20,8 @@
|
||||
|
||||
#include "Banner.h"
|
||||
|
||||
#define CACHE_DIR BASE_PATH "Cache" SLASH
|
||||
|
||||
/* Call CacheBanner to cache a banner by path. If the banner is already
|
||||
* cached, it'll be recreated. This is efficient if the banner hasn't changed,
|
||||
* but we still only do this in TidyUpData for songs.
|
||||
@@ -47,7 +50,7 @@ CString BannerCache::GetBannerCachePath( CString BannerPath )
|
||||
{
|
||||
/* Use GetHashForString, not ForFile, since we don't want to spend time
|
||||
* checking the file size and date. */
|
||||
return ssprintf( "Cache/Banners/%u", GetHashForString(BannerPath) );
|
||||
return ssprintf( CACHE_DIR "Banners" SLASH "%u", GetHashForString(BannerPath) );
|
||||
}
|
||||
|
||||
void BannerCache::LoadBanner( CString BannerPath )
|
||||
@@ -112,8 +115,8 @@ void BannerCache::UnloadAllBanners()
|
||||
|
||||
BannerCache::BannerCache()
|
||||
{
|
||||
CreateDirectories("Cache/Banners/");
|
||||
BannerData.SetPath( "Cache/banners.cache" );
|
||||
CreateDirectories( CACHE_DIR "Banners" SLASH );
|
||||
BannerData.SetPath( CACHE_DIR "banners.cache" );
|
||||
BannerData.ReadFile(); // don't care if this fails
|
||||
}
|
||||
|
||||
|
||||
@@ -13,18 +13,19 @@
|
||||
#include "Character.h"
|
||||
#include "IniFile.h"
|
||||
#include "RageUtil.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
bool Character::Load( CString sCharDir )
|
||||
{
|
||||
// Save character directory
|
||||
if( sCharDir.Right(1)!="/" )
|
||||
sCharDir += '/';
|
||||
if( sCharDir.Right(1)!=SLASH )
|
||||
sCharDir += SLASH;
|
||||
m_sCharDir = sCharDir;
|
||||
|
||||
// Save character name
|
||||
vector<CString> as;
|
||||
split( sCharDir, "/", as );
|
||||
split( sCharDir, SLASH, as );
|
||||
m_sName = as.back();
|
||||
|
||||
// Save attacks
|
||||
@@ -52,9 +53,9 @@ CString GetRandomFileInDir( CString sDir )
|
||||
|
||||
|
||||
CString Character::GetModelPath() { return m_sCharDir + "model.txt"; }
|
||||
CString Character::GetRestAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); }
|
||||
CString Character::GetWarmUpAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp/")); }
|
||||
CString Character::GetDanceAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance/")); }
|
||||
CString Character::GetRestAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest" SLASH)); }
|
||||
CString Character::GetWarmUpAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "WarmUp" SLASH)); }
|
||||
CString Character::GetDanceAnimationPath() { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Dance" SLASH)); }
|
||||
CString Character::GetTakingABreakPath()
|
||||
{
|
||||
CStringArray as;
|
||||
|
||||
@@ -237,9 +237,9 @@ const int NUM_ATTACKS_PER_LEVEL = 3;
|
||||
const int ITEM_NONE = -1;
|
||||
|
||||
|
||||
#define BG_ANIMS_DIR CString("BGAnimations/")
|
||||
#define VISUALIZATIONS_DIR CString("Visualizations/")
|
||||
#define RANDOMMOVIES_DIR CString("RandomMovies/")
|
||||
#define BG_ANIMS_DIR CString(BASE_PATH "BGAnimations" SLASH)
|
||||
#define VISUALIZATIONS_DIR CString(BASE_PATH "Visualizations" SLASH)
|
||||
#define RANDOMMOVIES_DIR CString(BASE_PATH "RandomMovies" SLASH)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
const CString NOTESKIN_DIR = "NoteSkins/";
|
||||
|
||||
|
||||
const int DANCE_COL_SPACING = 64;
|
||||
const int DANCE_6PANEL_VERSUS_COL_SPACING = 54;
|
||||
const int PUMP_COL_SPACING = 50;
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
#include "Character.h"
|
||||
#include "UnlockSystem.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
#define CHARACTERS_DIR BASE_PATH "Characters" SLASH
|
||||
|
||||
GameState::GameState()
|
||||
{
|
||||
@@ -163,7 +165,7 @@ void GameState::ReloadCharacters()
|
||||
m_pCurCharacters[p] = NULL;
|
||||
|
||||
CStringArray as;
|
||||
GetDirListing( "Characters/*", as, true, true );
|
||||
GetDirListing( CHARACTERS_DIR "*", as, true, true );
|
||||
for( i=0; i<as.size(); i++ )
|
||||
{
|
||||
Character* pChar = new Character;
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
#include "RageUtil.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageInput.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
#define KEYMAPS_PATH BASE_PATH "Data" SLASH "Keymaps.ini"
|
||||
|
||||
InputMapper::InputMapper()
|
||||
{
|
||||
@@ -74,6 +76,7 @@ struct AutoJoyMapping
|
||||
struct {
|
||||
int deviceButton;
|
||||
GameButton gb;
|
||||
int iSlot;
|
||||
/* If this is true, this is an auxilliary mapping assigned to the second
|
||||
* player. If two of the same device are found, and the device has secondary
|
||||
* entries, the later entries take precedence. This way, if a Pump pad is
|
||||
@@ -93,10 +96,10 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
false,
|
||||
4,
|
||||
{
|
||||
{ JOY_16, DANCE_BUTTON_LEFT },
|
||||
{ JOY_14, DANCE_BUTTON_RIGHT },
|
||||
{ JOY_13, DANCE_BUTTON_UP },
|
||||
{ JOY_15, DANCE_BUTTON_DOWN },
|
||||
{ JOY_16, DANCE_BUTTON_LEFT, 1 },
|
||||
{ JOY_14, DANCE_BUTTON_RIGHT, 1 },
|
||||
{ JOY_13, DANCE_BUTTON_UP, 1 },
|
||||
{ JOY_15, DANCE_BUTTON_DOWN, 1 },
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -105,10 +108,10 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
false,
|
||||
4,
|
||||
{
|
||||
{ JOY_16, DANCE_BUTTON_LEFT },
|
||||
{ JOY_14, DANCE_BUTTON_RIGHT },
|
||||
{ JOY_13, DANCE_BUTTON_UP },
|
||||
{ JOY_15, DANCE_BUTTON_DOWN },
|
||||
{ JOY_16, DANCE_BUTTON_LEFT, 1 },
|
||||
{ JOY_14, DANCE_BUTTON_RIGHT, 1 },
|
||||
{ JOY_13, DANCE_BUTTON_UP, 1 },
|
||||
{ JOY_15, DANCE_BUTTON_DOWN, 1 },
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -117,18 +120,38 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
false,
|
||||
12,
|
||||
{
|
||||
{ JOY_LEFT, DANCE_BUTTON_LEFT },
|
||||
{ JOY_RIGHT, DANCE_BUTTON_RIGHT },
|
||||
{ JOY_UP, DANCE_BUTTON_UP },
|
||||
{ JOY_DOWN, DANCE_BUTTON_DOWN },
|
||||
{ JOY_1, DANCE_BUTTON_LEFT },
|
||||
{ JOY_3, DANCE_BUTTON_RIGHT },
|
||||
{ JOY_4, DANCE_BUTTON_UP },
|
||||
{ JOY_2, DANCE_BUTTON_DOWN },
|
||||
{ JOY_5, DANCE_BUTTON_UPLEFT },
|
||||
{ JOY_6, DANCE_BUTTON_UPRIGHT },
|
||||
{ JOY_9, DANCE_BUTTON_BACK },
|
||||
{ JOY_10, DANCE_BUTTON_START },
|
||||
{ JOY_LEFT, DANCE_BUTTON_LEFT, 1 },
|
||||
{ JOY_RIGHT, DANCE_BUTTON_RIGHT, 1 },
|
||||
{ JOY_UP, DANCE_BUTTON_UP, 1 },
|
||||
{ JOY_DOWN, DANCE_BUTTON_DOWN, 1 },
|
||||
{ JOY_1, DANCE_BUTTON_LEFT, 2 },
|
||||
{ JOY_3, DANCE_BUTTON_RIGHT, 2 },
|
||||
{ JOY_4, DANCE_BUTTON_UP, 2 },
|
||||
{ JOY_2, DANCE_BUTTON_DOWN, 2 },
|
||||
{ JOY_5, DANCE_BUTTON_UPLEFT, 1 },
|
||||
{ JOY_6, DANCE_BUTTON_UPRIGHT, 1 },
|
||||
{ JOY_9, DANCE_BUTTON_BACK, 1 },
|
||||
{ JOY_10, DANCE_BUTTON_START, 1 },
|
||||
}
|
||||
},
|
||||
{
|
||||
GAME_DANCE,
|
||||
"XBOX Gamepad Plugin V0.01",
|
||||
false,
|
||||
12,
|
||||
{
|
||||
{ JOY_HAT_LEFT, DANCE_BUTTON_LEFT, 1 },
|
||||
{ JOY_HAT_RIGHT, DANCE_BUTTON_RIGHT, 1 },
|
||||
{ JOY_HAT_UP, DANCE_BUTTON_UP, 1 },
|
||||
{ JOY_HAT_DOWN, DANCE_BUTTON_DOWN, 1 },
|
||||
{ JOY_1, DANCE_BUTTON_DOWN, 2 }, // A
|
||||
{ JOY_2, DANCE_BUTTON_RIGHT, 2 }, // B
|
||||
{ JOY_3, DANCE_BUTTON_LEFT, 2 }, // X
|
||||
{ JOY_4, DANCE_BUTTON_UP, 2 }, // Y
|
||||
{ JOY_7, DANCE_BUTTON_UPLEFT, 1 }, // L shoulder
|
||||
{ JOY_8, DANCE_BUTTON_UPRIGHT, 1 }, // R shoulder
|
||||
{ JOY_9, DANCE_BUTTON_START, 1 },
|
||||
{ JOY_10, DANCE_BUTTON_BACK, 1 },
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -137,21 +160,21 @@ const AutoJoyMapping g_AutoJoyMappings[] =
|
||||
false,
|
||||
11,
|
||||
{
|
||||
{ PUMP_UL, PUMP_BUTTON_UPLEFT },
|
||||
{ PUMP_UR, PUMP_BUTTON_UPRIGHT },
|
||||
{ PUMP_MID, PUMP_BUTTON_CENTER },
|
||||
{ PUMP_DL, PUMP_BUTTON_DOWNLEFT },
|
||||
{ PUMP_DR, PUMP_BUTTON_DOWNRIGHT },
|
||||
{ PUMP_ESCAPE, PUMP_BUTTON_BACK },
|
||||
{ PUMP_2P_UL, PUMP_BUTTON_UPLEFT, true },
|
||||
{ PUMP_2P_UR, PUMP_BUTTON_UPRIGHT, true },
|
||||
{ PUMP_2P_MID, PUMP_BUTTON_CENTER, true },
|
||||
{ PUMP_2P_DL, PUMP_BUTTON_DOWNLEFT, true },
|
||||
{ PUMP_2P_DR, PUMP_BUTTON_DOWNRIGHT, true },
|
||||
{ PUMP_UL, PUMP_BUTTON_UPLEFT, 1 },
|
||||
{ PUMP_UR, PUMP_BUTTON_UPRIGHT, 1 },
|
||||
{ PUMP_MID, PUMP_BUTTON_CENTER, 1 },
|
||||
{ PUMP_DL, PUMP_BUTTON_DOWNLEFT, 1 },
|
||||
{ PUMP_DR, PUMP_BUTTON_DOWNRIGHT, 1 },
|
||||
{ PUMP_ESCAPE, PUMP_BUTTON_BACK, 1 },
|
||||
{ PUMP_2P_UL, PUMP_BUTTON_UPLEFT, 1, true },
|
||||
{ PUMP_2P_UR, PUMP_BUTTON_UPRIGHT, 1, true },
|
||||
{ PUMP_2P_MID, PUMP_BUTTON_CENTER, 1, true },
|
||||
{ PUMP_2P_DL, PUMP_BUTTON_DOWNLEFT, 1, true },
|
||||
{ PUMP_2P_DR, PUMP_BUTTON_DOWNRIGHT, 1, true },
|
||||
}
|
||||
},
|
||||
};
|
||||
const int NUM_AUTO_JOY_MAPPINGS = sizeof(g_AutoJoyMappings) / sizeof(g_AutoJoyMappings[0]);
|
||||
const int NUM_AUTO_JOY_MAPPINGS = ARRAYSIZE(g_AutoJoyMappings);
|
||||
|
||||
void InputMapper::AutoMapJoysticksForCurrentGame()
|
||||
{
|
||||
@@ -195,7 +218,7 @@ void InputMapper::AutoMapJoysticksForCurrentGame()
|
||||
|
||||
DeviceInput di( device, mapping.mapping[k].deviceButton );
|
||||
GameInput gi( gc, mapping.mapping[k].gb );
|
||||
SetInputMap( di, gi, 1 );
|
||||
SetInputMap( di, gi, mapping.mapping[k].iSlot );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -210,9 +233,9 @@ void InputMapper::ReadMappingsFromDisk()
|
||||
ClearAllMappings();
|
||||
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/Keymaps.ini" );
|
||||
ini.SetPath( KEYMAPS_PATH );
|
||||
if( !ini.ReadFile() )
|
||||
LOG->Warn( "could not input mapping file \"Keymaps.ini\"." );
|
||||
LOG->Warn( "could not input mapping file '%s'.", KEYMAPS_PATH );
|
||||
|
||||
const IniFile::key *Key = ini.GetKey( GAMESTATE->GetCurrentGameDef()->m_szName );
|
||||
|
||||
@@ -247,7 +270,7 @@ void InputMapper::ReadMappingsFromDisk()
|
||||
void InputMapper::SaveMappingsToDisk()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/Keymaps.ini" );
|
||||
ini.SetPath( KEYMAPS_PATH );
|
||||
ini.ReadFile();
|
||||
|
||||
// erase the key so that we overwrite everything for this game
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "LyricsLoader.h"
|
||||
|
||||
#include <fstream>
|
||||
#include "RageFile.h"
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
@@ -21,7 +21,7 @@ bool LyricsLoader::LoadFromLRCFile( CString sPath, Song &out )
|
||||
{
|
||||
LOG->Trace( "LyricsLoader::LoadFromLRCFile(%s)", sPath.c_str() );
|
||||
|
||||
ifstream input(sPath);
|
||||
Rageifstream input(sPath);
|
||||
if(input.bad())
|
||||
{
|
||||
LOG->Warn( "Error opening file '%s' for reading.", sPath.c_str() );
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
#include "RageFile.h"
|
||||
|
||||
const float FRAMES_PER_SECOND = 30;
|
||||
const CString DEFAULT_ANIMATION_NAME = "default";
|
||||
@@ -77,7 +77,7 @@ bool Model::LoadMilkshapeAscii( CString sPath )
|
||||
CString sDir, sThrowAway;
|
||||
splitrelpath( sPath, sDir, sThrowAway, sThrowAway );
|
||||
|
||||
FILE *file = fopen (sPath, "rt");
|
||||
FILE *file = Ragefopen (sPath, "rt");
|
||||
if (!file)
|
||||
RageException::Throw( "Model::LoadMilkshapeAscii Could not open '%s'.", sPath.c_str() );
|
||||
|
||||
@@ -438,7 +438,7 @@ bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
|
||||
CString sDir, sThrowAway;
|
||||
splitrelpath( sPath, sDir, sThrowAway, sThrowAway );
|
||||
|
||||
FILE *file = fopen (sPath, "rt");
|
||||
FILE *file = Ragefopen (sPath, "rt");
|
||||
if (!file)
|
||||
RageException::Throw( "Model:: Could not open '%s'.", sPath.c_str() );
|
||||
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
#include "StyleDef.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameManager.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
NoteSkinManager* NOTESKIN = NULL; // global object accessable from anywhere in the program
|
||||
|
||||
|
||||
const CString BASE_NOTESKIN_NAME = "default";
|
||||
const CString NOTESKINS_DIR = "NoteSkins/";
|
||||
const CString NOTESKINS_DIR = BASE_PATH "NoteSkins" SLASH;
|
||||
|
||||
NoteSkinManager::NoteSkinManager()
|
||||
{
|
||||
@@ -39,7 +40,7 @@ void NoteSkinManager::RefreshNoteSkinData( Game game )
|
||||
{
|
||||
GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game );
|
||||
|
||||
CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + "/";
|
||||
CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + SLASH;
|
||||
CStringArray asNoteSkinNames;
|
||||
GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true );
|
||||
|
||||
@@ -112,7 +113,7 @@ CString NoteSkinManager::GetNoteSkinDir( CString sSkinName )
|
||||
{
|
||||
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||
|
||||
return NOTESKINS_DIR + ssprintf("%s/%s/", pGameDef->m_szName, sSkinName.c_str());
|
||||
return NOTESKINS_DIR + pGameDef->m_szName + SLASH + sSkinName + SLASH;
|
||||
}
|
||||
|
||||
CString NoteSkinManager::GetMetric( PlayerNumber pn, CString sButtonName, CString sValue ) // looks in GAMESTATE for the current Style
|
||||
|
||||
@@ -303,7 +303,7 @@ bool KSFLoader::LoadGlobalData( const CString &sPath, Song &out )
|
||||
/* Try to fill in missing bits of information from the pathname. */
|
||||
{
|
||||
CStringArray asBits;
|
||||
split( sPath, "/", asBits, true);
|
||||
split( sPath, SLASH, asBits, true);
|
||||
|
||||
ASSERT(asBits.size() > 1);
|
||||
LoadTags(asBits[asBits.size()-2], out);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "NoteData.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
/* Output is an angle bracket expression without angle brackets, eg. "468". */
|
||||
CString NotesWriterDWI::NotesToDWIString( const TapNote cNoteCols[6] )
|
||||
@@ -321,7 +322,7 @@ bool NotesWriterDWI::WriteDWINotesTag( FILE* fp, const Notes &out )
|
||||
|
||||
bool NotesWriterDWI::Write( CString sPath, const Song &out )
|
||||
{
|
||||
FILE* fp = fopen( sPath, "w" );
|
||||
FILE* fp = Ragefopen( sPath, "w" );
|
||||
if( fp == NULL )
|
||||
RageException::Throw( "Error opening song file '%s' for writing.", sPath.c_str() );
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
#include "RageException.h"
|
||||
#include "GameState.h"
|
||||
#include <math.h>
|
||||
#include "arch/arch.h"
|
||||
|
||||
#define AI_PATH BASE_PATH "Data" SLASH "AI.ini"
|
||||
|
||||
struct TapScoreDistribution
|
||||
{
|
||||
@@ -44,7 +46,7 @@ TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS];
|
||||
void PlayerAI::InitFromDisk()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/AI.ini" );
|
||||
ini.SetPath( AI_PATH );
|
||||
ini.ReadFile();
|
||||
|
||||
for( int i=0; i<NUM_SKILL_LEVELS; i++ )
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "arch/arch.h" /* for default driver specs */
|
||||
|
||||
#define STEPMANIA_INI_PATH BASE_PATH "Data" SLASH "StepMania.ini"
|
||||
#define GAMEPREFS_INI_PATH BASE_PATH "Data" SLASH "GamePrefs.ini"
|
||||
|
||||
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -141,7 +143,7 @@ PrefsManager::~PrefsManager()
|
||||
void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/StepMania.ini" );
|
||||
ini.SetPath( STEPMANIA_INI_PATH );
|
||||
if( !ini.ReadFile() )
|
||||
return; // could not read config file, load nothing
|
||||
|
||||
@@ -244,7 +246,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
|
||||
void PrefsManager::SaveGlobalPrefsToDisk()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/StepMania.ini" );
|
||||
ini.SetPath( STEPMANIA_INI_PATH );
|
||||
|
||||
ini.SetValueB( "Options", "Windowed", m_bWindowed );
|
||||
ini.SetValueI( "Options", "DisplayWidth", m_iDisplayWidth );
|
||||
@@ -348,7 +350,7 @@ void PrefsManager::ReadGamePrefsFromDisk()
|
||||
|
||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/GamePrefs.ini" );
|
||||
ini.SetPath( GAMEPREFS_INI_PATH );
|
||||
ini.ReadFile(); // it's OK if this fails
|
||||
|
||||
CString sAnnouncer = sGameName, sTheme = sGameName, sNoteSkin = sGameName;
|
||||
@@ -378,7 +380,7 @@ void PrefsManager::SaveGamePrefsToDisk()
|
||||
|
||||
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/GamePrefs.ini" );
|
||||
ini.SetPath( GAMEPREFS_INI_PATH );
|
||||
ini.ReadFile(); // it's OK if this fails
|
||||
|
||||
ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() );
|
||||
|
||||
@@ -84,7 +84,6 @@ void RageBitmapTexture::Create()
|
||||
/* Load the image into an SDL surface. */
|
||||
SDL_Surface *img = IMG_Load( GetID().filename );
|
||||
|
||||
|
||||
/* XXX: Wait, we don't want to throw for all images; in particular, we
|
||||
* want to tolerate corrupt/unknown background images. */
|
||||
if(img == NULL)
|
||||
@@ -257,6 +256,7 @@ apply_color_key:
|
||||
// texturePixfmt = FMT_ALPHA8;
|
||||
// }
|
||||
|
||||
|
||||
/* It's either not a paletted image, or we can't handle paletted textures.
|
||||
* Convert to the desired RGBA format, dithering if appropriate. */
|
||||
if( actualID.bDither &&
|
||||
@@ -286,7 +286,7 @@ apply_color_key:
|
||||
if( !DISPLAY->SupportsTextureFormat(pixfmt) )
|
||||
pixfmt = FMT_RGBA4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Convert the data to the destination format and dimensions
|
||||
* required by OpenGL if it's not in it already. */
|
||||
|
||||
@@ -169,12 +169,21 @@ static const PixelFormatDesc PIXEL_FORMAT_DESC[NUM_PIX_FORMATS] = {
|
||||
0x001F,
|
||||
0x0000 },
|
||||
}, {
|
||||
#if defined _XBOX
|
||||
/* A8B8G8R8 */
|
||||
32,
|
||||
{ 0x00FF0000,
|
||||
0x0000FF00,
|
||||
0x000000FF,
|
||||
0xFF000000 }
|
||||
#else
|
||||
/* B8G8R8 */
|
||||
24,
|
||||
{ 0xFF0000,
|
||||
0x00FF00,
|
||||
0x0000FF,
|
||||
0x000000 }
|
||||
#endif
|
||||
}, {
|
||||
/* Paletted */
|
||||
8,
|
||||
@@ -194,10 +203,10 @@ static D3DFORMAT D3DFORMATS[NUM_PIX_FORMATS] =
|
||||
D3DFMT_A4R4G4B4,
|
||||
D3DFMT_A1R5G5B5,
|
||||
D3DFMT_X1R5G5B5,
|
||||
#ifndef _XBOX
|
||||
D3DFMT_R8G8B8,
|
||||
#else
|
||||
#if defined _XBOX
|
||||
D3DFMT_A8R8G8B8,
|
||||
#else
|
||||
D3DFMT_R8G8B8,
|
||||
#endif
|
||||
D3DFMT_P8,
|
||||
D3DFMT_UNKNOWN, /* no BGR */
|
||||
@@ -258,6 +267,7 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
|
||||
* actually initialize the window. Do this after as many error conditions
|
||||
* as possible, because if we have to shut it down again we'll flash a window
|
||||
* briefly. */
|
||||
//#if defined _WINDOWS
|
||||
if(!SDL_WasInit(SDL_INIT_VIDEO))
|
||||
{
|
||||
if( SDL_InitSubSystem(SDL_INIT_VIDEO) == -1 )
|
||||
@@ -272,6 +282,7 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
|
||||
* of the SDL video system--it'll be reinitialized on us if we do this first. */
|
||||
SDL_EventState(0xFF /*SDL_ALLEVENTS*/, SDL_IGNORE);
|
||||
SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE);
|
||||
//#endif
|
||||
|
||||
g_PaletteIndex.clear();
|
||||
for( int i = 0; i < 256; ++i )
|
||||
@@ -280,17 +291,21 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
|
||||
// Save the original desktop format.
|
||||
g_pd3d->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &g_DesktopMode );
|
||||
|
||||
#if defined _WINDOWS
|
||||
// Create the SDL window
|
||||
int flags = SDL_RESIZABLE | SDL_SWSURFACE;
|
||||
SDL_Surface *screen = SDL_SetVideoMode(p.width, p.height, p.bpp, flags);
|
||||
if(!screen)
|
||||
RageException::Throw("SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
#endif
|
||||
|
||||
SetVideoMode( p );
|
||||
} catch(...) {
|
||||
// Clean up; ~RageDisplay will not be called.
|
||||
#if defined _WINDOWS
|
||||
if( SDL_WasInit(SDL_INIT_VIDEO) )
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
#endif
|
||||
|
||||
if( g_pd3d )
|
||||
{
|
||||
@@ -311,6 +326,7 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
|
||||
|
||||
void RageDisplay_D3D::Update(float fDeltaTime)
|
||||
{
|
||||
#if defined _WINDOWS
|
||||
SDL_Event event;
|
||||
while(SDL_GetEvent(event, SDL_VIDEORESIZEMASK))
|
||||
{
|
||||
@@ -325,6 +341,7 @@ void RageDisplay_D3D::Update(float fDeltaTime)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RageDisplay_D3D::IsSoftwareRenderer()
|
||||
@@ -336,8 +353,10 @@ RageDisplay_D3D::~RageDisplay_D3D()
|
||||
{
|
||||
LOG->Trace( "RageDisplay_D3D::~RageDisplay()" );
|
||||
|
||||
#if defined _WINDOWS
|
||||
SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
#endif
|
||||
|
||||
g_pd3dDevice->Release();
|
||||
g_pd3d->Release();
|
||||
@@ -367,7 +386,9 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
}
|
||||
if( !bWindowed && iBPP != 16 && iBPP != 32 )
|
||||
{
|
||||
#if defined _WINDOWS
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
|
||||
#endif
|
||||
throw RageException( ssprintf("Invalid BPP '%u' specified", iBPP) );
|
||||
}
|
||||
|
||||
@@ -400,7 +421,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
return (D3DFORMAT)-1;
|
||||
}
|
||||
|
||||
#ifndef _XBOX
|
||||
#if defined _WINDOWS
|
||||
HWND GetHwnd()
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
@@ -425,6 +446,7 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||
if( FindBackBufferType( p.windowed, p.bpp ) == -1 ) // no possible back buffer formats
|
||||
return false; // failed to set mode
|
||||
|
||||
#if defined _WINDOWS
|
||||
/* Set SDL window title and icon -before- creating the window */
|
||||
SDL_WM_SetCaption( p.sWindowTitle, "" );
|
||||
mySDL_WM_SetIcon( p.sIconFile );
|
||||
@@ -436,6 +458,7 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||
// SDL window only if we're not fullscreen.
|
||||
|
||||
SDL_ShowCursor( p.windowed );
|
||||
#endif
|
||||
|
||||
ZeroMemory( &g_d3dpp, sizeof(g_d3dpp) );
|
||||
g_d3dpp.BackBufferWidth = p.width;
|
||||
@@ -481,7 +504,9 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||
&g_pd3dDevice );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
#if defined _WINDOWS
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
|
||||
#endif
|
||||
RageException::Throw( "CreateDevice failed: '%s'", GetErrorString(hr).c_str() );
|
||||
}
|
||||
}
|
||||
@@ -491,13 +516,16 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||
hr = g_pd3dDevice->Reset( &g_d3dpp );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
#if defined _WINDOWS
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
|
||||
#endif
|
||||
RageException::Throw( "g_pd3dDevice->Reset failed: '%s'", GetErrorString(hr).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
if( p.windowed )
|
||||
{
|
||||
#if defined _WINDOWS
|
||||
int flags = SDL_RESIZABLE | SDL_SWSURFACE;
|
||||
|
||||
// Don't use SDL to change the video mode. This will cause a
|
||||
@@ -513,6 +541,7 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
|
||||
RageException::Throw("SDL_SetVideoMode failed: %s", SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ResolutionChanged();
|
||||
@@ -572,6 +601,15 @@ void RageDisplay_D3D::EndFrame()
|
||||
|
||||
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt )
|
||||
{
|
||||
#if defined _XBOX
|
||||
// Lazy... Xbox handles paletted textures completely differently
|
||||
// than D3D and I don't want to add a bunch of code for it. Also,
|
||||
// paletted textures result in worse cache efficiency (see "Xbox
|
||||
// Palettized Texture Performance" in XDK). So, we'll force 32bit
|
||||
// ARGB textures. -Chris
|
||||
return pixfmt == FMT_RGBA8;
|
||||
#endif
|
||||
|
||||
// Some cards (Savage) don't support alpha in palettes.
|
||||
// Don't allow paletted textures if this is the case.
|
||||
if( pixfmt == FMT_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) )
|
||||
@@ -969,12 +1007,28 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
ASSERT( xoffset+width <= int(desc.Width) );
|
||||
ASSERT( yoffset+height <= int(desc.Height) );
|
||||
|
||||
//
|
||||
// Copy bits
|
||||
//
|
||||
#if _XBOX
|
||||
// Xbox textures need to be swizzled
|
||||
XGSwizzleRect(
|
||||
img->pixels, // pSource,
|
||||
img->pitch, // Pitch,
|
||||
NULL, // pRect,
|
||||
lr.pBits, // pDest,
|
||||
img->w, // Width,
|
||||
img->h, // Height,
|
||||
NULL, // pPoint,
|
||||
img->format->BytesPerPixel ); //BytesPerPixel
|
||||
#else
|
||||
int texpixfmt;
|
||||
for(texpixfmt = 0; texpixfmt < NUM_PIX_FORMATS; ++texpixfmt)
|
||||
if(D3DFORMATS[texpixfmt] == desc.Format) break;
|
||||
ASSERT( texpixfmt != NUM_PIX_FORMATS );
|
||||
|
||||
SDL_Surface *Texture = CreateSurfaceFromPixfmt(PixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
|
||||
ASSERT( Texture );
|
||||
SDL_Rect area;
|
||||
area.x = area.y = 0;
|
||||
area.w = (Uint16) width;
|
||||
@@ -985,17 +1039,8 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
mySDL_BlitSurface( img, Texture, width, height, false );
|
||||
|
||||
SDL_FreeSurface( Texture );
|
||||
|
||||
#if 0
|
||||
// copy each row
|
||||
int bytes_per_pixel = img->format->BytesPerPixel;
|
||||
for( int y=rect.top; y<rect.bottom; y++ )
|
||||
{
|
||||
char* src = (char*)img->pixels + y*img->pitch + rect.left*bytes_per_pixel;
|
||||
char* dst = (char*)lr.pBits + y*lr.Pitch + rect.left*bytes_per_pixel;
|
||||
memcpy( dst, src, (rect.right-rect.left)*bytes_per_pixel );
|
||||
}
|
||||
#endif
|
||||
|
||||
pTex->UnlockRect( 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#include "global.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: RageFile
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "RageFile.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
|
||||
void FixSlashesInPlace( CString &sPath )
|
||||
{
|
||||
sPath.Replace( "/", SLASH );
|
||||
sPath.Replace( "\\", SLASH );
|
||||
}
|
||||
|
||||
CString FixSlashes( CString sPath )
|
||||
{
|
||||
sPath.Replace( "/", SLASH );
|
||||
sPath.Replace( "\\", SLASH );
|
||||
return sPath;
|
||||
}
|
||||
|
||||
void CollapsePath( CString &sPath )
|
||||
{
|
||||
CStringArray as;
|
||||
split( sPath, SLASH, as );
|
||||
|
||||
for( unsigned i=0; i<as.size(); i++ )
|
||||
{
|
||||
if( as[i] == ".." )
|
||||
{
|
||||
as.erase( as.begin()+i-1 );
|
||||
as.erase( as.begin()+i-1 );
|
||||
i -= 2;
|
||||
}
|
||||
}
|
||||
sPath = join( SLASH, as );
|
||||
}
|
||||
|
||||
// replacement for fopen
|
||||
FILE* Ragefopen( const char *szPath, const char *szMode )
|
||||
{
|
||||
return fopen( FixSlashes(szPath), szMode );
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef RageFile_H
|
||||
#define RageFile_H
|
||||
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: RageFile
|
||||
|
||||
Desc: Encapsulates C and C++ file classes to deal with arch-specific oddities.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
using namespace std; // using "std::ifstream" causes problems below in VC6. Why?!?
|
||||
|
||||
void FixSlashesInPlace( CString &sPath );
|
||||
CString FixSlashes( CString sPath );
|
||||
|
||||
void CollapsePath( CString &sPath );
|
||||
|
||||
FILE* Ragefopen( const char *szPath, const char *szMode );
|
||||
|
||||
// replacement for ifstream
|
||||
class Rageifstream : public std::ifstream
|
||||
{
|
||||
public:
|
||||
Rageifstream() {};
|
||||
Rageifstream( const char *szPath ) : ifstream(FixSlashes(szPath)) {}
|
||||
void open( const char *szPath ) { ifstream::open(FixSlashes(szPath)); }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -27,8 +27,9 @@ RageInput::RageInput()
|
||||
|
||||
/* If no input devices are loaded, the user won't be able to input anything.
|
||||
* That should never happen. */
|
||||
if(Devices.size() == 0)
|
||||
RageException::Throw("No input devices were loaded. This shouldn't happen; please file a bug.");
|
||||
/* Temporarily commented out until Xbox is working. -Chris */
|
||||
// if(Devices.size() == 0)
|
||||
// RageException::Throw("No input devices were loaded. This shouldn't happen; please file a bug.");
|
||||
}
|
||||
|
||||
RageInput::~RageInput()
|
||||
|
||||
@@ -215,9 +215,8 @@ void RageSoundManager::PlayOnceFromDir( CString sDir )
|
||||
return;
|
||||
|
||||
// make sure there's a slash at the end of this path
|
||||
sDir.Replace("\\", "/");
|
||||
if( sDir[sDir.GetLength()-1] != '/' )
|
||||
sDir += "/";
|
||||
if( sDir.Right(1) != SLASH )
|
||||
sDir += SLASH;
|
||||
|
||||
CStringArray arraySoundFiles;
|
||||
GetDirListing( sDir + "*.mp3", arraySoundFiles );
|
||||
|
||||
@@ -6,19 +6,23 @@
|
||||
* something wrong with my SDL_sound MAD wrapper ...
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static_d.lib")
|
||||
#ifdef _XBOX
|
||||
// #ifdef DEBUG
|
||||
// #pragma comment(lib, "SDL_sound-1.0.0/lib/xbox_sdl_sound_static_d.lib")
|
||||
// #else
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/xbox_sdl_sound_static.lib")
|
||||
// #endif
|
||||
#else
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static.lib")
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static_d.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/sdl_sound_static.lib")
|
||||
#endif
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/ogg_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbis_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbisfile_static.lib")
|
||||
#endif
|
||||
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/ogg_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbis_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbisfile_static.lib")
|
||||
|
||||
#endif
|
||||
|
||||
#include "RageSoundReader_SDL_Sound.h"
|
||||
|
||||
|
||||
@@ -5,10 +5,29 @@
|
||||
#include "RageUtil.h"
|
||||
#include "SDL_utils.h"
|
||||
#include "RageSoundReader_Vorbisfile.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "vorbis/vorbisfile.h"
|
||||
#else
|
||||
#include "tremor/ivorbisfile.h"
|
||||
#endif
|
||||
|
||||
#if defined _XBOX
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/xbox_ogg_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/xbox_vorbis_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/xbox_vorbisfile_static.lib")
|
||||
#elif defined _WINDOWS
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/ogg_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbis_static.lib")
|
||||
#pragma comment(lib, "SDL_sound-1.0.0/lib/vorbisfile_static.lib")
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
#include "RageFile.h"
|
||||
|
||||
/* What is this file, and why is it needed? Seems to compile on
|
||||
* Win32 w/o it. -Chris */
|
||||
//#include <sys/errno.h>
|
||||
|
||||
|
||||
const int channels = 2;
|
||||
@@ -21,7 +40,7 @@ bool RageSoundReader_Vorbisfile::Open(CString filename_)
|
||||
filename=filename_;
|
||||
|
||||
vf = new OggVorbis_File;
|
||||
FILE *f = fopen(filename, "r");
|
||||
FILE *f = Ragefopen(filename, "r");
|
||||
if(f == NULL)
|
||||
{
|
||||
SetError(ssprintf("ogg fopen(%s) failed: %s", filename.c_str(), strerror(errno)));
|
||||
@@ -81,7 +100,12 @@ int RageSoundReader_Vorbisfile::Read(char *buf, unsigned len)
|
||||
char tmpbuf[4096];
|
||||
int bstream;
|
||||
|
||||
#ifdef _XBOX // float vorbis decoder
|
||||
int ret = ov_read(vf, tmpbuf, sizeof(tmpbuf), 0, 2, 1, &bstream);
|
||||
#else // integer vorbis decoder
|
||||
int ret = ov_read(vf, tmpbuf, sizeof(tmpbuf), &bstream);
|
||||
#endif
|
||||
|
||||
//int ret = 4096;
|
||||
//memset(tmpbuf, 0, sizeof(tmpbuf));
|
||||
if(ret == OV_HOLE)
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageUtil_FileDB.h"
|
||||
#include "RageLog.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
#include <numeric>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <fstream>
|
||||
#include "RageFile.h"
|
||||
#include <map>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -298,12 +299,11 @@ bool CreateDirectories( CString Path )
|
||||
{
|
||||
CStringArray parts;
|
||||
CString curpath;
|
||||
Path.Replace("\\", "/");
|
||||
split(Path, "/", parts);
|
||||
split(Path, SLASH, parts);
|
||||
|
||||
for(unsigned i = 0; i < parts.size(); ++i)
|
||||
{
|
||||
curpath += parts[i] + "/";
|
||||
curpath += parts[i] + SLASH;
|
||||
if(mkdir( curpath, 0755 ))
|
||||
continue;
|
||||
|
||||
@@ -404,7 +404,7 @@ unsigned int GetHashForDirectory( CString sDir )
|
||||
hash += GetHashForFile( sDir );
|
||||
|
||||
CStringArray arrayFiles;
|
||||
GetDirListing( sDir+"/*", arrayFiles, false );
|
||||
GetDirListing( sDir+"*", arrayFiles, false );
|
||||
for( unsigned i=0; i<arrayFiles.size(); i++ )
|
||||
{
|
||||
const CString sFilePath = sDir + arrayFiles[i];
|
||||
@@ -491,7 +491,7 @@ CString DerefRedir(const CString &path)
|
||||
|
||||
CString sNewFileName;
|
||||
{
|
||||
ifstream file(path);
|
||||
Rageifstream file(path);
|
||||
getline(file, sNewFileName);
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ CString GetRedirContents(const CString &path)
|
||||
|
||||
CString sNewFileName;
|
||||
{
|
||||
ifstream file(path);
|
||||
Rageifstream file(path);
|
||||
getline(file, sNewFileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
|
||||
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
||||
|
||||
#define ZERO(x) memset(&x, 0, sizeof(x))
|
||||
#define COPY(a,b) { ASSERT(sizeof(a)==sizeof(b)); memcpy(&a, &b, sizeof(a)); }
|
||||
#define ZERO(x) memset(&x, 0, sizeof(x))
|
||||
#define COPY(a,b) { ASSERT(sizeof(a)==sizeof(b)); memcpy(&a, &b, sizeof(a)); }
|
||||
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
/* Common harmless mismatches. All min(T,T) and max(T,T) cases are handled
|
||||
* by the generic template we get from <algorithm>. */
|
||||
|
||||
@@ -9,19 +9,13 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <RageFile.h>
|
||||
#include "arch/arch.h"
|
||||
|
||||
#if !defined(WIN32)
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
static void GetCwd(CString &s)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
bool ret = getcwd(buf, PATH_MAX) != NULL;
|
||||
ASSERT(ret);
|
||||
|
||||
s = buf;
|
||||
}
|
||||
|
||||
struct File {
|
||||
istring name;
|
||||
@@ -59,19 +53,12 @@ void FileSet::LoadFromDir(const CString &dir)
|
||||
age.GetDeltaTime(); /* reset */
|
||||
files.clear();
|
||||
|
||||
CString oldpath;
|
||||
GetCwd(oldpath);
|
||||
if(chdir(dir) == -1) return;
|
||||
|
||||
#if defined(WIN32)
|
||||
WIN32_FIND_DATA fd;
|
||||
HANDLE hFind = FindFirstFile( "*", &fd );
|
||||
HANDLE hFind = FindFirstFile( dir+SLASH "*", &fd );
|
||||
|
||||
if( hFind == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
chdir(oldpath);
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
if(!strcmp(fd.cFileName, ".") || !strcmp(fd.cFileName, ".."))
|
||||
@@ -85,7 +72,7 @@ void FileSet::LoadFromDir(const CString &dir)
|
||||
} while( FindNextFile( hFind, &fd ) );
|
||||
FindClose(hFind);
|
||||
#else
|
||||
DIR *d = opendir(".");
|
||||
DIR *d = opendir(dir+"/.");
|
||||
|
||||
while(struct dirent *ent = readdir(d))
|
||||
{
|
||||
@@ -116,7 +103,6 @@ void FileSet::LoadFromDir(const CString &dir)
|
||||
|
||||
closedir(d);
|
||||
#endif
|
||||
chdir(oldpath);
|
||||
}
|
||||
|
||||
/* Search for "beginning*containing*ending". */
|
||||
@@ -195,7 +181,7 @@ static void SplitPath( CString Path, CString &Dir, CString &Name )
|
||||
Name = match[1];
|
||||
} else {
|
||||
/* No slash. */
|
||||
Dir = "./";
|
||||
Dir = "." SLASH;
|
||||
Name = Path;
|
||||
}
|
||||
}
|
||||
@@ -261,18 +247,16 @@ bool FilenameDB::ResolvePath(CString &path)
|
||||
if(path == ".") return true;
|
||||
if(path == "") return true;
|
||||
|
||||
path.Replace("\\", "/");
|
||||
|
||||
/* Split path into components. */
|
||||
vector<CString> p;
|
||||
split(path, "/", p, true);
|
||||
split(path, SLASH, p, true);
|
||||
|
||||
/* Resolve each component. Assume the first component is correct. XXX
|
||||
* don't do that! "Songs/" vs "songs/" */
|
||||
CString ret = p[0];
|
||||
for(unsigned i = 1; i < p.size(); ++i)
|
||||
{
|
||||
ret += "/";
|
||||
ret += SLASH;
|
||||
|
||||
vector<CString> lst;
|
||||
FileSet &fs = GetFileSet(ret.c_str());
|
||||
@@ -282,14 +266,14 @@ bool FilenameDB::ResolvePath(CString &path)
|
||||
if(lst.empty()) return false;
|
||||
|
||||
if(lst.size() > 1)
|
||||
LOG->Warn("Ambiguous filenames \"%s\" and \"%s\"",
|
||||
LOG->Warn("Ambiguous filenames '%s' and '%s'",
|
||||
lst[0].c_str(), lst[1].c_str());
|
||||
|
||||
ret += lst[0];
|
||||
}
|
||||
|
||||
if(path[path.size()-1] == '/')
|
||||
path = ret + "/";
|
||||
if(path.Right(1) == SLASH)
|
||||
path = ret + SLASH;
|
||||
else
|
||||
path = ret;
|
||||
return true;
|
||||
@@ -335,8 +319,9 @@ void FilenameDB::GetFilesSimpleMatch(const CString &dir, const CString &fn, vect
|
||||
FileSet &FilenameDB::GetFileSet(CString dir, bool ResolveCase)
|
||||
{
|
||||
/* Normalize the path. */
|
||||
dir.Replace("\\", "/"); /* foo\bar -> foo/bar */
|
||||
dir.Replace("//", "/"); /* foo//bar -> foo/bar */
|
||||
dir.Replace("\\", SLASH); /* foo\bar -> foo/bar */
|
||||
dir.Replace("/", SLASH); /* foo//bar -> foo/bar */
|
||||
dir.Replace("//", SLASH); /* foo//bar -> foo/bar */
|
||||
|
||||
FileSet *ret;
|
||||
map<istring, FileSet *>::iterator i = dirs.find(dir.c_str());
|
||||
@@ -381,6 +366,8 @@ FilenameDB FDB;
|
||||
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
{
|
||||
// LOG->Trace( "GetDirListing( %s )", sPath.c_str() );
|
||||
|
||||
/* If you want the CWD, use ".". */
|
||||
ASSERT(!sPath.empty());
|
||||
|
||||
@@ -389,7 +376,7 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bRe
|
||||
* prepend "./" */
|
||||
|
||||
/* Strip off the last path element and use it as a mask. */
|
||||
unsigned pos = sPath.find_last_of("/\\");
|
||||
unsigned pos = sPath.find_last_of( SLASH );
|
||||
CString fn;
|
||||
if(pos != sPath.npos)
|
||||
{
|
||||
@@ -414,6 +401,11 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bRe
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
// LOG->Trace( "dir is '%s'", sPath.c_str() );
|
||||
// LOG->Trace( "Found:" );
|
||||
// for( unsigned i=0; i<AddTo.size(); i++ )
|
||||
// LOG->Trace( AddTo[i] );
|
||||
}
|
||||
|
||||
bool ResolvePath(CString &path) { return FDB.ResolvePath(path); }
|
||||
|
||||
@@ -52,20 +52,18 @@ bool RandomSample::LoadSoundDir( CString sDir, int iMaxToLoad )
|
||||
if( sDir == "" )
|
||||
return true;
|
||||
|
||||
sDir.Replace("\\", "/");
|
||||
|
||||
#if 0
|
||||
/* (don't want to do this just yet) */
|
||||
/* If this is actually a directory, add a backslash to the filename,
|
||||
* so we'll look for eg. themes\Default\sounds\sDir\*.mp3. Otherwise,
|
||||
* don't, so we'll look for all of the files starting with sDir,
|
||||
* eg. themes\Default\sounds\sDir*.mp3. */
|
||||
if(IsADirectory(sDir) && sDir[sDir.GetLength()-1] != '/' )
|
||||
sDir += "/";
|
||||
if(IsADirectory(sDir) && sDir[sDir.GetLength()-1] != SLASH )
|
||||
sDir += SLASH;
|
||||
#else
|
||||
// make sure there's a slash at the end of this path
|
||||
if( sDir[sDir.GetLength()-1] != '/' )
|
||||
sDir += "/";
|
||||
if( sDir.Right(1) != SLASH )
|
||||
sDir += SLASH;
|
||||
#endif
|
||||
|
||||
CStringArray arraySoundFiles;
|
||||
|
||||
+19
-12
@@ -12,21 +12,28 @@
|
||||
#include "SDL.h"
|
||||
#include "SDL_utils.h"
|
||||
#include "SDL_endian.h"
|
||||
|
||||
#if defined(WIN32)
|
||||
#include "RageFile.h"
|
||||
|
||||
/* Pull in all of our SDL libraries here. */
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLd.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/SDL_imaged.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDL.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/SDL_image.lib")
|
||||
#ifdef _XBOX
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDLx-0.02/SDLxd.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/xbox_SDL_imaged.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDLx-0.02/SDLx.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/xbox_SDL_image.lib")
|
||||
#endif
|
||||
#elif defined _WINDOWS
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLd.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/SDL_imaged.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDL.lib")
|
||||
#pragma comment(lib, "SDL_image-1.2/SDL_image.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Uint32 mySDL_Swap24(Uint32 x)
|
||||
{
|
||||
return SDL_Swap32(x) >> 8; // xx223344 -> 443322xx -> 00443322
|
||||
@@ -598,7 +605,7 @@ struct SurfaceHeader
|
||||
/* Save and load SDL_Surfaces to disk. This avoids problems with bitmaps. */
|
||||
bool mySDL_SaveSurface( SDL_Surface *img, CString file )
|
||||
{
|
||||
FILE *f = fopen(file.c_str(), "wb+");
|
||||
FILE *f = Ragefopen(file.c_str(), "wb+");
|
||||
if(f == NULL)
|
||||
return false;
|
||||
|
||||
@@ -636,7 +643,7 @@ bool mySDL_SaveSurface( SDL_Surface *img, CString file )
|
||||
|
||||
SDL_Surface *mySDL_LoadSurface( CString file )
|
||||
{
|
||||
FILE *f = fopen(file.c_str(), "rb");
|
||||
FILE *f = Ragefopen(file.c_str(), "rb");
|
||||
if(f == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Notes.h"
|
||||
#include <utility>
|
||||
#include "NoteFieldPositioning.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
|
||||
const float RECORD_HOLD_SECONDS = 0.3f;
|
||||
|
||||
+19
-17
@@ -29,6 +29,8 @@
|
||||
#include "BannerCache.h"
|
||||
#include "Sprite.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "arch/arch.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
#include "NotesLoaderSM.h"
|
||||
#include "NotesLoaderDWI.h"
|
||||
@@ -42,6 +44,7 @@
|
||||
#include "SDL.h"
|
||||
#include "SDL_image.h"
|
||||
|
||||
#define CACHE_DIR BASE_PATH "Cache" SLASH
|
||||
|
||||
const int FILE_CACHE_VERSION = 126; // increment this when Song or Notes changes to invalidate cache
|
||||
|
||||
@@ -292,7 +295,7 @@ float Song::GetElapsedTimeFromBeat( float fBeat ) const
|
||||
|
||||
CString Song::GetCacheFilePath() const
|
||||
{
|
||||
return ssprintf( "Cache/Songs/%u", GetHashForString(m_sSongDir) );
|
||||
return ssprintf( CACHE_DIR "Songs" SLASH "%u", GetHashForString(m_sSongDir) );
|
||||
}
|
||||
|
||||
/* Get a path to the SM containing data for this song. It might
|
||||
@@ -361,17 +364,16 @@ bool Song::LoadFromSongDir( CString sDir )
|
||||
// LOG->Trace( "Song::LoadFromSongDir(%s)", sDir.c_str() );
|
||||
ASSERT( sDir != "" );
|
||||
|
||||
sDir.Replace("\\", "/");
|
||||
// make sure there is a trailing slash at the end of sDir
|
||||
if( sDir.Right(1) != "/" )
|
||||
sDir += "/";
|
||||
if( sDir.Right(1) != SLASH )
|
||||
sDir += SLASH;
|
||||
|
||||
// save song dir
|
||||
m_sSongDir = sDir;
|
||||
|
||||
// save group name
|
||||
CStringArray sDirectoryParts;
|
||||
split( m_sSongDir, "/", sDirectoryParts, false );
|
||||
split( m_sSongDir, SLASH, sDirectoryParts, false );
|
||||
m_sGroupName = sDirectoryParts[sDirectoryParts.size()-3]; // second from last item
|
||||
|
||||
//
|
||||
@@ -534,9 +536,8 @@ void Song::TidyUpData()
|
||||
{
|
||||
/* Use the song directory name. */
|
||||
CString SongDir = this->GetSongDir();
|
||||
SongDir.Replace("\\", "/");
|
||||
vector<CString> parts;
|
||||
split(SongDir, "/", parts);
|
||||
split(SongDir, SLASH, parts);
|
||||
ASSERT(parts.size() > 0);
|
||||
|
||||
NotesLoader::GetMainAndSubTitlesFromFullTitle( parts[parts.size()-1], m_sMainTitle, m_sSubTitle );
|
||||
@@ -598,11 +599,11 @@ void Song::TidyUpData()
|
||||
LOG->Trace("Looking for images...");
|
||||
|
||||
/* Replace backslashes with slashes in all paths. */
|
||||
m_sMusicFile.Replace("\\", "/");
|
||||
m_sBannerFile.Replace("\\", "/");
|
||||
m_sBackgroundFile.Replace("\\", "/");
|
||||
m_sCDTitleFile.Replace("\\", "/");
|
||||
m_sLyricsFile.Replace("\\", "/");
|
||||
FixSlashes( m_sMusicFile );
|
||||
FixSlashes( m_sBannerFile );
|
||||
FixSlashes( m_sBackgroundFile );
|
||||
FixSlashes( m_sCDTitleFile );
|
||||
FixSlashes( m_sLyricsFile );
|
||||
|
||||
/* Many imported files contain erroneous whitespace before or after
|
||||
* filenames. Paths usually don't actually start or end with spaces,
|
||||
@@ -691,11 +692,12 @@ void Song::TidyUpData()
|
||||
if( HasCDTitle() && stricmp(m_sCDTitleFile, arrayImages[i])==0 )
|
||||
continue; // skip
|
||||
|
||||
SDL_Surface *img = IMG_Load( m_sSongDir + arrayImages[i] );
|
||||
CString sPath = m_sSongDir + arrayImages[i];
|
||||
SDL_Surface *img = IMG_Load( sPath );
|
||||
if( !img )
|
||||
{
|
||||
LOG->Trace("Couldn't load %s%s: %s",
|
||||
m_sSongDir.c_str(), arrayImages[i].c_str(), SDL_GetError());
|
||||
LOG->Trace("Couldn't load '%s': %s",
|
||||
sPath.c_str(), SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1464,7 +1466,7 @@ CString Song::GetMusicPath() const
|
||||
/* 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 PREFSMAN->m_DWIPath+SLASH+m_sMusicFile;
|
||||
|
||||
/* Otherwise, it's relative to the top of the SM directory (the CWD), so
|
||||
* return it directly. */
|
||||
@@ -1487,7 +1489,7 @@ CString Song::GetCDTitlePath() const
|
||||
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 PREFSMAN->m_DWIPath+SLASH+m_sCDTitleFile;
|
||||
|
||||
return m_sCDTitleFile;
|
||||
}
|
||||
|
||||
@@ -7,13 +7,16 @@
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "song.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
#define CACHE_DIR BASE_PATH "Cache" SLASH
|
||||
|
||||
SongCacheIndex *SONGINDEX;
|
||||
|
||||
SongCacheIndex::SongCacheIndex()
|
||||
{
|
||||
CreateDirectories( "Cache/Songs" );
|
||||
CacheIndex.SetPath( "Cache/index.cache" );
|
||||
CreateDirectories( CACHE_DIR "Songs" );
|
||||
CacheIndex.SetPath( CACHE_DIR "index.cache" );
|
||||
ReadCacheIndex();
|
||||
}
|
||||
|
||||
@@ -48,9 +51,9 @@ void SongCacheIndex::ReadCacheIndex()
|
||||
return; /* OK */
|
||||
|
||||
LOG->Trace( "Cache format is out of date. Deleting all cache files." );
|
||||
EmptyDir( "Cache/" );
|
||||
EmptyDir( "Cache/Banners/" );
|
||||
EmptyDir( "Cache/Songs/" );
|
||||
EmptyDir( CACHE_DIR );
|
||||
EmptyDir( CACHE_DIR "Banners" SLASH );
|
||||
EmptyDir( CACHE_DIR "Songs" SLASH );
|
||||
|
||||
CacheIndex.Reset();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "RageLog.h"
|
||||
#include "NotesLoaderDWI.h"
|
||||
#include "BannerCache.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
#include "GameState.h"
|
||||
#include "PrefsManager.h"
|
||||
@@ -26,15 +27,16 @@
|
||||
#include "ThemeManager.h"
|
||||
#include "GameManager.h"
|
||||
|
||||
#include <fstream>
|
||||
#include "RageFile.h"
|
||||
|
||||
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
const CString CATEGORY_RANKING_FILE = "Data/CategoryRanking.dat";
|
||||
const CString COURSE_RANKING_FILE = "Data/CourseRanking.dat";
|
||||
const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { "Data/Player1NotesScores.dat", "Data/Player2NotesScores.dat", "Data/MachineNotesScores.dat" };
|
||||
const CString COURSE_SCORES_FILE[NUM_MEMORY_CARDS] = { "Data/Player1CourseScores.dat", "Data/Player2CourseScores.dat", "Data/MachineCourseScores.dat" };
|
||||
#define SONGS_DIR BASE_PATH "Songs" SLASH
|
||||
#define COURSES_DIR BASE_PATH "Courses" SLASH
|
||||
const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat";
|
||||
const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat";
|
||||
const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1NotesScores.dat", BASE_PATH "Data" SLASH "Player2NotesScores.dat", BASE_PATH "Data" SLASH "MachineNotesScores.dat" };
|
||||
const CString COURSE_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1CourseScores.dat", BASE_PATH "Data" SLASH "Player2CourseScores.dat", BASE_PATH "Data" SLASH "MachineCourseScores.dat" };
|
||||
const int CATEGORY_RANKING_VERSION = 1;
|
||||
const int COURSE_RANKING_VERSION = 1;
|
||||
const int NOTES_SCORES_VERSION = 2;
|
||||
@@ -80,13 +82,24 @@ SongManager::SongManager( LoadingWindow *ld )
|
||||
SongManager::~SongManager()
|
||||
{
|
||||
SaveMachineScoresToDisk();
|
||||
|
||||
FreeSongArray();
|
||||
}
|
||||
|
||||
void SongManager::SaveMachineScoresToDisk()
|
||||
{
|
||||
SaveCategoryRankingsToFile( CATEGORY_RANKING_FILE );
|
||||
SaveCourseRankingsToFile( COURSE_RANKING_FILE );
|
||||
for( int c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
{
|
||||
SaveNoteScoresToFile( NOTES_SCORES_FILE[c], c );
|
||||
SaveCourseScoresToFile( COURSE_SCORES_FILE[c], c );
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::InitSongArrayFromDisk( LoadingWindow *ld )
|
||||
{
|
||||
LoadStepManiaSongDir( "Songs", ld );
|
||||
LoadStepManiaSongDir( SONGS_DIR, ld );
|
||||
|
||||
for( unsigned i=0; i<PREFSMAN->m_asAdditionalSongFolders.size(); i++ )
|
||||
LoadStepManiaSongDir( PREFSMAN->m_asAdditionalSongFolders[i], ld );
|
||||
@@ -133,7 +146,7 @@ void SongManager::AddGroup( CString sDir, CString sGroupDirName )
|
||||
|
||||
CString sBannerPath;
|
||||
if( !arrayGroupBanners.empty() )
|
||||
sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ;
|
||||
sBannerPath = sDir+sGroupDirName+SLASH+arrayGroupBanners[0] ;
|
||||
else
|
||||
{
|
||||
// Look for a group banner in the parent folder
|
||||
@@ -155,7 +168,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
|
||||
{
|
||||
/* Make sure sDir has a trailing slash. */
|
||||
TrimRight( sDir, "/\\" );
|
||||
sDir += "/";
|
||||
sDir += SLASH;
|
||||
|
||||
// Find all group directories in "Songs" folder
|
||||
CStringArray arrayGroupDirs;
|
||||
@@ -173,7 +186,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
|
||||
|
||||
// Find all Song folders in this group directory
|
||||
CStringArray arraySongDirs;
|
||||
GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true );
|
||||
GetDirListing( sDir+sGroupDirName + SLASH "*", arraySongDirs, true, true );
|
||||
SortCStringArray( arraySongDirs );
|
||||
|
||||
unsigned j;
|
||||
@@ -239,7 +252,7 @@ void SongManager::ReloadSongArray()
|
||||
|
||||
void SongManager::ReadNoteScoresFromFile( CString fn, int c )
|
||||
{
|
||||
ifstream f(fn);
|
||||
Rageifstream f(fn);
|
||||
if( !f.good() )
|
||||
return;
|
||||
CString line;
|
||||
@@ -302,7 +315,7 @@ void SongManager::ReadNoteScoresFromFile( CString fn, int c )
|
||||
|
||||
void SongManager::ReadCourseScoresFromFile( CString fn, int c )
|
||||
{
|
||||
FILE* fp = fopen( fn, "r" );
|
||||
FILE* fp = Ragefopen( fn, "r" );
|
||||
|
||||
if( !fp )
|
||||
return;
|
||||
@@ -342,7 +355,7 @@ void SongManager::ReadCourseScoresFromFile( CString fn, int c )
|
||||
|
||||
void SongManager::ReadCategoryRankingsFromFile( CString fn )
|
||||
{
|
||||
FILE* fp = fopen( fn, "r" );
|
||||
FILE* fp = Ragefopen( fn, "r" );
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
@@ -365,7 +378,7 @@ void SongManager::ReadCategoryRankingsFromFile( CString fn )
|
||||
|
||||
void SongManager::ReadCourseRankingsFromFile( CString fn )
|
||||
{
|
||||
FILE* fp = fopen( fn, "r" );
|
||||
FILE* fp = Ragefopen( fn, "r" );
|
||||
|
||||
if( !fp )
|
||||
return;
|
||||
@@ -432,28 +445,31 @@ void SongManager::InitMachineScoresFromDisk()
|
||||
ReadCourseScoresFromFile( COURSE_SCORES_FILE[c], c );
|
||||
}
|
||||
|
||||
void SongManager::SaveMachineScoresToDisk()
|
||||
|
||||
void SongManager::SaveCategoryRankingsToFile( CString fn )
|
||||
{
|
||||
// category ranking
|
||||
LOG->Trace("Writing category ranking");
|
||||
{
|
||||
FILE* fp = fopen( CATEGORY_RANKING_FILE, "w" );
|
||||
if( fp )
|
||||
{
|
||||
fprintf(fp,"%d\n",CATEGORY_RANKING_VERSION);
|
||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||
if( fp )
|
||||
fprintf(fp, "%i %s\n", m_MachineScores[i][j][k].iScore, m_MachineScores[i][j][k].sName.c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
FILE* fp = Ragefopen( fn, "w" );
|
||||
if( fp )
|
||||
{
|
||||
fprintf(fp,"%d\n",CATEGORY_RANKING_VERSION);
|
||||
for( int i=0; i<NUM_NOTES_TYPES; i++ )
|
||||
for( int j=0; j<NUM_RANKING_CATEGORIES; j++ )
|
||||
for( int k=0; k<NUM_RANKING_LINES; k++ )
|
||||
if( fp )
|
||||
fprintf(fp, "%i %s\n", m_MachineScores[i][j][k].iScore, m_MachineScores[i][j][k].sName.c_str());
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::SaveCourseRankingsToFile( CString fn )
|
||||
{
|
||||
// course ranking
|
||||
LOG->Trace("Writing course ranking");
|
||||
{
|
||||
FILE* fp = fopen( COURSE_RANKING_FILE, "w" );
|
||||
FILE* fp = Ragefopen( fn, "w" );
|
||||
|
||||
if( fp )
|
||||
{
|
||||
@@ -482,11 +498,14 @@ void SongManager::SaveMachineScoresToDisk()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SongManager::SaveNoteScoresToFile( CString fn, int c )
|
||||
{
|
||||
// notes scores
|
||||
LOG->Trace("Writing note scores");
|
||||
for( int c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
{
|
||||
FILE* fp = fopen( NOTES_SCORES_FILE[c], "w" );
|
||||
FILE* fp = Ragefopen( fn, "w" );
|
||||
if( fp )
|
||||
{
|
||||
fprintf(fp,"%d\n",NOTES_SCORES_VERSION);
|
||||
@@ -533,36 +552,36 @@ void SongManager::SaveMachineScoresToDisk()
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::SaveCourseScoresToFile( CString fn, int c )
|
||||
{
|
||||
// course scores
|
||||
LOG->Trace("Writing course scores");
|
||||
{
|
||||
for( int c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
FILE* fp = Ragefopen( fn, "w" );
|
||||
if( fp )
|
||||
{
|
||||
FILE* fp = fopen( COURSE_SCORES_FILE[c], "w" );
|
||||
if( fp )
|
||||
fprintf(fp,"%d\n",COURSE_SCORES_VERSION);
|
||||
|
||||
for( unsigned i=0; i<m_pCourses.size(); i++ ) // foreach song
|
||||
{
|
||||
fprintf(fp,"%d\n",COURSE_SCORES_VERSION);
|
||||
Course* pCourse = m_pCourses[i];
|
||||
ASSERT(pCourse);
|
||||
|
||||
for( unsigned i=0; i<m_pCourses.size(); i++ ) // foreach song
|
||||
{
|
||||
Course* pCourse = m_pCourses[i];
|
||||
ASSERT(pCourse);
|
||||
|
||||
if( pCourse->m_bIsAutogen )
|
||||
fprintf(fp, "%s\n", pCourse->m_sName.c_str());
|
||||
else
|
||||
fprintf(fp, "%s\n", pCourse->m_sPath.c_str());
|
||||
|
||||
for( int nt=0; nt<NUM_NOTES_TYPES; nt++ )
|
||||
fprintf(fp, "%d %d %f\n",
|
||||
pCourse->m_MemCardScores[c][nt].iNumTimesPlayed,
|
||||
pCourse->m_MemCardScores[c][nt].iScore,
|
||||
pCourse->m_MemCardScores[c][nt].fSurviveTime);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
if( pCourse->m_bIsAutogen )
|
||||
fprintf(fp, "%s\n", pCourse->m_sName.c_str());
|
||||
else
|
||||
fprintf(fp, "%s\n", pCourse->m_sPath.c_str());
|
||||
|
||||
for( int nt=0; nt<NUM_NOTES_TYPES; nt++ )
|
||||
fprintf(fp, "%d %d %f\n",
|
||||
pCourse->m_MemCardScores[c][nt].iNumTimesPlayed,
|
||||
pCourse->m_MemCardScores[c][nt].iScore,
|
||||
pCourse->m_MemCardScores[c][nt].fSurviveTime);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,7 +743,7 @@ void SongManager::InitCoursesFromDisk()
|
||||
// Load courses from in Courses dir
|
||||
//
|
||||
CStringArray saCourseFiles;
|
||||
GetDirListing( "Courses/*.crs", saCourseFiles, false, true );
|
||||
GetDirListing( COURSES_DIR "*.crs", saCourseFiles, false, true );
|
||||
for( i=0; i<saCourseFiles.size(); i++ )
|
||||
{
|
||||
Course* pCourse = new Course;
|
||||
@@ -735,7 +754,7 @@ void SongManager::InitCoursesFromDisk()
|
||||
|
||||
// Find all group directories in Courses dir
|
||||
CStringArray arrayGroupDirs;
|
||||
GetDirListing( "Courses/*", arrayGroupDirs, true );
|
||||
GetDirListing( COURSES_DIR "*", arrayGroupDirs, true );
|
||||
SortCStringArray( arrayGroupDirs );
|
||||
|
||||
for( i=0; i< arrayGroupDirs.size(); i++ ) // for each dir in /Courses/
|
||||
@@ -747,7 +766,7 @@ void SongManager::InitCoursesFromDisk()
|
||||
|
||||
// Find all CRS files in this group directory
|
||||
CStringArray arrayCoursePaths;
|
||||
GetDirListing( "Courses/"+sGroupDirName + "/*.crs", arrayCoursePaths, false, true );
|
||||
GetDirListing( COURSES_DIR + sGroupDirName + "/*.crs", arrayCoursePaths, false, true );
|
||||
SortCStringArray( arrayCoursePaths );
|
||||
|
||||
for( unsigned j=0; j<arrayCoursePaths.size(); j++ )
|
||||
@@ -843,21 +862,21 @@ void SongManager::GetEndlessCourses( vector<Course*> &AddTo, bool bIncludeAutoge
|
||||
bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
||||
Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out )
|
||||
{
|
||||
const CString sCourseSuffix = sPreferredGroup + "/" + (bExtra2 ? "extra2" : "extra1") + ".crs";
|
||||
CString sCoursePath = "Songs/" + sCourseSuffix;
|
||||
const CString sCourseSuffix = sPreferredGroup + SLASH + (bExtra2 ? "extra2" : "extra1") + ".crs";
|
||||
CString sCoursePath = SONGS_DIR + sCourseSuffix;
|
||||
if( !DoesFileExist(sCoursePath) )
|
||||
{
|
||||
/* try alternative song folders */
|
||||
for( unsigned i=0; i<PREFSMAN->m_asAdditionalSongFolders.size(); i++ )
|
||||
{
|
||||
sCoursePath = PREFSMAN->m_asAdditionalSongFolders[i] + "/" + sCourseSuffix;
|
||||
sCoursePath = PREFSMAN->m_asAdditionalSongFolders[i] + SLASH + sCourseSuffix;
|
||||
if( DoesFileExist(sCoursePath) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !DoesFileExist(sCoursePath) && PREFSMAN->m_DWIPath.size() )
|
||||
sCoursePath = PREFSMAN->m_DWIPath + "/Songs/" + sCourseSuffix;
|
||||
sCoursePath = PREFSMAN->m_DWIPath + SLASH "Songs" SLASH + sCourseSuffix;
|
||||
|
||||
/* Couldn't find course in DWI path or alternative song folders */
|
||||
if( !DoesFileExist(sCoursePath) )
|
||||
|
||||
@@ -122,6 +122,11 @@ protected:
|
||||
void ReadCourseRankingsFromFile( CString fn );
|
||||
Song *FindSong( CString sGroup, CString sSong );
|
||||
|
||||
void SaveNoteScoresToFile( CString fn, int c );
|
||||
void SaveCourseScoresToFile( CString fn, int c );
|
||||
void SaveCategoryRankingsToFile( CString fn );
|
||||
void SaveCourseRankingsToFile( CString fn );
|
||||
|
||||
vector<Song*> m_pSongs; // all songs that can be played
|
||||
vector<Song*> m_pBestSongs;
|
||||
CStringArray m_arrayGroupNames;
|
||||
|
||||
@@ -48,7 +48,7 @@ Sprite::~Sprite()
|
||||
bool Sprite::LoadBG( RageTextureID ID )
|
||||
{
|
||||
ID.iMipMaps = 1;
|
||||
ID.bDither = true;
|
||||
// ID.bDither = true;
|
||||
return Load(ID);
|
||||
}
|
||||
|
||||
@@ -175,6 +175,8 @@ void Sprite::EnableAnimation( bool bEnable )
|
||||
|
||||
bool Sprite::LoadFromTexture( RageTextureID ID )
|
||||
{
|
||||
LOG->Trace( "Sprite::LoadFromTexture( %s )", ID.filename.c_str() );
|
||||
|
||||
if( !m_pTexture || !(m_pTexture->GetID() == ID) )
|
||||
{
|
||||
/* Load the texture if it's not already loaded. We still need
|
||||
|
||||
+28
-15
@@ -50,16 +50,24 @@
|
||||
#include "BannerCache.h"
|
||||
#include "UnlockSystem.h"
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmain.lib")
|
||||
#if defined(_XBOX)
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/xboxSDLmaind.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/xboxSDLmain.lib")
|
||||
#endif
|
||||
#elif defined(_WINDOWS)
|
||||
#ifdef DEBUG
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmaind.lib")
|
||||
#else
|
||||
#pragma comment(lib, "SDL-1.2.5/lib/SDLmain.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HWND g_hWndMain = NULL;
|
||||
#endif
|
||||
|
||||
@@ -71,6 +79,7 @@ static bool g_bQuitting = false;
|
||||
|
||||
static void ChangeToDirOfExecutable(const char *argv0)
|
||||
{
|
||||
#ifndef _XBOX
|
||||
/* Make sure the current directory is the root program directory
|
||||
* We probably shouldn't do this; rather, we should know where things
|
||||
* are and use paths as needed, so we don't depend on the binary being
|
||||
@@ -84,6 +93,7 @@ static void ChangeToDirOfExecutable(const char *argv0)
|
||||
|
||||
chdir( dir.c_str() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ApplyGraphicOptions()
|
||||
@@ -275,6 +285,8 @@ static void CheckSettings()
|
||||
|
||||
static const CString D3DURL = "http://search.microsoft.com/gomsuri.asp?n=1&c=rp_BestBets&siteid=us&target=http://www.microsoft.com/downloads/details.aspx?FamilyID=a19bed22-0b25-4e5d-a584-6389d8a3dad0&displaylang=en";
|
||||
|
||||
#define VIDEOCARDS_INI_PATH BASE_PATH "Data" SLASH "VideoCardDefaults.ini"
|
||||
|
||||
RageDisplay *CreateDisplay()
|
||||
{
|
||||
/* We never want to bother users with having to decide which API to use.
|
||||
@@ -301,10 +313,9 @@ RageDisplay *CreateDisplay()
|
||||
*/
|
||||
|
||||
// Video card changed since last run
|
||||
#if defined(WIN32)
|
||||
#if defined(_WINDOWS)
|
||||
CString sVideoDriver = GetPrimaryVideoDriverName();
|
||||
#endif
|
||||
#if !defined(WIN32)
|
||||
#else
|
||||
CString sVideoDriver = "OpenGL";
|
||||
#endif
|
||||
if( PREFSMAN->m_sVideoRenderers == "" ||
|
||||
@@ -312,9 +323,9 @@ RageDisplay *CreateDisplay()
|
||||
{
|
||||
// Apply default graphic settings for this card
|
||||
IniFile ini;
|
||||
ini.SetPath( "Data/VideoCardDefaults.ini" );
|
||||
ini.SetPath( VIDEOCARDS_INI_PATH );
|
||||
if(!ini.ReadFile())
|
||||
RageException::Throw( "Couldn't read Data/VideoCardDefaults.ini." );
|
||||
RageException::Throw( "Couldn't read '%s'." VIDEOCARDS_INI_PATH );
|
||||
|
||||
IniFile::const_iterator i;
|
||||
for( i = ini.begin(); i != ini.end(); ++i )
|
||||
@@ -339,10 +350,9 @@ RageDisplay *CreateDisplay()
|
||||
ini.GetValueB( sKey, "AntiAliasing", PREFSMAN->m_bAntiAliasing );
|
||||
|
||||
// Update last seen video card
|
||||
#if defined(WIN32)
|
||||
#if defined(_WINDOWS)
|
||||
PREFSMAN->m_sLastSeenVideoDriver = GetPrimaryVideoDriverName();
|
||||
#endif
|
||||
#if !defined(WIN32)
|
||||
#else
|
||||
PREFSMAN->m_sLastSeenVideoDriver = "OpenGL";
|
||||
#endif
|
||||
|
||||
@@ -425,6 +435,9 @@ static void RestoreAppPri()
|
||||
#endif
|
||||
}
|
||||
|
||||
#define UNLOCKS_PATH BASE_PATH "Data" SLASH "Unlocks.dat"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
g_argc = argc;
|
||||
@@ -533,7 +546,7 @@ int main(int argc, char* argv[])
|
||||
ResetGame();
|
||||
|
||||
/* Load the unlocks into memory */
|
||||
GAMESTATE->m_pUnlockingSys->LoadFromDATFile("Data/Unlocks.dat");
|
||||
GAMESTATE->m_pUnlockingSys->LoadFromDATFile( UNLOCKS_PATH );
|
||||
|
||||
/* Run the main loop. */
|
||||
GameLoop();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int SMmain(int argc, char* argv[]);
|
||||
void ApplyGraphicOptions();
|
||||
void ExitGame();
|
||||
void ResetGame();
|
||||
|
||||
@@ -23,13 +23,15 @@
|
||||
#include "FontCharAliases.h"
|
||||
#include "RageDisplay.h"
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
#include "arch/arch.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
|
||||
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
|
||||
|
||||
|
||||
const CString BASE_THEME_NAME = "default";
|
||||
const CString THEMES_DIR = "Themes/";
|
||||
const CString THEMES_DIR = BASE_PATH "Themes" SLASH;
|
||||
const CString ELEMENT_CATEGORY_STRING[NUM_ELEMENT_CATEGORIES] =
|
||||
{
|
||||
"BGAnimations",
|
||||
@@ -57,7 +59,7 @@ ThemeManager::~ThemeManager()
|
||||
|
||||
void ThemeManager::GetThemeNames( CStringArray& AddTo )
|
||||
{
|
||||
GetDirListing( THEMES_DIR+"/*", AddTo, true );
|
||||
GetDirListing( THEMES_DIR + "*", AddTo, true );
|
||||
|
||||
// strip out the folder called "CVS"
|
||||
for( CStringArray::iterator i=AddTo.begin(); i != AddTo.end(); ++i )
|
||||
@@ -104,7 +106,7 @@ void ThemeManager::SwitchTheme( CString sThemeName )
|
||||
|
||||
CString ThemeManager::GetThemeDirFromName( const CString &sThemeName )
|
||||
{
|
||||
return THEMES_DIR + sThemeName + "/";
|
||||
return THEMES_DIR + sThemeName + SLASH;
|
||||
}
|
||||
|
||||
CString ThemeManager::GetPathTo( CString sThemeName, ElementCategory category, CString sFileName )
|
||||
@@ -125,12 +127,12 @@ try_element_again:
|
||||
|
||||
if( bLookingForSpecificFile )
|
||||
{
|
||||
GetDirListing( sThemeDir + sCategory+"/"+sFileName, asElementPaths, bDirsOnly, true );
|
||||
GetDirListing( sThemeDir + sCategory+SLASH+sFileName, asElementPaths, bDirsOnly, true );
|
||||
}
|
||||
else // look for all files starting with sFileName that have types we can use
|
||||
{
|
||||
/* First, look for redirs. */
|
||||
GetDirListing( sThemeDir + sCategory+"/"+sFileName + ".redir",
|
||||
GetDirListing( sThemeDir + sCategory + SLASH + sFileName + ".redir",
|
||||
asElementPaths, false, true );
|
||||
|
||||
static const char *masks[NUM_ELEMENT_CATEGORIES][12] = {
|
||||
@@ -143,7 +145,7 @@ try_element_again:
|
||||
const char **asset_masks = masks[category];
|
||||
|
||||
for( int i = 0; asset_masks[i]; ++i )
|
||||
GetDirListing( sThemeDir + sCategory+"/" + sFileName + asset_masks[i],
|
||||
GetDirListing( sThemeDir + sCategory + SLASH + sFileName + asset_masks[i],
|
||||
asElementPaths, bDirsOnly, true );
|
||||
if( category == Fonts )
|
||||
Font::WeedFontNames(asElementPaths, sFileName);
|
||||
@@ -223,6 +225,7 @@ try_element_again:
|
||||
|
||||
CString ThemeManager::GetPathTo( ElementCategory category, CString sFileName, bool bOptional )
|
||||
{
|
||||
// TODO: Use HOOKS->MessageBox()
|
||||
#if defined(DEBUG) && defined(WIN32)
|
||||
try_element_again:
|
||||
#endif
|
||||
@@ -230,6 +233,7 @@ try_element_again:
|
||||
CString ret = GetPathTo( m_sCurThemeName, category, sFileName);
|
||||
if( !ret.empty() ) // we found something
|
||||
return ret;
|
||||
|
||||
ret = GetPathTo( BASE_THEME_NAME, category, sFileName);
|
||||
if( !ret.empty() ) // we found something
|
||||
return ret;
|
||||
@@ -239,14 +243,14 @@ try_element_again:
|
||||
CString sCategory = ELEMENT_CATEGORY_STRING[category];
|
||||
|
||||
#if defined(DEBUG) && defined(WIN32)
|
||||
CString sMessage = ssprintf("The theme element '%s/%s' is missing.",sCategory.c_str(),sFileName.c_str());
|
||||
CString sMessage = "The theme element '" + sCategory + SLASH + sFileName +"' is missing.";
|
||||
switch( MessageBox(NULL, sMessage, "ThemeManager", MB_RETRYCANCEL ) )
|
||||
{
|
||||
case IDRETRY:
|
||||
FlushDirCache();
|
||||
goto try_element_again;
|
||||
case IDCANCEL:
|
||||
RageException::Throw( "Theme element '%s/%s' could not be found in '%s' or '%s'.",
|
||||
RageException::Throw( "Theme element '%s" SLASH "%s' could not be found in '%s' or '%s'.",
|
||||
sCategory.c_str(),
|
||||
sFileName.c_str(),
|
||||
GetThemeDirFromName(m_sCurThemeName).c_str(),
|
||||
@@ -256,7 +260,7 @@ try_element_again:
|
||||
#endif
|
||||
|
||||
LOG->Warn(
|
||||
"Theme element '%s/%s' could not be found in '%s' or '%s'.",
|
||||
"Theme element '%s" SLASH "%s' could not be found in '%s' or '%s'.",
|
||||
sCategory.c_str(),
|
||||
sFileName.c_str(),
|
||||
GetThemeDirFromName(m_sCurThemeName).c_str(),
|
||||
@@ -264,7 +268,7 @@ try_element_again:
|
||||
|
||||
/* Err? */
|
||||
if(sFileName == "_missing")
|
||||
RageException::Throw("_missing element missing from %s/%s", GetThemeDirFromName(BASE_THEME_NAME).c_str(), sCategory.c_str() );
|
||||
RageException::Throw("'_missing' isn't present in '%s%s'", GetThemeDirFromName(BASE_THEME_NAME).c_str(), sCategory.c_str() );
|
||||
return GetPathTo( category, "_missing" );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#include "global.h"
|
||||
#include "TitleSubstitution.h"
|
||||
#include "arch/arch.h"
|
||||
|
||||
#include "RageUtil.h"
|
||||
#include "FontCharAliases.h"
|
||||
|
||||
#include <fstream>
|
||||
#include "RageFile.h"
|
||||
|
||||
#define TRANSLATION_PATH BASE_PATH "Data" SLASH "Translation.dat"
|
||||
|
||||
struct TitleTrans
|
||||
{
|
||||
@@ -92,12 +95,12 @@ void TitleSubst::Subst(CString &title, CString &subtitle, CString &artist,
|
||||
|
||||
TitleSubst::TitleSubst(const CString §ion)
|
||||
{
|
||||
Load("data/Translation.dat", section);
|
||||
Load( TRANSLATION_PATH, section);
|
||||
}
|
||||
|
||||
void TitleSubst::Load(const CString &filename, const CString §ion)
|
||||
{
|
||||
ifstream f;
|
||||
Rageifstream f;
|
||||
f.open(filename);
|
||||
if(!f.good()) return;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "IniFile.h"
|
||||
#include "RageFile.h"
|
||||
|
||||
|
||||
Transition::Transition()
|
||||
@@ -24,8 +25,8 @@ Transition::Transition()
|
||||
|
||||
void Transition::Load( CString sBGAniDir )
|
||||
{
|
||||
if( !sBGAniDir.empty() && sBGAniDir.Right(1) != "/" )
|
||||
sBGAniDir += "/";
|
||||
if( !sBGAniDir.empty() && sBGAniDir.Right(1) != SLASH )
|
||||
sBGAniDir += SLASH;
|
||||
|
||||
m_BGAnimation.LoadFromAniDir( sBGAniDir );
|
||||
|
||||
@@ -39,9 +40,16 @@ void Transition::Load( CString sBGAniDir )
|
||||
|
||||
CString sSoundFileName;
|
||||
if( ini.GetValue("BGAnimation","Sound",sSoundFileName) )
|
||||
m_sound.Load( sBGAniDir+sSoundFileName );
|
||||
{
|
||||
FixSlashesInPlace( sSoundFileName );
|
||||
CString sPath = sBGAniDir+sSoundFileName;
|
||||
CollapsePath( sPath );
|
||||
m_sound.Load( sPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sound.Load( sBGAniDir );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -114,4 +114,5 @@ ArchHooks::MessageBoxResult ArchHooks_Win32::MessageBoxAbortRetryIgnore( CString
|
||||
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
|
||||
*
|
||||
* Glenn Maynard
|
||||
* Chris Danford
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef LOW_LEVEL_WINDOW_SDL_H
|
||||
#define LOW_LEVEL_WINDOW_SDL_H
|
||||
|
||||
#include "LowLevelWindow.h"
|
||||
|
||||
class LowLevelWindow_Null: public LowLevelWindow
|
||||
{
|
||||
RageDisplay::VideoModeParams CurrentParams;
|
||||
public:
|
||||
LowLevelWindow_Null() {};
|
||||
~LowLevelWindow_Null() {};
|
||||
void *GetProcAddress(CString s) { return NULL; };
|
||||
bool TryVideoMode( RageDisplay::VideoModeParams p, bool &bNewDeviceOut ) { return false; };
|
||||
void SwapBuffers() {};
|
||||
void Update(float fDeltaTime) {};
|
||||
|
||||
RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; }
|
||||
};
|
||||
#undef ARCH_LOW_LEVEL_WINDOW
|
||||
#define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_Null
|
||||
|
||||
#endif
|
||||
@@ -13,7 +13,7 @@
|
||||
#define DEFAULT_MOVIE_DRIVER_LIST "Null"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include "RageFile.h"
|
||||
bool RageMovieTexture::GetFourCC( CString fn, CString &handler, CString &type )
|
||||
{
|
||||
CString ignore, ext;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#pragma comment(lib, "dsound.lib")
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
//#pragma comment(lib, "dxguid.lib")
|
||||
|
||||
BOOL CALLBACK DSound::EnumCallback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageSound.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "archutils/win32/tls.h"
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
const int channels = 2;
|
||||
@@ -36,7 +40,9 @@ int RageSound_DSound::MixerThread_start(void *p)
|
||||
|
||||
void RageSound_DSound::MixerThread()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
InitThreadData("Mixer thread");
|
||||
#endif
|
||||
VDCHECKPOINT;
|
||||
|
||||
/* SOUNDMAN will be set once RageSoundManager's ctor returns and
|
||||
|
||||
@@ -32,13 +32,10 @@ void MakeInputHandlers(vector<InputHandler *> &Add)
|
||||
{
|
||||
#if defined(_WINDOWS)
|
||||
Add.push_back(new InputHandler_DInput);
|
||||
#else
|
||||
Add.push_back(new InputHandler_SDL);
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
Add.push_back(new InputHandler_Win32_Pump);
|
||||
// Add.push_back(new InputHandler_Win32_Para);
|
||||
#else
|
||||
Add.push_back(new InputHandler_SDL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -20,15 +20,26 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers);
|
||||
/* Define the default list of sound drivers for each arch. It's
|
||||
* OK to list drivers that may not be available. */
|
||||
#if defined(LINUX)
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "ALSA9,OSS,Null"
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "ALSA9,OSS,Null"
|
||||
#elif defined(DARWIN)
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "QT,QT1,Null"
|
||||
#elif defined(WIN32)
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound,DirectSound-sw,WaveOut"
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "QT,QT1,Null"
|
||||
#elif defined(_WINDOWS)
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound,DirectSound-sw,WaveOut"
|
||||
#elif defined(_XBOX)
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound"
|
||||
#else
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "Null"
|
||||
#define DEFAULT_SOUND_DRIVER_LIST "Null"
|
||||
#endif
|
||||
|
||||
|
||||
/* Hack for Xbox: All paths must be absolute. */
|
||||
#if defined(_XBOX)
|
||||
#define BASE_PATH "D:\\"
|
||||
#else
|
||||
#define BASE_PATH ""
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "Sound/RageSoundDriver_QT1.h"
|
||||
#include "Sound/RageSoundDriver_QT.h"
|
||||
#include "LoadingWindow/LoadingWindow_Cocoa.h"
|
||||
#include "InputHandler/InputHandler_SDL.h"
|
||||
|
||||
#include "ArchHooks/ArchHooks_darwin.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
/* All driver types should have a default, portable implementation, provided
|
||||
* here. */
|
||||
/* None of these SDL implementations run on Xbox, so I've commented
|
||||
* out use of this header and added the #includes to each arch_*.h */
|
||||
|
||||
/* Load default fallback drivers; some of these may be overridden by arch-specific drivers. */
|
||||
#include "LoadingWindow/LoadingWindow_SDL.h"
|
||||
@@ -10,8 +12,10 @@
|
||||
#include "ErrorDialog/ErrorDialog_null.h"
|
||||
#include "ArchHooks/ArchHooks_none.h"
|
||||
#include "Sound/RageSoundDriver_Null.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_SDL.h"
|
||||
#include "InputHandler/InputHandler_SDL.h"
|
||||
#include "LowLevelWindow/LowLevelWindow_Null.h"
|
||||
|
||||
// not supported on Xbox
|
||||
//#include "InputHandler/InputHandler_SDL.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#ifdef HAVE_GTK
|
||||
# include "LoadingWindow/LoadingWindow_Gtk.h"
|
||||
#endif
|
||||
#include "InputHandler/InputHandler_SDL.h"
|
||||
|
||||
#endif
|
||||
/*
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef XBOX_ARCH_H
|
||||
#define XBOX_ARCH_H
|
||||
|
||||
/* Load drivers for Win32. */
|
||||
#include "LoadingWindow/LoadingWindow_SDL.h"
|
||||
/* Load drivers for Xbox. */
|
||||
#include "LoadingWindow/LoadingWindow_Null.h"
|
||||
#include "ErrorDialog/ErrorDialog_null.h"
|
||||
#include "ArchHooks/ArchHooks_none.h"
|
||||
|
||||
#include "InputHandler/InputHandler_DirectInput.h"
|
||||
#include "InputHandler/InputHandler_SDL.h"
|
||||
|
||||
#include "Sound/RageSoundDriver_DSound.h"
|
||||
|
||||
|
||||
+22
-15
@@ -55,24 +55,25 @@ using namespace std;
|
||||
#undef ASSERT
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
/* Assertion that sets an optional message and brings up the crash handler, so
|
||||
* we get a backtrace. This should probably be used instead of throwing an
|
||||
* exception in most cases we expect never to happen (but not in cases that
|
||||
* we do expect, such as DSound init failure.) */
|
||||
#include "archutils/win32/crash.h"
|
||||
#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } }
|
||||
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
#define ASSERT RAGE_ASSERT
|
||||
#if defined(_WINDOWS)
|
||||
/* Assertion that sets an optional message and brings up the crash handler, so
|
||||
* we get a backtrace. This should probably be used instead of throwing an
|
||||
* exception in most cases we expect never to happen (but not in cases that
|
||||
* we do expect, such as DSound init failure.) */
|
||||
#include "archutils/win32/crash.h"
|
||||
#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } }
|
||||
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
#define ASSERT RAGE_ASSERT
|
||||
#else
|
||||
|
||||
#include <assert.h>
|
||||
/* TODO: do something useful and portable with RAGE_ASSERT*. */
|
||||
#define RAGE_ASSERT_M(COND, MESSAGE) ASSERT(COND)
|
||||
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
#define ASSERT assert
|
||||
#define VDCHECKPOINT (void*)(0)
|
||||
#include <assert.h>
|
||||
/* TODO: do something useful and portable with RAGE_ASSERT*. */
|
||||
#define RAGE_ASSERT_M(COND, MESSAGE) ASSERT(COND)
|
||||
#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
#define ASSERT assert
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_ASSERT(x) ASSERT(x)
|
||||
#else
|
||||
@@ -137,6 +138,12 @@ inline float acosf(float x) { return float(acos(double(x))); }
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if defined(_XBOX)
|
||||
#define SLASH "\\"
|
||||
#else
|
||||
#define SLASH "/"
|
||||
#endif
|
||||
|
||||
/* Don't include our own headers here, since they tend to change often. */
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user