aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMatthew Hoops2011-06-13 13:12:23 -0400
committerMatthew Hoops2011-06-13 13:12:23 -0400
commitd355475a0416897ed254fa85f4d63d0f75d9c7ea (patch)
tree184892480ebb704b28163c51999e50c414e85f8a /backends/platform
parent224c71e483e09931ba386555ff3b436b9defe63d (diff)
parentbfa26ffc44f80e4eb3d8590f5f865cda6a5188b7 (diff)
downloadscummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.gz
scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.tar.bz2
scummvm-rg350-d355475a0416897ed254fa85f4d63d0f75d9c7ea.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/android/android.cpp45
-rw-r--r--backends/platform/android/android.h10
-rw-r--r--backends/platform/android/gfx.cpp8
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/dc.h13
-rw-r--r--backends/platform/dc/dcmain.cpp23
-rw-r--r--backends/platform/dc/display.cpp5
-rw-r--r--backends/platform/dc/input.cpp4
-rw-r--r--backends/platform/dc/time.cpp4
-rw-r--r--backends/platform/dc/vmsave.cpp5
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp57
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h16
-rwxr-xr-xbackends/platform/gp2x/build/clean.sh17
-rw-r--r--backends/platform/gp2x/gp2x-common.h49
-rw-r--r--backends/platform/gp2x/gp2x-hw.cpp228
-rw-r--r--backends/platform/gp2x/gp2x-hw.h62
-rw-r--r--backends/platform/gp2x/gp2x-main.cpp50
-rw-r--r--backends/platform/gp2x/gp2x-mem.cpp84
-rw-r--r--backends/platform/gp2x/gp2x-mem.h51
-rw-r--r--backends/platform/gp2x/gp2x.cpp208
-rw-r--r--backends/platform/gp2x/module.mk15
-rw-r--r--backends/platform/gph/build/gp2x-config.sh5
-rw-r--r--backends/platform/gph/devices/gp2x/scummvm.gpe4
-rw-r--r--backends/platform/gph/gph-backend.cpp20
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph-sdl.h4
-rw-r--r--backends/platform/iphone/iphone_video.h1
-rw-r--r--backends/platform/iphone/iphone_video.m18
-rw-r--r--backends/platform/iphone/osys_main.cpp46
-rw-r--r--backends/platform/iphone/osys_main.h11
-rw-r--r--backends/platform/iphone/osys_video.cpp3
-rw-r--r--backends/platform/n64/osys_n64.h11
-rw-r--r--backends/platform/n64/osys_n64_base.cpp52
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp1
-rw-r--r--backends/platform/null/null.cpp22
-rw-r--r--backends/platform/openpandora/op-backend.cpp55
-rw-r--r--backends/platform/openpandora/op-main.cpp8
-rw-r--r--backends/platform/openpandora/op-sdl.h16
-rw-r--r--backends/platform/ps2/fileio.cpp20
-rw-r--r--backends/platform/ps2/fileio.h2
-rw-r--r--backends/platform/ps2/systemps2.cpp77
-rw-r--r--backends/platform/ps2/systemps2.h22
-rw-r--r--backends/platform/psp/cursor.h1
-rw-r--r--backends/platform/psp/osys_psp.cpp35
-rw-r--r--backends/platform/psp/osys_psp.h13
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp27
-rw-r--r--backends/platform/sdl/macosx/macosx.h4
-rw-r--r--backends/platform/sdl/posix/posix.cpp71
-rw-r--r--backends/platform/sdl/posix/posix.h21
-rw-r--r--backends/platform/sdl/sdl.cpp19
-rw-r--r--backends/platform/sdl/sdl.h10
-rw-r--r--backends/platform/sdl/win32/win32.cpp54
-rw-r--r--backends/platform/sdl/win32/win32.h15
-rw-r--r--backends/platform/wii/osystem.cpp41
-rw-r--r--backends/platform/wii/osystem.h9
-rw-r--r--backends/platform/wii/osystem_events.cpp1
-rw-r--r--backends/platform/wii/osystem_gfx.cpp9
-rw-r--r--backends/platform/wince/CEActionsPocket.cpp45
-rw-r--r--backends/platform/wince/CEActionsPocket.h2
-rw-r--r--backends/platform/wince/CEActionsSmartphone.cpp35
-rw-r--r--backends/platform/wince/CEActionsSmartphone.h2
-rw-r--r--backends/platform/wince/wince-sdl.cpp16
-rw-r--r--backends/platform/wince/wince-sdl.h3
63 files changed, 517 insertions, 1274 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index eeeddb4c77..90660cf82c 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -132,10 +132,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_show_mouse(false),
_show_overlay(false),
_enable_zoning(false),
- _savefile(0),
_mixer(0),
- _timer(0),
- _fsFactory(new POSIXFilesystemFactory()),
_shake_offset(0),
_event_queue_lock(createMutex()),
_touch_pt_down(),
@@ -149,6 +146,9 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
_dpad_scale(4),
_fingersDown(0),
_trackball_scale(2) {
+
+ _fsFactory = new POSIXFilesystemFactory();
+
Common::String mf = getSystemProperty("ro.product.manufacturer");
LOGI("Running on: [%s] [%s] [%s] [%s] [%s] SDK:%s ABI:%s",
@@ -170,17 +170,17 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
OSystem_Android::~OSystem_Android() {
ENTER();
- delete _savefile;
- delete _timer;
delete _mixer;
+ _mixer = 0;
delete _fsFactory;
+ _fsFactory = 0;
deleteMutex(_event_queue_lock);
}
void *OSystem_Android::timerThreadFunc(void *arg) {
OSystem_Android *system = (OSystem_Android *)arg;
- DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timer);
+ DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timerManager);
// renice this thread to boost the audio thread
if (setpriority(PRIO_PROCESS, 0, 19) < 0)
@@ -359,8 +359,8 @@ void OSystem_Android::initBackend() {
// BUG: "transient" ConfMan settings get nuked by the options
// screen. Passing the savepath in this way makes it stick
// (via ConfMan.registerDefault)
- _savefile = new DefaultSaveFileManager(ConfMan.get("savepath"));
- _timer = new DefaultTimerManager();
+ _savefileManager = new DefaultSaveFileManager(ConfMan.get("savepath"));
+ _timerManager = new DefaultTimerManager();
gettimeofday(&_startTime, 0);
@@ -388,6 +388,8 @@ void OSystem_Android::initBackend() {
warning("couldn't renice the main thread");
JNI::setReadyForEvents(true);
+
+ EventsBaseBackend::initBackend();
}
void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
@@ -399,7 +401,7 @@ void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
bool OSystem_Android::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode ||
f == kFeatureAspectRatioCorrection ||
- f == kFeatureCursorHasPalette ||
+ f == kFeatureCursorPalette ||
f == kFeatureVirtualKeyboard ||
f == kFeatureOverlaySupportsAlpha);
}
@@ -420,6 +422,11 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
_virtkeybd_on = enable;
showVirtualKeyboard(enable);
break;
+ case kFeatureCursorPalette:
+ _use_mouse_palette = !enable;
+ if (!enable)
+ disableCursorPalette();
+ break;
default:
break;
}
@@ -433,6 +440,8 @@ bool OSystem_Android::getFeatureState(Feature f) {
return _ar_correction;
case kFeatureVirtualKeyboard:
return _virtkeybd_on;
+ case kFeatureCursorPalette:
+ return _use_mouse_palette;
default:
return false;
}
@@ -526,21 +535,11 @@ void OSystem_Android::showVirtualKeyboard(bool enable) {
JNI::showVirtualKeyboard(enable);
}
-Common::SaveFileManager *OSystem_Android::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_Android::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_Android::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
void OSystem_Android::getTimeAndDate(TimeDate &td) const {
struct tm tm;
const time_t curTime = time(0);
@@ -554,10 +553,6 @@ void OSystem_Android::getTimeAndDate(TimeDate &td) const {
td.tm_year = tm.tm_year;
}
-FilesystemFactory *OSystem_Android::getFilesystemFactory() {
- return _fsFactory;
-}
-
void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
int priority) {
ENTER("");
@@ -568,6 +563,10 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,
void OSystem_Android::logMessage(LogMessageType::Type type,
const char *message) {
switch (type) {
+ case LogMessageType::kInfo:
+ __android_log_write(ANDROID_LOG_INFO, android_log_tag, message);
+ break;
+
case LogMessageType::kDebug:
__android_log_write(ANDROID_LOG_DEBUG, android_log_tag, message);
break;
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 752a31a4db..c2ada2ab77 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -103,7 +103,7 @@ protected:
};
#endif
-class OSystem_Android : public BaseBackend, public PaletteManager {
+class OSystem_Android : public EventsBaseBackend, public PaletteManager {
private:
// passed from the dark side
int _audio_sample_rate;
@@ -152,10 +152,7 @@ private:
bool _enable_zoning;
bool _virtkeybd_on;
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
- FilesystemFactory *_fsFactory;
timeval _startTime;
Common::String getSystemProperty(const char *name) const;
@@ -237,6 +234,7 @@ private:
void clipMouse(Common::Point &p);
void scaleMouse(Common::Point &p, int x, int y, bool deductDrawRect = true);
void updateEventScale();
+ void disableCursorPalette();
protected:
// PaletteManager API
@@ -272,7 +270,6 @@ public:
int cursorTargetScale,
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
@@ -289,11 +286,8 @@ public:
virtual void displayMessageOnOSD(const char *msg);
virtual void showVirtualKeyboard(bool enable);
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::TimerManager *getTimerManager();
- virtual FilesystemFactory *getFilesystemFactory();
virtual void logMessage(LogMessageType::Type type, const char *message);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s,
int priority = 0);
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 89e918a34e..b8a9e74437 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -801,12 +801,10 @@ void OSystem_Android::setCursorPalette(const byte *colors,
_use_mouse_palette = true;
}
-void OSystem_Android::disableCursorPalette(bool disable) {
- ENTER("%d", disable);
-
+void OSystem_Android::disableCursorPalette() {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
- if (disable && _game_texture->hasPalette()) {
+ if (_game_texture->hasPalette()) {
const byte *src = _game_texture->palette_const();
byte *dst = _mouse_texture_palette->palette();
@@ -825,8 +823,6 @@ void OSystem_Android::disableCursorPalette(bool disable) {
byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
WRITE_UINT16(p, READ_UINT16(p) & ~1);
}
-
- _use_mouse_palette = !disable;
}
#endif
diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index 16547456c3..ac709f62b9 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "dc.h"
#include "backends/fs/abstract-fs.h"
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index e31b817d7c..bde50daa2d 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -70,7 +70,7 @@ class DCCDManager : public DefaultAudioCDManager {
void updateCD();
};
-class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory
+class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public PaletteManager, public FilesystemFactory
#ifdef DYNAMIC_MODULES
, public FilePluginProvider
#endif
@@ -145,9 +145,6 @@ public:
// Replace the specified range of cursor the palette with new colors.
void setCursorPalette(const byte *colors, uint start, uint num);
- // Disable or enable cursor palette.
- void disableCursorPalette(bool disable);
-
// Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos);
@@ -164,8 +161,6 @@ public:
// Returns true if an event was retrieved.
bool pollEvent(Common::Event &event);
- AudioCDManager *getAudioCDManager() { return _cdManager; }
-
// Quit
void quit();
@@ -190,26 +185,20 @@ public:
void setWindowCaption(const char *caption);
// Modulatized backend
- Common::SaveFileManager *getSavefileManager() { return _savefile; }
Audio::Mixer *getMixer() { return _mixer; }
- Common::TimerManager *getTimerManager() { return _timer; }
// Extra SoftKbd support
void mouseToSoftKbd(int x, int y, int &rx, int &ry) const;
// Filesystem
- FilesystemFactory *getFilesystemFactory() { return this; }
AbstractFSNode *makeRootFileNode() const;
AbstractFSNode *makeCurrentDirectoryFileNode() const;
AbstractFSNode *makeFileNodePath(const Common::String &path) const;
private:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
SoftKeyboard _softkbd;
- DCCDManager *_cdManager;
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh;
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index dfce176e90..3faf0185ad 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -20,10 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <common/scummsys.h>
#include <engines/engine.h>
@@ -44,26 +41,29 @@ const char *gGameName;
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
- _ms_buf(NULL), _timer(NULL), _mixer(NULL), _savefile(NULL),
+ _ms_buf(NULL), _mixer(NULL),
_current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false),
_softkbd_motion(0), _enable_cursor_palette(false), _screenFormat(0)
{
memset(screen_tx, 0, sizeof(screen_tx));
memset(mouse_tx, 0, sizeof(mouse_tx));
memset(ovl_tx, 0, sizeof(ovl_tx));
+ _fsFactory = this;
}
void OSystem_Dreamcast::initBackend()
{
ConfMan.setInt("autosave_period", 0);
- _savefile = createSavefileManager();
- _timer = new DefaultTimerManager();
+ _savefileManager = createSavefileManager();
+ _timerManager = new DefaultTimerManager();
uint sampleRate = initSound();
_mixer = new Audio::MixerImpl(this, sampleRate);
_mixer->setReady(true);
- _cdManager = new DCCDManager();
+ _audiocdManager = new DCCDManager();
+
+ EventsBaseBackend::initBackend();
}
@@ -163,7 +163,7 @@ bool OSystem_Dreamcast::hasFeature(Feature f)
case kFeatureAspectRatioCorrection:
case kFeatureVirtualKeyboard:
case kFeatureOverlaySupportsAlpha:
- case kFeatureCursorHasPalette:
+ case kFeatureCursorPalette:
return true;
default:
return false;
@@ -181,6 +181,9 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable)
case kFeatureVirtualKeyboard:
_softkbd_on = enable;
break;
+ case kFeatureCursorPalette:
+ _enable_cursor_palette = enable;
+ break;
default:
break;
}
@@ -193,6 +196,8 @@ bool OSystem_Dreamcast::getFeatureState(Feature f)
return _aspect_stretch;
case kFeatureVirtualKeyboard:
return _softkbd_on;
+ case kFeatureCursorPalette:
+ return _enable_cursor_palette;
default:
return false;
}
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 56eef870c0..a11e329df3 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -171,11 +171,6 @@ void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint nu
_enable_cursor_palette = true;
}
-void OSystem_Dreamcast::disableCursorPalette(bool disable)
-{
- _enable_cursor_palette = !disable;
-}
-
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
{
const unsigned short *src = palette + start;
diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp
index 7054ad196e..3759eec6df 100644
--- a/backends/platform/dc/input.cpp
+++ b/backends/platform/dc/input.cpp
@@ -192,8 +192,8 @@ bool OSystem_Dreamcast::pollEvent(Common::Event &event)
{
unsigned int t = Timer();
- if (_timer != NULL)
- _timer->handler();
+ if (_timerManager != NULL)
+ ((DefaultTimerManager *)_timerManager)->handler();
if (((int)(t-_devpoll))<0)
return false;
diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp
index c343852321..8cc3a71e8d 100644
--- a/backends/platform/dc/time.cpp
+++ b/backends/platform/dc/time.cpp
@@ -48,8 +48,8 @@ void OSystem_Dreamcast::delayMillis(uint msecs)
unsigned int t, start = Timer();
int time = (((unsigned int)msecs)*3125U)>>6;
while (((int)((t = Timer())-start))<time) {
- if (_timer != NULL)
- _timer->handler();
+ if (_timerManager != NULL)
+ ((DefaultTimerManager *)_timerManager)->handler();
checkSound();
}
getMillis();
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index f18f69efa6..e06dd7fa43 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -20,10 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <common/scummsys.h>
#include "engines/engine.h"
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) {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 4ab2e36322..b1222a152d 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -29,13 +29,12 @@
#include "nds.h"
#include "gbampsave.h"
#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "audio/mixer_intern.h"
#include "graphics/surface.h"
#include "graphics/colormasks.h"
#include "graphics/palette.h"
-class OSystem_DS : public BaseBackend, public PaletteManager {
+class OSystem_DS : public EventsBaseBackend, public PaletteManager {
protected:
int eventNum;
@@ -46,7 +45,6 @@ protected:
GBAMPSaveFileManager mpSaveManager;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
Graphics::Surface _framebuffer;
bool _frameBufferExists;
bool _graphicsEnable;
@@ -140,8 +138,6 @@ public:
virtual void quit();
- virtual Common::SaveFileManager *getSavefileManager();
-
void addEvent(const Common::Event& e);
bool isEventQueueEmpty() const { return queuePos == 0; }
@@ -159,7 +155,6 @@ public:
virtual Audio::Mixer *getMixer() { return _mixer; }
Audio::MixerImpl *getMixerImpl() { return _mixer; }
- virtual Common::TimerManager *getTimerManager() { return _timer; }
static int timerHandler(int t);
@@ -172,14 +167,13 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool dis) { _disableCursorPalette = dis; refreshCursor(); }
-
- FilesystemFactory *getFilesystemFactory();
+ virtual FilesystemFactory *getFilesystemFactory();
void refreshCursor();
- Common::WriteStream *createConfigWriteStream();
- Common::SeekableReadStream *createConfigReadStream();
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
u16 applyGamma(u16 color);
void setGammaValue(int gamma) { _gammaValue = gamma; }
diff --git a/backends/platform/gp2x/build/clean.sh b/backends/platform/gp2x/build/clean.sh
deleted file mode 100755
index 0979f6c7d6..0000000000
--- a/backends/platform/gp2x/build/clean.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-export CXX=arm-open2x-linux-g++
-export CC=arm-open2x-linux-gcc
-export CXXFLAGS=-march=armv4t
-export LDFLAGS=-static
-
-cd ../../../..
-
-echo Cleaning ScummVM for GP2X.
-make clean
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
deleted file mode 100644
index 7efdd7164c..0000000000
--- a/backends/platform/gp2x/gp2x-common.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PLATFORM_SDL_GP2X_H
-#define PLATFORM_SDL_GP2X_H
-
-#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
-#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-
-#ifndef PATH_MAX
- #define PATH_MAX 255
-#endif
-
-class OSystem_GP2X : public OSystem_POSIX {
-public:
- OSystem_GP2X() {}
-
- void initBackend();
- void quit();
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- void initSDL();
-
-protected:
-
-};
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
deleted file mode 100644
index 074c668b5f..0000000000
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- * Thanks to Rlyeh, Snaff, Squidge, Hermes, PS2Reality and RobBrown
- * for there help with us all getting to grips with this.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "gp2x-common.h"
-
-#include "gp2x-hw.h"
-#include "gp2x-mem.h"
-
-// Linux includes to let us goof about with the system in a 'standard' way.
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-extern "C" {
-static unsigned long gp2x_dev[8]={0,0,0,0,0,0,0,0};//, gp2x_ticks_per_second;
-}
-
-namespace GP2X_HW {
-
-enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
-};
-
-int volumeLevel = VOLUME_INITIAL;
-
-/* system registers */
-static struct
-{
- unsigned short SYSCLKENREG,SYSCSETREG,FPLLVSETREG,DUALINT920,DUALINT940,DUALCTRL940;
-}
-system_reg;
-
-static unsigned short dispclockdiv;
-
-static volatile unsigned short *MEM_REG;
-
-#define SYS_CLK_FREQ 7372800
-
-void deviceInit() {
- // Open devices
- if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR);
- if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY);
- if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-}
-
-void deviceDeinit() {
- // Close devices
- {
- int i;
- for (i=0;i<8;i++)
- {
- if (gp2x_dev[i])
- {
- close(gp2x_dev[i]);
- }
- }
- }
-
- MEM_REG[0x91c>>1] = system_reg.SYSCSETREG;
- MEM_REG[0x910>>1] = system_reg.FPLLVSETREG;
- MEM_REG[0x3B40>>1] = system_reg.DUALINT920;
- MEM_REG[0x3B42>>1] = system_reg.DUALINT940;
- MEM_REG[0x3B48>>1] = system_reg.DUALCTRL940;
- MEM_REG[0x904>>1] = system_reg.SYSCLKENREG;
- MEM_REG[0x924>>1] = dispclockdiv;
-
- unpatchMMU();
-}
-
-void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if(direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if(soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
-}
-
-void setCpuspeed(unsigned int mhz)
-{
- set_FCLK(mhz);
- set_DCLK_Div(0);
- set_920_Div(0);
-}
-
-int getBattLevel() {
- int devbatt;
- unsigned short currentval=0;
- devbatt = open("/dev/batt", O_RDONLY);
- read (devbatt, &currentval, 2);
- close (devbatt);
- return (currentval);
-}
-
-void set_display_clock_div(unsigned div)
-{
- div=((div & 63) | 64)<<8;
- MEM_REG[0x924>>1]=(MEM_REG[0x924>>1] & ~(255<<8)) | div;
-}
-
-
-void set_FCLK(unsigned MHZ)
-{
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
- MHZ*=1000000;
- mdiv=(MHZ*pdiv)/SYS_CLK_FREQ;
- mdiv=((mdiv-8)<<8) & 0xff00;
- pdiv=((pdiv-2)<<2) & 0xfc;
- scale&=3;
- v=mdiv | pdiv | scale;
- MEM_REG[0x910>>1]=v;
-}
-
-
-void set_920_Div(unsigned short div)
-{
- unsigned short v;
- v = MEM_REG[0x91c>>1] & (~0x3);
- MEM_REG[0x91c>>1] = (div & 0x7) | v;
-}
-
-
-void set_DCLK_Div( unsigned short div )
-{
- unsigned short v;
- v = (unsigned short)( MEM_REG[0x91c>>1] & (~(0x7 << 6)) );
- MEM_REG[0x91c>>1] = ((div & 0x7) << 6) | v;
-}
-
-
-void Disable_940(void)
-{
- MEM_REG[0x3B42>>1];
- MEM_REG[0x3B42>>1]=0;
- MEM_REG[0x3B46>>1]=0xffff;
- MEM_REG[0x3B48>>1]|= (1 << 7);
- MEM_REG[0x904>>1]&=0xfffe;
-}
-
-void gp2x_video_wait_vsync(void)
-{
- MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2;
- while (!(MEM_REG[0x2846>>1] & 2));
-}
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-int tapmodeLevel = TAPMODE_LEFT;
-
-void ToggleTapMode() {
- if (tapmodeLevel == TAPMODE_LEFT) {
- tapmodeLevel = TAPMODE_RIGHT;
- } else if (tapmodeLevel == TAPMODE_RIGHT) {
- tapmodeLevel = TAPMODE_HOVER;
- } else if (tapmodeLevel == TAPMODE_HOVER) {
- tapmodeLevel = TAPMODE_LEFT;
- } else {
- tapmodeLevel = TAPMODE_LEFT;
- }
-}
-
-
-} /* namespace GPH */
diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h
deleted file mode 100644
index 3c66400124..0000000000
--- a/backends/platform/gp2x/gp2x-hw.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- *
- */
-
-#ifndef GP2X_HW_H
-#define GP2X_HW_H
-
-namespace GP2X_HW {
-
-#define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer
-#define SYS_CLK_FREQ 7372800 // Clock Frequency
-
-extern int volumeLevel;
-
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
-extern void setCpuspeed(unsigned int cpuspeed);
-extern int getBattLevel();
-
-extern void save_system_regs(void); /* save some registers */
-extern void set_display_clock_div(unsigned div);
-extern void set_FCLK(unsigned MHZ); /* adjust the clock frequency (in Mhz units) */
-extern void set_920_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void Disable_940(void); /* 940t down */
-extern void gp2x_video_wait_vsync(void);
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-extern int tapmodeLevel;
-
-extern void ToggleTapMode();
-
-} /* namespace GPH */
-
-#endif //GP2X_HW_H
diff --git a/backends/platform/gp2x/gp2x-main.cpp b/backends/platform/gp2x/gp2x-main.cpp
deleted file mode 100644
index f1ee5ed5f3..0000000000
--- a/backends/platform/gp2x/gp2x-main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/plugins/sdl/sdl-provider.h"
-#include "base/main.h"
-
-#if defined(GP2X)
-int main(int argc, char *argv[]) {
-
- // Create our OSystem instance
- g_system = new OSystem_GP2X();
- assert(g_system);
-
- // Pre initialize the backend
- ((OSystem_GP2X *)g_system)->init();
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
-
- // Free OSystem
- delete (OSystem_GP2X *)g_system;
-
- return res;
-}
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp
deleted file mode 100644
index 8d22bf8130..0000000000
--- a/backends/platform/gp2x/gp2x-mem.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory tweaking stuff.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-extern "C" {
-static volatile unsigned short *gp2x_memregs;
-}
-
-void SetClock (unsigned c) {
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
-
- // Set ARM920t clock
- c *= 1000000;
- mdiv = (c*pdiv) / SYS_CLK_FREQ;
- mdiv = ((mdiv-8)<<8) & 0xff00;
- pdiv = ((pdiv-2)<<2) & 0xfc;
- scale &= 3;
- v = mdiv | pdiv | scale;
- gp2x_memregs[0x910>>1] = v;
-}
-
-void patchMMU (void) {
- //volatile unsigned int *secbuf = (unsigned int *)malloc (204800);
-
- printf ("Reconfiguring cached memory regions...\n");
-
- //hackpgtable();
- //printf ("Sucess...\n");
-
- system("/sbin/rmmod mmuhack");
- system("/sbin/insmod -f mmuhack.o");
-
- int mmufd = open("/dev/mmuhack", O_RDWR);
-
- if(mmufd < 0) {
- printf ("Upper memory uncached (attempt failed, access to upper memory will be slower)...\n");
- } else {
- printf ("Upper memory cached...\n");
- close(mmufd);
- }
-}
-
-void unpatchMMU (void) {
- printf ("Restoreing cached memory regions...\n");
- system("/sbin/rmmod mmuhack");
-}
diff --git a/backends/platform/gp2x/gp2x-mem.h b/backends/platform/gp2x/gp2x-mem.h
deleted file mode 100644
index b2cd00a587..0000000000
--- a/backends/platform/gp2x/gp2x-mem.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory Stuff.
- *
- */
-
-#ifndef GP2X_MEM_H
-#define GP2X_MEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Use Squidge's MMU patch rather then myown (his is neater).
-// The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;).
-
-//extern void InitRam (void);
-//extern void CloseRam (void);
-// Set ARM920t clock frequency
-extern void SetClock (unsigned c);
-extern void patchMMU (void);
-extern void unpatchMMU (void);
-
-#define SYS_CLK_FREQ 7372800
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif //GP2X_MEM_H
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
deleted file mode 100644
index 0e28a6b738..0000000000
--- a/backends/platform/gp2x/gp2x.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Main backend.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/sdl/sdl-sys.h"
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-#include "backends/saves/default/default-saves.h"
-
-#include "common/config-manager.h"
-#include "common/debug.h"
-
-// Disable for normal serial logging.
-#define DUMP_STDOUT
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-void OSystem_GP2X::initBackend() {
- // Setup default save path to be workingdir/saves
- char savePath[PATH_MAX + 1];
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
- } else {
- printf("Current working directory: %s\n", workDirName);
- }
-
- strcpy(savePath, workDirName);
- strcat(savePath, "/saves");
- printf("Current save directory: %s\n", savePath);
- struct stat sb;
- if (stat(savePath, &sb) == -1)
- if (errno == ENOENT) // Create the dir if it does not exist
- if (mkdir(savePath, 0755) != 0)
- warning("mkdir for '%s' failed", savePath);
-
- ConfMan.registerDefault("savepath", savePath);
-
- #ifdef DUMP_STDOUT
- // The GP2X has a serial console but most users do not use this so we
- // output all our STDOUT and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX + 1];
- char STDERR_FILE[PATH_MAX + 1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- /* Flush the output in case anything is queued */
- fclose(stdout);
- fclose(stderr);
-
- /* Redirect standard input and standard output */
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
- }
-
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
- }
-
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
-
- // Setup other defaults.
- ConfMan.registerDefault("aspect_ratio", true);
-
- /* Up default volume values as we use a seperate system level volume anyway. */
- ConfMan.registerDefault("music_volume", 192);
- ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("speech_volume", 192);
- ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
-
- ConfMan.setBool("FM_low_quality", true);
-
- /* Initialize any GP2X specific stuff we may want (Batt Status, scaler etc.) */
- GP2X_HW::deviceInit();
-
- /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
- GP2X_HW::mixerMoveVolume(0);
-
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GP2XSdlEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new GP2XSdlGraphicsManager(_eventSource);
-
- /* Pass to POSIX method to do the heavy lifting */
- OSystem_POSIX::initBackend();
-}
-
-void OSystem_GP2X::initSDL() {
- // Check if SDL has not been initialized
- if (!_initedSDL) {
- uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
- if (ConfMan.hasKey("disable_sdl_parachute"))
- sdlFlags |= SDL_INIT_NOPARACHUTE;
-
- // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
- if (SDL_Init(sdlFlags) == -1)
- error("Could not initialize SDL: %s", SDL_GetError());
-
- // Enable unicode support if possible
- SDL_EnableUNICODE(1);
-
- _initedSDL = true;
- }
-}
-
-void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- /* Setup default extra data paths for engine data files and plugins */
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__GP2X_WORKDIR__", new Common::FSDirectory(workDirName), priority);
- }
-
- char enginedataPath[PATH_MAX+1];
-
- strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "/engine-data");
-
- Common::FSNode engineNode(enginedataPath);
- if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__GP2X_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "/plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__GP2X_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
- }
-}
-
-void OSystem_GP2X::quit() {
- GP2X_HW::deviceDeinit();
-
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
-
- OSystem_POSIX::quit();
-}
diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk
deleted file mode 100644
index 4846f162cb..0000000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/gp2x
-
-MODULE_OBJS := \
- gp2x-hw.o \
- gp2x-main.o \
- gp2x-mem.o \
- gp2x.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-
-# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
index f474c4d0d4..a9b28b2fd0 100644
--- a/backends/platform/gph/build/gp2x-config.sh
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -23,8 +23,9 @@ cd ../../../..
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
- --enable-vkeybd --enable-plugins --default-dynamic
-# --disable-release --enable-debug
+ --enable-vkeybd
+
# --enable-plugins --default-dynamic
+# --disable-release --enable-debug
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/devices/gp2x/scummvm.gpe b/backends/platform/gph/devices/gp2x/scummvm.gpe
index e8983aa2ce..51a49f7560 100644
--- a/backends/platform/gph/devices/gp2x/scummvm.gpe
+++ b/backends/platform/gph/devices/gp2x/scummvm.gpe
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Remount SD with forced Sync, does this really work?
mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
@@ -8,7 +8,7 @@ mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.gph
+./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index cb52da441d..ae3466b836 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -56,8 +56,15 @@
/* Dump console info to files. */
#define DUMP_STDOUT
+OSystem_GPH::OSystem_GPH()
+ :
+ OSystem_POSIX() {
+}
+
void OSystem_GPH::initBackend() {
+ assert(!_inited);
+
// Create the events manager
if (_eventSource == 0)
_eventSource = new GPHEventSource();
@@ -81,7 +88,7 @@ void OSystem_GPH::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -155,7 +162,8 @@ void OSystem_GPH::initBackend() {
/* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */
ConfMan.registerDefault("autosave_period", 4 * 60);
- /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop
+ users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
/* Make sure SDL knows that we have a joystick we want to use. */
@@ -164,10 +172,10 @@ void OSystem_GPH::initBackend() {
/* Now setup any device specific user options (Left handed mode, that sort of thing). */
// GPH::setOptions();
- printf("%s\n", "Passing to OSystem::SDL initBackend.");
-
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
+
+ _inited = true;
}
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
@@ -176,7 +184,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
+ error("Error: Could not obtain current working directory.");
}
Common::FSNode workdirNode(workDirName);
@@ -215,5 +223,5 @@ void OSystem_GPH::quit() {
fclose(stderr);
#endif /* DUMP_STDOUT */
- OSystem_SDL::quit();
+ OSystem_POSIX::quit();
}
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index f91ec8f478..1a8c6686ca 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/gph/gph-sdl.h"
-#include "backends/plugins/sdl/sdl-provider.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "base/main.h"
#if defined(GPH_DEVICE)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_GPH *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+ PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h
index 68a641eed7..8b943f98f3 100644
--- a/backends/platform/gph/gph-sdl.h
+++ b/backends/platform/gph/gph-sdl.h
@@ -28,8 +28,8 @@
#include "backends/base-backend.h"
#include "backends/platform/sdl/sdl.h"
#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gph/gph-graphics.h"
#include "backends/events/gph/gph-events.h"
+#include "backends/graphics/gph/gph-graphics.h"
#define __GP2XWIZ__
@@ -39,6 +39,8 @@
class OSystem_GPH : public OSystem_POSIX {
public:
+ OSystem_GPH();
+
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 8e0ffc19cb..223f025978 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -67,6 +67,7 @@
- (void)updateMainSurface;
- (void)updateOverlaySurface;
- (void)updateMouseSurface;
+- (void)clearColorBuffer;
-(void)updateMouseCursor;
diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m
index 006603df64..04d25cebf8 100644
--- a/backends/platform/iphone/iphone_video.m
+++ b/backends/platform/iphone/iphone_video.m
@@ -85,6 +85,8 @@ void iPhone_setMouseCursor(short* buffer, int width, int height) {
void iPhone_enableOverlay(int state) {
_overlayIsEnabled = state;
+
+ [sharedInstance performSelectorOnMainThread:@selector(clearColorBuffer) withObject:nil waitUntilDone: YES];
}
int iPhone_getScreenHeight() {
@@ -478,12 +480,7 @@ bool getLocalMouseCoords(CGPoint *point) {
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); printOpenGLError();
- // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
- int clearCount = 5;
- while (clearCount-- > 0) {
- glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
- [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
- }
+ [self clearColorBuffer];
if (_keyboardView != nil) {
[_keyboardView removeFromSuperview];
@@ -535,6 +532,15 @@ bool getLocalMouseCoords(CGPoint *point) {
}
}
+- (void)clearColorBuffer {
+ // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later.
+ int clearCount = 5;
+ while (clearCount-- > 0) {
+ glClear(GL_COLOR_BUFFER_BIT); printOpenGLError();
+ [_context presentRenderbuffer:GL_RENDERBUFFER_OES];
+ }
+}
+
- (id)getEvent {
if (_events == nil || [_events count] == 0) {
return nil;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 12317ad935..9325ed50bf 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -53,7 +53,7 @@ SoundProc OSystem_IPHONE::s_soundCallback = NULL;
void *OSystem_IPHONE::s_soundParam = NULL;
OSystem_IPHONE::OSystem_IPHONE() :
- _savefile(NULL), _mixer(NULL), _timer(NULL), _offscreen(NULL),
+ _mixer(NULL), _offscreen(NULL),
_overlayVisible(false), _fullscreen(NULL),
_mouseHeight(0), _mouseWidth(0), _mouseBuf(NULL), _lastMouseTap(0), _queuedEventTime(0),
_secondaryTapped(false), _lastSecondaryTap(0),
@@ -72,10 +72,7 @@ OSystem_IPHONE::OSystem_IPHONE() :
OSystem_IPHONE::~OSystem_IPHONE() {
AudioQueueDispose(s_AudioQueue.queue, true);
- delete _fsFactory;
- delete _savefile;
delete _mixer;
- delete _timer;
delete _offscreen;
delete _fullscreen;
}
@@ -88,12 +85,12 @@ int OSystem_IPHONE::timerHandler(int t) {
void OSystem_IPHONE::initBackend() {
#ifdef IPHONE_OFFICIAL
- _savefile = new DefaultSaveFileManager(iPhone_getDocumentsDir());
+ _savefileManager = new DefaultSaveFileManager(iPhone_getDocumentsDir());
#else
- _savefile = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
+ _savefileManager = new DefaultSaveFileManager(SCUMMVM_SAVE_PATH);
#endif
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
gettimeofday(&_startTime, NULL);
@@ -101,7 +98,7 @@ void OSystem_IPHONE::initBackend() {
setTimerCallback(&OSystem_IPHONE::timerHandler, 10);
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
bool OSystem_IPHONE::hasFeature(Feature f) {
@@ -210,48 +207,25 @@ void OSystem_IPHONE::getTimeAndDate(TimeDate &td) const {
td.tm_year = t.tm_year;
}
-Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_IPHONE::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_IPHONE::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
OSystem *OSystem_IPHONE_create() {
return new OSystem_IPHONE();
}
-Common::SeekableReadStream *OSystem_IPHONE::createConfigReadStream() {
+Common::String OSystem_IPHONE::getDefaultConfigFileName() {
#ifdef IPHONE_OFFICIAL
- char buf[256];
- strncpy(buf, iPhone_getDocumentsDir(), 256);
- strncat(buf, "/Preferences", 256 - strlen(buf) );
- Common::FSNode file(buf);
+ Common::String path = iPhone_getDocumentsDir();
+ path += "/Preferences";
+ return path;
#else
- Common::FSNode file(SCUMMVM_PREFS_PATH);
+ return SCUMMVM_PREFS_PATH;
#endif
- return file.createReadStream();
}
-Common::WriteStream *OSystem_IPHONE::createConfigWriteStream() {
-#ifdef IPHONE_OFFICIAL
- char buf[256];
- strncpy(buf, iPhone_getDocumentsDir(), 256);
- strncat(buf, "/Preferences", 256 - strlen(buf) );
- Common::FSNode file(buf);
-#else
- Common::FSNode file(SCUMMVM_PREFS_PATH);
-#endif
- return file.createWriteStream();
-}
void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// Get URL of the Resource directory of the .app bundle
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 1ff87967a1..14325f8090 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -49,7 +49,7 @@ typedef struct AQCallbackStruct {
AudioStreamBasicDescription dataFormat;
} AQCallbackStruct;
-class OSystem_IPHONE : public BaseBackend, public PaletteManager {
+class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
protected:
static const OSystem::GraphicsMode s_supportedGraphicsModes[];
@@ -57,9 +57,7 @@ protected:
static SoundProc s_soundCallback;
static void *s_soundParam;
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
Graphics::Surface _framebuffer;
byte *_offscreen;
@@ -110,7 +108,6 @@ protected:
bool _fullScreenIsDirty;
bool _fullScreenOverlayIsDirty;
int _screenChangeCount;
- FilesystemFactory *_fsFactory;
public:
@@ -173,19 +170,15 @@ public:
virtual int getScreenChangeID() const { return _screenChangeCount; }
virtual void quit();
- FilesystemFactory *getFilesystemFactory() { return _fsFactory; }
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
- virtual Common::TimerManager *getTimerManager();
void startSoundsystem();
void stopSoundsystem();
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual Common::String getDefaultConfigFileName();
protected:
void internUpdateScreen();
diff --git a/backends/platform/iphone/osys_video.cpp b/backends/platform/iphone/osys_video.cpp
index 263cbd2bcc..fa425b108a 100644
--- a/backends/platform/iphone/osys_video.cpp
+++ b/backends/platform/iphone/osys_video.cpp
@@ -349,6 +349,7 @@ void OSystem_IPHONE::showOverlay() {
//printf("showOverlay()\n");
_overlayVisible = true;
dirtyFullOverlayScreen();
+ updateScreen();
iPhone_enableOverlay(true);
}
@@ -368,7 +369,7 @@ void OSystem_IPHONE::clearOverlay() {
void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) {
//printf("grabOverlay()\n");
- int h = _screenHeight;
+ int h = _overlayHeight;
OverlayColor *src = _overlayBuffer;
do {
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 8c0b34ce32..dfa8f58cce 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -27,8 +27,6 @@
#include "common/config-manager.h"
#include "backends/base-backend.h"
-#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "base/main.h"
@@ -73,12 +71,9 @@ enum GraphicModeID {
OVERS_MPAL_340X240
};
-class OSystem_N64 : public BaseBackend, public PaletteManager {
+class OSystem_N64 : public EventsBaseBackend, public PaletteManager {
protected:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
- FilesystemFactory *_fsFactory;
struct display_context * _dc; // Display context for N64 on screen buffer switching
@@ -189,7 +184,6 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
@@ -202,12 +196,9 @@ public:
virtual void quit();
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const;
- virtual Common::TimerManager *getTimerManager();
virtual void setTimerCallback(TimerProc callback, int interval);
- FilesystemFactory *getFilesystemFactory();
void rebuildOffscreenGameBuffer(void);
void rebuildOffscreenMouseBuffer(void);
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 094bb839d3..69e8da3526 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -30,6 +30,8 @@
#include "pakfs_save_manager.h"
#include "framfs_save_manager.h"
#include "backends/fs/n64/n64-fs-factory.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/timer/default/default-timer.h"
typedef unsigned long long uint64;
@@ -137,9 +139,7 @@ OSystem_N64::OSystem_N64() {
_mouseMaxX = _overlayWidth;
_mouseMaxY = _overlayHeight;
- _savefile = 0;
_mixer = 0;
- _timer = 0;
_dirtyOffscreen = false;
@@ -154,10 +154,7 @@ OSystem_N64::OSystem_N64() {
}
OSystem_N64::~OSystem_N64() {
- delete _savefile;
delete _mixer;
- delete _timer;
- delete _fsFactory;
}
void OSystem_N64::initBackend() {
@@ -170,7 +167,7 @@ void OSystem_N64::initBackend() {
if (FRAM_Detect()) { // Use FlashRAM
initFramFS();
- _savefile = new FRAMSaveManager();
+ _savefileManager = new FRAMSaveManager();
} else { // Use PakFS
// Init Controller Pak
initPakFs();
@@ -185,28 +182,36 @@ void OSystem_N64::initBackend() {
}
}
- _savefile = new PAKSaveManager();
+ _savefileManager = new PAKSaveManager();
}
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
setTimerCallback(&timer_handler, 10);
setupMixer();
- OSystem::initBackend();
-
+ EventsBaseBackend::initBackend();
}
bool OSystem_N64::hasFeature(Feature f) {
- return (f == kFeatureCursorHasPalette);
+ return (f == kFeatureCursorPalette);
}
void OSystem_N64::setFeatureState(Feature f, bool enable) {
- return;
+ if (f == kFeatureCursorPalette) {
+ _cursorPaletteDisabled = !enable;
+
+ // Rebuild cursor hicolor buffer
+ rebuildOffscreenMouseBuffer();
+
+ _dirtyOffscreen = true;
+ }
}
bool OSystem_N64::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette)
+ return !_cursorPaletteDisabled;
return false;
}
@@ -437,15 +442,6 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
_dirtyOffscreen = true;
}
-void OSystem_N64::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- // Rebuild cursor hicolor buffer
- rebuildOffscreenMouseBuffer();
-
- _dirtyOffscreen = true;
-}
-
void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
//Clip the coordinates
if (x < 0) {
@@ -852,21 +848,11 @@ void OSystem_N64::quit() {
return;
}
-Common::SaveFileManager *OSystem_N64::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_N64::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_N64::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
void OSystem_N64::getTimeAndDate(TimeDate &t) const {
// No RTC inside the N64, read mips timer to simulate
// passing of time, not a perfect solution, but can't think
@@ -884,10 +870,6 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
return;
}
-FilesystemFactory *OSystem_N64::getFilesystemFactory() {
- return _fsFactory;
-}
-
void OSystem_N64::setTimerCallback(TimerProc callback, int interval) {
assert (interval > 0);
diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp
index 8d9f0471d3..0622e6423d 100644
--- a/backends/platform/n64/osys_n64_utilities.cpp
+++ b/backends/platform/n64/osys_n64_utilities.cpp
@@ -21,6 +21,7 @@
*/
#include "osys_n64.h"
+#include "backends/timer/default/default-timer.h"
void checkTimers(void) {
OSystem_N64 *osys = (OSystem_N64 *)g_system;
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index b9e901bb5a..106cde1699 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -52,9 +52,6 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
-
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
};
OSystem_NULL::OSystem_NULL() {
@@ -73,12 +70,11 @@ OSystem_NULL::~OSystem_NULL() {
}
void OSystem_NULL::initBackend() {
- _mutexManager = (MutexManager *)new NullMutexManager();
+ _mutexManager = new NullMutexManager();
_timerManager = new DefaultTimerManager();
_eventManager = new DefaultEventManager(this);
_savefileManager = new DefaultSaveFileManager();
- _graphicsManager = (GraphicsManager *)new NullGraphicsManager();
- _audiocdManager = (AudioCDManager *)new DefaultAudioCDManager();
+ _graphicsManager = new NullGraphicsManager();
_mixer = new Audio::MixerImpl(this, 22050);
((Audio::MixerImpl *)_mixer)->setReady(false);
@@ -87,7 +83,7 @@ void OSystem_NULL::initBackend() {
// this way; they need to be hooked into the system somehow to
// be functional. Of course, can't do that in a NULL backend :).
- OSystem::initBackend();
+ ModularBackend::initBackend();
}
bool OSystem_NULL::pollEvent(Common::Event &event) {
@@ -101,18 +97,6 @@ uint32 OSystem_NULL::getMillis() {
void OSystem_NULL::delayMillis(uint msecs) {
}
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
-
-Common::SeekableReadStream *OSystem_NULL::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createReadStream();
-}
-
-Common::WriteStream *OSystem_NULL::createConfigWriteStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
-}
-
OSystem *OSystem_NULL_create() {
return new OSystem_NULL();
}
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index 4c29636e40..5231e9790d 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -20,13 +20,16 @@
*
*/
+#if defined(OPENPANDORA)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "backends/platform/openpandora/op-sdl.h"
-#include "base/main.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h"
+#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
@@ -35,6 +38,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "audio/mixer_intern.h"
@@ -52,15 +56,29 @@
static SDL_Cursor *hiddenCursor;
-static Uint32 timer_handler(Uint32 interval, void *param) {
- ((DefaultTimerManager *)param)->handler();
- return interval;
+OSystem_OP::OSystem_OP()
+ :
+ OSystem_POSIX() {
}
+//static Uint32 timer_handler(Uint32 interval, void *param) {
+// ((DefaultTimerManager *)param)->handler();
+// return interval;
+//}
+
void OSystem_OP::initBackend() {
assert(!_inited);
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new OPEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new OPGraphicsManager(_eventSource);
+ }
+
// int joystick_num = ConfMan.getInt("joystick_num");
// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
//
@@ -76,12 +94,12 @@ void OSystem_OP::initBackend() {
//
// Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
+// if (_mixer == 0) {
+// _mixerManager = new DoubleBufferSDLMixerManager();
// Setup and start mixer
- _mixerManager->init();
- }
+// _mixerManager->init();
+// }
/* Setup default save path to be workingdir/saves */
@@ -103,7 +121,7 @@ void OSystem_OP::initBackend() {
if (mkdir(savePath, 0755) != 0)
warning("mkdir for '%s' failed!", savePath);
-// _savefileManager = new DefaultSaveFileManager(savePath);
+ _savefileManager = new DefaultSaveFileManager(savePath);
#ifdef DUMP_STDOUT
// The OpenPandora has a serial console on the EXT connection but most users do not use this so we
@@ -161,24 +179,14 @@ void OSystem_OP::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new OPGraphicsManager(_eventSource);
-
// _graphicsMutex = createMutex();
- // Invoke parent implementation of this method
+ /* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
_inited = true;
}
-
-
// enable joystick
// if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
// printf("Using joystick: %s\n", SDL_JoystickName(0));
@@ -239,13 +247,14 @@ void OSystem_OP::initSDL() {
// _videoMode.fullscreen = true;
_initedSDL = true;
+
+// OSystem_POSIX::initSDL();
}
}
void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
-
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
@@ -276,3 +285,5 @@ void OSystem_OP::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index ab777fec8f..bb359e7204 100644
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -20,10 +20,8 @@
*
*/
-
-#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/openpandora/op-sdl.h"
-#include "backends/plugins/posix/posix-provider.h"
+#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
#if defined(OPENPANDORA)
@@ -35,10 +33,10 @@ int main(int argc, char *argv[]) {
assert(g_system);
// Pre initialize the backend
- //((OSystem_OP *)g_system)->init();
+ ((OSystem_OP *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 9d92472b17..d493c3957c 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -26,12 +26,12 @@
#if defined(OPENPANDORA)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-#define __OPENPANDORA__
+//#define MIXER_DOUBLE_BUFFERING 1
#ifndef PATH_MAX
#define PATH_MAX 255
@@ -39,16 +39,22 @@
class OSystem_OP : public OSystem_POSIX {
public:
- OSystem_OP() {}
+ OSystem_OP();
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
- void initSDL();
void quit();
protected:
-
+ bool _inited;
+ bool _initedSDL;
+
+ /**
+ * Initialse the SDL library
+ * with an OpenPandora workaround.
+ */
+ virtual void initSDL();
};
#endif
#endif //OP_SDL_H
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 038cccd9dd..ef01f3a693 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -535,23 +535,3 @@ size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream) {
assert(r != 0);
return ((Ps2File*)stream)->write(buf, r * n) / r;
}
-
-int ps2_fputs(const char *s, FILE *stream) {
- int len = strlen(s);
-
- if (stream == stderr || stream == stdout) {
- printf("%s", s);
- sioprintf("%s", s);
- return len;
- }
-
- if (ps2_fwrite(s, 1, len, stream) == (size_t)len)
- return len;
- else
- return EOF;
-}
-
-int ps2_fflush(FILE *stream) {
- // printf("fflush not implemented\n");
- return 0;
-}
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index 3fdee5f1dc..afa2ca1f24 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -115,10 +115,8 @@ public:
// TODO: Get rid of the following, instead use PS2FileStream directly.
FILE *ps2_fopen(const char *fname, const char *mode);
int ps2_fclose(FILE *stream);
-int ps2_fflush(FILE *stream);
size_t ps2_fread(void *buf, size_t r, size_t n, FILE *stream);
size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream);
-int ps2_fputs(const char *s, FILE *stream);
#endif // __PS2FILE_IO__
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 210454c9aa..d3acd06089 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -33,36 +33,41 @@
#include <assert.h>
#include <iopcontrol.h>
#include <iopheap.h>
-#include "common/scummsys.h"
-#include "engines/engine.h"
-#include "backends/platform/ps2/systemps2.h"
-#include "backends/platform/ps2/Gs2dScreen.h"
-#include "backends/platform/ps2/ps2input.h"
-#include "backends/platform/ps2/irxboot.h"
+
#include <sjpcm.h>
#include <libhdd.h>
-#include "backends/platform/ps2/savefilemgr.h"
-#include "common/file.h"
-#include "backends/platform/ps2/sysdefs.h"
-#include "backends/platform/ps2/fileio.h"
#include <libmc.h>
#include <libpad.h>
-#include "backends/platform/ps2/cd.h"
#include <fileXio_rpc.h>
-#include "backends/platform/ps2/asyncfio.h"
#include "eecodyvdfs.h"
-#include "graphics/surface.h"
-#include "graphics/font.h"
-#include "backends/timer/default/default-timer.h"
-#include "audio/mixer_intern.h"
+
+#include "common/config-manager.h"
#include "common/events.h"
+#include "common/file.h"
+#include "common/scummsys.h"
+
+#include "backends/platform/ps2/asyncfio.h"
+#include "backends/platform/ps2/cd.h"
+#include "backends/platform/ps2/fileio.h"
+#include "backends/platform/ps2/Gs2dScreen.h"
+#include "backends/platform/ps2/irxboot.h"
#include "backends/platform/ps2/ps2debug.h"
-#include "backends/fs/ps2/ps2-fs-factory.h"
+#include "backends/platform/ps2/ps2input.h"
+#include "backends/platform/ps2/savefilemgr.h"
+#include "backends/platform/ps2/sysdefs.h"
+#include "backends/platform/ps2/systemps2.h"
+#include "backends/fs/ps2/ps2-fs-factory.h"
#include "backends/plugins/ps2/ps2-provider.h"
-#include "backends/saves/default/default-saves.h"
-#include "common/config-manager.h"
+#include "backends/timer/default/default-timer.h"
+
+#include "audio/mixer_intern.h"
+
+#include "engines/engine.h"
+
+#include "graphics/font.h"
+#include "graphics/surface.h"
#include "icon.h"
#include "ps2temp.h"
@@ -342,13 +347,14 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
void OSystem_PS2::init(void) {
sioprintf("Timer...\n");
- _scummTimerManager = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
_scummMixer = new Audio::MixerImpl(this, 48000);
_scummMixer->setReady(true);
+
initTimer();
sioprintf("Starting SavefileManager\n");
- _saveManager = new Ps2SaveFileManager(this, _screen);
+ _savefileManager = new Ps2SaveFileManager(this, _screen);
sioprintf("Initializing ps2Input\n");
_input = new Ps2Input(this, _useMouse, _useKbd);
@@ -423,7 +429,7 @@ void OSystem_PS2::initTimer(void) {
void OSystem_PS2::timerThreadCallback(void) {
while (!_systemQuit) {
WaitSema(g_TimerThreadSema);
- _scummTimerManager->handler();
+ ((DefaultTimerManager *)_timerManager)->handler();
}
ExitThread();
}
@@ -593,22 +599,10 @@ void OSystem_PS2::delayMillis(uint msecs) {
}
}
-Common::TimerManager *OSystem_PS2::getTimerManager() {
- return _scummTimerManager;
-}
-/*
-Common::EventManager *OSystem_PS2::getEventManager() {
- return getEventManager();
-}
-*/
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
-Common::SaveFileManager *OSystem_PS2::getSavefileManager(void) {
- return _saveManager;
-}
-
FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
return &Ps2FilesystemFactory::instance();
}
@@ -767,7 +761,7 @@ void OSystem_PS2::msgPrintf(int millis, const char *format, ...) {
void OSystem_PS2::powerOffCallback(void) {
sioprintf("powerOffCallback\n");
- // _saveManager->quit(); // romeo
+ // _savefileManager->quit(); // romeo
if (_useHdd) {
sioprintf("umount\n");
fio.umount("pfs0:");
@@ -807,7 +801,7 @@ void OSystem_PS2::quit(void) {
DisableIntc(INT_TIMER0);
RemoveIntcHandler(INT_TIMER0, _intrId);
- // _saveManager->quit(); // romeo
+ // _savefileManager->quit(); // romeo
_screen->quit();
padEnd(); // stop pad library
@@ -976,12 +970,11 @@ void OSystem_PS2::makeConfigPath() {
_configFile = strdup(path);
}
-Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() {
- Common::FSNode file(_configFile);
- return file.createReadStream();
+Common::String OSystem_PS2::getDefaultConfigFileName() {
+ return _configFile;
}
-Common::WriteStream *OSystem_PS2::createConfigWriteStream() {
- Common::FSNode file(_configFile);
- return file.createWriteStream();
+void OSystem_PS2::logMessage(LogMessageType::Type type, const char *message) {
+ printf("%s", message);
+ sioprintf("%s", message);
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index b21a56c184..35ceaf829e 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -27,12 +27,8 @@
#include "backends/base-backend.h"
#include "graphics/palette.h"
-class DefaultTimerManager;
-class DefaultSaveFileManager;
-
class Gs2dScreen;
class Ps2Input;
-class Ps2SaveFileManager;
// class Ps2FilesystemFactory;
struct IrxReference;
@@ -44,15 +40,11 @@ struct Ps2Mutex {
int count;
};
-namespace Common {
-class TimerManager;
-};
-
namespace Audio {
class MixerImpl;
};
-class OSystem_PS2 : public BaseBackend, public PaletteManager {
+class OSystem_PS2 : public EventsBaseBackend, public PaletteManager {
public:
OSystem_PS2(const char *elfPath);
virtual ~OSystem_PS2(void);
@@ -93,8 +85,6 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
- virtual Common::TimerManager *getTimerManager();
-// virtual Common::EventManager *getEventManager();
virtual bool pollEvent(Common::Event &event);
virtual Audio::Mixer *getMixer();
@@ -112,11 +102,11 @@ public:
virtual void quit();
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual Common::String getDefaultConfigFileName();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
virtual Graphics::PixelFormat getOverlayFormat() const;
- virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(TimeDate &t) const;
@@ -144,15 +134,11 @@ private:
void initTimer(void);
void readRtcTime(void);
- DefaultTimerManager *_scummTimerManager;
Audio::MixerImpl *_scummMixer;
bool _mouseVisible;
bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet;
- Ps2SaveFileManager *_saveManager;
- // DefaultSaveFileManager *_saveManager;
-
Gs2dScreen *_screen;
Ps2Input *_input;
uint16 _oldMouseX, _oldMouseY;
diff --git a/backends/platform/psp/cursor.h b/backends/platform/psp/cursor.h
index 9c24d001fb..f79968243b 100644
--- a/backends/platform/psp/cursor.h
+++ b/backends/platform/psp/cursor.h
@@ -53,6 +53,7 @@ public:
Buffer &buffer() { return _buffer; }
void setCursorPalette(const byte *colors, uint start, uint num);
void enableCursorPalette(bool enable);
+ bool isCursorPaletteEnabled() const { return _useCursorPalette; }
void setLimits(uint32 width, uint32 height);
void setXY(int x, int y);
int32 getX() const { return _x; }
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 3db743eff3..01124b420e 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -89,9 +89,9 @@ void OSystem_PSP::initBackend() {
_imageViewer.setInputHandler(&_inputHandler);
_imageViewer.setDisplayManager(&_displayManager);
- _savefile = new PSPSaveFileManager;
+ _savefileManager = new PSPSaveFileManager;
- _timer = new DefaultTimerManager();
+ _timerManager = new DefaultTimerManager();
PSP_DEBUG_PRINT("calling keyboard.load()\n");
_keyboard.load(); // Load virtual keyboard files into memory
@@ -100,7 +100,7 @@ void OSystem_PSP::initBackend() {
setupMixer();
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
// Let's us know an engine
@@ -110,13 +110,20 @@ void OSystem_PSP::engineDone() {
}
bool OSystem_PSP::hasFeature(Feature f) {
- return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorHasPalette);
+ return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorPalette);
}
void OSystem_PSP::setFeatureState(Feature f, bool enable) {
+ if (f == kFeatureCursorPalette) {
+ _pendingUpdate = false;
+ _cursor.enableCursorPalette(enable);
+ }
}
bool OSystem_PSP::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette) {
+ return _cursor.isCursorPaletteEnabled();
+ }
return false;
}
@@ -198,12 +205,6 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
_cursor.clearKeyColor(); // Do we need this?
}
-void OSystem_PSP::disableCursorPalette(bool disable) {
- DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
- _cursor.enableCursorPalette(!disable);
-}
-
void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
@@ -421,7 +422,7 @@ void OSystem_PSP::quit() {
}
void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) {
- BaseBackend::logMessage(type, message);
+ EventsBaseBackend::logMessage(type, message);
if (type == LogMessageType::kError)
PspDebugTrace(false, "%s", message); // write to file
@@ -438,14 +439,6 @@ void OSystem_PSP::getTimeAndDate(TimeDate &td) const {
td.tm_year = t.tm_year;
}
-#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
-
-Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() {
- Common::FSNode file(PSP_CONFIG_FILE);
- return file.createReadStream();
-}
-
-Common::WriteStream *OSystem_PSP::createConfigWriteStream() {
- Common::FSNode file(PSP_CONFIG_FILE);
- return file.createWriteStream();
+Common::String OSystem_PSP::getDefaultConfigFileName() {
+ return "ms0:/scummvm.ini";
}
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 00eec3da90..e6b445e232 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -42,12 +42,10 @@
#include "backends/timer/psp/timer.h"
#include "backends/platform/psp/thread.h"
-class OSystem_PSP : public BaseBackend, public PaletteManager {
+class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
private:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- Common::TimerManager *_timer;
bool _pendingUpdate; // save an update we couldn't perform
uint32 _pendingUpdateCounter; // prevent checking for pending update too often, in a cheap way
@@ -63,7 +61,7 @@ private:
ImageViewer _imageViewer;
public:
- OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
+ OSystem_PSP() : _mixer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {}
~OSystem_PSP();
static OSystem *instance();
@@ -99,7 +97,6 @@ protected:
void grabPalette(byte *colors, uint start, uint num);
public:
void setCursorPalette(const byte *colors, uint start, uint num);
- void disableCursorPalette(bool disable);
// Screen related
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
@@ -134,7 +131,6 @@ public:
// Timer
typedef int (*TimerProc)(int interval);
void setTimerCallback(TimerProc callback, int interval);
- Common::TimerManager *getTimerManager() { return _timer; }
// Mutex
MutexRef createMutex(void);
@@ -148,7 +144,6 @@ public:
Audio::Mixer *getMixer() { return _mixer; }
// Misc
- Common::SaveFileManager *getSavefileManager() { return _savefile; }
FilesystemFactory *getFilesystemFactory() { return &PSPFilesystemFactory::instance(); }
void getTimeAndDate(TimeDate &t) const;
virtual void engineDone();
@@ -157,9 +152,7 @@ public:
void logMessage(LogMessageType::Type type, const char *message);
- Common::SeekableReadStream *createConfigReadStream();
- Common::WriteStream *createConfigWriteStream();
-
+ virtual Common::String getDefaultConfigFileName();
};
#endif /* OSYS_PSP_H */
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 0ef16d9a6e..9b11eb2c09 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -33,7 +33,9 @@
#include "common/archive.h"
#include "common/fs.h"
-#include "CoreFoundation/CoreFoundation.h"
+#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
+#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
+#include "CoreServices/CoreServices.h" // for FSPathMakeRef
OSystem_MacOSX::OSystem_MacOSX()
:
@@ -75,4 +77,27 @@ void OSystem_MacOSX::setupIcon() {
// Don't set icon on OS X, as we use a nicer external icon there.
}
+bool OSystem_MacOSX::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+ return OSystem_POSIX::hasFeature(f);
+}
+
+bool OSystem_MacOSX::displayLogFile() {
+ // Use LaunchServices to open the log file, if possible.
+
+ if (_logFilePath.empty())
+ return false;
+
+ FSRef ref;
+ OSStatus err;
+
+ err = FSPathMakeRef((const UInt8 *)_logFilePath.c_str(), &ref, NULL);
+ if (err == noErr) {
+ err = LSOpenFSRef(&ref, NULL);
+ }
+
+ return err != noErr;
+}
+
#endif
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 6d78427522..86c70297ec 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -29,6 +29,10 @@ class OSystem_MacOSX : public OSystem_POSIX {
public:
OSystem_MacOSX();
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
virtual void initBackend();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
virtual void setupIcon();
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 21ad7b9e35..d757186134 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -22,6 +22,8 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h
#include "common/scummsys.h"
@@ -34,6 +36,8 @@
#include <errno.h>
#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
OSystem_POSIX::OSystem_POSIX(Common::String baseConfigName)
@@ -58,6 +62,12 @@ void OSystem_POSIX::initBackend() {
OSystem_SDL::initBackend();
}
+bool OSystem_POSIX::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+ return OSystem_SDL::hasFeature(f);
+}
+
Common::String OSystem_POSIX::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
@@ -73,6 +83,10 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() {
}
Common::WriteStream *OSystem_POSIX::createLogFile() {
+ // Start out by resetting _logFilePath, so that in case
+ // of a failure, we know that no log file is open.
+ _logFilePath.clear();
+
const char *home = getenv("HOME");
if (home == NULL)
return 0;
@@ -128,7 +142,62 @@ Common::WriteStream *OSystem_POSIX::createLogFile() {
logFile += "/scummvm.log";
Common::FSNode file(logFile);
- return file.createWriteStream();
+ Common::WriteStream *stream = file.createWriteStream();
+ if (stream)
+ _logFilePath = logFile;
+ return stream;
}
+bool OSystem_POSIX::displayLogFile() {
+ if (_logFilePath.empty())
+ return false;
+
+ // FIXME: This may not work perfectly when in fullscreen mode.
+ // On my system it drops from fullscreen without ScummVM noticing,
+ // so the next Alt-Enter does nothing, going from windowed to windowed.
+ // (wjp, 20110604)
+
+ pid_t pid = fork();
+ if (pid < 0) {
+ // failed to fork
+ return false;
+ } else if (pid == 0) {
+
+ // Try xdg-open first
+ execlp("xdg-open", "xdg-open", _logFilePath.c_str(), (char*)0);
+
+ // If we're here, that clearly failed.
+
+ // TODO: We may also want to try detecting the case where
+ // xdg-open is successfully executed but returns an error code.
+
+ // Try xterm+less next
+
+ execlp("xterm", "xterm", "-e", "less", _logFilePath.c_str(), (char*)0);
+
+ // TODO: If less does not exist we could fall back to 'more'.
+ // However, we'll have to use 'xterm -hold' for that to prevent the
+ // terminal from closing immediately (for short log files) or
+ // unexpectedly.
+
+ exit(127);
+ }
+
+ int status;
+ // Wait for viewer to close.
+ // (But note that xdg-open may have spawned a viewer in the background.)
+
+ // FIXME: We probably want the viewer to always open in the background.
+ // This may require installing a SIGCHLD handler.
+ pid = waitpid(pid, &status, 0);
+
+ if (pid < 0) {
+ // Probably nothing sensible to do in this error situation
+ return false;
+ }
+
+ return WIFEXITED(status) && WEXITSTATUS(status) == 0;
+}
+
+
#endif
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index 0a4f38e2c4..59909a958f 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -31,14 +31,31 @@ public:
OSystem_POSIX(Common::String baseConfigName = ".scummvmrc");
virtual ~OSystem_POSIX() {}
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
virtual void init();
virtual void initBackend();
protected:
- // Base string for creating the default path and filename
- // for the configuration file
+ /**
+ * Base string for creating the default path and filename for the
+ * configuration file. This allows the Mac OS X subclass to override
+ * the config file path and name.
+ */
Common::String _baseConfigName;
+ /**
+ * The path of the currently open log file, if any.
+ *
+ * @note This is currently a string and not an FSNode for simplicity;
+ * e.g. we don't need to include fs.h here, and currently the
+ * only use of this value is to use it to open the log file in an
+ * editor; for that, we need it only as a string anyway.
+ */
+ Common::String _logFilePath;
+
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index a3fb719ca4..afc6c850d9 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -20,8 +20,7 @@
*
*/
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
@@ -206,6 +205,8 @@ void OSystem_SDL::initBackend() {
setupIcon();
_inited = true;
+
+ ModularBackend::initBackend();
}
void OSystem_SDL::initSDL() {
@@ -244,20 +245,6 @@ void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
}
-Common::String OSystem_SDL::getDefaultConfigFileName() {
- return "scummvm.ini";
-}
-
-Common::SeekableReadStream *OSystem_SDL::createConfigReadStream() {
- Common::FSNode file(getDefaultConfigFileName());
- return file.createReadStream();
-}
-
-Common::WriteStream *OSystem_SDL::createConfigWriteStream() {
- Common::FSNode file(getDefaultConfigFileName());
- return file.createWriteStream();
-}
-
void OSystem_SDL::setWindowCaption(const char *caption) {
Common::String cap;
byte c;
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index e9e9bc5696..9c08752054 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -65,8 +65,6 @@ public:
virtual void setWindowCaption(const char *caption);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &td) const;
@@ -93,6 +91,8 @@ protected:
*/
SdlEventSource *_eventSource;
+ virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
+
/**
* Initialze the SDL library.
*/
@@ -103,12 +103,6 @@ protected:
*/
virtual void setupIcon();
- /**
- * Get the file path where the user configuration
- * of ScummVM will be saved.
- */
- virtual Common::String getDefaultConfigFileName();
-
// Logging
virtual Common::WriteStream *createLogFile() { return 0; }
Backends::Log::Log *_logger;
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 93b76f4188..5b14be4417 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -32,6 +32,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef ARRAYSIZE // winnt.h defines ARRAYSIZE, but we want our own one...
+#include <shellapi.h>
#include "backends/platform/sdl/win32/win32.h"
#include "backends/fs/windows/windows-fs-factory.h"
@@ -87,6 +88,49 @@ void OSystem_Win32::init() {
OSystem_SDL::init();
}
+
+bool OSystem_Win32::hasFeature(Feature f) {
+ if (f == kFeatureDisplayLogFile)
+ return true;
+
+ return OSystem_SDL::hasFeature(f);
+}
+
+bool OSystem_Win32::displayLogFile() {
+ if (_logFilePath.empty())
+ return false;
+
+ // Try opening the log file with the default text editor
+ // log files should be registered as "txtfile" by default and thus open in the default text editor
+ HINSTANCE shellExec = ShellExecute(NULL, NULL, _logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ if ((intptr_t)shellExec > 32)
+ return true;
+
+ // ShellExecute with the default verb failed, try the "Open with..." dialog
+ PROCESS_INFORMATION processInformation;
+ STARTUPINFO startupInfo;
+ memset(&processInformation, 0, sizeof(processInformation));
+ memset(&startupInfo, 0, sizeof(startupInfo));
+ startupInfo.cb = sizeof(startupInfo);
+
+ char cmdLine[MAX_PATH * 2]; // CreateProcess may change the contents of cmdLine
+ sprintf(cmdLine, "rundll32 shell32.dll,OpenAs_RunDLL %s", _logFilePath.c_str());
+ BOOL result = CreateProcess(NULL,
+ cmdLine,
+ NULL,
+ NULL,
+ FALSE,
+ NORMAL_PRIORITY_CLASS,
+ NULL,
+ NULL,
+ &startupInfo,
+ &processInformation);
+ if (result)
+ return true;
+
+ return false;
+}
+
Common::String OSystem_Win32::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
@@ -136,6 +180,10 @@ Common::String OSystem_Win32::getDefaultConfigFileName() {
}
Common::WriteStream *OSystem_Win32::createLogFile() {
+ // Start out by resetting _logFilePath, so that in case
+ // of a failure, we know that no log file is open.
+ _logFilePath.clear();
+
char logFile[MAXPATHLEN];
OSVERSIONINFO win32OsVersion;
@@ -163,7 +211,11 @@ Common::WriteStream *OSystem_Win32::createLogFile() {
strcat(logFile, "\\scummvm.log");
Common::FSNode file(logFile);
- return file.createWriteStream();
+ Common::WriteStream *stream = file.createWriteStream();
+ if (stream)
+ _logFilePath= logFile;
+
+ return stream;
} else {
return 0;
}
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 268449eeff..ef7b6af3f1 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -30,7 +30,22 @@ public:
virtual void init();
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
+
+ virtual bool hasFeature(Feature f);
+
+ virtual bool displayLogFile();
+
protected:
+ /**
+ * The path of the currently open log file, if any.
+ *
+ * @note This is currently a string and not an FSNode for simplicity;
+ * e.g. we don't need to include fs.h here, and currently the
+ * only use of this value is to use it to open the log file in an
+ * editor; for that, we need it only as a string anyway.
+ */
+ Common::String _logFilePath;
+
virtual Common::String getDefaultConfigFileName();
virtual Common::WriteStream *createLogFile();
};
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 401b19b0e1..c6b23783b8 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -34,6 +34,8 @@
#include "common/config-manager.h"
#include "common/textconsole.h"
#include "backends/fs/wii/wii-fs-factory.h"
+#include "backends/saves/default/default-saves.h"
+#include "backends/timer/default/default-timer.h"
#include "osystem.h"
#include "options.h"
@@ -96,20 +98,12 @@ OSystem_Wii::OSystem_Wii() :
_padSensitivity(16),
_padAcceleration(4),
- _savefile(NULL),
- _mixer(NULL),
- _timer(NULL) {
+ _mixer(NULL) {
}
OSystem_Wii::~OSystem_Wii() {
- delete _savefile;
- _savefile = NULL;
-
delete _mixer;
_mixer = NULL;
-
- delete _timer;
- _timer = NULL;
}
void OSystem_Wii::initBackend() {
@@ -143,14 +137,14 @@ void OSystem_Wii::initBackend() {
if (!getcwd(buf, MAXPATHLEN))
strcpy(buf, "/");
- _savefile = new DefaultSaveFileManager(buf);
- _timer = new DefaultTimerManager();
+ _savefileManager = new DefaultSaveFileManager(buf);
+ _timerManager = new DefaultTimerManager();
initGfx();
initSfx();
initEvents();
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
void OSystem_Wii::quit() {
@@ -175,7 +169,7 @@ void OSystem_Wii::engineDone() {
bool OSystem_Wii::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) ||
- (f == kFeatureCursorHasPalette) ||
+ (f == kFeatureCursorPalette) ||
(f == kFeatureOverlaySupportsAlpha);
}
@@ -188,6 +182,13 @@ void OSystem_Wii::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection:
_arCorrection = enable;
break;
+ case kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ if (_texMouse.palette && !enable) {
+ memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
+ _cursorPaletteDirty = true;
+ }
+ break;
default:
break;
}
@@ -199,6 +200,8 @@ bool OSystem_Wii::getFeatureState(Feature f) {
return _fullscreen;
case kFeatureAspectRatioCorrection:
return _arCorrection;
+ case kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
@@ -252,21 +255,11 @@ void OSystem_Wii::setWindowCaption(const char *caption) {
printf("window caption: %s\n", caption);
}
-Common::SaveFileManager *OSystem_Wii::getSavefileManager() {
- assert(_savefile);
- return _savefile;
-}
-
Audio::Mixer *OSystem_Wii::getMixer() {
assert(_mixer);
return _mixer;
}
-Common::TimerManager *OSystem_Wii::getTimerManager() {
- assert(_timer);
- return _timer;
-}
-
FilesystemFactory *OSystem_Wii::getFilesystemFactory() {
return &WiiFilesystemFactory::instance();
}
@@ -368,7 +361,7 @@ Common::String OSystem_Wii::getSystemLanguage() const {
} else {
// This will only happen when new languages are added to the API.
warning("WII: Unknown system language: %d", langID);
- return BaseBackend::getSystemLanguage();
+ return EventsBaseBackend::getSystemLanguage();
}
}
#endif // !GAMECUBE
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 0db5f92fff..6863a6840e 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -32,8 +32,6 @@
#include "common/rect.h"
#include "common/events.h"
#include "backends/base-backend.h"
-#include "backends/saves/default/default-saves.h"
-#include "backends/timer/default/default-timer.h"
#include "graphics/colormasks.h"
#include "graphics/palette.h"
#include "graphics/surface.h"
@@ -54,7 +52,7 @@ extern void wii_memstats(void);
}
#endif
-class OSystem_Wii : public BaseBackend, public PaletteManager {
+class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
private:
s64 _startup_time;
@@ -130,9 +128,7 @@ private:
void showOptionsDialog();
protected:
- Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
public:
enum {
@@ -171,7 +167,6 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h);
virtual void updateScreen();
@@ -212,9 +207,7 @@ public:
virtual void setWindowCaption(const char *caption);
- virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer();
- virtual Common::TimerManager *getTimerManager();
virtual FilesystemFactory *getFilesystemFactory();
virtual void getTimeAndDate(TimeDate &t) const;
diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp
index 8e51bbc673..389d3823e7 100644
--- a/backends/platform/wii/osystem_events.cpp
+++ b/backends/platform/wii/osystem_events.cpp
@@ -35,6 +35,7 @@
#endif
#include "common/config-manager.h"
+#include "backends/timer/default/default-timer.h"
#define TIMER_THREAD_STACKSIZE (1024 * 32)
#define TIMER_THREAD_PRIO 64
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index b44c1270f5..859e3a1395 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -394,15 +394,6 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
_cursorPaletteDirty = true;
}
-void OSystem_Wii::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- if (_texMouse.palette && disable) {
- memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
- _cursorPaletteDirty = true;
- }
-}
-
void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h) {
assert(x >= 0 && x < _gameWidth);
diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp
index f2c461fcf9..a4786d330d 100644
--- a/backends/platform/wince/CEActionsPocket.cpp
+++ b/backends/platform/wince/CEActionsPocket.cpp
@@ -233,15 +233,15 @@ CEActionsPocket::~CEActionsPocket() {
bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
static bool keydialogrunning = false, quitdialog = false;
+ _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
if (!pushed) {
switch (action) {
case POCKET_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+ _graphicsMan->add_right_click(false);
return true;
case POCKET_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+ _graphicsMan->add_left_click(false);
return true;
case POCKET_ACTION_PAUSE:
case POCKET_ACTION_SAVE:
@@ -249,7 +249,6 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
case POCKET_ACTION_MULTI:
EventsBuffer::simulateKey(&_key_action[action], false);
return true;
-
}
return false;
}
@@ -271,55 +270,43 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case POCKET_ACTION_KEYBOARD:
- //_CESystem->swap_panel();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel();
+ _graphicsMan->swap_panel();
return true;
case POCKET_ACTION_HIDE:
- //_CESystem->swap_panel_visibility();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_panel_visibility();
+ _graphicsMan->swap_panel_visibility();
return true;
case POCKET_ACTION_SOUND:
_CESystem->swap_sound_master();
return true;
case POCKET_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+ _graphicsMan->add_right_click(true);
return true;
case POCKET_ACTION_CURSOR:
- //_CESystem->swap_mouse_visibility();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_mouse_visibility();
+ _graphicsMan->swap_mouse_visibility();
return true;
case POCKET_ACTION_FREELOOK:
- //_CESystem->swap_freeLook();
- ((WINCESdlEventSource *)((OSystem_SDL *)g_system)->getEventManager())->swap_freeLook();
+ _graphicsMan->swap_freeLook();
return true;
case POCKET_ACTION_ZOOM_UP:
- //_CESystem->swap_zoom_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_up();
+ _graphicsMan->swap_zoom_up();
return true;
case POCKET_ACTION_ZOOM_DOWN:
- //_CESystem->swap_zoom_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_zoom_down();
+ _graphicsMan->swap_zoom_down();
return true;
case POCKET_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+ _graphicsMan->add_left_click(true);
return true;
case POCKET_ACTION_UP:
- //_CESystem->move_cursor_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+ _graphicsMan->move_cursor_up();
return true;
case POCKET_ACTION_DOWN:
- //_CESystem->move_cursor_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+ _graphicsMan->move_cursor_down();
return true;
case POCKET_ACTION_LEFT:
- //_CESystem->move_cursor_left();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+ _graphicsMan->move_cursor_left();
return true;
case POCKET_ACTION_RIGHT:
- //_CESystem->move_cursor_right();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+ _graphicsMan->move_cursor_right();
return true;
case POCKET_ACTION_QUIT:
if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsPocket.h b/backends/platform/wince/CEActionsPocket.h
index fd97c0b1df..e1f52b6b88 100644
--- a/backends/platform/wince/CEActionsPocket.h
+++ b/backends/platform/wince/CEActionsPocket.h
@@ -28,6 +28,7 @@
#include "common/str.h"
#include "gui/Key.h"
#include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#define POCKET_ACTION_VERSION 5
@@ -80,6 +81,7 @@ public:
~CEActionsPocket();
private:
CEActionsPocket(const Common::String &gameid);
+ WINCESdlGraphicsManager *_graphicsMan;
bool _right_click_needed;
bool _hide_toolbar_needed;
bool _zoom_needed;
diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp
index fdd52cfc26..b12dadabb6 100644
--- a/backends/platform/wince/CEActionsSmartphone.cpp
+++ b/backends/platform/wince/CEActionsSmartphone.cpp
@@ -199,15 +199,15 @@ CEActionsSmartphone::~CEActionsSmartphone() {
bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
static bool keydialogrunning = false, quitdialog = false;
+ _graphicsMan = ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager());
+
if (!pushed) {
switch (action) {
case SMARTPHONE_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
+ _graphicsMan->add_right_click(false);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(false);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
+ _graphicsMan->add_left_click(false);
return true;
case SMARTPHONE_ACTION_SAVE:
case SMARTPHONE_ACTION_SKIP:
@@ -234,32 +234,25 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
EventsBuffer::simulateKey(&_key_action[action], true);
return true;
case SMARTPHONE_ACTION_RIGHTCLICK:
- //_CESystem->add_right_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
+ _graphicsMan->add_right_click(true);
return true;
case SMARTPHONE_ACTION_LEFTCLICK:
- //_CESystem->add_left_click(true);
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
+ _graphicsMan->add_left_click(true);
return true;
case SMARTPHONE_ACTION_UP:
- //_CESystem->move_cursor_up();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
+ _graphicsMan->move_cursor_up();
return true;
case SMARTPHONE_ACTION_DOWN:
- //_CESystem->move_cursor_down();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
+ _graphicsMan->move_cursor_down();
return true;
case SMARTPHONE_ACTION_LEFT:
- //_CESystem->move_cursor_left();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
+ _graphicsMan->move_cursor_left();
return true;
case SMARTPHONE_ACTION_RIGHT:
- //_CESystem->move_cursor_right();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
+ _graphicsMan->move_cursor_right();
return true;
case SMARTPHONE_ACTION_ZONE:
- //_CESystem->switch_zone();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
+ _graphicsMan->switch_zone();
return true;
case SMARTPHONE_ACTION_BINDKEYS:
if (!keydialogrunning) {
@@ -271,12 +264,10 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
}
return true;
case SMARTPHONE_ACTION_KEYBOARD:
- //_CESystem->swap_smartphone_keyboard();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
+ _graphicsMan->swap_smartphone_keyboard();
return true;
case SMARTPHONE_ACTION_ROTATE:
- //_CESystem->smartphone_rotate_display();
- ((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
+ _graphicsMan->smartphone_rotate_display();
return true;
case SMARTPHONE_ACTION_QUIT:
if (!quitdialog) {
diff --git a/backends/platform/wince/CEActionsSmartphone.h b/backends/platform/wince/CEActionsSmartphone.h
index 5535ce1350..3da46d3923 100644
--- a/backends/platform/wince/CEActionsSmartphone.h
+++ b/backends/platform/wince/CEActionsSmartphone.h
@@ -28,6 +28,7 @@
#include "common/str.h"
#include "gui/Key.h"
#include "gui/Actions.h"
+#include "backends/graphics/wincesdl/wincesdl-graphics.h"
#define SMARTPHONE_ACTION_VERSION 5
@@ -68,6 +69,7 @@ public:
~CEActionsSmartphone();
private:
CEActionsSmartphone();
+ WINCESdlGraphicsManager *_graphicsMan;
bool _right_click_needed;
OSystem_WINCE3 *_CESystem;
};
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index a53bc41667..3ab9dc8aa4 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -379,10 +379,17 @@ void OSystem_WINCE3::initBackend() {
((WINCESdlEventSource *)_eventSource)->init((WINCESdlGraphicsManager *)_graphicsManager);
+
+ // FIXME: This timer manager is *not accesible* from the outside.
+ // Instead the timer manager setup by OSystem_SDL is visible on the outside.
+ // Since the WinCE backend actually seems to work, my guess is that
+ // SDL_AddTimer works after all and the following code is redundant.
+ // However it may be, this must be resolved one way or another.
+
// Create the timer. CE SDL does not support multiple timers (SDL_AddTimer).
// We work around this by using the SetTimer function, since we only use
// one timer in scummvm (for the time being)
- _timer = _int_timer = new DefaultTimerManager();
+ _int_timer = new DefaultTimerManager();
//_timerID = NULL; // OSystem_SDL will call removetimer with this, it's ok
SDL_SetTimer(10, &timer_handler_wrapper);
@@ -443,14 +450,9 @@ OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(),
}
OSystem_WINCE3::~OSystem_WINCE3() {
- delete _fsFactory;
delete _mixer;
}
-FilesystemFactory *OSystem_WINCE3::getFilesystemFactory() {
- return _fsFactory;
-}
-
void OSystem_WINCE3::swap_sound_master() {
_soundMaster = !_soundMaster;
@@ -464,7 +466,7 @@ void OSystem_WINCE3::swap_sound_master() {
void OSystem_WINCE3::engineInit() {
check_mappings(); // called here to initialize virtual keys handling
- //update_game_settings();
+ ((WINCESdlGraphicsManager *)_graphicsManager)->update_game_settings();
// finalize mixer init
_mixerManager->init();
}
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index a1e46081f9..adb63eb936 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -58,7 +58,6 @@ public:
void getTimeAndDate(TimeDate &t) const;
virtual Common::String getDefaultConfigFileName();
- virtual FilesystemFactory *getFilesystemFactory();
void swap_sound_master();
@@ -73,8 +72,6 @@ public:
protected:
void initSDL();
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
- FilesystemFactory *_fsFactory;
private:
void check_mappings();