fix compilation / modularization update

svn-id: r25487
This commit is contained in:
Joost Peters 2007-02-11 11:24:37 +00:00
parent b14bb6206a
commit fb76c7d2e5
2 changed files with 40 additions and 2 deletions

View file

@ -30,6 +30,10 @@
#include "common/rect.h"
#include "osys_psp.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "sound/mixer.h"
#include "common/config-manager.h"
#include <pspgu.h>
@ -51,6 +55,12 @@ void putPixel(uint16 x, uint16 y, unsigned long colour) {
*(unsigned short *)(DrawBuffer + (y << 9) + x ) = colour;
}
static int timer_handler(int t) {
DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
tm->handler();
return t;
}
const OSystem::GraphicsMode OSystem_PSP::s_supportedGraphicsModes[] = {
{ "320x200 (centered)", "320x200 16-bit centered", CENTERED_320X200 },
{ "353x272 (best-fit, centered)", "353x272 16-bit centered", CENTERED_435X272 },
@ -81,6 +91,18 @@ OSystem_PSP::~OSystem_PSP() {
if (_mouseBuf) free(_mouseBuf);
}
void OSystem_PSP::initBackend() {
_savefile = new DefaultSaveFileManager();
_mixer = new Audio::Mixer();
_timer = new DefaultTimerManager();
setSoundCallback(Audio::Mixer::mixCallback, _mixer);
setTimerCallback(&timer_handler, 10);
OSystem::initBackend();
}
bool OSystem_PSP::hasFeature(Feature f) {
return false;
}

View file

@ -41,6 +41,10 @@ namespace Graphics {
struct Surface;
}
namespace Common {
class SaveFileManager;
class TimerManager;
}
class OSystem_PSP : public OSystem {
public:
@ -73,11 +77,17 @@ protected:
uint32 _samplesPerSec;
SceCtrlData pad;
Common::SaveFileManager *_savefile;
Audio::Mixer *_mixer;
Common::TimerManager *_timer;
public:
OSystem_PSP();
virtual ~OSystem_PSP();
virtual void initBackend();
virtual bool hasFeature(Feature f);
virtual void setFeatureState(Feature f, bool enable);
virtual bool getFeatureState(Feature f);
@ -117,6 +127,7 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
typedef int (*TimerProc)(int interval);
virtual void setTimerCallback(TimerProc callback, int interval);
virtual MutexRef createMutex(void);
@ -124,10 +135,15 @@ public:
virtual void unlockMutex(MutexRef mutex);
virtual void deleteMutex(MutexRef mutex);
typedef void (*SoundProc)(void *param, byte *buf, int len);
virtual bool setSoundCallback(SoundProc proc, void *param);
virtual void clearSoundCallback();
virtual int getOutputSampleRate() const;
Common::SaveFileManager *getSavefileManager() { return _savefile; }
Audio::Mixer *getMixer() { return _mixer; }
Common::TimerManager *getTimerManager() { return _timer; }
virtual void quit();
virtual void setWindowCaption(const char *caption);