aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
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.cpp10
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/ScummVM.java2
-rw-r--r--backends/platform/dc/Makefile4
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/dc.h15
-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/dingux/module.mk10
-rw-r--r--backends/platform/ds/arm9/dist/readme_ds.txt2
-rw-r--r--backends/platform/ds/arm9/makefile8
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp5
-rw-r--r--backends/platform/ds/arm9/source/fat/gba_nds_fat.c2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp57
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h16
-rw-r--r--backends/platform/ds/arm9/source/portdefs.h7
-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.mk12
-rw-r--r--backends/platform/gph/build/caanoo-config-alleng.sh4
-rw-r--r--backends/platform/gph/build/caanoo-config.sh4
-rw-r--r--backends/platform/gph/build/gp2x-config-alleng.sh8
-rw-r--r--backends/platform/gph/build/gp2x-config.sh11
-rw-r--r--backends/platform/gph/build/gp2xwiz-config-alleng.sh5
-rw-r--r--backends/platform/gph/build/gp2xwiz-config.sh5
-rw-r--r--backends/platform/gph/devices/gp2x/scummvm.gpe4
-rw-r--r--backends/platform/gph/gph-backend.cpp22
-rw-r--r--backends/platform/gph/gph-main.cpp4
-rw-r--r--backends/platform/gph/gph-sdl.h4
-rw-r--r--backends/platform/gph/module.mk2
-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_events.cpp4
-rw-r--r--backends/platform/iphone/osys_main.cpp58
-rw-r--r--backends/platform/iphone/osys_main.h13
-rw-r--r--backends/platform/iphone/osys_video.cpp3
-rw-r--r--backends/platform/linuxmoto/module.mk4
-rw-r--r--backends/platform/n64/osys_n64.h12
-rw-r--r--backends/platform/n64/osys_n64_base.cpp60
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp1
-rw-r--r--backends/platform/n64/portdefs.h13
-rw-r--r--backends/platform/null/null.cpp30
-rwxr-xr-xbackends/platform/openpandora/build/config-alleng.sh1
-rwxr-xr-xbackends/platform/openpandora/build/config.sh1
-rwxr-xr-xbackends/platform/openpandora/module.mk9
-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/Makefile.gdb100
-rw-r--r--backends/platform/ps2/Makefile.ps260
-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.cpp46
-rw-r--r--backends/platform/psp/osys_psp.h13
-rw-r--r--backends/platform/samsungtv/main.cpp6
-rw-r--r--backends/platform/samsungtv/module.mk3
-rw-r--r--backends/platform/samsungtv/samsungtv.cpp9
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp27
-rw-r--r--backends/platform/sdl/macosx/macosx.h4
-rw-r--r--backends/platform/sdl/main.cpp2
-rw-r--r--backends/platform/sdl/module.mk2
-rw-r--r--backends/platform/sdl/posix/posix-main.cpp2
-rw-r--r--backends/platform/sdl/posix/posix.cpp75
-rw-r--r--backends/platform/sdl/posix/posix.h21
-rw-r--r--backends/platform/sdl/sdl.cpp35
-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/symbian/BuildPackageUpload_LocalSettings.pl7
-rw-r--r--backends/platform/symbian/README3
-rw-r--r--backends/platform/symbian/src/portdefs.h22
-rw-r--r--backends/platform/wii/options.cpp6
-rw-r--r--backends/platform/wii/osystem.cpp59
-rw-r--r--backends/platform/wii/osystem.h11
-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/Makefile6
-rw-r--r--backends/platform/wince/README-WinCE.txt42
-rw-r--r--backends/platform/wince/portdefs.h60
-rw-r--r--backends/platform/wince/wince-sdl.cpp83
-rw-r--r--backends/platform/wince/wince-sdl.h5
98 files changed, 943 insertions, 1438 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index eeeddb4c77..17c7d4f9cb 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 62226eb8b1..b8a9e74437 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -179,7 +179,7 @@ void OSystem_Android::initSurface() {
JNI::initSurface();
- // Initialise OpenGLES context.
+ // Initialize OpenGLES context.
GLESTexture::initGLExtensions();
if (_game_texture)
@@ -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/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
index c4de6d62f8..ef9f4cc1e0 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java
@@ -260,7 +260,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
if (_audio_track.getState() != AudioTrack.STATE_INITIALIZED)
throw new Exception(
- String.format("Error initialising AudioTrack: %d",
+ String.format("Error initializing AudioTrack: %d",
_audio_track.getState()));
}
diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile
index 0133ffd9e9..6da32a9049 100644
--- a/backends/platform/dc/Makefile
+++ b/backends/platform/dc/Makefile
@@ -11,9 +11,13 @@ CXX = sh-elf-g++ -ml -m4-single-only
LD = $(CXX)
CXXFLAGS= -O3 -Wno-multichar -funroll-loops -fschedule-insns2 -fomit-frame-pointer -fdelete-null-pointer-checks -fno-exceptions
DEFINES = -D__DC__ -DNONSTANDARD_PORT -DUSE_MAD -DUSE_ZLIB -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_RGB_COLOR
+# For release builds:
+#DEFINES += -DNOSERIAL
LDFLAGS = -Wl,-Ttext,0x8c010000 -nostartfiles $(ronindir)/lib/crt0.o
INCLUDES= -I./ -I$(srcdir) -I$(ronindir)/include/ -I$(srcdir)/engines
LIBS = -L$(ronindir)/lib -lmad -lronin -lz -lm
+# For release builds:
+#LIBS = -L$(ronindir)/lib -lmad -lronin-noserial -lz -lm
EXECUTABLE = scummvm.elf
DEPDIR = .deps
CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
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 81f93a077e..bde50daa2d 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -53,7 +53,7 @@ class DCHardware {
};
class DCCDManager : public DefaultAudioCDManager {
- // Initialise the specified CD drive for audio playback.
+ // Initialize the specified CD drive for audio playback.
bool openCD(int drive);
// Poll cdrom status
@@ -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/dingux/module.mk b/backends/platform/dingux/module.mk
index 2247625a04..b924fec1cf 100644
--- a/backends/platform/dingux/module.mk
+++ b/backends/platform/dingux/module.mk
@@ -4,8 +4,10 @@ MODULE_OBJS := \
main.o \
dingux.o
-MODULE_DIRS += \
- backends/platform/dingux/
+# 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)))
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(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/ds/arm9/dist/readme_ds.txt b/backends/platform/ds/arm9/dist/readme_ds.txt
index ee1db719f4..24c85ad556 100644
--- a/backends/platform/ds/arm9/dist/readme_ds.txt
+++ b/backends/platform/ds/arm9/dist/readme_ds.txt
@@ -679,7 +679,7 @@ not supported.
Cdex can do the conversion very well and I recommend using it to convert
your audio files, although any CD ripping software can be used, so feel
-free to use your favourite program. The format you need to use is
+free to use your favorite program. The format you need to use is
IMA-ADPCM 4-bit Mono. You may use any sample rate. All other formats
will be rejected, including uncompressed WAV files.
diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile
index 781738265c..1b21b41a9b 100644
--- a/backends/platform/ds/arm9/makefile
+++ b/backends/platform/ds/arm9/makefile
@@ -75,7 +75,7 @@ else
ifdef DS_BUILD_K
else
- # USE_MAD = 1
+ USE_MAD = 1
endif
endif
endif
@@ -245,7 +245,9 @@ ifdef USE_MAD
DEFINES += -DUSE_MAD
endif
-DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE -DDISABLE_MASS_ADD -DDISABLE_NES_APU
+DEFINES += -DREDUCE_MEMORY_USAGE -DDISABLE_DEBUGGER -DUSE_TEXT_CONSOLE_FOR_DEBUGGER -DDISABLE_MASS_ADD -DDISABLE_NES_APU
+# for release builds:
+#DEFINES += -DNDEBUG
LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections
@@ -259,7 +261,7 @@ BACKEND := ds
INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \
-I$(portdir)/data -I$(portdir)/../commoninclude \
-I$(portdir)/source -I$(portdir)/source/mad \
- -I$(libndsdir)/include -include $(srcdir)/common/scummsys.h
+ -I$(libndsdir)/include -include $(portdir)/source/portdefs.h
LIBS = -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index b3146cc16f..dfd906d816 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -575,7 +575,7 @@ void initGame() {
for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
if (!stricmp(gameName, gameList[r].gameId)) {
s_currentGame = &gameList[r];
- // consolePrintf("Game list num: %d\n", s_currentGame);
+ // consolePrintf("Game list num: %d\n", r);
}
}
}
@@ -1668,8 +1668,7 @@ void addEventsToQueue() {
if (!keyboardEnable) {
-
- if ((isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) {
+ if ((!isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) {
// Controls specific to the control method
if (s_currentGame->control == CONT_SKY) {
diff --git a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
index 698590418c..76508a1664 100644
--- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
+++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c
@@ -1010,7 +1010,7 @@ DIR_ENT FAT_GetDirEntry ( u32 dirCluster, int entry, int origin)
dir.name[0] = FILE_FREE; // default to no file found
dir.attrib = 0x00;
- // Check if fat has been initialised
+ // Check if fat has been initialized
if (filesysBytePerSec == 0)
{
return (dir);
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/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h
index 580eb680eb..f512ce3ea2 100644
--- a/backends/platform/ds/arm9/source/portdefs.h
+++ b/backends/platform/ds/arm9/source/portdefs.h
@@ -26,8 +26,11 @@
// Include ndstypes.h for uint16 etc. typedefs
#include "nds/ndstypes.h"
-// Somebody removed these from scummsys.h, but they're still required, so I'm
-// adding them here in the hope that they'll stay.
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+// Include required headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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 4cdb4cd0d5..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);
-
- /* Initialise 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 837ad99d7b..0000000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,12 +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)))
diff --git a/backends/platform/gph/build/caanoo-config-alleng.sh b/backends/platform/gph/build/caanoo-config-alleng.sh
index 97fed942fa..b7836508ed 100644
--- a/backends/platform/gph/build/caanoo-config-alleng.sh
+++ b/backends/platform/gph/build/caanoo-config-alleng.sh
@@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+./configure --backend=caanoo --disable-mt32emu --host=caanoo \
+ --disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
diff --git a/backends/platform/gph/build/caanoo-config.sh b/backends/platform/gph/build/caanoo-config.sh
index 11d597481a..fe191647e6 100644
--- a/backends/platform/gph/build/caanoo-config.sh
+++ b/backends/platform/gph/build/caanoo-config.sh
@@ -8,10 +8,10 @@ echo and let all the build work be done from the backend/build folder.
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=caanoo --disable-mt32emu --host=caanoo --disable-alsa --disable-flac \
+./configure --backend=caanoo --disable-mt32emu --host=caanoo \
+ --disable-alsa --disable-flac \
--disable-nasm --disable-vorbis --disable-hq-scalers \
--with-sdl-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-tremor --with-tremor-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/opt/arm-caanoo/arm-none-linux-gnueabi/usr \
diff --git a/backends/platform/gph/build/gp2x-config-alleng.sh b/backends/platform/gph/build/gp2x-config-alleng.sh
index 4a3526d50c..83a4fe2046 100644
--- a/backends/platform/gph/build/gp2x-config-alleng.sh
+++ b/backends/platform/gph/build/gp2x-config-alleng.sh
@@ -17,7 +17,13 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --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-all-engines --enable-vkeybd
+./configure --backend=gp2x --disable-mt32emu --host=gp2x \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
+ --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-all-engines --enable-vkeybd
#--enable-plugins --default-dynamic
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
index 9092b0b1ea..a9b28b2fd0 100644
--- a/backends/platform/gph/build/gp2x-config.sh
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -17,8 +17,15 @@ export DEFINES=-DNDEBUG
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gp2x --disable-mt32emu --host=gp2x --disable-flac --disable-nasm --disable-hq-scalers --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 --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
+./configure --backend=gp2x --disable-mt32emu --host=gp2x \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
+ --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
echo Generating config for GP2X complete. Check for errors.
diff --git a/backends/platform/gph/build/gp2xwiz-config-alleng.sh b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
index 9ec8a09cd2..ff905d0585 100644
--- a/backends/platform/gph/build/gp2xwiz-config-alleng.sh
+++ b/backends/platform/gph/build/gp2xwiz-config-alleng.sh
@@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
- --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--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 \
diff --git a/backends/platform/gph/build/gp2xwiz-config.sh b/backends/platform/gph/build/gp2xwiz-config.sh
index ac7c34ad12..7be103602b 100644
--- a/backends/platform/gph/build/gp2xwiz-config.sh
+++ b/backends/platform/gph/build/gp2xwiz-config.sh
@@ -16,8 +16,9 @@ export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib
# Edit the configure line to suit.
cd ../../../..
-./configure --backend=gph --disable-mt32emu --host=gp2xwiz --disable-flac --disable-nasm --disable-hq-scalers \
- --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin --with-mpeg2-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
+./configure --backend=gph --disable-mt32emu --host=gp2xwiz \
+ --disable-flac --disable-nasm --disable-hq-scalers \
+ --with-sdl-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin \
--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 \
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 375ee37378..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);
}
@@ -141,7 +148,7 @@ void OSystem_GPH::initBackend() {
printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
#endif /* DUMP_STDOUT */
- /* Initialise any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
+ /* Initialize any GP2X Wiz specific stuff we may want (Batt Status, scaler etc.) */
WIZ_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. */
@@ -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/gph/module.mk b/backends/platform/gph/module.mk
index a9951494d1..d8a1a6cd8d 100644
--- a/backends/platform/gph/module.mk
+++ b/backends/platform/gph/module.mk
@@ -11,4 +11,4 @@ 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 \ No newline at end of file
+-include $(srcdir)/backends/platform/sdl/module.mk
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_events.cpp b/backends/platform/iphone/osys_events.cpp
index 6e2a4b7e1e..1ab1db0f27 100644
--- a/backends/platform/iphone/osys_events.cpp
+++ b/backends/platform/iphone/osys_events.cpp
@@ -335,9 +335,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x,
const char *dialogMsg;
if (_mouseClickAndDragEnabled) {
_touchpadModeEnabled = false;
- dialogMsg = "Mouse-click-and-drag mode enabled.";
+ dialogMsg = _("Mouse-click-and-drag mode enabled.");
} else
- dialogMsg = "Mouse-click-and-drag mode disabled.";
+ dialogMsg = _("Mouse-click-and-drag mode disabled.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
return false;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index 12317ad935..4bc567c39d 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
@@ -268,6 +242,18 @@ void OSystem_IPHONE::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
}
}
+void OSystem_IPHONE::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
void iphone_main(int argc, char *argv[]) {
//OSystem_IPHONE::migrateApp();
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 1ff87967a1..37896cceeb 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,17 @@ 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();
+
+ virtual void logMessage(LogMessageType::Type type, const char *message);
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/linuxmoto/module.mk b/backends/platform/linuxmoto/module.mk
index c604d69da1..4c81aac3f2 100644
--- a/backends/platform/linuxmoto/module.mk
+++ b/backends/platform/linuxmoto/module.mk
@@ -10,5 +10,5 @@ MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
OBJS := $(MODULE_OBJS) $(OBJS)
MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-# HACK: The linuxmoto backend is based on the SDL one, so we load that, too.
-include $(srcdir)/backends/platform/sdl/module.mk
+# 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/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 8c0b34ce32..285e2afa55 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,10 @@ 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();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
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..4bc3780fe2 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,8 +870,16 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
return;
}
-FilesystemFactory *OSystem_N64::getFilesystemFactory() {
- return _fsFactory;
+void OSystem_N64::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
}
void OSystem_N64::setTimerCallback(TimerProc callback, int interval) {
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/n64/portdefs.h b/backends/platform/n64/portdefs.h
index e62551355d..35ef3c71db 100644
--- a/backends/platform/n64/portdefs.h
+++ b/backends/platform/n64/portdefs.h
@@ -35,5 +35,18 @@
#undef assert
#define assert(x) ((x) ? 0 : (print_error("ASSERT TRIGGERED:\n\n("#x")\n%s\nline: %d", __FILE__, __LINE__)))
+// Typedef basic data types in a way that is compatible with the N64 SDK.
+typedef unsigned char byte;
+typedef unsigned char uint8;
+typedef signed char int8;
+typedef unsigned short int uint16;
+typedef signed short int int16;
+typedef unsigned int uint32;
+typedef signed int int32;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
#endif
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 7dd127fefa..4690a67c55 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -34,7 +34,7 @@
*/
#if defined(__amigaos4__)
#include "backends/fs/amigaos4/amigaos4-fs-factory.h"
-#elif defined(UNIX)
+#elif defined(POSIX)
#include "backends/fs/posix/posix-fs-factory.h"
#elif defined(WIN32)
#include "backends/fs/windows/windows-fs-factory.h"
@@ -53,14 +53,13 @@ public:
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
- virtual Common::SeekableReadStream *createConfigReadStream();
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual void logMessage(LogMessageType::Type type, const char *message);
};
OSystem_NULL::OSystem_NULL() {
#if defined(__amigaos4__)
_fsFactory = new AmigaOSFilesystemFactory();
- #elif defined(UNIX)
+ #elif defined(POSIX)
_fsFactory = new POSIXFilesystemFactory();
#elif defined(WIN32)
_fsFactory = new WindowsFilesystemFactory();
@@ -73,12 +72,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 +85,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,16 +99,16 @@ uint32 OSystem_NULL::getMillis() {
void OSystem_NULL::delayMillis(uint msecs) {
}
-#define DEFAULT_CONFIG_FILE "scummvm.ini"
+void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
-Common::SeekableReadStream *OSystem_NULL::createConfigReadStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createReadStream();
-}
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
-Common::WriteStream *OSystem_NULL::createConfigWriteStream() {
- Common::FSNode file(DEFAULT_CONFIG_FILE);
- return file.createWriteStream();
+ fputs(message, output);
+ fflush(output);
}
OSystem *OSystem_NULL_create() {
diff --git a/backends/platform/openpandora/build/config-alleng.sh b/backends/platform/openpandora/build/config-alleng.sh
index f3fa1a0f94..4028f5f4de 100755
--- a/backends/platform/openpandora/build/config-alleng.sh
+++ b/backends/platform/openpandora/build/config-alleng.sh
@@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
diff --git a/backends/platform/openpandora/build/config.sh b/backends/platform/openpandora/build/config.sh
index 9bc52a9bc4..92476c5525 100755
--- a/backends/platform/openpandora/build/config.sh
+++ b/backends/platform/openpandora/build/config.sh
@@ -19,7 +19,6 @@ export DEFINES=-DNDEBUG
cd ../../../..
./configure --backend=openpandora --host=openpandora --disable-nasm \
--with-sdl-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/bin \
- --with-mpeg2-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--disable-vorbis --enable-tremor --with-tremor-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-zlib --with-zlib-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
--enable-mad --with-mad-prefix=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr \
diff --git a/backends/platform/openpandora/module.mk b/backends/platform/openpandora/module.mk
index 8e60b87aa6..5bd568e1c4 100755
--- a/backends/platform/openpandora/module.mk
+++ b/backends/platform/openpandora/module.mk
@@ -5,11 +5,10 @@ MODULE_OBJS := \
op-backend.o \
op-main.o
-MODULE_DIRS += \
- backends/platform/openpandora/
-
-# We don't use the rules.mk here on purpose
-OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS)
+# 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/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/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
index 48dcebc1d4..1e2510d3f4 100644
--- a/backends/platform/ps2/Makefile.gdb
+++ b/backends/platform/ps2/Makefile.gdb
@@ -1,7 +1,7 @@
# $Header: Exp $
include $(PS2SDK)/Defs.make
-PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports
+PS2_EXTRA = /works/devel/ps2/sdk-extra
PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
@@ -9,31 +9,44 @@ ENABLED=STATIC_PLUGIN
ENABLE_SCUMM = $(ENABLED)
ENABLE_SCUMM_7_8 = $(ENABLED)
-#ENABLE_HE = $(ENABLED)
-#ENABLE_AGI = $(ENABLED)
-#ENABLE_AGOS = $(ENABLED)
-#ENABLE_CINE = $(ENABLED)
-#ENABLE_CRUISE = $(ENABLED)
-#ENABLE_DRASCULA = $(ENABLED)
-#ENABLE_GOB = $(ENABLED)
-#ENABLE_KYRA = $(ENABLED)
-#ENABLE_LURE = $(ENABLED)
- # ENABLE_M4 = $(ENABLED)
-#ENABLE_MADE = $(ENABLED)
-#ENABLE_PARALLACTION = $(ENABLED)
-#ENABLE_QUEEN = $(ENABLED)
-#ENABLE_SAGA = $(ENABLED)
-#ENABLE_SAGA2 = $(ENABLED)
-#ENABLE_IHNM = $(ENABLED)
-#ENABLE_SKY = $(ENABLED)
-#ENABLE_SWORD1 = $(ENABLED)
-#ENABLE_SWORD2 = $(ENABLED)
- # ENABLE_TINSEL = $(ENABLED)
-#ENABLE_TOUCHE = $(ENABLED)
+# ENABLE_HE = $(ENABLED)
+# ENABLE_AGI = $(ENABLED)
+# ENABLE_AGOS = $(ENABLED)
+# ENABLE_AGOS2 = $(ENABLED)
+# ENABLE_CINE = $(ENABLED)
+# ENABLE_CRUISE = $(ENABLED)
+# ENABLE_DRACI = $(ENABLED)
+# ENABLE_DRASCULA = $(ENABLED)
+# ENABLE_GOB = $(ENABLED)
+# ENABLE_GROOVIE = $(ENABLED)
+## ENABLE_GROOVIE2 = $(ENABLED)
+# ENABLE_HUGO = $(ENABLED)
+# ENABLE_IHNM = $(ENABLED)
+# ENABLE_KYRA = $(ENABLED)
+## ENABLE_LOL = $(ENABLED)
+# ENABLE_LURE = $(ENABLED)
+## ENABLE_M4 = $(ENABLED)
+# ENABLE_MADE = $(ENABLED)
+# ENABLE_MOHAWK = $(ENABLED)
+# ENABLE_PARALLACTION = $(ENABLED)
+# ENABLE_QUEEN = $(ENABLED)
+# ENABLE_SAGA = $(ENABLED)
+# ENABLE_SAGA2 = $(ENABLED)
+# ENABLE_SCI = $(ENABLED)
+## ENABLE_SCI32 = $(ENABLED)
+# ENABLE_SKY = $(ENABLED)
+# ENABLE_SWORD1 = $(ENABLED)
+# ENABLE_SWORD2 = $(ENABLED)
+# ENABLE_TEENAGENT = $(ENABLED)
+# ENABLE_TINSEL = $(ENABLED)
+# ENABLE_TOON = $(ENABLED)
+# ENABLE_TOUCHE = $(ENABLED)
+# ENABLE_TUCKER = $(ENABLED)
+
HAVE_GCC3 = true
-CC = ee-gcc
+CC = ee-gcc
CXX = ee-g++
AS = ee-gcc
LD = ee-gcc
@@ -48,35 +61,36 @@ VPATH = $(srcdir)
INCDIR = ../../../
# DEPDIR = .deps
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar
-
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
+# for release builds:
+#DEFINES += -DRELEASE_BUILD
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
+
TARGET = elf/scummvm.elf
-OBJS := backends/platform/ps2/DmaPipe.o \
- backends/platform/ps2/Gs2dScreen.o \
- backends/platform/ps2/irxboot.o \
- backends/platform/ps2/ps2input.o \
- backends/platform/ps2/ps2pad.o \
- backends/platform/ps2/savefilemgr.o \
- backends/platform/ps2/fileio.o \
- backends/platform/ps2/asyncfio.o \
- backends/platform/ps2/icon.o \
- backends/platform/ps2/cd.o \
- backends/platform/ps2/eecodyvdfs.o \
- backends/platform/ps2/rpckbd.o \
- backends/platform/ps2/systemps2.o \
- backends/platform/ps2/ps2mutex.o \
- backends/platform/ps2/ps2time.o \
- backends/platform/ps2/ps2debug.o
+OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
+ $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+ $(srcdir)/backends/platform/ps2/irxboot.o \
+ $(srcdir)/backends/platform/ps2/ps2input.o \
+ $(srcdir)/backends/platform/ps2/ps2pad.o \
+ $(srcdir)/backends/platform/ps2/savefilemgr.o \
+ $(srcdir)/backends/platform/ps2/fileio.o \
+ $(srcdir)/backends/platform/ps2/asyncfio.o \
+ $(srcdir)/backends/platform/ps2/icon.o \
+ $(srcdir)/backends/platform/ps2/cd.o \
+ $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+ $(srcdir)/backends/platform/ps2/rpckbd.o \
+ $(srcdir)/backends/platform/ps2/systemps2.o \
+ $(srcdir)/backends/platform/ps2/ps2mutex.o \
+ $(srcdir)/backends/platform/ps2/ps2time.o \
+ $(srcdir)/backends/platform/ps2/ps2debug.o
MODULE_DIRS += .
-BACKEND := ps2
-
include $(srcdir)/Makefile.common
LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 472ba5ec3a..77cc735c5f 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -12,28 +12,41 @@ ENABLE_SCUMM_7_8 = $(ENABLED)
ENABLE_HE = $(ENABLED)
ENABLE_AGI = $(ENABLED)
ENABLE_AGOS = $(ENABLED)
+ENABLE_AGOS2 = $(ENABLED)
ENABLE_CINE = $(ENABLED)
ENABLE_CRUISE = $(ENABLED)
+ENABLE_DRACI = $(ENABLED)
ENABLE_DRASCULA = $(ENABLED)
ENABLE_GOB = $(ENABLED)
+ENABLE_GROOVIE = $(ENABLED)
+# ENABLE_GROOVIE2 = $(ENABLED)
+ENABLE_HUGO = $(ENABLED)
+ENABLE_IHNM = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
+# ENABLE_LOL = $(ENABLED)
ENABLE_LURE = $(ENABLED)
# ENABLE_M4 = $(ENABLED)
ENABLE_MADE = $(ENABLED)
+ENABLE_MOHAWK = $(ENABLED)
ENABLE_PARALLACTION = $(ENABLED)
ENABLE_QUEEN = $(ENABLED)
ENABLE_SAGA = $(ENABLED)
-ENABLE_SAGA2 = $(ENABLED)
-ENABLE_IHNM = $(ENABLED)
+# ENABLE_SAGA2 = $(ENABLED)
+ENABLE_SCI = $(ENABLED)
+# ENABLE_SCI32 = $(ENABLED)
ENABLE_SKY = $(ENABLED)
ENABLE_SWORD1 = $(ENABLED)
ENABLE_SWORD2 = $(ENABLED)
-# ENABLE_TINSEL = $(ENABLED)
+ENABLE_TEENAGENT = $(ENABLED)
+ENABLE_TINSEL = $(ENABLED)
+ENABLE_TOON = $(ENABLED)
ENABLE_TOUCHE = $(ENABLED)
+ENABLE_TUCKER = $(ENABLED)
+
HAVE_GCC3 = true
-CC = ee-gcc
+CC = ee-gcc
CXX = ee-g++
AS = ee-gcc
LD = ee-gcc
@@ -48,30 +61,33 @@ VPATH = $(srcdir)
INCDIR = ../../../
# DEPDIR = .deps
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
-
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
+# for release builds:
+#DEFINES += -DRELEASE_BUILD
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
+
TARGET = elf/scummvm.elf
-OBJS := backends/platform/ps2/DmaPipe.o \
- backends/platform/ps2/Gs2dScreen.o \
- backends/platform/ps2/irxboot.o \
- backends/platform/ps2/ps2input.o \
- backends/platform/ps2/ps2pad.o \
- backends/platform/ps2/savefilemgr.o \
- backends/platform/ps2/fileio.o \
- backends/platform/ps2/asyncfio.o \
- backends/platform/ps2/icon.o \
- backends/platform/ps2/cd.o \
- backends/platform/ps2/eecodyvdfs.o \
- backends/platform/ps2/rpckbd.o \
- backends/platform/ps2/systemps2.o \
- backends/platform/ps2/ps2mutex.o \
- backends/platform/ps2/ps2time.o \
- backends/platform/ps2/ps2debug.o
+OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
+ $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+ $(srcdir)/backends/platform/ps2/irxboot.o \
+ $(srcdir)/backends/platform/ps2/ps2input.o \
+ $(srcdir)/backends/platform/ps2/ps2pad.o \
+ $(srcdir)/backends/platform/ps2/savefilemgr.o \
+ $(srcdir)/backends/platform/ps2/fileio.o \
+ $(srcdir)/backends/platform/ps2/asyncfio.o \
+ $(srcdir)/backends/platform/ps2/icon.o \
+ $(srcdir)/backends/platform/ps2/cd.o \
+ $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+ $(srcdir)/backends/platform/ps2/rpckbd.o \
+ $(srcdir)/backends/platform/ps2/systemps2.o \
+ $(srcdir)/backends/platform/ps2/ps2mutex.o \
+ $(srcdir)/backends/platform/ps2/ps2time.o \
+ $(srcdir)/backends/platform/ps2/ps2debug.o
MODULE_DIRS += .
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..8c8180d04e 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -20,8 +20,7 @@
*
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <pspuser.h>
#include <pspgu.h>
@@ -89,9 +88,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 +99,7 @@ void OSystem_PSP::initBackend() {
setupMixer();
- OSystem::initBackend();
+ EventsBaseBackend::initBackend();
}
// Let's us know an engine
@@ -110,13 +109,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 +204,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 +421,15 @@ void OSystem_PSP::quit() {
}
void OSystem_PSP::logMessage(LogMessageType::Type type, const char *message) {
- BaseBackend::logMessage(type, message);
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
if (type == LogMessageType::kError)
PspDebugTrace(false, "%s", message); // write to file
@@ -438,14 +446,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/samsungtv/main.cpp b/backends/platform/samsungtv/main.cpp
index 4f3291613d..8274bb00a2 100644
--- a/backends/platform/samsungtv/main.cpp
+++ b/backends/platform/samsungtv/main.cpp
@@ -22,12 +22,14 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+#include "common/scummsys.h"
+
+#if defined(SAMSUNGTV)
+
#include "backends/platform/samsungtv/samsungtv.h"
#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
-#if defined(SAMSUNGTV)
-
#include <unistd.h>
extern "C" int Game_Main(char *path, char *) {
diff --git a/backends/platform/samsungtv/module.mk b/backends/platform/samsungtv/module.mk
index 36ad75da6d..cba09db74c 100644
--- a/backends/platform/samsungtv/module.mk
+++ b/backends/platform/samsungtv/module.mk
@@ -8,3 +8,6 @@ MODULE_OBJS := \
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/samsungtv/samsungtv.cpp b/backends/platform/samsungtv/samsungtv.cpp
index cb657a0a22..9718eed1fe 100644
--- a/backends/platform/samsungtv/samsungtv.cpp
+++ b/backends/platform/samsungtv/samsungtv.cpp
@@ -20,15 +20,18 @@
*
*/
+#include "common/scummsys.h"
+
+#if defined(SAMSUNGTV)
+
#include "backends/platform/samsungtv/samsungtv.h"
#include "backends/events/samsungtvsdl/samsungtvsdl-events.h"
#include "backends/graphics/samsungtvsdl/samsungtvsdl-graphics.h"
-
-#if defined(SAMSUNGTV)
+#include "common/textconsole.h"
OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV()
:
- OSystem_POSIX("/mtd_rwarea/scummvm/.scummvmrc") {
+ OSystem_POSIX("/mtd_rwarea/.scummvmrc") {
}
void OSystem_SDL_SamsungTV::initBackend() {
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/main.cpp b/backends/platform/sdl/main.cpp
index a0a64e1155..1992bdd3f2 100644
--- a/backends/platform/sdl/main.cpp
+++ b/backends/platform/sdl/main.cpp
@@ -24,7 +24,7 @@
// Several SDL based ports use a custom main, and hence do not want to compile
// of this file. The following "#if" ensures that.
-#if !defined(UNIX) && \
+#if !defined(POSIX) && \
!defined(WIN32) && \
!defined(__MAEMO__) && \
!defined(__SYMBIAN32__) && \
diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk
index 87a0e3d658..efc5168d5b 100644
--- a/backends/platform/sdl/module.mk
+++ b/backends/platform/sdl/module.mk
@@ -5,7 +5,7 @@ MODULE_OBJS := \
main.o \
sdl.o
-ifdef UNIX
+ifdef POSIX
MODULE_OBJS += \
posix/posix-main.o \
posix/posix.o
diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/posix/posix-main.cpp
index ffc28b354c..f78e001398 100644
--- a/backends/platform/sdl/posix/posix-main.cpp
+++ b/backends/platform/sdl/posix/posix-main.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#if defined(UNIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA)
+#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA)
#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 4dd0039c1e..d757186134 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -22,11 +22,13 @@
#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"
-#ifdef UNIX
+#ifdef POSIX
#include "backends/platform/sdl/posix/posix.h"
#include "backends/saves/posix/posix-saves.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,10 +62,16 @@ 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];
- // On UNIX type systems, by default we store the config file inside
+ // On POSIX type systems, by default we store the config file inside
// to the HOME directory of the user.
const char *home = getenv("HOME");
if (home != NULL && strlen(home) < 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..e36878db07 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;
@@ -288,10 +275,22 @@ void OSystem_SDL::fatalError() {
void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
- ModularBackend::logMessage(type, message);
+ // First log to stdout/stderr
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+
+ // Then log into file (via the logger)
if (_logger)
_logger->print(message);
+ // Finally, some Windows / WinCE specific logging code.
#if defined( USE_WINDBG )
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
@@ -314,7 +313,7 @@ void OSystem_SDL::logMessage(LogMessageType::Type type, const char *message) {
}
Common::String OSystem_SDL::getSystemLanguage() const {
-#ifdef USE_DETECTLANG
+#if defined(USE_DETECTLANG) && !defined(_WIN32_WCE)
#ifdef WIN32
// We can not use "setlocale" (at least not for MSVC builds), since it
// will return locales like: "English_USA.1252", thus we need a special
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/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
index cb1c508fa1..82c15ec3db 100644
--- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
+++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
@@ -104,9 +104,6 @@
#$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "$SdlBase\\S90";
#$SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "$SdlBase\\UIQ2"
#$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "$SdlBase\\UIQ3";
-
- ## HardlySupported(TM) :P
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "$DevBase\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -145,7 +142,6 @@
# $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S60";
# $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S80";
# $SDK_LibraryDirs{'S90'}{'esdl.lib'} = "C:\\S\\ESDL\\epoc\\S90";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -183,7 +179,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -221,7 +216,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
@@ -259,7 +253,6 @@
$SDK_LibraryDirs{'S90'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S90";
$SDK_LibraryDirs{'S60v3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60\\S60V3";
$SDK_LibraryDirs{'UIQ3'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ\\UIQ3";
- #$SDK_LibraryDirs{'ALL'}{'libmpeg2.lib'} = "C:\\S\\mpeg2dec-0.4.0\\epoc";
}
# now you can add $VariationSets only built on this PC below this line :)
diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README
index 140f442fb6..1f49c52f02 100644
--- a/backends/platform/symbian/README
+++ b/backends/platform/symbian/README
@@ -114,9 +114,6 @@ Building ScummVM
- flac, the Free Lossless Audio Codec
http://flac.sourceforge.net/
- - libmpeg2, a free MPEG-2 video stream decoder
- http://libmpeg2.sourceforge.net
-
Compiling ScummVM
-----------------
diff --git a/backends/platform/symbian/src/portdefs.h b/backends/platform/symbian/src/portdefs.h
index ebcd273659..86460e65c5 100644
--- a/backends/platform/symbian/src/portdefs.h
+++ b/backends/platform/symbian/src/portdefs.h
@@ -18,8 +18,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
#ifndef SYMBIAN_PORTDEFS_H
#define SYMBIAN_PORTDEFS_H
+
#include <assert.h>
#include <stdarg.h>
#include <string.h>
@@ -37,6 +39,26 @@
#define M_PI 3.14159265358979323846
#endif /* M_PI */
+
+// Enable Symbians own datatypes
+// This is done for two reasons
+// a) uint is already defined by Symbians libc component
+// b) Symbian is using its "own" datatyping, and the Scummvm port
+// should follow this to ensure the best compability possible.
+typedef unsigned char byte;
+typedef unsigned char uint8;
+typedef signed char int8;
+typedef unsigned short int uint16;
+typedef signed short int int16;
+typedef unsigned long int uint32;
+typedef signed long int int32;
+
+// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
+// re-define those data types.
+#define SCUMMVM_DONT_DEFINE_TYPES
+
+#define SMALL_SCREEN_DEVICE
+
#define DISABLE_COMMAND_LINE
#if defined(USE_TREMOR) && !defined(USE_VORBIS)
diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp
index ffabc5ae97..8c12ad9b81 100644
--- a/backends/platform/wii/options.cpp
+++ b/backends/platform/wii/options.cpp
@@ -175,15 +175,15 @@ void WiiOptionsDialog::handleTickle() {
break;
case -EBUSY:
- label = _("Initialising network");
+ label = _("Initializing network");
break;
case -ETIMEDOUT:
- label = _("Timeout while initialising network");
+ label = _("Timeout while initializing network");
break;
default:
- label = String::format(_("Network not initialised (%d)"), status);
+ label = String::format(_("Network not initialized (%d)"), status);
break;
}
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 401b19b0e1..258a782cc4 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -19,11 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// Allow use of stuff in <time.h>
-#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
-
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <unistd.h>
@@ -34,6 +30,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 +94,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 +133,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 +165,7 @@ void OSystem_Wii::engineDone() {
bool OSystem_Wii::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) ||
- (f == kFeatureCursorHasPalette) ||
+ (f == kFeatureCursorPalette) ||
(f == kFeatureOverlaySupportsAlpha);
}
@@ -188,6 +178,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 +196,8 @@ bool OSystem_Wii::getFeatureState(Feature f) {
return _fullscreen;
case kFeatureAspectRatioCorrection:
return _arCorrection;
+ case kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
@@ -252,21 +251,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();
}
@@ -298,6 +287,18 @@ void OSystem_Wii::showOptionsDialog() {
_padAcceleration = 9 - ConfMan.getInt("wii_pad_acceleration");
}
+void OSystem_Wii::logMessage(LogMessageType::Type type, const char *message) {
+ FILE *output = 0;
+
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(message, output);
+ fflush(output);
+}
+
#ifndef GAMECUBE
Common::String OSystem_Wii::getSystemLanguage() const {
const char *wiiCountries[] = {
@@ -368,7 +369,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..64197f913a 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,12 +207,12 @@ 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;
+ virtual void logMessage(LogMessageType::Type type, const char *message);
+
#ifndef GAMECUBE
virtual Common::String getSystemLanguage() const;
#endif // GAMECUBE
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/Makefile b/backends/platform/wince/Makefile
index a9741f396f..7f8d45b3de 100644
--- a/backends/platform/wince/Makefile
+++ b/backends/platform/wince/Makefile
@@ -47,7 +47,6 @@ ENABLE_MADE = STATIC_PLUGIN
## Pick which libraries you want to use here
USE_MAD = 1
-#USE_MPEG2 = 1
#USE_TREMOR = 1
USE_TREMOLO = 1
#USE_FLAC = 1
@@ -133,11 +132,6 @@ DEFINES += -DUSE_MAD
LIBS += -lmad
endif
-ifdef USE_MPEG2
-DEFINES += -DUSE_MPEG2
-LIBS += -lmpeg2
-endif
-
ifdef USE_TREMOR
DEFINES += -DUSE_TREMOR -DUSE_VORBIS
LIBS += -ltremorce
diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt
index 69abd66e69..c48d9ca998 100644
--- a/backends/platform/wince/README-WinCE.txt
+++ b/backends/platform/wince/README-WinCE.txt
@@ -1,15 +1,49 @@
ScummVM Windows CE FAQ
-Last updated: $Date$
-Release version: 1.1.0
+Last updated: 2011-05-27
+Release version: 1.3.0
------------------------------------------------------------------------
New in this version
-------------------
-1.1.1
+1.3.0:
+This is the first official Windows CE release since 1.1.1.
+
+The following new engines are now included (changes since last WinCE release):
+ - Draci Engine (Dragon History)
+ - Hugo Engine (Hugo Trilogy)
+ - Mohawk Engine (Myst, Riven, Living Book games & Where in Time is Carmen
+ Sandiego?)
+ - SCI Engine (Sierra SCI games, see main README for a list of supported games)
+ - Toon Engine (Toonstruck)
+
+Also, there are now 4 binaries in this distribution, a single executable
+which contains all engines (for devices with enough memory) and 3 smaller
+binaries which contain only some of the engines. The following lists all
+executables and the engines they contain:
+
+scummvm.exe:
+ - all supported engines
+scummvm1.exe:
+ - scumm, agi, cruise, draci, lure, queen, sky, sword1, tinsel, touche
+scummvm2.exe:
+ - agos, cine, drascula, gob, groovie, kyra, made, parallaction, saga,
+ teenagent, tucker
+scummvm3.exe:
+ - hugo, mohawk, sci, sword2, toon
+
+There are no other port specific changes.
+
+1.2.1:
+(Note: No official 1.2.1 release)
+
+1.2.0:
+(Note: No official 1.2.0 release)
+
+1.1.1:
Fix to the Normal2xAspect scaler that was causing crashes.
-1.1.0
+1.1.0:
The TeenAgent engine is now included, but there are no other port specific
changes since 1.0.0.
diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h
index 64aa80abf2..93df6cd39e 100644
--- a/backends/platform/wince/portdefs.h
+++ b/backends/platform/wince/portdefs.h
@@ -20,40 +20,47 @@
*
*/
-// Missing string/stdlib/assert declarations for WinCE 2.xx
+#ifndef WINCE_PORTDEFS_H
+#define WINCE_PORTDEFS_H
+
+#ifndef _WIN32_WCE
+#error For use on WinCE only
+#endif
+// Missing string/stdlib/assert declarations for WinCE 2.xx
#if _WIN32_WCE < 300
-void *calloc(size_t n, size_t s);
-int isalnum(int c);
-int isdigit(int c);
-int isprint(int c);
-int isspace(int c);
-char *strrchr(const char *s, int c);
-char *strdup(const char *s);
-void assert(void *expression);
-void assert(int expression);
-long int strtol(const char *nptr, char **endptr, int base);
-char *_strdup(const char *s);
-char *strpbrk(const char *s, const char *accept);
+ #define SMALL_SCREEN_DEVICE
+
+ void *calloc(size_t n, size_t s);
+ int isalnum(int c);
+ int isdigit(int c);
+ int isprint(int c);
+ int isspace(int c);
+ char *strrchr(const char *s, int c);
+ char *strdup(const char *s);
+ void assert(void *expression);
+ void assert(int expression);
+ long int strtol(const char *nptr, char **endptr, int base);
+ char *_strdup(const char *s);
+ char *strpbrk(const char *s, const char *accept);
#endif
-#ifdef _WIN32_WCE
#ifndef __GNUC__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
-char *getcwd(char *buf, int size);
-typedef int ptrdiff_t;
-void GetCurrentDirectory(int len, char *buf);
-#define INVALID_FILE_ATTRIBUTES 0xffffffff
+ void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+ char *getcwd(char *buf, int size);
+ typedef int ptrdiff_t;
+ void GetCurrentDirectory(int len, char *buf);
+ #define INVALID_FILE_ATTRIBUTES 0xffffffff
#else
-#include <math.h>
-#undef GetCurrentDirectory
-extern "C" void GetCurrentDirectory(int len, char *buf);
-#define snprintf _snprintf
-#define strdup _strdup
-#define fopen wce_fopen
+ #include <math.h>
+ #undef GetCurrentDirectory
+ extern "C" void GetCurrentDirectory(int len, char *buf);
+ #define snprintf _snprintf
+ #define strdup _strdup
+ #define fopen wce_fopen
#endif
#include <windows.h>
@@ -68,7 +75,7 @@ extern "C" void GetCurrentDirectory(int len, char *buf);
//#include <direct.h>
#ifdef __MINGW32CE__
-void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
+ void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
#endif
int remove(const char *path);
int _access(const char *path, int mode);
@@ -77,4 +84,5 @@ void drawError(char *);
#define vsnprintf _vsnprintf
+
#endif
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index a53bc41667..54fa71cfd2 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();
}
@@ -576,6 +578,73 @@ void OSystem_WINCE3::getTimeAndDate(TimeDate &t) const {
t.tm_sec = systime.wSecond;
}
+Common::String OSystem_WINCE3::getSystemLanguage() const {
+#ifdef USE_DETECTLANG
+ // We can not use "setlocale" (at least not for MSVC builds), since it
+ // will return locales like: "English_USA.1252", thus we need a special
+ // way to determine the locale string for Win32.
+ char langName[9];
+ char ctryName[9];
+ TCHAR langNameW[32];
+ TCHAR ctryNameW[32];
+ int i = 0;
+ bool localeFound = false;
+ Common::String localeName;
+
+ // Really not nice, but the only way to map Windows CE language/country codes to posix NLS names,
+ // because Windows CE doesn't support LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME,
+ // according to this: http://msdn.microsoft.com/en-us/library/aa912934.aspx
+ //
+ // See http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx for a translation table
+ // This table has to be updated manually when new translations are added
+ const char *posixMappingTable[][3] = {
+ {"CAT", "ESP", "ca_ES"},
+ {"CSY", "CZE", "cs_CZ"},
+ {"DAN", "DNK", "da_DA"},
+ {"DEU", "DEU", "de_DE"},
+ {"ESN", "ESP", "es_ES"},
+ {"ESP", "ESP", "es_ES"},
+ {"FRA", "FRA", "fr_FR"},
+ {"HUN", "HUN", "hu_HU"},
+ {"ITA", "ITA", "it_IT"},
+ {"NOR", "NOR", "nb_NO"},
+ {"NON", "NOR", "nn_NO"},
+ {"PLK", "POL", "pl_PL"},
+ {"PTB", "BRA", "pt_BR"},
+ {"RUS", "RUS", "ru_RU"},
+ {"SVE", "SWE", "se_SE"},
+ {"UKR", "UKR", "uk_UA"},
+ {NULL, NULL, NULL}
+ };
+
+ if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, langNameW, sizeof(langNameW)) != 0 &&
+ GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) {
+ WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL);
+
+ debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName);
+ while (posixMappingTable[i][0] && !localeFound) {
+ if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) &&
+ (!strcmp(posixMappingTable[i][1], ctryName) || !strcmp(posixMappingTable[i][0], "*")) ) {
+ localeFound = true;
+ localeName = posixMappingTable[i][2];
+ }
+ i++;
+ }
+ if (!localeFound) warning("No posix locale name found for %s_%s", langName, ctryName);
+ }
+
+ if (localeFound) {
+ debug(1, "Found posix locale name: %s", localeName.c_str());
+ return localeName;
+ } else {
+ return ModularBackend::getSystemLanguage();
+ }
+#else // USE_DETECTLANG
+ return ModularBackend::getSystemLanguage();
+#endif // USE_DETECTLANG
+}
+
int OSystem_WINCE3::_platformScreenWidth;
int OSystem_WINCE3::_platformScreenHeight;
bool OSystem_WINCE3::_isOzone;
diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h
index a1e46081f9..481956c19a 100644
--- a/backends/platform/wince/wince-sdl.h
+++ b/backends/platform/wince/wince-sdl.h
@@ -53,12 +53,13 @@ public:
// Overloaded from SDL backend
void quit();
+ virtual Common::String getSystemLanguage() const;
+
// Overloaded from OSystem
void engineInit();
void getTimeAndDate(TimeDate &t) const;
virtual Common::String getDefaultConfigFileName();
- virtual FilesystemFactory *getFilesystemFactory();
void swap_sound_master();
@@ -73,8 +74,6 @@ public:
protected:
void initSDL();
Audio::MixerImpl *_mixer;
- DefaultTimerManager *_timer;
- FilesystemFactory *_fsFactory;
private:
void check_mappings();