compiles on Xbox (still a CRT linking error though)

This commit is contained in:
Chris Danford
2003-07-11 03:15:28 +00:00
parent df975a9692
commit 8158ca8770
22 changed files with 768 additions and 65 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
#include "RageMath.h" #include "RageMath.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "RageLog.h" #include "RageLog.h"
#include "StepMania.h" #include "arch/ArchHooks/ArchHooks.h"
/* This is Reset instead of Init since many derived classes have Init() functions /* This is Reset instead of Init since many derived classes have Init() functions
* that shouldn't change the position of the actor. */ * that shouldn't change the position of the actor. */
+1 -1
View File
@@ -26,7 +26,7 @@
#include "Sprite.h" #include "Sprite.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "StepMania.h" // for HOOKS #include "arch/ArchHooks/ArchHooks.h"
#include "RageTextureManager.h" #include "RageTextureManager.h"
-3
View File
@@ -600,9 +600,6 @@ bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
return true; return true;
} }
#include "SDL_opengl.h"
#include "RageTimer.h"
void Model::DrawPrimitives() void Model::DrawPrimitives()
{ {
if(m_Meshes.empty()) if(m_Meshes.empty())
+1 -1
View File
@@ -18,7 +18,7 @@
#include "RageException.h" #include "RageException.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageTypes.h" #include "RageTypes.h"
#include "StepMania.h" // yuck. Needed for HOOKS. #include "arch/ArchHooks/ArchHooks.h"
#include "SDL.h" #include "SDL.h"
#include "SDL_image.h" #include "SDL_image.h"
+17 -5
View File
@@ -28,7 +28,7 @@
#include "D3dx8math.h" #include "D3dx8math.h"
#include "SDL_video.h" // for SDL_Surface #include "SDL_video.h" // for SDL_Surface
#include "SDL_utils.h" #include "SDL_utils.h"
#include "Dxerr8.h" #include "D3DX8Core.h"
#include "arch/arch.h" #include "arch/arch.h"
@@ -38,12 +38,20 @@
#endif #endif
// load Windows D3D8 dynamically // load Windows D3D8 dynamically
#pragma comment(lib, "D3dx8.lib") #pragma comment(lib, "D3dx8.lib")
#pragma comment(lib, "Dxerr8.lib") //#pragma comment(lib, "Dxerr8.lib")
#include <math.h> #include <math.h>
#include <list> #include <list>
CString GetErrorString( HRESULT hr )
{
char szError[1024] = "";
D3DXGetErrorString( hr, szError, sizeof(szError) );
return szError;
}
// //
// Globals // Globals
// //
@@ -290,11 +298,13 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
g_pd3d = NULL; g_pd3d = NULL;
} }
#if !defined(_XBOX)
if( g_D3D8_Module ) if( g_D3D8_Module )
{ {
FreeLibrary( g_D3D8_Module ); FreeLibrary( g_D3D8_Module );
g_D3D8_Module = NULL; g_D3D8_Module = NULL;
} }
#endif
throw; throw;
} }
} }
@@ -472,7 +482,7 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
if( FAILED(hr) ) if( FAILED(hr) )
{ {
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called! SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
RageException::Throw( "CreateDevice failed: '%s'", DXGetErrorString8(hr) ); RageException::Throw( "CreateDevice failed: '%s'", GetErrorString(hr).c_str() );
} }
} }
else else
@@ -482,7 +492,7 @@ bool RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
if( FAILED(hr) ) if( FAILED(hr) )
{ {
SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called! SDL_QuitSubSystem(SDL_INIT_VIDEO); // exit out of full screen. The ~RageDisplay will not be called!
RageException::Throw( "g_pd3dDevice->Reset failed: '%s'", DXGetErrorString8(hr) ); RageException::Throw( "g_pd3dDevice->Reset failed: '%s'", GetErrorString(hr).c_str() );
} }
} }
@@ -543,8 +553,10 @@ int RageDisplay_D3D::GetMaxTextureSize() const
void RageDisplay_D3D::BeginFrame() void RageDisplay_D3D::BeginFrame()
{ {
#ifndef _XBOX
if( g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET ) if( g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET )
SetVideoMode( g_CurrentParams ); SetVideoMode( g_CurrentParams );
#endif
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 ); D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
@@ -902,7 +914,7 @@ unsigned RageDisplay_D3D::CreateTexture(
hr = g_pd3dDevice->CreateTexture( img->w, img->h, 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex ); hr = g_pd3dDevice->CreateTexture( img->w, img->h, 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex );
if( FAILED(hr) ) if( FAILED(hr) )
RageException::Throw( "CreateTexture(%i,%i,pixfmt=%i) failed: %s", RageException::Throw( "CreateTexture(%i,%i,pixfmt=%i) failed: %s",
img->w, img->h, pixfmt, DXGetErrorString8(hr) ); img->w, img->h, pixfmt, GetErrorString(hr).c_str() );
unsigned uTexHandle = (unsigned)pTex; unsigned uTexHandle = (unsigned)pTex;
+1 -1
View File
@@ -11,7 +11,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "StepMania.h" #include "arch/ArchHooks/ArchHooks.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageTimer.h" #include "RageTimer.h"
+7 -10
View File
@@ -17,6 +17,7 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageLog.h" #include "RageLog.h"
#include <math.h> #include <math.h>
#include "arch/ArchHooks/ArchHooks.h"
void RageVec2Normalize( RageVector2* pOut, const RageVector2* pV ) void RageVec2Normalize( RageVector2* pOut, const RageVector2* pV )
{ {
@@ -240,24 +241,20 @@ void RageMatrixCommand( CString sCommandString, RageMatrix &mat )
else if( sName=="rotationz" ) RageMatrixRotationZ( &b, fParam(1) ); else if( sName=="rotationz" ) RageMatrixRotationZ( &b, fParam(1) );
else else
{ {
CString sError = ssprintf( "Unrecognized matrix command name '%s' in command string '%s'.", sName.c_str(), sCommandString.c_str() ); CString sError = ssprintf( "MatrixCommand: Unrecognized matrix command name '%s' in command string '%s'.", sName.c_str(), sCommandString.c_str() );
LOG->Warn( sError ); LOG->Warn( sError );
#if defined(WIN32) && !defined(_XBOX) // XXX arch? if( DISPLAY->IsWindowed() )
if( DISPLAY->GetVideoModeParams().windowed ) HOOKS->MessageBoxOK( sError );
MessageBox(NULL, sError, "MatrixCommand", MB_OK);
#endif
continue; continue;
} }
if( iMaxIndexAccessed != (int)asTokens.size()-1 ) if( iMaxIndexAccessed != (int)asTokens.size()-1 )
{ {
CString sError = ssprintf( "Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() ); CString sError = ssprintf( "MatrixCommand: Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() );
LOG->Warn( sError ); LOG->Warn( sError );
#if defined(WIN32) // XXX arch? if( DISPLAY->IsWindowed() )
if( DISPLAY->GetVideoModeParams().windowed ) HOOKS->MessageBoxOK( sError );
MessageBox(NULL, sError, "MatrixCommand", MB_OK);
#endif
continue; continue;
} }
+5 -5
View File
@@ -133,8 +133,7 @@ CString vssprintf( const char *fmt, va_list argList)
} }
#ifdef WIN32 #ifdef WIN32
#include "dxerr8.h" #include "D3DX8Core.h"
#pragma comment(lib, "DxErr8.lib")
CString hr_ssprintf( int hr, const char *fmt, ...) CString hr_ssprintf( int hr, const char *fmt, ...)
{ {
@@ -143,9 +142,10 @@ CString hr_ssprintf( int hr, const char *fmt, ...)
CString s = vssprintf( fmt, va ); CString s = vssprintf( fmt, va );
va_end(va); va_end(va);
/* Why was this commented out? -glenn */ char szError[1024] = "";
return s + ssprintf( " (%s)", DXGetErrorString8(hr) ); D3DXGetErrorString( hr, szError, sizeof(szError) );
// return s;// += ssprintf( " (%s)", DXGetErrorString8(hr) );
return s + ssprintf( " (%s)", szError );
} }
CString werr_ssprintf( int err, const char *fmt, ...) CString werr_ssprintf( int err, const char *fmt, ...)
+1 -1
View File
@@ -4,7 +4,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#if defined(WIN32) #if defined(_WINDOWS)
/* Convert from the given codepage to UTF-8. Return true if successful. */ /* Convert from the given codepage to UTF-8. Return true if successful. */
static bool CodePageConvert(CString &txt, int cp) static bool CodePageConvert(CString &txt, int cp)
-2
View File
@@ -13,8 +13,6 @@
#include "ScreenEz2SelectMusic.h" #include "ScreenEz2SelectMusic.h"
#include <math.h> #include <math.h>
#include "SDL.h"
#include "SDL_opengl.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "RageSoundManager.h" #include "RageSoundManager.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
+1 -1
View File
@@ -25,7 +25,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ModeChoice.h" #include "ModeChoice.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "StepMania.h" #include "arch/ArchHooks/ArchHooks.h"
#define CHOICES THEME->GetMetric (m_sName,"Choices") #define CHOICES THEME->GetMetric (m_sName,"Choices")
+1 -1
View File
@@ -22,7 +22,7 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "SDL_utils.h" #include "SDL_utils.h"
#include "StepMania.h" #include "arch/ArchHooks/ArchHooks.h"
Sprite::Sprite() Sprite::Sprite()
{ {
+4 -5
View File
@@ -49,9 +49,8 @@
#include "SongCacheIndex.h" #include "SongCacheIndex.h"
#include "BannerCache.h" #include "BannerCache.h"
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "arch/ArchHooks/ArchHooks.h"
/* This is also a global class; we own it. */
ArchHooks *HOOKS = NULL;
#ifdef WIN32 #ifdef WIN32
@@ -200,7 +199,7 @@ static void BoostAppPri()
if(!ChangeAppPri()) if(!ChangeAppPri())
return; return;
#ifdef WIN32 #ifdef _WINDOWS
/* We just want a slight boost, so we don't skip needlessly if something happens /* We just want a slight boost, so we don't skip needlessly if something happens
* in the background. We don't really want to be high-priority--above normal should * in the background. We don't really want to be high-priority--above normal should
* be enough. However, ABOVE_NORMAL_PRIORITY_CLASS is only supported in Win2000 * be enough. However, ABOVE_NORMAL_PRIORITY_CLASS is only supported in Win2000
@@ -423,7 +422,7 @@ static void RestoreAppPri()
if(!ChangeAppPri()) if(!ChangeAppPri())
return; return;
#ifdef WIN32 #ifdef _WINDOWS
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
#endif #endif
} }
@@ -517,7 +516,7 @@ int main(int argc, char* argv[])
if ( SDL_GetWMInfo(&info) < 0 ) if ( SDL_GetWMInfo(&info) < 0 )
RageException::Throw( "SDL_GetWMInfo failed" ); RageException::Throw( "SDL_GetWMInfo failed" );
#ifdef WIN32 #ifdef _WINDOWS
g_hWndMain = info.window; g_hWndMain = info.window;
#endif #endif
File diff suppressed because it is too large Load Diff
-3
View File
@@ -15,9 +15,6 @@ void ApplyGraphicOptions();
void ExitGame(); void ExitGame();
void ResetGame(); void ResetGame();
#include "arch/ArchHooks/ArchHooks.h"
extern ArchHooks *HOOKS; // global and accessable from anywhere in our program
#if defined(WIN32) #if defined(WIN32)
extern HWND g_hWndMain; extern HWND g_hWndMain;
#endif #endif
+7 -8
View File
@@ -22,6 +22,7 @@
#include "Font.h" #include "Font.h"
#include "FontCharAliases.h" #include "FontCharAliases.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "arch/ArchHooks/ArchHooks.h"
ThemeManager* THEME = NULL; // global object accessable from anywhere in the program ThemeManager* THEME = NULL; // global object accessable from anywhere in the program
@@ -157,15 +158,14 @@ try_element_again:
FlushDirCache(); FlushDirCache();
CString message = ssprintf( CString message = ssprintf(
"There is more than one theme element element that matches " "ThemeManager: There is more than one theme element element that matches "
"'%s/%s/%s'. Please remove all but one of these matches.", "'%s/%s/%s'. Please remove all but one of these matches.",
sThemeName.c_str(), sCategory.c_str(), sFileName.c_str() ); sThemeName.c_str(), sCategory.c_str(), sFileName.c_str() );
#if defined(WIN32) // XXX arch?
if( DISPLAY->IsWindowed() ) if( DISPLAY->IsWindowed() )
if( MessageBox(NULL, message, "ThemeManager", MB_RETRYCANCEL ) == IDRETRY) if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) )
goto try_element_again; goto try_element_again;
#endif
RageException::Throw( message ); RageException::Throw( message );
} }
else if( asElementPaths.size() == 0 ) else if( asElementPaths.size() == 0 )
@@ -206,15 +206,14 @@ try_element_again:
else else
{ {
CString message = ssprintf( CString message = ssprintf(
"The redirect '%s' points to the file '%s', which does not exist. " "ThemeManager: The redirect '%s' points to the file '%s', which does not exist. "
"Verify that this redirect is correct.", "Verify that this redirect is correct.",
sPath.c_str(), sNewFileName.c_str()); sPath.c_str(), sNewFileName.c_str());
#if defined(WIN32) // XXX arch?
if( DISPLAY->IsWindowed() ) if( DISPLAY->IsWindowed() )
if( MessageBox(NULL, message, "ThemeManager", MB_RETRYCANCEL ) == IDRETRY) if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) )
goto try_element_again; goto try_element_again;
#endif
RageException::Throw( "%s", message.c_str() ); RageException::Throw( "%s", message.c_str() );
} }
} }
@@ -0,0 +1,4 @@
#include "global.h"
#include "ArchHooks.h"
ArchHooks *HOOKS = NULL;
+2
View File
@@ -40,6 +40,8 @@ public:
#endif #endif
extern ArchHooks *HOOKS; // global and accessable from anywhere in our program
/* /*
* Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved. * Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved.
* *
@@ -3,7 +3,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#if defined(WIN32) #if defined(_WINDOWS)
#include "MovieTexture_DShow.h" #include "MovieTexture_DShow.h"
#endif #endif
@@ -64,7 +64,7 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID)
{ {
DumpAVIDebugInfo( ID.filename ); DumpAVIDebugInfo( ID.filename );
#if defined(WIN32) #if defined(_WINDOWS)
return new MovieTexture_DShow(ID); return new MovieTexture_DShow(ID);
#else #else
/* XXX: need a simple null movie texture object */ /* XXX: need a simple null movie texture object */
+34 -6
View File
@@ -4,7 +4,6 @@
#include "../../RageLog.h" #include "../../RageLog.h"
#define DIRECTSOUND_VERSION 0x0700 #define DIRECTSOUND_VERSION 0x0700
#include <mmsystem.h>
#include <dsound.h> #include <dsound.h>
#include <math.h> #include <math.h>
@@ -26,28 +25,35 @@ DSound::DSound()
{ {
HRESULT hr; HRESULT hr;
#ifndef _XBOX
// Initialize COM // Initialize COM
if( FAILED( hr = CoInitialize( NULL ) ) ) if( FAILED( hr = CoInitialize( NULL ) ) )
RageException::ThrowNonfatal(hr_ssprintf(hr, "CoInitialize")); RageException::ThrowNonfatal(hr_ssprintf(hr, "CoInitialize"));
#endif
// Create IDirectSound using the primary sound device // Create IDirectSound using the primary sound device
if( FAILED( hr = DirectSoundCreate( NULL, &ds, NULL ) ) ) if( FAILED( hr = DirectSoundCreate( NULL, &ds, NULL ) ) )
RageException::ThrowNonfatal(hr_ssprintf(hr, "DirectSoundCreate")); RageException::ThrowNonfatal(hr_ssprintf(hr, "DirectSoundCreate"));
#ifndef _XBOX
DirectSoundEnumerate(EnumCallback, 0); DirectSoundEnumerate(EnumCallback, 0);
/* Try to set primary mixing privileges */ /* Try to set primary mixing privileges */
hr = ds->SetCooperativeLevel(GetDesktopWindow(), DSSCL_PRIORITY); hr = ds->SetCooperativeLevel(GetDesktopWindow(), DSSCL_PRIORITY);
#endif
} }
DSound::~DSound() DSound::~DSound()
{ {
ds->Release(); ds->Release();
#ifndef _XBOX
CoUninitialize(); CoUninitialize();
#endif
} }
bool DSound::IsEmulated() const bool DSound::IsEmulated() const
{ {
#ifndef _XBOX
/* Don't bother wasting time trying to create buffers if we're /* Don't bother wasting time trying to create buffers if we're
* emulated. This also gives us better diagnostic information. */ * emulated. This also gives us better diagnostic information. */
DSCAPS Caps; DSCAPS Caps;
@@ -61,6 +67,9 @@ bool DSound::IsEmulated() const
} }
return !!(Caps.dwFlags & DSCAPS_EMULDRIVER); return !!(Caps.dwFlags & DSCAPS_EMULDRIVER);
#else
return false;
#endif
} }
DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware, DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware,
@@ -100,30 +109,44 @@ DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware,
DSBUFFERDESC format; DSBUFFERDESC format;
memset(&format, 0, sizeof(format)); memset(&format, 0, sizeof(format));
format.dwSize = sizeof(format); format.dwSize = sizeof(format);
#ifdef _XBOX
format.dwFlags = DSBCAPS_CTRLVOLUME;
#else
format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME; format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME;
#endif
#ifndef _XBOX
/* Don't use DSBCAPS_STATIC. It's meant for static buffers, and we /* Don't use DSBCAPS_STATIC. It's meant for static buffers, and we
* only use streaming buffers. */ * only use streaming buffers. */
if(hardware == HW_HARDWARE) if(hardware == HW_HARDWARE)
format.dwFlags |= DSBCAPS_LOCHARDWARE; format.dwFlags |= DSBCAPS_LOCHARDWARE;
else else
format.dwFlags |= DSBCAPS_LOCSOFTWARE; format.dwFlags |= DSBCAPS_LOCSOFTWARE;
#endif
if(NeedCtrlFrequency) if(NeedCtrlFrequency)
format.dwFlags |= DSBCAPS_CTRLFREQUENCY; format.dwFlags |= DSBCAPS_CTRLFREQUENCY;
format.dwBufferBytes = buffersize; format.dwBufferBytes = buffersize;
#ifndef _XBOX
format.dwReserved = 0; format.dwReserved = 0;
#endif
format.lpwfxFormat = &waveformat; format.lpwfxFormat = &waveformat;
IDirectSoundBuffer *sndbuf_buf; /* Query IID_IDirectSoundBuffer instead of IID_IDirectSoundBuffer8. -Chris */
HRESULT hr = ds.GetDS()->CreateSoundBuffer(&format, &sndbuf_buf, NULL); // IDirectSoundBuffer *sndbuf_buf;
// HRESULT hr = ds.GetDS()->CreateSoundBuffer(&format, &sndbuf_buf, NULL);
// if (FAILED(hr))
// RageException::ThrowNonfatal(hr_ssprintf(hr, "CreateSoundBuffer failed"));
//
// sndbuf_buf->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*) &buf);
// ASSERT(buf);
HRESULT hr = ds.GetDS()->CreateSoundBuffer(&format, &buf, NULL);
if (FAILED(hr)) if (FAILED(hr))
RageException::ThrowNonfatal(hr_ssprintf(hr, "CreateSoundBuffer failed")); RageException::ThrowNonfatal(hr_ssprintf(hr, "CreateSoundBuffer failed"));
sndbuf_buf->QueryInterface(IID_IDirectSoundBuffer, (LPVOID*) &buf); #ifndef _XBOX
ASSERT(buf);
/* I'm not sure this should ever be needed, but ... */ /* I'm not sure this should ever be needed, but ... */
DSBCAPS bcaps; DSBCAPS bcaps;
bcaps.dwSize=sizeof(bcaps); bcaps.dwSize=sizeof(bcaps);
@@ -137,6 +160,7 @@ DSoundBuf::DSoundBuf(DSound &ds, DSoundBuf::hw hardware,
buffersize = bcaps.dwBufferBytes; buffersize = bcaps.dwBufferBytes;
writeahead = min(writeahead, buffersize); writeahead = min(writeahead, buffersize);
} }
#endif
} }
void DSoundBuf::SetSampleRate(int hz) void DSoundBuf::SetSampleRate(int hz)
@@ -187,6 +211,7 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int *play_pos, i
/* It's easiest to think of the cursor as a block, starting and ending at /* It's easiest to think of the cursor as a block, starting and ending at
* the two values returned by GetCurrentPosition, that we can't write to. */ * the two values returned by GetCurrentPosition, that we can't write to. */
result = buf->GetCurrentPosition(&cursorstart, &cursorend); result = buf->GetCurrentPosition(&cursorstart, &cursorend);
#ifndef _XBOX
if ( result == DSERR_BUFFERLOST ) { if ( result == DSERR_BUFFERLOST ) {
buf->Restore(); buf->Restore();
result = buf->GetCurrentPosition(&cursorstart, &cursorend); result = buf->GetCurrentPosition(&cursorstart, &cursorend);
@@ -195,6 +220,7 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int *play_pos, i
LOG->Warn(hr_ssprintf(result, "DirectSound::GetCurrentPosition failed")); LOG->Warn(hr_ssprintf(result, "DirectSound::GetCurrentPosition failed"));
return false; return false;
} }
#endif
/* XXX We can figure out if we've underrun, and increase the write-ahead /* XXX We can figure out if we've underrun, and increase the write-ahead
@@ -271,10 +297,12 @@ bool DSoundBuf::get_output_buf(char **buffer, unsigned *bufsiz, int *play_pos, i
/* Lock the audio buffer. */ /* Lock the audio buffer. */
result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0); result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0);
#ifndef _XBOX
if ( result == DSERR_BUFFERLOST ) { if ( result == DSERR_BUFFERLOST ) {
buf->Restore(); buf->Restore();
result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0); result = buf->Lock(write_cursor, num_bytes_empty, (LPVOID *)buffer, (DWORD *) bufsiz, NULL, &junk, 0);
} }
#endif
if ( result != DS_OK ) { if ( result != DS_OK ) {
LOG->Warn(hr_ssprintf(result, "Couldn't lock the DirectSound buffer.")); LOG->Warn(hr_ssprintf(result, "Couldn't lock the DirectSound buffer."));
return false; return false;
+9 -4
View File
@@ -17,7 +17,9 @@
#include "arch_linux.h" #include "arch_linux.h"
#elif defined(DARWIN) #elif defined(DARWIN)
#include "arch_darwin.h" #include "arch_darwin.h"
#elif defined(WIN32) #elif defined(_XBOX)
#include "arch_xbox.h"
#elif defined(_WINDOWS)
#include "arch_Win32.h" #include "arch_Win32.h"
#endif #endif
@@ -28,13 +30,13 @@ LowLevelWindow *MakeLowLevelWindow() { return new ARCH_LOW_LEVEL_WINDOW; }
void MakeInputHandlers(vector<InputHandler *> &Add) void MakeInputHandlers(vector<InputHandler *> &Add)
{ {
#if defined(WIN32) && !defined(_XBOX) #if defined(_WINDOWS)
Add.push_back(new InputHandler_DInput); Add.push_back(new InputHandler_DInput);
#else #else
Add.push_back(new InputHandler_SDL); Add.push_back(new InputHandler_SDL);
#endif #endif
#if defined(WIN32) #if defined(_WINDOWS)
Add.push_back(new InputHandler_Win32_Pump); Add.push_back(new InputHandler_Win32_Pump);
// Add.push_back(new InputHandler_Win32_Para); // Add.push_back(new InputHandler_Win32_Para);
#endif #endif
@@ -62,11 +64,14 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers)
Driver = DriversToTry[i]; Driver = DriversToTry[i];
LOG->Trace("Initializing driver: %s", DriversToTry[i].c_str()); LOG->Trace("Initializing driver: %s", DriversToTry[i].c_str());
#ifdef WIN32 #ifdef WINDOWS
if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound;
if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software; if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software;
if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut; if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut;
#endif #endif
#ifdef _XBOX
if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound;
#endif
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
if(!DriversToTry[i].CompareNoCase("ALSA9")) ret = new RageSound_ALSA9; if(!DriversToTry[i].CompareNoCase("ALSA9")) ret = new RageSound_ALSA9;
#endif #endif
+20
View File
@@ -0,0 +1,20 @@
#ifndef XBOX_ARCH_H
#define XBOX_ARCH_H
/* Load drivers for Win32. */
#include "LoadingWindow/LoadingWindow_SDL.h"
#include "ErrorDialog/ErrorDialog_null.h"
#include "ArchHooks/ArchHooks_none.h"
#include "InputHandler/InputHandler_DirectInput.h"
#include "Sound/RageSoundDriver_DSound.h"
#endif
/*
* Copyright (c) 2002 by the person(s) listed below. All rights reserved.
*
* Glenn Maynard
* Chris Danford
*/