Xbox: Fix exception handling
This commit is contained in:
@@ -34,10 +34,6 @@
|
|||||||
#include "RageSoundReader_Resample.h"
|
#include "RageSoundReader_Resample.h"
|
||||||
#include "RageSoundReader_FileReader.h"
|
#include "RageSoundReader_FileReader.h"
|
||||||
|
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualMemory.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const int channels = 2;
|
const int channels = 2;
|
||||||
const int framesize = 2 * channels; /* 16-bit */
|
const int framesize = 2 * channels; /* 16-bit */
|
||||||
#define samplerate() Sample->GetSampleRate()
|
#define samplerate() Sample->GetSampleRate()
|
||||||
@@ -343,11 +339,6 @@ int RageSound::FillBuf( int frames )
|
|||||||
* that would be read. */
|
* that would be read. */
|
||||||
int RageSound::GetData( char *buffer, int frames )
|
int RageSound::GetData( char *buffer, int frames )
|
||||||
{
|
{
|
||||||
#if defined(XBOX)
|
|
||||||
// should prevent a page fault crash
|
|
||||||
vmem_Manager.Lock(buffer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( m_Param.m_LengthSeconds != -1 )
|
if( m_Param.m_LengthSeconds != -1 )
|
||||||
{
|
{
|
||||||
/* We have a length; only read up to the end. */
|
/* We have a length; only read up to the end. */
|
||||||
@@ -376,10 +367,6 @@ int RageSound::GetData( char *buffer, int frames )
|
|||||||
databuf.read( buffer, got*framesize );
|
databuf.read( buffer, got*framesize );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(XBOX)
|
|
||||||
vmem_Manager.Unlock(buffer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
#include "arch/arch.h"
|
#include "arch/arch.h"
|
||||||
#include "arch/Sound/RageSoundDriver.h"
|
#include "arch/Sound/RageSoundDriver.h"
|
||||||
|
|
||||||
#if defined(XBOX)
|
|
||||||
#include "archutils/Xbox/VirtualMemory.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The lock ordering requirements are:
|
* The lock ordering requirements are:
|
||||||
* RageSound::Lock before g_SoundManMutex
|
* RageSound::Lock before g_SoundManMutex
|
||||||
@@ -212,10 +208,6 @@ RageSound *RageSoundManager::PlaySound( RageSound &snd, const RageSoundParams *p
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sound_to_play = new RageSound(snd);
|
sound_to_play = new RageSound(snd);
|
||||||
#if defined(XBOX)
|
|
||||||
// keep the sound data committed to memory
|
|
||||||
vmem_Manager.Lock(sound_to_play);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We're responsible for freeing it. */
|
/* We're responsible for freeing it. */
|
||||||
g_SoundManMutex.Lock(); /* lock for access to owned_sounds */
|
g_SoundManMutex.Lock(); /* lock for access to owned_sounds */
|
||||||
|
|||||||
@@ -918,21 +918,7 @@ static void ProcessArgsSecond()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
void XboxMain();
|
|
||||||
|
|
||||||
void __cdecl main()
|
void __cdecl main()
|
||||||
{
|
|
||||||
_set_new_handler(NoMemory);
|
|
||||||
_set_new_mode(1);
|
|
||||||
|
|
||||||
__try
|
|
||||||
{
|
|
||||||
XboxMain();
|
|
||||||
}
|
|
||||||
__except(CheckPageFault(GetExceptionInformation())) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
void XboxMain()
|
|
||||||
#else
|
#else
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
#endif
|
#endif
|
||||||
@@ -940,6 +926,10 @@ int main(int argc, char* argv[])
|
|||||||
#if defined(XBOX)
|
#if defined(XBOX)
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
char *argv[] = {"default.xbe"};
|
char *argv[] = {"default.xbe"};
|
||||||
|
|
||||||
|
_set_new_handler(NoMemory);
|
||||||
|
_set_new_mode(1);
|
||||||
|
SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) CheckPageFault);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_argc = argc;
|
g_argc = argc;
|
||||||
|
|||||||
Reference in New Issue
Block a user