From 24b0d4800ae5e94a03232def0788d045d837499f Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 25 Oct 2006 19:18:38 +0000 Subject: DS backend : Compile fixes for the new backends system, still needs plugging the old callbacks svn-id: r24504 --- backends/platform/ds/arm9/source/dsmain.cpp | 8 ++++---- backends/platform/ds/arm9/source/dsmain.h | 6 +++--- backends/platform/ds/arm9/source/osystem_ds.cpp | 4 ++++ backends/platform/ds/arm9/source/osystem_ds.h | 22 +++++++++++++++++++++- 4 files changed, 32 insertions(+), 8 deletions(-) (limited to 'backends/platform/ds/arm9/source') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 31ef245982..dbdf4fd876 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -69,7 +69,7 @@ int currentTimeMillis; // Timer Callback int callbackInterval; int callbackTimer; -OSystem::TimerProc callback; +OSystem_DS::TimerProc callback; // Scaled bool scaledMode; @@ -99,7 +99,7 @@ int lastEventFrame; bool indyFightState; bool indyFightRight; -OSystem::SoundProc soundCallback; +OSystem_DS::SoundProc soundCallback; void* soundParam; int lastCallbackFrame; bool bufferFirstHalf; @@ -603,7 +603,7 @@ u16* get8BitBackBuffer() { return BG_GFX + 0x10000; // 16bit qty! } -void setSoundProc(OSystem::SoundProc proc, void* param) { +void setSoundProc(OSystem_DS::SoundProc proc, void* param) { // consolePrintf("Set sound callback"); soundCallback = proc; soundParam = param; @@ -1464,7 +1464,7 @@ int getMillis() { // return frameCount * FRAME_TIME; } -void setTimerCallback(OSystem::TimerProc proc, int interval) { +void setTimerCallback(OSystem_DS::TimerProc proc, int interval) { // consolePrintf("Set timer proc %x, int %d\n", proc, interval); callback = proc; callbackInterval = interval; diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index c6c4148cb7..20d9adcd25 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -23,7 +23,7 @@ #include #include "stdafx.h" -#include "system.h" +#include "osystem_ds.h" #include "scummconsole.h" #include "NDS/scummvm_ipc.h" @@ -63,12 +63,12 @@ void setTalkPos(int x, int y); void setTopScreenTarget(int x, int y); // Timers -void setTimerCallback(OSystem::TimerProc proc, int interval); // Setup a callback function at a regular interval +void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval int getMillis(); // Return the current runtime in milliseconds void doTimerCallback(); // Call callback function if required // Sound -void setSoundProc(OSystem::SoundProc proc, void* param); // Setup a callback function for sound +void setSoundProc(OSystem_DS::SoundProc proc, void* param); // Setup a callback function for sound void doSoundCallback(); // Call function if sound buffers need more data void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound void stopSound(int channel); diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 12d3b0ad01..b018c7d378 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -44,6 +44,8 @@ OSystem_DS::OSystem_DS() lastPenFrame = 0; queuePos = 0; _instance = this; + _mixer = NULL; + _timer = NULL; } OSystem_DS::~OSystem_DS() { @@ -53,6 +55,8 @@ void OSystem_DS::initBackend() { ConfMan.setInt("autosave_period", 0); ConfMan.setBool("FM_low_quality", true); + _mixer = new DSAudioMixer; + _timer = new DSTimerManager; OSystem::initBackend(); } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 7920ea4475..b5d191bee9 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -25,6 +25,18 @@ #include "nds.h" #include "ramsave.h" #include "gbampsave.h" +#include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" +#include "sound/mixer.h" + +class DSAudioMixer : public Audio::Mixer +{ +}; + +class DSTimerManager : public DefaultTimerManager +{ +}; + class OSystem_DS : public OSystem { public: @@ -37,8 +49,13 @@ public: DSSaveFileManager saveManager; GBAMPSaveFileManager mpSaveManager; - + DSAudioMixer* _mixer; + DSTimerManager* _timer; + static OSystem_DS* _instance; + + typedef void (*SoundProc)(void *param, byte *buf, int len); + typedef int (*TimerProc)(int interval); public: @@ -119,6 +136,9 @@ public: virtual void clearFocusRectangle(); virtual void initBackend(); + + virtual Audio::Mixer* getMixer() { return _mixer; } + virtual Common::TimerManager* getTimerManager() { return _timer; } }; static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { -- cgit v1.2.3