diff options
Diffstat (limited to 'backends/platform/psp/osys_psp.cpp')
-rw-r--r-- | backends/platform/psp/osys_psp.cpp | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index a36ae1847f..58d98bc219 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -37,7 +37,6 @@ #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" #include "backends/platform/psp/powerman.h" -#include "backends/platform/psp/thread.h" #include "backends/saves/psp/psp-saves.h" #include "backends/timer/default/default-timer.h" @@ -49,7 +48,6 @@ #include "backends/platform/psp/trace.h" -#define USE_PSP_AUDIO #define SAMPLES_PER_SEC 44100 @@ -60,11 +58,7 @@ static int timer_handler(int t) { } void OSystem_PSP::initSDL() { -#ifdef USE_PSP_AUDIO - SDL_Init(0); -#else - SDL_Init(SDL_INIT_AUDIO); -#endif + SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER); } OSystem_PSP::~OSystem_PSP() {} @@ -91,7 +85,7 @@ void OSystem_PSP::initBackend() { _inputHandler.init(); initSDL(); - + _savefile = new PSPSaveFileManager; _timer = new DefaultTimerManager(); @@ -299,18 +293,17 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { return _inputHandler.getAllInputs(event); } + uint32 OSystem_PSP::getMillis() { - return PspThread::getMillis(); + return SDL_GetTicks(); } void OSystem_PSP::delayMillis(uint msecs) { - PspThread::delayMillis(msecs); + SDL_Delay(msecs); } void OSystem_PSP::setTimerCallback(TimerProc callback, int interval) { - _pspTimer.setCallback((PspTimer::CallbackFunc)callback); - _pspTimer.setIntervalMs(interval); - _pspTimer.start(); + SDL_SetTimer(interval, (SDL_TimerCallback)callback); } OSystem::MutexRef OSystem_PSP::createMutex(void) { @@ -338,6 +331,8 @@ void OSystem_PSP::mixCallback(void *sys, byte *samples, int len) { } void OSystem_PSP::setupMixer(void) { + SDL_AudioSpec desired; + SDL_AudioSpec obtained; // Determine the desired output sampling frequency. uint32 samplesPerSec = 0; @@ -354,22 +349,6 @@ void OSystem_PSP::setupMixer(void) { while (samples * 16 > samplesPerSec * 2) samples >>= 1; - assert(!_mixer); - -#ifdef USE_PSP_AUDIO - if (!_audio.open(samplesPerSec, 2, samples, mixCallback, this)) { - PSP_ERROR("failed to open audio\n"); - return; - } - samplesPerSec = _audio.getFrequency(); // may have been changed by audio system - _mixer = new Audio::MixerImpl(this, samplesPerSec); - assert(_mixer); - _mixer->setReady(true); - _audio.unpause(); -#else - SDL_AudioSpec obtained; - SDL_AudioSpec desired; - memset(&desired, 0, sizeof(desired)); desired.freq = samplesPerSec; desired.format = AUDIO_S16SYS; @@ -377,7 +356,8 @@ void OSystem_PSP::setupMixer(void) { desired.samples = samples; desired.callback = mixCallback; desired.userdata = this; - + + assert(!_mixer); if (SDL_OpenAudio(&desired, &obtained) != 0) { warning("Could not open audio: %s", SDL_GetError()); _mixer = new Audio::MixerImpl(this, samplesPerSec); @@ -396,15 +376,10 @@ void OSystem_PSP::setupMixer(void) { SDL_PauseAudio(0); } -#endif /* USE_PSP_AUDIO */ } void OSystem_PSP::quit() { -#ifdef USE_PSP_AUDIO - _audio.close(); -#else SDL_CloseAudio(); -#endif SDL_Quit(); sceKernelExitGame(); } |