mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
DS: Begin modularizing the DS backend
This commit is contained in:
parent
6fa77b3429
commit
1c40d79732
@ -36,7 +36,6 @@
|
||||
|
||||
MaxModMixerManager::MaxModMixerManager(int freq, int bufSize)
|
||||
:
|
||||
_mixer(0),
|
||||
_freq(freq),
|
||||
_bufSize(bufSize) {
|
||||
|
||||
@ -66,17 +65,30 @@ void MaxModMixerManager::init() {
|
||||
sys.fifo_channel = FIFO_MAXMOD;
|
||||
mmInit( &sys );
|
||||
|
||||
mm_stream mystream;
|
||||
mystream.sampling_rate = _freq;
|
||||
mystream.buffer_length = _bufSize / 4;
|
||||
mystream.callback = on_stream_request;
|
||||
mystream.format = MM_STREAM_16BIT_STEREO;
|
||||
mystream.timer = MM_TIMER2;
|
||||
mystream.manual = 0;
|
||||
_stream.sampling_rate = _freq;
|
||||
_stream.buffer_length = _bufSize / 4;
|
||||
_stream.callback = on_stream_request;
|
||||
_stream.format = MM_STREAM_16BIT_STEREO;
|
||||
_stream.timer = MM_TIMER2;
|
||||
_stream.manual = 0;
|
||||
|
||||
mmStreamOpen( &mystream );
|
||||
mmStreamOpen( &_stream );
|
||||
|
||||
_mixer->setReady(true);
|
||||
}
|
||||
|
||||
void MaxModMixerManager::suspendAudio() {
|
||||
mmStreamClose();
|
||||
_audioSuspended = true;
|
||||
}
|
||||
|
||||
int MaxModMixerManager::resumeAudio() {
|
||||
if (!_audioSuspended)
|
||||
return -2;
|
||||
|
||||
mmStreamOpen( &_stream );
|
||||
_audioSuspended = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -23,14 +23,16 @@
|
||||
#ifndef BACKENDS_MIXER_MAXMOD_H
|
||||
#define BACKENDS_MIXER_MAXMOD_H
|
||||
|
||||
#include "audio/mixer_intern.h"
|
||||
#include "backends/mixer/mixer.h"
|
||||
|
||||
#include <mm_types.h>
|
||||
|
||||
/**
|
||||
* MaxMod mixer manager. It wraps the actual implementation
|
||||
* of the Audio:Mixer used by the engine, and sets up
|
||||
* MaxMod and the callback for the audio mixer implementation.
|
||||
*/
|
||||
class MaxModMixerManager {
|
||||
class MaxModMixerManager : public MixerManager {
|
||||
public:
|
||||
MaxModMixerManager(int freq, int bufSize);
|
||||
virtual ~MaxModMixerManager();
|
||||
@ -41,14 +43,17 @@ public:
|
||||
virtual void init();
|
||||
|
||||
/**
|
||||
* Get the audio mixer implementation
|
||||
* Pauses the audio system
|
||||
*/
|
||||
Audio::Mixer *getMixer() { return (Audio::Mixer *)_mixer; }
|
||||
virtual void suspendAudio();
|
||||
|
||||
/**
|
||||
* Resumes the audio system
|
||||
*/
|
||||
virtual int resumeAudio();
|
||||
|
||||
protected:
|
||||
/** The mixer implementation */
|
||||
Audio::MixerImpl *_mixer;
|
||||
|
||||
mm_stream _stream;
|
||||
int _freq, _bufSize;
|
||||
};
|
||||
|
||||
|
@ -49,6 +49,8 @@
|
||||
|
||||
#include "backends/audiocd/default/default-audiocd.h"
|
||||
#include "backends/events/default/default-events.h"
|
||||
#include "backends/mixer/maxmod/maxmod-mixer.h"
|
||||
#include "backends/mutex/null/null-mutex.h"
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/timer/default/default-timer.h"
|
||||
|
||||
@ -57,7 +59,7 @@
|
||||
OSystem_DS *OSystem_DS::_instance = NULL;
|
||||
|
||||
OSystem_DS::OSystem_DS()
|
||||
: _eventSource(NULL), _mixerManager(NULL), _isOverlayShown(true),
|
||||
: _eventSource(NULL), _isOverlayShown(true),
|
||||
_graphicsMode(GFX_HWSCALE), _stretchMode(100),
|
||||
_disableCursorPalette(true), _graphicsEnable(true),
|
||||
_callbackTimer(10), _currentTimeMillis(0)
|
||||
@ -66,11 +68,10 @@ OSystem_DS::OSystem_DS()
|
||||
|
||||
nitroFSInit(NULL);
|
||||
_fsFactory = new DevoptabFilesystemFactory();
|
||||
_mutexManager = new NullMutexManager();
|
||||
}
|
||||
|
||||
OSystem_DS::~OSystem_DS() {
|
||||
delete _mixerManager;
|
||||
_mixerManager = 0;
|
||||
}
|
||||
|
||||
void timerTickHandler() {
|
||||
@ -441,19 +442,6 @@ void OSystem_DS::getTimeAndDate(TimeDate &td) const {
|
||||
td.tm_wday = t.tm_wday;
|
||||
}
|
||||
|
||||
OSystem::MutexRef OSystem_DS::createMutex(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void OSystem_DS::lockMutex(MutexRef mutex) {
|
||||
}
|
||||
|
||||
void OSystem_DS::unlockMutex(MutexRef mutex) {
|
||||
}
|
||||
|
||||
void OSystem_DS::deleteMutex(MutexRef mutex) {
|
||||
}
|
||||
|
||||
void OSystem_DS::quit() {
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
||||
#ifndef _OSYSTEM_DS_H_
|
||||
#define _OSYSTEM_DS_H_
|
||||
|
||||
#include "backends/base-backend.h"
|
||||
#include "backends/modular-backend.h"
|
||||
#include "backends/events/ds/ds-events.h"
|
||||
#include "backends/mixer/maxmod/maxmod-mixer.h"
|
||||
#include "backends/mixer/mixer.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/palette.h"
|
||||
|
||||
@ -36,9 +36,8 @@ enum {
|
||||
GFX_SWSCALE = 2
|
||||
};
|
||||
|
||||
class OSystem_DS : public BaseBackend, public PaletteManager {
|
||||
class OSystem_DS : public ModularMutexBackend, public ModularMixerBackend, public PaletteManager {
|
||||
protected:
|
||||
MaxModMixerManager *_mixerManager;
|
||||
Graphics::Surface _framebuffer, _overlay, _cursor;
|
||||
bool _graphicsEnable, _isOverlayShown;
|
||||
int _graphicsMode, _stretchMode;
|
||||
@ -123,11 +122,6 @@ public:
|
||||
|
||||
virtual Common::String getSystemLanguage() const;
|
||||
|
||||
virtual MutexRef createMutex(void);
|
||||
virtual void lockMutex(MutexRef mutex);
|
||||
virtual void unlockMutex(MutexRef mutex);
|
||||
virtual void deleteMutex(MutexRef mutex);
|
||||
|
||||
virtual void quit();
|
||||
|
||||
virtual void setFocusRectangle(const Common::Rect& rect);
|
||||
@ -141,8 +135,6 @@ public:
|
||||
virtual Graphics::Surface *lockScreen();
|
||||
virtual void unlockScreen();
|
||||
|
||||
virtual Audio::Mixer *getMixer() { return _mixerManager->getMixer(); }
|
||||
|
||||
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
||||
|
||||
void refreshCursor(u16 *dst, const Graphics::Surface &src, const uint16 *palette);
|
||||
|
Loading…
Reference in New Issue
Block a user