diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 493df85284..97b7de1706 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -79,6 +79,9 @@ void AddLayersFromAniDir( CString sAniDir, vector &layersAddT if( ini.GetValue(sLayer, "Import", sImportDir) ) { // import a whole BGAnimation +#ifdef _XBOX + sImportDir.Replace("/","\\"); +#endif sImportDir = sAniDir + sImportDir; CollapsePath( sImportDir ); AddLayersFromAniDir( sImportDir, layersAddTo, Generic ); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 41d1daadf2..bed409323b 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -49,6 +49,7 @@ PrefsManager::PrefsManager() #else m_bShowStats = false; #endif + m_bShowBanners = true ; m_BackgroundMode = BGMODE_ANIMATIONS; m_iNumBackgrounds = 8; m_bShowDanger = true; @@ -168,6 +169,10 @@ PrefsManager::PrefsManager() #ifdef _XBOX m_bInterlaced = true; m_bPAL = false; + m_fScreenPosX = 0 ; + m_fScreenPosY = 0 ; + m_fScreenWidth = 640 ; + m_fScreenHeight = 480 ; #else m_bInterlaced = false; #endif @@ -214,6 +219,10 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "Interlaced", m_bInterlaced ); #ifdef _XBOX ini.GetValue( "Options", "PAL", m_bPAL ); + ini.GetValue( "Options", "ScreenPosX", m_fScreenPosX ); + ini.GetValue( "Options", "ScreenPosY", m_fScreenPosY ); + ini.GetValue( "Options", "ScreenWidth", m_fScreenWidth ); + ini.GetValue( "Options", "ScreenHeight", m_fScreenHeight ); #endif ini.GetValue( "Options", "DisplayWidth", m_iDisplayWidth ); ini.GetValue( "Options", "DisplayHeight", m_iDisplayHeight ); @@ -224,6 +233,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "RefreshRate", m_iRefreshRate ); ini.GetValue( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.GetValue( "Options", "ShowStats", m_bShowStats ); + ini.GetValue( "Options", "ShowBanners", m_bShowBanners ); ini.GetValue( "Options", "BackgroundMode", (int&)m_BackgroundMode ); ini.GetValue( "Options", "NumBackgrounds", m_iNumBackgrounds); ini.GetValue( "Options", "ShowDanger", m_bShowDanger ); @@ -373,6 +383,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "RefreshRate", m_iRefreshRate ); ini.SetValue( "Options", "UseDedicatedMenuButtons", m_bOnlyDedicatedMenuButtons ); ini.SetValue( "Options", "ShowStats", m_bShowStats ); + ini.SetValue( "Options", "ShowBanners", m_bShowBanners ); ini.SetValue( "Options", "BackgroundMode", m_BackgroundMode); ini.SetValue( "Options", "NumBackgrounds", m_iNumBackgrounds); ini.SetValue( "Options", "ShowDanger", m_bShowDanger ); @@ -410,6 +421,10 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "Interlaced", m_bInterlaced ); #ifdef _XBOX ini.SetValue( "Options", "PAL", m_bPAL ); + ini.SetValue( "Options", "ScreenPosX", m_fScreenPosX ); + ini.SetValue( "Options", "ScreenPosY", m_fScreenPosY ); + ini.SetValue( "Options", "ScreenWidth", m_fScreenWidth ); + ini.SetValue( "Options", "ScreenHeight", m_fScreenHeight ); #endif ini.SetValue( "Options", "HowToPlay", m_bInstructions ); ini.SetValue( "Options", "Caution", m_bShowDontDie ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 8673392c5a..78ee1f8e12 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -29,6 +29,7 @@ public: int m_iMaxTextureResolution; int m_iRefreshRate; bool m_bShowStats; + bool m_bShowBanners; enum BackgroundModes { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES } m_BackgroundMode; int m_iNumBackgrounds; float m_fBGBrightness; @@ -37,6 +38,10 @@ public: bool m_bInterlaced; #ifdef _XBOX bool m_bPAL; + float m_fScreenPosX ; + float m_fScreenPosY ; + float m_fScreenWidth ; + float m_fScreenHeight ; #endif bool m_bDelayedTextureDelete; bool m_bTexturePreload; diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 5cf1493646..d2327b6626 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -204,6 +204,7 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn ) bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn ) { +#ifndef _XBOX // mount card if( !PREFSMAN->m_sMemoryCardMountCommand[pn].empty() ) system( PREFSMAN->m_sMemoryCardMountCommand[pn] ); @@ -218,6 +219,7 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn ) if( LoadProfileFromMemoryCard(pn) ) return true; } +#endif if( LoadDefaultProfileFromMachine(pn) ) return true; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index c87c6be503..4841842244 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -29,6 +29,7 @@ #include "SDL_video.h" // for SDL_Surface #include "SDL_utils.h" #include "D3DX8Core.h" +#include "PrefsManager.h" #include "arch/arch.h" @@ -489,8 +490,21 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) g_d3dpp.Flags = 0; g_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; #else - g_d3dpp.Flags = (p.interlaced? D3DPRESENTFLAG_INTERLACED: D3DPRESENTFLAG_PROGRESSIVE ) | D3DPRESENTFLAG_10X11PIXELASPECTRATIO; - g_d3dpp.FullScreen_RefreshRateInHz = p.PAL ? 50 : 60; + if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I) + { + //get supported video flags + DWORD videoFlags = XGetVideoFlags(); + + //set pal60 if available. + if(videoFlags & XC_VIDEO_FLAGS_PAL_60Hz) + g_d3dpp.FullScreen_RefreshRateInHz = 60 ; + else + g_d3dpp.FullScreen_RefreshRateInHz = 50 ; + } + else + g_d3dpp.FullScreen_RefreshRateInHz = 60 ; + + g_d3dpp.Flags = 0 ; #endif LOG->Trace( "Present Parameters: %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d", @@ -502,6 +516,11 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) g_d3dpp.FullScreen_PresentationInterval ); +#ifdef _XBOX + if ( D3D__pDevice ) + g_pd3dDevice = D3D__pDevice ; +#endif + if( g_pd3dDevice == NULL ) // device is not yet created. We need to create it { bNewDeviceOut = true; @@ -567,6 +586,16 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) void RageDisplay_D3D::ResolutionChanged() { +#ifdef _XBOX + g_CurrentParams.width = PREFSMAN->m_fScreenWidth ; + g_CurrentParams.height = PREFSMAN->m_fScreenHeight ; + D3DVIEWPORT8 viewData2 = { 0,0,640,480, 0.f, 1.f }; + g_pd3dDevice->SetViewport( &viewData2 ); + g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, + D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 ); + D3DVIEWPORT8 viewData = { PREFSMAN->m_fScreenPosX, PREFSMAN->m_fScreenPosY, g_CurrentParams.width, g_CurrentParams.height, 0.f, 1.f }; + g_pd3dDevice->SetViewport( &viewData ); +#endif // no need to clear because D3D uses an overlay // SetViewport(0,0); // diff --git a/stepmania/src/RageSoundReader_MP3.cpp b/stepmania/src/RageSoundReader_MP3.cpp index 8f0e5ad3fe..ffc0556fa7 100644 --- a/stepmania/src/RageSoundReader_MP3.cpp +++ b/stepmania/src/RageSoundReader_MP3.cpp @@ -12,8 +12,11 @@ #ifdef _WIN32 #include "mad-0.15.0b/mad.h" #ifdef _XBOX -// not set up -// #pragma comment(lib, "mad-0.15.0b/msvc++/Xbox_Release/libmad.lib") +#ifdef _DEBUG +#pragma comment(lib, "mad-0.15.0b/xboxmad/debug/xboxmad.lib") +#else +#pragma comment(lib, "mad-0.15.0b/xboxmad/Release/xboxmad.lib") +#endif #else #pragma comment(lib, "mad-0.15.0b/msvc++/Release/libmad.lib") #endif diff --git a/stepmania/src/RageSoundReader_Resample_Good.cpp b/stepmania/src/RageSoundReader_Resample_Good.cpp index f4f26a0f55..8ed093f7d4 100644 --- a/stepmania/src/RageSoundReader_Resample_Good.cpp +++ b/stepmania/src/RageSoundReader_Resample_Good.cpp @@ -8,6 +8,16 @@ #pragma comment(lib, "libresample/resample.lib") #endif +#ifdef _XBOX + +#ifdef _DEBUG +#pragma comment(lib, "libresample/xboxresample/debug/xboxresample.lib") +#else +#pragma comment(lib, "libresample/xboxresample/release/xboxresample.lib") +#endif + +#endif + #include "RageTimer.h" RageSoundReader_Resample_Good::RageSoundReader_Resample_Good() diff --git a/stepmania/src/RageSoundReader_Vorbisfile.cpp b/stepmania/src/RageSoundReader_Vorbisfile.cpp index 8b57a5a04c..f683a4c8f9 100644 --- a/stepmania/src/RageSoundReader_Vorbisfile.cpp +++ b/stepmania/src/RageSoundReader_Vorbisfile.cpp @@ -15,9 +15,15 @@ #endif #if defined(_XBOX) +#ifdef _DEBUG +#pragma comment(lib, "vorbis/xbox/ogg_static_d.lib") +#pragma comment(lib, "vorbis/xbox/vorbis_static_d.lib") +#pragma comment(lib, "vorbis/xbox/vorbisfile_static_d.lib") +#else #pragma comment(lib, "vorbis/xbox/ogg_static.lib") #pragma comment(lib, "vorbis/xbox/vorbis_static.lib") #pragma comment(lib, "vorbis/xbox/vorbisfile_static.lib") +#endif #elif defined(_WINDOWS) #pragma comment(lib, "vorbis/win32/ogg_static.lib") #pragma comment(lib, "vorbis/win32/vorbis_static.lib") diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 2fed39d376..87f4fc2e0c 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -293,8 +293,11 @@ void RageThread::HaltAllThreads( bool Kill ) continue; if( ThisThreadID == (int) g_ThreadSlots[entry].threadid ) continue; -// SuspendThread( g_ThreadSlots[entry].ThreadHandle ); +#ifdef _XBOX + SuspendThread( g_ThreadSlots[entry].ThreadHandle ); +#else TerminateThread( g_ThreadSlots[entry].ThreadHandle, 0 ); +#endif } #endif } diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 090d8ae974..ad844340b0 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -299,10 +299,14 @@ CString GetExtension( CString sPath ) CString GetCwd() { +#ifdef _XBOX + return "D:\\" ; +#else char buf[PATH_MAX]; bool ret = getcwd(buf, PATH_MAX) != NULL; ASSERT(ret); return buf; +#endif } /* mkdir -p. Doesn't fail if Path already exists and is a directory. */ diff --git a/stepmania/src/RageUtil_FileDB.cpp b/stepmania/src/RageUtil_FileDB.cpp index e86c650e9c..a96233faa2 100644 --- a/stepmania/src/RageUtil_FileDB.cpp +++ b/stepmania/src/RageUtil_FileDB.cpp @@ -62,7 +62,14 @@ void FileSet::LoadFromDir(const CString &dir) #if defined(WIN32) WIN32_FIND_DATA fd; - HANDLE hFind = FindFirstFile( dir+SLASH "*", &fd ); + CString dirHolder = dir ; + + if ( dirHolder.size() > 0 && dirHolder.Right(1) == SLASH ) + { + dirHolder.erase( dirHolder.size() - 1 ) ; + } + + HANDLE hFind = FindFirstFile( dirHolder+SLASH "*", &fd ); if( hFind == INVALID_HANDLE_VALUE ) return; @@ -222,7 +229,12 @@ static void SplitPath( CString Path, CString &Dir, CString &Name ) if( Path.size() > 0 && Path.Right(1) == SLASH ) Path.erase( Path.size()-1 ); +#ifdef _XBOX + static Regex split("(.*\\\\)([^\\\\]+)"); +#else static Regex split("(.*/)([^/]+)"); +#endif + CStringArray match; if(split.Compare(Path, match)) { /* At least one slash. */ @@ -230,8 +242,13 @@ static void SplitPath( CString Path, CString &Dir, CString &Name ) Name = match[1]; } else { /* No slash. */ +#ifdef _XBOX + Dir = "D:\\" ; + Name = "" ; +#else Dir = "." SLASH; Name = Path; +#endif } } @@ -288,6 +305,12 @@ bool FilenameDB::IsADirectory( const CString &sPath ) CString Dir, Name; SplitPath(sPath, Dir, Name); FileSet &fs = GetFileSet(Dir.c_str()); + +#ifdef _XBOX + if ( ( Dir == "D:\\" ) && ( Name == "" ) ) + return true ; +#endif + return fs.IsADirectory(Name); } diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index b120dbcbf3..cd7b6c72ec 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -372,7 +372,13 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) if( !GAMESTATE->IsPlayerEnabled(p) ) continue; // skip +#ifdef _XBOX + //shorten filenames for FATX + m_DifficultyIcon[p].Load( THEME->GetPathToG("ScreenEvaluation diff icons 1x5") ); +#else m_DifficultyIcon[p].Load( THEME->GetPathToG("ScreenEvaluation difficulty icons 1x5") ); +#endif + m_DifficultyIcon[p].SetFromNotes( (PlayerNumber)p, GAMESTATE->m_pCurNotes[p] ); m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) ); UtilSetXYAndOnCommand( m_DifficultyIcon[p], "ScreenEvaluation" ); @@ -620,7 +626,12 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName) UtilSetXYAndOnCommand( m_sprJudgeLabels[l], "ScreenEvaluation" ); this->AddChild( &m_sprJudgeLabels[l] ); +#ifdef _XBOX + //shorten filenames for FATX + // m_soundJudgeSound[l].Load( THEME->GetPathToS( ssprintf("ScreenEvaluation j %s", JUDGE_STRING[l]) ) ); +#else // m_soundJudgeSound[l].Load( THEME->GetPathToS( ssprintf("ScreenEvaluation JudgeSound %s", JUDGE_STRING[l]) ) ); +#endif // m_TimeToPlayJudgeSound[l] = JUDGE_SOUND_TIME( JUDGE_STRING[l] ); for( p=0; pAddChild( &m_InfoFrame ); +#ifdef _XBOX + //shorten filenames for FATX + m_PumpDifficultyCircle.Load( THEME->GetPathToG("ScreenEz2SelectMusic diff frame")); +#else m_PumpDifficultyCircle.Load( THEME->GetPathToG("ScreenEz2SelectMusic difficulty frame")); +#endif + m_PumpDifficultyCircle.SetXY( PUMP_DIFF_X, PUMP_DIFF_Y ); this->AddChild( &m_PumpDifficultyCircle ); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index df7335eab0..7b18a0315b 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -95,6 +95,18 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S SECONDS_BETWEEN_COMMENTS.Refresh(); G_TICK_EARLY_SECONDS.Refresh(); + //need to initialize these before checking for demonstration mode + //otherwise destructor will try to delete possibly invalid pointers + + for( p=0; pm_pCurSong == NULL && GAMESTATE->m_pCurCourse == NULL ) return; // ScreenDemonstration will move us to the next scren. We just need to survive for one update without crashing. @@ -105,14 +117,6 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S GAMESTATE->ResetStageStatistics(); - for( p=0; pm_iProgressiveNonstopLifebar ); MOVE( DisplayMode, PREFSMAN->m_bWindowed ); MOVE( WaitForVsync, PREFSMAN->m_bVsync ); MOVE( ShowStats, PREFSMAN->m_bShowStats ); +MOVE( ShowBanners, PREFSMAN->m_bShowBanners ); MOVE( KeepTexturesInMemory, PREFSMAN->m_bDelayedTextureDelete ); MOVE( AntiAliasing, PREFSMAN->m_bAntiAliasing ); @@ -473,6 +474,7 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Refresh\nRate", RefreshRate, "DEFAULT","60","70","72","75","80","85","90","100","120","150" ), ConfOption( "Wait For\nVsync", WaitForVsync, "NO", "YES" ), ConfOption( "Show\nStats", ShowStats, "OFF","ON" ), + ConfOption( "Show\nBanners", ShowBanners, "OFF","ON" ), /* Sound options */ ConfOption( "Preload\nSounds", PreloadSounds, "NO","YES" ), diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 354828db99..3a8acfe1fd 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -117,7 +117,13 @@ ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : Screen( sClassNam this->AddChild( &m_HighScore[p] ); } +#ifdef _XBOX + //shorten filenames for FATX + m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenSelectCourse opt message 1x2") ); +#else m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenSelectCourse options message 1x2") ); +#endif + m_sprOptionsMessage.StopAnimating(); m_sprOptionsMessage.SetXY( CENTER_X, CENTER_Y ); m_sprOptionsMessage.SetZoomY( 0 ); diff --git a/stepmania/src/ScreenSelectDifficultyEX.cpp b/stepmania/src/ScreenSelectDifficultyEX.cpp index ff57629ab4..5e818fe242 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.cpp +++ b/stepmania/src/ScreenSelectDifficultyEX.cpp @@ -115,9 +115,15 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX( CString sClassName ) : Scree float fCursorX = GetCursorX( (PlayerNumber)p ); float fCursorY = GetCursorY( (PlayerNumber)p ); +#ifdef _XBOX + //shorten filenames for FATX + CString sInfoFile = ssprintf( "ScrSelDiffX info %s", m_ModeChoices[0].m_sName.c_str() ); + CString sPictureFile = ssprintf( "ScrSelDiffX picture %s", m_ModeChoices[0].m_sName.c_str() ); +#else CString sInfoFile = ssprintf( "ScreenSelectDifficultyEX info %s", m_ModeChoices[0].m_sName.c_str() ); CString sPictureFile = ssprintf( "ScreenSelectDifficultyEX picture %s", m_ModeChoices[0].m_sName.c_str() ); - +#endif + m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) ); m_sprPicture[p].SetXY( PICTURE_X(p), PICTURE_Y(p) ); m_framePages.AddChild( &m_sprPicture[p] ); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index ab6f8ac58e..aff857cf9d 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -1023,7 +1023,10 @@ void ScreenSelectMusic::AfterMusicChange() pSong->GetSteps( m_arrayNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); SortNotesArrayByDifficulty( m_arrayNotes ); - m_Banner.LoadFromSong( pSong ); + if ( PREFSMAN->m_bShowBanners ) + m_Banner.LoadFromSong( pSong ); + else + m_Banner.LoadFallback() ; if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) { diff --git a/stepmania/src/SongCacheIndex.cpp b/stepmania/src/SongCacheIndex.cpp index 480cdd0219..36988b6f7b 100644 --- a/stepmania/src/SongCacheIndex.cpp +++ b/stepmania/src/SongCacheIndex.cpp @@ -27,7 +27,11 @@ SongCacheIndex::~SongCacheIndex() static void EmptyDir( CString dir ) { +#ifdef _XBOX + ASSERT(dir[dir.size()-1] == '\\'); +#else ASSERT(dir[dir.size()-1] == '/'); +#endif CStringArray asCacheFileNames; GetDirListing( dir, asCacheFileNames ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 824a3c61bb..949888cc2b 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -56,7 +56,8 @@ #if defined(_XBOX) - #ifdef DEBUG + #include "custom_launch_params.h" + #ifdef _DEBUG #pragma comment(lib, "SDL-1.2.6/lib/xboxSDLmaind.lib") #else #pragma comment(lib, "SDL-1.2.6/lib/xboxSDLmain.lib") @@ -83,6 +84,11 @@ CString DirOfExecutable; static void ChangeToDirOfExecutable(const char *argv0) { +#ifdef _XBOX + DirOfExecutable = "D:\\" ; + return ; +#endif + DirOfExecutable = argv0; // strip off executable name unsigned n = DirOfExecutable.find_last_of("/\\"); @@ -494,6 +500,10 @@ struct VideoCardDefaults static CString GetVideoDriverName() { +#ifdef _XBOX + return "D3D" ; +#endif + #if defined(_WINDOWS) return GetPrimaryVideoDriverName(); #else @@ -735,9 +745,21 @@ void SaveGamePrefsToDisk() #define UNLOCKS_PATH BASE_PATH "Data" SLASH "Unlocks.dat" +#ifdef _XBOX +char *xboxargv[] = { "d:\\default.xbe" } ; +extern RageDisplay::VideoModeParams g_CurrentParams; + +#endif int main(int argc, char* argv[]) { + +#ifdef _XBOX + argc = 1 ; + argv = xboxargv ; + XGetCustomLaunchData() ; +#endif + g_argc = argc; g_argv = argv; @@ -869,6 +891,12 @@ int main(int argc, char* argv[]) /* Initialize which courses are ranking courses here. */ SONGMAN->UpdateRankingCourses(); +#ifdef _XBOX + g_CurrentParams.width = 600 ; + g_CurrentParams.height= 400 ; + DISPLAY->ResolutionChanged() ; +#endif + /* Run the main loop. */ GameLoop(); @@ -926,6 +954,10 @@ int main(int argc, char* argv[]) SAFE_DELETE( HOOKS ); +#ifdef _XBOX + XReturnToLaunchingXBE() ; +#endif + return 0; } diff --git a/stepmania/src/StepMania.sln b/stepmania/src/StepMania.sln index 972bef8cf8..83ef25f5b8 100644 --- a/stepmania/src/StepMania.sln +++ b/stepmania/src/StepMania.sln @@ -5,6 +5,8 @@ Global GlobalSection(SolutionConfiguration) = preSolution ConfigName.0 = Debug ConfigName.1 = Release + ConfigName.2 = Debug Xbox + ConfigName.3 = Release Xbox EndGlobalSection GlobalSection(ProjectDependencies) = postSolution EndGlobalSection @@ -13,6 +15,10 @@ Global {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug.Build.0 = Debug|Win32 {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.ActiveCfg = Release|Win32 {670745A6-106B-420D-A2A9-D4F89A23986E}.Release.Build.0 = Release|Win32 + {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug Xbox.ActiveCfg = Debug|Xbox + {670745A6-106B-420D-A2A9-D4F89A23986E}.Debug Xbox.Build.0 = Debug|Xbox + {670745A6-106B-420D-A2A9-D4F89A23986E}.Release Xbox.ActiveCfg = Release|Xbox + {670745A6-106B-420D-A2A9-D4F89A23986E}.Release Xbox.Build.0 = Release|Xbox EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution DPBuild = 5 diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 979e8aae8f..98e05cdb81 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -9,6 +9,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -823,6 +940,9 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + @@ -837,6 +957,18 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + @@ -856,12 +988,29 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + + + + @@ -874,6 +1023,18 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + @@ -887,6 +1048,18 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + @@ -906,18 +1079,72 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -934,18 +1161,78 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -976,48 +1263,228 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ Filter=""> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1488,6 +1955,18 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + + + diff --git a/stepmania/src/arch/InputHandler/InputHandler_SDL.cpp b/stepmania/src/arch/InputHandler/InputHandler_SDL.cpp index fde13e68a3..72c88deb34 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_SDL.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_SDL.cpp @@ -12,6 +12,8 @@ #include "InputHandler_SDL.h" #include "SDL_utils.h" #include "RageLog.h" +#include "RageDisplay.h" +#include "PrefsManager.h" static const Sint8 Handled_SDL_Events[] = { SDL_KEYDOWN, SDL_KEYUP, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, @@ -23,6 +25,11 @@ InputHandler_SDL::InputHandler_SDL() { SDL_InitSubSystem( SDL_INIT_JOYSTICK ); +#ifdef _XBOX + //strange hardware timing issue with 3rd party controllers + Sleep(750) ; +#endif + SDL_EnableKeyRepeat( 0, 0 ); /* We can do this to get Unicode values in the key struct, which (with @@ -80,6 +87,16 @@ InputHandler_SDL::~InputHandler_SDL() void InputHandler_SDL::Update(float fDeltaTime) { +#ifdef _XBOX + + static int lastValX1 = 0 ; + static int lastValY1 = 0 ; + static int lastValX2 = 0 ; + static int lastValY2 = 0 ; + static int resolutionChanged = 0 ; + +#endif + SDL_Event event; while(SDL_GetEvent(event, SDL_EventMask)) { @@ -115,11 +132,67 @@ void InputHandler_SDL::Update(float fDeltaTime) case SDL_JOYAXISMOTION: { +#ifdef _XBOX + resolutionChanged = 1 ; + if ( abs(event.jaxis.value) > 15600 ) + { + switch ( event.jaxis.axis ) + { + case 0 : + { + lastValX1 = event.jaxis.value ; + break; + } + case 1 : + { + lastValY1 = event.jaxis.value ; + break; + } + case 2 : + { + lastValX2 = event.jaxis.value ; + break; + } + case 3 : + { + lastValY2 = event.jaxis.value ; + break; + } + } + } + else + { + switch ( event.jaxis.axis ) + { + case 0 : + { + lastValX1 = 0; + break; + } + case 1 : + { + lastValY1 = 0 ; + break; + } + case 2 : + { + lastValX2 = 0; + break; + } + case 3 : + { + lastValY2 = 0; + break; + } + } + } +#else InputDevice i = InputDevice(DEVICE_JOY1 + event.jaxis.which); JoystickButton neg = (JoystickButton)(JOY_LEFT+2*event.jaxis.axis); JoystickButton pos = (JoystickButton)(JOY_RIGHT+2*event.jaxis.axis); ButtonPressed(DeviceInput(i, neg), event.jaxis.value < -16000); ButtonPressed(DeviceInput(i, pos), event.jaxis.value > +16000); +#endif continue; } @@ -135,6 +208,32 @@ void InputHandler_SDL::Update(float fDeltaTime) } } +#ifdef _XBOX + + if ( resolutionChanged ) + { + if ( lastValX1 || lastValY1 || lastValX2 || lastValY2 ) + { + PREFSMAN->m_fScreenPosX += ((float)lastValX1/32767.0f) ; + if ( PREFSMAN->m_fScreenPosX < 0) + PREFSMAN->m_fScreenPosX = 0 ; + + PREFSMAN->m_fScreenPosY -= ((float)lastValY1/32767.0f) ; + if ( PREFSMAN->m_fScreenPosY < 0) + PREFSMAN->m_fScreenPosY = 0 ; + + PREFSMAN->m_fScreenWidth += ((float)lastValX2/32767.0f) ; + PREFSMAN->m_fScreenHeight -= ((float)lastValY2/32767.0f) ; + + DISPLAY->ResolutionChanged() ; + } + else + { + resolutionChanged = 0 ; + } + } +#endif + InputHandler::UpdateTimer(); } diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.cpp index def3aeaecf..7a505f788e 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.cpp +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.cpp @@ -38,16 +38,55 @@ LoadingWindow_SDL::LoadingWindow_SDL() if( image == NULL ) RageException::Throw("Couldn't load loading.bmp: %s",SDL_GetError()); + /* Initialize the window */ loading_screen = SDL_SetVideoMode(image->w, image->h, 16, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_NOFRAME); if( loading_screen == NULL ) RageException::Throw( "Couldn't initialize loading window: %s", SDL_GetError() ); +#ifdef _XBOX + SDL_XBOX_SetScreenPosition( 70, 48 ) ; + SDL_XBOX_SetScreenStretch( -150, -300 ) ; + + + if( FAILED ( XFONT_OpenDefaultFont( &m_pConsoleTTF ) ) ) + { + m_pConsoleTTF = 0 ; + } + else + { + m_pConsoleTTF->SetTextHeight( 24 ); + + // Change Font Style - XFONT_NORMAL, XFONT_BOLD, + // XFONT_ITALICS, XFONT_BOLDITALICS + m_pConsoleTTF->SetTextStyle( XFONT_NORMAL ); + + // Anti-Alias the font -- 0 for no anti-alias, 2 for some, 4 for MAX! + m_pConsoleTTF->SetTextAntialiasLevel( 2 ); + m_pConsoleTTF->SetTextColor( 0xFFFFFFFF ) ; + m_pConsoleTTF->SetBkColor( 0x00000000 ) ; + m_pConsoleTTF->SetBkMode(XFONT_OPAQUE) ; + + SetText( CString("Loading Songs" ) ) ; + } + +#endif + SDL_BlitSurface(image, NULL, loading_screen, NULL); SDL_FreeSurface(image); + + SDL_UpdateRect(loading_screen, 0,0,0,0); + SDL_UpdateRect(loading_screen, 0,0,0,0); } +#ifdef _XBOX +void LoadingWindow_SDL::SetText(CString str) +{ + m_cstrText = str ; +} +#endif + LoadingWindow_SDL::~LoadingWindow_SDL() { SDL_QuitSubSystem( SDL_INIT_VIDEO ); @@ -55,7 +94,33 @@ LoadingWindow_SDL::~LoadingWindow_SDL() void LoadingWindow_SDL::Paint() { +#ifdef _XBOX + LPDIRECT3DSURFACE8 m_primarySurface; + int x,y ; + unsigned int val ; + if ( m_pConsoleTTF ) + { + WCHAR msg[1000] ; + swprintf( msg, L"%S", m_cstrText.c_str() ) ; + + if ( m_pConsoleTTF->GetTextExtent( msg, -1, &val ) != S_OK ) + { + val = 100 ; + } + + x = (640-val)/2 ; + y = 350 ; + + D3D__pDevice->GetRenderTarget( &m_primarySurface ) ; + m_pConsoleTTF->TextOut( m_primarySurface, L" ", -1, (float)0, (float)y ) ; + m_pConsoleTTF->TextOut( m_primarySurface, msg, wcslen(msg), (float)x, (float)y ) ; + m_primarySurface->Release() ; + D3D__pDevice->Present(NULL, NULL, NULL, NULL) ; + } + +#else SDL_UpdateRect(loading_screen, 0,0,0,0); +#endif } /* diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h index 5d25282725..ce9b4b1223 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h @@ -4,6 +4,11 @@ #include "LoadingWindow.h" #include "SDL.h" +#ifdef _XBOX +#define XFONT_TRUETYPE +#include +#endif + class LoadingWindow_SDL: public LoadingWindow { SDL_Surface *loading_screen; @@ -12,6 +17,14 @@ public: ~LoadingWindow_SDL(); void Paint(); + +#ifdef _XBOX + + void SetText(CString str); + + CString m_cstrText ; + XFONT* m_pConsoleTTF; // Pointer to the Arial TrueTypeFont +#endif }; #define HAVE_LOADING_WINDOW_SDL diff --git a/stepmania/src/arch/Sound/DSoundHelpers.cpp b/stepmania/src/arch/Sound/DSoundHelpers.cpp index d2c18713aa..6999efb4dc 100644 --- a/stepmania/src/arch/Sound/DSoundHelpers.cpp +++ b/stepmania/src/arch/Sound/DSoundHelpers.cpp @@ -168,7 +168,7 @@ DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware, memset(&format, 0, sizeof(format)); format.dwSize = sizeof(format); #ifdef _XBOX - format.dwFlags = DSBCAPS_CTRLVOLUME; + format.dwFlags = 0; #else format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME; #endif @@ -188,7 +188,24 @@ DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware, format.dwBufferBytes = buffersize; #ifndef _XBOX format.dwReserved = 0; +#else + DSMIXBINVOLUMEPAIR dsmbvp[8] = { + {DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX}, // left channel + {DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX}, // right channel + {DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX}, // left channel + {DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX}, // right channel + {DSMIXBIN_BACK_LEFT, DSBVOLUME_MAX}, // left channel + {DSMIXBIN_BACK_RIGHT, DSBVOLUME_MAX}, // right channel + {DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX}, // left channel + {DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX}}; // right channel + + DSMIXBINS dsmb; + dsmb.dwMixBinCount = 8; + dsmb.lpMixBinVolumePairs = dsmbvp; + + format.lpMixBins = &dsmb; #endif + format.lpwfxFormat = &waveformat; /* Query IID_IDirectSoundBuffer instead of IID_IDirectSoundBuffer8. -Chris */ @@ -355,7 +372,12 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int chunksize) // LOG->Trace("gave %i at %i (%i, %i) %i filled", num_bytes_empty, write_cursor, cursor, write, buffer_bytes_filled); /* Lock the audio buffer. */ +#ifdef _XBOX + result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, NULL, 0); +#else result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0); +#endif + #ifndef _XBOX if ( result == DSERR_BUFFERLOST ) { buf->Restore(); diff --git a/stepmania/src/arch/arch_xbox.h b/stepmania/src/arch/arch_xbox.h index 41c9005012..eaafbdc593 100644 --- a/stepmania/src/arch/arch_xbox.h +++ b/stepmania/src/arch/arch_xbox.h @@ -2,7 +2,7 @@ #define XBOX_ARCH_H /* Load drivers for Xbox. */ -#include "ErrorDialog/ErrorDialog_null.h" +//#include "ErrorDialog/ErrorDialog_null.h" #include "ArchHooks/ArchHooks_none.h" /* Err, is SDL input working on Xbox? arch_default comments indicated no. @@ -11,6 +11,8 @@ #include "Sound/RageSoundDriver_DSound.h" +#include "LoadingWindow/LoadingWindow_SDL.h" + /* Undef this if you need no SDL input. */ // #undef SUPPORT_SDL_INPUT diff --git a/stepmania/src/libresample/xboxresample/Debug/xboxresample.lib b/stepmania/src/libresample/xboxresample/Debug/xboxresample.lib new file mode 100644 index 0000000000..0aea27d926 Binary files /dev/null and b/stepmania/src/libresample/xboxresample/Debug/xboxresample.lib differ diff --git a/stepmania/src/libresample/xboxresample/Release/xboxresample.lib b/stepmania/src/libresample/xboxresample/Release/xboxresample.lib new file mode 100644 index 0000000000..dadabaecf4 Binary files /dev/null and b/stepmania/src/libresample/xboxresample/Release/xboxresample.lib differ diff --git a/stepmania/src/libresample/xboxresample/xboxresample.sln b/stepmania/src/libresample/xboxresample/xboxresample.sln new file mode 100644 index 0000000000..601769c8fc --- /dev/null +++ b/stepmania/src/libresample/xboxresample/xboxresample.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xboxresample", "xboxresample.vcproj", "{8F267B70-00CA-49D3-9E55-149B3ECE5396}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Profile + ConfigName.2 = Profile_FastCap + ConfigName.3 = Release + ConfigName.4 = Release_LTCG + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Debug.ActiveCfg = Debug|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Debug.Build.0 = Debug|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Profile.ActiveCfg = Profile|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Profile.Build.0 = Profile|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Profile_FastCap.ActiveCfg = Profile_FastCap|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Profile_FastCap.Build.0 = Profile_FastCap|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Release.ActiveCfg = Release|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Release.Build.0 = Release|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Release_LTCG.ActiveCfg = Release_LTCG|Xbox + {8F267B70-00CA-49D3-9E55-149B3ECE5396}.Release_LTCG.Build.0 = Release_LTCG|Xbox + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/stepmania/src/libresample/xboxresample/xboxresample.vcproj b/stepmania/src/libresample/xboxresample/xboxresample.vcproj new file mode 100644 index 0000000000..26b8fca77a --- /dev/null +++ b/stepmania/src/libresample/xboxresample/xboxresample.vcproj @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stepmania/src/mad-0.15.0b/xboxmad/Debug/xboxmad.lib b/stepmania/src/mad-0.15.0b/xboxmad/Debug/xboxmad.lib new file mode 100644 index 0000000000..42d2cbfe6e Binary files /dev/null and b/stepmania/src/mad-0.15.0b/xboxmad/Debug/xboxmad.lib differ diff --git a/stepmania/src/mad-0.15.0b/xboxmad/Release/xboxmad.lib b/stepmania/src/mad-0.15.0b/xboxmad/Release/xboxmad.lib new file mode 100644 index 0000000000..8817201350 Binary files /dev/null and b/stepmania/src/mad-0.15.0b/xboxmad/Release/xboxmad.lib differ diff --git a/stepmania/src/mad-0.15.0b/xboxmad/xboxmad.vcproj b/stepmania/src/mad-0.15.0b/xboxmad/xboxmad.vcproj new file mode 100644 index 0000000000..41bac28aa8 --- /dev/null +++ b/stepmania/src/mad-0.15.0b/xboxmad/xboxmad.vcproj @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stepmania/src/vorbis/xbox/ogg_static.lib b/stepmania/src/vorbis/xbox/ogg_static.lib index da8f1526ce..ef6cf008d8 100644 Binary files a/stepmania/src/vorbis/xbox/ogg_static.lib and b/stepmania/src/vorbis/xbox/ogg_static.lib differ diff --git a/stepmania/src/vorbis/xbox/ogg_static_d.lib b/stepmania/src/vorbis/xbox/ogg_static_d.lib new file mode 100644 index 0000000000..9610c4dda2 Binary files /dev/null and b/stepmania/src/vorbis/xbox/ogg_static_d.lib differ diff --git a/stepmania/src/vorbis/xbox/vorbis_static.lib b/stepmania/src/vorbis/xbox/vorbis_static.lib index 339fa22986..2a8099ada9 100644 Binary files a/stepmania/src/vorbis/xbox/vorbis_static.lib and b/stepmania/src/vorbis/xbox/vorbis_static.lib differ diff --git a/stepmania/src/vorbis/xbox/vorbis_static_d.lib b/stepmania/src/vorbis/xbox/vorbis_static_d.lib new file mode 100644 index 0000000000..7c8b1e542d Binary files /dev/null and b/stepmania/src/vorbis/xbox/vorbis_static_d.lib differ diff --git a/stepmania/src/vorbis/xbox/vorbisfile_static.lib b/stepmania/src/vorbis/xbox/vorbisfile_static.lib index b2d6905001..2579c6397a 100644 Binary files a/stepmania/src/vorbis/xbox/vorbisfile_static.lib and b/stepmania/src/vorbis/xbox/vorbisfile_static.lib differ diff --git a/stepmania/src/vorbis/xbox/vorbisfile_static_d.lib b/stepmania/src/vorbis/xbox/vorbisfile_static_d.lib new file mode 100644 index 0000000000..b4e1785a6c Binary files /dev/null and b/stepmania/src/vorbis/xbox/vorbisfile_static_d.lib differ