aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds/arm9/source/osystem_ds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/ds/arm9/source/osystem_ds.cpp')
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp57
1 files changed, 35 insertions, 22 deletions
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 462990cb32..b157a3a87a 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -41,6 +41,9 @@
#include "touchkeyboard.h"
#include "backends/fs/ds/ds-fs-factory.h"
+#include "backends/audiocd/default/default-audiocd.h"
+#include "backends/timer/default/default-timer.h"
+
#ifdef ENABLE_AGI
#include "wordcompletion.h"
#endif
@@ -79,7 +82,7 @@
OSystem_DS *OSystem_DS::_instance = NULL;
OSystem_DS::OSystem_DS()
- : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false),
+ : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _frameBufferExists(false),
_disableCursorPalette(true), _graphicsEnable(true), _gammaValue(0)
{
// eventNum = 0;
@@ -87,13 +90,17 @@ OSystem_DS::OSystem_DS()
// queuePos = 0;
_instance = this;
// _mixer = NULL;
- // _timer = NULL;
//_frameBufferExists = false;
}
OSystem_DS::~OSystem_DS() {
delete _mixer;
- delete _timer;
+ _mixer = 0;
+
+ // If _savefileManager is not 0, then it points to the OSystem_DS
+ // member variable mpSaveManager. Hence we set _savefileManager to
+ // 0, to prevent the OSystem destructor from trying to delete it.
+ _savefileManager = 0;
}
int OSystem_DS::timerHandler(int t) {
@@ -106,7 +113,11 @@ void OSystem_DS::initBackend() {
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
- _timer = new DefaultTimerManager();
+ if (DS::isGBAMPAvailable()) {
+ _savefileManager = &mpSaveManager;
+ }
+
+ _timerManager = new DefaultTimerManager();
DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
if (ConfMan.hasKey("22khzaudio", "ds") && ConfMan.getBool("22khzaudio", "ds")) {
@@ -118,21 +129,32 @@ void OSystem_DS::initBackend() {
_mixer = new Audio::MixerImpl(this, DS::getSoundFrequency());
_mixer->setReady(true);
- OSystem::initBackend();
+ /* TODO/FIXME: The NDS should use a custom AudioCD manager instance!
+ if (!_audiocdManager)
+ _audiocdManager = new DSAudioCDManager();
+ */
+
+ EventsBaseBackend::initBackend();
}
bool OSystem_DS::hasFeature(Feature f) {
- return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorHasPalette);
+ return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorPalette);
}
void OSystem_DS::setFeatureState(Feature f, bool enable) {
if (f == kFeatureVirtualKeyboard)
DS::setKeyboardIcon(enable);
+ else if (f == kFeatureCursorPalette) {
+ _disableCursorPalette = !enable;
+ refreshCursor();
+ }
}
bool OSystem_DS::getFeatureState(Feature f) {
if (f == kFeatureVirtualKeyboard)
return DS::getKeyboardIcon();
+ if (f == kFeatureCursorPalette)
+ return !_disableCursorPalette;
return false;
}
@@ -734,14 +756,6 @@ void OSystem_DS::quit() {
swiSoftReset();*/
}
-Common::SaveFileManager *OSystem_DS::getSavefileManager() {
- if (DS::isGBAMPAvailable()) {
- return &mpSaveManager;
- }
- return NULL;
-}
-
-
Graphics::Surface *OSystem_DS::createTempFrameBuffer() {
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
@@ -840,16 +854,15 @@ void OSystem_DS::setCharactersEntered(int count) {
DS::setCharactersEntered(count);
}
-Common::SeekableReadStream *OSystem_DS::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
-// consolePrintf("R %s", DEFAULT_CONFIG_FILE);
- return file.createReadStream();
+Common::String OSystem_DS::getDefaultConfigFileName() {
+ return DEFAULT_CONFIG_FILE;
}
-Common::WriteStream *OSystem_DS::createConfigWriteStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
-// consolePrintf("W %s", DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
+void OSystem_DS::logMessage(LogMessageType::Type type, const char *message) {
+#ifndef DISABLE_TEXT_CONSOLE
+ nocashMessage((char *)message);
+// consolePrintf((char *)message);
+#endif
}
u16 OSystem_DS::applyGamma(u16 color) {