From 6a796c2bb0b2a6d46546a97c24320bdceae2c69d Mon Sep 17 00:00:00 2001 From: John Willis Date: Sat, 5 Jun 2010 18:24:28 +0000 Subject: GP2X Wiz: Update handy shell scripts. svn-id: r49441 --- backends/platform/gp2xwiz/build/build.sh | 4 ++-- backends/platform/gp2xwiz/build/bundle.sh | 6 ++++-- backends/platform/gp2xwiz/build/config.sh | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'backends') diff --git a/backends/platform/gp2xwiz/build/build.sh b/backends/platform/gp2xwiz/build/build.sh index 1bdc020f17..876c3e378a 100755 --- a/backends/platform/gp2xwiz/build/build.sh +++ b/backends/platform/gp2xwiz/build/build.sh @@ -13,7 +13,7 @@ export ASFLAGS=-mfloat-abi=soft cd ../../../.. -echo Building ScummVM for GP2X. +echo Building ScummVM for GP2X Wiz. make -echo Build for GP2X - SDL - complete - Please check build logs. +echo Build for GP2X Wiz - complete - Please check build logs. diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh index 492ba9e1c6..065bd7a685 100755 --- a/backends/platform/gp2xwiz/build/bundle.sh +++ b/backends/platform/gp2xwiz/build/bundle.sh @@ -35,10 +35,12 @@ loc=`dirname "$f"` cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 - -echo Making Stripped exe. +echo Making Stripped Binary. arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.wiz +echo Making Stripped Plugins. +arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins/* + echo Building ZIP bundle. if [ -f /usr/bin/zip ] then diff --git a/backends/platform/gp2xwiz/build/config.sh b/backends/platform/gp2xwiz/build/config.sh index 27c1fbf0bf..54c4795298 100755 --- a/backends/platform/gp2xwiz/build/config.sh +++ b/backends/platform/gp2xwiz/build/config.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo Quick script to make running configure all the time less painful echo and let all the build work be done from the backend/build folder. -- cgit v1.2.3 From 7b56f39985a62852478ccb8ad01a85e9f028097c Mon Sep 17 00:00:00 2001 From: John Willis Date: Sat, 5 Jun 2010 18:26:53 +0000 Subject: GP2X Wiz: Add missing "#include "graphics/scaler/aspect.h"". svn-id: r49442 --- backends/platform/gp2xwiz/build/clean.sh | 2 +- backends/platform/gp2xwiz/gp2xwiz-events.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/gp2xwiz/build/clean.sh b/backends/platform/gp2xwiz/build/clean.sh index 2862887bb3..5ec1b9e62c 100755 --- a/backends/platform/gp2xwiz/build/clean.sh +++ b/backends/platform/gp2xwiz/build/clean.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh echo Quick script to make building all the time less painful. diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index 2774efce1b..a69aa42967 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -30,6 +30,7 @@ #include "backends/platform/gp2xwiz/gp2xwiz-sdl.h" #include "backends/platform/gp2xwiz/gp2xwiz-hw.h" +#include "graphics/scaler/aspect.h" #include "common/util.h" #include "common/events.h" -- cgit v1.2.3 From 46155b2c3678784f6333eed1d65a35eefdcb2001 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 6 Jun 2010 09:34:36 +0000 Subject: Add Android backend from patch #2603856 svn-id: r49449 --- backends/platform/android/README.build | 84 ++ backends/platform/android/android.cpp | 1413 ++++++++++++++++++++ backends/platform/android/android.mk | 52 + backends/platform/android/asset-archive.cpp | 414 ++++++ backends/platform/android/asset-archive.h | 53 + backends/platform/android/module.mk | 85 ++ .../inodes/gus/scummvm/EditableSurfaceView.java | 59 + .../android/org/inodes/gus/scummvm/Event.java | 330 +++++ .../org/inodes/gus/scummvm/PluginProvider.java | 52 + .../android/org/inodes/gus/scummvm/ScummVM.java | 317 +++++ .../org/inodes/gus/scummvm/ScummVMActivity.java | 446 ++++++ .../org/inodes/gus/scummvm/ScummVMApplication.java | 29 + .../android/org/inodes/gus/scummvm/Unpacker.java | 370 +++++ .../android/scummvm-android-themeengine.patch | 135 ++ 14 files changed, 3839 insertions(+) create mode 100644 backends/platform/android/README.build create mode 100644 backends/platform/android/android.cpp create mode 100644 backends/platform/android/android.mk create mode 100644 backends/platform/android/asset-archive.cpp create mode 100644 backends/platform/android/asset-archive.h create mode 100644 backends/platform/android/module.mk create mode 100644 backends/platform/android/org/inodes/gus/scummvm/EditableSurfaceView.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/Event.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/ScummVM.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java create mode 100644 backends/platform/android/org/inodes/gus/scummvm/Unpacker.java create mode 100644 backends/platform/android/scummvm-android-themeengine.patch (limited to 'backends') diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build new file mode 100644 index 0000000000..fa56bfc180 --- /dev/null +++ b/backends/platform/android/README.build @@ -0,0 +1,84 @@ +Building the ScummVM Android port +================================= + +You will need these things to build: +1. Android EGL headers and library +2. Android SDK +3. An arm-android-eabi GCC toolchain + +In the example commands, we are going to build against the Android 1.5 +native ABI (but using the Android 1.6 SDK tools). Other version +combinations might/should be possible with a bit of tweaking. + +In detail: + +1. Android EGL headers and library + +You can build these from the full Android source, but it is far easier +to just download the 3 Android EGL headers from here: + http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=opengl/include/EGL;hb=HEAD + (copy them to a directory called "EGL" somewhere) + +... and grab libEGL.so off an existing phone/emulator: + adb pull /system/lib/libEGL.so /tmp + +2. Android SDK + +Download and install somewhere. + +3. arm-android-eabi GCC toolchain + +You have several choices for toolchains: + +- Use Google arm-eabi prebuilt toolchain. + +This is shipped with both the Android source release and Android NDK. +The problem is that "arm-eabi-gcc" can't actually link anything +successfully without extra command line flags. To use this with the +ScummVM configure/build environment you will need to create a family +of shell wrapper scripts that convert "arm-android-eabi-foo" to +"arm-eabi-foo -mandroid". + +For example, I use this script: + #!/bin/sh + exec arm-eabi-${0##*-} -mandroid -DANDROID "$@" + +... and create a family of symlinks/hardlinks pointing to it called +arm-android-eabi-gcc, arm-android-eabi-g++, etc. For tools that don't +take a "-mandroid" argument - like arm-eabi-strip - I bypass the shell +wrapper and just create an arm-android-eabi-strip symlink to the tool +directly. + +- Build your own arm-android-eabi toolchain from GCC source. + +This is lots of fun. I suggest my Android openembedded patches, see: + http://wiki.github.com/anguslees/openembedded-android/ +(You just need to have lots of disk space and type a few commands) +If you get stuck, ask + +Alternatively, do a websearch - there are several other cross-compile +toolchains around. + + +Building ScummVM +================ + + export ANDROID_SDK= + + PATH=$ANDROID_SDK/platforms/android-1.6/tools:$ANDROID_SDK/tools:$PATH + # You also want to ensure your arm-android-eabi toolchain is in your $PATH + + export ANDROID_TOP= + + EGL_INC="-I" + EGL_LIBS="-L" + + CPPFLAGS="$EGL_INC" \ + LDFLAGS="-g $EGL_LIBS" \ + ./configure --backend=android --host=android --enable-zlib #and any other flags + make scummvm.apk + +This will build a "monolithic" ScummVM package, with the engines +statically linked in. If you want to build separate engine packages, +like on the market, add "--enable-plugins --default-dynamic" to +configure and also make scummvm-engine-scumm.apk, etc. diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp new file mode 100644 index 0000000000..76590ec823 --- /dev/null +++ b/backends/platform/android/android.cpp @@ -0,0 +1,1413 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "backends/base-backend.h" +#include "base/main.h" +#include "graphics/surface.h" + +#include "backends/platform/android/video.h" + +#if defined(ANDROID_BACKEND) + +#define ANDROID_VERSION_GE(major,minor) \ + (ANDROID_MAJOR_VERSION > (major) || \ + (ANDROID_MAJOR_VERSION == (major) && ANDROID_MINOR_VERSION >= (minor))) + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "common/archive.h" +#include "common/util.h" +#include "common/rect.h" +#include "common/queue.h" +#include "common/mutex.h" +#include "common/events.h" +#include "common/config-manager.h" + +#include "backends/fs/posix/posix-fs-factory.h" +#include "backends/keymapper/keymapper.h" +#include "backends/saves/default/default-saves.h" +#include "backends/timer/default/default-timer.h" +#include "backends/plugins/posix/posix-provider.h" +#include "sound/mixer_intern.h" + +#include "backends/platform/android/asset-archive.h" + +#undef LOG_TAG +#define LOG_TAG "ScummVM" + +#if 0 +#define ENTER(args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, args) +#else +#define ENTER(args...) /**/ +#endif + +// Fix JNIEXPORT declaration to actually do something useful +#undef JNIEXPORT +#define JNIEXPORT __attribute__ ((visibility("default"))) + +static JavaVM *cached_jvm; +static jfieldID FID_Event_type; +static jfieldID FID_Event_synthetic; +static jfieldID FID_Event_kbd_keycode; +static jfieldID FID_Event_kbd_ascii; +static jfieldID FID_Event_kbd_flags; +static jfieldID FID_Event_mouse_x; +static jfieldID FID_Event_mouse_y; +static jfieldID FID_Event_mouse_relative; +static jfieldID FID_ScummVM_nativeScummVM; +static jmethodID MID_Object_wait; + +JNIEnv* JNU_GetEnv() { + JNIEnv* env; + bool version_unsupported = + cached_jvm->GetEnv((void**)&env, JNI_VERSION_1_2); + assert(! version_unsupported); + return env; +} + +static void JNU_ThrowByName(JNIEnv* env, const char* name, const char* msg) { + jclass cls = env->FindClass(name); + // if cls is NULL, an exception has already been thrown + if (cls != NULL) + env->ThrowNew(cls, msg); + env->DeleteLocalRef(cls); +} + +// floating point. use sparingly. +template +static inline T scalef(T in, float numerator, float denominator) { + return static_cast(in) * numerator / denominator; +} + +static inline GLfixed xdiv(int numerator, int denominator) { + assert(numerator < (1<<16)); + return (numerator << 16) / denominator; +} + +#ifdef DYNAMIC_MODULES +class AndroidPluginProvider : public POSIXPluginProvider { +protected: + virtual void addCustomDirectories(Common::FSList &dirs) const; +}; +#endif + + +#if 0 +#define CHECK_GL_ERROR() checkGlError(__FILE__, __LINE__) +static const char* getGlErrStr(GLenum error) { + switch (error) { + case GL_NO_ERROR: return "GL_NO_ERROR"; + case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; + case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; + case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW"; + case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; + case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; + } + + static char buf[40]; + snprintf(buf, sizeof(buf), "(Unknown GL error code 0x%x)", error); + return buf; +} +static void checkGlError(const char* file, int line) { + GLenum error = glGetError(); + if (error != GL_NO_ERROR) + warning("%s:%d: GL error: %s", file, line, getGlErrStr(error)); +} +#else +#define CHECK_GL_ERROR() do {} while (false) +#endif + +class OSystem_Android : public BaseBackend { +private: + jobject _back_ptr; // back pointer to (java) peer instance + jmethodID MID_displayMessageOnOSD; + jmethodID MID_setWindowCaption; + jmethodID MID_initBackend; + jmethodID MID_audioSampleRate; + jmethodID MID_showVirtualKeyboard; + jmethodID MID_getSysArchives; + jmethodID MID_getPluginDirectories; + jmethodID MID_setupScummVMSurface; + jmethodID MID_destroyScummVMSurface; + + int _screen_changeid; + EGLDisplay _egl_display; + EGLSurface _egl_surface; + EGLint _egl_surface_width; + EGLint _egl_surface_height; + + bool _force_redraw; + + // Game layer + GLESPaletteTexture* _game_texture; + int _shake_offset; + bool _full_screen_dirty; + Common::Array _dirty_rects; + + // Overlay layer + GLES4444Texture* _overlay_texture; + bool _show_overlay; + + // Mouse layer + GLESPaletteATexture* _mouse_texture; + Common::Point _mouse_hotspot; + int _mouse_targetscale; + bool _show_mouse; + bool _use_mouse_palette; + + Common::Queue _event_queue; + MutexRef _event_queue_lock; + + bool _timer_thread_exit; + pthread_t _timer_thread; + static void* timerThreadFunc(void* arg); + + bool _virtkeybd_on; + + Common::SaveFileManager *_savefile; + Audio::MixerImpl *_mixer; + Common::TimerManager *_timer; + FilesystemFactory *_fsFactory; + Common::Archive *_asset_archive; + timeval _startTime; + + void setupScummVMSurface(); + void destroyScummVMSurface(); + void setupKeymapper(); + void _setCursorPalette(const byte *colors, uint start, uint num); + +public: + OSystem_Android(jobject am); + virtual ~OSystem_Android(); + bool initJavaHooks(JNIEnv* env, jobject self); + + static OSystem_Android* fromJavaObject(JNIEnv* env, jobject obj); + virtual void initBackend(); + void addPluginDirectories(Common::FSList &dirs) const; + + virtual bool hasFeature(Feature f); + virtual void setFeatureState(Feature f, bool enable); + virtual bool getFeatureState(Feature f); + virtual const GraphicsMode *getSupportedGraphicsModes() const; + virtual int getDefaultGraphicsMode() const; + bool setGraphicsMode(const char *name); + virtual bool setGraphicsMode(int mode); + virtual int getGraphicsMode() const; + virtual void initSize(uint width, uint height, + const Graphics::PixelFormat *format); + virtual int getScreenChangeID() const { return _screen_changeid; } + virtual int16 getHeight(); + virtual int16 getWidth(); + virtual void setPalette(const byte *colors, uint start, uint num); + virtual void grabPalette(byte *colors, uint start, uint num); + virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void updateScreen(); + virtual Graphics::Surface *lockScreen(); + virtual void unlockScreen(); + virtual void setShakePos(int shakeOffset); + virtual void fillScreen(uint32 col); + virtual void setFocusRectangle(const Common::Rect& rect); + virtual void clearFocusRectangle(); + + virtual void showOverlay(); + virtual void hideOverlay(); + virtual void clearOverlay(); + virtual void grabOverlay(OverlayColor *buf, int pitch); + virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual int16 getOverlayHeight(); + virtual int16 getOverlayWidth(); + virtual Graphics::PixelFormat getOverlayFormat() const { + // RGBA 4444 + Graphics::PixelFormat format; + format.bytesPerPixel = 2; + format.rLoss = 8 - 4; + format.gLoss = 8 - 4; + format.bLoss = 8 - 4; + format.aLoss = 8 - 4; + format.rShift = 3*4; + format.gShift = 2*4; + format.bShift = 1*4; + format.aShift = 0*4; + return format; + } + + virtual bool showMouse(bool visible); + + 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); + void pushEvent(const Common::Event& event); + virtual uint32 getMillis(); + virtual void delayMillis(uint msecs); + + virtual MutexRef createMutex(void); + virtual void lockMutex(MutexRef mutex); + virtual void unlockMutex(MutexRef mutex); + virtual void deleteMutex(MutexRef mutex); + + virtual void quit(); + + virtual void setWindowCaption(const char *caption); + 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 addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); +}; + +OSystem_Android::OSystem_Android(jobject am) + : _back_ptr(0), + _egl_display(EGL_NO_DISPLAY), + _egl_surface(EGL_NO_SURFACE), + _screen_changeid(0), + _force_redraw(false), + _game_texture(NULL), + _overlay_texture(NULL), + _mouse_texture(NULL), + _use_mouse_palette(false), + _show_mouse(false), + _show_overlay(false), + _savefile(0), + _mixer(0), + _timer(0), + _fsFactory(new POSIXFilesystemFactory()), + _asset_archive(new AndroidAssetArchive(am)), + _shake_offset(0), + _full_screen_dirty(false), + _event_queue_lock(createMutex()) { +} + +OSystem_Android::~OSystem_Android() { + ENTER("~OSystem_Android()"); + delete _game_texture; + delete _overlay_texture; + delete _mouse_texture; + destroyScummVMSurface(); + JNIEnv* env = JNU_GetEnv(); + //env->DeleteWeakGlobalRef(_back_ptr); + env->DeleteGlobalRef(_back_ptr); + delete _savefile; + delete _mixer; + delete _timer; + delete _fsFactory; + delete _asset_archive; + deleteMutex(_event_queue_lock); +} + +OSystem_Android* OSystem_Android::fromJavaObject(JNIEnv* env, jobject obj) { + jlong peer = env->GetLongField(obj, FID_ScummVM_nativeScummVM); + return (OSystem_Android*)peer; +} + +bool OSystem_Android::initJavaHooks(JNIEnv* env, jobject self) { + // weak global ref to allow class to be unloaded + // ... except dalvik doesn't implement NewWeakGlobalRef (yet) + //_back_ptr = env->NewWeakGlobalRef(self); + _back_ptr = env->NewGlobalRef(self); + + jclass cls = env->GetObjectClass(_back_ptr); + +#define FIND_METHOD(name, signature) do { \ + MID_ ## name = env->GetMethodID(cls, #name, signature); \ + if (MID_ ## name == NULL) \ + return false; \ + } while (0) + + FIND_METHOD(setWindowCaption, "(Ljava/lang/String;)V"); + FIND_METHOD(displayMessageOnOSD, "(Ljava/lang/String;)V"); + FIND_METHOD(initBackend, "()V"); + FIND_METHOD(audioSampleRate, "()I"); + FIND_METHOD(showVirtualKeyboard, "(Z)V"); + FIND_METHOD(getSysArchives, "()[Ljava/lang/String;"); + FIND_METHOD(getPluginDirectories, "()[Ljava/lang/String;"); + FIND_METHOD(setupScummVMSurface, "()V"); + FIND_METHOD(destroyScummVMSurface, "()V"); + +#undef FIND_METHOD + + return true; +} + +static void ScummVM_create(JNIEnv* env, jobject self, jobject am) { + OSystem_Android* cpp_obj = new OSystem_Android(am); + if (!cpp_obj->initJavaHooks(env, self)) + // Exception already thrown by initJavaHooks + return; + + env->SetLongField(self, FID_ScummVM_nativeScummVM, (jlong)cpp_obj); + +#ifdef DYNAMIC_MODULES + PluginManager::instance().addPluginProvider(new AndroidPluginProvider()); +#endif +} + +static void ScummVM_nativeDestroy(JNIEnv* env, jobject self) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + delete cpp_obj; +} + +static void ScummVM_audioMixCallback(JNIEnv* env, jobject self, + jbyteArray jbuf) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + jsize len = env->GetArrayLength(jbuf); + jbyte* buf = env->GetByteArrayElements(jbuf, NULL); + if (buf == NULL) { + warning("Unable to get Java audio byte array. Skipping."); + return; + } + Audio::MixerImpl* mixer = + static_cast(cpp_obj->getMixer()); + assert(mixer); + mixer->mixCallback(reinterpret_cast(buf), len); + env->ReleaseByteArrayElements(jbuf, buf, 0); +} + +static void ScummVM_setConfManInt(JNIEnv* env, jclass cls, + jstring key_obj, jint value) { + ENTER("setConfManInt(%p, %d)", key_obj, (int)value); + const char* key = env->GetStringUTFChars(key_obj, NULL); + if (key == NULL) + return; + ConfMan.setInt(key, value); + env->ReleaseStringUTFChars(key_obj, key); +} + +static void ScummVM_setConfManString(JNIEnv* env, jclass cls, jstring key_obj, + jstring value_obj) { + ENTER("setConfManStr(%p, %p)", key_obj, value_obj); + const char* key = env->GetStringUTFChars(key_obj, NULL); + if (key == NULL) + return; + const char* value = env->GetStringUTFChars(value_obj, NULL); + if (value == NULL) { + env->ReleaseStringUTFChars(key_obj, key); + return; + } + ConfMan.set(key, value); + env->ReleaseStringUTFChars(value_obj, value); + env->ReleaseStringUTFChars(key_obj, key); +} + +void* OSystem_Android::timerThreadFunc(void* arg) { + OSystem_Android* system = (OSystem_Android*)arg; + DefaultTimerManager* timer = (DefaultTimerManager*)(system->_timer); + + struct timespec tv; + tv.tv_sec = 0; + tv.tv_nsec = 100 * 1000 * 1000; // 100ms + + while (!system->_timer_thread_exit) { + timer->handler(); + nanosleep(&tv, NULL); + } + + return NULL; +} + +void OSystem_Android::initBackend() { + ENTER("initBackend()"); + JNIEnv* env = JNU_GetEnv(); + + ConfMan.setInt("autosave_period", 0); + ConfMan.setInt("FM_medium_quality", true); + + // must happen before creating TimerManager to avoid race in + // creating EventManager + setupKeymapper(); + + // 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(); + + gettimeofday(&_startTime, NULL); + + jint sample_rate = env->CallIntMethod(_back_ptr, MID_audioSampleRate); + if (env->ExceptionCheck()) { + warning("Error finding audio sample rate - assuming 11025HZ"); + env->ExceptionDescribe(); + env->ExceptionClear(); + sample_rate = 11025; + } + _mixer = new Audio::MixerImpl(this, sample_rate); + _mixer->setReady(true); + + env->CallVoidMethod(_back_ptr, MID_initBackend); + if (env->ExceptionCheck()) { + error("Error in Java initBackend"); + env->ExceptionDescribe(); + env->ExceptionClear(); + } + + _timer_thread_exit = false; + pthread_create(&_timer_thread, NULL, timerThreadFunc, this); + + OSystem::initBackend(); + + setupScummVMSurface(); +} + +void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const { + ENTER("OSystem_Android::addPluginDirectories()"); + JNIEnv* env = JNU_GetEnv(); + + jobjectArray array = + (jobjectArray)env->CallObjectMethod(_back_ptr, MID_getPluginDirectories); + if (env->ExceptionCheck()) { + warning("Error finding plugin directories"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return; + } + + jsize size = env->GetArrayLength(array); + for (jsize i = 0; i < size; ++i) { + jstring path_obj = (jstring)env->GetObjectArrayElement(array, i); + if (path_obj == NULL) + continue; + const char* path = env->GetStringUTFChars(path_obj, NULL); + if (path == NULL) { + warning("Error getting string characters from plugin directory"); + env->ExceptionClear(); + env->DeleteLocalRef(path_obj); + continue; + } + dirs.push_back(Common::FSNode(path)); + env->ReleaseStringUTFChars(path_obj, path); + env->DeleteLocalRef(path_obj); + } +} + +bool OSystem_Android::hasFeature(Feature f) { + return (f == kFeatureCursorHasPalette || + f == kFeatureVirtualKeyboard || + f == kFeatureOverlaySupportsAlpha); +} + +void OSystem_Android::setFeatureState(Feature f, bool enable) { + ENTER("setFeatureState(%d, %d)", f, enable); + switch (f) { + case kFeatureVirtualKeyboard: + _virtkeybd_on = enable; + showVirtualKeyboard(enable); + break; + default: + break; + } +} + +bool OSystem_Android::getFeatureState(Feature f) { + switch (f) { + case kFeatureVirtualKeyboard: + return _virtkeybd_on; + default: + return false; + } +} + +const OSystem::GraphicsMode* OSystem_Android::getSupportedGraphicsModes() const { + static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { + {"default", "Default", 1}, + {0, 0, 0}, + }; + return s_supportedGraphicsModes; +} + + +int OSystem_Android::getDefaultGraphicsMode() const { + return 1; +} + +bool OSystem_Android::setGraphicsMode(const char *mode) { + ENTER("setGraphicsMode(%s)", mode); + return true; +} + +bool OSystem_Android::setGraphicsMode(int mode) { + ENTER("setGraphicsMode(%d)", mode); + return true; +} + +int OSystem_Android::getGraphicsMode() const { + return 1; +} + +void OSystem_Android::setupScummVMSurface() { + JNIEnv* env = JNU_GetEnv(); + env->CallVoidMethod(_back_ptr, MID_setupScummVMSurface); + if (env->ExceptionCheck()) + return; + + // EGL set up with a new surface. Initialise OpenGLES context. + + _egl_display = eglGetCurrentDisplay(); + _egl_surface = eglGetCurrentSurface(EGL_DRAW); + + static bool log_version = true; + if (log_version) { + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, + "Using EGL %s (%s); GL %s/%s (%s)", + eglQueryString(_egl_display, EGL_VERSION), + eglQueryString(_egl_display, EGL_VENDOR), + glGetString(GL_VERSION), + glGetString(GL_RENDERER), + glGetString(GL_VENDOR)); + log_version = false; // only log this once + } + + GLESTexture::initGLExtensions(); + + if (!eglQuerySurface(_egl_display, _egl_surface, + EGL_WIDTH, &_egl_surface_width) || + !eglQuerySurface(_egl_display, _egl_surface, + EGL_HEIGHT, &_egl_surface_height)) { + JNU_ThrowByName(env, "java/lang/RuntimeException", + "Error fetching EGL surface width/height"); + return; + } + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, + "New surface is %dx%d", + _egl_surface_width, _egl_surface_height); + + CHECK_GL_ERROR(); + + // Turn off anything that looks like 3D ;) + glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glDisable(GL_FOG); + glDisable(GL_DITHER); + glShadeModel(GL_FLAT); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glEnable(GL_TEXTURE_2D); + + if (!_game_texture) + _game_texture = new GLESPaletteTexture(); + else + _game_texture->reinitGL(); + + if (!_overlay_texture) + _overlay_texture = new GLES4444Texture(); + else + _overlay_texture->reinitGL(); + + if (!_mouse_texture) + _mouse_texture = new GLESPaletteATexture(); + else + _mouse_texture->reinitGL(); + + glViewport(0, 0, _egl_surface_width, _egl_surface_height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrthof(0, _egl_surface_width, _egl_surface_height, 0, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + CHECK_GL_ERROR(); + + _force_redraw = true; +} + +void OSystem_Android::destroyScummVMSurface() { + _egl_surface = EGL_NO_SURFACE; + JNIEnv* env = JNU_GetEnv(); + env->CallVoidMethod(_back_ptr, MID_destroyScummVMSurface); + // Can't use OpenGLES functions after this +} + +void OSystem_Android::initSize(uint width, uint height, + const Graphics::PixelFormat *format) { + ENTER("initSize(%d,%d,%p)", width, height, format); + + _game_texture->allocBuffer(width, height); + + // Cap at 320x200 or the ScummVM themes abort :/ + GLuint overlay_width = MIN(_egl_surface_width, 320); + GLuint overlay_height = MIN(_egl_surface_height, 200); + _overlay_texture->allocBuffer(overlay_width, overlay_height); + + // Don't know mouse size yet - it gets reallocated in + // setMouseCursor. We need the palette allocated before + // setMouseCursor however, so just take a guess at the desired + // size (it's small). + _mouse_texture->allocBuffer(20, 20); +} + +int16 OSystem_Android::getHeight() { + return _game_texture->height(); +} + +int16 OSystem_Android::getWidth() { + return _game_texture->width(); +} + +void OSystem_Android::setPalette(const byte* colors, uint start, uint num) { + ENTER("setPalette(%p, %u, %u)", colors, start, num); + + if (!_use_mouse_palette) + _setCursorPalette(colors, start, num); + + byte* palette = _game_texture->palette() + start*3; + do { + for (int i = 0; i < 3; ++i) + palette[i] = colors[i]; + palette += 3; + colors += 4; + } while (--num); +} + +void OSystem_Android::grabPalette(byte *colors, uint start, uint num) { + ENTER("grabPalette(%p, %u, %u)", colors, start, num); + const byte* palette = _game_texture->palette_const() + start*3; + do { + for (int i = 0; i < 3; ++i) + colors[i] = palette[i]; + colors[3] = 0xff; // alpha + + palette += 3; + colors += 4; + } while (--num); +} + +void OSystem_Android::copyRectToScreen(const byte *buf, int pitch, + int x, int y, int w, int h) { + ENTER("copyRectToScreen(%p, %d, %d, %d, %d, %d)", + buf, pitch, x, y, w, h); + + _game_texture->updateBuffer(x, y, w, h, buf, pitch); +} + +void OSystem_Android::updateScreen() { + //ENTER("updateScreen()"); + + if (!_force_redraw && + !_game_texture->dirty() && + !_overlay_texture->dirty() && + !_mouse_texture->dirty()) + return; + + _force_redraw = false; + + glPushMatrix(); + + if (_shake_offset != 0) { + // This is the only case where _game_texture doesn't + // cover the entire screen. + glClearColorx(0, 0, 0, 1 << 16); + glClear(GL_COLOR_BUFFER_BIT); + + // Move everything up by _shake_offset (game) pixels + glTranslatex(0, -_shake_offset << 16, 0); + } + + _game_texture->drawTexture(0, 0, + _egl_surface_width, _egl_surface_height); + + CHECK_GL_ERROR(); + + if (_show_overlay) { + _overlay_texture->drawTexture(0, 0, + _egl_surface_width, + _egl_surface_height); + CHECK_GL_ERROR(); + } + + if (_show_mouse) { + glPushMatrix(); + + glTranslatex(-_mouse_hotspot.x << 16, + -_mouse_hotspot.y << 16, + 0); + + // Scale up ScummVM -> OpenGL (pixel) coordinates + int texwidth, texheight; + if (_show_overlay) { + texwidth = getOverlayWidth(); + texheight = getOverlayHeight(); + } else { + texwidth = getWidth(); + texheight = getHeight(); + } + glScalex(xdiv(_egl_surface_width, texwidth), + xdiv(_egl_surface_height, texheight), + 1 << 16); + + // Note the extra half texel to position the mouse in + // the middle of the x,y square: + const Common::Point& mouse = getEventManager()->getMousePos(); + glTranslatex((mouse.x << 16) | 1 << 15, + (mouse.y << 16) | 1 << 15, 0); + + // Mouse targetscale just seems to make the cursor way + // too big :/ + //glScalex(_mouse_targetscale << 16, _mouse_targetscale << 16, + // 1 << 16); + + _mouse_texture->drawTexture(); + + glPopMatrix(); + } + + glPopMatrix(); + + CHECK_GL_ERROR(); + + if (!eglSwapBuffers(_egl_display, _egl_surface)) { + EGLint error = eglGetError(); + warning("eglSwapBuffers exited with error 0x%x", error); + // Some errors mean we need to reinit GL + if (error == EGL_CONTEXT_LOST) { + destroyScummVMSurface(); + setupScummVMSurface(); + } + } +} + +Graphics::Surface *OSystem_Android::lockScreen() { + ENTER("lockScreen()"); + Graphics::Surface* surface = _game_texture->surface(); + assert(surface->pixels); + return surface; +} + +void OSystem_Android::unlockScreen() { + ENTER("unlockScreen()"); + assert(_game_texture->dirty()); +} + +void OSystem_Android::setShakePos(int shake_offset) { + ENTER("setShakePos(%d)", shake_offset); + if (_shake_offset != shake_offset) { + _shake_offset = shake_offset; + _force_redraw = true; + } +} + +void OSystem_Android::fillScreen(uint32 col) { + ENTER("fillScreen(%u)", col); + assert(col < 256); + _game_texture->fillBuffer(col); +} + +void OSystem_Android::setFocusRectangle(const Common::Rect& rect) { + ENTER("setFocusRectangle(%d,%d,%d,%d)", + rect.left, rect.top, rect.right, rect.bottom); +#if 0 + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrthof(rect.left, rect.right, rect.top, rect.bottom, 0, 1); + glMatrixMode(GL_MODELVIEW); + + _force_redraw = true; +#endif +} + +void OSystem_Android::clearFocusRectangle() { + ENTER("clearFocusRectangle()"); +#if 0 + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrthof(0, _egl_surface_width, _egl_surface_height, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + + _force_redraw = true; +#endif +} + +void OSystem_Android::showOverlay() { + ENTER("showOverlay()"); + _show_overlay = true; + _force_redraw = true; +} + +void OSystem_Android::hideOverlay() { + ENTER("hideOverlay()"); + _show_overlay = false; + _force_redraw = true; +} + +void OSystem_Android::clearOverlay() { + ENTER("clearOverlay()"); + _overlay_texture->fillBuffer(0); +} + +void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { + ENTER("grabOverlay(%p, %d)", buf, pitch); + // We support overlay alpha blending, so the pixel data here + // shouldn't actually be used. Let's fill it with zeros, I'm sure + // it will be fine... + const Graphics::Surface* surface = _overlay_texture->surface_const(); + assert(surface->bytesPerPixel == sizeof(buf[0])); + int h = surface->h; + do { + memset(buf, 0, surface->w * sizeof(buf[0])); + buf += pitch; // This 'pitch' is pixels not bytes + } while (--h); +} + +void OSystem_Android::copyRectToOverlay(const OverlayColor *buf, int pitch, + int x, int y, int w, int h) { + ENTER("copyRectToOverlay(%p, %d, %d, %d, %d, %d)", + buf, pitch, x, y, w, h); + const Graphics::Surface* surface = _overlay_texture->surface_const(); + assert(surface->bytesPerPixel == sizeof(buf[0])); + + // This 'pitch' is pixels not bytes + _overlay_texture->updateBuffer(x, y, w, h, buf, pitch * sizeof(buf[0])); +} + +int16 OSystem_Android::getOverlayHeight() { + return _overlay_texture->height(); +} + +int16 OSystem_Android::getOverlayWidth() { + return _overlay_texture->width(); +} + +bool OSystem_Android::showMouse(bool visible) { + ENTER("showMouse(%d)", visible); + _show_mouse = visible; + return true; +} + +void OSystem_Android::warpMouse(int x, int y) { + ENTER("warpMouse(%d, %d)", x, y); + // We use only the eventmanager's idea of the current mouse + // position, so there is nothing extra to do here. +} + +void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h, + int hotspotX, int hotspotY, + uint32 keycolor, int cursorTargetScale, + const Graphics::PixelFormat *format) { + ENTER("setMouseCursor(%p, %u, %u, %d, %d, %d, %d, %p)", + buf, w, h, hotspotX, hotspotY, (int)keycolor, cursorTargetScale, + format); + + assert(keycolor < 256); + + _mouse_texture->allocBuffer(w, h); + + // Update palette alpha based on keycolor + byte* palette = _mouse_texture->palette(); + int i = 256; + do { + palette[3] = 0xff; + palette += 4; + } while (--i); + palette = _mouse_texture->palette(); + palette[keycolor*4 + 3] = 0x00; + _mouse_texture->updateBuffer(0, 0, w, h, buf, w); + + _mouse_hotspot = Common::Point(hotspotX, hotspotY); + _mouse_targetscale = cursorTargetScale; +} + +void OSystem_Android::_setCursorPalette(const byte *colors, + uint start, uint num) { + byte* palette = _mouse_texture->palette() + start*4; + do { + for (int i = 0; i < 3; ++i) + palette[i] = colors[i]; + // Leave alpha untouched to preserve keycolor + + palette += 4; + colors += 4; + } while (--num); +} + +void OSystem_Android::setCursorPalette(const byte *colors, + uint start, uint num) { + ENTER("setCursorPalette(%p, %u, %u)", colors, start, num); + _setCursorPalette(colors, start, num); + _use_mouse_palette = true; +} + +void OSystem_Android::disableCursorPalette(bool disable) { + ENTER("disableCursorPalette(%d)", disable); + _use_mouse_palette = !disable; +} + +void OSystem_Android::setupKeymapper() { +#ifdef ENABLE_KEYMAPPER + using namespace Common; + + Keymapper *mapper = getEventManager()->getKeymapper(); + + HardwareKeySet *keySet = new HardwareKeySet(); + keySet->addHardwareKey( + new HardwareKey("n", KeyState(KEYCODE_n), "n (vk)", + kTriggerLeftKeyType, + kVirtualKeyboardActionType)); + mapper->registerHardwareKeySet(keySet); + + Keymap *globalMap = new Keymap("global"); + Action *act; + + act = new Action(globalMap, "VIRT", "Display keyboard", + kVirtualKeyboardActionType); + act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0)); + + mapper->addGlobalKeymap(globalMap); + + mapper->pushKeymap("global"); +#endif +} + +bool OSystem_Android::pollEvent(Common::Event &event) { + //ENTER("pollEvent()"); + lockMutex(_event_queue_lock); + if (_event_queue.empty()) { + unlockMutex(_event_queue_lock); + return false; + } + event = _event_queue.pop(); + unlockMutex(_event_queue_lock); + + switch (event.type) { + case Common::EVENT_MOUSEMOVE: + // TODO: only dirty/redraw move bounds + _force_redraw = true; + // fallthrough + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONUP: + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + case Common::EVENT_MBUTTONDOWN: + case Common::EVENT_MBUTTONUP: { + if (event.kbd.flags == 1) { // relative mouse hack + // Relative (trackball) mouse hack. + const Common::Point& mouse_pos = + getEventManager()->getMousePos(); + event.mouse.x += mouse_pos.x; + event.mouse.y += mouse_pos.y; + event.mouse.x = CLIP(event.mouse.x, (int16)0, _show_overlay ? + getOverlayWidth() : getWidth()); + event.mouse.y = CLIP(event.mouse.y, (int16)0, _show_overlay ? + getOverlayHeight() : getHeight()); + } else { + // Touchscreen events need to be converted + // from device to game coords first. + const GLESTexture* tex = _show_overlay + ? static_cast(_overlay_texture) + : static_cast(_game_texture); + event.mouse.x = scalef(event.mouse.x, tex->width(), + _egl_surface_width); + event.mouse.y = scalef(event.mouse.y, tex->height(), + _egl_surface_height); + event.mouse.x -= _shake_offset; + } + break; + } + case Common::EVENT_SCREEN_CHANGED: + debug("EVENT_SCREEN_CHANGED"); + _screen_changeid++; + destroyScummVMSurface(); + setupScummVMSurface(); + break; + default: + break; + } + + return true; +} + +void OSystem_Android::pushEvent(const Common::Event& event) { + lockMutex(_event_queue_lock); + + // Try to combine multiple queued mouse move events + if (event.type == Common::EVENT_MOUSEMOVE && + !_event_queue.empty() && + _event_queue.back().type == Common::EVENT_MOUSEMOVE) { + Common::Event tail = _event_queue.back(); + if (event.kbd.flags) { + // relative movement hack + tail.mouse.x += event.mouse.x; + tail.mouse.y += event.mouse.y; + } else { + // absolute position + tail.kbd.flags = 0; // clear relative flag + tail.mouse.x = event.mouse.x; + tail.mouse.y = event.mouse.y; + } + } + else + _event_queue.push(event); + + unlockMutex(_event_queue_lock); +} + +static void ScummVM_pushEvent(JNIEnv* env, jobject self, jobject java_event) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + + Common::Event event; + event.type = (Common::EventType)env->GetIntField(java_event, + FID_Event_type); + event.synthetic = + env->GetBooleanField(java_event, FID_Event_synthetic); + + switch (event.type) { + case Common::EVENT_KEYDOWN: + case Common::EVENT_KEYUP: + event.kbd.keycode = (Common::KeyCode)env->GetIntField( + java_event, FID_Event_kbd_keycode); + event.kbd.ascii = static_cast(env->GetIntField( + java_event, FID_Event_kbd_ascii)); + event.kbd.flags = static_cast(env->GetIntField( + java_event, FID_Event_kbd_flags)); + break; + case Common::EVENT_MOUSEMOVE: + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONUP: + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + case Common::EVENT_MBUTTONDOWN: + case Common::EVENT_MBUTTONUP: + event.mouse.x = + env->GetIntField(java_event, FID_Event_mouse_x); + event.mouse.y = + env->GetIntField(java_event, FID_Event_mouse_y); + // This is a terrible hack. We stash "relativeness" + // in the kbd.flags field until pollEvent() can work + // it out. + event.kbd.flags = env->GetBooleanField( + java_event, FID_Event_mouse_relative) ? 1 : 0; + break; + default: + break; + } + + cpp_obj->pushEvent(event); +} + +uint32 OSystem_Android::getMillis() { + timeval curTime; + gettimeofday(&curTime, NULL); + return (uint32)(((curTime.tv_sec - _startTime.tv_sec) * 1000) + \ + ((curTime.tv_usec - _startTime.tv_usec) / 1000)); +} + +void OSystem_Android::delayMillis(uint msecs) { + usleep(msecs * 1000); +} + +OSystem::MutexRef OSystem_Android::createMutex() { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + + pthread_mutex_t *mutex = new pthread_mutex_t; + if (pthread_mutex_init(mutex, &attr) != 0) { + warning("pthread_mutex_init() failed!"); + delete mutex; + return NULL; + } + return (MutexRef)mutex; +} + +void OSystem_Android::lockMutex(MutexRef mutex) { + if (pthread_mutex_lock((pthread_mutex_t*)mutex) != 0) + warning("pthread_mutex_lock() failed!"); +} + +void OSystem_Android::unlockMutex(MutexRef mutex) { + if (pthread_mutex_unlock((pthread_mutex_t*)mutex) != 0) + warning("pthread_mutex_unlock() failed!"); +} + +void OSystem_Android::deleteMutex(MutexRef mutex) { + pthread_mutex_t* m = (pthread_mutex_t*)mutex; + if (pthread_mutex_destroy(m) != 0) + warning("pthread_mutex_destroy() failed!"); + else + delete m; +} + +void OSystem_Android::quit() { + ENTER("quit()"); + + _timer_thread_exit = true; + pthread_join(_timer_thread, NULL); +} + +void OSystem_Android::setWindowCaption(const char *caption) { + ENTER("setWindowCaption(%s)", caption); + JNIEnv* env = JNU_GetEnv(); + jstring java_caption = env->NewStringUTF(caption); + env->CallVoidMethod(_back_ptr, MID_setWindowCaption, java_caption); + if (env->ExceptionCheck()) { + warning("Failed to set window caption"); + env->ExceptionDescribe(); + env->ExceptionClear(); + } + env->DeleteLocalRef(java_caption); +} + +void OSystem_Android::displayMessageOnOSD(const char *msg) { + ENTER("displayMessageOnOSD(%s)", msg); + JNIEnv* env = JNU_GetEnv(); + jstring java_msg = env->NewStringUTF(msg); + env->CallVoidMethod(_back_ptr, MID_displayMessageOnOSD, java_msg); + if (env->ExceptionCheck()) { + warning("Failed to display OSD message"); + env->ExceptionDescribe(); + env->ExceptionClear(); + } + env->DeleteLocalRef(java_msg); +} + +void OSystem_Android::showVirtualKeyboard(bool enable) { + ENTER("showVirtualKeyboard(%d)", enable); + JNIEnv* env = JNU_GetEnv(); + env->CallVoidMethod(_back_ptr, MID_showVirtualKeyboard, enable); + if (env->ExceptionCheck()) { + error("Error trying to show virtual keyboard"); + env->ExceptionDescribe(); + env->ExceptionClear(); + } +} + +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(NULL); + localtime_r(&curTime, &tm); + td.tm_sec = tm.tm_sec; + td.tm_min = tm.tm_min; + td.tm_hour = tm.tm_hour; + td.tm_mday = tm.tm_mday; + td.tm_mon = tm.tm_mon; + td.tm_year = tm.tm_year; +} + +FilesystemFactory *OSystem_Android::getFilesystemFactory() { + return _fsFactory; +} + +void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s, + int priority) { + s.add("ASSET", _asset_archive, priority, false); + + JNIEnv* env = JNU_GetEnv(); + + jobjectArray array = + (jobjectArray)env->CallObjectMethod(_back_ptr, MID_getSysArchives); + if (env->ExceptionCheck()) { + warning("Error finding system archive path"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return; + } + + jsize size = env->GetArrayLength(array); + for (jsize i = 0; i < size; ++i) { + jstring path_obj = (jstring)env->GetObjectArrayElement(array, i); + const char* path = env->GetStringUTFChars(path_obj, NULL); + if (path != NULL) { + s.addDirectory(path, path, priority); + env->ReleaseStringUTFChars(path_obj, path); + } + env->DeleteLocalRef(path_obj); + } +} + + +static jint ScummVM_scummVMMain(JNIEnv* env, jobject self, jobjectArray args) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + + const int MAX_NARGS = 32; + int res = -1; + + int argc = env->GetArrayLength(args); + if (argc > MAX_NARGS) { + JNU_ThrowByName(env, "java/lang/IllegalArgumentException", + "too many arguments"); + return 0; + } + + char* argv[MAX_NARGS]; + int nargs; // note use in cleanup loop below + for (nargs = 0; nargs < argc; ++nargs) { + jstring arg = (jstring)env->GetObjectArrayElement(args, nargs); + if (arg == NULL) { + argv[nargs] = NULL; + } else { + const char* cstr = env->GetStringUTFChars(arg, NULL); + argv[nargs] = const_cast(cstr); + if (cstr == NULL) + goto cleanup; // exception already thrown + } + env->DeleteLocalRef(arg); + } + + g_system = cpp_obj; + assert(g_system); + __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, + "Entering scummvm_main with %d args", argc); + res = scummvm_main(argc, argv); + __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "Exiting scummvm_main"); + g_system->quit(); + +cleanup: + nargs--; + for (int i = 0; i < nargs; ++i) { + if (argv[i] == NULL) + continue; + jstring arg = (jstring)env->GetObjectArrayElement(args, nargs); + if (arg == NULL) + // Exception already thrown + return res; + env->ReleaseStringUTFChars(arg, argv[i]); + env->DeleteLocalRef(arg); + } + + return res; +} + +#ifdef DYNAMIC_MODULES +void AndroidPluginProvider::addCustomDirectories(Common::FSList &dirs) const { + OSystem_Android* g_system_android = (OSystem_Android*)g_system; + g_system_android->addPluginDirectories(dirs); +} +#endif + +const static JNINativeMethod gMethods[] = { + { "create", "(Landroid/content/res/AssetManager;)V", + (void*)ScummVM_create }, + { "nativeDestroy", "()V", (void*)ScummVM_nativeDestroy }, + { "scummVMMain", "([Ljava/lang/String;)I", + (void*)ScummVM_scummVMMain }, + { "pushEvent", "(Lorg/inodes/gus/scummvm/Event;)V", + (void*)ScummVM_pushEvent }, + { "audioMixCallback", "([B)V", + (void*)ScummVM_audioMixCallback }, + { "setConfMan", "(Ljava/lang/String;I)V", + (void*)ScummVM_setConfManInt }, + { "setConfMan", "(Ljava/lang/String;Ljava/lang/String;)V", + (void*)ScummVM_setConfManString }, +}; + +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM* jvm, void* reserved) { + cached_jvm = jvm; + + JNIEnv* env; + if (jvm->GetEnv((void**)&env, JNI_VERSION_1_2)) + return JNI_ERR; + + jclass cls = env->FindClass("org/inodes/gus/scummvm/ScummVM"); + if (cls == NULL) + return JNI_ERR; + if (env->RegisterNatives(cls, gMethods, ARRAYSIZE(gMethods)) < 0) + return JNI_ERR; + + FID_ScummVM_nativeScummVM = env->GetFieldID(cls, "nativeScummVM", "J"); + if (FID_ScummVM_nativeScummVM == NULL) + return JNI_ERR; + + jclass event = env->FindClass("org/inodes/gus/scummvm/Event"); + if (event == NULL) + return JNI_ERR; + FID_Event_type = env->GetFieldID(event, "type", "I"); + if (FID_Event_type == NULL) + return JNI_ERR; + FID_Event_synthetic = env->GetFieldID(event, "synthetic", "Z"); + if (FID_Event_synthetic == NULL) + return JNI_ERR; + FID_Event_kbd_keycode = env->GetFieldID(event, "kbd_keycode", "I"); + if (FID_Event_kbd_keycode == NULL) + return JNI_ERR; + FID_Event_kbd_ascii = env->GetFieldID(event, "kbd_ascii", "I"); + if (FID_Event_kbd_ascii == NULL) + return JNI_ERR; + FID_Event_kbd_flags = env->GetFieldID(event, "kbd_flags", "I"); + if (FID_Event_kbd_flags == NULL) + return JNI_ERR; + FID_Event_mouse_x = env->GetFieldID(event, "mouse_x", "I"); + if (FID_Event_mouse_x == NULL) + return JNI_ERR; + FID_Event_mouse_y = env->GetFieldID(event, "mouse_y", "I"); + if (FID_Event_mouse_y == NULL) + return JNI_ERR; + FID_Event_mouse_relative = env->GetFieldID(event, "mouse_relative", "Z"); + if (FID_Event_mouse_relative == NULL) + return JNI_ERR; + + cls = env->FindClass("java/lang/Object"); + if (cls == NULL) + return JNI_ERR; + MID_Object_wait = env->GetMethodID(cls, "wait", "()V"); + if (MID_Object_wait == NULL) + return JNI_ERR; + + return JNI_VERSION_1_2; +} + +#endif diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk new file mode 100644 index 0000000000..0bc8fa265e --- /dev/null +++ b/backends/platform/android/android.mk @@ -0,0 +1,52 @@ +# Android specific build targets + +AAPT = aapt +DX = dx +APKBUILDER = apkbuilder +ADB = adb -e +ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.6/android.jar +JAVAC ?= javac +JAVACFLAGS = -source 1.5 -target 1.5 + +# FIXME: find/mark plugin entry points and add all this back again: +#LDFLAGS += -Wl,--gc-sections +#CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden + +scummvm.apk: build.tmp/libscummvm.so resources.ap_ classes.dex + # Package installer won't delete old libscummvm.so on upgrade so + # replace it with a zero size file + $(INSTALL) -d build.stage/common/lib/armeabi + touch build.stage/common/lib/armeabi/libscummvm.so + # We now handle the library unpacking ourselves from mylib/ + $(INSTALL) -d build.stage/common/mylib/armeabi + $(INSTALL) -c -m 644 build.tmp/libscummvm.so build.stage/common/mylib/armeabi/ + $(STRIP) build.stage/common/mylib/armeabi/libscummvm.so + # "-nf lib/armeabi/libscummvm.so" builds bogus paths? + $(APKBUILDER) $@ -z resources.ap_ -f classes.dex -rf build.stage/common || { $(RM) $@; exit 1; } + +scummvm-engine-%.apk: plugins/lib%.so build.tmp/%/resources.ap_ build.tmp/plugins/classes.dex + $(INSTALL) -d build.stage/$*/apk/mylib/armeabi/ + $(INSTALL) -c -m 644 plugins/lib$*.so build.stage/$*/apk/mylib/armeabi/ + $(STRIP) build.stage/$*/apk/mylib/armeabi/lib$*.so + $(APKBUILDER) $@ -z build.tmp/$*/resources.ap_ -f build.tmp/plugins/classes.dex -rf build.stage/$*/apk || { $(RM) $@; exit 1; } + +release/%.apk: %.apk + @$(MKDIR) -p $(@D) + @$(RM) $@ + $(CP) $< $@.tmp + # remove debugging signature + zip -d $@.tmp META-INF/\* + jarsigner $(JARSIGNER_FLAGS) $@.tmp release + zipalign 4 $@.tmp $@ + $(RM) $@.tmp + +androidrelease: release/scummvm.apk $(patsubst plugins/lib%.so,release/scummvm-engine-%.apk,$(PLUGINS)) + +androidtest: scummvm.apk scummvm-engine-scumm.apk scummvm-engine-kyra.apk + @set -e; for apk in $^; do \ + echo $(ADB) install -r $$apk; \ + $(ADB) install -r $$apk; \ + done + $(ADB) shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n org.inodes.gus.scummvm/.Unpacker + +.PHONY: androidrelease androidtest diff --git a/backends/platform/android/asset-archive.cpp b/backends/platform/android/asset-archive.cpp new file mode 100644 index 0000000000..20c6a653c0 --- /dev/null +++ b/backends/platform/android/asset-archive.cpp @@ -0,0 +1,414 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#if defined(ANDROID) + +#include + +#include +#include + +#include "common/str.h" +#include "common/stream.h" +#include "common/util.h" +#include "common/archive.h" +#include "common/debug.h" + +#include "backends/platform/android/asset-archive.h" + +extern JNIEnv* JNU_GetEnv(); + +// Must match android.content.res.AssetManager.ACCESS_* +const jint ACCESS_UNKNOWN = 0; +const jint ACCESS_RANDOM = 1; + +// This might be useful to someone else. Assumes markSupported() == true. +class JavaInputStream : public Common::SeekableReadStream { +public: + JavaInputStream(JNIEnv* env, jobject is); + virtual ~JavaInputStream(); + virtual bool eos() const { return _eos; } + virtual bool err() const { return _err; } + virtual void clearErr() { _eos = _err = false; } + virtual uint32 read(void *dataPtr, uint32 dataSize); + virtual int32 pos() const { return _pos; } + virtual int32 size() const { return _len; } + virtual bool seek(int32 offset, int whence = SEEK_SET); +private: + void close(JNIEnv* env); + jmethodID MID_mark; + jmethodID MID_available; + jmethodID MID_close; + jmethodID MID_read; + jmethodID MID_reset; + jmethodID MID_skip; + jobject _input_stream; + jsize _buflen; + jbyteArray _buf; + uint32 _pos; + jint _len; + bool _eos; + bool _err; +}; + +JavaInputStream::JavaInputStream(JNIEnv* env, jobject is) : + _eos(false), _err(false), _pos(0) +{ + _input_stream = env->NewGlobalRef(is); + _buflen = 8192; + _buf = static_cast(env->NewGlobalRef(env->NewByteArray(_buflen))); + + jclass cls = env->GetObjectClass(_input_stream); + MID_mark = env->GetMethodID(cls, "mark", "(I)V"); + assert(MID_mark); + MID_available = env->GetMethodID(cls, "available", "()I"); + assert(MID_mark); + MID_close = env->GetMethodID(cls, "close", "()V"); + assert(MID_close); + MID_read = env->GetMethodID(cls, "read", "([BII)I"); + assert(MID_read); + MID_reset = env->GetMethodID(cls, "reset", "()V"); + assert(MID_reset); + MID_skip = env->GetMethodID(cls, "skip", "(J)J"); + assert(MID_skip); + + // Mark start of stream, so we can reset back to it. + // readlimit is set to something bigger than anything we might + // want to seek within. + env->CallVoidMethod(_input_stream, MID_mark, 10*1024*1024); + _len = env->CallIntMethod(_input_stream, MID_available); +} + +JavaInputStream::~JavaInputStream() { + JNIEnv* env = JNU_GetEnv(); + close(env); + env->DeleteGlobalRef(_buf); + env->DeleteGlobalRef(_input_stream); +} + +void JavaInputStream::close(JNIEnv* env) { + env->CallVoidMethod(_input_stream, MID_close); + if (env->ExceptionCheck()) + env->ExceptionClear(); +} + +uint32 JavaInputStream::read(void *dataPtr, uint32 dataSize) { + JNIEnv* env = JNU_GetEnv(); + + if (_buflen < dataSize) { + _buflen = dataSize; + env->DeleteGlobalRef(_buf); + _buf = static_cast(env->NewGlobalRef(env->NewByteArray(_buflen))); + } + + jint ret = env->CallIntMethod(_input_stream, MID_read, _buf, 0, dataSize); + if (env->ExceptionCheck()) { + warning("Exception during JavaInputStream::read(%p, %d)", + dataPtr, dataSize); + env->ExceptionDescribe(); + env->ExceptionClear(); + _err = true; + ret = -1; + } else if (ret == -1) { + _eos = true; + ret = 0; + } else { + env->GetByteArrayRegion(_buf, 0, ret, static_cast(dataPtr)); + _pos += ret; + } + return ret; +} + +bool JavaInputStream::seek(int32 offset, int whence) { + JNIEnv* env = JNU_GetEnv(); + uint32 newpos; + switch (whence) { + case SEEK_SET: + newpos = offset; + break; + case SEEK_CUR: + newpos = _pos + offset; + break; + case SEEK_END: + newpos = _len + offset; + break; + default: + debug("Unknown 'whence' arg %d", whence); + return false; + } + + jlong skip_bytes; + if (newpos > _pos) { + skip_bytes = newpos - _pos; + } else { + // Can't skip backwards, so jump back to start and skip from there. + env->CallVoidMethod(_input_stream, MID_reset); + if (env->ExceptionCheck()) { + warning("Failed to rewind to start of asset stream"); + env->ExceptionDescribe(); + env->ExceptionClear(); + return false; + } + _pos = 0; + skip_bytes = newpos; + } + + while (skip_bytes > 0) { + jlong ret = env->CallLongMethod(_input_stream, MID_skip, skip_bytes); + if (env->ExceptionCheck()) { + warning("Failed to skip %ld bytes into asset stream", + static_cast(skip_bytes)); + env->ExceptionDescribe(); + env->ExceptionClear(); + return false; + } else if (ret == 0) { + warning("InputStream->skip(%ld) didn't skip any bytes. Aborting seek.", + static_cast(skip_bytes)); + return false; // No point looping forever... + } + _pos += ret; + skip_bytes -= ret; + } + _eos = false; + return true; +} + + +// Must match android.content.res.AssetFileDescriptor.UNKNOWN_LENGTH +const jlong UNKNOWN_LENGTH = -1; + +// Reading directly from a fd is so much more efficient, that it is +// worth optimising for. +class AssetFdReadStream : public Common::SeekableReadStream { +public: + AssetFdReadStream(JNIEnv* env, jobject assetfd); + virtual ~AssetFdReadStream(); + virtual bool eos() const { return _eos; } + virtual bool err() const { return _err; } + virtual void clearErr() { _eos = _err = false; } + virtual uint32 read(void *dataPtr, uint32 dataSize); + virtual int32 pos() const { return _pos; } + virtual int32 size() const { return _declared_len; } + virtual bool seek(int32 offset, int whence = SEEK_SET); +private: + void close(JNIEnv* env); + int _fd; + jmethodID MID_close; + jobject _assetfd; + jlong _start_off; + jlong _declared_len; + uint32 _pos; + bool _eos; + bool _err; +}; + +AssetFdReadStream::AssetFdReadStream(JNIEnv* env, jobject assetfd) : + _eos(false), _err(false), _pos(0) +{ + _assetfd = env->NewGlobalRef(assetfd); + + jclass cls = env->GetObjectClass(_assetfd); + MID_close = env->GetMethodID(cls, "close", "()V"); + assert(MID_close); + + jmethodID MID_getStartOffset = + env->GetMethodID(cls, "getStartOffset", "()J"); + assert(MID_getStartOffset); + _start_off = env->CallLongMethod(_assetfd, MID_getStartOffset); + + jmethodID MID_getDeclaredLength = + env->GetMethodID(cls, "getDeclaredLength", "()J"); + assert(MID_getDeclaredLength); + _declared_len = env->CallLongMethod(_assetfd, MID_getDeclaredLength); + + jmethodID MID_getFileDescriptor = + env->GetMethodID(cls, "getFileDescriptor", "()Ljava/io/FileDescriptor;"); + assert(MID_getFileDescriptor); + jobject javafd = env->CallObjectMethod(_assetfd, MID_getFileDescriptor); + assert(javafd); + jclass fd_cls = env->GetObjectClass(javafd); + jfieldID FID_descriptor = env->GetFieldID(fd_cls, "descriptor", "I"); + assert(FID_descriptor); + _fd = env->GetIntField(javafd, FID_descriptor); +} + +AssetFdReadStream::~AssetFdReadStream() { + JNIEnv* env = JNU_GetEnv(); + env->CallVoidMethod(_assetfd, MID_close); + if (env->ExceptionCheck()) + env->ExceptionClear(); + env->DeleteGlobalRef(_assetfd); +} + +uint32 AssetFdReadStream::read(void *dataPtr, uint32 dataSize) { + if (_declared_len != UNKNOWN_LENGTH) { + jlong cap = _declared_len - _pos; + if (dataSize > cap) + dataSize = cap; + } + int ret = ::read(_fd, dataPtr, dataSize); + if (ret == 0) + _eos = true; + else if (ret == -1) + _err = true; + else + _pos += ret; + return ret; +} + +bool AssetFdReadStream::seek(int32 offset, int whence) { + if (whence == SEEK_SET) { + if (_declared_len != UNKNOWN_LENGTH && offset > _declared_len) + offset = _declared_len; + offset += _start_off; + } else if (whence == SEEK_END && _declared_len != UNKNOWN_LENGTH) { + whence = SEEK_SET; + offset = _start_off + _declared_len + offset; + } + int ret = lseek(_fd, offset, whence); + if (ret == -1) + return false; + _pos = ret - _start_off; + _eos = false; + return true; +} + +AndroidAssetArchive::AndroidAssetArchive(jobject am) { + JNIEnv* env = JNU_GetEnv(); + _am = env->NewGlobalRef(am); + + jclass cls = env->GetObjectClass(_am); + MID_open = env->GetMethodID(cls, "open", + "(Ljava/lang/String;I)Ljava/io/InputStream;"); + assert(MID_open); + MID_openFd = env->GetMethodID(cls, "openFd", + "(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;"); + assert(MID_openFd); + MID_list = env->GetMethodID(cls, "list", + "(Ljava/lang/String;)[Ljava/lang/String;"); + assert(MID_list); +} + +AndroidAssetArchive::~AndroidAssetArchive() { + JNIEnv* env = JNU_GetEnv(); + env->DeleteGlobalRef(_am); +} + +bool AndroidAssetArchive::hasFile(const Common::String &name) { + JNIEnv* env = JNU_GetEnv(); + jstring path = env->NewStringUTF(name.c_str()); + jobject result = env->CallObjectMethod(_am, MID_open, path, ACCESS_UNKNOWN); + if (env->ExceptionCheck()) { + // Assume FileNotFoundException + //warning("Error while calling AssetManager->open(%s)", name.c_str()); + //env->ExceptionDescribe(); + env->ExceptionClear(); + env->DeleteLocalRef(path); + return false; + } + env->DeleteLocalRef(result); + env->DeleteLocalRef(path); + return true; +} + +int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) { + JNIEnv* env = JNU_GetEnv(); + Common::List dirlist; + dirlist.push_back(""); + + int count = 0; + while (!dirlist.empty()) { + const Common::String dir = dirlist.back(); + dirlist.pop_back(); + + jstring jpath = env->NewStringUTF(dir.c_str()); + jobjectArray jpathlist = static_cast(env->CallObjectMethod(_am, MID_list, jpath)); + if (env->ExceptionCheck()) { + warning("Error while calling AssetManager->list(%s). Ignoring.", + dir.c_str()); + env->ExceptionDescribe(); + env->ExceptionClear(); + continue; // May as well keep going ... + } + env->DeleteLocalRef(jpath); + + for (jsize i = 0; i < env->GetArrayLength(jpathlist); ++i) { + jstring elem = (jstring)env->GetObjectArrayElement(jpathlist, i); + const char* p = env->GetStringUTFChars(elem, NULL); + Common::String thispath = dir; + if (!thispath.empty()) + thispath += "/"; + thispath += p; + + // Assume files have a . in them, and directories don't + if (strchr(p, '.')) { + member_list.push_back(getMember(thispath)); + ++count; + } else + dirlist.push_back(thispath); + + env->ReleaseStringUTFChars(elem, p); + env->DeleteLocalRef(elem); + } + + env->DeleteLocalRef(jpathlist); + } + + return count; +} + +Common::ArchiveMemberPtr AndroidAssetArchive::getMember(const Common::String &name) { + return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); +} + +Common::SeekableReadStream *AndroidAssetArchive::createReadStreamForMember(const Common::String &path) const { + JNIEnv* env = JNU_GetEnv(); + jstring jpath = env->NewStringUTF(path.c_str()); + + // Try openFd() first ... + jobject afd = env->CallObjectMethod(_am, MID_openFd, jpath); + if (env->ExceptionCheck()) + env->ExceptionClear(); + else if (afd != NULL) { + // success :) + env->DeleteLocalRef(jpath); + return new AssetFdReadStream(env, afd); + } + + // ... and fallback to normal open() if that doesn't work + jobject is = env->CallObjectMethod(_am, MID_open, jpath, ACCESS_RANDOM); + if (env->ExceptionCheck()) { + // Assume FileNotFoundException + //warning("Error opening %s", path.c_str()); + //env->ExceptionDescribe(); + env->ExceptionClear(); + env->DeleteLocalRef(jpath); + return NULL; + } + + return new JavaInputStream(env, is); +} + +#endif diff --git a/backends/platform/android/asset-archive.h b/backends/platform/android/asset-archive.h new file mode 100644 index 0000000000..b3f6993c50 --- /dev/null +++ b/backends/platform/android/asset-archive.h @@ -0,0 +1,53 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#if defined(ANDROID) + +#include + +#include "common/str.h" +#include "common/stream.h" +#include "common/util.h" +#include "common/archive.h" + +class AndroidAssetArchive : public Common::Archive { +public: + AndroidAssetArchive(jobject am); + virtual ~AndroidAssetArchive(); + + virtual bool hasFile(const Common::String &name); + virtual int listMembers(Common::ArchiveMemberList &list); + virtual Common::ArchiveMemberPtr getMember(const Common::String &name); + virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; + +private: + jmethodID MID_open; + jmethodID MID_openFd; + jmethodID MID_list; + + jobject _am; +}; + +#endif diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk new file mode 100644 index 0000000000..fdb0ed2ac4 --- /dev/null +++ b/backends/platform/android/module.mk @@ -0,0 +1,85 @@ +MODULE := backends/platform/android + +MODULE_OBJS := \ + android.o asset-archive.o video.o + +MODULE_DIRS += \ + backends/platform/android/ + +# We don't use the rules.mk here on purpose +OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) + +JAVA_SRC = \ + $(MODULE)/org/inodes/gus/scummvm/ScummVM.java \ + $(MODULE)/org/inodes/gus/scummvm/ScummVMApplication.java \ + $(MODULE)/org/inodes/gus/scummvm/ScummVMActivity.java \ + $(MODULE)/org/inodes/gus/scummvm/EditableSurfaceView.java \ + $(MODULE)/org/inodes/gus/scummvm/Unpacker.java \ + $(MODULE)/org/inodes/gus/scummvm/Manifest.java \ + $(MODULE)/org/inodes/gus/scummvm/R.java + +JAVA_PLUGIN_SRC = \ + $(MODULE)/org/inodes/gus/scummvm/PluginProvider.java + +RESOURCES = \ + $(srcdir)/dists/android/res/values/strings.xml \ + $(srcdir)/dists/android/res/layout/main.xml \ + $(srcdir)/dists/android/res/layout/splash.xml \ + $(srcdir)/dists/android/res/drawable/gradient.xml \ + $(srcdir)/dists/android/res/drawable/scummvm.png \ + $(srcdir)/dists/android/res/drawable/scummvm_big.png + +ASSETS = $(DIST_FILES_ENGINEDATA) $(DIST_FILES_THEMES) + +PLUGIN_RESOURCES = \ + $(srcdir)/dists/android/res/values/strings.xml \ + $(srcdir)/dists/android/res/drawable/scummvm.png + +# These must be incremented for each market upload +#ANDROID_VERSIONCODE = 6 Specified in dists/android/AndroidManifest.xml.in +ANDROID_PLUGIN_VERSIONCODE = 6 + +# This library contains scummvm proper +build.tmp/libscummvm.so: $(OBJS) + @$(MKDIR) -p $(@D) + $(CXX) $(PLUGIN_LDFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS) + + +backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR) + $(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR) + +build.tmp/classes/%.class: $(srcdir)/backends/platform/android/%.java $(srcdir)/backends/platform/android/org/inodes/gus/scummvm/R.java + @$(MKDIR) -p $(@D) + $(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes -bootclasspath $(ANDROID_JAR) $< + +build.tmp/classes.plugin/%.class: $(srcdir)/backends/platform/android/%.java + @$(MKDIR) -p $(@D) + $(JAVAC) $(JAVACFLAGS) -cp $(srcdir)/backends/platform/android -d build.tmp/classes.plugin -bootclasspath $(ANDROID_JAR) $< + +classes.dex: $(JAVA_SRC:backends/platform/android/%.java=build.tmp/classes/%.class) + $(DX) --dex --output=$@ build.tmp/classes + +build.tmp/plugins/classes.dex: $(JAVA_PLUGIN_SRC:backends/platform/android/%.java=build.tmp/classes.plugin/%.class) + @$(MKDIR) -p $(@D) + $(DX) --dex --output=$@ build.tmp/classes.plugin + +resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) + $(INSTALL) -d build.tmp/assets/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/ + $(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR) -F $@ + +build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR) + $(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR) -F $@ + +build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml: dists/android/mkmanifest.pl configure dists/android/AndroidManifest.xml + dists/android/mkmanifest.pl --id=$* --configure=configure \ + --version-name=$(VERSION) \ + --version-code=$(ANDROID_PLUGIN_VERSIONCODE) \ + --stringres=build.stage/$*/res/values/strings.xml \ + --manifest=build.tmp/$*/AndroidManifest.xml \ + --master-manifest=dists/android/AndroidManifest.xml \ + --unpacklib=mylib/armeabi/lib$*.so + +build.stage/%/res/drawable/scummvm.png: dists/android/res/drawable/scummvm.png + @$(MKDIR) -p $(@D) + $(CP) $< $@ diff --git a/backends/platform/android/org/inodes/gus/scummvm/EditableSurfaceView.java b/backends/platform/android/org/inodes/gus/scummvm/EditableSurfaceView.java new file mode 100644 index 0000000000..5b71d4a3a5 --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/EditableSurfaceView.java @@ -0,0 +1,59 @@ +package org.inodes.gus.scummvm; + +import android.content.Context; +import android.text.InputType; +import android.util.AttributeSet; +import android.view.SurfaceView; +import android.view.inputmethod.BaseInputConnection; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodManager; + +public class EditableSurfaceView extends SurfaceView { + public EditableSurfaceView(Context context) { + super(context); + } + + public EditableSurfaceView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public EditableSurfaceView(Context context, AttributeSet attrs, + int defStyle) { + super(context, attrs, defStyle); + } + + @Override + public boolean onCheckIsTextEditor() { + return true; + } + + private class MyInputConnection extends BaseInputConnection { + public MyInputConnection() { + super(EditableSurfaceView.this, false); + } + + @Override + public boolean performEditorAction(int actionCode) { + if (actionCode == EditorInfo.IME_ACTION_DONE) { + InputMethodManager imm = (InputMethodManager) + getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(getWindowToken(), 0); + } + return super.performEditorAction(actionCode); // Sends enter key + } + } + + @Override + public InputConnection onCreateInputConnection(EditorInfo outAttrs) { + outAttrs.initialCapsMode = 0; + outAttrs.initialSelEnd = outAttrs.initialSelStart = -1; + outAttrs.inputType = (InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_VARIATION_NORMAL | + InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); + outAttrs.imeOptions = (EditorInfo.IME_ACTION_DONE | + EditorInfo.IME_FLAG_NO_EXTRACT_UI); + + return new MyInputConnection(); + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/Event.java b/backends/platform/android/org/inodes/gus/scummvm/Event.java new file mode 100644 index 0000000000..f9c7aba93b --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/Event.java @@ -0,0 +1,330 @@ +package org.inodes.gus.scummvm; + +import android.view.KeyEvent; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class Event { + // Common::EventType enum. + // Must be kept in sync with common/events.h + public final static int EVENT_INVALID = 0; + public final static int EVENT_KEYDOWN = 1; + public final static int EVENT_KEYUP = 2; + public final static int EVENT_MOUSEMOVE = 3; + public final static int EVENT_LBUTTONDOWN = 4; + public final static int EVENT_LBUTTONUP = 5; + public final static int EVENT_RBUTTONDOWN = 6; + public final static int EVENT_RBUTTONUP = 7; + public final static int EVENT_WHEELUP = 8; + public final static int EVENT_WHEELDOWN = 9; + public final static int EVENT_QUIT = 10; + public final static int EVENT_SCREEN_CHANGED = 11; + public final static int EVENT_PREDICTIVE_DIALOG = 12; + public final static int EVENT_MBUTTONDOWN = 13; + public final static int EVENT_MBUTTONUP = 14; + public final static int EVENT_MAINMENU = 15; + public final static int EVENT_RTL = 16; + + // common/keyboard.h + public final static int ASCII_F1 = 315; + public final static int ASCII_F2 = 316; + public final static int ASCII_F3 = 317; + public final static int ASCII_F4 = 318; + public final static int ASCII_F5 = 319; + public final static int ASCII_F6 = 320; + public final static int ASCII_F7 = 321; + public final static int ASCII_F8 = 322; + public final static int ASCII_F9 = 323; + public final static int ASCII_F10 = 324; + public final static int ASCII_F11 = 325; + public final static int ASCII_F12 = 326; + public final static int KBD_CTRL = 1 << 0; + public final static int KBD_ALT = 1 << 1; + public final static int KBD_SHIFT = 1 << 2; + + public final static int KEYCODE_INVALID = 0; + public final static int KEYCODE_BACKSPACE = 8; + public final static int KEYCODE_TAB = 9; + public final static int KEYCODE_CLEAR = 12; + public final static int KEYCODE_RETURN = 13; + public final static int KEYCODE_PAUSE = 19; + public final static int KEYCODE_ESCAPE = 27; + public final static int KEYCODE_SPACE = 32; + public final static int KEYCODE_EXCLAIM = 33; + public final static int KEYCODE_QUOTEDBL = 34; + public final static int KEYCODE_HASH = 35; + public final static int KEYCODE_DOLLAR = 36; + public final static int KEYCODE_AMPERSAND = 38; + public final static int KEYCODE_QUOTE = 39; + public final static int KEYCODE_LEFTPAREN = 40; + public final static int KEYCODE_RIGHTPAREN = 41; + public final static int KEYCODE_ASTERISK = 42; + public final static int KEYCODE_PLUS = 43; + public final static int KEYCODE_COMMA = 44; + public final static int KEYCODE_MINUS = 45; + public final static int KEYCODE_PERIOD = 46; + public final static int KEYCODE_SLASH = 47; + public final static int KEYCODE_0 = 48; + public final static int KEYCODE_1 = 49; + public final static int KEYCODE_2 = 50; + public final static int KEYCODE_3 = 51; + public final static int KEYCODE_4 = 52; + public final static int KEYCODE_5 = 53; + public final static int KEYCODE_6 = 54; + public final static int KEYCODE_7 = 55; + public final static int KEYCODE_8 = 56; + public final static int KEYCODE_9 = 57; + public final static int KEYCODE_COLON = 58; + public final static int KEYCODE_SEMICOLON = 59; + public final static int KEYCODE_LESS = 60; + public final static int KEYCODE_EQUALS = 61; + public final static int KEYCODE_GREATER = 62; + public final static int KEYCODE_QUESTION = 63; + public final static int KEYCODE_AT = 64; + public final static int KEYCODE_LEFTBRACKET = 91; + public final static int KEYCODE_BACKSLASH = 92; + public final static int KEYCODE_RIGHTBRACKET = 93; + public final static int KEYCODE_CARET = 94; + public final static int KEYCODE_UNDERSCORE = 95; + public final static int KEYCODE_BACKQUOTE = 96; + public final static int KEYCODE_a = 97; + public final static int KEYCODE_b = 98; + public final static int KEYCODE_c = 99; + public final static int KEYCODE_d = 100; + public final static int KEYCODE_e = 101; + public final static int KEYCODE_f = 102; + public final static int KEYCODE_g = 103; + public final static int KEYCODE_h = 104; + public final static int KEYCODE_i = 105; + public final static int KEYCODE_j = 106; + public final static int KEYCODE_k = 107; + public final static int KEYCODE_l = 108; + public final static int KEYCODE_m = 109; + public final static int KEYCODE_n = 110; + public final static int KEYCODE_o = 111; + public final static int KEYCODE_p = 112; + public final static int KEYCODE_q = 113; + public final static int KEYCODE_r = 114; + public final static int KEYCODE_s = 115; + public final static int KEYCODE_t = 116; + public final static int KEYCODE_u = 117; + public final static int KEYCODE_v = 118; + public final static int KEYCODE_w = 119; + public final static int KEYCODE_x = 120; + public final static int KEYCODE_y = 121; + public final static int KEYCODE_z = 122; + public final static int KEYCODE_DELETE = 127; + // Numeric keypad + public final static int KEYCODE_KP0 = 256; + public final static int KEYCODE_KP1 = 257; + public final static int KEYCODE_KP2 = 258; + public final static int KEYCODE_KP3 = 259; + public final static int KEYCODE_KP4 = 260; + public final static int KEYCODE_KP5 = 261; + public final static int KEYCODE_KP6 = 262; + public final static int KEYCODE_KP7 = 263; + public final static int KEYCODE_KP8 = 264; + public final static int KEYCODE_KP9 = 265; + public final static int KEYCODE_KP_PERIOD = 266; + public final static int KEYCODE_KP_DIVIDE = 267; + public final static int KEYCODE_KP_MULTIPLY = 268; + public final static int KEYCODE_KP_MINUS = 269; + public final static int KEYCODE_KP_PLUS = 270; + public final static int KEYCODE_KP_ENTER = 271; + public final static int KEYCODE_KP_EQUALS = 272; + // Arrows + Home/End pad + public final static int KEYCODE_UP = 273; + public final static int KEYCODE_DOWN = 274; + public final static int KEYCODE_RIGHT = 275; + public final static int KEYCODE_LEFT = 276; + public final static int KEYCODE_INSERT = 277; + public final static int KEYCODE_HOME = 278; + public final static int KEYCODE_END = 279; + public final static int KEYCODE_PAGEUP = 280; + public final static int KEYCODE_PAGEDOWN = 281; + // Function keys + public final static int KEYCODE_F1 = 282; + public final static int KEYCODE_F2 = 283; + public final static int KEYCODE_F3 = 284; + public final static int KEYCODE_F4 = 285; + public final static int KEYCODE_F5 = 286; + public final static int KEYCODE_F6 = 287; + public final static int KEYCODE_F7 = 288; + public final static int KEYCODE_F8 = 289; + public final static int KEYCODE_F9 = 290; + public final static int KEYCODE_F10 = 291; + public final static int KEYCODE_F11 = 292; + public final static int KEYCODE_F12 = 293; + public final static int KEYCODE_F13 = 294; + public final static int KEYCODE_F14 = 295; + public final static int KEYCODE_F15 = 296; + // Key state modifier keys + public final static int KEYCODE_NUMLOCK = 300; + public final static int KEYCODE_CAPSLOCK = 301; + public final static int KEYCODE_SCROLLOCK = 302; + public final static int KEYCODE_RSHIFT = 303; + public final static int KEYCODE_LSHIFT = 304; + public final static int KEYCODE_RCTRL = 305; + public final static int KEYCODE_LCTRL = 306; + public final static int KEYCODE_RALT = 307; + public final static int KEYCODE_LALT = 308; + public final static int KEYCODE_RMETA = 309; + public final static int KEYCODE_LMETA = 310; + public final static int KEYCODE_LSUPER = 311; // Left "Windows" key + public final static int KEYCODE_RSUPER = 312; // Right "Windows" key + public final static int KEYCODE_MODE = 313; // "Alt Gr" key + public final static int KEYCODE_COMPOSE = 314; // Multi-key compose key + // Miscellaneous function keys + public final static int KEYCODE_HELP = 315; + public final static int KEYCODE_PRINT = 316; + public final static int KEYCODE_SYSREQ = 317; + public final static int KEYCODE_BREAK = 318; + public final static int KEYCODE_MENU = 319; + public final static int KEYCODE_POWER = 320; // Power Macintosh power key + public final static int KEYCODE_EURO = 321; // Some european keyboards + public final static int KEYCODE_UNDO = 322; // Atari keyboard has Undo + + // Android KeyEvent keycode -> ScummVM keycode + public final static Map androidKeyMap; + static { + Map map = new HashMap(); + + map.put(KeyEvent.KEYCODE_DEL, KEYCODE_BACKSPACE); + map.put(KeyEvent.KEYCODE_TAB, KEYCODE_TAB); + map.put(KeyEvent.KEYCODE_CLEAR, KEYCODE_CLEAR); + map.put(KeyEvent.KEYCODE_ENTER, KEYCODE_RETURN); + //map.put(??, KEYCODE_PAUSE); + map.put(KeyEvent.KEYCODE_BACK, KEYCODE_ESCAPE); + map.put(KeyEvent.KEYCODE_SPACE, KEYCODE_SPACE); + //map.put(??, KEYCODE_EXCLAIM); + //map.put(??, KEYCODE_QUOTEDBL); + map.put(KeyEvent.KEYCODE_POUND, KEYCODE_HASH); + //map.put(??, KEYCODE_DOLLAR); + //map.put(??, KEYCODE_AMPERSAND); + map.put(KeyEvent.KEYCODE_APOSTROPHE, KEYCODE_QUOTE); + //map.put(??, KEYCODE_LEFTPAREN); + //map.put(??, KEYCODE_RIGHTPAREN); + //map.put(??, KEYCODE_ASTERISK); + map.put(KeyEvent.KEYCODE_PLUS, KEYCODE_PLUS); + map.put(KeyEvent.KEYCODE_COMMA, KEYCODE_COMMA); + map.put(KeyEvent.KEYCODE_MINUS, KEYCODE_MINUS); + map.put(KeyEvent.KEYCODE_PERIOD, KEYCODE_PERIOD); + map.put(KeyEvent.KEYCODE_SLASH, KEYCODE_SLASH); + map.put(KeyEvent.KEYCODE_0, KEYCODE_0); + map.put(KeyEvent.KEYCODE_1, KEYCODE_1); + map.put(KeyEvent.KEYCODE_2, KEYCODE_2); + map.put(KeyEvent.KEYCODE_3, KEYCODE_3); + map.put(KeyEvent.KEYCODE_4, KEYCODE_4); + map.put(KeyEvent.KEYCODE_5, KEYCODE_5); + map.put(KeyEvent.KEYCODE_6, KEYCODE_6); + map.put(KeyEvent.KEYCODE_7, KEYCODE_7); + map.put(KeyEvent.KEYCODE_8, KEYCODE_8); + map.put(KeyEvent.KEYCODE_9, KEYCODE_9); + //map.put(??, KEYCODE_COLON); + map.put(KeyEvent.KEYCODE_SEMICOLON, KEYCODE_SEMICOLON); + //map.put(??, KEYCODE_LESS); + map.put(KeyEvent.KEYCODE_EQUALS, KEYCODE_EQUALS); + //map.put(??, KEYCODE_GREATER); + //map.put(??, KEYCODE_QUESTION); + map.put(KeyEvent.KEYCODE_AT, KEYCODE_AT); + map.put(KeyEvent.KEYCODE_LEFT_BRACKET, KEYCODE_LEFTBRACKET); + map.put(KeyEvent.KEYCODE_BACKSLASH, KEYCODE_BACKSLASH); + map.put(KeyEvent.KEYCODE_RIGHT_BRACKET, KEYCODE_RIGHTBRACKET); + //map.put(??, KEYCODE_CARET); + //map.put(??, KEYCODE_UNDERSCORE); + //map.put(??, KEYCODE_BACKQUOTE); + map.put(KeyEvent.KEYCODE_A, KEYCODE_a); + map.put(KeyEvent.KEYCODE_B, KEYCODE_b); + map.put(KeyEvent.KEYCODE_C, KEYCODE_c); + map.put(KeyEvent.KEYCODE_D, KEYCODE_d); + map.put(KeyEvent.KEYCODE_E, KEYCODE_e); + map.put(KeyEvent.KEYCODE_F, KEYCODE_f); + map.put(KeyEvent.KEYCODE_G, KEYCODE_g); + map.put(KeyEvent.KEYCODE_H, KEYCODE_h); + map.put(KeyEvent.KEYCODE_I, KEYCODE_i); + map.put(KeyEvent.KEYCODE_J, KEYCODE_j); + map.put(KeyEvent.KEYCODE_K, KEYCODE_k); + map.put(KeyEvent.KEYCODE_L, KEYCODE_l); + map.put(KeyEvent.KEYCODE_M, KEYCODE_m); + map.put(KeyEvent.KEYCODE_N, KEYCODE_n); + map.put(KeyEvent.KEYCODE_O, KEYCODE_o); + map.put(KeyEvent.KEYCODE_P, KEYCODE_p); + map.put(KeyEvent.KEYCODE_Q, KEYCODE_q); + map.put(KeyEvent.KEYCODE_R, KEYCODE_r); + map.put(KeyEvent.KEYCODE_S, KEYCODE_s); + map.put(KeyEvent.KEYCODE_T, KEYCODE_t); + map.put(KeyEvent.KEYCODE_U, KEYCODE_u); + map.put(KeyEvent.KEYCODE_V, KEYCODE_v); + map.put(KeyEvent.KEYCODE_W, KEYCODE_w); + map.put(KeyEvent.KEYCODE_X, KEYCODE_x); + map.put(KeyEvent.KEYCODE_Y, KEYCODE_y); + map.put(KeyEvent.KEYCODE_Z, KEYCODE_z); + //map.put(KeyEvent.KEYCODE_DEL, KEYCODE_DELETE); use BACKSPACE instead + //map.put(??, KEYCODE_KP_*); + map.put(KeyEvent.KEYCODE_DPAD_UP, KEYCODE_UP); + map.put(KeyEvent.KEYCODE_DPAD_DOWN, KEYCODE_DOWN); + map.put(KeyEvent.KEYCODE_DPAD_RIGHT, KEYCODE_RIGHT); + map.put(KeyEvent.KEYCODE_DPAD_LEFT, KEYCODE_LEFT); + //map.put(??, KEYCODE_INSERT); + //map.put(??, KEYCODE_HOME); + //map.put(??, KEYCODE_END); + //map.put(??, KEYCODE_PAGEUP); + //map.put(??, KEYCODE_PAGEDOWN); + //map.put(??, KEYCODE_F{1-15}); + map.put(KeyEvent.KEYCODE_NUM, KEYCODE_NUMLOCK); + //map.put(??, KEYCODE_CAPSLOCK); + //map.put(??, KEYCODE_SCROLLLOCK); + map.put(KeyEvent.KEYCODE_SHIFT_RIGHT, KEYCODE_RSHIFT); + map.put(KeyEvent.KEYCODE_SHIFT_LEFT, KEYCODE_LSHIFT); + //map.put(??, KEYCODE_RCTRL); + //map.put(??, KEYCODE_LCTRL); + map.put(KeyEvent.KEYCODE_ALT_RIGHT, KEYCODE_RALT); + map.put(KeyEvent.KEYCODE_ALT_LEFT, KEYCODE_LALT); + // ?? META, SUPER + // ?? MODE, COMPOSE + // ?? HELP, PRINT, SYSREQ, BREAK, EURO, UNDO + map.put(KeyEvent.KEYCODE_MENU, KEYCODE_MENU); + map.put(KeyEvent.KEYCODE_POWER, KEYCODE_POWER); + + androidKeyMap = Collections.unmodifiableMap(map); + } + + public int type; + public boolean synthetic; + public int kbd_keycode; + public int kbd_ascii; + public int kbd_flags; + public int mouse_x; + public int mouse_y; + public boolean mouse_relative; // Used for trackball events + + public Event() { + type = EVENT_INVALID; + synthetic = false; + } + + public Event(int type) { + this.type = type; + synthetic = false; + } + + public static Event KeyboardEvent(int type, int keycode, int ascii, + int flags) { + Event e = new Event(); + e.type = type; + e.kbd_keycode = keycode; + e.kbd_ascii = ascii; + e.kbd_flags = flags; + return e; + } + + public static Event MouseEvent(int type, int x, int y) { + Event e = new Event(); + e.type = type; + e.mouse_x = x; + e.mouse_y = y; + return e; + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java new file mode 100644 index 0000000000..b4035a296b --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java @@ -0,0 +1,52 @@ +package org.inodes.gus.scummvm; + +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; + +import java.util.ArrayList; + +public class PluginProvider extends BroadcastReceiver { + public final static String META_UNPACK_LIB = + "org.inodes.gus.scummvm.meta.UNPACK_LIB"; + + public void onReceive(Context context, Intent intent) { + if (!intent.getAction().equals(ScummVMApplication.ACTION_PLUGIN_QUERY)) + return; + + Bundle extras = getResultExtras(true); + + final ActivityInfo info; + try { + info = context.getPackageManager() + .getReceiverInfo(new ComponentName(context, this.getClass()), + PackageManager.GET_META_DATA); + } catch (PackageManager.NameNotFoundException e) { + Log.e(this.toString(), "Error finding my own info?", e); + return; + } + + String mylib = info.metaData.getString(META_UNPACK_LIB); + if (mylib != null) { + ArrayList all_libs = + extras.getStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS); + + all_libs.add(new Uri.Builder() + .scheme("plugin") + .authority(context.getPackageName()) + .path(mylib) + .toString()); + + extras.putStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS, + all_libs); + } + + setResultExtras(extras); + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java new file mode 100644 index 0000000000..bc0c5ef408 --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -0,0 +1,317 @@ +package org.inodes.gus.scummvm; + +import android.content.Context; +import android.content.res.AssetManager; +import android.media.AudioFormat; +import android.media.AudioManager; +import android.media.AudioTrack; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Process; +import android.util.Log; +import android.view.Surface; +import android.view.SurfaceHolder; + +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.egl.EGLContext; +import javax.microedition.khronos.egl.EGLDisplay; +import javax.microedition.khronos.egl.EGLSurface; + +import java.io.File; +import java.util.concurrent.Semaphore; + + +// At least in Android 2.1, eglCreateWindowSurface() requires an +// EGLNativeWindowSurface object, which is hidden deep in the bowels +// of libui. Until EGL is properly exposed, it's probably safer to +// use the Java versions of most EGL functions :( + +public class ScummVM implements SurfaceHolder.Callback { + private final static String LOG_TAG = "ScummVM.java"; + + private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo + public static class AudioSetupException extends Exception {} + + private long nativeScummVM; // native code hangs itself here + boolean scummVMRunning = false; + + private native void create(AssetManager am); + + public ScummVM(Context context) { + create(context.getAssets()); // Init C++ code, set nativeScummVM + } + + private native void nativeDestroy(); + + public synchronized void destroy() { + if (nativeScummVM != 0) { + nativeDestroy(); + nativeScummVM = 0; + } + } + protected void finalize() { + destroy(); + } + + // Surface creation: + // GUI thread: create surface, release lock + // ScummVM thread: acquire lock (block), read surface + // + // Surface deletion: + // GUI thread: post event, acquire lock (block), return + // ScummVM thread: read event, free surface, release lock + // + // In other words, ScummVM thread does this: + // acquire lock + // setup surface + // when SCREEN_CHANGED arrives: + // destroy surface + // release lock + // back to acquire lock + static final int configSpec[] = { + EGL10.EGL_RED_SIZE, 5, + EGL10.EGL_GREEN_SIZE, 5, + EGL10.EGL_BLUE_SIZE, 5, + EGL10.EGL_DEPTH_SIZE, 0, + EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT, + EGL10.EGL_NONE, + }; + EGL10 egl; + EGLDisplay eglDisplay = EGL10.EGL_NO_DISPLAY; + EGLConfig eglConfig; + EGLContext eglContext = EGL10.EGL_NO_CONTEXT; + EGLSurface eglSurface = EGL10.EGL_NO_SURFACE; + Semaphore surfaceLock = new Semaphore(0, true); + SurfaceHolder nativeSurface; + + public void surfaceCreated(SurfaceHolder holder) { + nativeSurface = holder; + surfaceLock.release(); + } + + public void surfaceChanged(SurfaceHolder holder, int format, + int width, int height) { + // Disabled while I debug GL problems + //pushEvent(new Event(Event.EVENT_SCREEN_CHANGED)); + } + + public void surfaceDestroyed(SurfaceHolder holder) { + pushEvent(new Event(Event.EVENT_SCREEN_CHANGED)); + try { + surfaceLock.acquire(); + } catch (InterruptedException e) { + Log.e(this.toString(), + "Interrupted while waiting for surface lock", e); + } + } + + // Called by ScummVM thread (from initBackend) + private void createScummVMGLContext() { + egl = (EGL10)EGLContext.getEGL(); + eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); + int[] version = new int[2]; + egl.eglInitialize(eglDisplay, version); + int[] num_config = new int[1]; + egl.eglChooseConfig(eglDisplay, configSpec, null, 0, num_config); + + final int numConfigs = num_config[0]; + if (numConfigs <= 0) + throw new IllegalArgumentException("No configs match configSpec"); + + EGLConfig[] configs = new EGLConfig[numConfigs]; + egl.eglChooseConfig(eglDisplay, configSpec, configs, numConfigs, + num_config); + eglConfig = configs[0]; + + eglContext = egl.eglCreateContext(eglDisplay, eglConfig, + EGL10.EGL_NO_CONTEXT, null); + } + + // Called by ScummVM thread + protected void setupScummVMSurface() { + try { + surfaceLock.acquire(); + } catch (InterruptedException e) { + Log.e(this.toString(), + "Interrupted while waiting for surface lock", e); + return; + } + eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, + nativeSurface, null); + egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); + } + + // Called by ScummVM thread + protected void destroyScummVMSurface() { + if (eglSurface != null) { + egl.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, + EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); + egl.eglDestroySurface(eglDisplay, eglSurface); + eglSurface = EGL10.EGL_NO_SURFACE; + } + + surfaceLock.release(); + } + + public void setSurface(SurfaceHolder holder) { + holder.addCallback(this); + } + + // Set scummvm config options + final public native static void loadConfigFile(String path); + final public native static void setConfMan(String key, int value); + final public native static void setConfMan(String key, String value); + + // Feed an event to ScummVM. Safe to call from other threads. + final public native void pushEvent(Event e); + + final private native void audioMixCallback(byte[] buf); + + // Runs the actual ScummVM program and returns when it does. + // This should not be called from multiple threads simultaneously... + final public native int scummVMMain(String[] argv); + + // Callbacks from C++ peer instance + //protected GraphicsMode[] getSupportedGraphicsModes() {} + protected void displayMessageOnOSD(String msg) {} + protected void setWindowCaption(String caption) {} + protected void showVirtualKeyboard(boolean enable) {} + protected String[] getSysArchives() { return new String[0]; } + protected String[] getPluginDirectories() { return new String[0]; } + protected void initBackend() throws AudioSetupException { + createScummVMGLContext(); + initAudio(); + } + + private static class AudioThread extends Thread { + final private int buf_size; + private boolean is_paused = false; + final private ScummVM scummvm; + final private AudioTrack audio_track; + + AudioThread(ScummVM scummvm, AudioTrack audio_track, int buf_size) { + super("AudioThread"); + this.scummvm = scummvm; + this.audio_track = audio_track; + this.buf_size = buf_size; + setPriority(Thread.MAX_PRIORITY); + setDaemon(true); + } + + public void pauseAudio() { + synchronized (this) { + is_paused = true; + } + audio_track.pause(); + } + + public void resumeAudio() { + synchronized (this) { + is_paused = false; + notifyAll(); + } + audio_track.play(); + } + + public void run() { + byte[] buf = new byte[buf_size]; + audio_track.play(); + int offset = 0; + try { + while (true) { + synchronized (this) { + while (is_paused) + wait(); + } + + if (offset == buf.length) { + // Grab new audio data + scummvm.audioMixCallback(buf); + offset = 0; + } + int len = buf.length - offset; + int ret = audio_track.write(buf, offset, len); + if (ret < 0) { + Log.w(LOG_TAG, String.format( + "AudioTrack.write(%dB) returned error %d", + buf.length, ret)); + break; + } else if (ret != len) { + Log.w(LOG_TAG, String.format( + "Short audio write. Wrote %dB, not %dB", + ret, buf.length)); + // Buffer is full, so yield cpu for a while + Thread.sleep(100); + } + offset += ret; + } + } catch (InterruptedException e) { + Log.e(this.toString(), "Audio thread interrupted", e); + } + } + } + private AudioThread audio_thread; + + final public int audioSampleRate() { + return AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC); + } + + private void initAudio() throws AudioSetupException { + int sample_rate = audioSampleRate(); + int buf_size = + AudioTrack.getMinBufferSize(sample_rate, + AudioFormat.CHANNEL_CONFIGURATION_STEREO, + AudioFormat.ENCODING_PCM_16BIT); + if (buf_size < 0) { + int guess = AUDIO_FRAME_SIZE * sample_rate / 100; // 10ms of audio + Log.w(LOG_TAG, String.format( + "Unable to get min audio buffer size (error %d). Guessing %dB.", + buf_size, guess)); + buf_size = guess; + } + Log.d(LOG_TAG, String.format("Using %dB buffer for %dHZ audio", + buf_size, sample_rate)); + AudioTrack audio_track = + new AudioTrack(AudioManager.STREAM_MUSIC, + sample_rate, + AudioFormat.CHANNEL_CONFIGURATION_STEREO, + AudioFormat.ENCODING_PCM_16BIT, + buf_size, + AudioTrack.MODE_STREAM); + if (audio_track.getState() != AudioTrack.STATE_INITIALIZED) { + Log.e(LOG_TAG, "Error initialising Android audio system."); + throw new AudioSetupException(); + } + + audio_thread = new AudioThread(this, audio_track, buf_size); + audio_thread.start(); + } + + public void pause() { + audio_thread.pauseAudio(); + // TODO: need to pause engine too + } + + public void resume() { + // TODO: need to resume engine too + audio_thread.resumeAudio(); + } + + static { + // For grabbing with gdb... + final boolean sleep_for_debugger = false; + if (sleep_for_debugger) { + try { + Thread.sleep(20*1000); + } catch (InterruptedException e) { + } + } + + //System.loadLibrary("scummvm"); + File cache_dir = ScummVMApplication.getLastCacheDir(); + String libname = System.mapLibraryName("scummvm"); + File libpath = new File(cache_dir, libname); + System.load(libpath.getPath()); + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java new file mode 100644 index 0000000000..29e1eba3d3 --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -0,0 +1,446 @@ +package org.inodes.gus.scummvm; + +import android.app.AlertDialog; +import android.app.Activity; +import android.content.DialogInterface; +import android.content.res.Configuration; +import android.media.AudioManager; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.inputmethod.InputMethodManager; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.SurfaceView; +import android.view.View; +import android.view.ViewConfiguration; +import android.widget.Toast; + +import java.io.IOException; + +public class ScummVMActivity extends Activity { + private boolean _do_right_click; + private boolean _last_click_was_right; + + // game pixels to move per trackball/dpad event. + // FIXME: replace this with proper mouse acceleration + private final static int TRACKBALL_SCALE = 2; + + private class MyScummVM extends ScummVM { + private boolean scummvmRunning = false; + + public MyScummVM() { + super(ScummVMActivity.this); + } + + @Override + protected void initBackend() throws ScummVM.AudioSetupException { + synchronized (this) { + scummvmRunning = true; + notifyAll(); + } + super.initBackend(); + } + + public void waitUntilRunning() throws InterruptedException { + synchronized (this) { + while (!scummvmRunning) + wait(); + } + } + + @Override + protected void displayMessageOnOSD(String msg) { + Log.i(this.toString(), "OSD: " + msg); + Toast.makeText(ScummVMActivity.this, msg, Toast.LENGTH_LONG).show(); + } + + @Override + protected void setWindowCaption(final String caption) { + runOnUiThread(new Runnable() { + public void run() { + setTitle(caption); + } + }); + } + + @Override + protected String[] getPluginDirectories() { + String[] dirs = new String[1]; + dirs[0] = ScummVMApplication.getLastCacheDir().getPath(); + return dirs; + } + + @Override + protected void showVirtualKeyboard(final boolean enable) { + if (getResources().getConfiguration().keyboard == + Configuration.KEYBOARD_NOKEYS) { + runOnUiThread(new Runnable() { + public void run() { + showKeyboard(enable); + } + }); + } + } + } + private MyScummVM scummvm; + private Thread scummvm_thread; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + _do_right_click = false; + setVolumeControlStream(AudioManager.STREAM_MUSIC); + + setContentView(R.layout.main); + takeKeyEvents(true); + + // This is a common enough error that we should warn about it + // explicitly. + if (!Environment.getExternalStorageDirectory().canRead()) { + new AlertDialog.Builder(this) + .setTitle(R.string.no_sdcard_title) + .setIcon(android.R.drawable.ic_dialog_alert) + .setMessage(R.string.no_sdcard) + .setNegativeButton(R.string.quit, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + finish(); + } + }) + .show(); + return; + } + + SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface); + main_surface.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + return onTouchEvent(event); + } + }); + main_surface.setOnKeyListener(new View.OnKeyListener() { + public boolean onKey(View v, int code, KeyEvent ev) { + return onKeyDown(code, ev); + } + }); + main_surface.requestFocus(); + + // Start ScummVM + scummvm = new MyScummVM(); + scummvm_thread = new Thread(new Runnable() { + public void run() { + try { + runScummVM(); + } catch (Exception e) { + Log.e("ScummVM", "Fatal error in ScummVM thread", e); + new AlertDialog.Builder(ScummVMActivity.this) + .setTitle("Error") + .setMessage(e.toString()) + .setIcon(android.R.drawable.ic_dialog_alert) + .show(); + finish(); + } + } + }, "ScummVM"); + scummvm_thread.start(); + + // Block UI thread until ScummVM has started. In particular, + // this means that surface and event callbacks should be safe + // after this point. + try { + scummvm.waitUntilRunning(); + } catch (InterruptedException e) { + Log.e(this.toString(), + "Interrupted while waiting for ScummVM.initBackend", e); + finish(); + } + + scummvm.setSurface(main_surface.getHolder()); + } + + // Runs in another thread + private void runScummVM() throws IOException { + getFilesDir().mkdirs(); + String[] args = { + "ScummVM-lib", + "--config=" + getFileStreamPath("scummvmrc").getPath(), + "--path=" + Environment.getExternalStorageDirectory().getPath(), + "--gui-theme=scummmodern", + "--savepath=" + getDir("saves", 0).getPath(), + }; + + int ret = scummvm.scummVMMain(args); + + // On exit, tear everything down for a fresh + // restart next time. + System.exit(ret); + } + + private boolean was_paused = false; + + @Override + public void onPause() { + if (scummvm != null) { + was_paused = true; + scummvm.pause(); + } + super.onPause(); + } + + @Override + public void onResume() { + super.onResume(); + if (scummvm != null && was_paused) + scummvm.resume(); + was_paused = false; + } + + @Override + public void onStop() { + if (scummvm != null) { + scummvm.pushEvent(new Event(Event.EVENT_QUIT)); + try { + scummvm_thread.join(1000); // 1s timeout + } catch (InterruptedException e) { + Log.i(this.toString(), + "Error while joining ScummVM thread", e); + } + } + super.onStop(); + } + + static final int MSG_MENU_LONG_PRESS = 1; + private final Handler keycodeMenuTimeoutHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + if (msg.what == MSG_MENU_LONG_PRESS) { + InputMethodManager imm = (InputMethodManager) + getSystemService(INPUT_METHOD_SERVICE); + if (imm != null) + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + } + }; + + @Override + public boolean onKeyUp(int keyCode, KeyEvent kevent) { + return onKeyDown(keyCode, kevent); + } + + @Override + public boolean onKeyMultiple(int keyCode, int repeatCount, + KeyEvent kevent) { + return onKeyDown(keyCode, kevent); + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent kevent) { + // Filter out "special" keys + switch (keyCode) { + case KeyEvent.KEYCODE_MENU: + // Have to reimplement hold-down-menu-brings-up-softkeybd + // ourselves, since we are otherwise hijacking the menu + // key :( + // See com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel() + // for the usual Android implementation of this feature. + if (kevent.getRepeatCount() > 0) + // Ignore keyrepeat for menu + return false; + boolean timeout_fired = false; + if (getResources().getConfiguration().keyboard == + Configuration.KEYBOARD_NOKEYS) { + timeout_fired = !keycodeMenuTimeoutHandler.hasMessages(MSG_MENU_LONG_PRESS); + keycodeMenuTimeoutHandler.removeMessages(MSG_MENU_LONG_PRESS); + if (kevent.getAction() == KeyEvent.ACTION_DOWN) { + keycodeMenuTimeoutHandler.sendMessageDelayed( + keycodeMenuTimeoutHandler.obtainMessage(MSG_MENU_LONG_PRESS), + ViewConfiguration.getLongPressTimeout()); + return true; + } + } + if (kevent.getAction() == KeyEvent.ACTION_UP) { + if (!timeout_fired) + scummvm.pushEvent(new Event(Event.EVENT_MAINMENU)); + return true; + } + return false; + case KeyEvent.KEYCODE_CAMERA: + case KeyEvent.KEYCODE_SEARCH: + _do_right_click = (kevent.getAction() == KeyEvent.ACTION_DOWN); + return true; + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_DPAD_UP: + case KeyEvent.KEYCODE_DPAD_DOWN: + case KeyEvent.KEYCODE_DPAD_LEFT: + case KeyEvent.KEYCODE_DPAD_RIGHT: { + // HTC Hero doesn't seem to generate + // MotionEvent.ACTION_DOWN events on trackball press :( + // We'll have to just fake one here. + // Some other handsets lack a trackball, so the DPAD is + // the only way of moving the cursor. + int motion_action; + // FIXME: this logic is a mess. + if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { + switch (kevent.getAction()) { + case KeyEvent.ACTION_DOWN: + motion_action = MotionEvent.ACTION_DOWN; + break; + case KeyEvent.ACTION_UP: + motion_action = MotionEvent.ACTION_UP; + break; + default: // ACTION_MULTIPLE + return false; + } + } else + motion_action = MotionEvent.ACTION_MOVE; + + Event e = new Event(getEventType(motion_action)); + e.mouse_x = 0; + e.mouse_y = 0; + e.mouse_relative = true; + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_UP: + e.mouse_y = -TRACKBALL_SCALE; + break; + case KeyEvent.KEYCODE_DPAD_DOWN: + e.mouse_y = TRACKBALL_SCALE; + break; + case KeyEvent.KEYCODE_DPAD_LEFT: + e.mouse_x = -TRACKBALL_SCALE; + break; + case KeyEvent.KEYCODE_DPAD_RIGHT: + e.mouse_x = TRACKBALL_SCALE; + break; + } + scummvm.pushEvent(e); + return true; + } + case KeyEvent.KEYCODE_BACK: + // skip isSystem() check and fall through to main code + break; + default: + if (kevent.isSystem()) + return false; + } + + // FIXME: what do I need to do for composed characters? + + Event e = new Event(); + + switch (kevent.getAction()) { + case KeyEvent.ACTION_DOWN: + e.type = Event.EVENT_KEYDOWN; + e.synthetic = false; + break; + case KeyEvent.ACTION_UP: + e.type = Event.EVENT_KEYUP; + e.synthetic = false; + break; + case KeyEvent.ACTION_MULTIPLE: + // e.type is handled below + e.synthetic = true; + break; + default: + return false; + } + + e.kbd_keycode = Event.androidKeyMap.containsKey(keyCode) ? + Event.androidKeyMap.get(keyCode) : Event.KEYCODE_INVALID; + e.kbd_ascii = kevent.getUnicodeChar(); + if (e.kbd_ascii == 0) + e.kbd_ascii = e.kbd_keycode; // scummvm keycodes are mostly ascii + + + e.kbd_flags = 0; + if (kevent.isAltPressed()) + e.kbd_flags |= Event.KBD_ALT; + if (kevent.isSymPressed()) // no ctrl key in android, so use sym (?) + e.kbd_flags |= Event.KBD_CTRL; + if (kevent.isShiftPressed()) { + if (keyCode >= KeyEvent.KEYCODE_0 && + keyCode <= KeyEvent.KEYCODE_9) { + // Shift+number -> convert to F* key + int offset = keyCode == KeyEvent.KEYCODE_0 ? + 10 : keyCode - KeyEvent.KEYCODE_1; // turn 0 into 10 + e.kbd_keycode = Event.KEYCODE_F1 + offset; + e.kbd_ascii = Event.ASCII_F1 + offset; + } else + e.kbd_flags |= Event.KBD_SHIFT; + } + + if (kevent.getAction() == KeyEvent.ACTION_MULTIPLE) { + for (int i = 0; i <= kevent.getRepeatCount(); i++) { + e.type = Event.EVENT_KEYDOWN; + scummvm.pushEvent(e); + e.type = Event.EVENT_KEYUP; + scummvm.pushEvent(e); + } + } else + scummvm.pushEvent(e); + + return true; + } + + private int getEventType(int action) { + switch (action) { + case MotionEvent.ACTION_DOWN: + _last_click_was_right = _do_right_click; + return _last_click_was_right ? + Event.EVENT_RBUTTONDOWN : Event.EVENT_LBUTTONDOWN; + case MotionEvent.ACTION_UP: + return _last_click_was_right ? + Event.EVENT_RBUTTONUP : Event.EVENT_LBUTTONUP; + case MotionEvent.ACTION_MOVE: + return Event.EVENT_MOUSEMOVE; + default: + return Event.EVENT_INVALID; + } + } + + @Override + public boolean onTrackballEvent(MotionEvent event) { + int type = getEventType(event.getAction()); + if (type == Event.EVENT_INVALID) + return false; + + Event e = new Event(type); + e.mouse_x = + (int)(event.getX() * event.getXPrecision()) * TRACKBALL_SCALE; + e.mouse_y = + (int)(event.getY() * event.getYPrecision()) * TRACKBALL_SCALE; + e.mouse_relative = true; + scummvm.pushEvent(e); + + return true; + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + int type = getEventType(event.getAction()); + if (type == Event.EVENT_INVALID) + return false; + + Event e = new Event(type); + e.mouse_x = (int)event.getX(); + e.mouse_y = (int)event.getY(); + e.mouse_relative = false; + scummvm.pushEvent(e); + + return true; + } + + private void showKeyboard(boolean show) { + SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface); + InputMethodManager imm = (InputMethodManager) + getSystemService(INPUT_METHOD_SERVICE); + if (show) + imm.showSoftInput(main_surface, InputMethodManager.SHOW_IMPLICIT); + else + imm.hideSoftInputFromWindow(main_surface.getWindowToken(), + InputMethodManager.HIDE_IMPLICIT_ONLY); + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java new file mode 100644 index 0000000000..37a9d09e1a --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMApplication.java @@ -0,0 +1,29 @@ +package org.inodes.gus.scummvm; + +import android.app.Application; + +import java.io.File; + +public class ScummVMApplication extends Application { + public final static String ACTION_PLUGIN_QUERY = "org.inodes.gus.scummvm.action.PLUGIN_QUERY"; + public final static String EXTRA_UNPACK_LIBS = "org.inodes.gus.scummvm.extra.UNPACK_LIBS"; + + private static File cache_dir; + + @Override + public void onCreate() { + super.onCreate(); + // This is still on /data :( + cache_dir = getCacheDir(); + // This is mounted noexec :( + //cache_dir = new File(Environment.getExternalStorageDirectory(), + // "/.ScummVM.tmp"); + // This is owned by download manager and requires special + // permissions to access :( + //cache_dir = Environment.getDownloadCacheDirectory(); + } + + public static File getLastCacheDir() { + return cache_dir; + } +} diff --git a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java new file mode 100644 index 0000000000..efa3e1d2ef --- /dev/null +++ b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java @@ -0,0 +1,370 @@ +package org.inodes.gus.scummvm; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.ContextWrapper; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.widget.ProgressBar; + +import java.io.IOException; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipFile; +import java.util.zip.ZipEntry; + +public class Unpacker extends Activity { + private final static String META_NEXT_ACTIVITY = + "org.inodes.gus.unpacker.nextActivity"; + private ProgressBar mProgress; + private File mUnpackDest; // location to unpack into + private AsyncTask mUnpacker; + private final static int REQUEST_MARKET = 1; + + private static class UnpackJob { + public ZipFile zipfile; + public Set paths; + + public UnpackJob(ZipFile zipfile, Set paths) { + this.zipfile = zipfile; + this.paths = paths; + } + + public long UnpackSize() { + long size = 0; + for (String path: paths) { + ZipEntry entry = zipfile.getEntry(path); + if (entry != null) size += entry.getSize(); + } + return size; + } + } + + private class UnpackTask extends AsyncTask { + @Override + protected void onProgressUpdate(Integer... progress) { + mProgress.setIndeterminate(false); + mProgress.setMax(progress[1]); + mProgress.setProgress(progress[0]); + mProgress.postInvalidate(); + } + + @Override + protected void onPostExecute(Void result) { + Bundle md = getMetaData(); + String nextActivity = md.getString(META_NEXT_ACTIVITY); + if (nextActivity != null) { + final ComponentName cn = + ComponentName.unflattenFromString(nextActivity); + if (cn != null) { + final Intent origIntent = getIntent(); + Intent intent = new Intent(); + intent.setPackage(origIntent.getPackage()); + intent.setComponent(cn); + if (origIntent.getExtras() != null) + intent.putExtras(origIntent.getExtras()); + intent.putExtra(Intent.EXTRA_INTENT, origIntent); + intent.setDataAndType(origIntent.getData(), + origIntent.getType()); + //intent.fillIn(getIntent(), 0); + intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); + Log.i(this.toString(), + "Starting next activity with intent " + intent); + startActivity(intent); + } else { + Log.w(this.toString(), + "Unable to extract a component name from " + nextActivity); + } + } + + finish(); + } + + @Override + protected Void doInBackground(String... all_libs) { + // This will contain all unpack jobs + Map unpack_jobs = + new HashMap(all_libs.length); + + // This will contain all unpack filenames (so we can + // detect stale files in the unpack directory) + Set all_files = new HashSet(all_libs.length); + + for (String lib: all_libs) { + final Uri uri = Uri.parse(lib); + final String pkg = uri.getAuthority(); + final String path = uri.getPath().substring(1); // skip first / + + all_files.add(new File(path).getName()); + + UnpackJob job = unpack_jobs.get(pkg); + if (job == null) { + try { + // getPackageResourcePath is hidden in Context, + // but exposed in ContextWrapper... + ContextWrapper context = + new ContextWrapper(createPackageContext(pkg, 0)); + ZipFile zipfile = + new ZipFile(context.getPackageResourcePath()); + job = new UnpackJob(zipfile, new HashSet(1)); + } catch (PackageManager.NameNotFoundException e) { + Log.e(this.toString(), "Package " + pkg + + " not found", e); + continue; + } catch (IOException e) { + // FIXME: show some sort of GUI error dialog + Log.e(this.toString(), + "Error opening ZIP for package " + pkg, e); + continue; + } + unpack_jobs.put(pkg, job); + } + job.paths.add(path); + } + + // Delete stale filenames from mUnpackDest + for (File file: mUnpackDest.listFiles()) { + if (!all_files.contains(file.getName())) { + Log.i(this.toString(), + "Deleting stale cached file " + file); + file.delete(); + } + } + + int total_size = 0; + for (UnpackJob job: unpack_jobs.values()) + total_size += job.UnpackSize(); + + publishProgress(0, total_size); + + mUnpackDest.mkdirs(); + + int progress = 0; + + for (UnpackJob job: unpack_jobs.values()) { + try { + ZipFile zipfile = job.zipfile; + for (String path: job.paths) { + ZipEntry zipentry = zipfile.getEntry(path); + if (zipentry == null) + throw new FileNotFoundException( + "Couldn't find " + path + " in zip"); + File dest = new File(mUnpackDest, new File(path).getName()); + if (dest.exists() && + dest.lastModified() == zipentry.getTime() && + dest.length() == zipentry.getSize()) { + // Already unpacked + progress += zipentry.getSize(); + } else { + if (dest.exists()) + Log.d(this.toString(), + "Replacing " + dest.getPath() + + " old.mtime=" + dest.lastModified() + + " new.mtime=" + zipentry.getTime() + + " old.size=" + dest.length() + + " new.size=" + zipentry.getSize()); + else + Log.i(this.toString(), + "Extracting " + zipentry.getName() + + " from " + zipfile.getName() + + " to " + dest.getPath()); + + long next_update = progress; + + InputStream in = zipfile.getInputStream(zipentry); + OutputStream out = new FileOutputStream(dest); + int len; + byte[] buffer = new byte[4096]; + while ((len = in.read(buffer)) != -1) { + out.write(buffer, 0, len); + progress += len; + if (progress >= next_update) { + publishProgress(progress, total_size); + // Arbitrary limit of 2% update steps + next_update += total_size / 50; + } + } + + in.close(); + out.close(); + dest.setLastModified(zipentry.getTime()); + } + publishProgress(progress, total_size); + } + + zipfile.close(); + } catch (IOException e) { + // FIXME: show some sort of GUI error dialog + Log.e(this.toString(), "Error unpacking plugin", e); + } + } + + if (progress != total_size) + Log.d(this.toString(), "Ended with progress " + progress + + " != total size " + total_size); + + setResult(RESULT_OK); + + return null; + } + } + + private class PluginBroadcastReciever extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + if (!intent.getAction() + .equals(ScummVMApplication.ACTION_PLUGIN_QUERY)) { + Log.e(this.toString(), + "Received unexpected action " + intent.getAction()); + return; + } + + Bundle extras = getResultExtras(false); + if (extras == null) { + // Nothing for us to do. + Unpacker.this.setResult(RESULT_OK); + finish(); + } + + ArrayList unpack_libs = + extras.getStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS); + + if (unpack_libs != null && !unpack_libs.isEmpty()) { + final String[] libs = + unpack_libs.toArray(new String[unpack_libs.size()]); + mUnpacker = new UnpackTask().execute(libs); + } + } + } + + private void initPlugins() { + Bundle extras = new Bundle(1); + + ArrayList unpack_libs = new ArrayList(1); + // This is the common ScummVM code (not really a "plugin" as such) + unpack_libs.add(new Uri.Builder() + .scheme("plugin") + .authority(getPackageName()) + .path("mylib/armeabi/libscummvm.so") + .toString()); + extras.putStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS, + unpack_libs); + + Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY); + sendOrderedBroadcast(intent, Manifest.permission.SCUMMVM_PLUGIN, + new PluginBroadcastReciever(), + null, RESULT_OK, null, extras); + } + + @Override + public void onCreate(Bundle b) { + super.onCreate(b); + + mUnpackDest = ScummVMApplication.getLastCacheDir(); + + setContentView(R.layout.splash); + mProgress = (ProgressBar)findViewById(R.id.progress); + + setResult(RESULT_CANCELED); + + tryUnpack(); + } + + private void tryUnpack() { + Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY); + List plugins = getPackageManager() + .queryBroadcastReceivers(intent, 0); + if (plugins.isEmpty()) { + // No plugins installed + AlertDialog.Builder alert = new AlertDialog.Builder(this) + .setTitle(R.string.no_plugins_title) + .setMessage(R.string.no_plugins_found) + .setIcon(android.R.drawable.ic_dialog_alert) + .setOnCancelListener(new DialogInterface.OnCancelListener() { + public void onCancel(DialogInterface dialog) { + finish(); + } + }) + .setNegativeButton(R.string.quit, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + finish(); + } + }); + + final Uri uri = Uri.parse("market://search?q=ScummVM plugin"); + final Intent market_intent = new Intent(Intent.ACTION_VIEW, uri); + if (getPackageManager().resolveActivity(market_intent, 0) != null) { + alert.setPositiveButton(R.string.to_market, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + dialog.dismiss(); + try { + startActivityForResult(market_intent, + REQUEST_MARKET); + } catch (ActivityNotFoundException e) { + Log.e(this.toString(), + "Error starting market", e); + } + } + }); + } + + alert.show(); + + } else { + // Already have at least one plugin installed + initPlugins(); + } + } + + @Override + public void onStop() { + if (mUnpacker != null) + mUnpacker.cancel(true); + super.onStop(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, + Intent data) { + switch (requestCode) { + case REQUEST_MARKET: + if (resultCode != RESULT_OK) + Log.w(this.toString(), "Market returned " + resultCode); + tryUnpack(); + break; + } + } + + private Bundle getMetaData() { + try { + ActivityInfo ai = getPackageManager() + .getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); + return ai.metaData; + } catch (PackageManager.NameNotFoundException e) { + Log.w(this.toString(), "Unable to find my own meta-data", e); + return new Bundle(); + } + } +} diff --git a/backends/platform/android/scummvm-android-themeengine.patch b/backends/platform/android/scummvm-android-themeengine.patch new file mode 100644 index 0000000000..1eafe7fb62 --- /dev/null +++ b/backends/platform/android/scummvm-android-themeengine.patch @@ -0,0 +1,135 @@ +diff -r 884e66fd1b9c gui/ThemeEngine.cpp +--- a/gui/ThemeEngine.cpp Tue Apr 13 09:30:52 2010 +1000 ++++ b/gui/ThemeEngine.cpp Fri May 28 23:24:43 2010 +1000 +@@ -390,21 +390,19 @@ + + // Try to create a Common::Archive with the files of the theme. + if (!_themeArchive && !_themeFile.empty()) { +- Common::FSNode node(_themeFile); +- if (node.getName().hasSuffix(".zip") && !node.isDirectory()) { ++ Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile); ++ if (member && member->getName().hasSuffix(".zip")) { + #ifdef USE_ZLIB +- Common::Archive *zipArchive = Common::makeZipArchive(node); ++ Common::Archive *zipArchive = Common::makeZipArchive(member->createReadStream()); + + if (!zipArchive) { +- warning("Failed to open Zip archive '%s'.", node.getPath().c_str()); ++ warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str()); + } + _themeArchive = zipArchive; + #else + warning("Trying to load theme '%s' in a Zip archive without zLib support", _themeFile.c_str()); + return false; + #endif +- } else if (node.isDirectory()) { +- _themeArchive = new Common::FSDirectory(node); + } + } + +@@ -1436,6 +1434,30 @@ + return tok.empty(); + } + ++bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName) { ++ Common::File stream; ++ bool foundHeader = false; ++ ++ if (member.getName().hasSuffix(".zip")) { ++#ifdef USE_ZLIB ++ Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream()); ++ ++ if (zipArchive && zipArchive->hasFile("THEMERC")) { ++ stream.open("THEMERC", *zipArchive); ++ } ++ ++ delete zipArchive; ++#endif ++ } ++ ++ if (stream.isOpen()) { ++ Common::String stxHeader = stream.readLine(); ++ foundHeader = themeConfigParseHeader(stxHeader, themeName); ++ } ++ ++ return foundHeader; ++} ++ + bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &themeName) { + Common::File stream; + bool foundHeader = false; +@@ -1493,10 +1515,6 @@ + if (ConfMan.hasKey("themepath")) + listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list); + +-#ifdef DATA_PATH +- listUsableThemes(Common::FSNode(DATA_PATH), list); +-#endif +- + #if defined(MACOSX) || defined(IPHONE) + CFURLRef resourceUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); + if (resourceUrl) { +@@ -1509,10 +1527,7 @@ + } + #endif + +- if (ConfMan.hasKey("extrapath")) +- listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list); +- +- listUsableThemes(Common::FSNode("."), list, 1); ++ listUsableThemes(SearchMan, list); + + // Now we need to strip all duplicates + // TODO: It might not be the best idea to strip duplicates. The user might +@@ -1531,6 +1546,34 @@ + output.clear(); + } + ++void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List &list) { ++ ThemeDescriptor td; ++ ++#ifdef USE_ZLIB ++ Common::ArchiveMemberList fileList; ++ archive.listMatchingMembers(fileList, "*.zip"); ++ for (Common::ArchiveMemberList::iterator i = fileList.begin(); ++ i != fileList.end(); ++i) { ++ td.name.clear(); ++ if (themeConfigUsable(**i, td.name)) { ++ td.filename = (*i)->getName(); ++ td.id = (*i)->getDisplayName(); ++ ++ // If the name of the node object also contains ++ // the ".zip" suffix, we will strip it. ++ if (td.id.hasSuffix(".zip")) { ++ for (int j = 0; j < 4; ++j) ++ td.id.deleteLastChar(); ++ } ++ ++ list.push_back(td); ++ } ++ } ++ ++ fileList.clear(); ++#endif ++} ++ + void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List &list, int depth) { + if (!node.exists() || !node.isReadable() || !node.isDirectory()) + return; +diff -r 884e66fd1b9c gui/ThemeEngine.h +--- a/gui/ThemeEngine.h Tue Apr 13 09:30:52 2010 +1000 ++++ b/gui/ThemeEngine.h Fri May 28 23:24:43 2010 +1000 +@@ -560,11 +560,13 @@ + static void listUsableThemes(Common::List &list); + private: + static bool themeConfigUsable(const Common::FSNode &node, Common::String &themeName); ++ static bool themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName); + static bool themeConfigParseHeader(Common::String header, Common::String &themeName); + + static Common::String getThemeFile(const Common::String &id); + static Common::String getThemeId(const Common::String &filename); + static void listUsableThemes(const Common::FSNode &node, Common::List &list, int depth = -1); ++ static void listUsableThemes(Common::Archive &archive, Common::List &list); + + protected: + OSystem *_system; /** Global system object. */ -- cgit v1.2.3 From 4667907b5cf9da3336352053b16b84484adf0393 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 6 Jun 2010 13:35:08 +0000 Subject: whitespace corrections svn-id: r49453 --- backends/platform/android/android.cpp | 6 +++--- .../platform/android/org/inodes/gus/scummvm/PluginProvider.java | 2 +- backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 2 +- .../platform/android/org/inodes/gus/scummvm/ScummVMActivity.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 76590ec823..a6258df554 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -703,10 +703,10 @@ void OSystem_Android::setPalette(const byte* colors, uint start, uint num) { palette += 3; colors += 4; } while (--num); -} - +} + void OSystem_Android::grabPalette(byte *colors, uint start, uint num) { - ENTER("grabPalette(%p, %u, %u)", colors, start, num); + ENTER("grabPalette(%p, %u, %u)", colors, start, num); const byte* palette = _game_texture->palette_const() + start*3; do { for (int i = 0; i < 3; ++i) diff --git a/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java index b4035a296b..840f3440d5 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java +++ b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java @@ -42,7 +42,7 @@ public class PluginProvider extends BroadcastReceiver { .authority(context.getPackageName()) .path(mylib) .toString()); - + extras.putStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS, all_libs); } diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index bc0c5ef408..f4dca0e7e5 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -42,7 +42,7 @@ public class ScummVM implements SurfaceHolder.Callback { create(context.getAssets()); // Init C++ code, set nativeScummVM } - private native void nativeDestroy(); + private native void nativeDestroy(); public synchronized void destroy() { if (nativeScummVM != 0) { diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java index 29e1eba3d3..fb3cd6348f 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -83,7 +83,7 @@ public class ScummVMActivity extends Activity { } }); } - } + } } private MyScummVM scummvm; private Thread scummvm_thread; @@ -353,7 +353,7 @@ public class ScummVMActivity extends Activity { e.kbd_ascii = kevent.getUnicodeChar(); if (e.kbd_ascii == 0) e.kbd_ascii = e.kbd_keycode; // scummvm keycodes are mostly ascii - + e.kbd_flags = 0; if (kevent.isAltPressed()) -- cgit v1.2.3 From 857f3ab550e015f9560bafa6bf080619216140fa Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 6 Jun 2010 14:17:37 +0000 Subject: PSP: faster way of getting file size svn-id: r49457 --- backends/fs/psp/psp-stream.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp index 9bcbe9d7cf..83ff095aa8 100644 --- a/backends/fs/psp/psp-stream.cpp +++ b/backends/fs/psp/psp-stream.cpp @@ -24,6 +24,8 @@ */ #ifdef __PSP__ +#include +#include #include #include @@ -106,10 +108,11 @@ void *PSPIoStream::open() { _handle = fopen(_path.c_str(), _writeMode ? "wb" : "rb"); // open if (_handle) { - // Get the file size - fseek((FILE *)_handle, 0, SEEK_END); // go to the end - _fileSize = ftell((FILE *)_handle); - fseek((FILE *)_handle, 0, SEEK_SET); // back to the beginning + // Get the file size. This way is much faster than going to the end of the file and back + SceIoStat stat; + sceIoGetstat(_path.c_str(), &stat); + _fileSize = *((uint32 *)(void *)&stat.st_size); // 4GB file is big enough for us + PSP_DEBUG_PRINT("%s filesize = %d\n", _path.c_str(), _fileSize); // Allocate the cache _cache = (char *)memalign(64, CACHE_SIZE); -- cgit v1.2.3 From 356728dab7f2c4cedf73684d7fe3b968be7396fd Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 7 Jun 2010 13:47:27 +0000 Subject: PSP: found bug in fast getMillis() implementation. Fixed it by adding a fixed amount to the time counter. svn-id: r49485 --- backends/platform/psp/osys_psp.cpp | 3 +-- backends/platform/psp/osys_psp.h | 2 ++ backends/platform/psp/thread.cpp | 41 +++++++++++++++++++++++++++++++++++--- backends/platform/psp/thread.h | 16 +++++++++++++-- 4 files changed, 55 insertions(+), 7 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index a36ae1847f..2043a4bef2 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -37,7 +37,6 @@ #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" #include "backends/platform/psp/powerman.h" -#include "backends/platform/psp/thread.h" #include "backends/saves/psp/psp-saves.h" #include "backends/timer/default/default-timer.h" @@ -300,7 +299,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { } uint32 OSystem_PSP::getMillis() { - return PspThread::getMillis(); + return _pspRtc.getMillis(); } void OSystem_PSP::delayMillis(uint msecs) { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 3f075d0139..a6c84ba39a 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -40,6 +40,7 @@ #include "backends/platform/psp/input.h" #include "backends/platform/psp/audio.h" #include "backends/timer/psp/timer.h" +#include "backends/platform/psp/thread.h" #include @@ -59,6 +60,7 @@ private: InputHandler _inputHandler; PspAudio _audio; PspTimer _pspTimer; + PspRtc _pspRtc; void initSDL(); diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index 88e7b6fe38..4e7d5eada9 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -29,6 +29,7 @@ #include #include "backends/platform/psp/thread.h" +#include "backends/platform/psp/trace.h" void PspThread::delayMillis(uint32 ms) { sceKernelDelayThread(ms * 1000); @@ -38,15 +39,49 @@ void PspThread::delayMicros(uint32 us) { sceKernelDelayThread(us); } -uint32 PspThread::getMillis() { +void PspRtc::init() { // init our starting ticks uint32 ticks[2]; sceRtcGetCurrentTick((u64 *)ticks); - return (ticks[0]/1000); + + _startMillis = ticks[0]/1000; + _startMicros = ticks[0]; + //_lastMillis = ticks[0]/1000; //debug - only when we don't subtract startMillis +} + +#define MS_LOOP_AROUND 4294967 /* We loop every 2^32 / 1000 = 71 minutes */ +#define MS_LOOP_CHECK 60000 /* Threading can cause weird mixups without this */ + +// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause +// unpredictable results +uint32 PspRtc::getMillis() { + uint32 ticks[2]; + + sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays + + uint32 millis = ticks[0]/1000; + millis -= _startMillis; // get ms since start of program + + if ((int)_lastMillis - (int)millis > MS_LOOP_CHECK) { // we must have looped around + if (_looped == false) { // check to make sure threads do this once + _looped = true; + _milliOffset += MS_LOOP_AROUND; // add the needed offset + PSP_DEBUG_PRINT("looping around. last ms[%d], curr ms[%d]\n", _lastMillis, millis); + } + } else { + _looped = false; + } + + _lastMillis = millis; + + return millis + _milliOffset; } -uint32 PspThread::getMicros() { +uint32 PspRtc::getMicros() { uint32 ticks[2]; + sceRtcGetCurrentTick((u64 *)ticks); + ticks[0] -= _startMicros; + return ticks[0]; } diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index e83eead68e..380159fa2d 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -32,8 +32,20 @@ class PspThread { public: static void delayMillis(uint32 ms); static void delayMicros(uint32 us); - static uint32 getMillis(); - static uint32 getMicros(); +}; + +class PspRtc { +private: + uint32 _startMillis; + uint32 _startMicros; + uint32 _lastMillis; + uint32 _milliOffset; // to prevent looping around of millis + bool _looped; // make sure we only loop once +public: + PspRtc() : _startMillis(0), _startMicros(0), _lastMillis(0), _milliOffset(0), _looped(false) { init(); } + void init(); + uint32 getMillis(); + uint32 getMicros(); }; enum ThreadPriority { -- cgit v1.2.3 From fb73cef4d9d481f616576a2779b53ea6c8c48b18 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 8 Jun 2010 13:15:15 +0000 Subject: Add a few files mistakenly left out of initial Android patch :( svn-id: r49502 --- backends/platform/android/video.cpp | 333 ++++++++++++++++++++++++++++++++++++ backends/platform/android/video.h | 140 +++++++++++++++ 2 files changed, 473 insertions(+) create mode 100644 backends/platform/android/video.cpp create mode 100644 backends/platform/android/video.h (limited to 'backends') diff --git a/backends/platform/android/video.cpp b/backends/platform/android/video.cpp new file mode 100644 index 0000000000..09d4dba154 --- /dev/null +++ b/backends/platform/android/video.cpp @@ -0,0 +1,333 @@ +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/null/null.cpp $ + * $Id: null.cpp 34912 2008-11-06 15:02:50Z fingolfin $ + * + */ + +#include "base/main.h" +#include "graphics/surface.h" + +#include +#include + +#include + +#include "common/rect.h" +#include "common/array.h" +#include "common/util.h" +#include "common/tokenizer.h" + +#include "backends/platform/android/video.h" + +#undef LOG_TAG +#define LOG_TAG "ScummVM-video" + +#if 0 +#define ENTER(args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, args) +#else +#define ENTER(args...) /**/ +#endif + +#if 1 +#define CHECK_GL_ERROR() checkGlError(__FILE__, __LINE__) +static const char* getGlErrStr(GLenum error) { + switch (error) { + case GL_NO_ERROR: return "GL_NO_ERROR"; + case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; + case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; + case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW"; + case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; + case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; + } + + static char buf[40]; + snprintf(buf, sizeof(buf), "(Unknown GL error code 0x%x)", error); + return buf; +} +static void checkGlError(const char* file, int line) { + GLenum error = glGetError(); + if (error != GL_NO_ERROR) + warning("%s:%d: GL error: %s", file, line, getGlErrStr(error)); +} +#else +#define CHECK_GL_ERROR() do {} while (false) +#endif + +// Supported GL extensions +static bool npot_supported = false; +#ifdef GL_OES_draw_texture +static bool draw_tex_supported = false; +#endif + +static inline GLfixed xdiv(int numerator, int denominator) { + assert(numerator < (1<<16)); + return (numerator << 16) / denominator; +} + +template +static T nextHigher2(T k) { + if (k == 0) + return 1; + --k; + for (uint i = 1; i < sizeof(T)*CHAR_BIT; i <<= 1) + k = k | k >> i; + return k + 1; +} + +void GLESTexture::initGLExtensions() { + const char* ext_string = + reinterpret_cast(glGetString(GL_EXTENSIONS)); + __android_log_print(ANDROID_LOG_INFO, LOG_TAG, + "Extensions: %s", ext_string); + Common::StringTokenizer tokenizer(ext_string, " "); + while (!tokenizer.empty()) { + Common::String token = tokenizer.nextToken(); + if (token == "GL_ARB_texture_non_power_of_two") + npot_supported = true; +#ifdef GL_OES_draw_texture + if (token == "GL_OES_draw_texture") + draw_tex_supported = true; +#endif + } +} + +GLESTexture::GLESTexture() : + _texture_width(0), + _texture_height(0), + _all_dirty(true) +{ + glGenTextures(1, &_texture_name); + // This all gets reset later in allocBuffer: + _surface.w = 0; + _surface.h = 0; + _surface.pitch = _texture_width; + _surface.pixels = NULL; + _surface.bytesPerPixel = 0; +} + +GLESTexture::~GLESTexture() { + debug("Destroying texture %u", _texture_name); + glDeleteTextures(1, &_texture_name); +} + +void GLESTexture::reinitGL() { + glGenTextures(1, &_texture_name); + setDirty(); +} + +void GLESTexture::allocBuffer(GLuint w, GLuint h) { + CHECK_GL_ERROR(); + int bpp = bytesPerPixel(); + _surface.w = w; + _surface.h = h; + _surface.bytesPerPixel = bpp; + + if (w <= _texture_width && h <= _texture_height) + // Already allocated a sufficiently large buffer + return; + + if (npot_supported) { + _texture_width = _surface.w; + _texture_height = _surface.h; + } else { + _texture_width = nextHigher2(_surface.w); + _texture_height = nextHigher2(_surface.h); + } + _surface.pitch = _texture_width * bpp; + + // Allocate room for the texture now, but pixel data gets uploaded + // later (perhaps with multiple TexSubImage2D operations). + CHECK_GL_ERROR(); + glBindTexture(GL_TEXTURE_2D, _texture_name); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + CHECK_GL_ERROR(); + glTexImage2D(GL_TEXTURE_2D, 0, glFormat(), + _texture_width, _texture_height, + 0, glFormat(), glType(), NULL); + CHECK_GL_ERROR(); +} + +void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, + const void* buf, int pitch) { + ENTER("updateBuffer(%u, %u, %u, %u, %p, %d)", x, y, w, h, buf, pitch); + glBindTexture(GL_TEXTURE_2D, _texture_name); + + if (static_cast(w) * bytesPerPixel() == pitch) { + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, + glFormat(), glType(), buf); + } else { + // GLES removed the ability to specify pitch, so we + // have to do this row by row. + int i = h; + const byte* src = static_cast(buf); + do { + glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, + w, 1, glFormat(), glType(), src); + ++y; + src += pitch; + } while (--i); + } + + setDirtyRect(Common::Rect(x, y, x+w, y+h)); +} + +void GLESTexture::fillBuffer(byte x) { + byte tmpbuf[_surface.h * _surface.w * bytesPerPixel()]; + memset(tmpbuf, 0, _surface.h * _surface.w * bytesPerPixel()); + glBindTexture(GL_TEXTURE_2D, _texture_name); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _surface.w, _surface.h, + glFormat(), glType(), tmpbuf); + setDirty(); +} + +void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { + glBindTexture(GL_TEXTURE_2D, _texture_name); + +#ifdef GL_OES_draw_texture + // Great extension, but only works under specific conditions. + // Still a work-in-progress - disabled for now. + if (false && draw_tex_supported && paletteSize() == 0) { + //glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + const GLint crop[4] = {0, _surface.h, _surface.w, -_surface.h}; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); + glDrawTexiOES(x, y, 0, w, h); + } else +#endif + { + const GLfixed tex_width = xdiv(_surface.w, _texture_width); + const GLfixed tex_height = xdiv(_surface.h, _texture_height); + const GLfixed texcoords[] = { + 0, 0, + tex_width, 0, + 0, tex_height, + tex_width, tex_height, + }; + glTexCoordPointer(2, GL_FIXED, 0, texcoords); + + const GLshort vertices[] = { + x, y, + x+w, y, + x, y+h, + x+w, y+h, + }; + glVertexPointer(2, GL_SHORT, 0, vertices); + + assert(ARRAYSIZE(vertices) == ARRAYSIZE(texcoords)); + glDrawArrays(GL_TRIANGLE_STRIP, 0, ARRAYSIZE(vertices)/2); + } + + _all_dirty = false; + _dirty_rect = Common::Rect(); +} + +GLESPaletteTexture::GLESPaletteTexture() : + GLESTexture(), + _texture(NULL) +{ +} + +GLESPaletteTexture::~GLESPaletteTexture() { + delete[] _texture; +} + +void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { + CHECK_GL_ERROR(); + int bpp = bytesPerPixel(); + _surface.w = w; + _surface.h = h; + _surface.bytesPerPixel = bpp; + + if (w <= _texture_width && h <= _texture_height) + // Already allocated a sufficiently large buffer + return; + + if (npot_supported) { + _texture_width = _surface.w; + _texture_height = _surface.h; + } else { + _texture_width = nextHigher2(_surface.w); + _texture_height = nextHigher2(_surface.h); + } + _surface.pitch = _texture_width * bpp; + + // Texture gets uploaded later (from drawTexture()) + + byte* new_buffer = new byte[paletteSize() + + _texture_width * _texture_height * bytesPerPixel()]; + if (_texture) { + memcpy(new_buffer, _texture, paletteSize()); // preserve palette + delete[] _texture; + } + _texture = new_buffer; + _surface.pixels = _texture + paletteSize(); +} + +void GLESPaletteTexture::fillBuffer(byte x) { + assert(_surface.pixels); + memset(_surface.pixels, x, _surface.pitch * _surface.h); + setDirty(); +} + +void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, + GLuint w, GLuint h, + const void* buf, int pitch) { + const byte* src = static_cast(buf); + byte* dst = static_cast(_surface.getBasePtr(x, y)); + do { + memcpy(dst, src, w * bytesPerPixel()); + dst += _surface.pitch; + src += pitch; + } while (--h); +} + +void GLESPaletteTexture::uploadTexture() const { + const size_t texture_size = + paletteSize() + _texture_width * _texture_height * bytesPerPixel(); + glCompressedTexImage2D(GL_TEXTURE_2D, 0, glType(), + _texture_width, _texture_height, + 0, texture_size, _texture); + CHECK_GL_ERROR(); +} + +void GLESPaletteTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { + if (_all_dirty) { + glBindTexture(GL_TEXTURE_2D, _texture_name); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + CHECK_GL_ERROR(); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + CHECK_GL_ERROR(); + uploadTexture(); + _all_dirty = false; + } + + GLESTexture::drawTexture(x, y, w, h); +} diff --git a/backends/platform/android/video.h b/backends/platform/android/video.h new file mode 100644 index 0000000000..ee707e4cb5 --- /dev/null +++ b/backends/platform/android/video.h @@ -0,0 +1,140 @@ +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/null/null.cpp $ + * $Id: null.cpp 34912 2008-11-06 15:02:50Z fingolfin $ + * + */ + +#if defined(ANDROID) + +#include + +#include "graphics/surface.h" + +#include "common/rect.h" +#include "common/array.h" + +class GLESTexture { +public: + static void initGLExtensions(); + + GLESTexture(); + virtual ~GLESTexture(); + virtual void reinitGL(); + virtual void allocBuffer(GLuint width, GLuint height); + const Graphics::Surface* surface_const() const { return &_surface; } + GLuint width() const { return _surface.w; } + GLuint height() const { return _surface.h; } + GLuint texture_name() const { return _texture_name; } + bool dirty() const { return _all_dirty || !_dirty_rect.isEmpty(); } + virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height, + const void* buf, int pitch); + virtual void fillBuffer(byte x); + virtual void drawTexture() { + drawTexture(0, 0, _surface.w, _surface.h); + } + virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); + +protected: + virtual byte bytesPerPixel() const = 0; + virtual GLenum glFormat() const = 0; + virtual GLenum glType() const = 0; + virtual size_t paletteSize() const { return 0; }; + void setDirty() { + _all_dirty = true; + _dirty_rect = Common::Rect(); + } + void setDirtyRect(const Common::Rect& r) { + if (!_all_dirty) { + if (_dirty_rect.isEmpty()) + _dirty_rect = r; + else + _dirty_rect.extend(r); + } + } + GLuint _texture_name; + Graphics::Surface _surface; + GLuint _texture_width; + GLuint _texture_height; + bool _all_dirty; + Common::Rect _dirty_rect; // Covers dirty area +}; + +// RGBA4444 texture +class GLES4444Texture : public GLESTexture { +protected: + virtual byte bytesPerPixel() const { return 2; } + virtual GLenum glFormat() const { return GL_RGBA; } + virtual GLenum glType() const { return GL_UNSIGNED_SHORT_4_4_4_4; } +}; + +// RGB565 texture +class GLES565Texture : public GLESTexture { +protected: + virtual byte bytesPerPixel() const { return 2; } + virtual GLenum glFormat() const { return GL_RGB; } + virtual GLenum glType() const { return GL_UNSIGNED_SHORT_5_6_5; } +}; + +// RGB888 256-entry paletted texture +class GLESPaletteTexture : public GLESTexture { +public: + GLESPaletteTexture(); + virtual ~GLESPaletteTexture(); + virtual void allocBuffer(GLuint width, GLuint height); + virtual void updateBuffer(GLuint x, GLuint y, GLuint width, GLuint height, + const void* buf, int pitch); + Graphics::Surface* surface() { + setDirty(); + return &_surface; + } + void* pixels() { + setDirty(); + return _surface.pixels; + } + const byte* palette_const() const { return _texture; }; + byte* palette() { + setDirty(); + return _texture; + }; + virtual void drawTexture() { + drawTexture(0, 0, _surface.w, _surface.h); + } + virtual void drawTexture(GLshort x, GLshort y, GLshort w, GLshort h); + virtual void fillBuffer(byte x); +protected: + virtual byte bytesPerPixel() const { return 1; } + virtual GLenum glFormat() const { return GL_RGB; } + virtual GLenum glType() const { return GL_PALETTE8_RGB8_OES; } + virtual size_t paletteSize() const { return 256 * 3; }; + virtual void uploadTexture() const; + byte* _texture; +}; + +// RGBA8888 256-entry paletted texture +class GLESPaletteATexture : public GLESPaletteTexture { +protected: + virtual GLenum glFormat() const { return GL_RGBA; } + virtual GLenum glType() const { return GL_PALETTE8_RGBA8_OES; } + virtual size_t paletteSize() const { return 256 * 4; }; +}; + +#endif -- cgit v1.2.3 From ec524e3705970a725c9dd1008fff97ccd7f1d250 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 8 Jun 2010 13:23:08 +0000 Subject: Remove obsolete ANDROID_VERSION_GE macro svn-id: r49505 --- backends/platform/android/android.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index a6258df554..f319e220cc 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -31,10 +31,6 @@ #if defined(ANDROID_BACKEND) -#define ANDROID_VERSION_GE(major,minor) \ - (ANDROID_MAJOR_VERSION > (major) || \ - (ANDROID_MAJOR_VERSION == (major) && ANDROID_MINOR_VERSION >= (minor))) - #include #include -- cgit v1.2.3 From d72ae64e3447ca01e308e61c320692463596fb0b Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 8 Jun 2010 13:25:00 +0000 Subject: Provide a replacement for bionic's __assert(). The usual Android version doesn't actually print the assert message before aborting. svn-id: r49506 --- backends/platform/android/android.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'backends') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index f319e220cc..5d78ead6be 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -74,6 +74,14 @@ #undef JNIEXPORT #define JNIEXPORT __attribute__ ((visibility("default"))) +// This replaces the bionic libc assert message with something that +// actually prints the assertion failure before aborting. +extern "C" +void __assert(const char *file, int line, const char *expr) { + __android_log_assert(expr, LOG_TAG, "%s:%d: Assertion failure: %s", + file, line, expr); +} + static JavaVM *cached_jvm; static jfieldID FID_Event_type; static jfieldID FID_Event_synthetic; -- cgit v1.2.3 From f6b02e9986ae8965034ffd1d2e0b895e7f115deb Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 8 Jun 2010 13:27:46 +0000 Subject: Whitespace fixup in last submit. I'll get the hang of this eventually :/ svn-id: r49507 --- backends/platform/android/android.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 5d78ead6be..7a8c976c82 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -78,8 +78,8 @@ // actually prints the assertion failure before aborting. extern "C" void __assert(const char *file, int line, const char *expr) { - __android_log_assert(expr, LOG_TAG, "%s:%d: Assertion failure: %s", - file, line, expr); + __android_log_assert(expr, LOG_TAG, "%s:%d: Assertion failure: %s", + file, line, expr); } static JavaVM *cached_jvm; -- cgit v1.2.3 From f770156dccff6ed5f1211cbe7676652897582ee9 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Wed, 9 Jun 2010 14:15:51 +0000 Subject: PSP: fixed missing frame issue with kyrandia and possibly other games by calling updateScreen() from pollEvent() once in a while svn-id: r49541 --- backends/platform/psp/display_manager.cpp | 11 +++++---- backends/platform/psp/display_manager.h | 8 +++---- backends/platform/psp/osys_psp.cpp | 37 +++++++++++++++++++++++++++++-- backends/platform/psp/osys_psp.h | 6 +++-- 4 files changed, 50 insertions(+), 12 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index c2f21e084b..5c9f8f92f0 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -311,25 +311,26 @@ void DisplayManager::calculateScaleParams() { } } -void DisplayManager::renderAll() { +// return true if we really rendered or no dirty. False otherwise +bool DisplayManager::renderAll() { DEBUG_ENTER_FUNC(); #ifdef USE_DISPLAY_CALLBACK if (!_masterGuRenderer.isRenderFinished()) { PSP_DEBUG_PRINT("Callback render not finished.\n"); - return; + return false; // didn't render } #endif /* USE_DISPLAY_CALLBACK */ if (!isTimeToUpdate()) - return; + return false; // didn't render if (!_screen->isDirty() && (!_overlay->isDirty()) && (!_cursor->isDirty()) && (!_keyboard->isDirty())) { PSP_DEBUG_PRINT("Nothing dirty\n"); - return; + return true; // nothing to render } PSP_DEBUG_PRINT("screen[%s], overlay[%s], cursor[%s], keyboard[%s]\n", @@ -361,6 +362,8 @@ void DisplayManager::renderAll() { _keyboard->setClean(); _masterGuRenderer.guPostRender(); + + return true; // rendered successfully } inline bool DisplayManager::isTimeToUpdate() { diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h index 5864f39b36..bceb85703d 100644 --- a/backends/platform/psp/display_manager.h +++ b/backends/platform/psp/display_manager.h @@ -40,12 +40,12 @@ public: void setupCallbackThread(); private: static uint32 _displayList[]; - uint32 _lastRenderTime; // For measuring rendering + uint32 _lastRenderTime; // For measuring rendering time void guProgramDisplayBufferSizes(); static int guCallbackThread(SceSize, void *); // for the graphics callbacks static int guCallback(int, int, void *__this); - bool _renderFinished; - int _callbackId; + bool _renderFinished; // for sync with render callback + int _callbackId; // to keep track of render callback }; class Screen; @@ -68,7 +68,7 @@ public: ~DisplayManager(); void init(); - void renderAll(); + bool renderAll(); // return true if rendered or nothing dirty. False otherwise bool setGraphicsMode(int mode); bool setGraphicsMode(const char *name); int getGraphicsMode() const { return _graphicsMode; } diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 2043a4bef2..48e9044535 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -127,11 +127,13 @@ int OSystem_PSP::getDefaultGraphicsMode() const { bool OSystem_PSP::setGraphicsMode(int mode) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; return _displayManager.setGraphicsMode(mode); } bool OSystem_PSP::setGraphicsMode(const char *name) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; return _displayManager.setGraphicsMode(name); } @@ -154,6 +156,7 @@ Common::List OSystem_PSP::getSupportedFormats() { void OSystem_PSP::initSize(uint width, uint height, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _displayManager.setSizeAndPixelFormat(width, height, format); _cursor.setVisible(false); @@ -172,6 +175,7 @@ int16 OSystem_PSP::getHeight() { void OSystem_PSP::setPalette(const byte *colors, uint start, uint num) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _screen.setPartialPalette(colors, start, num); _cursor.setScreenPalette(colors, start, num); _cursor.clearKeyColor(); @@ -179,6 +183,7 @@ void OSystem_PSP::setPalette(const byte *colors, uint start, uint num) { void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _cursor.setCursorPalette(colors, start, num); _cursor.enableCursorPalette(true); _cursor.clearKeyColor(); // Do we need this? @@ -186,37 +191,43 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) { 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(); + _pendingUpdate = false; _screen.copyFromRect(buf, pitch, x, y, w, h); } Graphics::Surface *OSystem_PSP::lockScreen() { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; return _screen.lockAndGetForEditing(); } void OSystem_PSP::unlockScreen() { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; // The screen is always completely updated anyway, so we don't have to force a full update here. _screen.unlock(); } void OSystem_PSP::updateScreen() { DEBUG_ENTER_FUNC(); - _displayManager.renderAll(); + _pendingUpdate = !_displayManager.renderAll(); // if we didn't update, we have a pending update } void OSystem_PSP::setShakePos(int shakeOffset) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _screen.setShakePos(shakeOffset); } void OSystem_PSP::showOverlay() { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _overlay.setVisible(true); _cursor.setLimits(_overlay.getWidth(), _overlay.getHeight()); _cursor.useGlobalScaler(false); // mouse with overlay is 1:1 @@ -224,6 +235,7 @@ void OSystem_PSP::showOverlay() { void OSystem_PSP::hideOverlay() { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _overlay.setVisible(false); _cursor.setLimits(_screen.getWidth(), _screen.getHeight()); _cursor.useGlobalScaler(true); // mouse needs to be scaled with screen @@ -231,6 +243,7 @@ void OSystem_PSP::hideOverlay() { void OSystem_PSP::clearOverlay() { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _overlay.clearBuffer(); } @@ -241,6 +254,7 @@ void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) { void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _overlay.copyFromRect(buf, pitch, x, y, w, h); } @@ -259,6 +273,8 @@ void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) { bool OSystem_PSP::showMouse(bool v) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; + PSP_DEBUG_PRINT("%s\n", v ? "true" : "false"); bool last = _cursor.isVisible(); _cursor.setVisible(v); @@ -268,11 +284,14 @@ bool OSystem_PSP::showMouse(bool v) { void OSystem_PSP::warpMouse(int x, int y) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; _cursor.setXY(x, y); } void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); + _pendingUpdate = false; + PSP_DEBUG_PRINT("pbuf[%p], w[%u], h[%u], hotspot:X[%d], Y[%d], keycolor[%d], scale[%d], pformat[%p]\n", buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format); if (format) { PSP_DEBUG_PRINT("format: bpp[%d], rLoss[%d], gLoss[%d], bLoss[%d], aLoss[%d], rShift[%d], gShift[%d], bShift[%d], aShift[%d]\n", format->bytesPerPixel, format->rLoss, format->gLoss, format->bLoss, format->aLoss, format->rShift, format->gShift, format->bShift, format->aShift); @@ -292,9 +311,23 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { // Pausing the engine is a necessary fix for games that use the timer for music synchronization // recovering many hours later causes the game to crash. We're polling without mutexes since it's not critical to // get it right now. - PowerMan.pollPauseEngine(); + // A hack: + // Check if we have a pending update that we missed for some reason (FPS throttling for example) + // Time between event polls is usually 5-10ms, so waiting for 4 calls before checking to update the screen should be fine + if (_pendingUpdate) { + _pendingUpdateCounter++; + + if (_pendingUpdateCounter >= 4) { + PSP_DEBUG_PRINT("servicing pending update\n"); + updateScreen(); + if (!_pendingUpdate) // we handled the update + _pendingUpdateCounter = 0; + } + } else + _pendingUpdateCounter = 0; // reset the counter, no pending + return _inputHandler.getAllInputs(event); } diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index a6c84ba39a..d8ec8fe824 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -50,6 +50,8 @@ 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 // All needed sub-members Screen _screen; @@ -62,10 +64,10 @@ private: PspTimer _pspTimer; PspRtc _pspRtc; - void initSDL(); + void initSDL(); public: - OSystem_PSP() : _savefile(0), _mixer(0), _timer(0) {} + OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {} ~OSystem_PSP(); static OSystem *instance(); -- cgit v1.2.3 From d8050029f9940ec7abe0a3868f17e55319bad9c3 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Wed, 9 Jun 2010 21:30:06 +0000 Subject: Improve build instructions to include themeengine patch and scummmodern.zip compression. svn-id: r49551 --- backends/platform/android/README.build | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backends') diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build index fa56bfc180..a834f8431b 100644 --- a/backends/platform/android/README.build +++ b/backends/platform/android/README.build @@ -63,6 +63,18 @@ toolchains around. Building ScummVM ================ +Apply the theme engine patch: + + patch -p1 < backends/platform/android/scummvm-android-themeengine.patch + +(Optionally) compress scummmodern.zip: +(ScummVM usually ships it uncompressed, but Android can read it more +efficiently if it is compressed *before* adding it to the apk) + + ( cd gui/themes/scummmodern && zip -f ../scummmodern.zip ) + +Then build ScummVM: + export ANDROID_SDK= PATH=$ANDROID_SDK/platforms/android-1.6/tools:$ANDROID_SDK/tools:$PATH -- cgit v1.2.3 From d44efa817fd997f336ac83f0490212fb21e9bf02 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Wed, 9 Jun 2010 21:31:48 +0000 Subject: Fix dirty tracking in paletted textures. svn-id: r49552 --- backends/platform/android/video.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/video.cpp b/backends/platform/android/video.cpp index 09d4dba154..5d16410cea 100644 --- a/backends/platform/android/video.cpp +++ b/backends/platform/android/video.cpp @@ -178,23 +178,22 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, ENTER("updateBuffer(%u, %u, %u, %u, %p, %d)", x, y, w, h, buf, pitch); glBindTexture(GL_TEXTURE_2D, _texture_name); + setDirtyRect(Common::Rect(x, y, x+w, y+h)); + if (static_cast(w) * bytesPerPixel() == pitch) { glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, glFormat(), glType(), buf); } else { // GLES removed the ability to specify pitch, so we // have to do this row by row. - int i = h; const byte* src = static_cast(buf); do { glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, 1, glFormat(), glType(), src); ++y; src += pitch; - } while (--i); + } while (--h); } - - setDirtyRect(Common::Rect(x, y, x+w, y+h)); } void GLESTexture::fillBuffer(byte x) { @@ -297,6 +296,8 @@ void GLESPaletteTexture::fillBuffer(byte x) { void GLESPaletteTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, const void* buf, int pitch) { + _all_dirty = true; + const byte* src = static_cast(buf); byte* dst = static_cast(_surface.getBasePtr(x, y)); do { -- cgit v1.2.3 From c8ee854600710f36f09d8375fbe51e1924d97320 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Thu, 10 Jun 2010 13:41:29 +0000 Subject: PSP: switched to psp semaphores rather than SDL's. Removal of SDL is almost complete. svn-id: r49572 --- backends/platform/psp/osys_psp.cpp | 8 ++-- backends/platform/psp/thread.cpp | 84 ++++++++++++++++++++++++++++++++++++++ backends/platform/psp/thread.h | 27 ++++++++++++ 3 files changed, 115 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 48e9044535..b0fb971230 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -346,19 +346,19 @@ void OSystem_PSP::setTimerCallback(TimerProc callback, int interval) { } OSystem::MutexRef OSystem_PSP::createMutex(void) { - return (MutexRef)SDL_CreateMutex(); + return (MutexRef) new PspMutex(true); // start with a full mutex } void OSystem_PSP::lockMutex(MutexRef mutex) { - SDL_mutexP((SDL_mutex *)mutex); + ((PspMutex *)mutex)->lock(); } void OSystem_PSP::unlockMutex(MutexRef mutex) { - SDL_mutexV((SDL_mutex *)mutex); + ((PspMutex *)mutex)->unlock(); } void OSystem_PSP::deleteMutex(MutexRef mutex) { - SDL_DestroyMutex((SDL_mutex *)mutex); + delete (PspMutex *)mutex; } void OSystem_PSP::mixCallback(void *sys, byte *samples, int len) { diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index 4e7d5eada9..684a985fed 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -31,6 +31,8 @@ #include "backends/platform/psp/thread.h" #include "backends/platform/psp/trace.h" +// Class PspThread -------------------------------------------------- + void PspThread::delayMillis(uint32 ms) { sceKernelDelayThread(ms * 1000); } @@ -39,6 +41,88 @@ void PspThread::delayMicros(uint32 us) { sceKernelDelayThread(us); } +// Class PspSemaphore ------------------------------------------------ +//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ +//#define __PSP_DEBUG_PRINT__ /* For debug printouts */ + +#include "backends/platform/psp/trace.h" + +PspSemaphore::PspSemaphore(int initialValue, int maxValue) { + DEBUG_ENTER_FUNC(); + _handle = 0; + _handle = sceKernelCreateSema("ScummVM Sema", 0 /* attr */, + initialValue, maxValue, + 0 /*option*/); + if (!_handle) + PSP_ERROR("failed to create semaphore.\n"); +} + +PspSemaphore::~PspSemaphore() { + DEBUG_ENTER_FUNC(); + if (_handle) + if (sceKernelDeleteSema(_handle) < 0) + PSP_ERROR("failed to delete semaphore.\n"); +} + +int PspSemaphore::numOfWaitingThreads() { + DEBUG_ENTER_FUNC(); + SceKernelSemaInfo info; + info.numWaitThreads = 0; + + if (sceKernelReferSemaStatus(_handle, &info) < 0) + PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle); + + return info.numWaitThreads; +} + +int PspSemaphore::getValue() { + DEBUG_ENTER_FUNC(); + SceKernelSemaInfo info; + info.currentCount = 0; + + if (sceKernelReferSemaStatus(_handle, &info) < 0) + PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle); + + return info.currentCount; +} + +bool PspSemaphore::pollForValue(int value) { + DEBUG_ENTER_FUNC(); + if (sceKernelPollSema(_handle, value) < 0) + return false; + + return true; +} + +// false: timeout or error +bool PspSemaphore::takeWithTimeOut(int num, uint32 timeOut) { + DEBUG_ENTER_FUNC(); + + uint32 *pTimeOut = 0; + if (timeOut) + pTimeOut = &timeOut; + + if (sceKernelWaitSema(_handle, num, pTimeOut) < 0) + return false; + return true; +} + +bool PspSemaphore::give(int num) { + DEBUG_ENTER_FUNC(); + + if (sceKernelSignalSema(_handle, num) < 0) + return false; + return true; +} + +//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ +//#define __PSP_DEBUG_PRINT__ /* For debug printouts */ + +#include "backends/platform/psp/trace.h" + + +// Class PspRtc --------------------------------------------------------------- + void PspRtc::init() { // init our starting ticks uint32 ticks[2]; sceRtcGetCurrentTick((u64 *)ticks); diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index 380159fa2d..23db8594dc 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -34,6 +34,33 @@ public: static void delayMicros(uint32 us); }; +class PspSemaphore { +private: + SceUID _handle; +public: + PspSemaphore(int initialValue, int maxValue); + ~PspSemaphore(); + bool take(int num) { return takeWithTimeOut(num, 0); } + bool takeWithTimeOut(int num, uint32 timeOut); + bool give(int num); + bool pollForValue(int value); // check for a certain value + int numOfWaitingThreads(); + int getValue(); +}; + +class PspMutex { +private: + PspSemaphore _semaphore; +public: + PspMutex(bool initialValue) : _semaphore(initialValue ? 1 : 0, 255) {} // initial, max value + bool lock() { return _semaphore.take(1); } + bool unlock() { return _semaphore.give(1); } + bool poll() { return _semaphore.pollForValue(1); } + int getNumWaitingThreads() { return _semaphore.numOfWaitingThreads(); } + bool getValue() { return (bool)_semaphore.getValue(); } +}; + + class PspRtc { private: uint32 _startMillis; -- cgit v1.2.3 From d89da56f471735b50a5eafbf9ee9eeb0c190f4eb Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Thu, 10 Jun 2010 14:01:30 +0000 Subject: PSP: swapped order of checks in renderAll. It's a little cheaper this way. svn-id: r49574 --- backends/platform/psp/display_manager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 5c9f8f92f0..15e0188ebf 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -322,9 +322,7 @@ bool DisplayManager::renderAll() { } #endif /* USE_DISPLAY_CALLBACK */ - if (!isTimeToUpdate()) - return false; // didn't render - + // This is cheaper than checking time, so we do it first if (!_screen->isDirty() && (!_overlay->isDirty()) && (!_cursor->isDirty()) && @@ -333,6 +331,9 @@ bool DisplayManager::renderAll() { return true; // nothing to render } + if (!isTimeToUpdate()) + return false; // didn't render + PSP_DEBUG_PRINT("screen[%s], overlay[%s], cursor[%s], keyboard[%s]\n", _screen->isDirty() ? "true" : "false", _overlay->isDirty() ? "true" : "false", -- cgit v1.2.3 From 580c9032f02123ba1f46a49c098dbf34f0b2f3c1 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Fri, 11 Jun 2010 10:54:49 +0000 Subject: Add support for setFocusRectangle - enabled on 'small' Android screens. svn-id: r49594 --- backends/platform/android/android.cpp | 85 ++++++++++++++-------- .../android/org/inodes/gus/scummvm/ScummVM.java | 1 + .../org/inodes/gus/scummvm/ScummVMActivity.java | 11 ++- 3 files changed, 65 insertions(+), 32 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 7a8c976c82..105561e595 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -178,8 +178,8 @@ private: // Game layer GLESPaletteTexture* _game_texture; int _shake_offset; + Common::Rect _focus_rect; bool _full_screen_dirty; - Common::Array _dirty_rects; // Overlay layer GLES4444Texture* _overlay_texture; @@ -199,6 +199,7 @@ private: pthread_t _timer_thread; static void* timerThreadFunc(void* arg); + bool _enable_zoning; bool _virtkeybd_on; Common::SaveFileManager *_savefile; @@ -221,6 +222,7 @@ public: static OSystem_Android* fromJavaObject(JNIEnv* env, jobject obj); virtual void initBackend(); void addPluginDirectories(Common::FSList &dirs) const; + void enableZoning(bool enable) { _enable_zoning = enable; } virtual bool hasFeature(Feature f); virtual void setFeatureState(Feature f, bool enable); @@ -311,6 +313,7 @@ OSystem_Android::OSystem_Android(jobject am) _use_mouse_palette(false), _show_mouse(false), _show_overlay(false), + _enable_zoning(false), _savefile(0), _mixer(0), _timer(0), @@ -649,16 +652,15 @@ void OSystem_Android::setupScummVMSurface() { _mouse_texture->reinitGL(); glViewport(0, 0, _egl_surface_width, _egl_surface_height); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0, _egl_surface_width, _egl_surface_height, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); glLoadIdentity(); + clearFocusRectangle(); CHECK_GL_ERROR(); - - _force_redraw = true; } void OSystem_Android::destroyScummVMSurface() { @@ -680,7 +682,7 @@ void OSystem_Android::initSize(uint width, uint height, _overlay_texture->allocBuffer(overlay_width, overlay_height); // Don't know mouse size yet - it gets reallocated in - // setMouseCursor. We need the palette allocated before + // setMouseCursor. We need the palette allocated before // setMouseCursor however, so just take a guess at the desired // size (it's small). _mouse_texture->allocBuffer(20, 20); @@ -695,7 +697,7 @@ int16 OSystem_Android::getWidth() { } void OSystem_Android::setPalette(const byte* colors, uint start, uint num) { - ENTER("setPalette(%p, %u, %u)", colors, start, num); + ENTER("setPalette(%p, %u, %u)", colors, start, num); if (!_use_mouse_palette) _setCursorPalette(colors, start, num); @@ -753,15 +755,39 @@ void OSystem_Android::updateScreen() { glTranslatex(0, -_shake_offset << 16, 0); } - _game_texture->drawTexture(0, 0, - _egl_surface_width, _egl_surface_height); + if (_focus_rect.isEmpty()) { + _game_texture->drawTexture(0, 0, + _egl_surface_width, _egl_surface_height); + } else { + // Need to ensure any exposed out-of-bounds region doesn't go + // all hall-of-mirrors. If _shake_offset != 0, we've already + // done this above. + const Common::Rect + screen_bounds(_game_texture->width(), _game_texture->height()); + if (!screen_bounds.contains(_focus_rect) && _shake_offset != 0) { + glClearColorx(0, 0, 0, 1 << 16); + glClear(GL_COLOR_BUFFER_BIT); + } + + glPushMatrix(); + glScalex(xdiv(_egl_surface_width, _focus_rect.width()), + xdiv(_egl_surface_height, _focus_rect.height()), + 1 << 16); + glTranslatex(-_focus_rect.left << 16, -_focus_rect.top << 16, 0); + glScalex(xdiv(_game_texture->width(), _egl_surface_width), + xdiv(_game_texture->height(), _egl_surface_height), + 1 << 16); + _game_texture->drawTexture(0, 0, + _egl_surface_width, _egl_surface_height); + glPopMatrix(); + } CHECK_GL_ERROR(); if (_show_overlay) { _overlay_texture->drawTexture(0, 0, - _egl_surface_width, - _egl_surface_height); + _egl_surface_width, + _egl_surface_height); CHECK_GL_ERROR(); } @@ -769,8 +795,8 @@ void OSystem_Android::updateScreen() { glPushMatrix(); glTranslatex(-_mouse_hotspot.x << 16, - -_mouse_hotspot.y << 16, - 0); + -_mouse_hotspot.y << 16, + 0); // Scale up ScummVM -> OpenGL (pixel) coordinates int texwidth, texheight; @@ -782,8 +808,8 @@ void OSystem_Android::updateScreen() { texheight = getHeight(); } glScalex(xdiv(_egl_surface_width, texwidth), - xdiv(_egl_surface_height, texheight), - 1 << 16); + xdiv(_egl_surface_height, texheight), + 1 << 16); // Note the extra half texel to position the mouse in // the middle of the x,y square: @@ -845,26 +871,18 @@ void OSystem_Android::fillScreen(uint32 col) { void OSystem_Android::setFocusRectangle(const Common::Rect& rect) { ENTER("setFocusRectangle(%d,%d,%d,%d)", rect.left, rect.top, rect.right, rect.bottom); -#if 0 - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrthof(rect.left, rect.right, rect.top, rect.bottom, 0, 1); - glMatrixMode(GL_MODELVIEW); - - _force_redraw = true; -#endif + if (_enable_zoning) { + _focus_rect = rect; + _force_redraw = true; + } } void OSystem_Android::clearFocusRectangle() { ENTER("clearFocusRectangle()"); -#if 0 - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrthof(0, _egl_surface_width, _egl_surface_height, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - - _force_redraw = true; -#endif + if (_enable_zoning) { + _focus_rect = Common::Rect(); + _force_redraw = true; + } } void OSystem_Android::showOverlay() { @@ -1342,6 +1360,11 @@ void AndroidPluginProvider::addCustomDirectories(Common::FSList &dirs) const { } #endif +static void ScummVM_enableZoning(JNIEnv* env, jobject self, jboolean enable) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + cpp_obj->enableZoning(enable); +} + const static JNINativeMethod gMethods[] = { { "create", "(Landroid/content/res/AssetManager;)V", (void*)ScummVM_create }, @@ -1356,6 +1379,8 @@ const static JNINativeMethod gMethods[] = { (void*)ScummVM_setConfManInt }, { "setConfMan", "(Ljava/lang/String;Ljava/lang/String;)V", (void*)ScummVM_setConfManString }, + { "enableZoning", "(Z)V", + (void*)ScummVM_enableZoning }, }; JNIEXPORT jint JNICALL diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index f4dca0e7e5..4ce8a85f30 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -162,6 +162,7 @@ public class ScummVM implements SurfaceHolder.Callback { final public native static void loadConfigFile(String path); final public native static void setConfMan(String key, int value); final public native static void setConfMan(String key, String value); + final public native void enableZoning(boolean enable); // Feed an event to ScummVM. Safe to call from other threads. final public native void pushEvent(Event e); diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java index fb3cd6348f..ba3c058ae4 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -1,7 +1,7 @@ package org.inodes.gus.scummvm; -import android.app.AlertDialog; import android.app.Activity; +import android.app.AlertDialog; import android.content.DialogInterface; import android.content.res.Configuration; import android.media.AudioManager; @@ -9,13 +9,14 @@ import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; +import android.util.DisplayMetrics; import android.util.Log; -import android.view.inputmethod.InputMethodManager; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; import android.view.ViewConfiguration; +import android.view.inputmethod.InputMethodManager; import android.widget.Toast; import java.io.IOException; @@ -33,6 +34,12 @@ public class ScummVMActivity extends Activity { public MyScummVM() { super(ScummVMActivity.this); + + // Enable ScummVM zoning on 'small' screens. + // This 'density' term is very confusing. + DisplayMetrics metrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(metrics); + enableZoning(metrics.densityDpi <= DisplayMetrics.DENSITY_LOW); } @Override -- cgit v1.2.3 From b921cebce882de6d32ed3fd62de16ee215daa467 Mon Sep 17 00:00:00 2001 From: John Willis Date: Mon, 14 Jun 2010 09:33:36 +0000 Subject: GP2XWiz: Add shellscripts to support building a non-stripped bundle for use with GDB. * This should help Tony (GSoC) get debug builds going. svn-id: r49648 --- backends/platform/gp2xwiz/build/bundle-debug.sh | 54 +++++++++++++++++++++++++ backends/platform/gp2xwiz/build/scummvm-gdb.gpe | 16 ++++++++ 2 files changed, 70 insertions(+) create mode 100755 backends/platform/gp2xwiz/build/bundle-debug.sh create mode 100755 backends/platform/gp2xwiz/build/scummvm-gdb.gpe (limited to 'backends') diff --git a/backends/platform/gp2xwiz/build/bundle-debug.sh b/backends/platform/gp2xwiz/build/bundle-debug.sh new file mode 100755 index 0000000000..d275f681ea --- /dev/null +++ b/backends/platform/gp2xwiz/build/bundle-debug.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +echo Quick script to make building a distribution of the GP2X Wiz backend more consistent. + +echo Collecting files. +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data" +mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib" + + +echo "Please put your save games in this dir" >> "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves/PUT_SAVES_IN_THIS_DIR" + +cp ./scummvm-gdb.gpe ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.gpe +cp ./scummvm.png ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ./README-GP2XWIZ ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ./scummvm.ini ./scummvm-wiz-`date '+%Y-%m-%d'`/ +cp ../../../../scummvm.wiz ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../AUTHORS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../README ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../COPYING ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../COPYRIGHT ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../NEWS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../gui/themes/scummmodern.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ +cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data +cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins + +# Copy over dynamic libs needed by the app (as the ones in the default filesystem are broken). +f=`which arm-open2x-linux-g++` +loc=`dirname "$f"` +cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 +cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 + +echo Building ZIP bundle. +if [ -f /usr/bin/zip ] + then + rm ./"scummvm-wiz-`date '+%Y-%m-%d'`.zip" + cd "scummvm-wiz-`date '+%Y-%m-%d'`" + zip -r -9 "../scummvm-wiz-`date '+%Y-%m-%d'`.zip" * + echo You should have a "scummvm-wiz-`date '+%Y-%m-%d'`.zip" for the GP2X Wiz backend ready to go. + cd .. + rm -R ./"scummvm-wiz-`date '+%Y-%m-%d'`" + else + echo - /usr/bin/zip not found, ZIP bundle not created. + echo All included files can also be found in ./"scummvm-wiz-`date '+%Y-%m-%d'`" + echo - Please use you preferred archive tool to bundle these files. +fi + +echo Please ensure GDB is installed somewhere in the path on your Wiz. + diff --git a/backends/platform/gp2xwiz/build/scummvm-gdb.gpe b/backends/platform/gp2xwiz/build/scummvm-gdb.gpe new file mode 100755 index 0000000000..64b6c8b974 --- /dev/null +++ b/backends/platform/gp2xwiz/build/scummvm-gdb.gpe @@ -0,0 +1,16 @@ +#!/bin/sh + +# Export the location of any libs ScummVM depends on +# (to avoid installing to the NAND and overwriting the broken ones there). +export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH + +# Run ScummVM via GDB (so make sure you have a terminal open or serial). +# Oh, and GDB installed of course ;) +gdb --args ./scummvm.wiz --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc + +# Sync the SD card to check that everything is written. +sync + +# Return to the GPH menu screen +cd /usr/gp2x +exec /usr/gp2x/gp2xmenu -- cgit v1.2.3 From 25c7dc08b1ca6816ef3b99bb13819469bd45c710 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 15 Jun 2010 05:34:37 +0000 Subject: PSP: fixed bug in hardware MP3 that caused crash in broken sword. The sample rate must be returned from our member variable, not from the header value which disappears. svn-id: r49680 --- backends/platform/psp/mp3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/psp/mp3.h b/backends/platform/psp/mp3.h index f8802f930c..029b3e498c 100644 --- a/backends/platform/psp/mp3.h +++ b/backends/platform/psp/mp3.h @@ -110,7 +110,7 @@ public: bool endOfData() const { return _state == MP3_STATE_EOS; } bool isStereo() const { return MAD_NCHANNELS(&_header) == 2; } - int getRate() const { return _header.samplerate; } + int getRate() const { return _sampleRate; } bool seek(const Timestamp &where); Timestamp getLength() const { return _length; } -- cgit v1.2.3 From ff66c67439ec501da5335e78e77b58943cea0972 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 15 Jun 2010 06:30:49 +0000 Subject: PSP: fixed SCI freeze issue by using recursive mutexes svn-id: r49682 --- backends/platform/psp/thread.cpp | 41 ++++++++++++++++++++++++++++++++++++++-- backends/platform/psp/thread.h | 14 ++++++++------ 2 files changed, 47 insertions(+), 8 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index 684a985fed..d20df45215 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -95,14 +95,14 @@ bool PspSemaphore::pollForValue(int value) { } // false: timeout or error -bool PspSemaphore::takeWithTimeOut(int num, uint32 timeOut) { +bool PspSemaphore::takeWithTimeOut(uint32 timeOut) { DEBUG_ENTER_FUNC(); uint32 *pTimeOut = 0; if (timeOut) pTimeOut = &timeOut; - if (sceKernelWaitSema(_handle, num, pTimeOut) < 0) + if (sceKernelWaitSema(_handle, 1, pTimeOut) < 0) // we always wait for 1 return false; return true; } @@ -115,6 +115,43 @@ bool PspSemaphore::give(int num) { return true; } +// Class PspMutex ------------------------------------------------------------ + +bool PspMutex::lock() { + DEBUG_ENTER_FUNC(); + int threadId = sceKernelGetThreadId(); + bool ret = true; + + if (_ownerId == threadId) { + _recursiveCount++; + } else { + ret = _semaphore.take(); + _ownerId = threadId; + _recursiveCount = 0; + } + return ret; +} + +bool PspMutex::unlock() { + DEBUG_ENTER_FUNC(); + int threadId = sceKernelGetThreadId(); + bool ret = true; + + if (_ownerId != threadId) { + PSP_ERROR("attempt to unlock mutex by thread[%x] as opposed to owner[%x]\n", + threadId, _ownerId); + return false; + } + + if (_recursiveCount) { + _recursiveCount--; + } else { + _ownerId = 0; + ret = _semaphore.give(1); + } + return ret; +} + //#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ //#define __PSP_DEBUG_PRINT__ /* For debug printouts */ diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index 23db8594dc..33b3f6ce53 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -40,8 +40,8 @@ private: public: PspSemaphore(int initialValue, int maxValue); ~PspSemaphore(); - bool take(int num) { return takeWithTimeOut(num, 0); } - bool takeWithTimeOut(int num, uint32 timeOut); + bool take() { return takeWithTimeOut(0); } + bool takeWithTimeOut(uint32 timeOut); bool give(int num); bool pollForValue(int value); // check for a certain value int numOfWaitingThreads(); @@ -51,12 +51,14 @@ public: class PspMutex { private: PspSemaphore _semaphore; + int _recursiveCount; + int _ownerId; public: - PspMutex(bool initialValue) : _semaphore(initialValue ? 1 : 0, 255) {} // initial, max value - bool lock() { return _semaphore.take(1); } - bool unlock() { return _semaphore.give(1); } + PspMutex(bool initialValue) : _semaphore(initialValue ? 1 : 0, 255), _recursiveCount(0), _ownerId(0) {} // initial, max value + bool lock(); + bool unlock(); bool poll() { return _semaphore.pollForValue(1); } - int getNumWaitingThreads() { return _semaphore.numOfWaitingThreads(); } + int numOfWaitingThreads() { return _semaphore.numOfWaitingThreads(); } bool getValue() { return (bool)_semaphore.getValue(); } }; -- cgit v1.2.3 From 0fe65d3e5fcabaac354ffb67cb1970e3e0f5f270 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 15 Jun 2010 10:36:53 +0000 Subject: PSP: fixed invisible bug in power callback svn-id: r49756 --- backends/platform/psp/psp_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index e6940eba13..c26aed539e 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -110,12 +110,13 @@ int exit_callback(void) { } /* Function for handling suspend/resume */ -void power_callback(int , int powerinfo) { +int power_callback(int , int powerinfo, void *) { if (powerinfo & PSP_POWER_CB_POWER_SWITCH || powerinfo & PSP_POWER_CB_SUSPENDING) { PowerMan.suspend(); } else if (powerinfo & PSP_POWER_CB_RESUME_COMPLETE) { PowerMan.resume(); } + return 0; } /* Callback thread */ -- cgit v1.2.3 From c6d9812270a7ae2fcf68a054a6730c6cfcbfed29 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:00:35 +0000 Subject: DS: sync with recent GUI changes. NOT TESTED. svn-id: r49791 --- backends/platform/ds/arm9/source/dsoptions.cpp | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 9937e81e61..300324a1de 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -31,6 +31,8 @@ #include "touchkeyboard.h" #include "gui/PopUpWidget.h" +#include "common/translation.h" + #define ALLOW_CPU_SCALER namespace DS { @@ -51,26 +53,26 @@ static int confGetInt(Common::String key, int defaultVal) { DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { - new GUI::ButtonWidget(this, 10, 170, 72, 16, "Close", GUI::kCloseCmd, 'C'); - new GUI::ButtonWidget(this, 320 - 10 - 130, 170, 120, 16, "ScummVM Main Menu", 0x40000000, 'M'); + new GUI::ButtonWidget(this, 10, 170, 72, 16, _("~C~lose"), 0, GUI::kCloseCmd); + new GUI::ButtonWidget(this, 320 - 10 - 130, 170, 120, 16, _("ScummVM Main Menu"), 0, 0x40000000, 'M'); _tab = new GUI::TabWidget(this, 10, 5, 300, 230 - 20 - 40 - 20); _tab->addTab("Controls"); - _leftHandedCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 130, 20, "Left handed mode", 0, 'L'); - _indyFightCheckbox = new GUI::CheckboxWidget(_tab, 5, 20, 140, 20, "Indy fight controls", 0, 'I'); - _showCursorCheckbox = new GUI::CheckboxWidget(_tab, 150, 5, 130, 20, "Show mouse cursor", 0, 'T'); - _snapToBorderCheckbox = new GUI::CheckboxWidget(_tab, 150, 20, 130, 20, "Snap to edges", 0, 'T'); + _leftHandedCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 130, 20, _("~L~eft handed mode")); + _indyFightCheckbox = new GUI::CheckboxWidget(_tab, 5, 20, 140, 20, _("~I~ndy fight controls")); + _showCursorCheckbox = new GUI::CheckboxWidget(_tab, 150, 5, 130, 20, _("Show mouse cursor"), 0, 0, 'T'); + _snapToBorderCheckbox = new GUI::CheckboxWidget(_tab, 150, 20, 130, 20, _("Snap to edges"), 0, 0, 'T'); - new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, "Touch X Offset", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, _("Touch X Offset"), Graphics::kTextAlignLeft); _touchX = new GUI::SliderWidget(_tab, 130, 35, 130, 12, 1); _touchX->setMinValue(-8); _touchX->setMaxValue(+8); _touchX->setValue(0); _touchX->setFlags(GUI::WIDGET_CLEARBG); - new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, "Touch Y Offset", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, _("Touch Y Offset"), Graphics::kTextAlignLeft); _touchY = new GUI::SliderWidget(_tab, 130, 50, 130, 12, 2); _touchY->setMinValue(-8); _touchY->setMaxValue(+8); @@ -82,10 +84,10 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { new GUI::StaticTextWidget(_tab, 130 - 20, 65, 20, 15, "-8", Graphics::kTextAlignCenter); - _touchPadStyle = new GUI::CheckboxWidget(_tab, 5, 80, 270, 20, "Use laptop trackpad-style cursor control", 0x20000001, 'T'); - _screenTaps = new GUI::CheckboxWidget(_tab, 5, 95, 285, 20, "Tap for left click, double tap right click", 0x20000002, 'T'); + _touchPadStyle = new GUI::CheckboxWidget(_tab, 5, 80, 270, 20, _("Use laptop trackpad-style cursor control"), 0, 0x20000001, 'T'); + _screenTaps = new GUI::CheckboxWidget(_tab, 5, 95, 285, 20, _("Tap for left click, double tap right click"), 0, 0x20000002, 'T'); - _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, "Sensitivity", Graphics::kTextAlignLeft); + _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, _("Sensitivity"), Graphics::kTextAlignLeft); _sensitivity = new GUI::SliderWidget(_tab, 130, 110, 130, 12, 1); _sensitivity->setMinValue(4); _sensitivity->setMaxValue(16); @@ -94,19 +96,19 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _tab->addTab("Graphics"); - new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, "Initial top screen scale:", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, _("Initial top screen scale:"), Graphics::kTextAlignLeft); _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", 0x30000001, 'T'); _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", 0x30000002, 'T'); _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", 0x30000003, 'T'); - new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, "Main screen scaling:", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, _("Main screen scaling:"), Graphics::kTextAlignLeft); - _hardScaler = new GUI::CheckboxWidget(_tab, 5, 20, 270, 20, "Hardware scale (fast, but low quality)", 0x10000001, 'T'); - _cpuScaler = new GUI::CheckboxWidget(_tab, 5, 35, 270, 20, "Software scale (good quality, but slower)", 0x10000002, 'S'); - _unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, "Unscaled (you must scroll left and right)", 0x10000003, 'S'); + _hardScaler = new GUI::CheckboxWidget(_tab, 5, 20, 270, 20, _("Hardware scale (fast, but low quality)"), 0, 0x10000001, 'T'); + _cpuScaler = new GUI::CheckboxWidget(_tab, 5, 35, 270, 20, _("Software scale (good quality, but slower)"), 0, 0x10000002, 'S'); + _unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, _("Unscaled (you must scroll left and right)"), 0, 0x10000003, 'S'); - new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, "Brightness:", Graphics::kTextAlignLeft); + new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, _("Brightness:"), Graphics::kTextAlignLeft); _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, 1); _gammaCorrection->setMinValue(0); _gammaCorrection->setMaxValue(8); @@ -116,8 +118,8 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _tab->addTab("General"); - _highQualityAudioCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 250, 20, "High quality audio (slower) (reboot)", 0, 'T'); - _disablePowerOff = new GUI::CheckboxWidget(_tab, 5, 20, 200, 20, "Disable power off", 0, 'T'); + _highQualityAudioCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 250, 20, _("High quality audio (slower) (reboot)"), 0, 0, 'T'); + _disablePowerOff = new GUI::CheckboxWidget(_tab, 5, 20, 200, 20, _("Disable power off"), 0, 0, 'T'); _tab->setActiveTab(0); @@ -125,7 +127,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { #ifdef DS_SCUMM_BUILD if (!DS::isGBAMPAvailable()) { -// addButton(this, 100, 140, "Delete Save", 'dels', 'D'); +// addButton(this, 100, 140, "Delete Save", 0, 'dels', 'D'); } #endif @@ -133,7 +135,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { //#ifdef ALLOW_CPU_SCALER -// _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T'); +// _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 0, 'T'); //#endif -- cgit v1.2.3 From d6d7cf3edfa0b69f3ad67c032ca4ec15229126bd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:00:57 +0000 Subject: IPhone: sync with recent GUI changes. NOT TESTED. svn-id: r49792 --- backends/platform/iphone/osys_events.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/iphone/osys_events.cpp b/backends/platform/iphone/osys_events.cpp index 72408be89a..c1c7ffdc0c 100644 --- a/backends/platform/iphone/osys_events.cpp +++ b/backends/platform/iphone/osys_events.cpp @@ -24,6 +24,7 @@ */ #include "gui/message.h" +#include "common/translation.h" #include "osys_main.h" @@ -335,9 +336,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, _touchpadModeEnabled = !_touchpadModeEnabled; const char *dialogMsg; if (_touchpadModeEnabled) - dialogMsg = "Touchpad mode enabled."; + dialogMsg = _("Touchpad mode enabled."); else - dialogMsg = "Touchpad mode disabled."; + dialogMsg = _("Touchpad mode disabled."); GUI::TimedMessageDialog dialog(dialogMsg, 1500); dialog.runModal(); return false; -- cgit v1.2.3 From 91078cc1bba6e768881ec099424b58cf822ef1b6 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:01:17 +0000 Subject: WII: sync with recent GUI changes. NOT TESTED. svn-id: r49793 --- backends/platform/wii/options.cpp | 82 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'backends') diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp index a8f3552313..402782a58d 100644 --- a/backends/platform/wii/options.cpp +++ b/backends/platform/wii/options.cpp @@ -28,6 +28,8 @@ #include "gui/dialog.h" #include "backends/fs/wii/wii-fs-factory.h" +#include "common/translation.h" + #include "options.h" WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) : @@ -42,84 +44,84 @@ WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) : _strUnderscanY = "wii_video_default_underscan_y"; } - new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, "Ok", 'k'); - new ButtonWidget(this, _w - 216 - 32, _h - 24 - 16, 108, 24, "Cancel", 'c'); + new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, _("Ok"), 0, 'k'); + new ButtonWidget(this, _w - 216 - 32, _h - 24 - 16, 108, 24, _("Cancel"), 0, 'c'); _tab = new TabWidget(this, 0, 0, _w, _h - 54); - _tabVideo = _tab->addTab("Video"); + _tabVideo = _tab->addTab(_("Video")); new StaticTextWidget(_tab, 16, 16, 128, 16, - "Current video mode:", Graphics::kTextAlignRight); + _("Current video mode:"), Graphics::kTextAlignRight); new StaticTextWidget(_tab, 160, 16, 128, 16, - _doubleStrike ? "Double-strike" : "Default", + _doubleStrike ? _("Double-strike") : _("Default"), Graphics::kTextAlignLeft); new StaticTextWidget(_tab, 16, 48, 128, 16, - "Horizontal underscan:", Graphics::kTextAlignRight); - _sliderUnderscanX = new SliderWidget(_tab, 160, 47, 128, 18, 'x'); + _("Horizontal underscan:"), Graphics::kTextAlignRight); + _sliderUnderscanX = new SliderWidget(_tab, 160, 47, 128, 18, 0, 'x'); _sliderUnderscanX->setMinValue(0); _sliderUnderscanX->setMaxValue(32); new StaticTextWidget(_tab, 16, 80, 128, 16, - "Vertical underscan:", Graphics::kTextAlignRight); - _sliderUnderscanY = new SliderWidget(_tab, 160, 79, 128, 18, 'y'); + _("Vertical underscan:"), Graphics::kTextAlignRight); + _sliderUnderscanY = new SliderWidget(_tab, 160, 79, 128, 18, 0, 'y'); _sliderUnderscanY->setMinValue(0); _sliderUnderscanY->setMaxValue(32); - _tabInput = _tab->addTab("Input"); + _tabInput = _tab->addTab(_("Input")); new StaticTextWidget(_tab, 16, 16, 128, 16, - "GC Pad sensitivity:", Graphics::kTextAlignRight); - _sliderPadSensitivity = new SliderWidget(_tab, 160, 15, 128, 18, 'x'); + _("GC Pad sensitivity:"), Graphics::kTextAlignRight); + _sliderPadSensitivity = new SliderWidget(_tab, 160, 15, 128, 18, 0, 'x'); _sliderPadSensitivity->setMinValue(0); _sliderPadSensitivity->setMaxValue(64); new StaticTextWidget(_tab, 16, 44, 128, 16, - "GC Pad acceleration:", Graphics::kTextAlignRight); - _sliderPadAcceleration = new SliderWidget(_tab, 160, 43, 128, 18, 'y'); + _("GC Pad acceleration:"), Graphics::kTextAlignRight); + _sliderPadAcceleration = new SliderWidget(_tab, 160, 43, 128, 18, 0, 'y'); _sliderPadAcceleration->setMinValue(0); _sliderPadAcceleration->setMaxValue(8); #ifdef USE_WII_DI - _tabDVD = _tab->addTab("DVD"); + _tabDVD = _tab->addTab(_("DVD")); new StaticTextWidget(_tab, 16, 16, 64, 16, - "Status:", Graphics::kTextAlignRight); - _textDVDStatus = new StaticTextWidget(_tab, 96, 16, 272, 16, "Unknown", + _("Status:"), Graphics::kTextAlignRight); + _textDVDStatus = new StaticTextWidget(_tab, 96, 16, 272, 16, _("Unknown"), Graphics::kTextAlignLeft); - new ButtonWidget(_tab, 16, 48, 108, 24, "Mount DVD", 'mdvd'); - new ButtonWidget(_tab, 140, 48, 108, 24, "Unmount DVD", 'udvd'); + new ButtonWidget(_tab, 16, 48, 108, 24, _("Mount DVD"), 0, 'mdvd'); + new ButtonWidget(_tab, 140, 48, 108, 24, _("Unmount DVD"), 0, 'udvd'); #endif #ifdef USE_WII_SMB - _tabSMB = _tab->addTab("SMB"); + _tabSMB = _tab->addTab(_("SMB")); new StaticTextWidget(_tab, 16, 16, 64, 16, - "Status:", Graphics::kTextAlignRight); - _textSMBStatus = new StaticTextWidget(_tab, 96, 16, 272, 16, "Unknown", + _("Status:"), Graphics::kTextAlignRight); + _textSMBStatus = new StaticTextWidget(_tab, 96, 16, 272, 16, _("Unknown"), Graphics::kTextAlignLeft); new StaticTextWidget(_tab, 16, 52, 64, 16, - "Server:", Graphics::kTextAlignRight); + _("Server:"), Graphics::kTextAlignRight); _editSMBServer = new EditTextWidget(_tab, 96, 48, _w - 96 - 32, 24, ""); new StaticTextWidget(_tab, 16, 92, 64, 16, - "Share:", Graphics::kTextAlignRight); + _("Share:"), Graphics::kTextAlignRight); _editSMBShare = new EditTextWidget(_tab, 96, 88, _w - 96 - 32, 24, ""); new StaticTextWidget(_tab, 16, 132, 64, 16, - "Username:", Graphics::kTextAlignRight); + _("Username:"), Graphics::kTextAlignRight); _editSMBUsername = new EditTextWidget(_tab, 96, 128, _w - 96 - 32, 24, ""); new StaticTextWidget(_tab, 16, 172, 64, 16, - "Password:", Graphics::kTextAlignRight); + _("Password:"), Graphics::kTextAlignRight); _editSMBPassword = new EditTextWidget(_tab, 96, 168, _w - 96 - 32, 24, ""); - new ButtonWidget(_tab, 16, 208, 108, 24, "Init network", 'net'); + new ButtonWidget(_tab, 16, 208, 108, 24, _("Init network"), 0, 'net'); - new ButtonWidget(_tab, 140, 208, 108, 24, "Mount SMB", 'msmb'); - new ButtonWidget(_tab, 264, 208, 108, 24, "Unmount SMB", 'usmb'); + new ButtonWidget(_tab, 140, 208, 108, 24, _("Mount SMB"), 0, 'msmb'); + new ButtonWidget(_tab, 264, 208, 108, 24, _("Unmount SMB"), 0, 'usmb'); #endif _tab->setActiveTab(_tabVideo); @@ -140,12 +142,12 @@ void WiiOptionsDialog::handleTickle() { #ifdef USE_WII_DI if (tab == _tabDVD) { if (fsf.isMounted(WiiFilesystemFactory::kDVD)) { - _textDVDStatus->setLabel("DVD Mounted successfully"); + _textDVDStatus->setLabel(_("DVD Mounted successfully")); } else { if (fsf.failedToMount(WiiFilesystemFactory::kDVD)) - _textDVDStatus->setLabel("Error while mounting the DVD"); + _textDVDStatus->setLabel(_("Error while mounting the DVD")); else - _textDVDStatus->setLabel("DVD not mounted"); + _textDVDStatus->setLabel(_("DVD not mounted")); } } #endif @@ -158,32 +160,32 @@ void WiiOptionsDialog::handleTickle() { switch (status) { case 0: if (fsf.isMounted(WiiFilesystemFactory::kSMB)) { - label = "Network up, share mounted"; + label = _("Network up, share mounted"); } else { - label = "Network up"; + label = _("Network up"); if (fsf.failedToMount(WiiFilesystemFactory::kSMB)) - label += ", error while mounting the share"; + label += _(", error while mounting the share"); else - label += ", share not mounted"; + label += _(", share not mounted"); } break; case -ENETDOWN: - label = "Network down"; + label = _("Network down"); break; case -EBUSY: - label = "Initialising network"; + label = _("Initialising network"); break; case -ETIMEDOUT: - label = "Timeout while initialising network"; + label = _("Timeout while initialising network"); break; default: - label = String::printf("Network not initialsed (%d)", status); + label = String::printf(_("Network not initialsed (%d)"), status); break; } -- cgit v1.2.3 From 9aa8a9d51903cf68b594a9403fe22fe92af7d036 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:01:41 +0000 Subject: Symbian: sync with recent GUI changes. NOT TESTED. svn-id: r49794 --- backends/platform/symbian/src/SymbianActions.cpp | 41 ++++++++++++------------ backends/platform/symbian/src/SymbianOS.cpp | 3 +- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'backends') diff --git a/backends/platform/symbian/src/SymbianActions.cpp b/backends/platform/symbian/src/SymbianActions.cpp index d925f5f0e7..1a55a68778 100644 --- a/backends/platform/symbian/src/SymbianActions.cpp +++ b/backends/platform/symbian/src/SymbianActions.cpp @@ -28,6 +28,7 @@ #include "gui/message.h" #include "scumm/scumm.h" #include "common/config-manager.h" +#include "common/translation.h" #include @@ -37,25 +38,25 @@ namespace GUI { // or we put them in this file separated by #ifdefs, this one is up to you, AnotherGuest :) const Common::String actionNames[] = { - "Up", - "Down", - "Left", - "Right", - "Left Click", - "Right Click", - "Save", - "Skip", - "Zone", - "Multi Function", - "Swap character", - "Skip text", - "Pause", - "Fast mode", - "Quit", - "Debugger", - "Global menu", - "Virtual keyboard", - "Key mapper" + _s("Up"), + _s("Down"), + _s("Left"), + _s("Right"), + _s("Left Click"), + _s("Right Click"), + _s("Save"), + _s("Skip"), + _s("Zone"), + _s("Multi Function"), + _s("Swap character"), + _s("Skip text"), + _s("Pause"), + _s("Fast mode"), + _s("Quit"), + _s("Debugger"), + _s("Global menu"), + _s("Virtual keyboard"), + _s("Key mapper") }; #ifdef UIQ @@ -75,7 +76,7 @@ void SymbianActions::init() { Common::String SymbianActions::actionName(ActionType action) { - return actionNames[action]; + return _(actionNames[action]); } int SymbianActions::size() { diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 2ae47b07a8..d63c9fe044 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -35,6 +35,7 @@ #include "common/config-manager.h" #include "common/scummsys.h" +#include "common/translation.h" #include "gui/message.h" @@ -442,7 +443,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { case GUI::ACTION_QUIT: { - GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No"); + GUI::MessageDialog alert(_("Do you want to quit ?"), _("Yes"), _("No")); if (alert.runModal() == GUI::kMessageOK) quit(); -- cgit v1.2.3 From 9793c96f1b0afd9e6898d73012be2492e4d53be8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:02:23 +0000 Subject: WINCE: sync with recent GUI changes. NOT TESTED. svn-id: r49795 --- backends/platform/wince/CEActionsPocket.cpp | 46 +++++++++++++------------ backends/platform/wince/CEActionsSmartphone.cpp | 36 ++++++++++--------- backends/platform/wince/CELauncherDialog.cpp | 10 +++--- 3 files changed, 49 insertions(+), 43 deletions(-) (limited to 'backends') diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp index ebe6981290..64abd0be3e 100644 --- a/backends/platform/wince/CEActionsPocket.cpp +++ b/backends/platform/wince/CEActionsPocket.cpp @@ -31,30 +31,32 @@ #include "common/config-manager.h" #include "gui/KeysDialog.h" +#include "common/translation.h" + #ifdef _WIN32_WCE #define KEY_ALL_SKIP 3457 #endif const String pocketActionNames[] = { - "Pause", - "Save", - "Quit", - "Skip", - "Hide Toolbar", - "Show Keyboard", - "Sound on/off", - "Right click", - "Show/Hide Cursor", - "Free look", - "Zoom up", - "Zoom down", - "Multi Function", - "Bind Keys", - "Cursor Up", - "Cursor Down", - "Cursor Left", - "Cursor Right", - "Left Click", + _s("Pause"), + _s("Save"), + _s("Quit"), + _s("Skip"), + _s("Hide Toolbar"), + _s("Show Keyboard"), + _s("Sound on/off"), + _s("Right click"), + _s("Show/Hide Cursor"), + _s("Free look"), + _s("Zoom up"), + _s("Zoom down"), + _s("Multi Function"), + _s("Bind Keys"), + _s("Cursor Up"), + _s("Cursor Down"), + _s("Cursor Left"), + _s("Cursor Right"), + _s("Left Click") }; void CEActionsPocket::init() { @@ -63,7 +65,7 @@ void CEActionsPocket::init() { String CEActionsPocket::actionName(GUI::ActionType action) { - return pocketActionNames[action]; + return _(pocketActionNames[action]); } int CEActionsPocket::size() { @@ -258,7 +260,7 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) { if (action == POCKET_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") { // FIXME: This is a temporary solution. The engine should handle its own menus. // Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience - GUI::MessageDialog alert("Do you want to load or save the game?", "Load", "Save"); + GUI::MessageDialog alert(_("Do you want to load or save the game?"), _("Load"), _("Save")); if (alert.runModal() == GUI::kMessageOK) _key_action[action].setKey(SDLK_l); else @@ -308,7 +310,7 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) { case POCKET_ACTION_QUIT: if (!quitdialog) { quitdialog = true; - GUI::MessageDialog alert(" Are you sure you want to quit ? ", "Yes", "No"); + GUI::MessageDialog alert(_(" Are you sure you want to quit ? "), _("Yes"), _("No")); if (alert.runModal() == GUI::kMessageOK) _mainSystem->quit(); quitdialog = false; diff --git a/backends/platform/wince/CEActionsSmartphone.cpp b/backends/platform/wince/CEActionsSmartphone.cpp index 47733ae317..af80bd2908 100644 --- a/backends/platform/wince/CEActionsSmartphone.cpp +++ b/backends/platform/wince/CEActionsSmartphone.cpp @@ -30,23 +30,25 @@ #include "common/config-manager.h" #include "gui/KeysDialog.h" +#include "common/translation.h" + #define KEY_ALL_SKIP 3457 const String smartphoneActionNames[] = { - "Up", - "Down", - "Left", - "Right", - "Left Click", - "Right Click", - "Save", - "Skip", - "Zone", - "Multi Function", - "Bind Keys", - "Keyboard", - "Rotate", - "Quit" + _s("Up"), + _s("Down"), + _s("Left"), + _s("Right"), + _s("Left Click"), + _s("Right Click"), + _s("Save"), + _s("Skip"), + _s("Zone"), + _s("Multi Function"), + _s("Bind Keys"), + _s("Keyboard"), + _s("Rotate"), + _s("Quit") }; const int ACTIONS_SMARTPHONE_DEFAULT[] = { SDLK_UP, SDLK_DOWN, SDLK_LEFT, SDLK_RIGHT, SDLK_F1, SDLK_F2, SDLK_F3, SDLK_ESCAPE, SDLK_9, SDLK_8, SDLK_F4, SDLK_RETURN, SDLK_5, SDLK_0 }; @@ -57,7 +59,7 @@ void CEActionsSmartphone::init() { String CEActionsSmartphone::actionName(GUI::ActionType action) { - return smartphoneActionNames[action]; + return _(smartphoneActionNames[action]); } int CEActionsSmartphone::size() { @@ -220,7 +222,7 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) { if (action == SMARTPHONE_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") { // FIXME: This is a temporary solution. The engine should handle its own menus. // Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience - GUI::MessageDialog alert("Do you want to load or save the game?", "Load", "Save"); + GUI::MessageDialog alert(_("Do you want to load or save the game?"), _("Load"), _("Save")); if (alert.runModal() == GUI::kMessageOK) _key_action[action].setKey(SDLK_l); else @@ -267,7 +269,7 @@ bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) { case SMARTPHONE_ACTION_QUIT: if (!quitdialog) { quitdialog = true; - GUI::MessageDialog alert(" Are you sure you want to quit ? ", "Yes", "No"); + GUI::MessageDialog alert(_(" Are you sure you want to quit ? "), _("Yes"), _("No")); if (alert.runModal() == GUI::kMessageOK) _mainSystem->quit(); quitdialog = false; diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp index 21a967336e..11e4900c2d 100644 --- a/backends/platform/wince/CELauncherDialog.cpp +++ b/backends/platform/wince/CELauncherDialog.cpp @@ -38,6 +38,8 @@ #include "common/config-manager.h" +#include "common/translation.h" + using namespace GUI; using namespace Common; @@ -51,13 +53,13 @@ public: // needs fixing, or remove it! const int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0); const int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0); - new ButtonWidget(this, (_w - buttonWidth) / 2, 45, buttonWidth, buttonHeight, "OK", kCloseCmd, '\r'); // Close dialog - FIXME + new ButtonWidget(this, (_w - buttonWidth) / 2, 45, buttonWidth, buttonHeight, _("OK"), 0, kCloseCmd, '\r'); // Close dialog - FIXME - Common::String videoDriver("Using SDL driver "); + Common::String videoDriver(_("Using SDL driver ")); SDL_VideoDriverName(tempo, sizeof(tempo)); videoDriver += tempo; new StaticTextWidget(this, 0, 10, _w, kLineHeight, videoDriver, Graphics::kTextAlignCenter); - Common::String displayInfos("Display "); + Common::String displayInfos(_("Display ")); sprintf(tempo, "%dx%d (real %dx%d)", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), OSystem_WINCE3::getScreenWidth(), OSystem_WINCE3::getScreenHeight()); displayInfos += tempo; new StaticTextWidget(this, 0, 20, _w, kLineHeight, displayInfos, Graphics::kTextAlignCenter); @@ -99,7 +101,7 @@ void CELauncherDialog::automaticScanDirectory(const Common::FSNode &node) { * returns some illegal paths atm. */ void CELauncherDialog::addGame() { - MessageDialog alert("Do you want to perform an automatic scan ?", "Yes", "No"); + MessageDialog alert(_("Do you want to perform an automatic scan ?"), _("Yes"), _("No")); if (alert.runModal() == kMessageOK && _browser->runModal() > 0) { // Clear existing domains ConfigManager::DomainMap &domains = (ConfigManager::DomainMap&)ConfMan.getGameDomains(); -- cgit v1.2.3 From 9e006b74d342c5b020f36b5b75285e71d74f7d20 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 11:02:42 +0000 Subject: Keymapper: sync with recent GUI changes. svn-id: r49796 --- backends/keymapper/remap-dialog.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index fd90b67d60..067d8453a5 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -31,6 +31,8 @@ #include "gui/ScrollBarWidget.h" #include "gui/ThemeEval.h" +#include "common/translation.h" + namespace Common { enum { @@ -44,12 +46,12 @@ RemapDialog::RemapDialog() _keymapper = g_system->getEventManager()->getKeymapper(); assert(_keymapper); - _kmPopUpDesc = new GUI::StaticTextWidget(this, "KeyMapper.PopupDesc", "Keymap:"); + _kmPopUpDesc = new GUI::StaticTextWidget(this, "KeyMapper.PopupDesc", _("Keymap:")); _kmPopUp = new GUI::PopUpWidget(this, "KeyMapper.Popup"); _scrollBar = new GUI::ScrollBarWidget(this, 0, 0, 0, 0); - new GUI::ButtonWidget(this, "KeyMapper.Close", "Close", kCloseCmd); + new GUI::ButtonWidget(this, "KeyMapper.Close", _("Close"), 0, kCloseCmd); } RemapDialog::~RemapDialog() { @@ -61,7 +63,7 @@ void RemapDialog::open() { const Stack &activeKeymaps = _keymapper->getActiveStack(); if (!(activeKeymaps.size() > 0)) { - _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + " (Active)"); + _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Active)")); divider = true; } @@ -95,7 +97,7 @@ void RemapDialog::open() { if (divider) _kmPopUp->appendEntry(""); for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); ++it) { - _kmPopUp->appendEntry(it->_value->getName() + " (Global)", idx); + _kmPopUp->appendEntry(it->_value->getName() + _(" (Global)"), idx); _keymapTable[idx++] = it->_value; } divider = true; @@ -105,7 +107,7 @@ void RemapDialog::open() { if (divider) _kmPopUp->appendEntry(""); for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); ++it) { - _kmPopUp->appendEntry(it->_value->getName() + " (Game)", idx); + _kmPopUp->appendEntry(it->_value->getName() + _(" (Game)"), idx); _keymapTable[idx++] = it->_value; } } @@ -168,7 +170,7 @@ void RemapDialog::reflowLayout() { widg.actionText = new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignRight); widg.keyButton = - new GUI::ButtonWidget(this, 0, 0, 0, 0, "", kRemapCmd + i); + new GUI::ButtonWidget(this, 0, 0, 0, 0, "", 0, kRemapCmd + i); _keymapWidgets.push_back(widg); } else { widg = _keymapWidgets[i]; -- cgit v1.2.3 From 703f0ca29c8f1915b5fae13decb6ccde110adada Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 15 Jun 2010 12:21:08 +0000 Subject: SYSTEM: Unify OSystem::getSupportedFormats() signature svn-id: r49838 --- backends/platform/dc/dc.h | 2 +- backends/platform/dc/display.cpp | 2 +- backends/platform/psp/display_manager.cpp | 2 +- backends/platform/psp/display_manager.h | 12 ++++++------ backends/platform/psp/osys_psp.cpp | 2 +- backends/platform/psp/osys_psp.h | 2 +- backends/platform/sdl/graphics.cpp | 2 +- backends/platform/sdl/sdl.h | 2 +- backends/platform/wii/osystem.h | 2 +- backends/platform/wii/osystem_gfx.cpp | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) (limited to 'backends') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 8a122ebb27..e87a0a8c90 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -86,7 +86,7 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys Graphics::PixelFormat getScreenFormat() const; // Returns a list of all pixel formats supported by the backend. - Common::List getSupportedFormats(); + Common::List getSupportedFormats() const; // Set the size of the video bitmap. // Typically, 320x200 diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 35fc94b3cc..53dbff333d 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -198,7 +198,7 @@ Graphics::PixelFormat OSystem_Dreamcast::getScreenFormat() const return screenFormats[_screenFormat]; } -Common::List OSystem_Dreamcast::getSupportedFormats() +Common::List OSystem_Dreamcast::getSupportedFormats() const { Common::List list; unsigned i; diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 15e0188ebf..a9f33f6091 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -379,7 +379,7 @@ inline bool DisplayManager::isTimeToUpdate() { return true; } -Common::List DisplayManager::getSupportedPixelFormats() { +Common::List DisplayManager::getSupportedPixelFormats() const { Common::List list; // In order of preference diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h index bceb85703d..dbbdf2022c 100644 --- a/backends/platform/psp/display_manager.h +++ b/backends/platform/psp/display_manager.h @@ -83,12 +83,12 @@ public: void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format); // Getters - float getScaleX() { return _displayParams.scaleX; } - float getScaleY() { return _displayParams.scaleY; } - uint32 getOutputWidth() { return _displayParams.screenOutput.width; } - uint32 getOutputHeight() { return _displayParams.screenOutput.height; } - uint32 getOutputBitsPerPixel() { return _displayParams.outputBitsPerPixel; } - Common::List getSupportedPixelFormats(); + float getScaleX() const { return _displayParams.scaleX; } + float getScaleY() const { return _displayParams.scaleY; } + uint32 getOutputWidth() const { return _displayParams.screenOutput.width; } + uint32 getOutputHeight() const { return _displayParams.screenOutput.height; } + uint32 getOutputBitsPerPixel() const { return _displayParams.outputBitsPerPixel; } + Common::List getSupportedPixelFormats() const; private: struct GlobalDisplayParams { diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index b0fb971230..580e4f1cfd 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -148,7 +148,7 @@ Graphics::PixelFormat OSystem_PSP::getScreenFormat() const { return _screen.getScummvmPixelFormat(); } -Common::List OSystem_PSP::getSupportedFormats() { +Common::List OSystem_PSP::getSupportedFormats() const { return _displayManager.getSupportedPixelFormats(); } diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index d8ec8fe824..56a64ccb80 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -87,7 +87,7 @@ public: int getGraphicsMode() const; #ifdef USE_RGB_COLOR virtual Graphics::PixelFormat getScreenFormat() const; - virtual Common::List getSupportedFormats(); + virtual Common::List getSupportedFormats() const; #endif // Screen size diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 82670cfcb7..83a256f568 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -243,7 +243,7 @@ const Graphics::PixelFormat BGRList[] = { }; // TODO: prioritize matching alpha masks -Common::List OSystem_SDL::getSupportedFormats() { +Common::List OSystem_SDL::getSupportedFormats() const { static Common::List list; static bool inited = false; diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 341a59c8cf..480e0af41b 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -98,7 +98,7 @@ public: virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; } // Highest supported - virtual Common::List getSupportedFormats(); + virtual Common::List getSupportedFormats() const; #endif // Set the size and format of the video bitmap. diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index d277aa38b1..8180d5727f 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -156,7 +156,7 @@ public: virtual bool setGraphicsMode(int mode); #ifdef USE_RGB_COLOR virtual Graphics::PixelFormat getScreenFormat() const; - virtual Common::List getSupportedFormats(); + virtual Common::List getSupportedFormats() const; #endif virtual int getGraphicsMode() const; virtual void initSize(uint width, uint height, diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 3d4e75883b..19190048a0 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -209,7 +209,7 @@ Graphics::PixelFormat OSystem_Wii::getScreenFormat() const { return _pfGame; } -Common::List OSystem_Wii::getSupportedFormats() { +Common::List OSystem_Wii::getSupportedFormats() const { Common::List res; res.push_back(_pfRGB565); res.push_back(Graphics::PixelFormat::createFormatCLUT8()); -- cgit v1.2.3 From 651e2760a3b2de0c542ccbbf1bf3caa319cc0349 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 15 Jun 2010 12:33:20 +0000 Subject: Fix spelling, cleanup svn-id: r49843 --- backends/fs/amigaos4/amigaos4-fs.cpp | 2 +- backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp | 6 +++--- backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp | 2 +- backends/platform/PalmOS/Src/launcher/launch.cpp | 2 +- backends/platform/ds/arm9/source/fat/io_nmmc.c | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'backends') diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index fe6164cb0c..8a57a3cf1c 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -368,7 +368,7 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b } if (ERROR_NO_MORE_ENTRIES != IDOS->IoErr() ) { - debug(6, "An error occured during ExamineDir"); + debug(6, "An error occurred during ExamineDir"); ret = false; } else { ret = true; diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp index b4c1e222d0..9566a25311 100644 --- a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp +++ b/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp @@ -107,7 +107,7 @@ static void SkinsFormExit(Boolean bSave) { listP = (ListType *)GetObjectPtr(SkinsSkinList); selected = LstGetSelection(listP); - if (bSave && selected == -1) { // may never occured... + if (bSave && selected == -1) { // may never occurred... FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); return; } @@ -164,7 +164,7 @@ static void SkinsFormBeam() { listP = (ListType *)GetObjectPtr(SkinsSkinList); selected = LstGetSelection(listP); - if (selected == -1) { // may never occured... + if (selected == -1) { // may never occurred... FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); return; } @@ -187,7 +187,7 @@ static void SkinsFormDelete() { listP = (ListType *)GetObjectPtr(SkinsSkinList); selected = LstGetSelection(listP); - if (selected == -1) { // may never occured... + if (selected == -1) { // may never occurred... FrmCustomAlert(FrmInfoAlert, "You didn't select a skin.", 0, 0); return; } diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp index 58eaa5b5fc..48399efa95 100644 --- a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp +++ b/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp @@ -258,7 +258,7 @@ static void MusicFormInit(UInt16 index) { ogameInfoP = (GameInfoType *)MemHandleLock(recordH); if (!ogameInfoP) { - FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0); + FrmCustomAlert(FrmErrorAlert, "An error occurred.",0,0); return; } diff --git a/backends/platform/PalmOS/Src/launcher/launch.cpp b/backends/platform/PalmOS/Src/launcher/launch.cpp index cb2d52b20e..d83a34e94c 100644 --- a/backends/platform/PalmOS/Src/launcher/launch.cpp +++ b/backends/platform/PalmOS/Src/launcher/launch.cpp @@ -468,7 +468,7 @@ Boolean StartScummVM(Int16 engine) { return false; } - // reset mode if screen rotation occured (DIA only) + // reset mode if screen rotation occurred (DIA only) if (!direct && OPTIONS_TST(kOptCollapsible)) { UInt8 mode = PalmScreenSize(0,0, &(gVars->screenFullWidth), &(gVars->screenFullHeight)); OPTIONS_RST(kOptModeLandscape); diff --git a/backends/platform/ds/arm9/source/fat/io_nmmc.c b/backends/platform/ds/arm9/source/fat/io_nmmc.c index 261096a27b..6c996f5de1 100644 --- a/backends/platform/ds/arm9/source/fat/io_nmmc.c +++ b/backends/platform/ds/arm9/source/fat/io_nmmc.c @@ -170,7 +170,7 @@ bool NMMC_IsInserted(void) { Neo_EnableMMC( true ); // Open SPI port to MMC card Neo_SendMMCCommand(MMC_SEND_CSD, 0); - if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured + if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occurred Neo_EnableMMC( false ); return false; } @@ -227,14 +227,14 @@ bool NMMC_StartUp(void) { // Set block length Neo_SendMMCCommand(MMC_SET_BLOCKLEN, BYTE_PER_READ ); - if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured + if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occurred Neo_EnableMMC( false ); return false; } // Check if we can use a higher SPI frequency Neo_SendMMCCommand(MMC_SEND_CSD, 0); - if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured + if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occurred Neo_EnableMMC( false ); return false; } @@ -268,7 +268,7 @@ bool NMMC_WriteSectors (u32 sector, u8 numSecs, void* buffer) Neo_EnableMMC( true ); // Open SPI port to MMC card Neo_SendMMCCommand( 25, sector ); - if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured + if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occurred Neo_EnableMMC( false ); return false; } @@ -318,7 +318,7 @@ bool NMMC_ReadSectors (u32 sector, u8 numSecs, void* buffer) while (totalSecs--) { Neo_SendMMCCommand(MMC_READ_BLOCK, sector ); - if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured + if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occurred Neo_EnableMMC( false ); return false; } -- cgit v1.2.3 From a21b9c7b96a29d3be9285b4217e91f835fed31ec Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 15 Jun 2010 13:10:00 +0000 Subject: PSP: fixed up PowerManager and removed dependency on SDL svn-id: r49852 --- backends/fs/psp/psp-stream.cpp | 14 +- backends/platform/psp/powerman.cpp | 352 +++++++++++++------------------------ backends/platform/psp/powerman.h | 75 ++++---- backends/platform/psp/thread.cpp | 56 +++++- backends/platform/psp/thread.h | 20 ++- 5 files changed, 232 insertions(+), 285 deletions(-) (limited to 'backends') diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp index 83ff095aa8..67c73beeaa 100644 --- a/backends/fs/psp/psp-stream.cpp +++ b/backends/fs/psp/psp-stream.cpp @@ -81,10 +81,10 @@ PSPIoStream::PSPIoStream(const Common::String &path, bool writeMode) PSPIoStream::~PSPIoStream() { DEBUG_ENTER_FUNC(); - if (PowerMan.beginCriticalSection() == PowerManager::Blocked) + if (PowerMan.beginCriticalSection()) PSP_DEBUG_PRINT_FUNC("Suspended\n"); - PowerMan.unregisterSuspend(this); // Unregister with powermanager to be suspended + PowerMan.unregisterForSuspend(this); // Unregister with powermanager to be suspended // Must do this before fclose() or resume() will reopen. fclose((FILE *)_handle); // We don't need a critical section. Worst case, the handle gets closed on its own @@ -100,7 +100,7 @@ PSPIoStream::~PSPIoStream() { */ void *PSPIoStream::open() { DEBUG_ENTER_FUNC(); - if (PowerMan.beginCriticalSection() == PowerManager::Blocked) { + if (PowerMan.beginCriticalSection()) { // No need to open. Just return the _handle resume() already opened. PSP_DEBUG_PRINT_FUNC("Suspended\n"); } @@ -118,7 +118,7 @@ void *PSPIoStream::open() { _cache = (char *)memalign(64, CACHE_SIZE); } - PowerMan.registerSuspend(this); // Register with the powermanager to be suspended + PowerMan.registerForSuspend(this); // Register with the powermanager to be suspended PowerMan.endCriticalSection(); @@ -233,7 +233,7 @@ uint32 PSPIoStream::read(void *ptr, uint32 len) { } } - if (PowerMan.beginCriticalSection() == PowerManager::Blocked) + if (PowerMan.beginCriticalSection()) PSP_DEBUG_PRINT_FUNC("Suspended\n"); @@ -309,7 +309,7 @@ inline bool PSPIoStream::isOffsetInCache(uint32 offset) { uint32 PSPIoStream::write(const void *ptr, uint32 len) { DEBUG_ENTER_FUNC(); // Check if we can access the file - if (PowerMan.beginCriticalSection() == PowerManager::Blocked) + if (PowerMan.beginCriticalSection()) PSP_DEBUG_PRINT_FUNC("Suspended\n"); PSP_DEBUG_PRINT_FUNC("filename[%s], len[0x%x]\n", _path.c_str(), len); @@ -346,7 +346,7 @@ uint32 PSPIoStream::write(const void *ptr, uint32 len) { bool PSPIoStream::flush() { DEBUG_ENTER_FUNC(); // Enter critical section - if (PowerMan.beginCriticalSection() == PowerManager::Blocked) + if (PowerMan.beginCriticalSection()) PSP_DEBUG_PRINT_FUNC("Suspended\n"); int ret = fflush((FILE *)_handle); diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp index df8da12f6d..eaadad16c5 100644 --- a/backends/platform/psp/powerman.cpp +++ b/backends/platform/psp/powerman.cpp @@ -23,16 +23,16 @@ * */ -//#define __PSP_DEBUG_FUNCS__ /* can put this locally too */ -//#define __PSP_DEBUG_PRINT__ -#include "backends/platform/psp/trace.h" - #include #include #include "backends/platform/psp/powerman.h" #include "engine.h" +//#define __PSP_DEBUG_FUNCS__ /* can put this locally too */ +//#define __PSP_DEBUG_PRINT__ +#include "backends/platform/psp/trace.h" + DECLARE_SINGLETON(PowerManager) // Function to debug the Power Manager (we have no output to screen) @@ -47,68 +47,30 @@ inline void PowerManager::debugPM() { * Constructor * ********************************************/ -PowerManager::PowerManager() { - DEBUG_ENTER_FUNC(); - - _flagMutex = NULL; /* Init mutex handle */ - _listMutex = NULL; /* Init mutex handle */ - _condSuspendable = NULL; /* Init condition variable */ - _condPM = NULL; - - _condSuspendable = SDL_CreateCond(); - if (_condSuspendable <= 0) { - PSP_ERROR("Couldn't create Suspendable condition variable\n"); - } - - _condPM = SDL_CreateCond(); - if (_condPM <= 0) { - PSP_ERROR("Couldn't create PM condition variable\n"); - } - - _flagMutex = SDL_CreateMutex(); - if (_flagMutex <= 0) { - PSP_ERROR("Couldn't create flag Mutex\n"); - } - - _listMutex = SDL_CreateMutex(); - if (_listMutex <= 0) { - PSP_ERROR("Couldn't create list Mutex\n"); - } - - _suspendFlag = false; - _criticalCounter = 0; // How many are in the critical section - _pauseFlag = 0; - _pauseFlagOld = 0; - _pauseClientState = 0; - _listCounter = 0; - PMStatusSet(kInitDone); - _error = 0; -} +PowerManager::PowerManager() : _pauseFlag(false), _pauseFlagOld(false), _pauseClientState(UNPAUSED), + _suspendFlag(false), _flagMutex(true), _listMutex(true), + _criticalCounter(0), _listCounter(0), _error(0), _PMStatus(kInitDone) {} /******************************************* * * Function to register to be notified when suspend/resume time comes * ********************************************/ -int PowerManager::registerSuspend(Suspendable *item) { +bool PowerManager::registerForSuspend(Suspendable *item) { DEBUG_ENTER_FUNC(); // Register in list debugPM(); - if (SDL_mutexP(_listMutex) != 0) { - PSP_ERROR("Couldn't lock _listMutex[%p]\n", _listMutex); - } + _listMutex.lock(); _suspendList.push_front(item); _listCounter++; - if (SDL_mutexV(_listMutex) != 0) { - PSP_ERROR("Couldn't unlock _listMutex[%p]\n", _listMutex); - } + _listMutex.unlock(); debugPM(); - return 0; + return true; } /******************************************* @@ -116,26 +78,20 @@ int PowerManager::registerSuspend(Suspendable *item) { * Function to unregister to be notified when suspend/resume time comes * ********************************************/ -int PowerManager::unregisterSuspend(Suspendable *item) { +bool PowerManager::unregisterForSuspend(Suspendable *item) { DEBUG_ENTER_FUNC(); debugPM(); // Unregister from stream list - if (SDL_mutexP(_listMutex) != 0) { - PSP_ERROR("Couldn't unlock _listMutex[%p]\n", _listMutex); - } - + _listMutex.lock(); + _suspendList.remove(item); _listCounter--; - if (SDL_mutexV(_listMutex) != 0) { - PSP_ERROR("Couldn't unlock _listMutex[%p]\n", _listMutex); - } + _listMutex.unlock(); - PSP_DEBUG_PRINT("Out of unregisterSuspend\n"); debugPM(); - - return 0; + return true; } /******************************************* @@ -144,21 +100,7 @@ int PowerManager::unregisterSuspend(Suspendable *item) { * ********************************************/ PowerManager::~PowerManager() { - DEBUG_ENTER_FUNC(); - - PMStatusSet(kDestroyPM); - - SDL_DestroyCond(_condSuspendable); - _condSuspendable = 0; - - SDL_DestroyCond(_condPM); - _condPM = 0; - - SDL_DestroyMutex(_flagMutex); - _flagMutex = 0; - - SDL_DestroyMutex(_listMutex); - _listMutex = 0; + _PMStatus = kDestroyPM; } /******************************************* @@ -171,114 +113,92 @@ PowerManager::~PowerManager() { * ********************************************/ void PowerManager::pollPauseEngine() { - + DEBUG_ENTER_FUNC(); + + bool pause = _pauseFlag; // We copy so as not to have multiple values - if ((pause != _pauseFlagOld) && g_engine) { // Check to see if we have an engine - if (pause && _pauseClientState == PowerManager::Unpaused) { - _pauseClientState = PowerManager::Pausing; // Tell PM we're in the middle of pausing - g_engine->pauseEngine(true); - PSP_DEBUG_PRINT_FUNC("Pausing engine\n"); - _pauseClientState = PowerManager::Paused; // Tell PM we're done pausing - } else if (!pause && _pauseClientState == PowerManager::Paused) { - g_engine->pauseEngine(false); - PSP_DEBUG_PRINT_FUNC("Unpausing for resume\n"); - _pauseClientState = PowerManager::Unpaused; // Tell PM we're in the middle of pausing + if (pause != _pauseFlagOld) { + if (g_engine) { // Check to see if we have an engine + if (pause && _pauseClientState == UNPAUSED) { + _pauseClientState = PAUSING; // Tell PM we're in the middle of pausing + g_engine->pauseEngine(true); + PSP_DEBUG_PRINT_FUNC("Pausing engine\n"); + _pauseClientState = PAUSED; // Tell PM we're done pausing + } else if (!pause && _pauseClientState == PAUSED) { + g_engine->pauseEngine(false); + PSP_DEBUG_PRINT_FUNC("Unpausing for resume\n"); + _pauseClientState = UNPAUSED; // Tell PM we're unpaused + } } - _pauseFlagOld = pause; } } -/******************************************* -* -* Function to be called by threads wanting to block on the PSP entering suspend -* Use this for small critical sections where you can easily restore the previous state. -* -********************************************/ -int PowerManager::blockOnSuspend() { - return beginCriticalSection(true); -} - /******************************************* * * Function to block on a suspend, then start a non-suspendable critical section * Use this for large or REALLY critical critical-sections. * Make sure to call endCriticalSection or the PSP won't suspend. +* returns true if blocked, false if not blocked ********************************************/ -int PowerManager::beginCriticalSection(bool justBlock) { +bool PowerManager::beginCriticalSection() { DEBUG_ENTER_FUNC(); - int ret = NotBlocked; - - if (SDL_mutexP(_flagMutex) != 0) { - PSP_ERROR("PowerManager::blockOnSuspend(): Couldn't lock flagMutex[%p]\n", _flagMutex); - ret = Error; - } + bool ret = false; + + _flagMutex.lock(); // Check the access flag - if (_suspendFlag == true) { - PSP_DEBUG_PRINT("We're being blocked!\n"); - debugPM(); - ret = Blocked; + if (_suspendFlag) { + ret = true; - // If it's true, we wait for a signal to continue - if (SDL_CondWait(_condSuspendable, _flagMutex) != 0) { - PSP_DEBUG_PRINT("PowerManager::blockOnSuspend(): Couldn't wait on cond[%p]\n", _condSuspendable); - } + PSP_DEBUG_PRINT("I got blocked. ThreadId[%x]\n", sceKernelGetThreadId()); + debugPM(); + + _threadSleep.wait(_flagMutex); - PSP_DEBUG_PRINT("We got blocked!!\n"); + PSP_DEBUG_PRINT_FUNC("I got released. ThreadId[%x]\n", sceKernelGetThreadId()); debugPM(); } // Now prevent the PM from suspending until we're done - if (justBlock == false) - _criticalCounter++; + _criticalCounter++; - if (SDL_mutexV(_flagMutex) != 0) { - PSP_ERROR("PowerManager::blockOnSuspend(): Couldn't unlock flagMutex[%p]\n", _flagMutex); - ret = Error; - } + _flagMutex.unlock(); return ret; } -int PowerManager::endCriticalSection() { +// returns success = true +void PowerManager::endCriticalSection() { DEBUG_ENTER_FUNC(); - int ret = 0; - if (SDL_mutexP(_flagMutex) != 0) { - PSP_ERROR("PowerManager::endCriticalSection(): Couldn't lock flagMutex[%p]\n", _flagMutex); - ret = Error; - } + _flagMutex.lock(); // We're done with our critical section _criticalCounter--; if (_criticalCounter <= 0) { - if (_suspendFlag == true) { // If the PM is sleeping, this flag must be set - PSP_DEBUG_PRINT("Unblocked thread waking up the PM.\n"); - debugPM(); - - SDL_CondBroadcast(_condPM); - - PSP_DEBUG_PRINT("Woke up the PM\n"); - debugPM(); + if (_suspendFlag) { // If the PM is sleeping, this flag must be set + PSP_DEBUG_PRINT_FUNC("PM is asleep. Waking it up.\n"); + debugPM(); + + _pmSleep.releaseAll(); + + PSP_DEBUG_PRINT_FUNC("Woke up the PM\n"); + + debugPM(); } if (_criticalCounter < 0) { // Check for bad usage of critical sections - PSP_ERROR("Critical counter[%d]\n", _criticalCounter); + PSP_ERROR("Critical counter[%d]!!!\n", _criticalCounter); debugPM(); } } - if (SDL_mutexV(_flagMutex) != 0) { - PSP_ERROR("Couldn't unlock flagMutex[%p]\n", _flagMutex); - ret = Error; - } - - return ret; + _flagMutex.unlock(); } /******************************************* @@ -286,90 +206,77 @@ int PowerManager::endCriticalSection() { * Callback function to be called to put every Suspendable to suspend * ********************************************/ -int PowerManager::suspend() { +void PowerManager::suspend() { DEBUG_ENTER_FUNC(); - int ret = 0; - if (_pauseFlag) return ret; // Very important - make sure we only suspend once + if (_pauseFlag) + return; // Very important - make sure we only suspend once - scePowerLock(0); // Critical to make sure PSP doesn't suspend before we're done + scePowerLock(0); // Also critical to make sure PSP doesn't suspend before we're done // The first stage of suspend is pausing the engine if possible. We don't want to cause files // to block, or we might not get the engine to pause. On the other hand, we might wait for polling // and it'll never happen. We also want to do this w/o mutexes (for speed) which is ok in this case. _pauseFlag = true; - PMStatusSet(kWaitForClientPause); + _PMStatus = kWaitForClientPause; // Now we wait, giving the engine thread some time to find our flag. - for (int i = 0; i < 10 && _pauseClientState == Unpaused; i++) - sceKernelDelayThread(50000); // We wait 50 msec x 10 times = 0.5 seconds + for (int i = 0; i < 10 && _pauseClientState == UNPAUSED; i++) + PspThread::delayMicros(50000); // We wait 50 msec x 10 times = 0.5 seconds - if (_pauseClientState == Pausing) { // Our event has been acknowledged. Let's wait until the client is done. - PMStatusSet(kWaitForClientToFinishPausing); + if (_pauseClientState == PAUSING) { // Our event has been acknowledged. Let's wait until the client is done. + _PMStatus = kWaitForClientToFinishPausing; - while (_pauseClientState != Paused) - sceKernelDelayThread(50000); // We wait 50 msec at a time + while (_pauseClientState != PAUSED) + PspThread::delayMicros(50000); // We wait 50 msec at a time } - // It's possible that the polling thread missed our pause event, but there's nothing we can do about that. - // We can't know if there's polling going on or not. It's usually not a critical thing anyway. + // It's possible that the polling thread missed our pause event, but there's + // nothing we can do about that. + // We can't know if there's polling going on or not. + // It's usually not a critical thing anyway. - PMStatusSet(kGettingFlagMutexSuspend); + _PMStatus = kGettingFlagMutexSuspend; // Now we set the suspend flag to true to cause reading threads to block + _flagMutex.lock(); - if (SDL_mutexP(_flagMutex) != 0) { - PSP_ERROR("Couldn't lock flagMutex[%p]\n", _flagMutex); - _error = Error; - ret = Error; - } - - PMStatusSet(kGotFlagMutexSuspend); + _PMStatus = kGotFlagMutexSuspend; _suspendFlag = true; // Check if anyone is in a critical section. If so, we'll wait for them if (_criticalCounter > 0) { - PMStatusSet(kWaitCritSectionSuspend); - SDL_CondWait(_condPM, _flagMutex); - PMStatusSet(kDoneWaitingCritSectionSuspend); - } + _PMStatus = kWaitCritSectionSuspend; + + _pmSleep.wait(_flagMutex); + + _PMStatus = kDoneWaitingCritSectionSuspend; + } + + _flagMutex.unlock(); - if (SDL_mutexV(_flagMutex) != 0) { - PSP_ERROR("Couldn't unlock flagMutex[%p]\n", _flagMutex); - _error = Error; - ret = Error; - } - - PMStatusSet(kGettingListMutexSuspend); + _PMStatus = kGettingListMutexSuspend; // Loop over list, calling suspend() - if (SDL_mutexP(_listMutex) != 0) { - PSP_ERROR("Couldn't lock listMutex[%p]\n", _listMutex); - _error = Error; - ret = Error; - } - PMStatusSet(kIteratingListSuspend); + _listMutex.lock(); + + _PMStatus = kIteratingListSuspend; // Iterate Common::List::iterator i; for (i = _suspendList.begin(); i != _suspendList.end(); ++i) { (*i)->suspend(); } + _PMStatus = kDoneIteratingListSuspend; - PMStatusSet(kDoneIteratingListSuspend); - - if (SDL_mutexV(_listMutex) != 0) { - PSP_ERROR("Couldn't unlock listMutex[%p]\n", _listMutex); - _error = Error; - ret = Error; - } - PMStatusSet(kDoneSuspend); + _listMutex.unlock(); + _PMStatus = kDoneSuspend; scePowerUnlock(0); // Allow the PSP to go to sleep now - - return ret; + + _PMStatus = kDonePowerUnlock; } /******************************************* @@ -377,24 +284,26 @@ int PowerManager::suspend() { * Callback function to resume every Suspendable * ********************************************/ -int PowerManager::resume() { +void PowerManager::resume() { DEBUG_ENTER_FUNC(); - int ret = 0; + + _PMStatus = kBeginResume; // Make sure we can't get another suspend scePowerLock(0); - if (!_pauseFlag) return ret; // Make sure we can only resume once + _PMStatus = kCheckingPauseFlag; + + if (!_pauseFlag) + return; // Make sure we can only resume once - PMStatusSet(kGettingListMutexResume); + _PMStatus = kGettingListMutexResume; // First we notify our Suspendables. Loop over list, calling resume() - if (SDL_mutexP(_listMutex) != 0) { - PSP_ERROR("Couldn't lock listMutex[%p]\n", _listMutex); - _error = Error; - ret = Error; - } - PMStatusSet(kIteratingListResume); + _listMutex.lock(); + + _PMStatus = kIteratingListResume; + // Iterate Common::List::iterator i = _suspendList.begin(); @@ -402,46 +311,31 @@ int PowerManager::resume() { (*i)->resume(); } - PMStatusSet(kDoneIteratingListResume); + _PMStatus = kDoneIteratingListResume; - if (SDL_mutexV(_listMutex) != 0) { - PSP_ERROR("Couldn't unlock listMutex[%p]\n", _listMutex); - _error = Error; - ret = Error; - } - - PMStatusSet(kGettingFlagMutexResume); + _listMutex.unlock(); + + _PMStatus = kGettingFlagMutexResume; // Now we set the suspend flag to false - if (SDL_mutexP(_flagMutex) != 0) { - PSP_ERROR("Couldn't lock flagMutex %p\n", _flagMutex); - _error = Error; - ret = Error; - } - PMStatusSet(kGotFlagMutexResume); + _flagMutex.lock(); + + _PMStatus = kGotFlagMutexResume; _suspendFlag = false; - PMStatusSet(kSignalSuspendedThreadsResume); + _PMStatus = kSignalSuspendedThreadsResume; - // Signal the other threads to wake up - if (SDL_CondBroadcast(_condSuspendable) != 0) { - PSP_ERROR("Couldn't broadcast condition[%p]\n", _condSuspendable); - _error = Error; - ret = Error; - } - PMStatusSet(kDoneSignallingSuspendedThreadsResume); + // Signal the threads to wake up + _threadSleep.releaseAll(); + + _PMStatus = kDoneSignallingSuspendedThreadsResume; - if (SDL_mutexV(_flagMutex) != 0) { - PSP_ERROR("Couldn't unlock flagMutex[%p]\n", _flagMutex); - _error = Error; - ret = Error; - } - PMStatusSet(kDoneResume); + _flagMutex.unlock(); + + _PMStatus = kDoneResume; - _pauseFlag = false; // Signal engine to unpause + _pauseFlag = false; // Signal engine to unpause -- no mutex needed scePowerUnlock(0); // Allow new suspends - - return ret; } diff --git a/backends/platform/psp/powerman.h b/backends/platform/psp/powerman.h index af3134adee..5f09bc7794 100644 --- a/backends/platform/psp/powerman.h +++ b/backends/platform/psp/powerman.h @@ -26,8 +26,7 @@ #ifndef POWERMAN_H #define POWERMAN_H -#include -#include +#include "backends/platform/psp/thread.h" #include "common/singleton.h" #include "common/list.h" @@ -53,12 +52,12 @@ class PowerManager: public Common::Singleton { public: int blockOnSuspend(); /* block if suspending */ - int beginCriticalSection(bool justBlock = false); /* Use a critical section to block (if suspend was already pressed) */ - int endCriticalSection(); /* and to prevent the PSP from suspending in a particular section */ - int registerSuspend(Suspendable *item); /* register to be called to suspend/resume */ - int unregisterSuspend(Suspendable *item); /* remove from suspend/resume list */ - int suspend(); /* callback to have all items in list suspend */ - int resume(); /* callback to have all items in list resume */ + bool beginCriticalSection(); /* Use a critical section to block (if suspend was already pressed) */ + void endCriticalSection(); /* and to prevent the PSP from suspending in a particular section */ + bool registerForSuspend(Suspendable *item); /* register to be called to suspend/resume */ + bool unregisterForSuspend(Suspendable *item); /* remove from suspend/resume list */ + void suspend(); /* callback to have all items in list suspend */ + void resume(); /* callback to have all items in list resume */ // Functions for pausing the engine void pollPauseEngine(); /* Poll whether the engine should be paused */ @@ -69,11 +68,9 @@ public: }; enum PauseState { - Unpaused = 0, - PauseEvent, - UnpauseEvent, - Pausing, - Paused + UNPAUSED = 0, + PAUSING, + PAUSED }; private: @@ -81,34 +78,38 @@ private: PowerManager(); ~PowerManager(); - Common::List _suspendList; /* list to register in */ + Common::List _suspendList; // list to register in - volatile bool _pauseFlag; /* For pausing, which is before suspending */ - volatile bool _pauseFlagOld; /* Save the last state of the flag while polling */ - volatile int _pauseClientState; /* Pause state of the target */ + volatile bool _pauseFlag; // For pausing, which is before suspending + volatile bool _pauseFlagOld; // Save the last state of the flag while polling + volatile PauseState _pauseClientState; // Pause state of the target - volatile bool _suspendFlag; /* protected variable */ - SDL_mutex *_flagMutex; /* mutex to access access flag */ - SDL_mutex *_listMutex; /* mutex to access Suspendable list */ - SDL_cond *_condSuspendable; /* signal to synchronize accessing threads */ - SDL_cond *_condPM; /* signal to wake up the PM from a critical section */ - volatile int _criticalCounter; /* Counter of how many threads are in a critical section */ - int _error; /* error code - PM can't talk to us. For debugging */ + volatile bool _suspendFlag; // protected variable + PspMutex _flagMutex; // mutex to access access flag + PspMutex _listMutex; // mutex to access Suspendable list + PspCondition _threadSleep; // signal to synchronize accessing threads + PspCondition _pmSleep; // signal to wake up the PM from a critical section + volatile int _criticalCounter; // Counter of how many threads are in a critical section + int _error; // error code - PM can't talk to us. For debugging + volatile int _PMStatus; // What the PM is doing. for debugging // States for PM to be in (used for debugging) enum PMState { - kInitDone = 1 , - kDestroyPM, - kWaitForClientPause, - kWaitForClientToFinishPausing, - kGettingFlagMutexSuspend, - kGotFlagMutexSuspend, - kWaitCritSectionSuspend, - kDoneWaitingCritSectionSuspend, - kGettingListMutexSuspend, - kIteratingListSuspend, - kDoneIteratingListSuspend, - kDoneSuspend, + kInitDone = 1, + kDestroyPM = 2, + kWaitForClientPause = 3, + kWaitForClientToFinishPausing = 4, + kGettingFlagMutexSuspend = 5, + kGotFlagMutexSuspend = 6, + kWaitCritSectionSuspend = 7, + kDoneWaitingCritSectionSuspend = 8, + kGettingListMutexSuspend = 9, + kIteratingListSuspend = 10, + kDoneIteratingListSuspend = 11, + kDoneSuspend = 12, + kDonePowerUnlock, + kBeginResume, + kCheckingPauseFlag, kGettingListMutexResume, kIteratingListResume, kDoneIteratingListResume, @@ -122,8 +123,6 @@ private: volatile int _listCounter; /* How many people are in the list - just for debugging */ void debugPM(); /* print info about the PM */ - void PMStatusSet(PMState s) { _PMStatus = s; } - volatile int _PMStatus; /* What the PM is doing */ public: int getPMStatus() const { return _PMStatus; } diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index d20df45215..43e3b931c3 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -47,10 +47,10 @@ void PspThread::delayMicros(uint32 us) { #include "backends/platform/psp/trace.h" -PspSemaphore::PspSemaphore(int initialValue, int maxValue) { +PspSemaphore::PspSemaphore(int initialValue, int maxValue/*=255*/) { DEBUG_ENTER_FUNC(); _handle = 0; - _handle = sceKernelCreateSema("ScummVM Sema", 0 /* attr */, + _handle = (uint32)sceKernelCreateSema("ScummVM Sema", 0 /* attr */, initialValue, maxValue, 0 /*option*/); if (!_handle) @@ -60,7 +60,7 @@ PspSemaphore::PspSemaphore(int initialValue, int maxValue) { PspSemaphore::~PspSemaphore() { DEBUG_ENTER_FUNC(); if (_handle) - if (sceKernelDeleteSema(_handle) < 0) + if (sceKernelDeleteSema((SceUID)_handle) < 0) PSP_ERROR("failed to delete semaphore.\n"); } @@ -69,7 +69,7 @@ int PspSemaphore::numOfWaitingThreads() { SceKernelSemaInfo info; info.numWaitThreads = 0; - if (sceKernelReferSemaStatus(_handle, &info) < 0) + if (sceKernelReferSemaStatus((SceUID)_handle, &info) < 0) PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle); return info.numWaitThreads; @@ -80,7 +80,7 @@ int PspSemaphore::getValue() { SceKernelSemaInfo info; info.currentCount = 0; - if (sceKernelReferSemaStatus(_handle, &info) < 0) + if (sceKernelReferSemaStatus((SceUID)_handle, &info) < 0) PSP_ERROR("failed to retrieve semaphore info for handle %d\n", _handle); return info.currentCount; @@ -88,7 +88,7 @@ int PspSemaphore::getValue() { bool PspSemaphore::pollForValue(int value) { DEBUG_ENTER_FUNC(); - if (sceKernelPollSema(_handle, value) < 0) + if (sceKernelPollSema((SceUID)_handle, value) < 0) return false; return true; @@ -107,10 +107,10 @@ bool PspSemaphore::takeWithTimeOut(uint32 timeOut) { return true; } -bool PspSemaphore::give(int num) { +bool PspSemaphore::give(int num /*=1*/) { DEBUG_ENTER_FUNC(); - if (sceKernelSignalSema(_handle, num) < 0) + if (sceKernelSignalSema((SceUID)_handle, num) < 0) return false; return true; } @@ -152,6 +152,46 @@ bool PspMutex::unlock() { return ret; } +// Class PspCondition ------------------------------------------------- + +// Release all threads waiting on the condition +void PspCondition::releaseAll() { + _mutex.lock(); + if (_waitingThreads > _signaledThreads) { // we have signals to issue + int numWaiting = _waitingThreads - _signaledThreads; // threads we haven't signaled + _signaledThreads = _waitingThreads; + + _waitSem.give(numWaiting); + _mutex.unlock(); + for (int i=0; i 0 ) { + _doneSem.give(); // let the thread know + _signaledThreads--; + } + _waitingThreads--; + _mutex.unlock(); + + externalMutex.lock(); // must lock external mutex here for continuation +} + //#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ //#define __PSP_DEBUG_PRINT__ /* For debug printouts */ diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index 33b3f6ce53..bd7a60b6ed 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -36,13 +36,13 @@ public: class PspSemaphore { private: - SceUID _handle; + uint32 _handle; public: - PspSemaphore(int initialValue, int maxValue); + PspSemaphore(int initialValue, int maxValue=255); ~PspSemaphore(); bool take() { return takeWithTimeOut(0); } bool takeWithTimeOut(uint32 timeOut); - bool give(int num); + bool give(int num=1); bool pollForValue(int value); // check for a certain value int numOfWaitingThreads(); int getValue(); @@ -62,6 +62,20 @@ public: bool getValue() { return (bool)_semaphore.getValue(); } }; +class PspCondition { +private: + PspMutex _mutex; + int _waitingThreads; + int _signaledThreads; + PspSemaphore _waitSem; + PspSemaphore _doneSem; +public: + PspCondition() : _mutex(true), _waitingThreads(0), _signaledThreads(0), + _waitSem(0), _doneSem(0) {} + void wait(PspMutex &externalMutex); + void releaseAll(); +}; + class PspRtc { private: -- cgit v1.2.3 From 831e626ccd488df9e8c3d534bf129c48e66f18e0 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 15 Jun 2010 16:58:03 +0000 Subject: SDL: only change mouse cursor, when mouse is currently within our window, also enable mouse position changing again for SCI svn-id: r49866 --- backends/platform/sdl/graphics.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 83a256f568..721cc54c90 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -1377,6 +1377,10 @@ void OSystem_SDL::setMousePos(int x, int y) { void OSystem_SDL::warpMouse(int x, int y) { int y1 = y; + // Don't change mouse position, when mouse is outside of our window (in case of windowed mode) + if (!(SDL_GetAppState( ) & SDL_APPMOUSEFOCUS)) + return; + if (_videoMode.aspectRatioCorrection && !_overlayVisible) y1 = real2Aspect(y); -- cgit v1.2.3 From ee419aad9cb16e36248158a434831163a93731db Mon Sep 17 00:00:00 2001 From: John Willis Date: Tue, 15 Jun 2010 17:49:40 +0000 Subject: GP2XWiz: Add port distribution rules into a makefile so they can be used with buildbot. This removes them from the old scripts in /backends/platform/gp2xwiz/build/ and puts them in the right place as make targets. svn-id: r49877 --- backends/platform/gp2xwiz/build/bundle-debug.sh | 51 +---------------- backends/platform/gp2xwiz/build/bundle.sh | 54 +----------------- backends/platform/gp2xwiz/gp2xwiz-bundle.mk | 73 +++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 99 deletions(-) create mode 100755 backends/platform/gp2xwiz/gp2xwiz-bundle.mk (limited to 'backends') diff --git a/backends/platform/gp2xwiz/build/bundle-debug.sh b/backends/platform/gp2xwiz/build/bundle-debug.sh index d275f681ea..cd5145b31d 100755 --- a/backends/platform/gp2xwiz/build/bundle-debug.sh +++ b/backends/platform/gp2xwiz/build/bundle-debug.sh @@ -2,53 +2,8 @@ echo Quick script to make building a distribution of the GP2X Wiz backend more consistent. -echo Collecting files. -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib" +cd ../../../.. +echo Building ScummVM for GP2X Wiz. -echo "Please put your save games in this dir" >> "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves/PUT_SAVES_IN_THIS_DIR" - -cp ./scummvm-gdb.gpe ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.gpe -cp ./scummvm.png ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ./README-GP2XWIZ ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ./scummvm.ini ./scummvm-wiz-`date '+%Y-%m-%d'`/ -cp ../../../../scummvm.wiz ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../AUTHORS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../README ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../COPYING ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../COPYRIGHT ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../NEWS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../gui/themes/scummmodern.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data -cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins - -# Copy over dynamic libs needed by the app (as the ones in the default filesystem are broken). -f=`which arm-open2x-linux-g++` -loc=`dirname "$f"` -cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 -cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 - -echo Building ZIP bundle. -if [ -f /usr/bin/zip ] - then - rm ./"scummvm-wiz-`date '+%Y-%m-%d'`.zip" - cd "scummvm-wiz-`date '+%Y-%m-%d'`" - zip -r -9 "../scummvm-wiz-`date '+%Y-%m-%d'`.zip" * - echo You should have a "scummvm-wiz-`date '+%Y-%m-%d'`.zip" for the GP2X Wiz backend ready to go. - cd .. - rm -R ./"scummvm-wiz-`date '+%Y-%m-%d'`" - else - echo - /usr/bin/zip not found, ZIP bundle not created. - echo All included files can also be found in ./"scummvm-wiz-`date '+%Y-%m-%d'`" - echo - Please use you preferred archive tool to bundle these files. -fi - -echo Please ensure GDB is installed somewhere in the path on your Wiz. - +make gp2xwiz-bundle-debug diff --git a/backends/platform/gp2xwiz/build/bundle.sh b/backends/platform/gp2xwiz/build/bundle.sh index 065bd7a685..579e2dc77b 100755 --- a/backends/platform/gp2xwiz/build/bundle.sh +++ b/backends/platform/gp2xwiz/build/bundle.sh @@ -2,56 +2,8 @@ echo Quick script to make building a distribution of the GP2X Wiz backend more consistent. -echo Collecting files. -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data" -mkdir "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib" +cd ../../../.. +echo Building ScummVM for GP2X Wiz. -echo "Please put your save games in this dir" >> "scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/saves/PUT_SAVES_IN_THIS_DIR" - -cp ./scummvm.gpe ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ./scummvm.png ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ./README-GP2XWIZ ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ./scummvm.ini ./scummvm-wiz-`date '+%Y-%m-%d'`/ -cp ../../../../scummvm.wiz ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../AUTHORS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../README ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../COPYING ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../COPYRIGHT ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../NEWS ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../gui/themes/scummmodern.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../dists/pred.dic ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/ -cp ../../../../dists/engine-data/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/engine-data -cp ../../../../plugins/* ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins - -# Copy over dynamic libs needed by the app (as the ones in the default filesystem are broken). -f=`which arm-open2x-linux-g++` -loc=`dirname "$f"` -cp $loc/../lib/libz.so.1.2.3 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libz.so.1 -cp $loc/../lib/libvorbisidec.so.1.0.2 ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/lib/libvorbisidec.so.1 - -echo Making Stripped Binary. -arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/scummvm.wiz - -echo Making Stripped Plugins. -arm-open2x-linux-strip ./scummvm-wiz-`date '+%Y-%m-%d'`/scummvm/plugins/* - -echo Building ZIP bundle. -if [ -f /usr/bin/zip ] - then - rm ./"scummvm-wiz-`date '+%Y-%m-%d'`.zip" - cd "scummvm-wiz-`date '+%Y-%m-%d'`" - zip -r -9 "../scummvm-wiz-`date '+%Y-%m-%d'`.zip" * - echo You should have a "scummvm-wiz-`date '+%Y-%m-%d'`.zip" for the GP2X Wiz backend ready to go. - cd .. - rm -R ./"scummvm-wiz-`date '+%Y-%m-%d'`" - else - echo - /usr/bin/zip not found, ZIP bundle not created. - echo All included files can also be found in ./"scummvm-wiz-`date '+%Y-%m-%d'`" - echo - Please use you preferred archive tool to bundle these files. -fi +make gp2xwiz-bundle diff --git a/backends/platform/gp2xwiz/gp2xwiz-bundle.mk b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk new file mode 100755 index 0000000000..fa5a247865 --- /dev/null +++ b/backends/platform/gp2xwiz/gp2xwiz-bundle.mk @@ -0,0 +1,73 @@ +# Special target to create bundles for the GP2X Wiz. + +#bundle_name = release/scummvm-wiz-`date '+%Y-%m-%d'` +bundle_name = release/scummvm-gp2xwiz +f=$(shell which $(STRIP)) +libloc = $(shell dirname $(f)) + +gp2xwiz-bundle: $(EXECUTABLE) + $(MKDIR) "$(bundle_name)" + $(MKDIR) "$(bundle_name)/scummvm" + $(MKDIR) "$(bundle_name)/scummvm/saves" + $(MKDIR) "$(bundle_name)/scummvm/engine-data" + $(MKDIR) "$(bundle_name)/scummvm/lib" + + echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR" + + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.gpe $(bundle_name)/scummvm/ + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/ + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/ + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/ + + $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/ + $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data + $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/ + + $(STRIP) $(EXECUTABLE) -o $(bundle_name)/scummvm/$(EXECUTABLE) + +ifdef DYNAMIC_MODULES + $(INSTALL) -d "$(bundle_name)/scummvm/plugins" + $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins" + $(STRIP) $(bundle_name)/scummvm/plugins/* +endif + + $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1 + $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1 + + tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 . + rm -R ./$(bundle_name) + +gp2xwiz-bundle-debug: $(EXECUTABLE) + $(MKDIR) "$(bundle_name)" + $(MKDIR) "$(bundle_name)/scummvm" + $(MKDIR) "$(bundle_name)/scummvm/saves" + $(MKDIR) "$(bundle_name)/scummvm/engine-data" + $(MKDIR) "$(bundle_name)/scummvm/lib" + + echo "Please put your save games in this dir" >> "$(bundle_name)/scummvm/saves/PUT_SAVES_IN_THIS_DIR" + + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm-gdb.gpe $(bundle_name)/scummvm/scummvm.gpe + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.png $(bundle_name)/scummvm/ + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/README-GP2XWIZ $(bundle_name)/scummvm/ + $(CP) $(srcdir)/backends/platform/gp2xwiz/build/scummvm.ini $(bundle_name)/ + + $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/scummvm/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/scummvm/ + $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/scummvm/engine-data + $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/scummvm/ + + $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/scummvm/$(EXECUTABLE) + +ifdef DYNAMIC_MODULES + $(INSTALL) -d "$(bundle_name)/scummvm/plugins" + $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins" +endif + + $(CP) $(libloc)/../lib/libz.so.1.2.3 $(bundle_name)/scummvm/lib/libz.so.1 + $(CP) $(libloc)/../lib/libvorbisidec.so.1.0.2 $(bundle_name)/scummvm/lib/libvorbisidec.so.1 + + tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 . + rm -R ./$(bundle_name) + +.PHONY: gp2xwiz-bundle gp2xwiz-bundle-debug -- cgit v1.2.3 From 2e9a7155e6ba4398a1594df4c21de97f29a99193 Mon Sep 17 00:00:00 2001 From: John Willis Date: Tue, 15 Jun 2010 20:45:13 +0000 Subject: GP2X: Move port distribution rules into a makefile for use with buildbot. This removes them from the old scripts in /backends/platform/gp2x/build/ and puts them in the right place. svn-id: r49892 --- backends/platform/gp2x/build/bundle.sh | 50 +++------------------------- backends/platform/gp2x/gp2x-bundle.mk | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 46 deletions(-) create mode 100755 backends/platform/gp2x/gp2x-bundle.mk (limited to 'backends') diff --git a/backends/platform/gp2x/build/bundle.sh b/backends/platform/gp2x/build/bundle.sh index c68c62191b..d17f8bd831 100755 --- a/backends/platform/gp2x/build/bundle.sh +++ b/backends/platform/gp2x/build/bundle.sh @@ -1,52 +1,10 @@ -#!/bin/bash +#!/bin/sh echo Quick script to make building a distribution of the GP2X port more consistent. -PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH -PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH -export CXX=arm-open2x-linux-g++ -export CXXFLAGS=-march=armv4t -export CPPFLAGS=-I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -export LDFLAGS=-L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib +cd ../../../.. -echo Collecting files. -mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`" -mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/saves" -mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/plugins" -mkdir "scummvm-gp2x-`date '+%Y-%m-%d'`/engine-data" +echo Building ScummVM for GP2X Wiz. -echo "Please put your save games in this dir" >> "scummvm-gp2x-`date '+%Y-%m-%d'`/saves/PUT_SAVES_IN_THIS_DIR" +make gp2x-bundle -cp ./scummvm.gpe ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ./scummvm.png ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ./README-GP2X ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ./mmuhack.o ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../scummvm.gp2x ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../AUTHORS ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../README ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../COPYING ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../COPYRIGHT ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../NEWS ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../gui/themes/scummmodern.zip ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../backends/vkeybd/packs/vkeybd_default.zip ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../dists/pred.dic ./scummvm-gp2x-`date '+%Y-%m-%d'`/ -cp ../../../../dists/engine-data/* ./scummvm-gp2x-`date '+%Y-%m-%d'`/engine-data -cp ../../../../plugins/* ./scummvm-gp2x-`date '+%Y-%m-%d'`/plugins - -echo Making Stripped GPE. -arm-open2x-linux-strip ./scummvm-gp2x-`date '+%Y-%m-%d'`/scummvm.gp2x - -echo Building ZIP bundle. -if [ -f /usr/bin/zip ] - then - rm ./"scummvm-gp2x-`date '+%Y-%m-%d'`.zip" - cd "scummvm-gp2x-`date '+%Y-%m-%d'`" - zip -r -9 "../scummvm-gp2x-`date '+%Y-%m-%d'`.zip" * - echo You should have a "scummvm-gp2x-`date '+%Y-%m-%d'`.zip" for the GP2X port ready to go. - cd .. - rm -R ./"scummvm-gp2x-`date '+%Y-%m-%d'`" - else - echo - /usr/bin/zip not found, ZIP bundle not created. - echo All included files can also be found in ./"scummvm-gp2x-`date '+%Y-%m-%d'`" - echo - Please use you preferred archive tool to bundle these files. -fi diff --git a/backends/platform/gp2x/gp2x-bundle.mk b/backends/platform/gp2x/gp2x-bundle.mk new file mode 100755 index 0000000000..c6fb72c1c3 --- /dev/null +++ b/backends/platform/gp2x/gp2x-bundle.mk @@ -0,0 +1,60 @@ +# Special target to create bundles for the GP2X. + +bundle_name = release/scummvm-gp2x + +gp2x-bundle: $(EXECUTABLE) + $(MKDIR) "$(bundle_name)" + $(MKDIR) "$(bundle_name)/saves" + $(MKDIR) "$(bundle_name)/engine-data" + + echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR" + + $(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.gpe $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.png $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/README-GP2X $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/mmuhack.o $(bundle_name)/ + + $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/ + $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/engine-data + $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/ + + $(STRIP) $(EXECUTABLE) -o $(bundle_name)/$(EXECUTABLE) + +ifdef DYNAMIC_MODULES + $(INSTALL) -d "$(bundle_name)/plugins" + $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/plugins" + $(STRIP) $(bundle_name)/plugins/* +endif + + tar -C $(bundle_name) -cvjf $(bundle_name).tar.bz2 . + rm -R ./$(bundle_name) + +gp2x-bundle-debug: $(EXECUTABLE) + $(MKDIR) "$(bundle_name)" + $(MKDIR) "$(bundle_name)/saves" + $(MKDIR) "$(bundle_name)/engine-data" + + echo "Please put your save games in this dir" >> "$(bundle_name)/saves/PUT_SAVES_IN_THIS_DIR" + + $(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.gpe $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/scummvm.png $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/README-GP2X $(bundle_name)/ + $(CP) $(srcdir)/backends/platform/gp2x/build/mmuhack.o $(bundle_name)/ + + $(INSTALL) -c -m 644 $(DIST_FILES_DOCS) $(bundle_name)/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(bundle_name)/ + $(INSTALL) -c -m 644 $(DIST_FILES_ENGINEDATA) $(bundle_name)/engine-data + $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/ + + $(INSTALL) -c -m 777 $(srcdir)/$(EXECUTABLE) $(bundle_name)/$(EXECUTABLE) + +ifdef DYNAMIC_MODULES + $(INSTALL) -d "$(bundle_name)/scummvm/plugins" + $(INSTALL) -c -m 644 $(PLUGINS) "$(bundle_name)/scummvm/plugins" +endif + + tar -C $(bundle_name) -cvjf $(bundle_name)-debug.tar.bz2 . + rm -R ./$(bundle_name) + +.PHONY: gp2x-bundle gp2x-bundle-debug -- cgit v1.2.3 From 4ac81f3d18c6d31d1e6291e53d128db9f7199f57 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 16 Jun 2010 07:22:54 +0000 Subject: Fix for Valgrind Uninitialised Error from SDL_Event in sdl backend and derived backends. svn-id: r49902 --- backends/platform/gp2x/events.cpp | 1 + backends/platform/gp2xwiz/gp2xwiz-events.cpp | 1 + backends/platform/sdl/events.cpp | 1 + backends/platform/wince/wince-sdl.cpp | 1 + 4 files changed, 4 insertions(+) (limited to 'backends') diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index 496e045ab0..a40967743c 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -229,6 +229,7 @@ int GP2X_BUTTON_STATE_L = false; bool OSystem_GP2X::pollEvent(Common::Event &event) { SDL_Event ev; + ev.type = SDL_NOEVENT; int axis; byte b = 0; diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index a69aa42967..19ef24ef58 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -165,6 +165,7 @@ int GP2X_BUTTON_STATE_L = false; /* Override the SDL pollEvent with the Wiz's own event code. */ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) { SDL_Event ev; + ev.type = SDL_NOEVENT; int axis; byte b = 0; diff --git a/backends/platform/sdl/events.cpp b/backends/platform/sdl/events.cpp index 1965cb3031..1c1d82730f 100644 --- a/backends/platform/sdl/events.cpp +++ b/backends/platform/sdl/events.cpp @@ -180,6 +180,7 @@ static void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event) { bool OSystem_SDL::pollEvent(Common::Event &event) { SDL_Event ev; + ev.type = SDL_NOEVENT; handleKbdMouse(); diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index b3480702b5..970c9dce90 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -2263,6 +2263,7 @@ static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode, bool unfilter) { bool OSystem_WINCE3::pollEvent(Common::Event &event) { SDL_Event ev; + ev.type = SDL_NOEVENT; byte b = 0; DWORD currentTime; bool keyEvent = false; -- cgit v1.2.3 From e7e8808affc1a256b228da859e44ec3071c3a5a4 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Wed, 16 Jun 2010 09:04:27 +0000 Subject: PSP: got rid of SDL svn-id: r49903 --- backends/platform/psp/Makefile | 6 +---- backends/platform/psp/README.PSP | 2 -- backends/platform/psp/README.PSP.in | 2 -- backends/platform/psp/osys_psp.cpp | 49 ------------------------------------- backends/platform/psp/osys_psp.h | 4 --- 5 files changed, 1 insertion(+), 62 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile index 7f8bb63b0a..02fd8b022a 100644 --- a/backends/platform/psp/Makefile +++ b/backends/platform/psp/Makefile @@ -124,17 +124,13 @@ CXXFLAGS += -pg -g LDFLAGS += -pg endif -# SDL Libs and Flags -SDLFLAGS := $(shell $(PSPBIN)/sdl-config --cflags) -SDLLIBS := $(shell $(PSPBIN)/sdl-config --libs) # PSP LIBS PSPLIBS = -lpspprof -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk \ -lpsputility -lpspuser -lpsppower -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lpspaudiocodec \ -lpspkernel # Add in PSPSDK includes and libraries. -CXXFLAGS += $(SDLFLAGS) -LIBS += -lpng -lSDL -lz $(findstring -lGL,$(SDLLIBS)) -lstdc++ -lc -lm $(filter -L%,$(SDLLIBS)) $(PSPLIBS) +LIBS += -lpng -lz -lstdc++ -lc -lm $(PSPLIBS) OBJS := powerman.o \ psp_main.o \ diff --git a/backends/platform/psp/README.PSP b/backends/platform/psp/README.PSP index 45f31483f7..f4d5bae6d6 100644 --- a/backends/platform/psp/README.PSP +++ b/backends/platform/psp/README.PSP @@ -99,8 +99,6 @@ To build ScummVM for PSP you need: Note: This usually gets installed by the PSP toolchain, so you don't have to do it manually. -- SDL (svn co svn://svn.pspdev.org/psp/trunk/SDL) - - zlib (svn co svn://svn.pspdev.org/psp/trunk/zlib) - libPNG (svn co svn://svn.pspdev.org/psp/trunk/libpng) diff --git a/backends/platform/psp/README.PSP.in b/backends/platform/psp/README.PSP.in index d9f75974f1..2d53fd3b47 100644 --- a/backends/platform/psp/README.PSP.in +++ b/backends/platform/psp/README.PSP.in @@ -99,8 +99,6 @@ To build ScummVM for PSP you need: Note: This usually gets installed by the PSP toolchain, so you don't have to do it manually. -- SDL (svn co svn://svn.pspdev.org/psp/trunk/SDL) - - zlib (svn co svn://svn.pspdev.org/psp/trunk/zlib) - libPNG (svn co svn://svn.pspdev.org/psp/trunk/libpng) diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 580e4f1cfd..01053b8cbb 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -48,8 +48,6 @@ #include "backends/platform/psp/trace.h" -#define USE_PSP_AUDIO - #define SAMPLES_PER_SEC 44100 static int timer_handler(int t) { @@ -58,14 +56,6 @@ static int timer_handler(int t) { return t; } -void OSystem_PSP::initSDL() { -#ifdef USE_PSP_AUDIO - SDL_Init(0); -#else - SDL_Init(SDL_INIT_AUDIO); -#endif -} - OSystem_PSP::~OSystem_PSP() {} #define PSP_SCREEN_WIDTH 480 @@ -89,8 +79,6 @@ void OSystem_PSP::initBackend() { _inputHandler.setKeyboard(&_keyboard); _inputHandler.init(); - initSDL(); - _savefile = new PSPSaveFileManager; _timer = new DefaultTimerManager(); @@ -388,7 +376,6 @@ void OSystem_PSP::setupMixer(void) { assert(!_mixer); -#ifdef USE_PSP_AUDIO if (!_audio.open(samplesPerSec, 2, samples, mixCallback, this)) { PSP_ERROR("failed to open audio\n"); return; @@ -398,46 +385,10 @@ void OSystem_PSP::setupMixer(void) { assert(_mixer); _mixer->setReady(true); _audio.unpause(); -#else - SDL_AudioSpec obtained; - SDL_AudioSpec desired; - - memset(&desired, 0, sizeof(desired)); - desired.freq = samplesPerSec; - desired.format = AUDIO_S16SYS; - desired.channels = 2; - desired.samples = samples; - desired.callback = mixCallback; - desired.userdata = this; - - if (SDL_OpenAudio(&desired, &obtained) != 0) { - warning("Could not open audio: %s", SDL_GetError()); - _mixer = new Audio::MixerImpl(this, samplesPerSec); - assert(_mixer); - _mixer->setReady(false); - } else { - // Note: This should be the obtained output rate, but it seems that at - // least on some platforms SDL will lie and claim it did get the rate - // even if it didn't. Probably only happens for "weird" rates, though. - samplesPerSec = obtained.freq; - - // Create the mixer instance and start the sound processing - _mixer = new Audio::MixerImpl(this, samplesPerSec); - assert(_mixer); - _mixer->setReady(true); - - SDL_PauseAudio(0); - } -#endif /* USE_PSP_AUDIO */ } void OSystem_PSP::quit() { -#ifdef USE_PSP_AUDIO _audio.close(); -#else - SDL_CloseAudio(); -#endif - SDL_Quit(); sceKernelExitGame(); } diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 56a64ccb80..46f258f577 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -42,8 +42,6 @@ #include "backends/timer/psp/timer.h" #include "backends/platform/psp/thread.h" -#include - class OSystem_PSP : public BaseBackend { private: @@ -64,8 +62,6 @@ private: PspTimer _pspTimer; PspRtc _pspRtc; - void initSDL(); - public: OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {} ~OSystem_PSP(); -- cgit v1.2.3 From 3c857be0c5cf397d364f9a6e23a095cfef0cda04 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 21 Jun 2010 11:51:19 +0000 Subject: PSP: switched loader to use PSP's debug mechanism svn-id: r50111 --- backends/platform/psp/psploader.cpp | 141 ++++++++++++++++++---------------- backends/plugins/psp/psp-provider.cpp | 8 +- 2 files changed, 81 insertions(+), 68 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/psploader.cpp b/backends/platform/psp/psploader.cpp index 68e51c1a50..464e20770c 100644 --- a/backends/platform/psp/psploader.cpp +++ b/backends/platform/psp/psploader.cpp @@ -37,24 +37,20 @@ #include "backends/platform/psp/psploader.h" #include "backends/platform/psp/powerman.h" -//#define __PSP_DEBUG_PLUGINS__ +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ -#ifdef __PSP_DEBUG_PLUGINS__ -#define DBG(x,...) fprintf(stderr,x, ## __VA_ARGS__) -#else -#define DBG(x,...) -#endif - -#define seterror(x,...) fprintf(stderr,x, ## __VA_ARGS__) +#include "backends/platform/psp/trace.h" extern char __plugin_hole_start; // Indicates start of hole in program file for shorts extern char __plugin_hole_end; // Indicates end of hole in program file -extern char _gp[]; // Value of gp register +extern char _gp[]; // Value of gp register DECLARE_SINGLETON(ShortSegmentManager) // For singleton // Get rid of symbol table in memory void DLObject::discard_symtab() { + DEBUG_ENTER_FUNC(); free(_symtab); free(_strtab); _symtab = NULL; @@ -64,6 +60,7 @@ void DLObject::discard_symtab() { // Unload all objects from memory void DLObject::unload() { + DEBUG_ENTER_FUNC(); discard_symtab(); free(_segment); _segment = NULL; @@ -84,18 +81,19 @@ void DLObject::unload() { * */ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void *relSegment) { + DEBUG_ENTER_FUNC(); Elf32_Rel *rel = NULL; // relocation entry // Allocate memory for relocation table if (!(rel = (Elf32_Rel *)malloc(size))) { - seterror("Out of memory."); + PSP_ERROR("Out of memory."); return false; } // Read in our relocation table if (lseek(fd, offset, SEEK_SET) < 0 || read(fd, rel, size) != (ssize_t)size) { - seterror("Relocation table load failed."); + PSP_ERROR("Relocation table load failed."); free(rel); return false; } @@ -103,7 +101,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * // Treat each relocation entry. Loop over all of them int cnt = size / sizeof(*rel); - DBG("Loaded relocation table. %d entries. base address=%p\n", cnt, relSegment); + PSP_DEBUG_PRINT("Loaded relocation table. %d entries. base address=%p\n", cnt, relSegment); bool seenHi16 = false; // For treating HI/LO16 commands int firstHi16 = -1; // Mark the point of the first hi16 seen @@ -127,7 +125,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * // Get the target instruction in the code unsigned int *target = (unsigned int *)((char *)relSegment + rel[i].r_offset); - unsigned int origTarget = *target; // Save for debugging + PSP_DEBUG_DO(unsigned int origTarget = *target); // Save for debugging // Act differently based on the type of relocation switch (REL_TYPE(rel[i].r_info)) { @@ -142,7 +140,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * lastHiSymVal = sym->st_value; hi16InShorts = (ShortsMan.inGeneralSegment((char *)sym->st_value)); // Fix for problem with switching btw segments if (debugRelocs[0]++ < DEBUG_NUM) // Print only a set number - DBG("R_MIPS_HI16: i=%d, offset=%x, ahl = %x, target = %x\n", + PSP_DEBUG_PRINT("R_MIPS_HI16: i=%d, offset=%x, ahl = %x, target = %x\n", i, rel[i].r_offset, ahl, *target); } break; @@ -150,7 +148,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * case R_MIPS_LO16: // Absolute addressing. Needs a HI16 to come before it if (sym->st_shndx < SHN_LOPROC) { // Only shift for plugin section. (ie. has a real section index) if (!seenHi16) { // We MUST have seen HI16 first - seterror("R_MIPS_LO16 w/o preceding R_MIPS_HI16 at relocation %d!\n", i); + PSP_ERROR("R_MIPS_LO16 w/o preceding R_MIPS_HI16 at relocation %d!\n", i); free(rel); return false; } @@ -195,10 +193,10 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * *target |= relocation & 0xffff; // Take the lower 16 bits of the relocation if (debugRelocs[1]++ < DEBUG_NUM) - DBG("R_MIPS_LO16: i=%d, offset=%x, a=%x, ahl = %x, lastTarget = %x, origt = %x, target = %x\n", + PSP_DEBUG_PRINT("R_MIPS_LO16: i=%d, offset=%x, a=%x, ahl = %x, lastTarget = %x, origt = %x, target = %x\n", i, rel[i].r_offset, a, ahl, *lastTarget, origTarget, *target); if (lo16InShorts && debugRelocs[2]++ < DEBUG_NUM) - DBG("R_MIPS_LO16s: i=%d, offset=%x, a=%x, ahl = %x, lastTarget = %x, origt = %x, target = %x\n", + PSP_DEBUG_PRINT("R_MIPS_LO16s: i=%d, offset=%x, a=%x, ahl = %x, lastTarget = %x, origt = %x, target = %x\n", i, rel[i].r_offset, a, ahl, *lastTarget, origTarget, *target); } break; @@ -212,11 +210,11 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * *target |= (relocation & 0x03ffffff); if (debugRelocs[3]++ < DEBUG_NUM) - DBG("R_MIPS_26: i=%d, offset=%x, symbol=%d, stinfo=%x, a=%x, origTarget=%x, target=%x\n", + PSP_DEBUG_PRINT("R_MIPS_26: i=%d, offset=%x, symbol=%d, stinfo=%x, a=%x, origTarget=%x, target=%x\n", i, rel[i].r_offset, REL_INDEX(rel[i].r_info), sym->st_info, a, origTarget, *target); } else { if (debugRelocs[4]++ < DEBUG_NUM) - DBG("R_MIPS_26: i=%d, offset=%x, symbol=%d, stinfo=%x, a=%x, origTarget=%x, target=%x\n", + PSP_DEBUG_PRINT("R_MIPS_26: i=%d, offset=%x, symbol=%d, stinfo=%x, a=%x, origTarget=%x, target=%x\n", i, rel[i].r_offset, REL_INDEX(rel[i].r_info), sym->st_info, a, origTarget, *target); } break; @@ -233,7 +231,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * *target |= relocation & 0xffff; if (debugRelocs[5]++ < DEBUG_NUM) - DBG("R_MIPS_GPREL16: i=%d, a=%x, gpVal=%x, origTarget=%x, target=%x, offset=%x\n", + PSP_DEBUG_PRINT("R_MIPS_GPREL16: i=%d, a=%x, gpVal=%x, origTarget=%x, target=%x, offset=%x\n", i, a, _gpVal, origTarget, *target, _shortsSegment->getOffset()); } @@ -250,24 +248,25 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void * *target = relocation; if (debugRelocs[6]++ < DEBUG_NUM) - DBG("R_MIPS_32: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); + PSP_DEBUG_PRINT("R_MIPS_32: i=%d, a=%x, origTarget=%x, target=%x\n", i, a, origTarget, *target); } break; default: - seterror("Unknown relocation type %x at relocation %d.\n", REL_TYPE(rel[i].r_info), i); + PSP_ERROR("Unknown relocation type %x at relocation %d.\n", REL_TYPE(rel[i].r_info), i); free(rel); return false; } } - DBG("Done with relocation. extendedHi16=%d\n\n", extendedHi16); + PSP_DEBUG_PRINT("Done with relocation. extendedHi16=%d\n\n", extendedHi16); free(rel); return true; } bool DLObject::readElfHeader(int fd, Elf32_Ehdr *ehdr) { + DEBUG_ENTER_FUNC(); // Start reading the elf header. Check for errors if (read(fd, ehdr, sizeof(*ehdr)) != sizeof(*ehdr) || memcmp(ehdr->e_ident, ELFMAG, SELFMAG) || // Check MAGIC @@ -275,31 +274,32 @@ bool DLObject::readElfHeader(int fd, Elf32_Ehdr *ehdr) { ehdr->e_machine != EM_MIPS || // Check for MIPS machine type ehdr->e_phentsize < sizeof(Elf32_Phdr) || // Check for size of program header ehdr->e_shentsize != sizeof(Elf32_Shdr)) { // Check for size of section header - seterror("Invalid file type."); + PSP_ERROR("Invalid file type."); return false; } - DBG("phoff = %d, phentsz = %d, phnum = %d\n", + PSP_DEBUG_PRINT("phoff = %d, phentsz = %d, phnum = %d\n", ehdr->e_phoff, ehdr->e_phentsize, ehdr->e_phnum); return true; } bool DLObject::readProgramHeaders(int fd, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, int num) { + DEBUG_ENTER_FUNC(); // Read program header if (lseek(fd, ehdr->e_phoff + sizeof(*phdr)*num, SEEK_SET) < 0 || read(fd, phdr, sizeof(*phdr)) != sizeof(*phdr)) { - seterror("Program header load failed."); + PSP_ERROR("Program header load failed."); return false; } // Check program header values if (phdr->p_type != PT_LOAD || phdr->p_filesz > phdr->p_memsz) { - seterror("Invalid program header."); + PSP_ERROR("Invalid program header."); return false; } - DBG("offs = %x, filesz = %x, memsz = %x, align = %x\n", + PSP_DEBUG_PRINT("offs = %x, filesz = %x, memsz = %x, align = %x\n", phdr->p_offset, phdr->p_filesz, phdr->p_memsz, phdr->p_align); return true; @@ -307,6 +307,7 @@ bool DLObject::readProgramHeaders(int fd, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr, in } bool DLObject::loadSegment(int fd, Elf32_Phdr *phdr) { + DEBUG_ENTER_FUNC(); char *baseAddress = 0; @@ -315,15 +316,15 @@ bool DLObject::loadSegment(int fd, Elf32_Phdr *phdr) { // Attempt to allocate memory for segment int extra = phdr->p_vaddr % phdr->p_align; // Get extra length TODO: check logic here - DBG("extra mem is %x\n", extra); + PSP_DEBUG_PRINT("extra mem is %x\n", extra); if (phdr->p_align < 0x10000) phdr->p_align = 0x10000; // Fix for wrong alignment on e.g. AGI if (!(_segment = (char *)memalign(phdr->p_align, phdr->p_memsz + extra))) { - seterror("Out of memory.\n"); + PSP_ERROR("Out of memory.\n"); return false; } - DBG("allocated segment @ %p\n", _segment); + PSP_DEBUG_PRINT("allocated segment @ %p\n", _segment); // Get offset to load segment into baseAddress = (char *)_segment + phdr->p_vaddr; @@ -332,20 +333,20 @@ bool DLObject::loadSegment(int fd, Elf32_Phdr *phdr) { _shortsSegment = ShortsMan.newSegment(phdr->p_memsz, (char *)phdr->p_vaddr); baseAddress = _shortsSegment->getStart(); - DBG("shorts segment @ %p to %p. Segment wants to be at %x. Offset=%x\n", + PSP_DEBUG_PRINT("shorts segment @ %p to %p. Segment wants to be at %x. Offset=%x\n", _shortsSegment->getStart(), _shortsSegment->getEnd(), phdr->p_vaddr, _shortsSegment->getOffset()); } // Set bss segment to 0 if necessary (assumes bss is at the end) if (phdr->p_memsz > phdr->p_filesz) { - DBG("Setting %p to %p to 0 for bss\n", baseAddress + phdr->p_filesz, baseAddress + phdr->p_memsz); + PSP_DEBUG_PRINT("Setting %p to %p to 0 for bss\n", baseAddress + phdr->p_filesz, baseAddress + phdr->p_memsz); memset(baseAddress + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); } // Read the segment into memory if (lseek(fd, phdr->p_offset, SEEK_SET) < 0 || read(fd, baseAddress, phdr->p_filesz) != (ssize_t)phdr->p_filesz) { - seterror("Segment load failed."); + PSP_ERROR("Segment load failed."); return false; } @@ -354,12 +355,13 @@ bool DLObject::loadSegment(int fd, Elf32_Phdr *phdr) { Elf32_Shdr * DLObject::loadSectionHeaders(int fd, Elf32_Ehdr *ehdr) { + DEBUG_ENTER_FUNC(); Elf32_Shdr *shdr = NULL; // Allocate memory for section headers if (!(shdr = (Elf32_Shdr *)malloc(ehdr->e_shnum * sizeof(*shdr)))) { - seterror("Out of memory."); + PSP_ERROR("Out of memory."); return NULL; } @@ -367,7 +369,7 @@ Elf32_Shdr * DLObject::loadSectionHeaders(int fd, Elf32_Ehdr *ehdr) { if (lseek(fd, ehdr->e_shoff, SEEK_SET) < 0 || read(fd, shdr, ehdr->e_shnum * sizeof(*shdr)) != (ssize_t)(ehdr->e_shnum * sizeof(*shdr))) { - seterror("Section headers load failed."); + PSP_ERROR("Section headers load failed."); return NULL; } @@ -375,11 +377,12 @@ Elf32_Shdr * DLObject::loadSectionHeaders(int fd, Elf32_Ehdr *ehdr) { } int DLObject::loadSymbolTable(int fd, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { + DEBUG_ENTER_FUNC(); // Loop over sections, looking for symbol table linked to a string table for (int i = 0; i < ehdr->e_shnum; i++) { - //DBG("Section %d: type = %x, size = %x, entsize = %x, link = %x\n", - // i, shdr[i].sh_type, shdr[i].sh_size, shdr[i].sh_entsize, shdr[i].sh_link); + PSP_DEBUG_PRINT("Section %d: type = %x, size = %x, entsize = %x, link = %x\n", + i, shdr[i].sh_type, shdr[i].sh_size, shdr[i].sh_entsize, shdr[i].sh_link); if (shdr[i].sh_type == SHT_SYMTAB && shdr[i].sh_entsize == sizeof(Elf32_Sym) && @@ -392,15 +395,15 @@ int DLObject::loadSymbolTable(int fd, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { // Check for no symbol table if (_symtab_sect < 0) { - seterror("No symbol table."); + PSP_ERROR("No symbol table."); return -1; } - DBG("Symbol section at section %d, size %x\n", _symtab_sect, shdr[_symtab_sect].sh_size); + PSP_DEBUG_PRINT("Symbol section at section %d, size %x\n", _symtab_sect, shdr[_symtab_sect].sh_size); // Allocate memory for symbol table if (!(_symtab = malloc(shdr[_symtab_sect].sh_size))) { - seterror("Out of memory."); + PSP_ERROR("Out of memory."); return -1; } @@ -408,25 +411,26 @@ int DLObject::loadSymbolTable(int fd, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { if (lseek(fd, shdr[_symtab_sect].sh_offset, SEEK_SET) < 0 || read(fd, _symtab, shdr[_symtab_sect].sh_size) != (ssize_t)shdr[_symtab_sect].sh_size) { - seterror("Symbol table load failed."); + PSP_ERROR("Symbol table load failed."); return -1; } // Set number of symbols _symbol_cnt = shdr[_symtab_sect].sh_size / sizeof(Elf32_Sym); - DBG("Loaded %d symbols.\n", _symbol_cnt); + PSP_DEBUG_PRINT("Loaded %d symbols.\n", _symbol_cnt); return _symtab_sect; } bool DLObject::loadStringTable(int fd, Elf32_Shdr *shdr) { + DEBUG_ENTER_FUNC(); int string_sect = shdr[_symtab_sect].sh_link; // Allocate memory for string table if (!(_strtab = (char *)malloc(shdr[string_sect].sh_size))) { - seterror("Out of memory."); + PSP_ERROR("Out of memory."); return false; } @@ -434,16 +438,17 @@ bool DLObject::loadStringTable(int fd, Elf32_Shdr *shdr) { if (lseek(fd, shdr[string_sect].sh_offset, SEEK_SET) < 0 || read(fd, _strtab, shdr[string_sect].sh_size) != (ssize_t)shdr[string_sect].sh_size) { - seterror("Symbol table strings load failed."); + PSP_ERROR("Symbol table strings load failed."); return false; } return true; } void DLObject::relocateSymbols(Elf32_Addr offset, Elf32_Addr shortsOffset) { + DEBUG_ENTER_FUNC(); int shortsCount = 0, othersCount = 0; - DBG("Relocating symbols by %x. Shorts offset=%x\n", offset, shortsOffset); + PSP_DEBUG_PRINT("Relocating symbols by %x. Shorts offset=%x\n", offset, shortsOffset); // Loop over symbols, add relocation offset Elf32_Sym *s = (Elf32_Sym *)_symtab; @@ -454,22 +459,23 @@ void DLObject::relocateSymbols(Elf32_Addr offset, Elf32_Addr shortsOffset) { othersCount++; s->st_value += offset; if (s->st_value < (Elf32_Addr)_segment || s->st_value > (Elf32_Addr)_segment + _segmentSize) - seterror("Symbol out of bounds! st_value = %x\n", s->st_value); + PSP_ERROR("Symbol out of bounds! st_value = %x\n", s->st_value); } else { // shorts section shortsCount++; s->st_value += shortsOffset; if (!_shortsSegment->inSegment((char *)s->st_value)) - seterror("Symbol out of bounds! st_value = %x\n", s->st_value); + PSP_ERROR("Symbol out of bounds! st_value = %x\n", s->st_value); } } } - DBG("Relocated %d short symbols, %d others.\n", shortsCount, othersCount); + PSP_DEBUG_PRINT("Relocated %d short symbols, %d others.\n", shortsCount, othersCount); } bool DLObject::relocateRels(int fd, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { + DEBUG_ENTER_FUNC(); // Loop over sections, finding relocation sections for (int i = 0; i < ehdr->e_shnum; i++) { @@ -500,7 +506,7 @@ bool DLObject::relocateRels(int fd, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) { bool DLObject::load(int fd) { - fprintf(stderr, "In DLObject::load\n"); + DEBUG_ENTER_FUNC(); Elf32_Ehdr ehdr; // ELF header Elf32_Phdr phdr; // Program header @@ -512,8 +518,7 @@ bool DLObject::load(int fd) { } for (int i = 0; i < ehdr.e_phnum; i++) { // Load our 2 segments - - fprintf(stderr, "Loading segment %d\n", i); + PSP_DEBUG_PRINT("Loading segment %d\n", i); if (readProgramHeaders(fd, &ehdr, &phdr, i) == false) return false; @@ -543,19 +548,20 @@ bool DLObject::load(int fd) { } bool DLObject::open(const char *path) { + DEBUG_ENTER_FUNC(); int fd; void *ctors_start, *ctors_end; - DBG("open(\"%s\")\n", path); + PSP_DEBUG_PRINT("open(\"%s\")\n", path); // Get the address of the global pointer _gpVal = (unsigned int) & _gp; - DBG("_gpVal is %x\n", _gpVal); + PSP_DEBUG_PRINT("_gpVal is %x\n", _gpVal); PowerMan.beginCriticalSection(); if ((fd = ::open(path, O_RDONLY)) < 0) { - seterror("%s not found.", path); + PSP_ERROR("%s not found.", path); return false; } @@ -581,21 +587,22 @@ bool DLObject::open(const char *path) { if (ctors_start == NULL || ctors_end == NULL || _dtors_start == NULL || _dtors_end == NULL) { - seterror("Missing ctors/dtors."); + PSP_ERROR("Missing ctors/dtors."); _dtors_start = _dtors_end = NULL; unload(); return false; } - DBG("Calling constructors.\n"); + PSP_DEBUG_PRINT("Calling constructors.\n"); for (void (**f)(void) = (void (**)(void))ctors_start; f != ctors_end; f++) (**f)(); - DBG("%s opened ok.\n", path); + PSP_DEBUG_PRINT("%s opened ok.\n", path); return true; } bool DLObject::close() { + DEBUG_ENTER_FUNC(); if (_dtors_start != NULL && _dtors_end != NULL) for (void (**f)(void) = (void (**)(void))_dtors_start; f != _dtors_end; f++) (**f)(); @@ -605,10 +612,11 @@ bool DLObject::close() { } void *DLObject::symbol(const char *name) { - DBG("symbol(\"%s\")\n", name); + DEBUG_ENTER_FUNC(); + PSP_DEBUG_PRINT("symbol(\"%s\")\n", name); if (_symtab == NULL || _strtab == NULL || _symbol_cnt < 1) { - seterror("No symbol table loaded."); + PSP_ERROR("No symbol table loaded."); return NULL; } @@ -621,23 +629,25 @@ void *DLObject::symbol(const char *name) { !strcmp(name, _strtab + s->st_name)) { // We found the symbol - DBG("=> %p\n", (void*)s->st_value); + PSP_DEBUG_PRINT("=> %p\n", (void*)s->st_value); return (void*)s->st_value; } } - seterror("Symbol \"%s\" not found.", name); + PSP_ERROR("Symbol \"%s\" not found.", name); return NULL; } ShortSegmentManager::ShortSegmentManager() { + DEBUG_ENTER_FUNC(); _shortsStart = &__plugin_hole_start ; _shortsEnd = &__plugin_hole_end; } ShortSegmentManager::Segment *ShortSegmentManager::newSegment(int size, char *origAddr) { + DEBUG_ENTER_FUNC(); char *lastAddress = origAddr; Common::List::iterator i; @@ -654,7 +664,7 @@ ShortSegmentManager::Segment *ShortSegmentManager::newSegment(int size, char *or lastAddress += 4 - ((Elf32_Addr)lastAddress & 3); // Round up to multiple of 4 if (lastAddress + size > _shortsEnd) { - seterror("Error. No space in shorts segment for %x bytes. Last address is %p, max address is %p.\n", + PSP_ERROR("No space in shorts segment for %x bytes. Last address is %p, max address is %p.\n", size, lastAddress, _shortsEnd); return NULL; } @@ -665,14 +675,15 @@ ShortSegmentManager::Segment *ShortSegmentManager::newSegment(int size, char *or _list.insert(i, seg); - DBG("Shorts segment size %x allocated. End = %p. Remaining space = %x. Highest so far is %p.\n", + PSP_DEBUG_PRINT("Shorts segment size %x allocated. End = %p. Remaining space = %x. Highest so far is %p.\n", size, lastAddress + size, _shortsEnd - _list.back()->getEnd(), _highestAddress); return seg; } void ShortSegmentManager::deleteSegment(ShortSegmentManager::Segment *seg) { - DBG("Deleting shorts segment from %p to %p.\n\n", seg->getStart(), seg->getEnd()); + DEBUG_ENTER_FUNC(); + PSP_DEBUG_PRINT("Deleting shorts segment from %p to %p.\n\n", seg->getStart(), seg->getEnd()); _list.remove(seg); delete seg; } diff --git a/backends/plugins/psp/psp-provider.cpp b/backends/plugins/psp/psp-provider.cpp index f394916538..5760424cbf 100644 --- a/backends/plugins/psp/psp-provider.cpp +++ b/backends/plugins/psp/psp-provider.cpp @@ -31,6 +31,8 @@ #include "backends/platform/psp/psploader.h" +#include "backends/platform/psp/trace.h" + class PSPPlugin : public DynamicPlugin { protected: @@ -95,13 +97,13 @@ Plugin* PSPPluginProvider::createPlugin(const Common::FSNode &node) const { bool PSPPluginProvider::isPluginFilename(const Common::FSNode &node) const { // Check the plugin suffix Common::String filename = node.getName(); - fprintf(stderr, "Testing name %s", filename.c_str()); + PSP_DEBUG_PRINT("Testing name %s", filename.c_str()); if (!filename.hasSuffix(".PLG") && !filename.hasSuffix(".plg")) { - fprintf(stderr," fail.\n"); + PSP_DEBUG_PRINT(" fail.\n"); return false; } - fprintf(stderr," success!\n"); + PSP_DEBUG_PRINT(" success!\n"); return true; } -- cgit v1.2.3 From 57b8e2caaabebde88eb46d0d85d3c09414cdc778 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 21 Jun 2010 13:23:13 +0000 Subject: PSP: removed default 'using ME' message svn-id: r50112 --- backends/platform/psp/mp3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp index 972c5a8ba8..eab8670280 100644 --- a/backends/platform/psp/mp3.cpp +++ b/backends/platform/psp/mp3.cpp @@ -85,13 +85,13 @@ bool Mp3PspStream::initDecoder() { } } else { if (sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC) < 0) { - PSP_ERROR("failed to load AVCODEC module.\n"); + PSP_ERROR("failed to load AVCODEC module. ME cannot start.\n"); _decoderFail = true; return false; } } - PSP_INFO_PRINT("Using PSP's ME for MP3\n"); // important to know this is happening + PSP_DEBUG_PRINT("Using PSP's ME for MP3\n"); // important to know this is happening _decoderInit = true; return true; -- cgit v1.2.3 From b5a25a6e1988c11929fe68cc9e5786bf738b21ce Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 21 Jun 2010 13:58:51 +0000 Subject: PSP: errors from both ScummVM and the PSP port now print to file by default. This should make debugging easier, especially for users. svn-id: r50113 --- backends/platform/psp/mp3.cpp | 2 +- backends/platform/psp/trace.cpp | 11 ++++++++--- backends/platform/psp/trace.h | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp index eab8670280..e25891396b 100644 --- a/backends/platform/psp/mp3.cpp +++ b/backends/platform/psp/mp3.cpp @@ -319,7 +319,7 @@ void Mp3PspStream::decodeMP3Data() { // This function blocks. We'll want to put it in a thread int ret = sceAudiocodecDecode(_codecParams, 0x1002); if (ret < 0) { - PSP_ERROR("failed to decode MP3 data in ME. sceAudiocodecDecode returned 0x%x\n", ret); + PSP_INFO_PRINT("failed to decode MP3 data in ME. sceAudiocodecDecode returned 0x%x\n", ret); // handle error here } diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 4bf5450177..7bac6534da 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -30,8 +30,9 @@ #include int psp_debug_indent = 0; +bool firstWriteToFile = true; -void PSPDebugTrace(bool alsoToScreen, const char *format, ...) { +void PspDebugTrace(bool alsoToScreen, const char *format, ...) { va_list opt; char buffer[2048]; int bufsz; @@ -41,8 +42,12 @@ void PSPDebugTrace(bool alsoToScreen, const char *format, ...) { bufsz = vsnprintf(buffer, (size_t) sizeof(buffer), format, opt); va_end(opt); - //fd = fopen("MS0:/SCUMMTRACE.TXT", "ab"); - fd = fopen("SCUMMTRACE.TXT", "ab"); + if (firstWriteToFile) { + fd = fopen("SCUMMTRACE.TXT", "wb"); // erase the file the first time we write + firstWriteToFile = false; + } else { + fd = fopen("SCUMMTRACE.TXT", "ab"); + } if (fd == 0) return; diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h index 1aad0f6781..ade8fd7214 100644 --- a/backends/platform/psp/trace.h +++ b/backends/platform/psp/trace.h @@ -39,8 +39,8 @@ #define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__) #endif /* PSP_PRINT_TO_FILE/SCREEN */ -/* Error function */ -#define PSP_ERROR(format,...) __PSP_PRINT__("Error in %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) +/* Error function - always print to file as well */ +#define PSP_ERROR(format,...) PspDebugTrace(true, "Error in %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__) /* Do the indent */ #define __PSP_INDENT__ for(int _i=psp_debug_indent; _i>0; _i--) \ @@ -52,7 +52,7 @@ #define PSP_INFO_PRINT_INDENT(format,...) { __PSP_INDENT__; \ __PSP_PRINT__(format, ## __VA_ARGS__); } -void PSPDebugTrace(bool alsoToScreen, const char *format, ...); +void PspDebugTrace(bool alsoToScreen, const char *format, ...); extern int psp_debug_indent; -- cgit v1.2.3 From 65fe8d817c627fe56929533a4a0fb4d2c5cb76c2 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 21 Jun 2010 15:13:36 +0000 Subject: PSP: moved RTC to singleton to allow usage by classes other than Osystem svn-id: r50116 --- backends/platform/psp/Makefile | 1 + backends/platform/psp/module.mk | 1 + backends/platform/psp/osys_psp.cpp | 6 ++- backends/platform/psp/osys_psp.h | 1 - backends/platform/psp/rtc.cpp | 87 ++++++++++++++++++++++++++++++++++++++ backends/platform/psp/rtc.h | 45 ++++++++++++++++++++ backends/platform/psp/thread.cpp | 57 ------------------------- backends/platform/psp/thread.h | 17 +------- 8 files changed, 140 insertions(+), 75 deletions(-) create mode 100644 backends/platform/psp/rtc.cpp create mode 100644 backends/platform/psp/rtc.h (limited to 'backends') diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile index 02fd8b022a..fed558eaad 100644 --- a/backends/platform/psp/Makefile +++ b/backends/platform/psp/Makefile @@ -147,6 +147,7 @@ OBJS := powerman.o \ pspkeyboard.o \ audio.o \ thread.o \ + rtc.o \ mp3.o # Include common Scummvm makefile diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk index 99170ce7fb..e9c896acfd 100644 --- a/backends/platform/psp/module.mk +++ b/backends/platform/psp/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := powerman.o \ pspkeyboard.o \ audio.o \ thread.o \ + rtc.o \ mp3.o MODULE_DIRS += \ diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 01053b8cbb..b09d9c0c00 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -37,6 +37,7 @@ #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" #include "backends/platform/psp/powerman.h" +#include "backends/platform/psp/rtc.h" #include "backends/saves/psp/psp-saves.h" #include "backends/timer/default/default-timer.h" @@ -64,6 +65,9 @@ OSystem_PSP::~OSystem_PSP() {} void OSystem_PSP::initBackend() { DEBUG_ENTER_FUNC(); + // Instantiate real time clock + PspRtc::instance(); + _cursor.enableCursorPalette(false); _cursor.setXY(PSP_SCREEN_WIDTH >> 1, PSP_SCREEN_HEIGHT >> 1); // Mouse in the middle of the screen @@ -320,7 +324,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { } uint32 OSystem_PSP::getMillis() { - return _pspRtc.getMillis(); + return PspRtc::instance().getMillis(); } void OSystem_PSP::delayMillis(uint msecs) { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 46f258f577..5721296c94 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -60,7 +60,6 @@ private: InputHandler _inputHandler; PspAudio _audio; PspTimer _pspTimer; - PspRtc _pspRtc; public: OSystem_PSP() : _savefile(0), _mixer(0), _timer(0), _pendingUpdate(false), _pendingUpdateCounter(0) {} diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp new file mode 100644 index 0000000000..57edea7e49 --- /dev/null +++ b/backends/platform/psp/rtc.cpp @@ -0,0 +1,87 @@ +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 49903 2010-06-16 09:04:27Z Bluddy $ + * + */ + +#include +#include +#include + +#include "common/scummsys.h" +#include "backends/platform/psp/rtc.h" + +//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ +//#define __PSP_DEBUG_PRINT__ /* For debug printouts */ + +#include "backends/platform/psp/trace.h" + + +// Class PspRtc --------------------------------------------------------------- +DECLARE_SINGLETON(PspRtc) + +void PspRtc::init() { // init our starting ticks + uint32 ticks[2]; + sceRtcGetCurrentTick((u64 *)ticks); + + _startMillis = ticks[0]/1000; + _startMicros = ticks[0]; + //_lastMillis = ticks[0]/1000; //debug - only when we don't subtract startMillis +} + +#define MS_LOOP_AROUND 4294967 /* We loop every 2^32 / 1000 = 71 minutes */ +#define MS_LOOP_CHECK 60000 /* Threading can cause weird mixups without this */ + +// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause +// unpredictable results +uint32 PspRtc::getMillis() { + uint32 ticks[2]; + + sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays + + uint32 millis = ticks[0]/1000; + millis -= _startMillis; // get ms since start of program + + if ((int)_lastMillis - (int)millis > MS_LOOP_CHECK) { // we must have looped around + if (_looped == false) { // check to make sure threads do this once + _looped = true; + _milliOffset += MS_LOOP_AROUND; // add the needed offset + PSP_DEBUG_PRINT("looping around. last ms[%d], curr ms[%d]\n", _lastMillis, millis); + } + } else { + _looped = false; + } + + _lastMillis = millis; + + return millis + _milliOffset; +} + +uint32 PspRtc::getMicros() { + uint32 ticks[2]; + + sceRtcGetCurrentTick((u64 *)ticks); + ticks[0] -= _startMicros; + + return ticks[0]; +} + diff --git a/backends/platform/psp/rtc.h b/backends/platform/psp/rtc.h new file mode 100644 index 0000000000..3f2d52ff16 --- /dev/null +++ b/backends/platform/psp/rtc.h @@ -0,0 +1,45 @@ +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 49903 2010-06-16 09:04:27Z Bluddy $ + * + */ + +#ifndef _PSP_RTC_H_ +#define _PSP_RTC_H_ + +#include "common/singleton.h" + +class PspRtc : public Common::Singleton{ +private: + uint32 _startMillis; + uint32 _startMicros; + uint32 _lastMillis; + uint32 _milliOffset; // to prevent looping around of millis + bool _looped; // make sure we only loop once - for threading +public: + PspRtc() : _startMillis(0), _startMicros(0), _lastMillis(0), _milliOffset(0), _looped(false) { init(); } + void init(); + uint32 getMillis(); + uint32 getMicros(); +}; + +#endif \ No newline at end of file diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index 43e3b931c3..c19ff5f9e3 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -23,9 +23,6 @@ * */ -#include -#include -#include #include #include "backends/platform/psp/thread.h" @@ -192,57 +189,3 @@ void PspCondition::wait(PspMutex &externalMutex) { externalMutex.lock(); // must lock external mutex here for continuation } -//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ -//#define __PSP_DEBUG_PRINT__ /* For debug printouts */ - -#include "backends/platform/psp/trace.h" - - -// Class PspRtc --------------------------------------------------------------- - -void PspRtc::init() { // init our starting ticks - uint32 ticks[2]; - sceRtcGetCurrentTick((u64 *)ticks); - - _startMillis = ticks[0]/1000; - _startMicros = ticks[0]; - //_lastMillis = ticks[0]/1000; //debug - only when we don't subtract startMillis -} - -#define MS_LOOP_AROUND 4294967 /* We loop every 2^32 / 1000 = 71 minutes */ -#define MS_LOOP_CHECK 60000 /* Threading can cause weird mixups without this */ - -// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause -// unpredictable results -uint32 PspRtc::getMillis() { - uint32 ticks[2]; - - sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays - - uint32 millis = ticks[0]/1000; - millis -= _startMillis; // get ms since start of program - - if ((int)_lastMillis - (int)millis > MS_LOOP_CHECK) { // we must have looped around - if (_looped == false) { // check to make sure threads do this once - _looped = true; - _milliOffset += MS_LOOP_AROUND; // add the needed offset - PSP_DEBUG_PRINT("looping around. last ms[%d], curr ms[%d]\n", _lastMillis, millis); - } - } else { - _looped = false; - } - - _lastMillis = millis; - - return millis + _milliOffset; -} - -uint32 PspRtc::getMicros() { - uint32 ticks[2]; - - sceRtcGetCurrentTick((u64 *)ticks); - ticks[0] -= _startMicros; - - return ticks[0]; -} - diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index bd7a60b6ed..27d53903d6 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -73,22 +73,7 @@ public: PspCondition() : _mutex(true), _waitingThreads(0), _signaledThreads(0), _waitSem(0), _doneSem(0) {} void wait(PspMutex &externalMutex); - void releaseAll(); -}; - - -class PspRtc { -private: - uint32 _startMillis; - uint32 _startMicros; - uint32 _lastMillis; - uint32 _milliOffset; // to prevent looping around of millis - bool _looped; // make sure we only loop once -public: - PspRtc() : _startMillis(0), _startMicros(0), _lastMillis(0), _milliOffset(0), _looped(false) { init(); } - void init(); - uint32 getMillis(); - uint32 getMicros(); + void releaseAll(); }; enum ThreadPriority { -- cgit v1.2.3 From bbad3f333a9227ccb1de633a0fe92d9e01ad7bb3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 21 Jun 2010 21:36:36 +0000 Subject: Patch #1956501: "GUI/LAUNCHER: Midi device selection" svn-id: r50128 --- backends/midi/alsa.cpp | 13 ++----------- backends/midi/camd.cpp | 13 ++----------- backends/midi/coreaudio.cpp | 13 ++----------- backends/midi/coremidi.cpp | 13 ++----------- backends/midi/dmedia.cpp | 13 ++----------- backends/midi/seq.cpp | 13 ++----------- backends/midi/stmidi.cpp | 14 ++------------ backends/midi/timidity.cpp | 13 ++----------- backends/midi/windows.cpp | 47 +++++++++++++++++++++++++++++---------------- backends/midi/ypa1.cpp | 13 ++----------- backends/midi/zodiac.cpp | 13 ++----------- 11 files changed, 50 insertions(+), 128 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index c38537248c..a82fffdf0d 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -269,7 +269,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; #define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) @@ -315,21 +315,12 @@ MusicDevices AlsaMusicPlugin::getDevices() const { return devices; } -Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_ALSA(); return Common::kNoError; } -MidiDriver *MidiDriver_ALSA_create() { - MidiDriver *mididriver; - - AlsaMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(ALSA) //REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin); //#else diff --git a/backends/midi/camd.cpp b/backends/midi/camd.cpp index e4ca3569f2..3486532549 100644 --- a/backends/midi/camd.cpp +++ b/backends/midi/camd.cpp @@ -177,7 +177,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices CamdMusicPlugin::getDevices() const { @@ -188,21 +188,12 @@ MusicDevices CamdMusicPlugin::getDevices() const { return devices; } -Common::Error CamdMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error CamdMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_CAMD(); return Common::kNoError; } -MidiDriver *MidiDriver_CAMD_create() { - MidiDriver *mididriver; - - CamdMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(CAMD) //REGISTER_PLUGIN_DYNAMIC(CAMD, PLUGIN_TYPE_MUSIC, CamdMusicPlugin); //#else diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp index d52547c997..aa0ad75f0a 100644 --- a/backends/midi/coreaudio.cpp +++ b/backends/midi/coreaudio.cpp @@ -218,7 +218,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices CoreAudioMusicPlugin::getDevices() const { @@ -229,21 +229,12 @@ MusicDevices CoreAudioMusicPlugin::getDevices() const { return devices; } -Common::Error CoreAudioMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error CoreAudioMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_CORE(); return Common::kNoError; } -MidiDriver *MidiDriver_CORE_create() { - MidiDriver *mididriver; - - CoreAudioMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(COREAUDIO) //REGISTER_PLUGIN_DYNAMIC(COREAUDIO, PLUGIN_TYPE_MUSIC, CoreAudioMusicPlugin); //#else diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp index e48b98a807..08f36a8b0f 100644 --- a/backends/midi/coremidi.cpp +++ b/backends/midi/coremidi.cpp @@ -190,7 +190,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices CoreMIDIMusicPlugin::getDevices() const { @@ -201,21 +201,12 @@ MusicDevices CoreMIDIMusicPlugin::getDevices() const { return devices; } -Common::Error CoreMIDIMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error CoreMIDIMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_CoreMIDI(); return Common::kNoError; } -MidiDriver *MidiDriver_CoreMIDI_create() { - MidiDriver *mididriver; - - CoreMIDIMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(COREMIDI) //REGISTER_PLUGIN_DYNAMIC(COREMIDI, PLUGIN_TYPE_MUSIC, CoreMIDIMusicPlugin); //#else diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp index 1ec79d8513..8c006b2cd9 100644 --- a/backends/midi/dmedia.cpp +++ b/backends/midi/dmedia.cpp @@ -199,7 +199,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices DMediaMusicPlugin::getDevices() const { @@ -224,21 +224,12 @@ MusicDevices DMediaMusicPlugin::getDevices() const { return devices; } -Common::Error DMediaMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error DMediaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_DMEDIA(); return Common::kNoError; } -MidiDriver *MidiDriver_DMEDIA_create() { - MidiDriver *mididriver; - - DMediaMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(DMEDIA) //REGISTER_PLUGIN_DYNAMIC(DMEDIA, PLUGIN_TYPE_MUSIC, DMediaMusicPlugin); //#else diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 55c8239562..216c5802b7 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -184,7 +184,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices SeqMusicPlugin::getDevices() const { @@ -195,21 +195,12 @@ MusicDevices SeqMusicPlugin::getDevices() const { return devices; } -Common::Error SeqMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error SeqMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_SEQ(); return Common::kNoError; } -MidiDriver *MidiDriver_SEQ_create() { - MidiDriver *mididriver; - - SeqMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(SEQ) //REGISTER_PLUGIN_DYNAMIC(SEQ, PLUGIN_TYPE_MUSIC, SeqMusicPlugin); //#else diff --git a/backends/midi/stmidi.cpp b/backends/midi/stmidi.cpp index f99f8f74dd..b00188dfea 100644 --- a/backends/midi/stmidi.cpp +++ b/backends/midi/stmidi.cpp @@ -127,8 +127,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) - const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices StMidiMusicPlugin::getDevices() const { @@ -139,21 +138,12 @@ MusicDevices StMidiMusicPlugin::getDevices() const { return devices; } -Common::Error StMidiMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error StMidiMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_STMIDI(); return Common::kNoError; } -MidiDriver *MidiDriver_STMIDI_create() { - MidiDriver *mididriver; - - StMidiMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(STMIDI) //REGISTER_PLUGIN_DYNAMIC(STMIDI, PLUGIN_TYPE_MUSIC, StMidiMusicPlugin); //#else diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index 1a44e62b16..f507f1e00a 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -530,7 +530,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices TimidityMusicPlugin::getDevices() const { @@ -539,21 +539,12 @@ MusicDevices TimidityMusicPlugin::getDevices() const { return devices; } -Common::Error TimidityMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error TimidityMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_TIMIDITY(); return Common::kNoError; } -MidiDriver *MidiDriver_TIMIDITY_create() { - MidiDriver *mididriver; - - TimidityMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(TIMIDITY) //REGISTER_PLUGIN_DYNAMIC(TIMIDITY, PLUGIN_TYPE_MUSIC, TimidityMusicPlugin); //#else diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index 036029644e..d030d9827d 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -30,6 +30,7 @@ #include "sound/musicplugin.h" #include "sound/mpu401.h" +#include "common/config-manager.h" #include @@ -46,11 +47,12 @@ private: HANDLE _streamEvent; HMIDIOUT _mo; bool _isOpen; + int _device; void check_error(MMRESULT result); public: - MidiDriver_WIN() : _isOpen(false) { } + MidiDriver_WIN(int deviceIndex) : _isOpen(false), _device(deviceIndex) { } int open(); void close(); void send(uint32 b); @@ -62,7 +64,7 @@ int MidiDriver_WIN::open() { return MERR_ALREADY_OPEN; _streamEvent = CreateEvent(NULL, true, true, NULL); - MMRESULT res = midiOutOpen((HMIDIOUT *)&_mo, MIDI_MAPPER, (DWORD_PTR)_streamEvent, 0, CALLBACK_EVENT); + MMRESULT res = midiOutOpen((HMIDIOUT *)&_mo, _device, (DWORD_PTR)_streamEvent, 0, CALLBACK_EVENT); if (res != MMSYSERR_NOERROR) { check_error(res); CloseHandle(_streamEvent); @@ -158,32 +160,43 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices WindowsMusicPlugin::getDevices() const { MusicDevices devices; - // TODO: Return a different music type depending on the configuration - // TODO: List the available devices - devices.push_back(MusicDevice(this, "", MT_GM)); + int numDevs = midiOutGetNumDevs(); + MIDIOUTCAPS tmp; + + for (int i = 0; i < numDevs; i++) { + if (midiOutGetDevCaps(i, &tmp, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) + break; + // There is no way to detect the "MusicType" so I just set it to MT_GM + // The user will have to manually select his MT32 type device and his GM type device. + devices.push_back(MusicDevice(this, tmp.szPname, MT_GM)); + } return devices; } -Common::Error WindowsMusicPlugin::createInstance(MidiDriver **mididriver) const { - *mididriver = new MidiDriver_WIN(); +Common::Error WindowsMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle dev) const { + int devIndex = 0; + bool found = false; + + if (dev) { + MusicDevices i = getDevices(); + for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) { + if (d->getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) { + found = true; + break; + } + devIndex++; + } + } + *mididriver = new MidiDriver_WIN(found ? devIndex : 0); return Common::kNoError; } -MidiDriver *MidiDriver_WIN_create() { - MidiDriver *mididriver; - - WindowsMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(WINDOWS) //REGISTER_PLUGIN_DYNAMIC(WINDOWS, PLUGIN_TYPE_MUSIC, WindowsMusicPlugin); //#else diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp index fe65d02c10..fb114d625c 100644 --- a/backends/midi/ypa1.cpp +++ b/backends/midi/ypa1.cpp @@ -117,7 +117,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices YamahaPa1MusicPlugin::getDevices() const { @@ -128,21 +128,12 @@ MusicDevices YamahaPa1MusicPlugin::getDevices() const { return devices; } -Common::Error YamahaPa1MusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error YamahaPa1MusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_YamahaPa1(); return Common::kNoError; } -MidiDriver *MidiDriver_YamahaPa1_create() { - MidiDriver *mididriver; - - YamahaPa1MusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(YPA1) //REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin); //#else diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp index b9cb46912a..e848315ca4 100644 --- a/backends/midi/zodiac.cpp +++ b/backends/midi/zodiac.cpp @@ -135,7 +135,7 @@ public: } MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver) const; + Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; }; MusicDevices ZodiacMusicPlugin::getDevices() const { @@ -146,21 +146,12 @@ MusicDevices ZodiacMusicPlugin::getDevices() const { return devices; } -Common::Error ZodiacMusicPlugin::createInstance(MidiDriver **mididriver) const { +Common::Error ZodiacMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { *mididriver = new MidiDriver_Zodiac(); return Common::kNoError; } -MidiDriver *MidiDriver_Zodiac_create() { - MidiDriver *mididriver; - - ZodiacMusicPlugin p; - p.createInstance(&mididriver); - - return mididriver; -} - //#if PLUGIN_ENABLED_DYNAMIC(ZODIAC) //REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin); //#else -- cgit v1.2.3 From 6c854f30da2579c8e7059948c700fd0bcc72366d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 21 Jun 2010 21:37:00 +0000 Subject: PSP: Whitespace fix (and rewrap overlong line for readability) svn-id: r50129 --- backends/platform/psp/rtc.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/rtc.h b/backends/platform/psp/rtc.h index 3f2d52ff16..7c1a28474d 100644 --- a/backends/platform/psp/rtc.h +++ b/backends/platform/psp/rtc.h @@ -28,7 +28,7 @@ #include "common/singleton.h" -class PspRtc : public Common::Singleton{ +class PspRtc : public Common::Singleton { private: uint32 _startMillis; uint32 _startMicros; @@ -36,7 +36,12 @@ private: uint32 _milliOffset; // to prevent looping around of millis bool _looped; // make sure we only loop once - for threading public: - PspRtc() : _startMillis(0), _startMicros(0), _lastMillis(0), _milliOffset(0), _looped(false) { init(); } + PspRtc() + : _startMillis(0), _startMicros(0), + _lastMillis(0), _milliOffset(0), + _looped(false) { + init(); + } void init(); uint32 getMillis(); uint32 getMicros(); -- cgit v1.2.3 From 063cef0c284cda74f6ad366182818ac4d3dfca83 Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Sat, 26 Jun 2010 15:48:03 +0000 Subject: GUI: Add and improve some messages to translate svn-id: r50324 --- backends/midi/windows.cpp | 3 ++- backends/platform/sdl/graphics.cpp | 5 +++-- backends/platform/wii/options.cpp | 2 +- backends/platform/wince/wince-sdl.cpp | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index d030d9827d..08587a6b80 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -31,6 +31,7 @@ #include "sound/musicplugin.h" #include "sound/mpu401.h" #include "common/config-manager.h" +#include "common/translation.h" #include @@ -152,7 +153,7 @@ void MidiDriver_WIN::check_error(MMRESULT result) { class WindowsMusicPlugin : public MusicPluginObject { public: const char *getName() const { - return "Windows MIDI"; + return _s("Windows MIDI"); } const char *getId() const { diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 721cc54c90..05870015cb 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -25,6 +25,7 @@ #include "backends/platform/sdl/sdl.h" #include "common/mutex.h" +#include "common/translation.h" #include "common/util.h" #ifdef USE_RGB_COLOR #include "common/list.h" @@ -36,7 +37,7 @@ #include "graphics/surface.h" static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { - {"1x", "Normal (no scaling)", GFX_NORMAL}, + {"1x", _s("Normal (no scaling)"), GFX_NORMAL}, #ifdef USE_SCALERS {"2x", "2x", GFX_DOUBLESIZE}, {"3x", "3x", GFX_TRIPLESIZE}, @@ -1378,7 +1379,7 @@ void OSystem_SDL::warpMouse(int x, int y) { int y1 = y; // Don't change mouse position, when mouse is outside of our window (in case of windowed mode) - if (!(SDL_GetAppState( ) & SDL_APPMOUSEFOCUS)) + if (!(SDL_GetAppState( ) & SDL_APPMOUSEFOCUS)) return; if (_videoMode.aspectRatioCorrection && !_overlayVisible) diff --git a/backends/platform/wii/options.cpp b/backends/platform/wii/options.cpp index 402782a58d..295856d564 100644 --- a/backends/platform/wii/options.cpp +++ b/backends/platform/wii/options.cpp @@ -44,7 +44,7 @@ WiiOptionsDialog::WiiOptionsDialog(bool doubleStrike) : _strUnderscanY = "wii_video_default_underscan_y"; } - new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, _("Ok"), 0, 'k'); + new ButtonWidget(this, _w - 108 - 16, _h - 24 - 16, 108, 24, _("OK"), 0, 'k'); new ButtonWidget(this, _w - 216 - 32, _h - 24 - 16, 108, 24, _("Cancel"), 0, 'c'); _tab = new TabWidget(this, 0, 0, _w, _h - 54); diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 970c9dce90..aef2117bd7 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -30,6 +30,7 @@ #include "common/events.h" #include "common/util.h" #include "common/timer.h" +#include "common/translation.h" #include "engines/engine.h" @@ -107,14 +108,14 @@ bool _hasSmartphoneResolution = false; // Low end devices 240x320 static const OSystem::GraphicsMode s_supportedGraphicsModesLow[] = { - {"1x", "Normal (no scaling)", GFX_NORMAL}, + {"1x", _s("Normal (no scaling)"), GFX_NORMAL}, {0, 0, 0} }; // High end device 480x640 static const OSystem::GraphicsMode s_supportedGraphicsModesHigh[] = { - {"1x", "Normal (no scaling)", GFX_NORMAL}, + {"1x", _s("Normal (no scaling)"), GFX_NORMAL}, {"2x", "2x", GFX_DOUBLESIZE}, #ifndef _MSC_VER // EVC breaks template functions, and I'm tired of fixing them :) {"2xsai", "2xSAI", GFX_2XSAI}, -- cgit v1.2.3 From 09b4f7cbed4f258a00822f2b135df475f6e1b398 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 26 Jun 2010 21:55:52 +0000 Subject: Define WIN32_LEAN_AND_MEAN before including windows.h. This will cause our code to include less functionality, but might on the other hand fasten up the compilation. svn-id: r50346 --- backends/midi/windows.cpp | 1 + backends/platform/sdl/main.cpp | 1 + backends/platform/sdl/sdl.cpp | 1 + backends/plugins/win32/win32-provider.cpp | 1 + 4 files changed, 4 insertions(+) (limited to 'backends') diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index 08587a6b80..da44c40978 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -24,6 +24,7 @@ #if defined(WIN32) && !defined(_WIN32_WCE) +#define WIN32_LEAN_AND_MEAN #include // winnt.h defines ARRAYSIZE, but we want our own one... #undef ARRAYSIZE diff --git a/backends/platform/sdl/main.cpp b/backends/platform/sdl/main.cpp index 13e614a4a2..52bbb59165 100644 --- a/backends/platform/sdl/main.cpp +++ b/backends/platform/sdl/main.cpp @@ -28,6 +28,7 @@ // otherwise we will get errors about the windows headers redefining // "ARRAYSIZE" for example. #if defined(WIN32) && !defined(__SYMBIAN32__) +#define WIN32_LEAN_AND_MEAN #include // winnt.h defines ARRAYSIZE, but we want our own one... #undef ARRAYSIZE diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index f8ae824acf..18c529092d 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -24,6 +24,7 @@ */ #if defined(WIN32) +#define WIN32_LEAN_AND_MEAN #include // winnt.h defines ARRAYSIZE, but we want our own one... - this is needed before including util.h #undef ARRAYSIZE diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp index a39bdfe76a..65586249e8 100644 --- a/backends/plugins/win32/win32-provider.cpp +++ b/backends/plugins/win32/win32-provider.cpp @@ -30,6 +30,7 @@ #include "common/debug.h" #include "common/fs.h" +#define WIN32_LEAN_AND_MEAN #include -- cgit v1.2.3 From 5e030bebcc8e1a1cf918559c729039fc50a470e7 Mon Sep 17 00:00:00 2001 From: Robert Å palek Date: Tue, 29 Jun 2010 06:38:00 +0000 Subject: enable reading ZIP archives even without USE_ZLIB our module unzip.cpp can read uncompressed ZIP archives even without zlib. if some of the files inside are compressed and zlib is not linked in, an error is returned. svn-id: r50483 --- backends/vkeybd/virtual-keyboard.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'backends') diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index bd512fe3ad..2c88322191 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -90,7 +90,6 @@ bool VirtualKeyboard::openPack(const String &packName, const FSNode &node) { return true; } -#ifdef USE_ZLIB if (node.getChild(packName + ".zip").exists()) { // compressed keyboard pack _fileArchive = makeZipArchive(node.getChild(packName + ".zip")); @@ -109,7 +108,6 @@ bool VirtualKeyboard::openPack(const String &packName, const FSNode &node) { return true; } -#endif return false; } -- cgit v1.2.3 From a3a1499444654ed30aa13c0ab753b0916245f865 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 29 Jun 2010 12:56:22 +0000 Subject: Replace some code with constructs that work on Android pre-1.6. Add a boolean for disabling the "no plugins found" warning. svn-id: r50494 --- .../org/inodes/gus/scummvm/ScummVMActivity.java | 21 +++++++++++++++++---- .../android/org/inodes/gus/scummvm/Unpacker.java | 4 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java index ba3c058ae4..b37b2b8a52 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -32,14 +32,27 @@ public class ScummVMActivity extends Activity { private class MyScummVM extends ScummVM { private boolean scummvmRunning = false; + private boolean usingSmallScreen() { + // Multiple screen sizes came in with Android 1.6. Have + // to use reflection in order to continue supporting 1.5 + // devices :( + DisplayMetrics metrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(metrics); + try { + // This 'density' term is very confusing. + int DENSITY_LOW = metrics.getClass().getField("DENSITY_LOW").getInt(null); + int densityDpi = metrics.getClass().getField("densityDpi").getInt(metrics); + return densityDpi <= DENSITY_LOW; + } catch (Exception e) { + return false; + } + } + public MyScummVM() { super(ScummVMActivity.this); // Enable ScummVM zoning on 'small' screens. - // This 'density' term is very confusing. - DisplayMetrics metrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(metrics); - enableZoning(metrics.densityDpi <= DisplayMetrics.DENSITY_LOW); + enableZoning(usingSmallScreen()); } @Override diff --git a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java index efa3e1d2ef..7280aac7d4 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java +++ b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java @@ -34,6 +34,7 @@ import java.util.zip.ZipFile; import java.util.zip.ZipEntry; public class Unpacker extends Activity { + private final static boolean PLUGINS_ENABLED = true; private final static String META_NEXT_ACTIVITY = "org.inodes.gus.unpacker.nextActivity"; private ProgressBar mProgress; @@ -79,7 +80,6 @@ public class Unpacker extends Activity { if (cn != null) { final Intent origIntent = getIntent(); Intent intent = new Intent(); - intent.setPackage(origIntent.getPackage()); intent.setComponent(cn); if (origIntent.getExtras() != null) intent.putExtras(origIntent.getExtras()); @@ -294,7 +294,7 @@ public class Unpacker extends Activity { Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY); List plugins = getPackageManager() .queryBroadcastReceivers(intent, 0); - if (plugins.isEmpty()) { + if (PLUGINS_ENABLED && plugins.isEmpty()) { // No plugins installed AlertDialog.Builder alert = new AlertDialog.Builder(this) .setTitle(R.string.no_plugins_title) -- cgit v1.2.3 From e3590a60a02114a7254e4955f8d512bcf76b71c4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 1 Jul 2010 16:06:26 +0000 Subject: NDS: Fix compile errors and a warning svn-id: r50555 --- backends/platform/ds/arm9/source/dsoptions.cpp | 14 +++++++------- backends/platform/ds/arm9/source/touchkeyboard.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 300324a1de..44bbad23b2 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -66,14 +66,14 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _snapToBorderCheckbox = new GUI::CheckboxWidget(_tab, 150, 20, 130, 20, _("Snap to edges"), 0, 0, 'T'); new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, _("Touch X Offset"), Graphics::kTextAlignLeft); - _touchX = new GUI::SliderWidget(_tab, 130, 35, 130, 12, 1); + _touchX = new GUI::SliderWidget(_tab, 130, 35, 130, 12, "TODO: Add tooltip", 1); _touchX->setMinValue(-8); _touchX->setMaxValue(+8); _touchX->setValue(0); _touchX->setFlags(GUI::WIDGET_CLEARBG); new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, _("Touch Y Offset"), Graphics::kTextAlignLeft); - _touchY = new GUI::SliderWidget(_tab, 130, 50, 130, 12, 2); + _touchY = new GUI::SliderWidget(_tab, 130, 50, 130, 12, "TODO: Add tooltip", 2); _touchY->setMinValue(-8); _touchY->setMaxValue(+8); _touchY->setValue(0); @@ -88,7 +88,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _screenTaps = new GUI::CheckboxWidget(_tab, 5, 95, 285, 20, _("Tap for left click, double tap right click"), 0, 0x20000002, 'T'); _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, _("Sensitivity"), Graphics::kTextAlignLeft); - _sensitivity = new GUI::SliderWidget(_tab, 130, 110, 130, 12, 1); + _sensitivity = new GUI::SliderWidget(_tab, 130, 110, 130, 12, "TODO: Add tooltip", 1); _sensitivity->setMinValue(4); _sensitivity->setMaxValue(16); _sensitivity->setValue(8); @@ -98,9 +98,9 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, _("Initial top screen scale:"), Graphics::kTextAlignLeft); - _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", 0x30000001, 'T'); - _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", 0x30000002, 'T'); - _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", 0x30000003, 'T'); + _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", "TODO: Add tooltip", 0x30000001, 'T'); + _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", "TODO: Add tooltip", 0x30000002, 'T'); + _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", "TODO: Add tooltip", 0x30000003, 'T'); new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, _("Main screen scaling:"), Graphics::kTextAlignLeft); @@ -109,7 +109,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, _("Unscaled (you must scroll left and right)"), 0, 0x10000003, 'S'); new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, _("Brightness:"), Graphics::kTextAlignLeft); - _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, 1); + _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, "TODO: Add tooltip", 1); _gammaCorrection->setMinValue(0); _gammaCorrection->setMaxValue(8); _gammaCorrection->setValue(0); diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 2d4b6a94f4..88bf0ae991 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -160,7 +160,7 @@ int typingTimeout = 0; // Render text onto the tiled screen -void drawText(int tx, int ty, char* string, bool highlight) { +void drawText(int tx, int ty, const char *string, bool highlight) { u16 baseValue = 0; -- cgit v1.2.3 From a905327e65be97824e3faf483d3e535e763586cd Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 1 Jul 2010 16:26:18 +0000 Subject: NDS: Fix typo svn-id: r50557 --- backends/platform/ds/ds.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index aeba1820c6..555e7ece06 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -65,7 +65,7 @@ OBJCOPY := $(DEVKITARM)/bin/arm-eabi-objcopy # ARM7_ARCH := -mthumb-interwork -# note: arm9tdmi isn't the correct CPU arch, but anything newer and LD +# note: arm7tdmi isn't the correct CPU arch, but anything newer and LD # *insists* it has a FPU or VFP, and it won't take no for an answer! ARM7_CFLAGS := -g -Wall -O2\ -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\ -- cgit v1.2.3 From 762ff57e0dd906e7a256c1d832c67f345faf8883 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 1 Jul 2010 23:12:28 +0000 Subject: NDS: Some tweaks for compiling via std build system svn-id: r50582 --- backends/platform/ds/arm9/source/portdefs.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 5472b711b8..2590758c86 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -52,10 +52,17 @@ typedef signed int s32; #define CT_NO_TRANSPARENCY +#ifndef DISABLE_TEXT_CONSOLE #define DISABLE_TEXT_CONSOLE +#endif + +#ifndef DISABLE_COMMAND_LINE #define DISABLE_COMMAND_LINE +#endif +#ifndef DISABLE_COMMAND_LINE #define STREAM_AUDIO_FROM_DISK +#endif //#undef assert //#define assert(expr) consolePrintf("Asserted!") -- cgit v1.2.3 From bb300ec671cfcd6fe7461dfd90615acfede2f1b9 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 5 Jul 2010 00:09:41 +0000 Subject: Skip /dev/sequencer MIDI on Android. svn-id: r50664 --- backends/midi/seq.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 216c5802b7..b1815adee5 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -28,7 +28,7 @@ * both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html) */ -#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) +#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__) #include "common/util.h" #include "sound/musicplugin.h" -- cgit v1.2.3 From b8778fc7c382ec401409bbaafcb67355f0c566e3 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 5 Jul 2010 01:00:59 +0000 Subject: Switch Android toolchain prefix from arm-android-eabi to arm-*-linux-androideabi, since this is what the upcoming gcc-4.6 change uses. Work around Android 2.0 and newer dynamic linker bug by explicitly linking plugins against the core libscummvm.so. Mark Android packages as preferring to be on external storage. Move -lm from LDFLAGS to LIBS. svn-id: r50665 --- backends/platform/android/README.build | 41 ++++++++++++++++++++++------------ backends/platform/android/android.mk | 9 +++++++- backends/platform/android/module.mk | 22 +++++++++--------- backends/platform/android/video.cpp | 2 +- 4 files changed, 47 insertions(+), 27 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build index a834f8431b..0aa5c6eefd 100644 --- a/backends/platform/android/README.build +++ b/backends/platform/android/README.build @@ -4,12 +4,18 @@ Building the ScummVM Android port You will need these things to build: 1. Android EGL headers and library 2. Android SDK -3. An arm-android-eabi GCC toolchain +3. An arm-oe-linux-androideabi GCC toolchain(*) In the example commands, we are going to build against the Android 1.5 native ABI (but using the Android 1.6 SDK tools). Other version combinations might/should be possible with a bit of tweaking. +(*) Any other sane Android toolchain should be easy to use, but this +is the toolchain prefix that is used by default. You can trivially +find and modify the single location where it appears in ./configure if +you have some other prefix variation. + + In detail: 1. Android EGL headers and library @@ -26,17 +32,17 @@ to just download the 3 Android EGL headers from here: Download and install somewhere. -3. arm-android-eabi GCC toolchain +3. arm-*-linux-androideabi GCC toolchain You have several choices for toolchains: -- Use Google arm-eabi prebuilt toolchain. + - Use Google arm-eabi prebuilt toolchain. This is shipped with both the Android source release and Android NDK. The problem is that "arm-eabi-gcc" can't actually link anything successfully without extra command line flags. To use this with the ScummVM configure/build environment you will need to create a family -of shell wrapper scripts that convert "arm-android-eabi-foo" to +of shell wrapper scripts that convert "arm-oe-linux-androideabi-foo" to "arm-eabi-foo -mandroid". For example, I use this script: @@ -44,17 +50,24 @@ For example, I use this script: exec arm-eabi-${0##*-} -mandroid -DANDROID "$@" ... and create a family of symlinks/hardlinks pointing to it called -arm-android-eabi-gcc, arm-android-eabi-g++, etc. For tools that don't -take a "-mandroid" argument - like arm-eabi-strip - I bypass the shell -wrapper and just create an arm-android-eabi-strip symlink to the tool -directly. +arm-oe-android-linuxeabi-gcc, arm-oe-android-linuxeabi-g++, etc. For +tools that don't take a "-mandroid" argument - like arm-eabi-strip - I +bypass the shell wrapper and just create an arm-oe-android-linuxeabi-strip +symlink to the tool directly. + +In practice you will probably need significant linker command line +massaging in order to get the crtbegin/end and libraries all linked in +the right way. It's not hard to do manually, but it is annoying to +script in a general purpose way. -- Build your own arm-android-eabi toolchain from GCC source. + - Build your own arm-*-linux-androideabi toolchain from GCC source. -This is lots of fun. I suggest my Android openembedded patches, see: - http://wiki.github.com/anguslees/openembedded-android/ -(You just need to have lots of disk space and type a few commands) -If you get stuck, ask +This is lots of fun, but will become significantly easier once gcc-4.6 +is released. In the interim, I suggest using my precompiled Android +openembedded-based toolchain: + wget http://commondatastorage.googleapis.com/anr/sdk/android-2.2-i686-linux-armv5te-linux-androideabi-toolchain-android.tar.bz2 + sudo tar jxf android-2.2-i686-linux-armv5te-linux-androideabi-toolchain-android.tar.bz2 -C / + . /usr/local/android/arm/environment-setup Alternatively, do a websearch - there are several other cross-compile toolchains around. @@ -78,7 +91,7 @@ Then build ScummVM: export ANDROID_SDK= PATH=$ANDROID_SDK/platforms/android-1.6/tools:$ANDROID_SDK/tools:$PATH - # You also want to ensure your arm-android-eabi toolchain is in your $PATH + # You also want to ensure your arm-oe-linux-androideabi toolchain is in $PATH export ANDROID_TOP= diff --git a/backends/platform/android/android.mk b/backends/platform/android/android.mk index 0bc8fa265e..95e848e0d9 100644 --- a/backends/platform/android/android.mk +++ b/backends/platform/android/android.mk @@ -4,7 +4,6 @@ AAPT = aapt DX = dx APKBUILDER = apkbuilder ADB = adb -e -ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.6/android.jar JAVAC ?= javac JAVACFLAGS = -source 1.5 -target 1.5 @@ -12,6 +11,14 @@ JAVACFLAGS = -source 1.5 -target 1.5 #LDFLAGS += -Wl,--gc-sections #CXXFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden +resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR8) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) + $(INSTALL) -d build.tmp/assets/ + $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/ + $(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR8) -F $@ + +build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR8) + $(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR8) -F $@ + scummvm.apk: build.tmp/libscummvm.so resources.ap_ classes.dex # Package installer won't delete old libscummvm.so on upgrade so # replace it with a zero size file diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk index fdb0ed2ac4..c7b98b996d 100644 --- a/backends/platform/android/module.mk +++ b/backends/platform/android/module.mk @@ -39,14 +39,22 @@ PLUGIN_RESOURCES = \ #ANDROID_VERSIONCODE = 6 Specified in dists/android/AndroidManifest.xml.in ANDROID_PLUGIN_VERSIONCODE = 6 +# This is a bit silly. I want to compile against the 1.6 android.jar, +# to make the compiler check that I don't use something that requires +# a newer Android. However, in order to use android:installLocation, +# we need to give aapt a version >=8 android.jar - even though the +# result will work ok on 1.5+. +ANDROID_JAR = $(ANDROID_SDK)/platforms/android-1.5/android.jar +ANDROID_JAR8 = $(ANDROID_SDK)/platforms/android-8/android.jar + # This library contains scummvm proper build.tmp/libscummvm.so: $(OBJS) @$(MKDIR) -p $(@D) - $(CXX) $(PLUGIN_LDFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS) + $(QUIET_LINK)$(CXX) -shared $(LDFLAGS) -Wl,-Bsymbolic -Wl,-soname,$(@F) -Wl,--no-undefined -o $@ $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LIBS) -backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR) - $(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR) +backends/platform/android/org/inodes/gus/scummvm/R.java backends/platform/android/org/inodes/gus/scummvm/Manifest.java: $(srcdir)/dists/android/AndroidManifest.xml $(filter %.xml,$(RESOURCES)) $(ANDROID_JAR8) + $(AAPT) package -m -J backends/platform/android -M $< -S $(srcdir)/dists/android/res -I $(ANDROID_JAR8) build.tmp/classes/%.class: $(srcdir)/backends/platform/android/%.java $(srcdir)/backends/platform/android/org/inodes/gus/scummvm/R.java @$(MKDIR) -p $(@D) @@ -63,14 +71,6 @@ build.tmp/plugins/classes.dex: $(JAVA_PLUGIN_SRC:backends/platform/android/%.jav @$(MKDIR) -p $(@D) $(DX) --dex --output=$@ build.tmp/classes.plugin -resources.ap_: $(srcdir)/dists/android/AndroidManifest.xml $(RESOURCES) $(ASSETS) $(ANDROID_JAR) $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) - $(INSTALL) -d build.tmp/assets/ - $(INSTALL) -c -m 644 $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) build.tmp/assets/ - $(AAPT) package -f -M $< -S $(srcdir)/dists/android/res -A build.tmp/assets -I $(ANDROID_JAR) -F $@ - -build.tmp/%/resources.ap_: build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml build.stage/%/res/drawable/scummvm.png $(ANDROID_JAR) - $(AAPT) package -f -M $< -S build.stage/$*/res -I $(ANDROID_JAR) -F $@ - build.tmp/%/AndroidManifest.xml build.stage/%/res/values/strings.xml: dists/android/mkmanifest.pl configure dists/android/AndroidManifest.xml dists/android/mkmanifest.pl --id=$* --configure=configure \ --version-name=$(VERSION) \ diff --git a/backends/platform/android/video.cpp b/backends/platform/android/video.cpp index 5d16410cea..d4c002fbd0 100644 --- a/backends/platform/android/video.cpp +++ b/backends/platform/android/video.cpp @@ -47,7 +47,7 @@ #define ENTER(args...) /**/ #endif -#if 1 +#if 0 #define CHECK_GL_ERROR() checkGlError(__FILE__, __LINE__) static const char* getGlErrStr(GLenum error) { switch (error) { -- cgit v1.2.3 From db1fa71745a6604612f295c4f5a33169bde75a75 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 10:07:06 +0000 Subject: NDS: Enable compilation of backend specific files Also tried to enable the conversion of .raw/.pal/.bin files, but this does not currently work (probably something really silly, but I don't have the time to debug this right now). svn-id: r50671 --- backends/platform/ds/ds.mk | 10 +++++----- backends/platform/ds/module.mk | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 555e7ece06..40a7e14965 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -18,7 +18,7 @@ OPT_SIZE := -Os -mthumb #-mthumb -fno-gcse -fno-schedule-insns2 -OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) +#OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) # TODO: Handle files in OPTLIST. @@ -99,10 +99,10 @@ $(ndsdir)/arm7/source/main.o: CXXFLAGS=$(ARM7_CXXFLAGS) $(ndsdir)/arm7/source/main.o: CPPFLAGS= # Rule for creating ARM7 .bin files from .elf files -%.bin: %.elf - @echo ------ - @echo Building $@... - $(OBJCOPY) -O binary $< $@ +#%.bin: %.elf +# @echo ------ +# @echo Building $@... +# $(OBJCOPY) -O binary $< $@ # Rule for creating ARM7 .elf files by linking .o files together with a special linker script %.elf: diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index 16630dc070..676fd20628 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -59,7 +59,38 @@ LIBCARTRESET_OBJS := #arm9/source/libcartreset/cartreset.o -MODULE_OBJS := +#MODULE_OBJS := $(PORT_OBJS) $(DATA_OBJS) $(FAT_OBJS) +MODULE_OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) + + +#--------------------------------------------------------------------------------- +# canned command sequence for binary data +#--------------------------------------------------------------------------------- +define bin2o + bin2s $< | $(AS) -mthumb -mthumb-interwork -o $(@) + echo "extern const u8" `(echo $( `(echo $(> `(echo $(> `(echo $( `(echo $(> `(echo $(> `(echo $( $@ + echo "extern const u8" `(echo $(> $@ + echo "extern const u32" `(echo $(> $@ +endef -#--------------------------------------------------------------------------------- -%.o : %.raw -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) +vpath %.raw $(srcdir) +vpath %.pal $(srcdir) +vpath %.bin $(srcdir) + +%.o: %.raw + $(bin2o) + +%_raw.h: %.raw + $(bin2h) + +%.o: %.pal + $(bin2o) + +%_raw.h: %.pal + $(bin2h) + +%.o: %.bin + $(bin2o) + +%_raw.h: %.bin + $(bin2h) -#--------------------------------------------------------------------------------- -%.o : %.pal -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) +# Mark files which require the *_raw.h files manually (for now, at least) +$(MODULE)/arm9/source/dsmain.o: \ + $(MODULE)/arm9/data/icons_raw.h \ + $(MODULE)/arm9/data/keyboard_raw.h \ + $(MODULE)/arm9/data/keyboard_pal_raw.h +$(MODULE)/arm9/source/touchkeyboard.o: \ + $(MODULE)/arm9/data/keyboard_raw.h \ + $(MODULE)/arm9/data/keyboard_pal_raw.h \ + $(MODULE)/arm9/data/8x8font_tga_raw.h -# TODO: Should add more dirs to MODULE_DIRS so that "make distclean" can remove .deps dirs. MODULE_DIRS += \ - backends/platform/ds/ + backends/platform/ds \ + backends/platform/ds/arm7/source \ + backends/platform/ds/arm7/source/libcartreset \ + backends/platform/ds/arm9/source \ + backends/platform/ds/arm9/source/fat \ + backends/platform/ds/arm9/source/libcartreset # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -- cgit v1.2.3 From 9a61be13e6638a5fe9b31d1fdf7fff72bb69bf8f Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 10:07:54 +0000 Subject: DS: Made some vars static, code formatting, cleanup svn-id: r50673 --- backends/platform/ds/arm9/source/dsmain.cpp | 277 +++++++++++++--------------- backends/platform/ds/arm9/source/dsmain.h | 4 - 2 files changed, 128 insertions(+), 153 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 30ac0a7880..b7f8b8caa3 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -80,8 +80,9 @@ //#include //basic print funcionality #include +#include + #include "dsmain.h" -#include "string.h" #include "osystem_ds.h" #include "icons_raw.h" #include "fat/gba_nds_fat.h" @@ -102,12 +103,14 @@ #ifdef USE_PROFILER #include "profiler/cyg-profile.h" #endif +#include "engine.h" + #include "backends/fs/ds/ds-fs.h" #include "base/version.h" -#include "engine.h" +#include "common/util.h" extern "C" void OurIntrMain(void); -extern "C" u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState); +extern "C" u32 getExceptionAddress(u32 opcodeAddress, u32 thumbState); extern const char __itcm_start[]; static const char *registerNames[] = @@ -118,20 +121,19 @@ static const char *registerNames[] = extern "C" void* __real_malloc(size_t size); -int total = 0; +static int s_total_malloc = 0; -void* operator new (size_t size) -{ +void *operator new (size_t size) { register unsigned int reg asm("lr"); volatile unsigned int poo = reg; - void* res = __real_malloc(size); - total += size; + void *res = __real_malloc(size); + s_total_malloc += size; if (!res) { // *((u8 *) NULL) = 0; - consolePrintf("Failed alloc (new) %d (%d)\n", size, total); + consolePrintf("Failed alloc (new) %d (%d)\n", size, s_total_malloc); return NULL; } @@ -139,7 +141,7 @@ void* operator new (size_t size) } -extern "C" void* __wrap_malloc(size_t size) { +extern "C" void *__wrap_malloc(size_t size) { /* u32 addr; asm("mov %0, lr" @@ -151,8 +153,7 @@ extern "C" void* __wrap_malloc(size_t size) { volatile unsigned int poo = reg; - if (size == 0) - { + if (size == 0) { static int zeroSize = 0; consolePrintf("0 size malloc (%d)", zeroSize++); } @@ -162,12 +163,12 @@ extern "C" void* __wrap_malloc(size_t size) { if (size > 50 * 1024) { consolePrintf("Allocated %d (%x)\n", size, poo); } - total += size; + s_total_malloc += size; return res; } else { // *((u8 *) NULL) = 0; - consolePrintf("Failed alloc %d (%d)\n", size, total); + consolePrintf("Failed alloc %d (%d)\n", size, s_total_malloc); return NULL; } } @@ -193,112 +194,113 @@ enum MouseMode { #define SCUMM_GAME_HEIGHT 142 #define SCUMM_GAME_WIDTH 227 -int textureID; -u16* texture; +static int textureID; +static u16* texture; -int frameCount; -int currentTimeMillis; +static int frameCount; +static int currentTimeMillis; // Timer Callback -int callbackInterval; -int callbackTimer; -OSystem_DS::TimerProc callback; +static int callbackInterval; +static int callbackTimer; +static OSystem_DS::TimerProc callback; // Scaled -bool scaledMode; -int scX; -int scY; +static bool scaledMode; +static int scX; +static int scY; -int subScX; -int subScY; -int subScTargetX; -int subScTargetY; -int subScreenWidth = SCUMM_GAME_WIDTH; -int subScreenHeight = SCUMM_GAME_HEIGHT; -int subScreenScale = 256; +static int subScX; +static int subScY; +static int subScTargetX; +static int subScTargetY; +static int subScreenWidth = SCUMM_GAME_WIDTH; +static int subScreenHeight = SCUMM_GAME_HEIGHT; +static int subScreenScale = 256; // Sound -int bufferSize; -s16* soundBuffer; -int bufferFrame; -int bufferRate; -int bufferSamples; -bool soundHiPart; -int soundFrequency; +static int bufferSize; +static s16* soundBuffer; +static int bufferFrame; +static int bufferRate; +static int bufferSamples; +static bool soundHiPart; +static int soundFrequency; // Events -int lastEventFrame; -bool indyFightState; -bool indyFightRight; +static int lastEventFrame; +static bool indyFightState; +static bool indyFightRight; -OSystem_DS::SoundProc soundCallback; -void* soundParam; -int lastCallbackFrame; -bool bufferFirstHalf; -bool bufferSecondHalf; +static OSystem_DS::SoundProc soundCallback; +static void *soundParam; +static int lastCallbackFrame; +static bool bufferFirstHalf; +static bool bufferSecondHalf; // Saved buffers -bool highBuffer; -bool displayModeIs8Bit = false; +static bool highBuffer; +static bool displayModeIs8Bit = false; // Game id -u8 gameID; +static u8 gameID; -bool snapToBorder = false; -bool consoleEnable = false; -bool gameScreenSwap = false; +static bool snapToBorder = false; +static bool consoleEnable = false; +static bool gameScreenSwap = false; bool isCpuScalerEnabled(); //#define HEAVY_LOGGING -MouseMode mouseMode = MOUSE_LEFT; +static MouseMode mouseMode = MOUSE_LEFT; -int storedMouseX = 0; -int storedMouseY = 0; +static int storedMouseX = 0; +static int storedMouseY = 0; // Sprites -SpriteEntry sprites[128]; -SpriteEntry spritesMain[128]; -int tweak; +static SpriteEntry sprites[128]; +static SpriteEntry spritesMain[128]; +static int tweak; // Shake -int shakePos = 0; +static int shakePos = 0; // Keyboard -bool keyboardEnable = false; -bool leftHandedMode = false; -bool keyboardIcon = false; +static bool keyboardEnable = false; +static bool leftHandedMode = false; +static bool keyboardIcon = false; // Touch -int touchScX, touchScY, touchX, touchY; -int mouseHotspotX, mouseHotspotY; -bool cursorEnable = false; -bool mouseCursorVisible = true; -bool rightButtonDown = false; -bool touchPadStyle = false; -int touchPadSensitivity = 8; -bool tapScreenClicks = true; - -int tapCount = 0; -int tapTimeout = 0; -int tapComplete = 0; +static int touchScX, touchScY, touchX, touchY; +static int mouseHotspotX, mouseHotspotY; +static bool cursorEnable = false; +static bool mouseCursorVisible = true; +static bool leftButtonDown = false; +static bool rightButtonDown = false; +static bool touchPadStyle = false; +static int touchPadSensitivity = 8; +static bool tapScreenClicks = true; + +static int tapCount = 0; +static int tapTimeout = 0; +static int tapComplete = 0; // Dragging -int dragStartX, dragStartY; -bool dragging = false; -int dragScX, dragScY; +static int dragStartX, dragStartY; +static bool dragging = false; +static int dragScX, dragScY; // Interface styles -char gameName[32]; +static char gameName[32]; // 8-bit surface size -int gameWidth = 320; -int gameHeight = 200; +static int gameWidth = 320; +static int gameHeight = 200; // Scale -bool twoHundredPercentFixedScale = false; -bool cpuScalerEnable = false; +static bool twoHundredPercentFixedScale = false; +static bool cpuScalerEnable = false; // 100 256 // 150 192 @@ -309,14 +311,14 @@ bool cpuScalerEnable = false; #ifdef USE_PROFILER -int hBlankCount = 0; +static int hBlankCount = 0; #endif -u8* scalerBackBuffer = NULL; +static u8 *scalerBackBuffer = NULL; #define NUM_SUPPORTED_GAMES 21 -gameListType gameList[NUM_SUPPORTED_GAMES] = { +static const gameListType gameList[NUM_SUPPORTED_GAMES] = { // Unknown game - use normal SCUMM controls {"unknown", CONT_SCUMM_ORIGINAL}, @@ -345,31 +347,29 @@ gameListType gameList[NUM_SUPPORTED_GAMES] = { {"parallaction", CONT_NIPPON}, }; -gameListType* currentGame = NULL; +static const gameListType *s_currentGame = NULL; // Stylus -#define ABS(x) ((x)>0?(x):-(x)) - -bool penDown = FALSE; -bool penHeld = FALSE; -bool penReleased = FALSE; -bool penDownLastFrame = FALSE; -s32 penX = 0, penY = 0; -s32 penDownX = 0, penDownY = 0; -int keysDownSaved = 0; -int keysReleasedSaved = 0; -int keysChangedSaved = 0; +static bool penDown = FALSE; +static bool penHeld = FALSE; +static bool penReleased = FALSE; +static bool penDownLastFrame = FALSE; +static s32 penX = 0, penY = 0; +static s32 penDownX = 0, penDownY = 0; +static int keysDownSaved = 0; +static int keysReleasedSaved = 0; +static int keysChangedSaved = 0; -bool penDownSaved = FALSE; -bool penReleasedSaved = FALSE; -int penDownFrames = 0; -int touchXOffset = 0; -int touchYOffset = 0; +static bool penDownSaved = FALSE; +static bool penReleasedSaved = FALSE; +static int penDownFrames = 0; +static int touchXOffset = 0; +static int touchYOffset = 0; -int triggeredIcon = 0; -int triggeredIconTimeout = 0; +static int triggeredIcon = 0; +static int triggeredIconTimeout = 0; -u16 savedPalEntry255 = RGB15(31, 31, 31); +static u16 savedPalEntry255 = RGB15(31, 31, 31); extern "C" int scummvm_main(int argc, char *argv[]); @@ -382,7 +382,7 @@ void setIcon(int num, int x, int y, int imageNum, int flags, bool enable); void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable); void uploadSpriteGfx(); -TransferSound soundControl; +static TransferSound soundControl; bool isCpuScalerEnabled() { @@ -430,7 +430,7 @@ void setTopScreenZoom(int percentage) { // return (ConfMan.hasKey("cpu_scaler", "ds") && ConfMan.getBool("cpu_scaler", "ds")); controlType getControlType() { - return currentGame->control; + return s_currentGame->control; } @@ -551,21 +551,8 @@ int getSoundFrequency() { return soundFrequency; } -void setControls(char* gameName) { - - for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) { - if (!stricmp(gameName, gameList[r].gameId)) { - currentGame = &gameList[r]; - consolePrintf("Current game set to: %s\n", gameName); - return; - } - } - - consolePrintf("Failed to set current game to: %s\n", gameName); -} - void exitGame() { - currentGame = NULL; + s_currentGame = NULL; } void initGame() { @@ -580,17 +567,17 @@ void initGame() { setOptions(); //strcpy(gameName, ConfMan.getActiveDomain().c_str()); - if (currentGame == NULL) { + if (s_currentGame == NULL) { strcpy(gameName, ConfMan.get("gameid").c_str()); // consolePrintf("\n\n\n\nCurrent game: '%s' %d\n", gameName, gameName[0]); - currentGame = &gameList[0]; // Default game + s_currentGame = &gameList[0]; // Default game for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) { if (!stricmp(gameName, gameList[r].gameId)) { - currentGame = &gameList[r]; - // consolePrintf("Game list num: %d\n", currentGame); + s_currentGame = &gameList[r]; + // consolePrintf("Game list num: %d\n", s_currentGame); } } } @@ -785,7 +772,7 @@ void checkSleepMode() { } void setShowCursor(bool enable) { - if ((currentGame) && (currentGame->control == CONT_SCUMM_SAMNMAX)) { + if ((s_currentGame) && (s_currentGame->control == CONT_SCUMM_SAMNMAX)) { if (cursorEnable) { sprites[1].attribute[0] = ATTR0_BMP | 150; } else { @@ -833,7 +820,7 @@ void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, } } - if (currentGame->control != CONT_SCUMM_SAMNMAX) + if (s_currentGame->control != CONT_SCUMM_SAMNMAX) return; uint16 border = RGB15(24,24,24) | 0x8000; @@ -1035,7 +1022,7 @@ void setShakePos(int shakePos) { } -u16* get16BitBackBuffer() { +u16 *get16BitBackBuffer() { return BG_GFX + 0x20000; } @@ -1319,8 +1306,7 @@ bool getIsDisplayMode8Bit() { return displayModeIs8Bit; } -void doScreenTapMode(OSystem_DS* system) -{ +void doScreenTapMode(OSystem_DS* system) { Common::Event event; static bool left = false, right = false; @@ -1398,9 +1384,6 @@ void doButtonSelectMode(OSystem_DS* system) //consolePrintf("x=%d y=%d \n", getPenX(), getPenY()); } - static bool leftButtonDown = false; - static bool rightButtonDown = false; - if (getPenReleased() && (leftButtonDown || rightButtonDown)) { if (leftButtonDown) { event.type = Common::EVENT_LBUTTONUP; @@ -1476,14 +1459,14 @@ void doButtonSelectMode(OSystem_DS* system) if (getKeysDown() & KEY_RIGHT) { - if ((currentGame->control != CONT_SCUMM_SAMNMAX) && (currentGame->control != CONT_FUTURE_WARS) && (currentGame->control != CONT_GOBLINS)) { + if ((s_currentGame->control != CONT_SCUMM_SAMNMAX) && (s_currentGame->control != CONT_FUTURE_WARS) && (s_currentGame->control != CONT_GOBLINS)) { mouseMode = MOUSE_RIGHT; } else { // If we're playing sam and max, click and release the right mouse // button to change verb Common::Event event; - if (currentGame->control == CONT_FUTURE_WARS) { + if (s_currentGame->control == CONT_FUTURE_WARS) { event.mouse = Common::Point(320 - 128, 200 - 128); event.type = Common::EVENT_MOUSEMOVE; system->addEvent(event); @@ -1558,7 +1541,7 @@ void addEventsToQueue() { if (!indyFightState) { if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) { - if (currentGame->control == CONT_AGI) { + if (s_currentGame->control == CONT_AGI) { event.kbd.keycode = Common::KEYCODE_RETURN; event.kbd.ascii = 13; event.kbd.flags = 0; @@ -1699,7 +1682,7 @@ void addEventsToQueue() { - if (currentGame->control == CONT_SKY) { + if (s_currentGame->control == CONT_SKY) { // Extra controls for Beneath a Steel Sky if ((getKeysDown() & KEY_DOWN)) { penY = 0; @@ -1707,7 +1690,7 @@ void addEventsToQueue() { } } - if (currentGame->control == CONT_AGI) { + if (s_currentGame->control == CONT_AGI) { // Extra controls for Leisure Suit Larry and KQ4 if ((getKeysHeld() & KEY_UP) && (getKeysHeld() & KEY_START) @@ -1727,7 +1710,7 @@ void addEventsToQueue() { - if (currentGame->control == CONT_SIMON) { + if (s_currentGame->control == CONT_SIMON) { // Extra controls for Simon the Sorcerer if ((getKeysDown() & KEY_DOWN)) { Common::Event event; @@ -1746,7 +1729,7 @@ void addEventsToQueue() { - if (currentGame->control == CONT_SCUMM_ORIGINAL) { + if (s_currentGame->control == CONT_SCUMM_ORIGINAL) { // Extra controls for Scumm v1-5 games if ((getKeysDown() & KEY_DOWN)) { Common::Event event; @@ -1806,14 +1789,14 @@ void addEventsToQueue() { if ((getKeysChanged() & KEY_START)) { event.kbd.flags = 0; event.type = getKeyEvent(KEY_START); - if (currentGame->control == CONT_FUTURE_WARS) { + if (s_currentGame->control == CONT_FUTURE_WARS) { event.kbd.keycode = Common::KEYCODE_F10; event.kbd.ascii = Common::ASCII_F10; - } else if (currentGame->control == CONT_GOBLINS) { + } else if (s_currentGame->control == CONT_GOBLINS) { event.kbd.keycode = Common::KEYCODE_F1; event.kbd.ascii = Common::ASCII_F1; // consolePrintf("!!!!!F1!!!!!"); - } else if (currentGame->control == CONT_AGI) { + } else if (s_currentGame->control == CONT_AGI) { event.kbd.keycode = Common::KEYCODE_ESCAPE; event.kbd.ascii = 27; } else { @@ -2060,8 +2043,8 @@ void VBlankHandler(void) { if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) { - if (currentGame) { - if (currentGame->control != CONT_SCUMM_SAMNMAX) { + if (s_currentGame) { + if (s_currentGame->control != CONT_SCUMM_SAMNMAX) { if (getPenHeld() && (getPenY() < SCUMM_GAME_HEIGHT)) { setTopScreenTarget(getPenX(), getPenY()); } @@ -2856,10 +2839,6 @@ bool getIndyFightState() { return indyFightState; } -gameListType* getCurrentGame() { - return currentGame; -} - /////////////////// // Fast Ram /////////////////// diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index beda592ba2..88a7ca2b22 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -68,9 +68,6 @@ int leftHandedSwap(int keys); void setGameScreenSwap(bool enable); void setSensitivity(int sensitivity); -// Controls options -void setControls(char* gameName); - // Video void displayMode8Bit(); // Switch to 8-bit mode5 void displayMode16Bit(); // Switch to 16-bit mode5 @@ -155,7 +152,6 @@ void fastRamReset(); void* fastRamAlloc(int size); void exitGame(); -gameListType* getCurrentGame(); } -- cgit v1.2.3 From cb265ae09ac6282b0a7282f3d3c0d5b5973cac08 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 10:08:13 +0000 Subject: DS: Fix setShakePos svn-id: r50674 --- backends/platform/ds/arm9/source/dsmain.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index b7f8b8caa3..556cfc3f43 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -264,7 +264,7 @@ static SpriteEntry spritesMain[128]; static int tweak; // Shake -static int shakePos = 0; +static int s_shakePos = 0; // Keyboard static bool keyboardEnable = false; @@ -1018,7 +1018,7 @@ void displayMode16BitFlipBuffer() { } void setShakePos(int shakePos) { - shakePos = shakePos; + s_shakePos = shakePos; } @@ -2127,7 +2127,7 @@ void VBlankHandler(void) { SUB_BG3_CX = subScX + 64; } - SUB_BG3_CY = subScY + (shakePos << 8);*/ + SUB_BG3_CY = subScY + (s_shakePos << 8);*/ /*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256); SUB_BG3_XDY = 0; @@ -2267,7 +2267,7 @@ void VBlankHandler(void) { setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8); - setMainScreenScroll(scX << 8, (scY << 8) + (shakePos << 8)); + setMainScreenScroll(scX << 8, (scY << 8) + (s_shakePos << 8)); setMainScreenScale(256, 256); // 1:1 scale } else { @@ -2283,7 +2283,7 @@ void VBlankHandler(void) { setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128)); setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8); - setMainScreenScroll(64, (scY << 8) + (shakePos << 8)); + setMainScreenScroll(64, (scY << 8) + (s_shakePos << 8)); setMainScreenScale(320, 256); // 1:1 scale } -- cgit v1.2.3 From fcde7221d55849441844d7a7480cf99696417e88 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 11:07:24 +0000 Subject: DS: Fix typo; change bin2o/bin2h to create taget dir svn-id: r50675 --- backends/platform/ds/ds.mk | 2 +- backends/platform/ds/module.mk | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index ee3a1050b8..0fd8ac7cda 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -3,7 +3,7 @@ # where OPTIONS is... # build A: --enable-scumm # build B: --enable-sky --enable-queen -# build C: --enable-ago +# build C: --enable-agos # build D: --enable-gob --enable-cine --enable-agi # build E: --enable-saga --disable-mad # build F: --enable-kyra --disable-mad diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index c97f24e12a..d70b5b1bab 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -63,10 +63,12 @@ MODULE_OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) # canned command sequence for binary data #--------------------------------------------------------------------------------- define bin2o + $(MKDIR) $(*D) bin2s $< | $(AS) -mthumb -mthumb-interwork -o $(@) endef define bin2h + $(MKDIR) $(*D) echo "extern const u8" `(echo $( $@ echo "extern const u8" `(echo $(> $@ echo "extern const u32" `(echo $(> $@ -- cgit v1.2.3 From d4ad7b8a6d159e367bfb5f9e8de92140f3f41e06 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 11:53:55 +0000 Subject: DS: Add missing .bin -> .elf rule svn-id: r50676 --- backends/platform/ds/ds.mk | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 0fd8ac7cda..9df0d2ba0d 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -92,6 +92,10 @@ OPT_SIZE := -Os -mthumb all: scummvm.nds scummvm.ds.gba +%.bin: %.elf + $(OBJCOPY) -S $< $( - EGL_INC="-I" - EGL_LIBS="-L" - - CPPFLAGS="$EGL_INC" \ - LDFLAGS="-g $EGL_LIBS" \ ./configure --backend=android --host=android --enable-zlib #and any other flags make scummvm.apk diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 105561e595..f6af0fcff5 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -41,7 +41,6 @@ #include #include -#include #include #include "common/archive.h" @@ -166,12 +165,11 @@ private: jmethodID MID_getPluginDirectories; jmethodID MID_setupScummVMSurface; jmethodID MID_destroyScummVMSurface; + jmethodID MID_swapBuffers; int _screen_changeid; - EGLDisplay _egl_display; - EGLSurface _egl_surface; - EGLint _egl_surface_width; - EGLint _egl_surface_height; + int _egl_surface_width; + int _egl_surface_height; bool _force_redraw; @@ -223,6 +221,10 @@ public: virtual void initBackend(); void addPluginDirectories(Common::FSList &dirs) const; void enableZoning(bool enable) { _enable_zoning = enable; } + void setSurfaceSize(int width, int height) { + _egl_surface_width = width; + _egl_surface_height = height; + } virtual bool hasFeature(Feature f); virtual void setFeatureState(Feature f, bool enable); @@ -303,8 +305,6 @@ public: OSystem_Android::OSystem_Android(jobject am) : _back_ptr(0), - _egl_display(EGL_NO_DISPLAY), - _egl_surface(EGL_NO_SURFACE), _screen_changeid(0), _force_redraw(false), _game_texture(NULL), @@ -369,6 +369,7 @@ bool OSystem_Android::initJavaHooks(JNIEnv* env, jobject self) { FIND_METHOD(getPluginDirectories, "()[Ljava/lang/String;"); FIND_METHOD(setupScummVMSurface, "()V"); FIND_METHOD(destroyScummVMSurface, "()V"); + FIND_METHOD(swapBuffers, "()Z"); #undef FIND_METHOD @@ -581,6 +582,7 @@ int OSystem_Android::getGraphicsMode() const { } void OSystem_Android::setupScummVMSurface() { + ENTER("setupScummVMSurface"); JNIEnv* env = JNU_GetEnv(); env->CallVoidMethod(_back_ptr, MID_setupScummVMSurface); if (env->ExceptionCheck()) @@ -588,37 +590,8 @@ void OSystem_Android::setupScummVMSurface() { // EGL set up with a new surface. Initialise OpenGLES context. - _egl_display = eglGetCurrentDisplay(); - _egl_surface = eglGetCurrentSurface(EGL_DRAW); - - static bool log_version = true; - if (log_version) { - __android_log_print(ANDROID_LOG_INFO, LOG_TAG, - "Using EGL %s (%s); GL %s/%s (%s)", - eglQueryString(_egl_display, EGL_VERSION), - eglQueryString(_egl_display, EGL_VENDOR), - glGetString(GL_VERSION), - glGetString(GL_RENDERER), - glGetString(GL_VENDOR)); - log_version = false; // only log this once - } - GLESTexture::initGLExtensions(); - if (!eglQuerySurface(_egl_display, _egl_surface, - EGL_WIDTH, &_egl_surface_width) || - !eglQuerySurface(_egl_display, _egl_surface, - EGL_HEIGHT, &_egl_surface_height)) { - JNU_ThrowByName(env, "java/lang/RuntimeException", - "Error fetching EGL surface width/height"); - return; - } - __android_log_print(ANDROID_LOG_INFO, LOG_TAG, - "New surface is %dx%d", - _egl_surface_width, _egl_surface_height); - - CHECK_GL_ERROR(); - // Turn off anything that looks like 3D ;) glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); @@ -664,7 +637,6 @@ void OSystem_Android::setupScummVMSurface() { } void OSystem_Android::destroyScummVMSurface() { - _egl_surface = EGL_NO_SURFACE; JNIEnv* env = JNU_GetEnv(); env->CallVoidMethod(_back_ptr, MID_destroyScummVMSurface); // Can't use OpenGLES functions after this @@ -745,8 +717,11 @@ void OSystem_Android::updateScreen() { glPushMatrix(); - if (_shake_offset != 0) { - // This is the only case where _game_texture doesn't + if (_shake_offset != 0 || + (!_focus_rect.isEmpty() && + !Common::Rect(_game_texture->width(), + _game_texture->height()).contains(_focus_rect))) { + // These are the only cases where _game_texture doesn't // cover the entire screen. glClearColorx(0, 0, 0, 1 << 16); glClear(GL_COLOR_BUFFER_BIT); @@ -759,16 +734,6 @@ void OSystem_Android::updateScreen() { _game_texture->drawTexture(0, 0, _egl_surface_width, _egl_surface_height); } else { - // Need to ensure any exposed out-of-bounds region doesn't go - // all hall-of-mirrors. If _shake_offset != 0, we've already - // done this above. - const Common::Rect - screen_bounds(_game_texture->width(), _game_texture->height()); - if (!screen_bounds.contains(_focus_rect) && _shake_offset != 0) { - glClearColorx(0, 0, 0, 1 << 16); - glClear(GL_COLOR_BUFFER_BIT); - } - glPushMatrix(); glScalex(xdiv(_egl_surface_width, _focus_rect.width()), xdiv(_egl_surface_height, _focus_rect.height()), @@ -831,14 +796,11 @@ void OSystem_Android::updateScreen() { CHECK_GL_ERROR(); - if (!eglSwapBuffers(_egl_display, _egl_surface)) { - EGLint error = eglGetError(); - warning("eglSwapBuffers exited with error 0x%x", error); - // Some errors mean we need to reinit GL - if (error == EGL_CONTEXT_LOST) { - destroyScummVMSurface(); - setupScummVMSurface(); - } + JNIEnv* env = JNU_GetEnv(); + if (!env->CallBooleanMethod(_back_ptr, MID_swapBuffers)) { + // Context lost -> need to reinit GL + destroyScummVMSurface(); + setupScummVMSurface(); } } @@ -1365,6 +1327,12 @@ static void ScummVM_enableZoning(JNIEnv* env, jobject self, jboolean enable) { cpp_obj->enableZoning(enable); } +static void ScummVM_setSurfaceSize(JNIEnv* env, jobject self, + jint width, jint height) { + OSystem_Android* cpp_obj = OSystem_Android::fromJavaObject(env, self); + cpp_obj->setSurfaceSize(width, height); +} + const static JNINativeMethod gMethods[] = { { "create", "(Landroid/content/res/AssetManager;)V", (void*)ScummVM_create }, @@ -1381,6 +1349,8 @@ const static JNINativeMethod gMethods[] = { (void*)ScummVM_setConfManString }, { "enableZoning", "(Z)V", (void*)ScummVM_enableZoning }, + { "setSurfaceSize", "(II)V", + (void*)ScummVM_setSurfaceSize }, }; JNIEXPORT jint JNICALL diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index 4ce8a85f30..d39aa363ef 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -12,7 +12,10 @@ import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; +import javax.microedition.khronos.opengles.GL; +import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGL11; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; @@ -30,11 +33,11 @@ import java.util.concurrent.Semaphore; public class ScummVM implements SurfaceHolder.Callback { private final static String LOG_TAG = "ScummVM.java"; - private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo + private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo public static class AudioSetupException extends Exception {} private long nativeScummVM; // native code hangs itself here - boolean scummVMRunning = false; + boolean scummVMRunning = false; private native void create(AssetManager am); @@ -54,49 +57,49 @@ public class ScummVM implements SurfaceHolder.Callback { destroy(); } - // Surface creation: - // GUI thread: create surface, release lock - // ScummVM thread: acquire lock (block), read surface - // - // Surface deletion: - // GUI thread: post event, acquire lock (block), return - // ScummVM thread: read event, free surface, release lock - // - // In other words, ScummVM thread does this: - // acquire lock - // setup surface - // when SCREEN_CHANGED arrives: - // destroy surface - // release lock - // back to acquire lock - static final int configSpec[] = { + // Surface creation: + // GUI thread: create surface, release lock + // ScummVM thread: acquire lock (block), read surface + // + // Surface deletion: + // GUI thread: post event, acquire lock (block), return + // ScummVM thread: read event, free surface, release lock + // + // In other words, ScummVM thread does this: + // acquire lock + // setup surface + // when SCREEN_CHANGED arrives: + // destroy surface + // release lock + // back to acquire lock + static final int configSpec[] = { EGL10.EGL_RED_SIZE, 5, EGL10.EGL_GREEN_SIZE, 5, EGL10.EGL_BLUE_SIZE, 5, EGL10.EGL_DEPTH_SIZE, 0, EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT, EGL10.EGL_NONE, - }; - EGL10 egl; - EGLDisplay eglDisplay = EGL10.EGL_NO_DISPLAY; - EGLConfig eglConfig; - EGLContext eglContext = EGL10.EGL_NO_CONTEXT; - EGLSurface eglSurface = EGL10.EGL_NO_SURFACE; - Semaphore surfaceLock = new Semaphore(0, true); - SurfaceHolder nativeSurface; - - public void surfaceCreated(SurfaceHolder holder) { + }; + EGL10 egl; + EGLDisplay eglDisplay = EGL10.EGL_NO_DISPLAY; + EGLConfig eglConfig; + EGLContext eglContext = EGL10.EGL_NO_CONTEXT; + EGLSurface eglSurface = EGL10.EGL_NO_SURFACE; + Semaphore surfaceLock = new Semaphore(0, true); + SurfaceHolder nativeSurface; + + public void surfaceCreated(SurfaceHolder holder) { nativeSurface = holder; surfaceLock.release(); - } + } - public void surfaceChanged(SurfaceHolder holder, int format, + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { // Disabled while I debug GL problems //pushEvent(new Event(Event.EVENT_SCREEN_CHANGED)); - } + } - public void surfaceDestroyed(SurfaceHolder holder) { + public void surfaceDestroyed(SurfaceHolder holder) { pushEvent(new Event(Event.EVENT_SCREEN_CHANGED)); try { surfaceLock.acquire(); @@ -104,10 +107,10 @@ public class ScummVM implements SurfaceHolder.Callback { Log.e(this.toString(), "Interrupted while waiting for surface lock", e); } - } + } - // Called by ScummVM thread (from initBackend) - private void createScummVMGLContext() { + // Called by ScummVM thread (from initBackend) + private void createScummVMGLContext() { egl = (EGL10)EGLContext.getEGL(); eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); int[] version = new int[2]; @@ -126,10 +129,11 @@ public class ScummVM implements SurfaceHolder.Callback { eglContext = egl.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, null); - } + } - // Called by ScummVM thread - protected void setupScummVMSurface() { + // Called by ScummVM thread + static private boolean _log_version = true; + protected void setupScummVMSurface() { try { surfaceLock.acquire(); } catch (InterruptedException e) { @@ -140,10 +144,30 @@ public class ScummVM implements SurfaceHolder.Callback { eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, nativeSurface, null); egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); - } - // Called by ScummVM thread - protected void destroyScummVMSurface() { + GL10 gl = (GL10)eglContext.getGL(); + + if (_log_version) { + Log.i(LOG_TAG, String.format("Using EGL %s (%s); GL %s/%s (%s)", + egl.eglQueryString(eglDisplay, EGL10.EGL_VERSION), + egl.eglQueryString(eglDisplay, EGL10.EGL_VENDOR), + gl.glGetString(GL10.GL_VERSION), + gl.glGetString(GL10.GL_RENDERER), + gl.glGetString(GL10.GL_VENDOR))); + _log_version = false; // only log this once + } + + int[] value = new int[1]; + egl.eglQuerySurface(eglDisplay, eglSurface, EGL10.EGL_WIDTH, value); + int width = value[0]; + egl.eglQuerySurface(eglDisplay, eglSurface, EGL10.EGL_HEIGHT, value); + int height = value[0]; + Log.i(LOG_TAG, String.format("New surface is %dx%d", width, height)); + setSurfaceSize(width, height); + } + + // Called by ScummVM thread + protected void destroyScummVMSurface() { if (eglSurface != null) { egl.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); @@ -152,17 +176,28 @@ public class ScummVM implements SurfaceHolder.Callback { } surfaceLock.release(); - } + } - public void setSurface(SurfaceHolder holder) { + public void setSurface(SurfaceHolder holder) { holder.addCallback(this); - } + } + + final public boolean swapBuffers() { + if (!egl.eglSwapBuffers(eglDisplay, eglSurface)) { + int error = egl.eglGetError(); + Log.w(LOG_TAG, String.format("eglSwapBuffers exited with error 0x%x", error)); + if (error == EGL11.EGL_CONTEXT_LOST) + return false; + } + return true; + } // Set scummvm config options final public native static void loadConfigFile(String path); final public native static void setConfMan(String key, int value); final public native static void setConfMan(String key, String value); final public native void enableZoning(boolean enable); + final public native void setSurfaceSize(int width, int height); // Feed an event to ScummVM. Safe to call from other threads. final public native void pushEvent(Event e); @@ -180,10 +215,10 @@ public class ScummVM implements SurfaceHolder.Callback { protected void showVirtualKeyboard(boolean enable) {} protected String[] getSysArchives() { return new String[0]; } protected String[] getPluginDirectories() { return new String[0]; } - protected void initBackend() throws AudioSetupException { + protected void initBackend() throws AudioSetupException { createScummVMGLContext(); initAudio(); - } + } private static class AudioThread extends Thread { final private int buf_size; @@ -240,7 +275,7 @@ public class ScummVM implements SurfaceHolder.Callback { break; } else if (ret != len) { Log.w(LOG_TAG, String.format( - "Short audio write. Wrote %dB, not %dB", + "Short audio write. Wrote %dB, not %dB", ret, buf.length)); // Buffer is full, so yield cpu for a while Thread.sleep(100); -- cgit v1.2.3 From f39f7f3dedbea6543337526607b0b1a477c2e0c3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:08:59 +0000 Subject: DS: Augment 'clean' target, simplify bin->elf conversion rule svn-id: r50686 --- backends/platform/ds/ds.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 9df0d2ba0d..d7c7defa3d 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -92,9 +92,17 @@ OPT_SIZE := -Os -mthumb all: scummvm.nds scummvm.ds.gba +clean: dsclean + +dsclean: + $(RM) scummvm.nds scummvm.ds.gba + +.PHONY: dsclean + +# TODO: Add a 'dsdist' target ? + %.bin: %.elf - $(OBJCOPY) -S $< $( 0) { flush(); } @@ -483,15 +482,17 @@ DSFileStream *DSFileStream::makeFromPath(const Common::String &path, bool writeM // Stdio replacements -#define MAX_FILE_HANDLES 32 +enum { + MAX_FILE_HANDLES = 32 +}; -bool inited = false; -DS::fileHandle handle[MAX_FILE_HANDLES]; +static bool inited = false; +static DS::fileHandle s_handle[MAX_FILE_HANDLES]; FILE* std_fopen(const char* name, const char* mode) { if (!inited) { for (int r = 0; r < MAX_FILE_HANDLES; r++) { - handle[r].used = false; + s_handle[r].used = false; } inited = true; currentDir[0] = '\0'; @@ -538,7 +539,7 @@ FILE* std_fopen(const char* name, const char* mode) { // Allocate a file handle int r = 0; - while (handle[r].used) { + while (s_handle[r].used) { r++; assert(r < MAX_FILE_HANDLES); } @@ -546,20 +547,20 @@ FILE* std_fopen(const char* name, const char* mode) { #ifdef GBA_SRAM_SAVE if (strchr(mode, 'w')) { // consolePrintf("Writing %s\n", realName); - handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true); + s_handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true); } else { // consolePrintf("Reading %s\n", realName); - handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, false); + s_handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, false); } #endif - if (handle[r].sramFile) { - handle[r].used = true; - handle[r].pos = 0; - handle[r].data = NULL; - handle[r].size = handle[r].sramFile->getSize(); + if (s_handle[r].sramFile) { + s_handle[r].used = true; + s_handle[r].pos = 0; + s_handle[r].data = NULL; + s_handle[r].size = s_handle[r].sramFile->getSize(); // consolePrintf("Found it"); - return &handle[r]; + return &s_handle[r]; } // consolePrintf("Not in SRAM!"); @@ -590,16 +591,17 @@ FILE* std_fopen(const char* name, const char* mode) { // Allocate a file handle int r = 0; - while (handle[r].used) r++; + while (s_handle[r].used) + r++; - handle[r].used = true; - handle[r].pos = 0; - handle[r].data = data; - handle[r].size = zip->getFileSize(); + s_handle[r].used = true; + s_handle[r].pos = 0; + s_handle[r].data = data; + s_handle[r].size = zip->getFileSize(); // consolePrintf("Opened file %d: %s (%s) ", r, realName, name); - return &handle[r]; + return &s_handle[r]; } else { zip->setAllFilesVisible(false); // consolePrintf("Not found: %s (%s) ", realName, name); diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 556cfc3f43..4ba0b35472 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -194,9 +194,6 @@ enum MouseMode { #define SCUMM_GAME_HEIGHT 142 #define SCUMM_GAME_WIDTH 227 -static int textureID; -static u16* texture; - static int frameCount; static int currentTimeMillis; @@ -235,7 +232,6 @@ static bool indyFightState; static bool indyFightRight; static OSystem_DS::SoundProc soundCallback; -static void *soundParam; static int lastCallbackFrame; static bool bufferFirstHalf; static bool bufferSecondHalf; @@ -1450,7 +1446,6 @@ void doButtonSelectMode(OSystem_DS* system) } if (rightButtonDown) { - Common::Event event; event.mouse = Common::Point(getPenX(), getPenY()); event.type = Common::EVENT_RBUTTONUP; system->addEvent(event); @@ -1464,7 +1459,6 @@ void doButtonSelectMode(OSystem_DS* system) } else { // If we're playing sam and max, click and release the right mouse // button to change verb - Common::Event event; if (s_currentGame->control == CONT_FUTURE_WARS) { event.mouse = Common::Point(320 - 128, 200 - 128); @@ -1579,8 +1573,7 @@ void addEventsToQueue() { bool release = getKeysReleased() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN); bool shoulders = getKeysHeld() & (KEY_L | KEY_R); - if ( (down && (!shoulders)) || release) - { + if ( (down && (!shoulders)) || release) { if (getKeysChanged() & KEY_LEFT) { event.kbd.keycode = Common::KEYCODE_LEFT; @@ -1658,8 +1651,6 @@ void addEventsToQueue() { updateStatus(); - Common::Event event; - if ((tapScreenClicks) && (getIsDisplayMode8Bit())) { if ((!keyboardEnable) || (!isInsideKeyboard(penDownX, penDownY))) { @@ -1713,8 +1704,6 @@ void addEventsToQueue() { if (s_currentGame->control == CONT_SIMON) { // Extra controls for Simon the Sorcerer if ((getKeysDown() & KEY_DOWN)) { - Common::Event event; - event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = Common::KEYCODE_F10; // F10 or # - show hotspots event.kbd.ascii = Common::ASCII_F10; @@ -1732,8 +1721,6 @@ void addEventsToQueue() { if (s_currentGame->control == CONT_SCUMM_ORIGINAL) { // Extra controls for Scumm v1-5 games if ((getKeysDown() & KEY_DOWN)) { - Common::Event event; - event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = Common::KEYCODE_PERIOD; // Full stop - skips current dialogue line event.kbd.ascii = '.'; @@ -2371,7 +2358,7 @@ void uploadSpriteGfx() { vramSetBankE(VRAM_E_MAIN_SPRITE); // Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit! - u8* srcTex = (u8 *) ::icons_raw; + const u8* srcTex = (const u8 *) ::icons_raw; for (int r = 32 * 256 ; r >= 0; r--) { SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); @@ -3361,7 +3348,6 @@ extern "C" void consolePrintf(char * format, ...) __attribute__ ((no_instrument_ extern "C" void consolePrintf(const char * format, ...) { - char buffer[256]; va_list args; va_start(args, format); viprintf(format, args); diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index 88a7ca2b22..5669f7feaf 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -38,7 +38,7 @@ enum controlType { CONT_FUTURE_WARS, CONT_AGI, CONT_GOBLINS, - CONT_NIPPON, + CONT_NIPPON }; struct gameListType { diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 9171151fde..5e21a7d78f 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -310,7 +310,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int for (int dy = y; dy < y + h; dy++) { u8* dest = ((u8 *) (bg)) + (dy * stride) + x; - u8* src = (u8 *) buf + (pitch * by); + const u8* src = (const u8 *) buf + (pitch * by); u32 dx; @@ -362,7 +362,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int for (int dy = y; dy < y + h; dy++) { u8* dest = ((u8 *) (bg)) + (dy * stride) + x; u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x; - u8* src = (u8 *) buf + (pitch * by); + const u8* src = (const u8 *) buf + (pitch * by); u32 dx; @@ -591,7 +591,7 @@ void OSystem_DS::refreshCursor() { DS::setCursorIcon(_cursorImage, _cursorW, _cursorH, _cursorKey, _cursorHotX, _cursorHotY); } -void OSystem_DS::addEvent(Common::Event& e) { +void OSystem_DS::addEvent(const Common::Event& e) { eventQueue[queuePos++] = e; } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 10b4c87f66..dc8b65a1c8 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -136,8 +136,8 @@ public: virtual Common::SaveFileManager *getSavefileManager(); - void addEvent(Common::Event& e); - bool isEventQueueEmpty() { return queuePos == 0; } + void addEvent(const Common::Event& e); + bool isEventQueueEmpty() const { return queuePos == 0; } virtual bool grabRawScreen(Graphics::Surface* surf); @@ -161,8 +161,8 @@ public: virtual void clearAutoComplete(); virtual void setCharactersEntered(int count); - u16 getDSPaletteEntry(u32 entry) { return _palette[entry]; } - u16 getDSCursorPaletteEntry(u32 entry) { return !_disableCursorPalette? _cursorPalette[entry]: _palette[entry]; } + u16 getDSPaletteEntry(u32 entry) const { return _palette[entry]; } + u16 getDSCursorPaletteEntry(u32 entry) const { return !_disableCursorPalette? _cursorPalette[entry]: _palette[entry]; } virtual void setCursorPalette(const byte *colors, uint start, uint num); diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 88bf0ae991..ef931899be 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -47,100 +47,100 @@ key_data keys[DS_NUM_KEYS] = { // Key number x y character // Numbers - {28, 3, 0, '1'}, - {29, 5, 0, '2'}, - {30, 7, 0, '3'}, - {31, 9, 0, '4'}, - {32, 11, 0, '5'}, - {33, 13, 0, '6'}, - {34, 15, 0, '7'}, - {35, 17, 0, '8'}, - {36, 19, 0, '9'}, - {27, 21, 0, '0'}, - {45, 23, 0, Common::KEYCODE_MINUS}, - {50, 25, 0, Common::KEYCODE_EQUALS}, - {52, 27, 0, Common::KEYCODE_BACKSPACE}, + {28, 3, 0, '1', false}, + {29, 5, 0, '2', false}, + {30, 7, 0, '3', false}, + {31, 9, 0, '4', false}, + {32, 11, 0, '5', false}, + {33, 13, 0, '6', false}, + {34, 15, 0, '7', false}, + {35, 17, 0, '8', false}, + {36, 19, 0, '9', false}, + {27, 21, 0, '0', false}, + {45, 23, 0, Common::KEYCODE_MINUS, false}, + {50, 25, 0, Common::KEYCODE_EQUALS, false}, + {52, 27, 0, Common::KEYCODE_BACKSPACE, false}, // Top row - {'Q'-'A' + 1, 4, 2, 'Q'}, - {'W'-'A' + 1, 6, 2, 'W'}, - {'E'-'A' + 1, 8, 2, 'E'}, - {'R'-'A' + 1, 10, 2, 'R'}, - {'T'-'A' + 1, 12, 2, 'T'}, - {'Y'-'A' + 1, 14, 2, 'Y'}, - {'U'-'A' + 1, 16, 2, 'U'}, - {'I'-'A' + 1, 18, 2, 'I'}, - {'O'-'A' + 1, 20, 2, 'O'}, - {'P'-'A' + 1, 22, 2, 'P'}, - {43, 24, 2, Common::KEYCODE_LEFTBRACKET}, - {44, 26, 2, Common::KEYCODE_RIGHTBRACKET}, + {'Q'-'A' + 1, 4, 2, 'Q', false}, + {'W'-'A' + 1, 6, 2, 'W', false}, + {'E'-'A' + 1, 8, 2, 'E', false}, + {'R'-'A' + 1, 10, 2, 'R', false}, + {'T'-'A' + 1, 12, 2, 'T', false}, + {'Y'-'A' + 1, 14, 2, 'Y', false}, + {'U'-'A' + 1, 16, 2, 'U', false}, + {'I'-'A' + 1, 18, 2, 'I', false}, + {'O'-'A' + 1, 20, 2, 'O', false}, + {'P'-'A' + 1, 22, 2, 'P', false}, + {43, 24, 2, Common::KEYCODE_LEFTBRACKET, false}, + {44, 26, 2, Common::KEYCODE_RIGHTBRACKET, false}, // Middle row - {55, 3, 4, DS_CAPSLOCK}, - {'A'-'A' + 1, 5, 4, 'A'}, - {'S'-'A' + 1, 7, 4, 'S'}, - {'D'-'A' + 1, 9, 4, 'D'}, - {'F'-'A' + 1, 11, 4, 'F'}, - {'G'-'A' + 1, 13, 4, 'G'}, - {'H'-'A' + 1, 15, 4, 'H'}, - {'J'-'A' + 1, 17, 4, 'J'}, - {'K'-'A' + 1, 19, 4, 'K'}, - {'L'-'A' + 1, 21, 4, 'L'}, - {42, 23, 4, Common::KEYCODE_SEMICOLON}, - {41, 25, 4, Common::KEYCODE_QUOTE}, - {46, 27, 4, Common::KEYCODE_RETURN}, + {55, 3, 4, DS_CAPSLOCK, false}, + {'A'-'A' + 1, 5, 4, 'A', false}, + {'S'-'A' + 1, 7, 4, 'S', false}, + {'D'-'A' + 1, 9, 4, 'D', false}, + {'F'-'A' + 1, 11, 4, 'F', false}, + {'G'-'A' + 1, 13, 4, 'G', false}, + {'H'-'A' + 1, 15, 4, 'H', false}, + {'J'-'A' + 1, 17, 4, 'J', false}, + {'K'-'A' + 1, 19, 4, 'K', false}, + {'L'-'A' + 1, 21, 4, 'L', false}, + {42, 23, 4, Common::KEYCODE_SEMICOLON, false}, + {41, 25, 4, Common::KEYCODE_QUOTE, false}, + {46, 27, 4, Common::KEYCODE_RETURN, false}, // Bottom row - {51, 4, 6, DS_SHIFT}, - {'Z'-'A' + 1, 6, 6, 'Z'}, - {'X'-'A' + 1, 8, 6, 'X'}, - {'C'-'A' + 1, 10, 6, 'C'}, - {'V'-'A' + 1, 12, 6, 'V'}, - {'B'-'A' + 1, 14, 6, 'B'}, - {'N'-'A' + 1, 16, 6, 'N'}, - {'M'-'A' + 1, 18, 6, 'M'}, - {38, 20, 6, Common::KEYCODE_COMMA}, - {39, 22, 6, Common::KEYCODE_PERIOD}, - {40, 24, 6, Common::KEYCODE_SLASH}, + {51, 4, 6, DS_SHIFT, false}, + {'Z'-'A' + 1, 6, 6, 'Z', false}, + {'X'-'A' + 1, 8, 6, 'X', false}, + {'C'-'A' + 1, 10, 6, 'C', false}, + {'V'-'A' + 1, 12, 6, 'V', false}, + {'B'-'A' + 1, 14, 6, 'B', false}, + {'N'-'A' + 1, 16, 6, 'N', false}, + {'M'-'A' + 1, 18, 6, 'M', false}, + {38, 20, 6, Common::KEYCODE_COMMA, false}, + {39, 22, 6, Common::KEYCODE_PERIOD, false}, + {40, 24, 6, Common::KEYCODE_SLASH, false}, // Space bar - {47, 9, 8, Common::KEYCODE_SPACE}, - {48, 11, 8, Common::KEYCODE_SPACE}, - {48, 13, 8, Common::KEYCODE_SPACE}, - {48, 15, 8, Common::KEYCODE_SPACE}, - {48, 17, 8, Common::KEYCODE_SPACE}, - {49, 19, 8, Common::KEYCODE_SPACE}, + {47, 9, 8, Common::KEYCODE_SPACE, false}, + {48, 11, 8, Common::KEYCODE_SPACE, false}, + {48, 13, 8, Common::KEYCODE_SPACE, false}, + {48, 15, 8, Common::KEYCODE_SPACE, false}, + {48, 17, 8, Common::KEYCODE_SPACE, false}, + {49, 19, 8, Common::KEYCODE_SPACE, false}, // Cursor arrows - {52, 27, 8, Common::KEYCODE_LEFT}, - {54, 29, 8, Common::KEYCODE_DOWN}, - {53, 31, 8, Common::KEYCODE_RIGHT}, - {51, 29, 6, Common::KEYCODE_UP}, + {52, 27, 8, Common::KEYCODE_LEFT, false}, + {54, 29, 8, Common::KEYCODE_DOWN, false}, + {53, 31, 8, Common::KEYCODE_RIGHT, false}, + {51, 29, 6, Common::KEYCODE_UP, false}, // Close button - {56, 30, 0, Common::KEYCODE_INVALID}, + {56, 30, 0, Common::KEYCODE_INVALID, false}, // Function keys (needed for AGI) - {57, 4, -2, Common::KEYCODE_F1}, - {58, 6, -2, Common::KEYCODE_F2}, - {59, 8, -2, Common::KEYCODE_F3}, - {60, 10, -2, Common::KEYCODE_F4}, - {61, 14, -2, Common::KEYCODE_F5}, - {62, 16, -2, Common::KEYCODE_F6}, - {63, 18, -2, Common::KEYCODE_F7}, - {64, 20, -2, Common::KEYCODE_F8}, - {65, 24, -2, Common::KEYCODE_F9}, - {66, 26, -2, Common::KEYCODE_F10}, - {67, 28, -2, Common::KEYCODE_F11}, - {68, 30, -2, Common::KEYCODE_F12}, + {57, 4, -2, Common::KEYCODE_F1, false}, + {58, 6, -2, Common::KEYCODE_F2, false}, + {59, 8, -2, Common::KEYCODE_F3, false}, + {60, 10, -2, Common::KEYCODE_F4, false}, + {61, 14, -2, Common::KEYCODE_F5, false}, + {62, 16, -2, Common::KEYCODE_F6, false}, + {63, 18, -2, Common::KEYCODE_F7, false}, + {64, 20, -2, Common::KEYCODE_F8, false}, + {65, 24, -2, Common::KEYCODE_F9, false}, + {66, 26, -2, Common::KEYCODE_F10, false}, + {67, 28, -2, Common::KEYCODE_F11, false}, + {68, 30, -2, Common::KEYCODE_F12, false}, }; int keyboardX; int keyboardY; -int mapBase; -int tileBase; +static int s_mapBase; +static int s_tileBase; u16* baseAddress; @@ -212,7 +212,7 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { for (int tile = 0; tile < 94; tile++) { u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32))); - u8* src = ((u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8; + const u8* src = ((const u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8; for (int y = 0 ; y < 8; y++) { for (int x = 0; x < 2; x++) { @@ -247,8 +247,8 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { keyboardX = -2; keyboardY = 2; - DS::mapBase = mapBase; - DS::tileBase = tileBase; + DS::s_mapBase = mapBase; + DS::s_tileBase = tileBase; shiftState = false; capsLockState = false; @@ -314,7 +314,7 @@ bool getKeyboardClosed() { } void setKeyHighlight(int key, bool highlight) { - u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(DS::mapBase)); + u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(DS::s_mapBase)); if (highlight) { base[(keyboardY + keys[key].y) * 32 + keyboardX + keys[key].x] |= 0x1000; diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h index 6ceb83bfc7..33dab253a9 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.h +++ b/backends/platform/ds/arm9/source/touchkeyboard.h @@ -27,9 +27,11 @@ namespace DS { -static const int NUM_WORDS = 12; -static const int KEYBOARD_DATA_SIZE = 4736 * 2; -static const int KEYBOARD_BOTTOM_Y = 105; +enum { + NUM_WORDS = 12, + KEYBOARD_DATA_SIZE = 4736 * 2, + KEYBOARD_BOTTOM_Y = 105 +}; void createKeyEvent(int keyNum, Common::Event& event); -- cgit v1.2.3 From e4ec2e6403211abd52806d19732ac30d9a874f92 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:10:22 +0000 Subject: DS: Code formatting: "char* foo" -> "char *foo" svn-id: r50688 --- backends/fs/ds/ds-fs.cpp | 44 +++++++-------- backends/fs/ds/ds-fs.h | 28 ++++----- backends/platform/ds/arm7/source/main.cpp | 14 ++--- backends/platform/ds/arm9/source/blitters.cpp | 22 ++++---- backends/platform/ds/arm9/source/blitters.h | 16 +++--- backends/platform/ds/arm9/source/cdaudio.cpp | 8 +-- backends/platform/ds/arm9/source/dsmain.cpp | 48 ++++++++-------- backends/platform/ds/arm9/source/dsmain.h | 8 +-- backends/platform/ds/arm9/source/dsoptions.cpp | 2 +- backends/platform/ds/arm9/source/dsoptions.h | 48 ++++++++-------- backends/platform/ds/arm9/source/gbampsave.cpp | 4 +- backends/platform/ds/arm9/source/gbampsave.h | 10 ++-- backends/platform/ds/arm9/source/osystem_ds.cpp | 66 +++++++++++----------- backends/platform/ds/arm9/source/osystem_ds.h | 22 ++++---- backends/platform/ds/arm9/source/portdefs.cpp | 2 +- backends/platform/ds/arm9/source/ramsave.cpp | 24 ++++---- backends/platform/ds/arm9/source/ramsave.h | 26 ++++----- backends/platform/ds/arm9/source/touchkeyboard.cpp | 26 ++++----- backends/platform/ds/arm9/source/touchkeyboard.h | 6 +- .../platform/ds/arm9/source/wordcompletion.cpp | 8 +-- backends/platform/ds/arm9/source/zipreader.cpp | 6 +- backends/platform/ds/arm9/source/zipreader.h | 10 ++-- .../platform/ds/commoninclude/NDS/scummvm_ipc.h | 4 +- 23 files changed, 226 insertions(+), 226 deletions(-) (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 39eaf39ec0..8dc3902216 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -115,7 +115,7 @@ DSFileSystemNode::DSFileSystemNode(const Common::String& path, bool isDir) { // consolePrintf("Found: %d, Dir: %d\n", _isValid, _isDirectory); } -DSFileSystemNode::DSFileSystemNode(const DSFileSystemNode* node) { +DSFileSystemNode::DSFileSystemNode(const DSFileSystemNode *node) { //TODO: not implemented? } @@ -144,7 +144,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool _zipFile->changeToRoot(); /* // This is the root dir, so add the RAM folder - DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/ram"); + DSFileSystemNode *dsfsn = new DSFileSystemNode("ds:/ram"); dsfsn->_isDirectory = true; dirList->push_back(wrap(dsfsn)); */ @@ -162,7 +162,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool if ( (_zipFile->isDirectory() && ((mode == Common::FSNode::kListDirectoriesOnly) || (mode == Common::FSNode::kListAll)) ) || (!_zipFile->isDirectory() && ((mode == Common::FSNode::kListFilesOnly) || (mode == Common::FSNode::kListAll)) ) ) { - DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + Common::String(n), _zipFile->isDirectory()); + DSFileSystemNode *dsfsn = new DSFileSystemNode("ds:/" + Common::String(n), _zipFile->isDirectory()); dsfsn->_isDirectory = _zipFile->isDirectory(); dirList.push_back((dsfsn)); } @@ -173,7 +173,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool return true; } -AbstractFSNode* DSFileSystemNode::getParent() const { +AbstractFSNode *DSFileSystemNode::getParent() const { // consolePrintf("parent\n"); DSFileSystemNode *p; @@ -276,7 +276,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDire } -GBAMPFileSystemNode::GBAMPFileSystemNode(const GBAMPFileSystemNode* node) { +GBAMPFileSystemNode::GBAMPFileSystemNode(const GBAMPFileSystemNode *node) { //TODO: not implemented? } @@ -319,7 +319,7 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo if ( ((entryType == TYPE_DIR) && ((mode == Common::FSNode::kListDirectoriesOnly) || (mode == Common::FSNode::kListAll))) || ((entryType == TYPE_FILE) && ((mode == Common::FSNode::kListFilesOnly) || (mode == Common::FSNode::kListAll))) ) { - GBAMPFileSystemNode* dsfsn; + GBAMPFileSystemNode *dsfsn; //consolePrintf("Fname: %s\n", fname); @@ -348,7 +348,7 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo return true; } -AbstractFSNode* GBAMPFileSystemNode::getParent() const { +AbstractFSNode *GBAMPFileSystemNode::getParent() const { // consolePrintf("parent\n"); GBAMPFileSystemNode *p; @@ -489,7 +489,7 @@ enum { static bool inited = false; static DS::fileHandle s_handle[MAX_FILE_HANDLES]; -FILE* std_fopen(const char* name, const char* mode) { +FILE *std_fopen(const char *name, const char *mode) { if (!inited) { for (int r = 0; r < MAX_FILE_HANDLES; r++) { s_handle[r].used = false; @@ -498,7 +498,7 @@ FILE* std_fopen(const char* name, const char* mode) { currentDir[0] = '\0'; } - char* realName = (char *) name; + char *realName = (char *) name; // Remove file system prefix if ((name[0] == 'd') && (name[1] == 's') && (name[2] == ':') && (name[3] == '/')) { @@ -516,13 +516,13 @@ FILE* std_fopen(const char* name, const char* mode) { FAT_chdir("/"); // Turn all back slashes into forward slashes for gba_nds_fat - char* p = realName; + char *p = realName; while (*p) { if (*p == '\\') *p = '/'; p++; } - FAT_FILE* result = FAT_fopen(realName, mode); + FAT_FILE *result = FAT_fopen(realName, mode); if (result == 0) { // consolePrintf("Error code %d\n", result); @@ -565,9 +565,9 @@ FILE* std_fopen(const char* name, const char* mode) { // consolePrintf("Not in SRAM!"); - char* data; + char *data; - ZipFile* zip = DSFileSystemNode::getZip(); + ZipFile *zip = DSFileSystemNode::getZip(); if (!zip) { // consolePrintf("No zip yet!"); return NULL; @@ -609,7 +609,7 @@ FILE* std_fopen(const char* name, const char* mode) { } } -void std_fclose(FILE* handle) { +void std_fclose(FILE *handle) { if (DS::isGBAMPAvailable()) { FAT_fclose((FAT_FILE *) handle); @@ -623,7 +623,7 @@ void std_fclose(FILE* handle) { } } -size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { +size_t std_fread(const void *ptr, size_t size, size_t numItems, FILE *handle) { // consolePrintf("fread %d,%d %d ", size, numItems, ptr); if (DS::isGBAMPAvailable()) { @@ -668,7 +668,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { return numItems; } -size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) { +size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle) { if ((handle == stdin)) return 0; if ((handle == stderr) || (handle == stdout)) { @@ -704,7 +704,7 @@ size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) { } } -bool std_feof(FILE* handle) { +bool std_feof(FILE *handle) { // consolePrintf("feof "); if (DS::isGBAMPAvailable()) { @@ -719,13 +719,13 @@ bool std_feof(FILE* handle) { return handle->pos >= handle->size; } -int std_fflush(FILE* handle) { +int std_fflush(FILE *handle) { //FIXME: not implemented? // consolePrintf("fflush "); return 0; } -long int std_ftell(FILE* handle) { +long int std_ftell(FILE *handle) { if (DS::isGBAMPAvailable()) { return FAT_ftell((FAT_FILE *) handle); } @@ -733,7 +733,7 @@ long int std_ftell(FILE* handle) { return handle->pos; } -int std_fseek(FILE* handle, long int offset, int whence) { +int std_fseek(FILE *handle, long int offset, int whence) { // consolePrintf("fseek %d %d ", offset, whence); if (DS::isGBAMPAvailable()) { @@ -758,14 +758,14 @@ int std_fseek(FILE* handle, long int offset, int whence) { return 0; } -int std_ferror(FILE* handle) { +int std_ferror(FILE *handle) { //FIXME: not implemented? // consolePrintf("ferror "); return readPastEndOfFile; } -void std_clearerr(FILE* handle) { +void std_clearerr(FILE *handle) { //FIXME: not implemented? readPastEndOfFile = false; // consolePrintf("clearerr "); diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index c8bf7d6cf2..b4c8f7ac12 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -40,7 +40,7 @@ namespace DS { */ class DSFileSystemNode : public AbstractFSNode { protected: - static ZipFile* _zipFile; + static ZipFile *_zipFile; Common::String _displayName; Common::String _path; @@ -96,7 +96,7 @@ public: * Returns the zip file this node points to. * TODO: check this documentation. */ - static ZipFile* getZip() { return _zipFile; } + static ZipFile *getZip() { return _zipFile; } }; /** @@ -161,10 +161,10 @@ public: struct fileHandle { int pos; bool used; - char* data; + char *data; int size; - DSSaveFile* sramFile; + DSSaveFile *sramFile; }; @@ -213,16 +213,16 @@ public: #define FILE DS::fileHandle // Please do not remove any of these prototypes that appear not to be required. -FILE* std_fopen(const char* name, const char* mode); -void std_fclose(FILE* handle); -size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle); -size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle); -bool std_feof(FILE* handle); -long int std_ftell(FILE* handle); -int std_fseek(FILE* handle, long int offset, int whence); -void std_clearerr(FILE* handle); -int std_fflush(FILE* handle); -int std_ferror(FILE* handle); +FILE* std_fopen(const char *name, const char *mode); +void std_fclose(FILE *handle); +size_t std_fread(const void *ptr, size_t size, size_t numItems, FILE *handle); +size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle); +bool std_feof(FILE *handle); +long int std_ftell(FILE *handle); +int std_fseek(FILE *handle, long int offset, int whence); +void std_clearerr(FILE *handle); +int std_fflush(FILE *handle); +int std_ferror(FILE *handle); } //namespace DS diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index a4cde02ba6..b45b601bda 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -58,10 +58,10 @@ s32 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1; s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH -60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28; s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT-60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28; -vu8* soundData; +vu8 *soundData; -vu8* soundBuffer; -vu8* arm9Buffer; +vu8 *soundBuffer; +vu8 *arm9Buffer; bool soundFilled[4]; int playingSection; @@ -81,7 +81,7 @@ int adpcmBufferNum = 0; ////////////////////////////////////////////////////////////////////// /* -void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { +void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate); SCHANNEL_SOURCE(channel) = (uint32)data; SCHANNEL_LENGTH(channel) = bytes; @@ -106,7 +106,7 @@ s8 getFreeSoundChannel() { return -1; } -void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { +void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) { // REG_IME = IME_DISABLE; channel = getFreeSoundChannel(); @@ -177,7 +177,7 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8 - soundData = (vu8* ) data; + soundData = (vu8 *) data; SCHANNEL_CR(channel) = flags; SCHANNEL_CR(channel + 2) = flags; @@ -386,7 +386,7 @@ void InterruptTimer1() { //if ((!soundFilled[r]) && (!IPC->fillNeeded[playingSection])) { memcpy((void *) (soundBuffer + (r * 1024)), (void *) (arm9Buffer + (r * 1024)), 1024); - vu16* p = (vu16 *) (soundBuffer); + vu16 *p = (vu16 *) (soundBuffer); //for (int t = 0; t < 2048; t++) { // *(p + t) = (t & 1)? 0xF000: 0x0000; //} diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index 07c6b3fee1..fa746fa51e 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -27,7 +27,7 @@ namespace DS { -void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, +void asmDrawStripToScreen(int height, int width, byte const *text, byte const *src, byte *dst, int vsPitch, int vmScreenWidth, int textSurfacePitch) { @@ -111,7 +111,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s -void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) { +void asmCopy8Col(byte *dst, int dstPitch, const byte *src, int height) { asm("ands r0, %3, #1\n" "addne %3, %3, #1\n" "bne roll2\n" @@ -155,7 +155,7 @@ void ComputeDivBy5TableIFN() #ifdef PERFECT_5_TO_4_RESCALING static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4, - u16* dest) + u16 *dest) { u32 bs0 = s0 & 0x1F; u32 bs1 = s1 & 0x1F; @@ -230,7 +230,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 } #else static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4, - u16* dest) + u16 *dest) { static const u32 MASK = 0x03E07C1F; @@ -279,7 +279,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 #endif static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3, u32 s4, - u16* dest) + u16 *dest) { u32 d0 = 4*s0 + s1; u32 d1 = 2*s1 + s1 + 2*s2; @@ -317,7 +317,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3 // Can't work in place #ifdef PERFECT_5_TO_4_RESCALING -static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette) +static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u32 *palette) { ComputeDivBy5TableIFN(); @@ -333,7 +333,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const } } #else -static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u16* palette) +static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u16 *palette) { for (size_t i=0; i<64; ++i) { @@ -350,7 +350,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const // Can work in place, because it's a contraction -static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src) +static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const u16 *src) { ComputeDivBy5TableIFN(); @@ -367,7 +367,7 @@ static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const } #ifdef PERFECT_5_TO_4_RESCALING -void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette) +void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) { u32 fastRam[768]; @@ -388,7 +388,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri } } #else -void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette) +void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) { u16 fastRam[256]; for (size_t i=0; i<128; ++i) @@ -401,7 +401,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri } #endif -void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride) +void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride) { for (size_t i=0; i<200; ++i) { diff --git a/backends/platform/ds/arm9/source/blitters.h b/backends/platform/ds/arm9/source/blitters.h index 5f541d1bd6..60dc2af133 100644 --- a/backends/platform/ds/arm9/source/blitters.h +++ b/backends/platform/ds/arm9/source/blitters.h @@ -29,11 +29,11 @@ namespace DS { -void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, +void asmDrawStripToScreen(int height, int width, byte const *text, byte const *src, byte *dst, int vsPitch, int vmScreenWidth, int textSurfacePitch); -void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height); -void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette); -void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride); +void asmCopy8Col(byte *dst, int dstPitch, const byte *src, int height); +void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette); +void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride); } @@ -41,11 +41,11 @@ void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStr extern "C" { -void ITCM_CODE asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst, +void ITCM_CODE asmDrawStripToScreen(int height, int width, byte const *text, byte const *src, byte *dst, int vsPitch, int vmScreenWidth, int textSurfacePitch); -void ITCM_CODE asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height); -void ITCM_CODE Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette, u32 numLines); -void ITCM_CODE Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride); +void ITCM_CODE asmCopy8Col(byte *dst, int dstPitch, const byte *src, int height); +void ITCM_CODE Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette, u32 numLines); +void ITCM_CODE Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride); } diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 7756286117..23a276c4cb 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -74,13 +74,13 @@ struct decoderFormat { bool active = false; WaveHeader waveHeader; Header blockHeader; -FILE* file; +FILE *file; int fillPos; bool isPlayingFlag = false; -s16* audioBuffer; +s16 *audioBuffer; u32 sampleNum; -s16* decompressionBuffer; +s16 *decompressionBuffer; int numLoops; int blockCount; int dataChunkStart; @@ -495,7 +495,7 @@ bool trackExists(int num) { } consolePrintf("Looking for %s...", path.c_str()); - FILE* file; + FILE *file; if ((file = DS::std_fopen(path.c_str(), "r"))) { consolePrintf("Success!\n"); setActive(true); diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 4ba0b35472..2f0d5e34ee 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -119,7 +119,7 @@ static const char *registerNames[] = #ifdef WRAP_MALLOC -extern "C" void* __real_malloc(size_t size); +extern "C" void *__real_malloc(size_t size); static int s_total_malloc = 0; @@ -158,7 +158,7 @@ extern "C" void *__wrap_malloc(size_t size) { consolePrintf("0 size malloc (%d)", zeroSize++); } - void* res = __real_malloc(size); + void *res = __real_malloc(size); if (res) { if (size > 50 * 1024) { consolePrintf("Allocated %d (%x)\n", size, poo); @@ -219,7 +219,7 @@ static int subScreenScale = 256; // Sound static int bufferSize; -static s16* soundBuffer; +static s16 *soundBuffer; static int bufferFrame; static int bufferRate; static int bufferSamples; @@ -431,7 +431,7 @@ controlType getControlType() { //plays an 8 bit mono sample at 11025Hz -void playSound(const void* data, u32 length, bool loop, bool adpcm, int rate) { +void playSound(const void *data, u32 length, bool loop, bool adpcm, int rate) { if (!IPC->soundData) { soundControl.count = 0; @@ -784,7 +784,7 @@ void setMouseCursorVisible(bool enable) { mouseCursorVisible = enable; } -void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY) { +void setCursorIcon(const u8 *icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY) { int off; @@ -965,7 +965,7 @@ void displayMode16BitFlipBuffer() { consolePrintf("Flip %s...", displayModeIs8Bit ? "8bpp" : "16bpp"); #endif if (!displayModeIs8Bit) { - u16* back = get16BitBackBuffer(); + u16 *back = get16BitBackBuffer(); // highBuffer = !highBuffer; // BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer? 1: 0); @@ -984,8 +984,8 @@ void displayMode16BitFlipBuffer() { TIMER1_CR = TIMER_ENABLE | TIMER_DIV_1024; u16 t0 = TIMER1_DATA; #endif - const u8* back = (const u8*)get8BitBackBuffer(); - u16* base = BG_GFX + 0x10000; + const u8 *back = (const u8*)get8BitBackBuffer(); + u16 *base = BG_GFX + 0x10000; Rescale_320x256xPAL8_To_256x256x1555( base, back, @@ -1033,11 +1033,11 @@ s32 get8BitBackBufferStride() { } } -u16* getScalerBuffer() { +u16 *getScalerBuffer() { return (u16 *) scalerBackBuffer; } -u16* get8BitBackBuffer() { +u16 *get8BitBackBuffer() { if (isCpuScalerEnabled()) return (u16 *) scalerBackBuffer; else @@ -1107,7 +1107,7 @@ void soundUpdate() { void memoryReport() { int r = 0; - int* p; + int *p; do { p = (int *) malloc(r * 8192); free(p); @@ -1115,7 +1115,7 @@ void memoryReport() { } while ((p) && (r < 512)); int t = -1; - void* block[1024]; + void *block[1024]; do { t++; block[t] = (int *) malloc(4096); @@ -1130,7 +1130,7 @@ void memoryReport() { void addIndyFightingKeys() { - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); Common::Event event; event.type = Common::EVENT_KEYDOWN; @@ -1230,7 +1230,7 @@ void addIndyFightingKeys() { void setKeyboardEnable(bool en) { if (en == keyboardEnable) return; keyboardEnable = en; - u16* backupBank = (u16 *) 0x6040000; + u16 *backupBank = (u16 *) 0x6040000; if (keyboardEnable) { @@ -1266,7 +1266,7 @@ void setKeyboardEnable(bool en) { if (displayModeIs8Bit) { // Copy the sub screen VRAM from the top screen - they should always be // the same. - u16* buffer = get8BitBackBuffer(); + u16 *buffer = get8BitBackBuffer(); s32 stride = get8BitBackBufferStride(); for (int y = 0; y < gameHeight; y++) { @@ -1302,7 +1302,7 @@ bool getIsDisplayMode8Bit() { return displayModeIs8Bit; } -void doScreenTapMode(OSystem_DS* system) { +void doScreenTapMode(OSystem_DS *system) { Common::Event event; static bool left = false, right = false; @@ -1368,7 +1368,7 @@ void doScreenTapMode(OSystem_DS* system) { system->addEvent(event); } -void doButtonSelectMode(OSystem_DS* system) +void doButtonSelectMode(OSystem_DS *system) { Common::Event event; @@ -1492,7 +1492,7 @@ void addEventsToQueue() { #ifdef HEAVY_LOGGING consolePrintf("addEventsToQueue\n"); #endif - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); Common::Event event; #ifdef USE_PROFILER @@ -2358,7 +2358,7 @@ void uploadSpriteGfx() { vramSetBankE(VRAM_E_MAIN_SPRITE); // Convert texture from 24bit 888 to 16bit 1555, remembering to set top bit! - const u8* srcTex = (const u8 *) ::icons_raw; + const u8 *srcTex = (const u8 *) ::icons_raw; for (int r = 32 * 256 ; r >= 0; r--) { SPRITE_GFX_SUB[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); SPRITE_GFX[r] = 0x8000 | (srcTex[r * 3] >> 3) | ((srcTex[r * 3 + 1] >> 3) << 5) | ((srcTex[r * 3 + 2] >> 3) << 10); @@ -2831,11 +2831,11 @@ bool getIndyFightState() { /////////////////// #define FAST_RAM_SIZE (24000) -u8* fastRamPointer; +u8 *fastRamPointer; u8 fastRamData[FAST_RAM_SIZE] ITCM_DATA; -void* fastRamAlloc(int size) { - void* result = (void *) fastRamPointer; +void *fastRamAlloc(int size) { + void *result = (void *) fastRamPointer; fastRamPointer += size; if(fastRamPointer > fastRamData + FAST_RAM_SIZE) { consolePrintf("FastRam (ITCM) allocation failed!\n"); @@ -2892,7 +2892,7 @@ void initDebugger() { // Ensure the function is processed with C linkage -extern "C" void debug_print_stub(char* string); +extern "C" void debug_print_stub(char *string); void debug_print_stub(char *string) { consolePrintf(string); @@ -3252,7 +3252,7 @@ int main(void) { */ // Create a file system node to force search for a zip file in GBA rom space - DSFileSystemNode* node = new DSFileSystemNode(); + DSFileSystemNode *node = new DSFileSystemNode(); if (!node->getZip() || (!node->getZip()->isReady())) { // If not found, init CF/SD driver initGBAMP(mode); diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index 5669f7feaf..7cf8313391 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -76,8 +76,8 @@ void displayMode16Bit(); // Switch to 16-bit mode5 void displayMode16BitFlipBuffer(); // Get address of current back buffer -u16* get16BitBackBuffer(); -u16* get8BitBackBuffer(); +u16 * get16BitBackBuffer(); +u16 * get8BitBackBuffer(); s32 get8BitBackBufferStride(); u16* getScalerBuffer(); @@ -96,7 +96,7 @@ void doTimerCallback(); // Call callback function if required void doSoundCallback(); void startSound(int freq, int buffer); // Start sound hardware // Call function if sound buffers need more data -void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound +void playSound(const void *data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound void stopSound(int channel); int getSoundFrequency(); @@ -106,7 +106,7 @@ void VBlankHandler(); // Sam and Max Stuff void setGameID(int id); -void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY); +void setCursorIcon(const u8 *icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY); void setShowCursor(bool enable); void setMouseCursorVisible(bool visible); diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 44bbad23b2..d8b2365c4f 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -366,7 +366,7 @@ void showOptionsDialog() { DS::displayMode16Bit(); - DSOptionsDialog* d = new DSOptionsDialog(); + DSOptionsDialog *d = new DSOptionsDialog(); d->runModal(); delete d; diff --git a/backends/platform/ds/arm9/source/dsoptions.h b/backends/platform/ds/arm9/source/dsoptions.h index 4b3ac36d45..48eb2c3303 100644 --- a/backends/platform/ds/arm9/source/dsoptions.h +++ b/backends/platform/ds/arm9/source/dsoptions.h @@ -46,30 +46,30 @@ protected: virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); void updateConfigManager(); - GUI::TabWidget* _tab; - - GUI::StaticTextWidget* _sensitivityLabel; - - GUI::SliderWidget* _touchX; - GUI::SliderWidget* _touchY; - GUI::SliderWidget* _sensitivity; - GUI::SliderWidget* _gammaCorrection; - GUI::CheckboxWidget* _leftHandedCheckbox; - GUI::CheckboxWidget* _unscaledCheckbox; - GUI::CheckboxWidget* _100PercentCheckbox; - GUI::CheckboxWidget* _150PercentCheckbox; - GUI::CheckboxWidget* _200PercentCheckbox; - GUI::CheckboxWidget* _indyFightCheckbox; - GUI::CheckboxWidget* _highQualityAudioCheckbox; - GUI::CheckboxWidget* _disablePowerOff; - GUI::CheckboxWidget* _showCursorCheckbox; - GUI::CheckboxWidget* _snapToBorderCheckbox; - - GUI::CheckboxWidget* _hardScaler; - GUI::CheckboxWidget* _cpuScaler; - - GUI::CheckboxWidget* _touchPadStyle; - GUI::CheckboxWidget* _screenTaps; + GUI::TabWidget *_tab; + + GUI::StaticTextWidget *_sensitivityLabel; + + GUI::SliderWidget *_touchX; + GUI::SliderWidget *_touchY; + GUI::SliderWidget *_sensitivity; + GUI::SliderWidget *_gammaCorrection; + GUI::CheckboxWidget *_leftHandedCheckbox; + GUI::CheckboxWidget *_unscaledCheckbox; + GUI::CheckboxWidget *_100PercentCheckbox; + GUI::CheckboxWidget *_150PercentCheckbox; + GUI::CheckboxWidget *_200PercentCheckbox; + GUI::CheckboxWidget *_indyFightCheckbox; + GUI::CheckboxWidget *_highQualityAudioCheckbox; + GUI::CheckboxWidget *_disablePowerOff; + GUI::CheckboxWidget *_showCursorCheckbox; + GUI::CheckboxWidget *_snapToBorderCheckbox; + + GUI::CheckboxWidget *_hardScaler; + GUI::CheckboxWidget *_cpuScaler; + + GUI::CheckboxWidget *_touchPadStyle; + GUI::CheckboxWidget *_screenTaps; bool _radioButtonMode; diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index 820e569555..d07e6c87fa 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -29,7 +29,7 @@ // GBAMP Save File ///////////////////////// -GBAMPSaveFile::GBAMPSaveFile(char* name, bool saveOrLoad) { +GBAMPSaveFile::GBAMPSaveFile(char *name, bool saveOrLoad) { handle = DS::std_fopen(name, saveOrLoad? "w": "r"); // consolePrintf("%s handle is %d\n", name, handle); // consolePrintf("Created %s\n", name); @@ -196,7 +196,7 @@ Common::StringArray GBAMPSaveFileManager::listSavefiles(const Common::String &pa // consolePrintf("Real cwd:%d\n", realName); - char* p = realName; + char *p = realName; while (*p) { if (*p == '\\') *p = '/'; p++; diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index bc4fdaa1a4..19a9a41938 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -29,14 +29,14 @@ #define SAVE_BUFFER_SIZE 100000 class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile { - DS::fileHandle* handle; + DS::fileHandle *handle; char buffer[SAVE_BUFFER_SIZE]; int bufferPos; int saveSize; int flushed; public: - GBAMPSaveFile(char* name, bool saveOrLoad); + GBAMPSaveFile(char *name, bool saveOrLoad); virtual ~GBAMPSaveFile(); virtual uint32 read(void *buf, uint32 size); @@ -62,12 +62,12 @@ public: GBAMPSaveFileManager(); ~GBAMPSaveFileManager(); -// static GBAMPSaveFileManager* instance() { return instancePtr; } +// static GBAMPSaveFileManager *instance() { return instancePtr; } GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad); - virtual Common::OutSaveFile* openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); } - virtual Common::InSaveFile* openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); } + virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); } + virtual Common::InSaveFile *openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); } virtual bool removeSavefile(const Common::String &filename) { return false; } // TODO: Implement this virtual Common::StringArray listSavefiles(const Common::String &pattern); diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 5e21a7d78f..418ab9d006 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -73,7 +73,7 @@ #define DEFAULT_CONFIG_FILE "scummvm.ini" #endif -OSystem_DS* OSystem_DS::_instance = NULL; +OSystem_DS *OSystem_DS::_instance = NULL; OSystem_DS::OSystem_DS() : eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false), @@ -133,7 +133,7 @@ bool OSystem_DS::getFeatureState(Feature f) { return false; } -const OSystem::GraphicsMode* OSystem_DS::getSupportedGraphicsModes() const { +const OSystem::GraphicsMode *OSystem_DS::getSupportedGraphicsModes() const { return s_supportedGraphicsModes; } @@ -243,13 +243,13 @@ void OSystem_DS::setCursorPalette(const byte *colors, uint start, uint num) { refreshCursor(); } -bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { +bool OSystem_DS::grabRawScreen(Graphics::Surface *surf) { surf->create(DS::getGameWidth(), DS::getGameHeight(), 1); // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing - const u16* image = (const u16 *) DS::get8BitBackBuffer(); + const u16 *image = (const u16 *) DS::get8BitBackBuffer(); for (int y = 0; y < DS::getGameHeight(); y++) { DC_FlushRange(image + (y << 8), DS::getGameWidth()); for (int x = 0; x < DS::getGameWidth() >> 1; x++) { @@ -282,9 +282,9 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int // consolePrintf("CopyRectToScreen %d\n", w * h); - u16* bg; + u16 *bg; s32 stride; - u16* bgSub = (u16 *)BG_GFX_SUB; + u16 *bgSub = (u16 *)BG_GFX_SUB; // The DS video RAM doesn't support 8-bit writes because Nintendo wanted // to save a few pennies/euro cents on the hardware. @@ -309,8 +309,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int // the keyboard image uses the same VRAM addresses. for (int dy = y; dy < y + h; dy++) { - u8* dest = ((u8 *) (bg)) + (dy * stride) + x; - const u8* src = (const u8 *) buf + (pitch * by); + u8 *dest = ((u8 *) (bg)) + (dy * stride) + x; + const u8 *src = (const u8 *) buf + (pitch * by); u32 dx; @@ -331,7 +331,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } // We can now assume dest is aligned - u16* dest16 = (u16 *) dest; + u16 *dest16 = (u16 *) dest; for (dx = 0; dx < pixelsLeft; dx+=2) { u16 mix; @@ -360,9 +360,9 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int // When they keyboard is not on screen, update both vram copies for (int dy = y; dy < y + h; dy++) { - u8* dest = ((u8 *) (bg)) + (dy * stride) + x; - u8* destSub = ((u8 *) (bgSub)) + (dy * 512) + x; - const u8* src = (const u8 *) buf + (pitch * by); + u8 *dest = ((u8 *) (bg)) + (dy * stride) + x; + u8 *destSub = ((u8 *) (bgSub)) + (dy * 512) + x; + const u8 *src = (const u8 *) buf + (pitch * by); u32 dx; @@ -385,8 +385,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } // We can now assume dest is aligned - u16* dest16 = (u16 *) dest; - u16* destSub16 = (u16 *) destSub; + u16 *dest16 = (u16 *) dest; + u16 *destSub16 = (u16 *) destSub; for (dx = 0; dx < pixelsLeft; dx+=2) { u16 mix; @@ -422,12 +422,12 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int // Stuff is aligned to 16-bit boundaries, so it's safe to do DMA. - u16* src = (u16 *) buf; + u16 *src = (u16 *) buf; if (DS::getKeyboardEnable()) { for (int dy = y; dy < y + h; dy++) { - u16* dest = bg + (dy * (stride >> 1)) + (x >> 1); + u16 *dest = bg + (dy * (stride >> 1)) + (x >> 1); DC_FlushRange(src, w << 1); DC_FlushRange(dest, w << 1); @@ -440,8 +440,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } else { for (int dy = y; dy < y + h; dy++) { - u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1); - u16* dest2 = bgSub + (dy << 8) + (x >> 1); + u16 *dest1 = bg + (dy * (stride >> 1)) + (x >> 1); + u16 *dest2 = bgSub + (dy << 8) + (x >> 1); DC_FlushRange(src, w << 1); DC_FlushRange(dest1, w << 1); @@ -503,13 +503,13 @@ void OSystem_DS::clearOverlay() { // consolePrintf("clearovl\n"); } -void OSystem_DS::grabOverlay(OverlayColor* buf, int pitch) { +void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) { // consolePrintf("grabovl\n") - u16* start = DS::get16BitBackBuffer(); + u16 *start = DS::get16BitBackBuffer(); for (int y = 0; y < 200; y++) { - u16* src = start + (y * 320); - u16* dest = ((u16 *) (buf)) + (y * pitch); + u16 *src = start + (y * 320); + u16 *dest = ((u16 *) (buf)) + (y * pitch); for (int x = 0; x < 320; x++) { *dest++ = *src++; @@ -519,8 +519,8 @@ void OSystem_DS::grabOverlay(OverlayColor* buf, int pitch) { } void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - u16* bg = (u16 *) DS::get16BitBackBuffer(); - const u16* src = (const u16 *) buf; + u16 *bg = (u16 *) DS::get16BitBackBuffer(); + const u16 *src = (const u16 *) buf; // if (x + w > 256) w = 256 - x; //if (x + h > 256) h = 256 - y; @@ -729,7 +729,7 @@ void OSystem_DS::quit() { swiSoftReset();*/ } -Common::SaveFileManager* OSystem_DS::getSavefileManager() { +Common::SaveFileManager *OSystem_DS::getSavefileManager() { bool forceSram; if (ConfMan.hasKey("forcesramsave", "ds")) { @@ -753,7 +753,7 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() { } -Graphics::Surface* OSystem_DS::createTempFrameBuffer() { +Graphics::Surface *OSystem_DS::createTempFrameBuffer() { // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing @@ -778,13 +778,13 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() { s32 width = DS::getGameWidth(); s32 stride = DS::get8BitBackBufferStride(); - u16* src = DS::get8BitBackBuffer(); - u16* dest = DS::getScalerBuffer(); + u16 *src = DS::get8BitBackBuffer(); + u16 *dest = DS::getScalerBuffer(); for (int y = 0; y < height; y++) { - u16* destLine = dest + (y * (width / 2)); - u16* srcLine = src + (y * (stride / 2)); + u16 *destLine = dest + (y * (width / 2)); + u16 *srcLine = src + (y * (stride / 2)); DC_FlushRange(srcLine, width); @@ -805,7 +805,7 @@ Graphics::Surface* OSystem_DS::createTempFrameBuffer() { size_t imageStrideInBytes = DS::get8BitBackBufferStride(); size_t imageStrideInWords = imageStrideInBytes / 2; - u16* image = (u16 *) DS::get8BitBackBuffer(); + u16 *image = (u16 *) DS::get8BitBackBuffer(); for (int y = 0; y < DS::getGameHeight(); y++) { DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth()); for (int x = 0; x < DS::getGameWidth() >> 1; x++) { @@ -851,13 +851,13 @@ void OSystem_DS::setCharactersEntered(int count) { DS::setCharactersEntered(count); } -Common::SeekableReadStream* OSystem_DS::createConfigReadStream() { +Common::SeekableReadStream *OSystem_DS::createConfigReadStream() { Common::FSNode file(DEFAULT_CONFIG_FILE); // consolePrintf("R %s", DEFAULT_CONFIG_FILE); return file.createReadStream(); } -Common::WriteStream* OSystem_DS::createConfigWriteStream() { +Common::WriteStream *OSystem_DS::createConfigWriteStream() { Common::FSNode file(DEFAULT_CONFIG_FILE); // consolePrintf("W %s", DEFAULT_CONFIG_FILE); return file.createWriteStream(); diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index dc8b65a1c8..42419b762e 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -48,13 +48,13 @@ protected: DSSaveFileManager saveManager; #endif GBAMPSaveFileManager mpSaveManager; - Audio::MixerImpl* _mixer; - DefaultTimerManager* _timer; + Audio::MixerImpl *_mixer; + DefaultTimerManager *_timer; Graphics::Surface _framebuffer; bool _frameBufferExists; bool _graphicsEnable; - static OSystem_DS* _instance; + static OSystem_DS *_instance; u16 _palette[256]; u16 _cursorPalette[256]; @@ -68,7 +68,7 @@ protected: int _cursorScale; - Graphics::Surface* createTempFrameBuffer(); + Graphics::Surface *createTempFrameBuffer(); bool _disableCursorPalette; int _gammaValue; @@ -94,7 +94,7 @@ public: virtual int16 getHeight(); virtual int16 getWidth(); virtual void setPalette(const byte *colors, uint start, uint num); - virtual void grabPalette(unsigned char* colors, uint start, uint num); + virtual void grabPalette(unsigned char *colors, uint start, uint num); void restoreHardwarePalette(); virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); @@ -139,7 +139,7 @@ public: void addEvent(const Common::Event& e); bool isEventQueueEmpty() const { return queuePos == 0; } - virtual bool grabRawScreen(Graphics::Surface* surf); + virtual bool grabRawScreen(Graphics::Surface *surf); virtual void setFocusRectangle(const Common::Rect& rect); @@ -150,10 +150,10 @@ public: virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); - virtual Audio::Mixer* getMixer() { return _mixer; } - Audio::MixerImpl* getMixerImpl() { return _mixer; } + virtual Audio::Mixer *getMixer() { return _mixer; } + Audio::MixerImpl *getMixerImpl() { return _mixer; } - virtual Common::TimerManager* getTimerManager() { return _timer; } + virtual Common::TimerManager *getTimerManager() { return _timer; } static int timerHandler(int t); @@ -172,8 +172,8 @@ public: void refreshCursor(); - Common::WriteStream* createConfigWriteStream(); - Common::SeekableReadStream* createConfigReadStream(); + Common::WriteStream *createConfigWriteStream(); + Common::SeekableReadStream *createConfigReadStream(); u16 applyGamma(u16 colour); void setGammaValue(int gamma) { _gammaValue = gamma; } diff --git a/backends/platform/ds/arm9/source/portdefs.cpp b/backends/platform/ds/arm9/source/portdefs.cpp index 0dcdc1d5a3..b75683df3d 100644 --- a/backends/platform/ds/arm9/source/portdefs.cpp +++ b/backends/platform/ds/arm9/source/portdefs.cpp @@ -25,7 +25,7 @@ #include "osystem_ds.h" /* -extern "C" time_t __wrap_time(time_t* t) { +extern "C" time_t __wrap_time(time_t *t) { if (t) { *t = OSystem_DS::instance()->getMillis() / 1000; } diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp index a0f4633988..d8e74d7445 100644 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ b/backends/platform/ds/arm9/source/ramsave.cpp @@ -38,7 +38,7 @@ DSSaveFile::DSSaveFile() { isTempFile = false; } -DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) { +DSSaveFile::DSSaveFile(SCUMMSave *s, bool compressed, u8 *data) { save = *s; saveData = data; ptr = 0; @@ -46,7 +46,7 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) { isOpenFlag = true; if (saveCompressed) { - u8* uncompressed = new unsigned char[save.size]; + u8 *uncompressed = new unsigned char[save.size]; if (!uncompressed) consolePrintf("Out of memory allocating %d!\n", save.size); LZ_Uncompress(saveData, uncompressed, save.compressedSize); saveData = uncompressed; @@ -79,7 +79,7 @@ DSSaveFile::~DSSaveFile() { } } -bool DSSaveFile::loadFromSaveRAM(vu8* address) { +bool DSSaveFile::loadFromSaveRAM(vu8 *address) { SCUMMSave newSave; @@ -113,7 +113,7 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) { void DSSaveFile::compress() { if (!saveCompressed) { - unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100]; + unsigned char *compBuffer = new unsigned char[(save.size * 110) / 100]; int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size); save.compressedSize = compSize; @@ -127,9 +127,9 @@ void DSSaveFile::compress() { } } -int DSSaveFile::saveToSaveRAM(vu8* address) { +int DSSaveFile::saveToSaveRAM(vu8 *address) { - unsigned char* compBuffer; + unsigned char *compBuffer; bool failed; @@ -356,7 +356,7 @@ void DSSaveFileManager::listFiles() { consolePrintf("SRAM free: %d bytes\n", getBytesFree()); } -DSSaveFileManager* DSSaveFileManager::instancePtr = NULL; +DSSaveFileManager *DSSaveFileManager::instancePtr = NULL; DSSaveFile *DSSaveFileManager::openSavefile(const char *filename, bool saveOrLoad) { for (int r = 0; r < 8; r++) { @@ -379,12 +379,12 @@ DSSaveFile *DSSaveFileManager::openSavefile(const char *filename, bool saveOrLoa -DSSaveFile* DSSaveFile::clone() { +DSSaveFile *DSSaveFile::clone() { // consolePrintf("Clone %s %d\n", save.name, save.size); return new DSSaveFile(&save, saveCompressed, saveData); } -void DSSaveFileManager::deleteFile(const char* name) { +void DSSaveFileManager::deleteFile(const char *name) { // consolePrintf("Deleting %s", name); for (int r = 0; r < 8; r++) { if (gbaSave[r].isValid() && (gbaSave[r].matches(name))) { @@ -506,7 +506,7 @@ void DSSaveFileManager::setExtraData(int data) { // Offset of extra data is 31. This overlaps the padding and reserved bytes of the first save entry. // which have not been used up until now. So it should be safe. - vu8* sram = CART_RAM + 31; + vu8 *sram = CART_RAM + 31; *(sram + 0) = 0xF0; // This is an identifier to check *(sram + 1) = 0x0D; // that extra data is present. @@ -518,14 +518,14 @@ void DSSaveFileManager::setExtraData(int data) { } bool DSSaveFileManager::isExtraDataPresent() { - vu8* sram = CART_RAM + 31; + vu8 *sram = CART_RAM + 31; // Check for the identifier return ((*(sram + 0) == 0xF0) && (*(sram + 1) == 0x0D)); } int DSSaveFileManager::getExtraData() { - vu8* sram = CART_RAM + 31; + vu8 *sram = CART_RAM + 31; if (isExtraDataPresent()) { int value = (*(sram + 2) << 24) | (*(sram + 3) << 16) | (*(sram + 4) << 8) | (*(sram + 5)); diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index e74df94952..7b17acb52a 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -48,15 +48,15 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile { } __attribute__ ((packed)); SCUMMSave save; - u8* saveData; - SCUMMSave* origHeader; + u8 *saveData; + SCUMMSave *origHeader; bool isOpenFlag; bool isTempFile; bool eosReached; public: DSSaveFile(); - DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data); + DSSaveFile(SCUMMSave *s, bool saveCompressed, u8 *data); ~DSSaveFile(); void reset(); @@ -74,7 +74,7 @@ public: uint32 write(const void *buf, uint32 size); void setName(char *name); - char* getName() { return save.name; } + char *getName() { return save.name; } bool isValid() { return save.isValid; } bool isTemp() { return isTempFile; } @@ -85,14 +85,14 @@ public: void compress(); int getRamUsage() { return sizeof(save) + save.compressedSize; } - char* getRamImage() { return (char *) &save; } + char *getRamImage() { return (char *) &save; } int getSize() { return save.size; } - DSSaveFile* clone(); + DSSaveFile *clone(); - bool loadFromSaveRAM(vu8* address); - int saveToSaveRAM(vu8* address); + bool loadFromSaveRAM(vu8 *address); + int saveToSaveRAM(vu8 *address); @@ -111,19 +111,19 @@ public: class DSSaveFileManager : public Common::SaveFileManager { DSSaveFile gbaSave[8]; - static DSSaveFileManager* instancePtr; + static DSSaveFileManager *instancePtr; int sramBytesFree; public: DSSaveFileManager(); ~DSSaveFileManager(); - static DSSaveFileManager* instance() { return instancePtr; } + static DSSaveFileManager *instance() { return instancePtr; } DSSaveFile *openSavefile(const char *filename, bool saveOrLoad); - virtual Common::OutSaveFile* openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); } - virtual Common::InSaveFile* openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); } + virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); } + virtual Common::InSaveFile *openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); } virtual bool removeSavefile(const Common::String &filename); virtual Common::StringArray listSavefiles(const Common::String &pattern); @@ -133,7 +133,7 @@ public: void addBytesFree(int size) { sramBytesFree += size; } int getBytesFree() { return sramBytesFree; } - void deleteFile(char* name); + void deleteFile(char *name); void listFiles(); void formatSram(); diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index ef931899be..32d7f1aee0 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -142,7 +142,7 @@ int keyboardY; static int s_mapBase; static int s_tileBase; -u16* baseAddress; +u16 *baseAddress; bool shiftState; bool capsLockState; @@ -181,7 +181,7 @@ void drawText(int tx, int ty, const char *string, bool highlight) { -void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) { +void restoreVRAM(int tileBase, int mapBase, u16 *saveSpace) { /* for (int r = 0; r < 32 * 32; r++) { ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++; } @@ -191,7 +191,7 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) { }*/ } -void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { +void drawKeyboard(int tileBase, int mapBase, u16 *saveSpace) { /* int keyboardDataSize = 4736 * 2; */ for (int r = 0; r < 32 * 32; r++) { @@ -211,8 +211,8 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { // this is the font for (int tile = 0; tile < 94; tile++) { - u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32))); - const u8* src = ((const u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8; + u16 *tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32))); + const u8 *src = ((const u8 *) (::_8x8font_tga_raw)) + 18 + tile * 8; for (int y = 0 ; y < 8; y++) { for (int x = 0; x < 2; x++) { @@ -256,7 +256,7 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) { int x = keyboardX; int y = keyboardY; - u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase)); + u16 *base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase)); baseAddress = base; for (int r = 0; r < DS_NUM_KEYS; r++) { @@ -314,7 +314,7 @@ bool getKeyboardClosed() { } void setKeyHighlight(int key, bool highlight) { - u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(DS::s_mapBase)); + u16 *base = ((u16 *) SCREEN_BASE_BLOCK_SUB(DS::s_mapBase)); if (highlight) { base[(keyboardY + keys[key].y) * 32 + keyboardX + keys[key].x] |= 0x1000; @@ -329,7 +329,7 @@ void setKeyHighlight(int key, bool highlight) { } } -void addAutoComplete(const char* word) { +void addAutoComplete(const char *word) { if (autoCompleteCount == NUM_WORDS) return; strcpy(&autoCompleteWord[autoCompleteCount++][0], word); drawAutoComplete(); @@ -353,7 +353,7 @@ void clearAutoComplete() { void typeCompletion(int current) { Common::Event event; - /* OSystem_DS* system = OSystem_DS::instance(); */ + /* OSystem_DS *system = OSystem_DS::instance(); */ strcat(autoCompleteBuffer, &autoCompleteWord[current][charactersEntered]); strcat(autoCompleteBuffer, " "); @@ -384,7 +384,7 @@ void typeCompletion(int current) { void updateTypeEvents() { if (autoCompleteBuffer[0] != '\0') { Common::Event event; - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0]; event.kbd.ascii = autoCompleteBuffer[0]; @@ -443,7 +443,7 @@ void releaseAllKeys() { if (keys[r].pressed) { DS::setKeyHighlight(r, false); - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); Common::Event event; createKeyEvent(r, event); @@ -502,7 +502,7 @@ void addKeyboardEvents() { for (int r = 0; r < DS_NUM_KEYS; r++) { if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) && (ty >= keys[r].y) && (ty <= keys[r].y + 1)) { - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); Common::Event event; // consolePrintf("Key: %d\n", r); @@ -551,7 +551,7 @@ void addKeyboardEvents() { if (keys[r].pressed) { DS::setKeyHighlight(r, false); - OSystem_DS* system = OSystem_DS::instance(); + OSystem_DS *system = OSystem_DS::instance(); Common::Event event; if ((keys[r].character == Common::KEYCODE_INVALID)) { diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h index 33dab253a9..0b4495ec39 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.h +++ b/backends/platform/ds/arm9/source/touchkeyboard.h @@ -35,13 +35,13 @@ enum { void createKeyEvent(int keyNum, Common::Event& event); -void drawKeyboard(int tileBase, int mapBase, u16* saveSpace); -void restoreVRAM(int tileBase, int mapBase, u16* saveSpace); +void drawKeyboard(int tileBase, int mapBase, u16 *saveSpace); +void restoreVRAM(int tileBase, int mapBase, u16 *saveSpace); void addKeyboardEvents(); bool getKeyboardClosed(); bool isInsideKeyboard(int x, int y); -void addAutoComplete(const char* word); +void addAutoComplete(const char *word); void clearAutoComplete(); void setCharactersEntered(int count); void releaseAllKeys(); diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index 035f6a631d..bc734f3f85 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -14,7 +14,7 @@ namespace DS { char wordBuffer[WORD_BUFFER_SIZE]; int wordBufferPos = 0; -char* wordBufferPtr[MAX_WORD_COUNT]; +char *wordBufferPtr[MAX_WORD_COUNT]; int wordBufferPtrPos = 0; void addAutoCompleteLine(const char *line) { @@ -53,7 +53,7 @@ void addAutoCompleteLine(const char *line) { } } -int stringCompare(const void* a, const void* b) { +int stringCompare(const void *a, const void *b) { const char** as = (const char **) a; const char** bs = (const char **) b; @@ -71,7 +71,7 @@ void sortAutoCompleteWordList() { } // Sends the current available words to the virtual keyboard code for display -bool findWordCompletions(const char* input) { +bool findWordCompletions(const char *input) { int min = 0; int max = wordBufferPtrPos - 1; char *word; @@ -82,7 +82,7 @@ bool findWordCompletions(const char* input) { if (wordBufferPtrPos == 0) return false; - OSystem_DS* system = (OSystem_DS *) g_system; + OSystem_DS *system = (OSystem_DS *) g_system; system->clearAutoComplete(); int start = 0; diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index fd6da4e9b9..dd9ac35990 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -28,7 +28,7 @@ ZipFile::ZipFile() { // consolePrintf("ZIP file check..."); - char* p = (char *) ZF_SEARCH_START; + char *p = (char *) ZF_SEARCH_START; bool found = false; _zipFile = NULL; @@ -112,7 +112,7 @@ bool ZipFile::currentFileInFolder() { return false; } -void ZipFile::getFileName(char* name) { +void ZipFile::getFileName(char *name) { strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength); for (int r = 0; name[r] != 0; r++) { @@ -207,7 +207,7 @@ void ZipFile::changeToRoot() { _directory[0] = 0; } -void ZipFile::changeDirectory(const char* dir) { +void ZipFile::changeDirectory(const char *dir) { // consolePrintf("Current dir now '%s'\n", dir); assert(dir && *dir); diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h index d1f70942ce..5438c3b95d 100644 --- a/backends/platform/ds/arm9/source/zipreader.h +++ b/backends/platform/ds/arm9/source/zipreader.h @@ -43,12 +43,12 @@ class ZipFile { u16 extraLength; // Length of any extra data } __attribute__ ((packed)); - char* _zipFile; + char *_zipFile; char _directory[128]; bool _allFilesVisible; - FileHeader* _currentFile; + FileHeader *_currentFile; public: ZipFile(); @@ -61,13 +61,13 @@ public: bool findFile(const char *search); // These return the file's data and information - char* getFile(); + char *getFile(); int getFileSize(); - void getFileName(char* name); + void getFileName(char *name); bool isDirectory(); // These set the current directory - void changeDirectory(const char* name); + void changeDirectory(const char *name); void changeToRoot(); void setAllFilesVisible(bool state) { _allFilesVisible = state; } diff --git a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h index f41548f400..c762d1acd1 100644 --- a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h +++ b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h @@ -58,9 +58,9 @@ typedef struct sTransferSound { typedef struct _adpcmBuffer { - u8* buffer[8]; + u8 *buffer[8]; bool filled[8]; - u8* arm7Buffer[8]; + u8 *arm7Buffer[8]; bool arm7Dirty[8]; bool semaphore; } adpcmBuffer; -- cgit v1.2.3 From 3d44870c8a64999e5464fc3b09c08f9378c4a2d3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:11:11 +0000 Subject: NDS: Update GPL/copyright headers; add namespace DS closing comments svn-id: r50689 --- backends/fs/ds/ds-fs.cpp | 9 ++++--- backends/fs/ds/ds-fs.h | 11 +++++---- backends/platform/ds/arm7/source/main.cpp | 10 ++++---- backends/platform/ds/arm9/source/blitters.cpp | 11 +++++---- backends/platform/ds/arm9/source/blitters.h | 11 +++++---- backends/platform/ds/arm9/source/cdaudio.cpp | 11 +++++---- backends/platform/ds/arm9/source/cdaudio.h | 11 +++++---- backends/platform/ds/arm9/source/dsmain.cpp | 12 ++++++---- backends/platform/ds/arm9/source/dsmain.h | 12 ++++++---- backends/platform/ds/arm9/source/dsoptions.cpp | 12 ++++++---- backends/platform/ds/arm9/source/dsoptions.h | 11 +++++---- backends/platform/ds/arm9/source/gbampsave.cpp | 9 ++++--- backends/platform/ds/arm9/source/gbampsave.h | 9 ++++--- backends/platform/ds/arm9/source/keys.cpp | 3 ++- backends/platform/ds/arm9/source/keys.h | 25 ++++++++++++++++++- backends/platform/ds/arm9/source/osystem_ds.h | 9 ++++--- backends/platform/ds/arm9/source/portdefs.cpp | 9 ++++--- backends/platform/ds/arm9/source/portdefs.h | 9 ++++--- backends/platform/ds/arm9/source/ramsave.h | 9 ++++--- backends/platform/ds/arm9/source/scummhelp.cpp | 12 ++++++---- backends/platform/ds/arm9/source/scummhelp.h | 12 ++++++---- backends/platform/ds/arm9/source/touchkeyboard.cpp | 3 +-- backends/platform/ds/arm9/source/touchkeyboard.h | 11 +++++---- .../platform/ds/arm9/source/wordcompletion.cpp | 28 +++++++++++++++++++++- backends/platform/ds/arm9/source/wordcompletion.h | 27 ++++++++++++++++++++- backends/platform/ds/arm9/source/zipreader.cpp | 9 ++++--- backends/platform/ds/arm9/source/zipreader.h | 9 ++++--- 27 files changed, 229 insertions(+), 85 deletions(-) (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 8dc3902216..600eae1972 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index b4c8f7ac12..b1df3a98eb 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -224,6 +227,6 @@ void std_clearerr(FILE *handle); int std_fflush(FILE *handle); int std_ferror(FILE *handle); -} //namespace DS +} // End of namespace DS #endif //_DS_FS_H diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index b45b601bda..bcaaf8e936 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -8,17 +8,19 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * - * $Header: /cvsroot/scummvm/scummvm/backends/fs/fs.cpp,v 1.3.2.1 2004/12/18 02:33:52 fingolfin Exp $ */ ////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index fa746fa51e..559845cb18 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -409,4 +412,4 @@ void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStr } } -} +} // End of namespace DS diff --git a/backends/platform/ds/arm9/source/blitters.h b/backends/platform/ds/arm9/source/blitters.h index 60dc2af133..88506a4405 100644 --- a/backends/platform/ds/arm9/source/blitters.h +++ b/backends/platform/ds/arm9/source/blitters.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -35,7 +38,7 @@ void asmCopy8Col(byte *dst, int dstPitch, const byte *src, int height); void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette); void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride); -} +} // End of namespace DS #else diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 23a276c4cb..28d9819991 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -548,4 +551,4 @@ bool isPlaying() { } } -} +} // End of namespace DS diff --git a/backends/platform/ds/arm9/source/cdaudio.h b/backends/platform/ds/arm9/source/cdaudio.h index aac303dd5e..6e53ef7bd2 100644 --- a/backends/platform/ds/arm9/source/cdaudio.h +++ b/backends/platform/ds/arm9/source/cdaudio.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -35,6 +38,6 @@ bool isPlaying(); void update(); } -} +} // End of namespace DS #endif diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 2f0d5e34ee..698960bb9f 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -3327,7 +3330,8 @@ int main(void) { return 0; } -} +} // End of namespace DS + int main() { DS::main(); diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index 7cf8313391..89b8c708b7 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -154,7 +157,8 @@ void* fastRamAlloc(int size); void exitGame(); -} +} // End of namespace DS + int cygprofile_getHBlanks(); diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index d8b2365c4f..32b37abfbc 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -438,4 +441,5 @@ void setOptions() { firstLoad = false; } -} +} // End of namespace DS + diff --git a/backends/platform/ds/arm9/source/dsoptions.h b/backends/platform/ds/arm9/source/dsoptions.h index 48eb2c3303..1bdc7c1f27 100644 --- a/backends/platform/ds/arm9/source/dsoptions.h +++ b/backends/platform/ds/arm9/source/dsoptions.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -78,6 +81,6 @@ protected: extern void showOptionsDialog(); extern void setOptions(); -} +} // End of namespace DS #endif diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index d07e6c87fa..dbcc310fa3 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index 19a9a41938..fd16b72e4c 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/keys.cpp b/backends/platform/ds/arm9/source/keys.cpp index 63fae866e5..8c97b02716 100644 --- a/backends/platform/ds/arm9/source/keys.cpp +++ b/backends/platform/ds/arm9/source/keys.cpp @@ -148,4 +148,5 @@ uint32 keysUp(void) { } -} // namespace ds +} // End of namespace DS + diff --git a/backends/platform/ds/arm9/source/keys.h b/backends/platform/ds/arm9/source/keys.h index e0f28a12cf..0068dfeeb6 100644 --- a/backends/platform/ds/arm9/source/keys.h +++ b/backends/platform/ds/arm9/source/keys.h @@ -1,4 +1,27 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ namespace DS { @@ -10,4 +33,4 @@ uint32 keysDownRepeat(void); void keysSetRepeat( u8 setDelay, u8 setRepeat ); uint32 keysUp(void); -} +} // End of namespace DS diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 42419b762e..a899c966fc 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/portdefs.cpp b/backends/platform/ds/arm9/source/portdefs.cpp index b75683df3d..fd7056a260 100644 --- a/backends/platform/ds/arm9/source/portdefs.cpp +++ b/backends/platform/ds/arm9/source/portdefs.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 2590758c86..3b3925abba 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index 7b17acb52a..066f7c332c 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/scummhelp.cpp b/backends/platform/ds/arm9/source/scummhelp.cpp index e1ddaecc2c..f1e8ba4fb2 100644 --- a/backends/platform/ds/arm9/source/scummhelp.cpp +++ b/backends/platform/ds/arm9/source/scummhelp.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -91,7 +94,8 @@ void updateStrings(byte gameId, byte version, Common::Platform platform, } -} +} // End of namespace DS + #undef ADD_BIND diff --git a/backends/platform/ds/arm9/source/scummhelp.h b/backends/platform/ds/arm9/source/scummhelp.h index 602cb5f788..4be28dca6a 100644 --- a/backends/platform/ds/arm9/source/scummhelp.h +++ b/backends/platform/ds/arm9/source/scummhelp.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -31,6 +34,7 @@ namespace DS { void updateStrings(byte gameId, byte version, Common::Platform platform, int page, Common::String &title, Common::String *&key, Common::String *&dsc); -} +} // End of namespace DS + #endif diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 32d7f1aee0..ce3e2416af 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -586,5 +586,4 @@ void addKeyboardEvents() { } -} - +} // End of namespace DS diff --git a/backends/platform/ds/arm9/source/touchkeyboard.h b/backends/platform/ds/arm9/source/touchkeyboard.h index 0b4495ec39..7644e48bff 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.h +++ b/backends/platform/ds/arm9/source/touchkeyboard.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ @@ -46,6 +49,6 @@ void clearAutoComplete(); void setCharactersEntered(int count); void releaseAllKeys(); -} +} // End of namespace DS #endif diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp index bc734f3f85..43a16486c5 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.cpp +++ b/backends/platform/ds/arm9/source/wordcompletion.cpp @@ -1,3 +1,28 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + #include "wordcompletion.h" #include "osystem_ds.h" #include "engines/agi/agi.h" // Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h @@ -176,5 +201,6 @@ bool findWordCompletions(const char *input) { } -} +} // End of namespace DS + #endif diff --git a/backends/platform/ds/arm9/source/wordcompletion.h b/backends/platform/ds/arm9/source/wordcompletion.h index e50bade37b..55a0bc8b5a 100644 --- a/backends/platform/ds/arm9/source/wordcompletion.h +++ b/backends/platform/ds/arm9/source/wordcompletion.h @@ -1,3 +1,28 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + namespace DS { extern void clearAutoCompleteWordList(); @@ -5,4 +30,4 @@ extern bool findWordCompletions(const char *input); extern void addAutoCompleteLine(const char *line); extern void sortAutoCompleteWordList(); -} +} // End of namespace DS diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index dd9ac35990..24458781af 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h index 5438c3b95d..bfba920401 100644 --- a/backends/platform/ds/arm9/source/zipreader.h +++ b/backends/platform/ds/arm9/source/zipreader.h @@ -8,15 +8,18 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ * */ -- cgit v1.2.3 From 782e43591a6eb5995036bebf2dcc2c871e4aed95 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:11:34 +0000 Subject: DS: Cleanup NDS portdefs.h a bit * Don't #include "nds/ndstypes.h" everywhere * Don't #define ITCM_DATA globally, it is only need in one place * Fix STREAM_AUDIO_FROM_DISK definition (copy&paste error) * Fix custom assert() implementation by using the do/while(0) trick for macros. Previously, there could be subtle errors caused by statements like if (COND) assert(...) else ... svn-id: r50690 --- backends/platform/ds/arm9/source/dsmain.cpp | 2 ++ backends/platform/ds/arm9/source/portdefs.h | 35 ++++++-------------------- backends/platform/ds/arm9/source/ramsave.h | 2 ++ backends/platform/ds/arm9/source/zipreader.cpp | 1 + backends/platform/ds/arm9/source/zipreader.h | 4 ++- 5 files changed, 16 insertions(+), 28 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 698960bb9f..163ae9518d 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -2834,6 +2834,8 @@ bool getIndyFightState() { /////////////////// #define FAST_RAM_SIZE (24000) +#define ITCM_DATA __attribute__((section(".itcm"))) + u8 *fastRamPointer; u8 fastRamData[FAST_RAM_SIZE] ITCM_DATA; diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index 3b3925abba..bdb42993d1 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -26,24 +26,8 @@ #ifndef _PORTDEFS_H_ #define _PORTDEFS_H_ - - -/* -typedef unsigned char u8; -typedef signed char s8; - -typedef unsigned short u16; -typedef signed short s16; - -typedef unsigned int u32; -typedef signed int s32; -*/ - -#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. +// Somebody removed these from scummsys.h, but they're still required, so I'm +// adding them here in the hope that they'll stay. #include #include #include @@ -53,8 +37,6 @@ typedef signed int s32; #define double float -#define CT_NO_TRANSPARENCY - #ifndef DISABLE_TEXT_CONSOLE #define DISABLE_TEXT_CONSOLE #endif @@ -63,15 +45,12 @@ typedef signed int s32; #define DISABLE_COMMAND_LINE #endif -#ifndef DISABLE_COMMAND_LINE +#ifndef STREAM_AUDIO_FROM_DISK #define STREAM_AUDIO_FROM_DISK #endif -//#undef assert -//#define assert(expr) consolePrintf("Asserted!") #define NO_DEBUG_MSGS - // This is defined in dsmain.cpp #ifdef __cplusplus extern "C" { @@ -86,15 +65,17 @@ void consolePrintf(const char *format, ...); #undef assert #endif -#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__) +#define assert(s) \ + do { \ + if (!(s)) \ + consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__); \ + } while (0) //#include "ds-fs.h" //#define debug(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__) //#define debug(fmt, ...) debug(0, fmt, ##__VA_ARGS__) -#define ITCM_DATA __attribute__((section(".itcm"))) - // FIXME: Since I can't change the engine at the moment (post lockdown) this define can go here. // This define changes the mouse-relative motion which doesn't make sense on a touch screen to // a more conventional form of input where the menus can be clicked on. diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h index 066f7c332c..f2cfe0fc0b 100644 --- a/backends/platform/ds/arm9/source/ramsave.h +++ b/backends/platform/ds/arm9/source/ramsave.h @@ -26,9 +26,11 @@ #ifndef _RAMSAVE_H_ #define _RAMSAVE_H_ +#include #include "common/system.h" #include "common/savefile.h" + // SaveFileManager class #define DS_MAX_SAVE_SIZE 150000 diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index 24458781af..0906123436 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -24,6 +24,7 @@ */ +#include "common/scummsys.h" #include "zipreader.h" ZipFile::ZipFile() { diff --git a/backends/platform/ds/arm9/source/zipreader.h b/backends/platform/ds/arm9/source/zipreader.h index bfba920401..5429954088 100644 --- a/backends/platform/ds/arm9/source/zipreader.h +++ b/backends/platform/ds/arm9/source/zipreader.h @@ -25,7 +25,9 @@ #ifndef _ZIPREADER_H_ #define _ZIPREADER_H_ -#include "portdefs.h" + +#include + #define ZF_SEARCH_START 0x08000000 #define ZF_SEARCH_END 0x09000000 #define ZF_SEARCH_STRIDE 16 -- cgit v1.2.3 From d2a24c0a9535f1e51c25610de806beeb092b1ec5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:11:54 +0000 Subject: DS: Remove unused portdefs.cpp svn-id: r50691 --- backends/platform/ds/arm9/makefile | 5 +--- backends/platform/ds/arm9/source/portdefs.cpp | 38 --------------------------- backends/platform/ds/module.mk | 1 - 3 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 backends/platform/ds/arm9/source/portdefs.cpp (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 295b5f1bf0..d1b1cf55d6 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -247,9 +247,6 @@ endif DEFINES += -DREDUCE_MEMORY_USAGE -# Removed, as these are done in portdefs.h -# -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE - LDFLAGS = -specs=ds_arm9.specs -mthumb-interwork -mno-fpu -Wl,-Map,map.txt -Wl,--gc-sections ifdef WRAP_MALLOC @@ -294,7 +291,7 @@ endif PORT_OBJS := $(portdir)/source/blitters_arm.o $(portdir)/source/cdaudio.o $(portdir)/source/dsmain.o \ $(portdir)/../../../fs/ds/ds-fs.o $(portdir)/source/gbampsave.o $(portdir)/source/scummhelp.o\ - $(portdir)/source/osystem_ds.o $(portdir)/source/portdefs.o $(portdir)/source/ramsave.o\ + $(portdir)/source/osystem_ds.o $(portdir)/source/ramsave.o\ $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\ $(portdir)/source/dsoptions.o $(portdir)/source/keys.o $(portdir)/source/wordcompletion.o\ $(portdir)/source/interrupt.o diff --git a/backends/platform/ds/arm9/source/portdefs.cpp b/backends/platform/ds/arm9/source/portdefs.cpp deleted file mode 100644 index fd7056a260..0000000000 --- a/backends/platform/ds/arm9/source/portdefs.cpp +++ /dev/null @@ -1,38 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include "nds/dma.h" -#include "osystem_ds.h" - -/* -extern "C" time_t __wrap_time(time_t *t) { - if (t) { - *t = OSystem_DS::instance()->getMillis() / 1000; - } - - return OSystem_DS::instance()->getMillis() / 1000; -} -*/ diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index d70b5b1bab..02ae0759d4 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -12,7 +12,6 @@ PORT_OBJS := \ arm9/source/gbampsave.o \ arm9/source/scummhelp.o \ arm9/source/osystem_ds.o \ - arm9/source/portdefs.o \ arm9/source/ramsave.o \ arm9/source/touchkeyboard.o \ arm9/source/zipreader.o \ -- cgit v1.2.3 From edb5210d382d27c31cca0a48a427735044078ba4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:12:10 +0000 Subject: DS: Fix error in std_fopen (warnings are great :) svn-id: r50692 --- backends/fs/ds/ds-fs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 600eae1972..8b921e7cd9 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -582,7 +582,7 @@ FILE *std_fopen(const char *name, const char *mode) { if (currentDir[0] != 0) { char nameWithPath[128]; - sprintf(nameWithPath, "%s\%s", currentDir, realName); + sprintf(nameWithPath, "%s\\%s", currentDir, realName); strcpy(realName, nameWithPath); } -- cgit v1.2.3 From 75529dc4022ec52ffba971d532c397aa951c2d5c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:12:31 +0000 Subject: DS: Fix various warnings and errors in the DS FS code * Do not modify the strings passed to std_fopen anymore * Correct signature of std_fread * Do not cast away constness, nor perform unnecessary casts svn-id: r50693 --- backends/fs/ds/ds-fs.cpp | 48 +++++++++++++++------------- backends/fs/ds/ds-fs.h | 8 ++--- backends/platform/ds/arm9/source/cdaudio.cpp | 8 ++--- 3 files changed, 33 insertions(+), 31 deletions(-) (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 8b921e7cd9..fafdc8502e 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -181,10 +181,10 @@ AbstractFSNode *DSFileSystemNode::getParent() const { DSFileSystemNode *p; if (_path != "ds:/") { - char *path = (char *) _path.c_str(); + const char *path = (const char *)_path.c_str(); int lastSlash = 4; - for (int r = 4; r < (int) _path.size(); r++) { + for (uint r = 4; r < _path.size(); r++) { if (path[r] == '\\') { lastSlash = r; } @@ -262,7 +262,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path) { _path = path; } -GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDirectory) { +GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDir) { //consolePrintf("'%s'",path.c_str()); int lastSlash = 3; @@ -275,7 +275,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDire _displayName = Common::String(path.c_str() + lastSlash + 1); _path = path; _isValid = true; - _isDirectory = isDirectory; + _isDirectory = isDir; } @@ -356,10 +356,10 @@ AbstractFSNode *GBAMPFileSystemNode::getParent() const { GBAMPFileSystemNode *p; if (_path != "mp:/") { - char *path = (char *) _path.c_str(); + const char *path = (const char *)_path.c_str(); int lastSlash = 4; - for (int r = 4; r < (int) strlen((char *) path); r++) { + for (uint r = 4; r < strlen(path); r++) { if (path[r] == '/') { lastSlash = r; } @@ -447,7 +447,7 @@ uint32 DSFileStream::read(void *ptr, uint32 len) { if (_writeBufferPos > 0) { flush(); } - return std_fread((byte *)ptr, 1, len, (FILE *)_handle); + return std_fread(ptr, 1, len, (FILE *)_handle); } uint32 DSFileStream::write(const void *ptr, uint32 len) { @@ -501,15 +501,15 @@ FILE *std_fopen(const char *name, const char *mode) { currentDir[0] = '\0'; } - char *realName = (char *) name; + char realName[MAXPATHLEN]; // Remove file system prefix if ((name[0] == 'd') && (name[1] == 's') && (name[2] == ':') && (name[3] == '/')) { - realName += 4; - } - - if ((name[0] == 'm') && (name[1] == 'p') && (name[2] == ':') && (name[3] == '/')) { - realName += 4; + strlcpy(realName, name + 4, MAXPATHLEN); + } else if ((name[0] == 'm') && (name[1] == 'p') && (name[2] == ':') && (name[3] == '/')) { + strlcpy(realName, name + 4, MAXPATHLEN); + } else { + strlcpy(realName, name, MAXPATHLEN); } // consolePrintf("Open file:"); @@ -521,7 +521,8 @@ FILE *std_fopen(const char *name, const char *mode) { // Turn all back slashes into forward slashes for gba_nds_fat char *p = realName; while (*p) { - if (*p == '\\') *p = '/'; + if (*p == '\\') + *p = '/'; p++; } @@ -535,7 +536,7 @@ FILE *std_fopen(const char *name, const char *mode) { } // MT_memoryReport(); - return (FILE *) result; + return (FILE *)result; } // Fail to open file for writing. It's in ROM! @@ -550,10 +551,10 @@ FILE *std_fopen(const char *name, const char *mode) { #ifdef GBA_SRAM_SAVE if (strchr(mode, 'w')) { // consolePrintf("Writing %s\n", realName); - s_handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true); + s_handle[r].sramFile = DSSaveFileManager::instance()->openSavefile(realName, true); } else { // consolePrintf("Reading %s\n", realName); - s_handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, false); + s_handle[r].sramFile = DSSaveFileManager::instance()->openSavefile(realName, false); } #endif @@ -593,7 +594,7 @@ FILE *std_fopen(const char *name, const char *mode) { zip->setAllFilesVisible(false); // Allocate a file handle - int r = 0; + r = 0; while (s_handle[r].used) r++; @@ -626,13 +627,13 @@ void std_fclose(FILE *handle) { } } -size_t std_fread(const void *ptr, size_t size, size_t numItems, FILE *handle) { +size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle) { // consolePrintf("fread %d,%d %d ", size, numItems, ptr); if (DS::isGBAMPAvailable()) { readPastEndOfFile = false; - int bytes = FAT_fread((void *) ptr, size, numItems, (FAT_FILE *) handle); + int bytes = FAT_fread(ptr, size, numItems, (FAT_FILE *) handle); if (!FAT_feof((FAT_FILE *) handle)) { return numItems; } else { @@ -665,14 +666,15 @@ size_t std_fread(const void *ptr, size_t size, size_t numItems, FILE *handle) { // consolePrintf("read %d ", size * numItems); - memcpy((void *) ptr, handle->data + handle->pos, size * numItems); + memcpy(ptr, handle->data + handle->pos, size * numItems); handle->pos += size * numItems; return numItems; } size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle) { - if ((handle == stdin)) return 0; + if ((handle == stdin)) + return 0; if ((handle == stderr) || (handle == stdout)) { // consolePrintf((char *) ptr); @@ -682,7 +684,7 @@ size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle) { //consolePrintf("fwrite size=%d\n", size * numItems); if (DS::isGBAMPAvailable()) { - FAT_fwrite(((char *) (ptr)), size, numItems, (FAT_FILE *) handle); + FAT_fwrite(ptr, size, numItems, (FAT_FILE *) handle); return numItems; int length = size * numItems; diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index b1df3a98eb..ee4afe60f3 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -209,16 +209,16 @@ public: #undef stdout #undef stdin -#define stdout ((DS::fileHandle*) -1) -#define stderr ((DS::fileHandle*) -2) -#define stdin ((DS::fileHandle*) -3) +#define stdout ((DS::fileHandle *) -1) +#define stderr ((DS::fileHandle *) -2) +#define stdin ((DS::fileHandle *) -3) #define FILE DS::fileHandle // Please do not remove any of these prototypes that appear not to be required. FILE* std_fopen(const char *name, const char *mode); void std_fclose(FILE *handle); -size_t std_fread(const void *ptr, size_t size, size_t numItems, FILE *handle); +size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle); size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle); bool std_feof(FILE *handle); long int std_ftell(FILE *handle); diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 28d9819991..66fbef6cdc 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -162,7 +162,7 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { } - DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file); + DS::std_fread(&waveHeader, sizeof(waveHeader), 1, file); consolePrintf("File: %s\n", fname.c_str()); @@ -186,11 +186,11 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { // Skip chunks until we reach the data chunk chunkHeader chunk; - DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file); + DS::std_fread(&chunk, sizeof(chunkHeader), 1, file); while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) { DS::std_fseek(file, chunk.size, SEEK_CUR); - DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file); + DS::std_fread(&chunk, sizeof(chunkHeader), 1, file); } dataChunkStart = DS::std_ftell(file); @@ -266,7 +266,7 @@ void decompressBlock() { do { - DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file); + DS::std_fread(&blockHeader, sizeof(blockHeader), 1, file); DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file); -- cgit v1.2.3 From 776c3a1d519838910732ab31b81b11cc5d122c88 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 16:12:47 +0000 Subject: DS: Fix MODULE_DIRS value (now dependency tracking works correctly) svn-id: r50694 --- backends/platform/ds/module.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index 02ae0759d4..e3c18c7174 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -109,12 +109,12 @@ $(MODULE)/arm9/source/touchkeyboard.o: \ MODULE_DIRS += \ - backends/platform/ds \ - backends/platform/ds/arm7/source \ - backends/platform/ds/arm7/source/libcartreset \ - backends/platform/ds/arm9/source \ - backends/platform/ds/arm9/source/fat \ - backends/platform/ds/arm9/source/libcartreset + backends/platform/ds/ \ + backends/platform/ds/arm7/source/ \ + backends/platform/ds/arm7/source/libcartreset/ \ + backends/platform/ds/arm9/source/ \ + backends/platform/ds/arm9/source/fat/ \ + backends/platform/ds/arm9/source/libcartreset/ # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -- cgit v1.2.3 From 68d620ccab1be965c8b0f7373cb1280e11244139 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 19:10:20 +0000 Subject: DS: Fix warnings, make some vars static, cleanup svn-id: r50701 --- backends/fs/ds/ds-fs.cpp | 16 ++--- backends/fs/ds/ds-fs.h | 4 +- backends/platform/ds/arm9/source/cdaudio.cpp | 82 ++++++++++++------------- backends/platform/ds/arm9/source/dsmain.cpp | 3 +- backends/platform/ds/arm9/source/gbampsave.cpp | 54 ++++++++-------- backends/platform/ds/arm9/source/osystem_ds.cpp | 2 +- 6 files changed, 78 insertions(+), 83 deletions(-) (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index fafdc8502e..43203eed54 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -416,18 +416,12 @@ bool DSFileStream::eos() const { } int32 DSFileStream::pos() const { - if (_writeBufferPos > 0) { - // Discard constness. Bad, but I can't see another way. - ((DSFileStream *) (this))->flush(); - } + assert(_writeBufferPos == 0); // This method may only be called when reading! return std_ftell((FILE *)_handle); } int32 DSFileStream::size() const { - if (_writeBufferPos > 0) { - // Discard constness. Bad, but I can't see another way. - ((DSFileStream *) (this))->flush(); - } + assert(_writeBufferPos == 0); // This method may only be called when reading! int32 oldPos = std_ftell((FILE *)_handle); std_fseek((FILE *)_handle, 0, SEEK_END); int32 length = std_ftell((FILE *)_handle); @@ -659,10 +653,10 @@ size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle) { return bytes / size; } - if ((int)(handle->pos + size * numItems) > handle->size) { + if (handle->pos > handle->size) + numItems = 0; + else if ((int)(handle->pos + size * numItems) > handle->size) numItems = (handle->size - handle->pos) / size; - if (numItems < 0) numItems = 0; - } // consolePrintf("read %d ", size * numItems); diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index ee4afe60f3..fadfb8a40d 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -173,7 +173,9 @@ struct fileHandle { class DSFileStream : public Common::SeekableReadStream, public Common::WriteStream, public Common::NonCopyable { protected: - static const int WRITE_BUFFER_SIZE = 512; + enum { + WRITE_BUFFER_SIZE = 512 + }; /** File handle to the actual file. */ void *_handle; diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index 66fbef6cdc..a5d38cb7e4 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -74,25 +74,25 @@ struct decoderFormat { unsigned char sample[1024]; } __attribute__ ((packed)); -bool active = false; -WaveHeader waveHeader; -Header blockHeader; -FILE *file; -int fillPos; -bool isPlayingFlag = false; - -s16 *audioBuffer; -u32 sampleNum; -s16 *decompressionBuffer; -int numLoops; -int blockCount; -int dataChunkStart; -int blocksLeft; -bool trackStartsAt2 = false; +static bool s_active = false; +static WaveHeader waveHeader; +static Header blockHeader; +static FILE *s_file; +static int fillPos; +static bool isPlayingFlag = false; + +static s16 *audioBuffer; +static u32 sampleNum; +static s16 *decompressionBuffer; +static int s_numLoops; +static int blockCount; +static int dataChunkStart; +static int blocksLeft; +static bool trackStartsAt2 = false; // These are from Microsoft's document on DVI ADPCM -const int stepTab[ 89 ] = { +static const int stepTab[ 89 ] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, @@ -106,7 +106,7 @@ const int stepTab[ 89 ] = { 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; -const int indexTab[ 16 ] = { -1, -1, -1, -1, 2, 4, 6, 8, +static const int indexTab[ 16 ] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 }; void playNextBlock(); @@ -118,11 +118,11 @@ void allocBuffers() { } void setActive(bool active) { - DS::CD::active = active; + s_active = active; } bool getActive() { - return active; + return s_active; } void playTrack(int track, int numLoops, int startFrame, int duration) { @@ -148,21 +148,21 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { sprintf(str, "track%d.wav", track); fname = path + str; - file = DS::std_fopen(fname.c_str(), "rb"); + s_file = DS::std_fopen(fname.c_str(), "rb"); - if (!file) { + if (!s_file) { sprintf(str, "track%02d.wav", track); fname = path + str; - file = DS::std_fopen(fname.c_str(), "rb"); + s_file = DS::std_fopen(fname.c_str(), "rb"); } - if (!file) { + if (!s_file) { consolePrintf("Failed to open %s!\n", path.c_str()); return; } - DS::std_fread(&waveHeader, sizeof(waveHeader), 1, file); + DS::std_fread(&waveHeader, sizeof(waveHeader), 1, s_file); consolePrintf("File: %s\n", fname.c_str()); @@ -174,7 +174,7 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) { consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n"); - DS::std_fclose(file); + DS::std_fclose(s_file); return; } @@ -186,14 +186,14 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { // Skip chunks until we reach the data chunk chunkHeader chunk; - DS::std_fread(&chunk, sizeof(chunkHeader), 1, file); + DS::std_fread(&chunk, sizeof(chunkHeader), 1, s_file); while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) { - DS::std_fseek(file, chunk.size, SEEK_CUR); - DS::std_fread(&chunk, sizeof(chunkHeader), 1, file); + DS::std_fseek(s_file, chunk.size, SEEK_CUR); + DS::std_fread(&chunk, sizeof(chunkHeader), 1, s_file); } - dataChunkStart = DS::std_ftell(file); + dataChunkStart = DS::std_ftell(s_file); static bool started = false; @@ -237,14 +237,14 @@ void playTrack(int track, int numLoops, int startFrame, int duration) { // No need to seek if we're starting from the beginning if (block != 0) { - DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET); + DS::std_fseek(s_file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET); // consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block); } //decompressBlock(); playNextBlock(); - DS::CD::numLoops = numLoops; + s_numLoops = numLoops; } void update() { @@ -266,20 +266,20 @@ void decompressBlock() { do { - DS::std_fread(&blockHeader, sizeof(blockHeader), 1, file); + DS::std_fread(&blockHeader, sizeof(blockHeader), 1, s_file); - DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file); + DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, s_file); - if (DS::std_feof(file) ) { + if (DS::std_feof(s_file)) { // Reached end of file, so loop - if ((numLoops == -1) || (numLoops > 1)) { + if ((s_numLoops == -1) || (s_numLoops > 1)) { // Seek file to first packet - if (numLoops != -1) { - numLoops--; + if (s_numLoops != -1) { + s_numLoops--; } - DS::std_fseek(file, dataChunkStart, SEEK_SET); + DS::std_fseek(s_file, dataChunkStart, SEEK_SET); loop = true; } else { // Fill decompression buffer with zeros to prevent glitching @@ -465,7 +465,7 @@ void playNextBlock() { void stopTrack() { if (!isPlayingFlag) return; - DS::std_fclose(file); + DS::std_fclose(s_file); isPlayingFlag = false; @@ -498,8 +498,8 @@ bool trackExists(int num) { } consolePrintf("Looking for %s...", path.c_str()); - FILE *file; - if ((file = DS::std_fopen(path.c_str(), "r"))) { + FILE *file = DS::std_fopen(path.c_str(), "r"); + if (file) { consolePrintf("Success!\n"); setActive(true); DS::std_fclose(file); diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 163ae9518d..7315c25a43 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -133,8 +133,7 @@ void *operator new (size_t size) { void *res = __real_malloc(size); s_total_malloc += size; - if (!res) - { + if (!res) { // *((u8 *) NULL) = 0; consolePrintf("Failed alloc (new) %d (%d)\n", size, s_total_malloc); return NULL; diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index dbcc310fa3..d0fb8fff3b 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -47,10 +47,10 @@ GBAMPSaveFile::~GBAMPSaveFile() { // consolePrintf("Closed file\n"); } -uint32 GBAMPSaveFile::read(void *buf, uint32 size) { - saveSize += size; -// consolePrintf("Read %d %d ", size, saveSize); - return DS::std_fread(buf, 1, size, handle); +uint32 GBAMPSaveFile::read(void *buf, uint32 length) { + saveSize += length; +// consolePrintf("Read %d %d ", length, saveSize); + return DS::std_fread(buf, 1, length, handle); } bool GBAMPSaveFile::eos() const { @@ -77,27 +77,27 @@ int32 GBAMPSaveFile::pos() const { int32 GBAMPSaveFile::size() const { int position = pos(); DS::std_fseek(handle, 0, SEEK_END); - int size = DS::std_ftell(handle); + int length = DS::std_ftell(handle); DS::std_fseek(handle, position, SEEK_SET); - return size; + return length; } -bool GBAMPSaveFile::seek(int32 pos, int whence) { - return DS::std_fseek(handle, pos, whence) == 0; +bool GBAMPSaveFile::seek(int32 newPos, int whence) { + return DS::std_fseek(handle, newPos, whence) == 0; } -uint32 GBAMPSaveFile::write(const void *buf, uint32 size) { - if (bufferPos + size > SAVE_BUFFER_SIZE) { +uint32 GBAMPSaveFile::write(const void *buf, uint32 length) { + if (bufferPos + length > SAVE_BUFFER_SIZE) { flushSaveBuffer(); - saveSize += size; -// consolePrintf("Writing %d bytes from %x", size, buf); -// DS::std_fwrite(buf, 1, size, handle); + saveSize += length; +// consolePrintf("Writing %d bytes from %x", length, buf); +// DS::std_fwrite(buf, 1, length, handle); - memcpy(buffer + bufferPos, buf, size); - bufferPos += size; + memcpy(buffer + bufferPos, buf, length); + bufferPos += length; - saveSize += size; + saveSize += length; /* int pos = 0; @@ -107,31 +107,31 @@ uint32 GBAMPSaveFile::write(const void *buf, uint32 size) { bufferPos = 512; pos += rest; flushSaveBuffer(); - size -= rest; + length -= rest; // consolePrintf("First section: %d\n", rest); - while (size >= 512) { + while (length >= 512) { DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle); - size -= 512; + length -= 512; pos += 512; -// consolePrintf("Full chunk, %d left ", size); +// consolePrintf("Full chunk, %d left ", length); } bufferPos = 0; - memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size); - bufferPos += size; + memcpy(buffer + bufferPos, ((char *) (buf)) + pos, length); + bufferPos += length; // consolePrintf("%d left in buffer ", bufferPos);*/ } else { - memcpy(buffer + bufferPos, buf, size); - bufferPos += size; + memcpy(buffer + bufferPos, buf, length); + bufferPos += length; - saveSize += size; + saveSize += length; } -// if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size); - return size; +// if ((length > 100) || (length <= 0)) consolePrintf("Write %d bytes\n", length); + return length; } diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 418ab9d006..d750dfbc07 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -463,7 +463,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } void OSystem_DS::updateScreen() { - static int cnt = 0; +// static int cnt = 0; // consolePrintf("updatescr %d\n", cnt++); if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit())) { -- cgit v1.2.3 From 5d25d3821a680ba9dd034595638be8c975de3dd2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 19:10:56 +0000 Subject: DS: Only include NDS/scummvm_ipc.h where necessary; minor tweaks svn-id: r50702 --- backends/platform/ds/arm9/source/dsmain.cpp | 1 + backends/platform/ds/arm9/source/dsmain.h | 1 - backends/platform/ds/arm9/source/touchkeyboard.cpp | 1 + .../platform/ds/commoninclude/NDS/scummvm_ipc.h | 36 ++++++++++------------ backends/platform/ds/ds.mk | 2 +- 5 files changed, 20 insertions(+), 21 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 7315c25a43..d1e30b93cd 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -85,6 +85,7 @@ #include #include +#include "NDS/scummvm_ipc.h" #include "dsmain.h" #include "osystem_ds.h" #include "icons_raw.h" diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h index 89b8c708b7..bd627fa620 100644 --- a/backends/platform/ds/arm9/source/dsmain.h +++ b/backends/platform/ds/arm9/source/dsmain.h @@ -28,7 +28,6 @@ #include #include "osystem_ds.h" -#include "NDS/scummvm_ipc.h" namespace DS { diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index ce3e2416af..7b5e8c2b52 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -20,6 +20,7 @@ * */ #include +#include "NDS/scummvm_ipc.h" #include "touchkeyboard.h" #include "keyboard_raw.h" #include "keyboard_pal_raw.h" diff --git a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h index c762d1acd1..e0cda4d972 100644 --- a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h +++ b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h @@ -33,31 +33,29 @@ ////////////////////////////////////////////////////////////////////// -typedef struct sTransferSoundData { -//--------------------------------------------------------------------------------- - const void *data; - u32 len; - u32 rate; - u8 vol; - u8 pan; - u8 format; - u8 PADDING; -} TransferSoundData, * pTransferSoundData; +typedef struct { + const void *data; + u32 len; + u32 rate; + u8 vol; + u8 pan; + u8 format; + u8 PADDING; +} TransferSoundData; //--------------------------------------------------------------------------------- -typedef struct sTransferSound { -//--------------------------------------------------------------------------------- - TransferSoundData data[16]; - u8 count; - u8 PADDING[3]; -} TransferSound, * pTransferSound; +typedef struct { + TransferSoundData data[16]; + u8 count; + u8 PADDING[3]; +} TransferSound; -typedef struct _adpcmBuffer { +typedef struct { u8 *buffer[8]; bool filled[8]; u8 *arm7Buffer[8]; @@ -97,7 +95,7 @@ typedef struct scummvmTransferRegion { uint16 battery; // battery life ?? hopefully. :) uint16 aux; // i have no idea... - pTransferSound soundData; + TransferSound *soundData; adpcmBuffer adpcm; @@ -127,7 +125,7 @@ typedef struct scummvmTransferRegion { // Streaming sound bool streamFillNeeded[4]; int streamPlayingSection; -} scummTransferRegion, * pscummTransferRegion; +} scummTransferRegion; ////////////////////////////////////////////////////////////////////// diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index d7c7defa3d..c8002a6204 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -1,5 +1,5 @@ # To approximate the DS builds A, B, C, ... run our configure like this -# configure --host=ds --disable-all-engines OPTIONS +# configure --host=ds --disable-translation --disable-all-engines OPTIONS # where OPTIONS is... # build A: --enable-scumm # build B: --enable-sky --enable-queen -- cgit v1.2.3 From 429de8f6efc3d3dcbbdfbc9f7eb53d2d096ca925 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 20:36:11 +0000 Subject: DS: More formating, made more vars static svn-id: r50708 --- backends/platform/ds/arm9/source/blitters.cpp | 64 +++++++------------ backends/platform/ds/arm9/source/cdaudio.cpp | 74 +++++++++------------- backends/platform/ds/arm9/source/dsmain.cpp | 61 ++++++------------ backends/platform/ds/arm9/source/dsoptions.cpp | 2 +- backends/platform/ds/arm9/source/keys.cpp | 33 +++------- backends/platform/ds/arm9/source/keys.h | 2 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 3 +- backends/platform/ds/arm9/source/touchkeyboard.cpp | 32 +++++----- backends/platform/ds/arm9/source/zipreader.cpp | 1 - 9 files changed, 98 insertions(+), 174 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/blitters.cpp b/backends/platform/ds/arm9/source/blitters.cpp index 559845cb18..5d29672ef6 100644 --- a/backends/platform/ds/arm9/source/blitters.cpp +++ b/backends/platform/ds/arm9/source/blitters.cpp @@ -33,10 +33,10 @@ namespace DS { void asmDrawStripToScreen(int height, int width, byte const *text, byte const *src, byte *dst, int vsPitch, int vmScreenWidth, int textSurfacePitch) { - - if (height <= 0) height = 1; - if (width < 4) return; - + if (height <= 0) + height = 1; + if (width < 4) + return; width &= ~4; // src = (const byte *) (((int) (src)) & (~4)); @@ -144,22 +144,19 @@ void asmCopy8Col(byte *dst, int dstPitch, const byte *src, int height) { static bool isDivBy5Ready = false; static u32 DIV_BY_5[160]; -void ComputeDivBy5TableIFN() -{ +void ComputeDivBy5TableIFN() { if (isDivBy5Ready) return; isDivBy5Ready = true; - for (int i=0; i<160; ++i) - { + for (int i = 0; i < 160; ++i) { DIV_BY_5[i] = (2*i+5)/10; } } #ifdef PERFECT_5_TO_4_RESCALING static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4, - u16 *dest) -{ + u16 *dest) { u32 bs0 = s0 & 0x1F; u32 bs1 = s1 & 0x1F; u32 bs2 = s2 & 0x1F; @@ -233,8 +230,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 } #else static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3, u16 s4, - u16 *dest) -{ + u16 *dest) { static const u32 MASK = 0x03E07C1F; u32 argbargbs0 = u32(s0) | (u32(s0) << 16); @@ -282,8 +278,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3 #endif static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3, u32 s4, - u16 *dest) -{ + u16 *dest) { u32 d0 = 4*s0 + s1; u32 d1 = 2*s1 + s1 + 2*s2; @@ -320,12 +315,10 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3 // Can't work in place #ifdef PERFECT_5_TO_4_RESCALING -static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u32 *palette) -{ +static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u32 *palette) { ComputeDivBy5TableIFN(); - for (size_t i=0; i<64; ++i) - { + for (size_t i = 0; i < 64; ++i) { u32 s0 = palette[src[5*i+0]]; u32 s1 = palette[src[5*i+1]]; u32 s2 = palette[src[5*i+2]]; @@ -336,10 +329,8 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const } } #else -static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u16 *palette) -{ - for (size_t i=0; i<64; ++i) - { +static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const u8 *src, const u16 *palette) { + for (size_t i = 0; i < 64; ++i) { u16 s0 = palette[src[5*i+0]]; u16 s1 = palette[src[5*i+1]]; u16 s2 = palette[src[5*i+2]]; @@ -353,12 +344,10 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16 *dest, const // Can work in place, because it's a contraction -static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const u16 *src) -{ +static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const u16 *src) { ComputeDivBy5TableIFN(); - for (size_t i=0; i<64; ++i) - { + for (size_t i = 0; i < 64; ++i) { u16 s0 = src[5*i+0]; u16 s1 = src[5*i+1]; u16 s2 = src[5*i+2]; @@ -370,13 +359,11 @@ static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16 *dest, const } #ifdef PERFECT_5_TO_4_RESCALING -void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) -{ +void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) { u32 fastRam[768]; // Palette lookup -> 0_888 - for (size_t i=0; i<256; ++i) - { + for (size_t i = 0; i < 256; ++i) { u32 col = palette[i]; u32 result = col & 0x0000001F; result |= (col << 3) & 0x00001F00; @@ -385,29 +372,24 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStri fastRam[i] = result; } - for (size_t i=0; i<200; ++i) - { + for (size_t i = 0; i < 200; ++i) { Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } } #else -void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) -{ +void Rescale_320x256xPAL8_To_256x256x1555(u16 *dest, const u8 *src, int destStride, int srcStride, const u16 *palette) { u16 fastRam[256]; - for (size_t i=0; i<128; ++i) + for (size_t i = 0; i < 128; ++i) ((u32*)fastRam)[i] = ((const u32*)palette)[i]; - for (size_t i=0; i<200; ++i) - { + for (size_t i = 0; i < 200; ++i) { Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam); } } #endif -void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride) -{ - for (size_t i=0; i<200; ++i) - { +void Rescale_320x256x1555_To_256x256x1555(u16 *dest, const u16 *src, int destStride, int srcStride) { + for (size_t i = 0; i < 200; ++i) { Rescale_320x1555Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride); } } diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp index a5d38cb7e4..5860dea4f2 100644 --- a/backends/platform/ds/arm9/source/cdaudio.cpp +++ b/backends/platform/ds/arm9/source/cdaudio.cpp @@ -328,45 +328,30 @@ void decompressBlock() { int offset = 0; switch (7 - (r & 0x0007)) { - case 0: { - offset = (word & 0xF0000000) >> 28; - break; - } - - case 1: { - offset = (word & 0x0F000000) >> 24; - break; - } - - case 2: { - offset = (word & 0x00F00000) >> 20; - break; - } - - case 3: { - offset = (word & 0x000F0000) >> 16; - break; - } - - case 4: { - offset = (word & 0x0000F000) >> 12; - break; - } - - case 5: { - offset = (word & 0x00000F00) >> 8; - break; - } - - case 6: { - offset = (word & 0x000000F0) >> 4; - break; - } - - case 7: { - offset = (word & 0x0000000F); - break; - } + case 0: + offset = (word & 0xF0000000) >> 28; + break; + case 1: + offset = (word & 0x0F000000) >> 24; + break; + case 2: + offset = (word & 0x00F00000) >> 20; + break; + case 3: + offset = (word & 0x000F0000) >> 16; + break; + case 4: + offset = (word & 0x0000F000) >> 12; + break; + case 5: + offset = (word & 0x00000F00) >> 8; + break; + case 6: + offset = (word & 0x000000F0) >> 4; + break; + case 7: + offset = (word & 0x0000000F); + break; } int diff = 0; @@ -409,7 +394,8 @@ void decompressBlock() { } void playNextBlock() { - if (!isPlayingFlag) return; + if (!isPlayingFlag) + return; int lastBlockId = -1; while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed @@ -445,9 +431,6 @@ void playNextBlock() { // DC_FlushAll(); } - - - } @@ -463,7 +446,8 @@ void playNextBlock() { } void stopTrack() { - if (!isPlayingFlag) return; + if (!isPlayingFlag) + return; DS::std_fclose(s_file); @@ -473,7 +457,7 @@ void stopTrack() { audioBuffer[r] = 0; } - for (int r= 0; r < waveHeader.fmtExtra; r++) { + for (int r = 0; r < waveHeader.fmtExtra; r++) { decompressionBuffer[r] = 0; } // DS::stopSound(1); diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index d1e30b93cd..dc52038cec 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -1026,8 +1026,9 @@ u16 *get16BitBackBuffer() { } s32 get8BitBackBufferStride() { - // When the CPU scaler is enabled, the back buffer is in system RAM and is 320 pixels wide - // When the CPU scaler is disabled, the back buffer is in video memory and therefore must have a 512 pixel stride + // When the CPU scaler is enabled, the back buffer is in system RAM and is + // 320 pixels wide. When the CPU scaler is disabled, the back buffer is in + // video memory and therefore must have a 512 pixel stride. if (isCpuScalerEnabled()){ return 320; @@ -1371,8 +1372,7 @@ void doScreenTapMode(OSystem_DS *system) { system->addEvent(event); } -void doButtonSelectMode(OSystem_DS *system) -{ +void doButtonSelectMode(OSystem_DS *system) { Common::Event event; @@ -1670,12 +1670,9 @@ void addEventsToQueue() { if (!keyboardEnable) { - if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) { // Controls specific to the control method - - if (s_currentGame->control == CONT_SKY) { // Extra controls for Beneath a Steel Sky if ((getKeysDown() & KEY_DOWN)) { @@ -1686,7 +1683,6 @@ void addEventsToQueue() { if (s_currentGame->control == CONT_AGI) { // Extra controls for Leisure Suit Larry and KQ4 - if ((getKeysHeld() & KEY_UP) && (getKeysHeld() & KEY_START) /*&& (!strcmp(gameName, "LLLLL"))*/) { consolePrintf("Cheat key!\n"); @@ -1699,11 +1695,8 @@ void addEventsToQueue() { event.type = Common::EVENT_KEYUP; system->addEvent(event); } - } - - if (s_currentGame->control == CONT_SIMON) { // Extra controls for Simon the Sorcerer if ((getKeysDown() & KEY_DOWN)) { @@ -1719,8 +1712,6 @@ void addEventsToQueue() { } } - - if (s_currentGame->control == CONT_SCUMM_ORIGINAL) { // Extra controls for Scumm v1-5 games if ((getKeysDown() & KEY_DOWN)) { @@ -1803,9 +1794,7 @@ void addEventsToQueue() { } consumeKeys(); - consumePenEvents(); - } } @@ -1835,23 +1824,19 @@ void updateStatus() { if (displayModeIs8Bit) { if (!tapScreenClicks) { switch (mouseMode) { - case MOUSE_LEFT: { - offs = 1; - break; - } - case MOUSE_RIGHT: { - offs = 2; - break; - } - case MOUSE_HOVER: { - offs = 0; - break; - } - default: { - // Nothing! - offs = 0; - break; - } + case MOUSE_LEFT: + offs = 1; + break; + case MOUSE_RIGHT: + offs = 2; + break; + case MOUSE_HOVER: + offs = 0; + break; + default: + // Nothing! + offs = 0; + break; } setIcon(0, 208, 150, offs, 0, true); @@ -1935,15 +1920,12 @@ void setMainScreenScale(int x, int y) { SUB_BG3_YDX = 0; SUB_BG3_YDY = y; } else*/ { - if (isCpuScalerEnabled() && (x==320)) - { + if (isCpuScalerEnabled() && (x==320)) { BG3_XDX = 256; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = y; - } - else - { + } else { BG3_XDX = x; BG3_XDY = 0; BG3_YDX = 0; @@ -2030,8 +2012,6 @@ void VBlankHandler(void) { soundUpdate(); - - if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) { if (s_currentGame) { if (s_currentGame->control != CONT_SCUMM_SAMNMAX) { @@ -2607,9 +2587,6 @@ void penUpdate() { } } - else - { - } } else { penDown = true; diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index 32b37abfbc..cc89c41017 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -423,7 +423,7 @@ void setOptions() { DS::setTrackPadStyleEnable(enable); - if ((enable) and (firstLoad)) { + if (enable && firstLoad) { // If we've just booted up, want to swap screens when trackpad mode is in use // but not every time we enter the options dialog. DS::setGameScreenSwap(true); diff --git a/backends/platform/ds/arm9/source/keys.cpp b/backends/platform/ds/arm9/source/keys.cpp index 8c97b02716..2f8497ab19 100644 --- a/backends/platform/ds/arm9/source/keys.cpp +++ b/backends/platform/ds/arm9/source/keys.cpp @@ -74,7 +74,6 @@ #include #include -//------------------------------------------------------------------------------ #define KEYS_CUR (( ((~REG_KEYINPUT)&0x3ff) | (((~IPC->buttons)&3)<<10) | (((~IPC->buttons)<<6) & (KEY_TOUCH|KEY_LID) ))^KEY_LID) @@ -89,61 +88,47 @@ static u8 delay = 60, repeat = 30, count = 60; static uint16 oldx = 0; static uint16 oldy = 0; -//------------------------------------------------------------------------------ void scanKeys(void) { -//------------------------------------------------------------------------------ keysold = keys; keys = KEYS_CUR; oldx = IPC->touchXpx; oldy = IPC->touchYpx; - if ( delay != 0 ) { - if ( keys != keysold ) { - count = delay ; - keysrepeat = keysDown() ; + if (delay != 0) { + if (keys != keysold) { + count = delay; + keysrepeat = keysDown(); } count--; - if ( count == 0 ) { + if (count == 0) { count = repeat; keysrepeat = keys; } } } -//------------------------------------------------------------------------------ uint32 keysHeld(void) { -//------------------------------------------------------------------------------ return keys; } -//------------------------------------------------------------------------------ uint32 keysDown(void) { -//------------------------------------------------------------------------------ return (keys ^ keysold) & keys; } -//------------------------------------------------------------------------------ uint32 keysDownRepeat(void) { -//------------------------------------------------------------------------------ uint32 tmp = keysrepeat; - keysrepeat = 0; - return tmp; } -//------------------------------------------------------------------------------ void keysSetRepeat( u8 setDelay, u8 setRepeat ) { -//------------------------------------------------------------------------------ - delay = setDelay ; - repeat = setRepeat ; - count = delay ; - keysrepeat = 0 ; + delay = setDelay; + repeat = setRepeat; + count = delay; + keysrepeat = 0; } -//------------------------------------------------------------------------------ uint32 keysUp(void) { -//------------------------------------------------------------------------------ return (keys ^ keysold) & (~keys); } diff --git a/backends/platform/ds/arm9/source/keys.h b/backends/platform/ds/arm9/source/keys.h index 0068dfeeb6..8d08014232 100644 --- a/backends/platform/ds/arm9/source/keys.h +++ b/backends/platform/ds/arm9/source/keys.h @@ -30,7 +30,7 @@ void scanKeys(void); uint32 keysHeld(void); uint32 keysDown(void); uint32 keysDownRepeat(void); -void keysSetRepeat( u8 setDelay, u8 setRepeat ); +void keysSetRepeat(u8 setDelay, u8 setRepeat); uint32 keysUp(void); } // End of namespace DS diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index d750dfbc07..09617c17b0 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -208,8 +208,7 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) { } } -void OSystem_DS::restoreHardwarePalette() -{ +void OSystem_DS::restoreHardwarePalette() { // Set the hardware palette up based on the stored palette for (int r = 0; r < 255; r++) { diff --git a/backends/platform/ds/arm9/source/touchkeyboard.cpp b/backends/platform/ds/arm9/source/touchkeyboard.cpp index 7b5e8c2b52..71f4f93c27 100644 --- a/backends/platform/ds/arm9/source/touchkeyboard.cpp +++ b/backends/platform/ds/arm9/source/touchkeyboard.cpp @@ -44,7 +44,7 @@ struct key_data { #define DS_CAPSLOCK 1 -key_data keys[DS_NUM_KEYS] = { +static key_data keys[DS_NUM_KEYS] = { // Key number x y character // Numbers @@ -137,27 +137,27 @@ key_data keys[DS_NUM_KEYS] = { }; -int keyboardX; -int keyboardY; +static int keyboardX; +static int keyboardY; static int s_mapBase; static int s_tileBase; -u16 *baseAddress; +static u16 *baseAddress; -bool shiftState; -bool capsLockState; +static bool shiftState; +static bool capsLockState; -bool closed; +static bool closed; -char autoCompleteWord[NUM_WORDS][32]; -int autoCompleteCount; +static char autoCompleteWord[NUM_WORDS][32]; +static int autoCompleteCount; -char autoCompleteBuffer[128]; +static char autoCompleteBuffer[128]; -int selectedCompletion = -1; -int charactersEntered = 0; -int typingTimeout = 0; +static int selectedCompletion = -1; +static int charactersEntered = 0; +static int typingTimeout = 0; // Render text onto the tiled screen @@ -396,8 +396,7 @@ void updateTypeEvents() { event.type = Common::EVENT_KEYUP; system->addEvent(event); - for (int r = 0; r < (int)strlen(autoCompleteBuffer); r++) - { + for (int r = 0; r < (int)strlen(autoCompleteBuffer); r++) { autoCompleteBuffer[r] = autoCompleteBuffer[r + 1]; } @@ -405,8 +404,7 @@ void updateTypeEvents() { } } -void createKeyEvent(int keyNum, Common::Event& event) -{ +void createKeyEvent(int keyNum, Common::Event& event) { event.kbd.flags = 0; if ((keys[keyNum].character >= '0') && (keys[keyNum].character <= '9')) { diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp index 0906123436..d4f055ee82 100644 --- a/backends/platform/ds/arm9/source/zipreader.cpp +++ b/backends/platform/ds/arm9/source/zipreader.cpp @@ -79,7 +79,6 @@ bool ZipFile::restartFile() { bool more = true; while (!currentFileInFolder() && more) { - char name[128]; getFileName(name); more = skipFile(); } -- cgit v1.2.3 From edac80ad6bd785e4925764bdd1bea2084aefc143 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 5 Jul 2010 20:36:43 +0000 Subject: DS: Fix warning about anonymous struct svn-id: r50709 --- backends/platform/ds/arm9/source/fat/gba_nds_fat.c | 12 ++++++------ backends/platform/ds/commoninclude/NDS/scummvm_ipc.h | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'backends') 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 b70d9e7b99..07affd8839 100644 --- a/backends/platform/ds/arm9/source/fat/gba_nds_fat.c +++ b/backends/platform/ds/arm9/source/fat/gba_nds_fat.c @@ -294,9 +294,9 @@ u16 getRTCtoFileTime (void) { #ifdef NDS return ( - ( ( (IPC->rtc_hours > 11 ? IPC->rtc_hours - 40 : IPC->rtc_hours) & 0x1F) << 11) | - ( (IPC->rtc_minutes & 0x3F) << 5) | - ( (IPC->rtc_seconds >> 1) & 0x1F) ); + ( ( (IPC->rtc.hours > 11 ? IPC->rtc.hours - 40 : IPC->rtc.hours) & 0x1F) << 11) | + ( (IPC->rtc.minutes & 0x3F) << 5) | + ( (IPC->rtc.seconds >> 1) & 0x1F) ); #else return 0; #endif @@ -306,9 +306,9 @@ u16 getRTCtoFileDate (void) { #ifdef NDS return ( - ( ((IPC->rtc_year + 20) & 0x7F) <<9) | - ( (IPC->rtc_month & 0xF) << 5) | - (IPC->rtc_day & 0x1F) ); + ( ((IPC->rtc.year + 20) & 0x7F) <<9) | + ( (IPC->rtc.month & 0xF) << 5) | + (IPC->rtc.day & 0x1F) ); #else return 0; #endif diff --git a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h index e0cda4d972..cf6436634a 100644 --- a/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h +++ b/backends/platform/ds/commoninclude/NDS/scummvm_ipc.h @@ -80,16 +80,16 @@ typedef struct scummvmTransferRegion { uint8 curtime[8]; // current time response from RTC struct { - u8 rtc_command; - u8 rtc_year; //add 2000 to get 4 digit year - u8 rtc_month; //1 to 12 - u8 rtc_day; //1 to (days in month) - - u8 rtc_incr; - u8 rtc_hours; //0 to 11 for AM, 52 to 63 for PM - u8 rtc_minutes; //0 to 59 - u8 rtc_seconds; //0 to 59 - }; + u8 command; + u8 year; //add 2000 to get 4 digit year + u8 month; //1 to 12 + u8 day; //1 to (days in month) + + u8 incr; + u8 hours; //0 to 11 for AM, 52 to 63 for PM + u8 minutes; //0 to 59 + u8 seconds; //0 to 59 + } rtc; }; uint16 battery; // battery life ?? hopefully. :) -- cgit v1.2.3 From 2343f8c60d8291c1cd081339865837c43fe1f55d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 6 Jul 2010 22:13:43 +0000 Subject: DS: Add isScrollingWithDPad() to make code more readable svn-id: r50727 --- backends/platform/ds/arm9/source/dsmain.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index dc52038cec..8d51eff3da 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -383,6 +383,9 @@ void uploadSpriteGfx(); static TransferSound soundControl; +static bool isScrollingWithDPad() { + return (getKeysHeld() & (KEY_L | KEY_R)) != 0; +} bool isCpuScalerEnabled() { return cpuScalerEnable || !displayModeIs8Bit; @@ -1339,7 +1342,7 @@ void doScreenTapMode(OSystem_DS *system) { right = true; } - if (!(getKeysHeld() & (KEY_L | KEY_R))) { + if (!isScrollingWithDPad()) { if (getKeysDown() & KEY_LEFT) { event.type = Common::EVENT_LBUTTONDOWN; @@ -1376,7 +1379,7 @@ void doButtonSelectMode(OSystem_DS *system) { Common::Event event; - if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { + if (!isScrollingWithDPad()) { event.type = Common::EVENT_MOUSEMOVE; event.mouse = Common::Point(getPenX(), getPenY()); system->addEvent(event); @@ -1399,7 +1402,7 @@ void doButtonSelectMode(OSystem_DS *system) { if ((mouseMode != MOUSE_HOVER) || (!displayModeIs8Bit)) { - if (getPenDown() && (!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R))) { + if (getPenDown() && !isScrollingWithDPad()) { if (mouseMode == MOUSE_LEFT) { event.type = Common::EVENT_LBUTTONDOWN; leftButtonDown = true; @@ -1441,7 +1444,7 @@ void doButtonSelectMode(OSystem_DS *system) { } } - if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) { + if (!isScrollingWithDPad() && !getIndyFightState() && !getKeyboardEnable()) { if (!getPenHeld() || (mouseMode != MOUSE_HOVER)) { if (getKeysDown() & KEY_LEFT) { @@ -1537,7 +1540,7 @@ void addEventsToQueue() { if (!indyFightState) { - if ((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_B)) { + if (!isScrollingWithDPad() && (getKeysDown() & KEY_B)) { if (s_currentGame->control == CONT_AGI) { event.kbd.keycode = Common::KEYCODE_RETURN; event.kbd.ascii = 13; @@ -1609,7 +1612,7 @@ void addEventsToQueue() { } - if (!((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (!getIndyFightState()) && (!getKeyboardEnable())) { + if (!isScrollingWithDPad() && !getIndyFightState() && !getKeyboardEnable()) { if ((getKeysDown() & KEY_A) && (!indyFightState)) { gameScreenSwap = !gameScreenSwap; @@ -1648,7 +1651,7 @@ void addEventsToQueue() { } } - if (!getIndyFightState() && !((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) && (getKeysDown() & KEY_X)) { + if (!getIndyFightState() && !isScrollingWithDPad() && (getKeysDown() & KEY_X)) { setKeyboardEnable(!keyboardEnable); } @@ -1670,7 +1673,7 @@ void addEventsToQueue() { if (!keyboardEnable) { - if (((!(getKeysHeld() & KEY_L)) && (!(getKeysHeld() & KEY_R)) || (indyFightState)) && (displayModeIs8Bit)) { + if ((isScrollingWithDPad() || (indyFightState)) && (displayModeIs8Bit)) { // Controls specific to the control method if (s_currentGame->control == CONT_SKY) { @@ -2012,7 +2015,7 @@ void VBlankHandler(void) { soundUpdate(); - if ((!gameScreenSwap) && (!(getKeysHeld() & KEY_L) && !(getKeysHeld() & KEY_R))) { + if ((!gameScreenSwap) && !isScrollingWithDPad()) { if (s_currentGame) { if (s_currentGame->control != CONT_SCUMM_SAMNMAX) { if (getPenHeld() && (getPenY() < SCUMM_GAME_HEIGHT)) { @@ -2054,7 +2057,7 @@ void VBlankHandler(void) { callbackTimer -= FRAME_TIME; } - if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { + if (isScrollingWithDPad()) { if ((!dragging) && (getPenHeld()) && (penDownFrames > 5)) { dragging = true; @@ -2108,7 +2111,7 @@ void VBlankHandler(void) { bool zooming = false; - if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { + if (isScrollingWithDPad()) { if ((getKeysHeld() & KEY_A) && (subScreenScale < ratio)) { subScreenScale += 1; zooming = true; @@ -2185,7 +2188,7 @@ void VBlankHandler(void) { if (displayModeIs8Bit) { - if ((getKeysHeld() & KEY_L) || (getKeysHeld() & KEY_R)) { + if (isScrollingWithDPad()) { int offsX = 0, offsY = 0; -- cgit v1.2.3 From 9b927b414aadf954f3f4fce9a80b86f3e26c154d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 6 Jul 2010 22:14:06 +0000 Subject: DS: Implemented (ugly, but working) support for optimization level overrides svn-id: r50728 --- backends/platform/ds/ds.mk | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index c8002a6204..66afa01a1f 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -61,9 +61,6 @@ LOGO = logoa.bmp # Files in this list will be optimisied for speed, otherwise they will be optimised for space -OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp -#OPTLIST := - # Compiler options for files which should be optimised for speed OPT_SPEED := -O3 @@ -71,16 +68,32 @@ OPT_SPEED := -O3 OPT_SIZE := -Os -mthumb -#-mthumb -fno-gcse -fno-schedule-insns2 - - -#OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) - - -# TODO: Handle files in OPTLIST. -# For this, the list should be made explicit. So, replace actor.cpp by path/to/actor.cpp -- -# in fact, there are several actor.cpp files, and right now all are "optimized", but -# I think Neil only had the SAGA one in mind. Same for gfx.cpp +# TODO: The original list contained three more files that should be optimized +# for size: actor.cpp gfx.cpp sprite.cpp -- but there are many files with these +# names, which are the "right" ones? +$(ndsdir)/arm9/source/dsmain.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +$(ndsdir)/arm9/source/osystem_ds.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +$(ndsdir)/arm9/source/blitters.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +$(ndsdir)/arm9/source/ds_main.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/isomap.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +sound/rate.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/actor_walk.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/actor_path.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/image.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +sound/fmopl.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/scumm/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/m4/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/scumm/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/cine/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/agos/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/saga/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/m4/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +engines/agi/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +# TODO: Fingolfin says: optimizing staticres for size would +# save about 30k, so maybe consider that? +#engines/kyra/staticres.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -- cgit v1.2.3 From fe409ea2692db8eb9d95564c03b166fb7baa316e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 6 Jul 2010 22:29:45 +0000 Subject: DS: cleanup arm9/makefile svn-id: r50729 --- backends/platform/ds/arm9/makefile | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index d1b1cf55d6..ae5fce531b 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -333,13 +333,11 @@ OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp i # Compiler options for files which should be optimised for speed ifdef DS_BUILD_E -# Another attempt to save some RAM in ITE -OPT_SPEED := -O3 -mthumb + # Another attempt to save some RAM in ITE + OPT_SPEED := -O3 -mthumb else -#OPT_SPEED := -O3 - -OPT_SPEED := -Os -mthumb - + #OPT_SPEED := -O3 + OPT_SPEED := -Os -mthumb endif # Compiler options for files which should be optimised for space @@ -379,14 +377,6 @@ dist : SCUMMVM.BIN plugins plugin_dist #--------------------------------------------------------------------------------- # canned command sequence for binary data #--------------------------------------------------------------------------------- -#define bin2o -# bin2s $< | $(AS) -mthumb -mthumb-interwork -o $(@) -# echo "extern const u8" `(echo $( `(echo $(> `(echo $(> `(echo $( `(echo $( $(*).h -# echo "extern const u32" $(notdir $(*))_size[]";" >> $(*).h -# -# echo $(*).h -# rm $(*).tmp -#endef - - ############## # Replacement rule for the one in makefile.common ############## @@ -474,10 +448,8 @@ endef padbin 16 $(basename $@).ds.gba #--------------------------------------------------------------------------------- -# FIXME: The following rule hardcodes the input & output filename -- shouldn't it use $< and $@ instead? %.bin: %.elf - $(OBJCOPY) -S scummvm.elf scummvm-stripped.elf - $(OBJCOPY) -O binary scummvm-stripped.elf scummvm.bin + $(OBJCOPY) -S -O binary $< $@ #%.o: %.s # $(MKDIR) $(*D)/$(DEPDIR) -- cgit v1.2.3 From 61a200dcdd03e8b0c1f35dea50842b6356e13e17 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 16:51:36 +0000 Subject: DS: Remove redundant lines from arm9/makefile svn-id: r50736 --- backends/platform/ds/arm9/makefile | 3 --- 1 file changed, 3 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index ae5fce531b..31be40f680 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -113,9 +113,6 @@ ifdef DS_BUILD_A DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM LOGO = logoa.bmp ENABLE_SCUMM = STATIC_PLUGIN - DEFINES += -DENABLE_SCUMM=STATIC_PLUGIN - MODULES += engines/scumm - USE_ARM_GFX_ASM = 1 BUILD=scummvm-A endif -- cgit v1.2.3 From fe72d5dd7842312606b350785f2fac2b2824fcb6 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 23:22:53 +0000 Subject: DS: Fix some quirks in the NDS build system, remove some dead code * remove (S)RAM save code (it has not been in use for quite some time) * remove the lz compressor (was only used by ram save code) * OPT_SPEED was set incorrectly * dsmain.cpp was misspelled as ds_main.cpp * remove unsed arm9 libcartreset (the copy in the arm7 directory still is around, though) svn-id: r50741 --- backends/fs/ds/ds-fs.cpp | 51 +- backends/fs/ds/ds-fs.h | 8 +- backends/platform/ds/arm9/makefile | 76 +-- backends/platform/ds/arm9/source/compressor/lz.cpp | 539 --------------------- backends/platform/ds/arm9/source/compressor/lz.h | 50 -- backends/platform/ds/arm9/source/dsmain.cpp | 109 +---- backends/platform/ds/arm9/source/gbampsave.h | 1 + .../ds/arm9/source/libcartreset/cartreset.c | 107 ---- .../arm9/source/libcartreset/cartreset_nolibfat.h | 57 --- backends/platform/ds/arm9/source/osystem_ds.cpp | 20 +- backends/platform/ds/arm9/source/osystem_ds.h | 4 - backends/platform/ds/arm9/source/ramsave.cpp | 538 -------------------- backends/platform/ds/arm9/source/ramsave.h | 155 ------ backends/platform/ds/module.mk | 15 +- 14 files changed, 64 insertions(+), 1666 deletions(-) delete mode 100644 backends/platform/ds/arm9/source/compressor/lz.cpp delete mode 100644 backends/platform/ds/arm9/source/compressor/lz.h delete mode 100644 backends/platform/ds/arm9/source/libcartreset/cartreset.c delete mode 100644 backends/platform/ds/arm9/source/libcartreset/cartreset_nolibfat.h delete mode 100644 backends/platform/ds/arm9/source/ramsave.cpp delete mode 100644 backends/platform/ds/arm9/source/ramsave.h (limited to 'backends') diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index 43203eed54..675084ff56 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -542,27 +542,6 @@ FILE *std_fopen(const char *name, const char *mode) { assert(r < MAX_FILE_HANDLES); } -#ifdef GBA_SRAM_SAVE - if (strchr(mode, 'w')) { -// consolePrintf("Writing %s\n", realName); - s_handle[r].sramFile = DSSaveFileManager::instance()->openSavefile(realName, true); - } else { -// consolePrintf("Reading %s\n", realName); - s_handle[r].sramFile = DSSaveFileManager::instance()->openSavefile(realName, false); - } -#endif - - if (s_handle[r].sramFile) { - s_handle[r].used = true; - s_handle[r].pos = 0; - s_handle[r].data = NULL; - s_handle[r].size = s_handle[r].sramFile->getSize(); -// consolePrintf("Found it"); - return &s_handle[r]; - } - -// consolePrintf("Not in SRAM!"); - char *data; ZipFile *zip = DSFileSystemNode::getZip(); @@ -615,10 +594,6 @@ void std_fclose(FILE *handle) { } handle->used = false; - if (handle->sramFile) { - delete handle->sramFile; - handle->sramFile = NULL; - } } size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle) { @@ -638,21 +613,6 @@ size_t std_fread(void *ptr, size_t size, size_t numItems, FILE *handle) { return numItems; } - if (handle->sramFile) { - int bytes = 0; - int result = 1; - //consolePrintf("fread size=", size * numItems); - for (int r = 0; (r < (s32) size * (s32) numItems) && (result > 0); r++) { - result = handle->sramFile->read((void *) ( ((char *) (ptr)) + r), 1); - bytes += result; - //consolePrintf("'%d',", ((char *) (ptr))[0]); - } - - handle->pos += bytes; - - return bytes / size; - } - if (handle->pos > handle->size) numItems = 0; else if ((int)(handle->pos + size * numItems) > handle->size) @@ -695,12 +655,7 @@ size_t std_fwrite(const void *ptr, size_t size, size_t numItems, FILE *handle) { return numItems; } - if (handle->sramFile) { - handle->sramFile->write(ptr, size); - return size; - } else { - return 0; - } + return 0; } bool std_feof(FILE *handle) { @@ -710,10 +665,6 @@ bool std_feof(FILE *handle) { return readPastEndOfFile && FAT_feof((FAT_FILE *) handle); } - if (handle->sramFile) { - return handle->sramFile->eos(); - } - // consolePrintf("feof %s", handle->pos >= handle->size? "true": "false"); return handle->pos >= handle->size; } diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index fadfb8a40d..6961022848 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -26,12 +26,12 @@ #ifndef _DS_FS_H #define _DS_FS_H -//#include #include "common/fs.h" +#include "common/stream.h" +#include "backends/fs/abstract-fs.h" + #include "zipreader.h" -#include "ramsave.h" #include "fat/gba_nds_fat.h" -#include "backends/fs/abstract-fs.h" namespace DS { @@ -166,8 +166,6 @@ struct fileHandle { bool used; char *data; int size; - - DSSaveFile *sramFile; }; diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 31be40f680..703d5d69b7 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -253,7 +253,7 @@ endif INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \ -I$(portdir)/data -I$(portdir)/../commoninclude \ - -I$(portdir)/source -I$(portdir)/source/mad -I$(portdir)/source/libcartreset \ + -I$(portdir)/source -I$(portdir)/source/mad \ -I$(libndsdir)/include -include $(srcdir)/common/scummsys.h @@ -286,46 +286,58 @@ PRE_OBJS_FLAGS = -Wl,--whole-archive POST_OBJS_FLAGS = -Wl,--no-whole-archive endif -PORT_OBJS := $(portdir)/source/blitters_arm.o $(portdir)/source/cdaudio.o $(portdir)/source/dsmain.o \ - $(portdir)/../../../fs/ds/ds-fs.o $(portdir)/source/gbampsave.o $(portdir)/source/scummhelp.o\ - $(portdir)/source/osystem_ds.o $(portdir)/source/ramsave.o\ - $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\ - $(portdir)/source/dsoptions.o $(portdir)/source/keys.o $(portdir)/source/wordcompletion.o\ - $(portdir)/source/interrupt.o +PORT_OBJS := \ + $(portdir)/source/blitters_arm.o \ + $(portdir)/source/cdaudio.o \ + $(portdir)/source/dsmain.o \ + $(portdir)/../../../fs/ds/ds-fs.o \ + $(portdir)/source/gbampsave.o \ + $(portdir)/source/scummhelp.o \ + $(portdir)/source/osystem_ds.o \ + $(portdir)/source/touchkeyboard.o \ + $(portdir)/source/zipreader.o \ + $(portdir)/source/dsoptions.o \ + $(portdir)/source/keys.o \ + $(portdir)/source/wordcompletion.o \ + $(portdir)/source/interrupt.o ifdef USE_PROFILER PORT_OBJS += $(portdir)/source/profiler/cyg-profile.o endif -DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o - -COMPRESSOR_OBJS := -#$(portdir)/source/compressor/lz.o - -FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o\ - $(portdir)/source/fat/io_fcsr.o $(portdir)/source/fat/io_m3cf.o\ - $(portdir)/source/fat/io_mpcf.o $(portdir)/source/fat/io_sccf.o\ - $(portdir)/source/fat/io_m3sd.o\ - $(portdir)/source/fat/io_nmmc.o $(portdir)/source/fat/io_scsd.o \ - $(portdir)/source/fat/io_scsd_asm.o \ - $(portdir)/source/fat/io_njsd.o \ - $(portdir)/source/fat/io_mmcf.o \ - $(portdir)/source/fat/io_sd_common.o \ - $(portdir)/source/fat/io_m3_common.o \ - $(portdir)/source/fat/io_dldi.o \ - $(portdir)/source/fat/m3sd.o +DATA_OBJS := + $(portdir)/data/icons.o \ + $(portdir)/data/keyboard.o \ + $(portdir)/data/keyboard_pal.o \ + $(portdir)/data/default_font.o \ + $(portdir)/data/8x8font_tga.o + +FAT_OBJS := + $(portdir)/source/fat/disc_io.o \ + $(portdir)/source/fat/gba_nds_fat.o \ + $(portdir)/source/fat/io_fcsr.o \ + $(portdir)/source/fat/io_m3cf.o \ + $(portdir)/source/fat/io_mpcf.o \ + $(portdir)/source/fat/io_sccf.o \ + $(portdir)/source/fat/io_m3sd.o \ + $(portdir)/source/fat/io_nmmc.o \ + $(portdir)/source/fat/io_scsd.o \ + $(portdir)/source/fat/io_scsd_asm.o \ + $(portdir)/source/fat/io_njsd.o \ + $(portdir)/source/fat/io_mmcf.o \ + $(portdir)/source/fat/io_sd_common.o \ + $(portdir)/source/fat/io_m3_common.o \ + $(portdir)/source/fat/io_dldi.o \ + $(portdir)/source/fat/m3sd.o # $(portdir)/source/fat/io_cf_common.o $(portdir)/source/fat/io_m3_common.o\ # $(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \ # $(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o -LIBCARTRESET_OBJS := -#$(portdir)/source/libcartreset/cartreset.o - # Files in this list will be optimisied for speed, otherwise they will be optimised for space -OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp script.cpp +OPTLIST := actor.cpp dsmain.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp script.cpp #OPTLIST := # Compiler options for files which should be optimised for speed @@ -333,18 +345,14 @@ ifdef DS_BUILD_E # Another attempt to save some RAM in ITE OPT_SPEED := -O3 -mthumb else - #OPT_SPEED := -O3 - OPT_SPEED := -Os -mthumb + OPT_SPEED := -O3 endif # Compiler options for files which should be optimised for space OPT_SIZE := -Os -mthumb -#-mthumb -fno-gcse -fno-schedule-insns2 - - -OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) +OBJS := $(DATA_OBJS) $(PORT_OBJS) $(FAT_OBJS) diff --git a/backends/platform/ds/arm9/source/compressor/lz.cpp b/backends/platform/ds/arm9/source/compressor/lz.cpp deleted file mode 100644 index 47a36646c6..0000000000 --- a/backends/platform/ds/arm9/source/compressor/lz.cpp +++ /dev/null @@ -1,539 +0,0 @@ -/************************************************************************* -* Name: lz.c -* Author: Marcus Geelnard -* Description: LZ77 coder/decoder implementation. -* Reentrant: Yes -* $Id$ -* -* The LZ77 compression scheme is a substitutional compression scheme -* proposed by Abraham Lempel and Jakob Ziv in 1977. It is very simple in -* its design, and uses no fancy bit level compression. -* -* This is my first attempt at an implementation of a LZ77 code/decoder. -* -* The principle of the LZ77 compression algorithm is to store repeated -* occurrences of strings as references to previous occurrences of the same -* string. The point is that the reference consumes less space than the -* string itself, provided that the string is long enough (in this -* implementation, the string has to be at least 4 bytes long, since the -* minimum coded reference is 3 bytes long). Also note that the term -* "string" refers to any kind of byte sequence (it does not have to be -* an ASCII string, for instance). -* -* The coder uses a brute force approach to finding string matches in the -* history buffer (or "sliding window", if you wish), which is very, very -* slow. I recon the complexity is somewhere between O(n^2) and O(n^3), -* depending on the input data. -* -* There is also a faster implementation that uses a large working buffer -* in which a "jump table" is stored, which is used to quickly find -* possible string matches (see the source code for LZ_CompressFast() for -* more information). The faster method is an order of magnitude faster, -* and also does a full string search in the entire input buffer (it does -* not use a sliding window). -* -* The upside is that decompression is very fast, and the compression ratio -* is often very good. -* -* The reference to a string is coded as a (length,offset) pair, where the -* length indicates the length of the string, and the offset gives the -* offset from the current data position. To distinguish between string -* references and literal strings (uncompressed bytes), a string reference -* is preceded by a marker byte, which is chosen as the least common byte -* symbol in the input data stream (this marker byte is stored in the -* output stream as the first byte). -* -* Occurrences of the marker byte in the stream are encoded as the marker -* byte followed by a zero byte, which means that occurrences of the marker -* byte have to be coded with two bytes. -* -* The lengths and offsets are coded in a variable length fashion, allowing -* values of any magnitude (up to 4294967295 in this implementation). -* -* With this compression scheme, the worst case compression result is -* (257/256)*insize + 1. -* -*------------------------------------------------------------------------- -* Copyright (c) 2003-2004 Marcus Geelnard -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would -* be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not -* be misrepresented as being the original software. -* -* 3. This notice may not be removed or altered from any source -* distribution. -* -* Marcus Geelnard -* marcus.geelnard at home.se -*************************************************************************/ - - -/************************************************************************* -* Constants used for LZ77 coding -*************************************************************************/ - -/* Maximum offset (can be any size < 2^32). Lower values gives faster - compression, while higher values gives better compression. - NOTE: LZ_CompressFast does not use this constant. */ -#define LZ_MAX_OFFSET 512 - - - -/************************************************************************* -* INTERNAL FUNCTIONS * -*************************************************************************/ - - -/************************************************************************* -* _LZ_StringCompare() - Return maximum length string match. -*************************************************************************/ - -inline static unsigned int _LZ_StringCompare( unsigned char * str1, - unsigned char * str2, unsigned int minlen, unsigned int maxlen ) -{ - unsigned int len; - - for ( len = minlen; (len < maxlen) && (str1[len] == str2[len]); ++ len ); - - return len; -} - - -/************************************************************************* -* _LZ_WriteVarSize() - Write unsigned integer with variable number of -* bytes depending on value. -*************************************************************************/ - -inline static int _LZ_WriteVarSize( unsigned int x, unsigned char * buf ) -{ - unsigned int y; - int num_bytes, i, b; - - /* Determine number of bytes needed to store the number x */ - y = x >> 3; - for ( num_bytes = 5; num_bytes >= 2; -- num_bytes ) - { - if ( y & 0xfe000000 ) break; - y <<= 7; - } - - /* Write all bytes, seven bits in each, with 8:th bit set for all */ - /* but the last byte. */ - for ( i = num_bytes-1; i >= 0; -- i ) - { - b = (x >> (i*7)) & 0x0000007f; - if ( i > 0 ) - { - b |= 0x00000080; - } - *buf ++ = (unsigned char) b; - } - - /* Return number of bytes written */ - return num_bytes; -} - - -/************************************************************************* -* _LZ_ReadVarSize() - Read unsigned integer with variable number of -* bytes depending on value. -*************************************************************************/ - -inline static int _LZ_ReadVarSize( unsigned int * x, unsigned char * buf ) -{ - unsigned int y, b, num_bytes; - - /* Read complete value (stop when byte contains zero in 8:th bit) */ - y = 0; - num_bytes = 0; - do - { - b = (unsigned int) (*buf ++); - y = (y << 7) | (b & 0x0000007f); - ++ num_bytes; - } - while ( b & 0x00000080 ); - - /* Store value in x */ - *x = y; - - /* Return number of bytes read */ - return num_bytes; -} - - - -/************************************************************************* -* PUBLIC FUNCTIONS * -*************************************************************************/ - - -/************************************************************************* -* LZ_Compress() - Compress a block of data using an LZ77 coder. -* in - Input (uncompressed) buffer. -* out - Output (compressed) buffer. This buffer must be 0.4% larger -* than the input buffer, plus one byte. -* insize - Number of input bytes. -* The function returns the size of the compressed data. -*************************************************************************/ - -int LZ_Compress( unsigned char *in, unsigned char *out, - unsigned int insize ) -{ - unsigned char marker, symbol; - unsigned int inpos, outpos, bytesleft, i; - unsigned int maxoffset, offset, bestoffset; - unsigned int maxlength, length, bestlength; - unsigned int histogram[ 256 ]; - unsigned char *ptr1, *ptr2; - - /* Do we have anything to compress? */ - if ( insize < 1 ) - { - return 0; - } - - /* Create histogram */ - for ( i = 0; i < 256; ++ i ) - { - histogram[ i ] = 0; - } - for ( i = 0; i < insize; ++ i ) - { - ++ histogram[ in[ i ] ]; - } - - /* Find the least common byte, and use it as the code marker */ - marker = 0; - for ( i = 1; i < 256; ++ i ) - { - if ( histogram[ i ] < histogram[ marker ] ) - { - marker = i; - } - } - - /* Remember the repetition marker for the decoder */ - out[ 0 ] = marker; - - /* Start of compression */ - inpos = 0; - outpos = 1; - - /* Main compression loop */ - bytesleft = insize; - do - { - /* Determine most distant position */ - if ( inpos > LZ_MAX_OFFSET ) maxoffset = LZ_MAX_OFFSET; - else maxoffset = inpos; - - /* Get pointer to current position */ - ptr1 = &in[ inpos ]; - - /* Search history window for maximum length string match */ - bestlength = 3; - bestoffset = 0; - for ( offset = 3; offset <= maxoffset; ++ offset ) - { - /* Get pointer to candidate string */ - ptr2 = &ptr1[ -offset ]; - - /* Quickly determine if this is a candidate (for speed) */ - if ( (ptr1[ 0 ] == ptr2[ 0 ]) && - (ptr1[ bestlength ] == ptr2[ bestlength ]) ) - { - /* Determine maximum length for this offset */ - maxlength = (bytesleft < offset ? bytesleft : offset); - - /* Count maximum length match at this offset */ - length = _LZ_StringCompare( ptr1, ptr2, 0, maxlength ); - - /* Better match than any previous match? */ - if ( length > bestlength ) - { - bestlength = length; - bestoffset = offset; - } - } - } - - /* Was there a good enough match? */ - if ( (bestlength >= 8) || - ((bestlength == 4) && (bestoffset <= 0x0000007f)) || - ((bestlength == 5) && (bestoffset <= 0x00003fff)) || - ((bestlength == 6) && (bestoffset <= 0x001fffff)) || - ((bestlength == 7) && (bestoffset <= 0x0fffffff)) ) - { - out[ outpos ++ ] = (unsigned char) marker; - outpos += _LZ_WriteVarSize( bestlength, &out[ outpos ] ); - outpos += _LZ_WriteVarSize( bestoffset, &out[ outpos ] ); - inpos += bestlength; - bytesleft -= bestlength; - } - else - { - /* Output single byte (or two bytes if marker byte) */ - symbol = in[ inpos ++ ]; - out[ outpos ++ ] = symbol; - if ( symbol == marker ) - { - out[ outpos ++ ] = 0; - } - -- bytesleft; - } - } - while ( bytesleft > 3 ); - - /* Dump remaining bytes, if any */ - while ( inpos < insize ) - { - if ( in[ inpos ] == marker ) - { - out[ outpos ++ ] = marker; - out[ outpos ++ ] = 0; - } - else - { - out[ outpos ++ ] = in[ inpos ]; - } - ++ inpos; - } - - return outpos; -} - - -/************************************************************************* -* LZ_CompressFast() - Compress a block of data using an LZ77 coder. -* in - Input (uncompressed) buffer. -* out - Output (compressed) buffer. This buffer must be 0.4% larger -* than the input buffer, plus one byte. -* insize - Number of input bytes. -* work - Pointer to a temporary buffer (internal working buffer), which -* must be able to hold (insize+65536) unsigned integers. -* The function returns the size of the compressed data. -*************************************************************************/ - -int LZ_CompressFast( unsigned char *in, unsigned char *out, - unsigned int insize, unsigned int *work ) -{ - unsigned char marker, symbol; - unsigned int inpos, outpos, bytesleft, i, index, symbols; - unsigned int offset, bestoffset; - unsigned int maxlength, length, bestlength; - unsigned int histogram[ 256 ], *lastindex, *jumptable; - unsigned char *ptr1, *ptr2; - - /* Do we have anything to compress? */ - if ( insize < 1 ) - { - return 0; - } - - /* Assign arrays to the working area */ - lastindex = work; - jumptable = &work[ 65536 ]; - - /* Build a "jump table". Here is how the jump table works: - jumptable[i] points to the nearest previous occurrence of the same - symbol pair as in[i]:in[i+1], so in[i] == in[jumptable[i]] and - in[i+1] == in[jumptable[i]+1]. Following the jump table gives a - dramatic boost for the string search'n'match loop compared to doing - a brute force search. */ - for ( i = 0; i < 65536; ++ i ) - { - lastindex[ i ] = 0xffffffff; - } - for ( i = 0; i < insize-1; ++ i ) - { - symbols = (((unsigned int)in[i]) << 8) | ((unsigned int)in[i+1]); - index = lastindex[ symbols ]; - lastindex[ symbols ] = i; - jumptable[ i ] = index; - } - jumptable[ insize-1 ] = 0xffffffff; - - /* Create histogram */ - for ( i = 0; i < 256; ++ i ) - { - histogram[ i ] = 0; - } - for ( i = 0; i < insize; ++ i ) - { - ++ histogram[ in[ i ] ]; - } - - /* Find the least common byte, and use it as the code marker */ - marker = 0; - for ( i = 1; i < 256; ++ i ) - { - if ( histogram[ i ] < histogram[ marker ] ) - { - marker = i; - } - } - - /* Remember the repetition marker for the decoder */ - out[ 0 ] = marker; - - /* Start of compression */ - inpos = 0; - outpos = 1; - - /* Main compression loop */ - bytesleft = insize; - do - { - /* Get pointer to current position */ - ptr1 = &in[ inpos ]; - - /* Search history window for maximum length string match */ - bestlength = 3; - bestoffset = 0; - index = jumptable[ inpos ]; - while ( index != 0xffffffff ) - { - /* Get pointer to candidate string */ - ptr2 = &in[ index ]; - - /* Quickly determine if this is a candidate (for speed) */ - if ( ptr2[ bestlength ] == ptr1[ bestlength ] ) - { - /* Determine maximum length for this offset */ - offset = inpos - index; - maxlength = (bytesleft < offset ? bytesleft : offset); - - /* Count maximum length match at this offset */ - length = _LZ_StringCompare( ptr1, ptr2, 2, maxlength ); - - /* Better match than any previous match? */ - if ( length > bestlength ) - { - bestlength = length; - bestoffset = offset; - } - } - - /* Get next possible index from jump table */ - index = jumptable[ index ]; - } - - /* Was there a good enough match? */ - if ( (bestlength >= 8) || - ((bestlength == 4) && (bestoffset <= 0x0000007f)) || - ((bestlength == 5) && (bestoffset <= 0x00003fff)) || - ((bestlength == 6) && (bestoffset <= 0x001fffff)) || - ((bestlength == 7) && (bestoffset <= 0x0fffffff)) ) - { - out[ outpos ++ ] = (unsigned char) marker; - outpos += _LZ_WriteVarSize( bestlength, &out[ outpos ] ); - outpos += _LZ_WriteVarSize( bestoffset, &out[ outpos ] ); - inpos += bestlength; - bytesleft -= bestlength; - } - else - { - /* Output single byte (or two bytes if marker byte) */ - symbol = in[ inpos ++ ]; - out[ outpos ++ ] = symbol; - if ( symbol == marker ) - { - out[ outpos ++ ] = 0; - } - -- bytesleft; - } - } - while ( bytesleft > 3 ); - - /* Dump remaining bytes, if any */ - while ( inpos < insize ) - { - if ( in[ inpos ] == marker ) - { - out[ outpos ++ ] = marker; - out[ outpos ++ ] = 0; - } - else - { - out[ outpos ++ ] = in[ inpos ]; - } - ++ inpos; - } - - return outpos; -} - - -/************************************************************************* -* LZ_Uncompress() - Uncompress a block of data using an LZ77 decoder. -* in - Input (compressed) buffer. -* out - Output (uncompressed) buffer. This buffer must be large -* enough to hold the uncompressed data. -* insize - Number of input bytes. -*************************************************************************/ - -void LZ_Uncompress( unsigned char *in, unsigned char *out, - unsigned int insize ) -{ - unsigned char marker, symbol; - unsigned int i, inpos, outpos, length, offset; - - /* Do we have anything to compress? */ - if ( insize < 1 ) - { - return; - } - - /* Get marker symbol from input stream */ - marker = in[ 0 ]; - inpos = 1; - - /* Main decompression loop */ - outpos = 0; - do - { - symbol = in[ inpos ++ ]; - if ( symbol == marker ) - { - /* We had a marker byte */ - if ( in[ inpos ] == 0 ) - { - /* It was a single occurrence of the marker byte */ - out[ outpos ++ ] = marker; - ++ inpos; - } - else - { - /* Extract true length and offset */ - inpos += _LZ_ReadVarSize( &length, &in[ inpos ] ); - inpos += _LZ_ReadVarSize( &offset, &in[ inpos ] ); - - /* Copy corresponding data from history window */ - for ( i = 0; i < length; ++ i ) - { - out[ outpos ] = out[ outpos - offset ]; - ++ outpos; - } - } - } - else - { - /* No marker, plain copy */ - out[ outpos ++ ] = symbol; - } - } - while ( inpos < insize ); -} diff --git a/backends/platform/ds/arm9/source/compressor/lz.h b/backends/platform/ds/arm9/source/compressor/lz.h deleted file mode 100644 index e7ea1567ca..0000000000 --- a/backends/platform/ds/arm9/source/compressor/lz.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -* Name: lz.h -* Author: Marcus Geelnard -* Description: LZ77 coder/decoder interface. -* Reentrant: Yes -* $Id$ -*------------------------------------------------------------------------- -* Copyright (c) 2003-2004 Marcus Geelnard -* -* This software is provided 'as-is', without any express or implied -* warranty. In no event will the authors be held liable for any damages -* arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, -* including commercial applications, and to alter it and redistribute it -* freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not -* claim that you wrote the original software. If you use this software -* in a product, an acknowledgment in the product documentation would -* be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not -* be misrepresented as being the original software. -* -* 3. This notice may not be removed or altered from any source -* distribution. -* -* Marcus Geelnard -* marcus.geelnard at home.se -*************************************************************************/ - -#ifndef _lz_h_ -#define _lz_h_ - - - -/************************************************************************* -* Function prototypes -*************************************************************************/ - -int LZ_Compress( unsigned char *in, unsigned char *out, - unsigned int insize ); -int LZ_CompressFast( unsigned char *in, unsigned char *out, - unsigned int insize, unsigned int *work ); -void LZ_Uncompress( unsigned char *in, unsigned char *out, - unsigned int insize ); - - -#endif /* _lz_h_ */ diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 8d51eff3da..95bfdfe40a 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -73,8 +73,6 @@ -//#define USE_LIBCARTRESET - #include #include #include @@ -100,9 +98,7 @@ #ifdef USE_DEBUGGER #include "user_debugger.h" #endif -#include "ramsave.h" #include "blitters.h" -#include "libcartreset/cartreset_nolibfat.h" #include "keys.h" #ifdef USE_PROFILER #include "profiler/cyg-profile.h" @@ -2775,31 +2771,6 @@ GLvector getPenPos() { return v; } -#ifdef GBA_SRAM_SAVE - -void formatSramOption() { - consolePrintf("The following files are present in save RAM:\n"); - DSSaveFileManager::instance()->listFiles(); - - consolePrintf("\nAre you sure you want to\n"); - consolePrintf("DELETE all files?\n"); - consolePrintf("A = Yes, X = No\n"); - - while (true) { - if (keysHeld() & KEY_A) { - DSSaveFileManager::instance()->formatSram(); - consolePrintf("SRAM cleared!\n"); - return; - } - - if (keysHeld() & KEY_X) { - consolePrintf("Whew, that was close!\n"); - return; - } - } -} -#endif - void setIndyFightState(bool st) { indyFightState = st; indyFightRight = true; @@ -2884,61 +2855,6 @@ void debug_print_stub(char *string) { } #endif -#ifdef USE_LIBCARTRESET - -struct cardTranslate { - int cartResetId; - int svmId; - char dldiId[5]; -}; - -cardTranslate cardReaderTable[] = { - {DEVICE_TYPE_M3SD, DEVICE_M3SD, "M3SD"}, - {DEVICE_TYPE_M3CF, DEVICE_M3CF, "M3CF"}, - {DEVICE_TYPE_MPCF, DEVICE_MPCF, "MPCF"}, - {DEVICE_TYPE_SCCF, DEVICE_SCCF, "SCCF"}, - {DEVICE_TYPE_SCSD, DEVICE_SCSD, "SCSD"}, - {DEVICE_TYPE_SCSD, DEVICE_SCSD, "SCLT"}, - {DEVICE_TYPE_NMMC, DEVICE_NMMC, "NMMC"}, -}; - -void reboot() { - int deviceType = -1; - - - if (disc_getDeviceId() == DEVICE_DLDI) { - - char id[6]; - disc_getDldiId(id); - - consolePrintf("DLDI Device ID: %s\n", id); - - for (int r = 0; r < ARRAYSIZE(cardReaderTable); r++) { - if (!stricmp(id, cardReaderTable[r].dldiId)) { - deviceType = cardReaderTable[r].cartResetId; - } - } - } else { - for (int r = 0; r < ARRAYSIZE(cardReaderTable); r++) { - if (disc_getDeviceId() == cardReaderTable[r].svmId) { - deviceType = cardReaderTable[r].cartResetId; - } - } - } - - - consolePrintf("Device number: %x\n", deviceType); - - if (deviceType == -1) { - IPC->reset = true; // Send message to ARM7 to turn power off - } else { - cartSetMenuMode(deviceType); - passmeloopEnter(); - } - - while (true); // Stop the program continuing beyond this point -} -#endif void powerOff() { while (keysHeld() != 0) { // Wait for all keys to be released. @@ -2953,12 +2869,10 @@ void powerOff() { while (true); } else { -#ifdef USE_LIBCARTRESET - reboot(); -#else IPC->reset = true; // Send message to ARM7 to turn power off - while (true); // Stop the program continuing beyond this point -#endif + while (true) { + // Stop the program from continuing beyond this point + } } } @@ -2979,7 +2893,7 @@ void dsExceptionHandler() { int offset = 8; - if ( currentMode == 0x17 ) { + if (currentMode == 0x17) { consolePrintf("\x1b[10Cdata abort!\n\n"); codeAddress = exceptionRegisters[15] - offset; if ( (codeAddress > 0x02000000 && codeAddress < 0x02400000) || @@ -3002,16 +2916,19 @@ void dsExceptionHandler() { int i; - for ( i=0; i < 8; i++ ) { + for (i = 0; i < 8; i++) { consolePrintf(" %s: %08X %s: %08X\n", registerNames[i], exceptionRegisters[i], registerNames[i+8],exceptionRegisters[i+8]); } - while(1); + + while(1) + ; // endles loop + u32 *stack = (u32 *)exceptionRegisters[13]; - for ( i=0; i<10; i++ ) { + for (i = 0; i < 10; i++) { consolePrintf("%08X %08X %08X\n", stack[i*3], stack[i*3+1], stack[(i*3)+2] ); } @@ -3262,12 +3179,6 @@ int main(void) { g_system = new OSystem_DS(); assert(g_system); -#ifdef GBA_SRAM_SAVE - if ((keysHeld() & KEY_L) && (keysHeld() & KEY_R)) { - formatSramOption(); - } -#endif - IPC->adpcm.semaphore = false; // printf("'%s'", Common::ConfigManager::kTransientDomain.c_str()); diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h index fd16b72e4c..ad929236cd 100644 --- a/backends/platform/ds/arm9/source/gbampsave.h +++ b/backends/platform/ds/arm9/source/gbampsave.h @@ -27,6 +27,7 @@ #define _GBAMPSAVE_H_ #include "common/system.h" +#include "common/savefile.h" #include "backends/fs/ds/ds-fs.h" #define SAVE_BUFFER_SIZE 100000 diff --git a/backends/platform/ds/arm9/source/libcartreset/cartreset.c b/backends/platform/ds/arm9/source/libcartreset/cartreset.c deleted file mode 100644 index 6fb906b86d..0000000000 --- a/backends/platform/ds/arm9/source/libcartreset/cartreset.c +++ /dev/null @@ -1,107 +0,0 @@ -/********************************** - Copyright (C) Rick Wong (Lick) - http://licklick.wordpress.com/ -***********************************/ -#include - - -#ifdef ARM9 - -bool cartSetMenuMode(u32 _deviceType) -{ - *(vu16*)(0x04000204) &= ~0x0880; //sysSetBusOwners(true, true); - u32 deviceType = _deviceType; - - *((vu32*)0x027FFFF8) = 0x080000C0; // ARM7 reset address - - if(deviceType == DEVICE_TYPE_EFA2) - { - *(u16 *)0x9FE0000 = 0xD200; - *(u16 *)0x8000000 = 0x1500; - *(u16 *)0x8020000 = 0xD200; - *(u16 *)0x8040000 = 0x1500; - *(u16 *)0x9880000 = 1 << 15; - *(u16 *)0x9FC0000 = 0x1500; - return true; - } - else if(deviceType == DEVICE_TYPE_MPCF) - { - return true; - } - else if(deviceType == DEVICE_TYPE_EZSD) - { - return true; - } - else if(deviceType == DEVICE_TYPE_M3CF || deviceType == DEVICE_TYPE_M3SD) - { - u32 mode = 0x00400004; - vu16 tmp; - tmp = *(vu16*)(0x08E00002); - tmp = *(vu16*)(0x0800000E); - tmp = *(vu16*)(0x08801FFC); - tmp = *(vu16*)(0x0800104A); - tmp = *(vu16*)(0x08800612); - tmp = *(vu16*)(0x08000000); - tmp = *(vu16*)(0x08801B66); - tmp = *(vu16*)(0x08000000 + (mode << 1)); - tmp = *(vu16*)(0x0800080E); - tmp = *(vu16*)(0x08000000); - - tmp = *(vu16*)(0x080001E4); - tmp = *(vu16*)(0x080001E4); - tmp = *(vu16*)(0x08000188); - tmp = *(vu16*)(0x08000188); - return true; - } - else if(deviceType == DEVICE_TYPE_SCCF || deviceType == DEVICE_TYPE_SCSD) - { - *(vu16*)0x09FFFFFE = 0xA55A; - *(vu16*)0x09FFFFFE = 0xA55A; - *(vu16*)0x09FFFFFE = 0; - *(vu16*)0x09FFFFFE = 0; - *((vu32*)0x027FFFF8) = 0x08000000; // Special ARM7 reset address - return true; - } - - return false; -} - - - -void passmeloopEnter() -{ - *(vu16*)(0x04000208) = 0; //REG_IME = IME_DISABLE; - *(vu16*)(0x04000204) |= 0x0880; //sysSetBusOwners(false, false); - *((vu32*)0x027FFFFC) = 0; - *((vu32*)0x027FFE04) = (u32)0xE59FF018; - *((vu32*)0x027FFE24) = (u32)0x027FFE04; - asm("swi 0x00"); //swiSoftReset(); - asm("bx lr"); -} - -#endif - - -#ifdef ARM7 - -bool passmeloopQuery() -{ - if(*((vu32*)0x027FFE24) == (u32)0x027FFE04) - return true; - return false; -} - - - -void cartExecute() -{ - *(vu16*)(0x04000208) = 0; //REG_IME = IME_DISABLE; - *((vu32*)0x027FFE34) = *((vu32*)0x027FFFF8); - asm("swi 0x00"); //swiSoftReset(); - asm("bx lr"); -} - -#endif - - - diff --git a/backends/platform/ds/arm9/source/libcartreset/cartreset_nolibfat.h b/backends/platform/ds/arm9/source/libcartreset/cartreset_nolibfat.h deleted file mode 100644 index ddc4b1d4c2..0000000000 --- a/backends/platform/ds/arm9/source/libcartreset/cartreset_nolibfat.h +++ /dev/null @@ -1,57 +0,0 @@ -/********************************** - Copyright (C) Rick Wong (Lick) - http://licklick.wordpress.com/ -***********************************/ -#ifndef CARTRESET_H -#define CARTRESET_H - -//#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef ARM9 -// Auto detect: -#define DEVICE_TYPE_AUTO 0x00000000 // doesn't work in libcartreset "nolibfat" version - -// Not supported: -#define DEVICE_TYPE_FCSR 0x52534346 -#define DEVICE_TYPE_MMCF 0x46434D4D -#define DEVICE_TYPE_NJSD 0x44534A4E -#define DEVICE_TYPE_NMMC 0x434D4D4E - -// Supported: -#define DEVICE_TYPE_EFA2 0x32414645 -#define DEVICE_TYPE_MPCF 0x4643504D -#define DEVICE_TYPE_M3CF 0x4643334D -#define DEVICE_TYPE_M3SD 0x4453334D -#define DEVICE_TYPE_SCCF 0x46434353 -#define DEVICE_TYPE_SCSD 0x44534353 - -// Supported, but libfat doesn't detect the device: -#define DEVICE_TYPE_EZSD 0x44535A45 - - -bool cartSetMenuMode(u32 _deviceType); -void passmeloopEnter(); - -#endif - - -#ifdef ARM7 - -bool passmeloopQuery(); -void cartExecute(); - -#endif - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 09617c17b0..55475b0bff 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -729,26 +729,10 @@ void OSystem_DS::quit() { } Common::SaveFileManager *OSystem_DS::getSavefileManager() { - bool forceSram; - - if (ConfMan.hasKey("forcesramsave", "ds")) { - forceSram = ConfMan.getBool("forcesramsave", "ds"); - } else { - forceSram = false; - } - if (forceSram) { - consolePrintf("Using SRAM save method!\n"); - } - - if (DS::isGBAMPAvailable() && (!forceSram)) { + if (DS::isGBAMPAvailable()) { return &mpSaveManager; - } else { -#ifdef GBA_SRAM_SAVE - return &saveManager; -#else - return NULL; -#endif } + return NULL; } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index a899c966fc..65ac3f4f7e 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -30,7 +30,6 @@ #include "backends/base-backend.h" #include "common/events.h" #include "nds.h" -#include "ramsave.h" #include "gbampsave.h" #include "backends/saves/default/default-saves.h" #include "backends/timer/default/default-timer.h" @@ -47,9 +46,6 @@ protected: Common::Event eventQueue[96]; int queuePos; -#ifdef GBA_SRAM_SAVE - DSSaveFileManager saveManager; -#endif GBAMPSaveFileManager mpSaveManager; Audio::MixerImpl *_mixer; DefaultTimerManager *_timer; diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp deleted file mode 100644 index d8e74d7445..0000000000 --- a/backends/platform/ds/arm9/source/ramsave.cpp +++ /dev/null @@ -1,538 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ -#ifdef GBA_SRAM_SAVE - - -#include "ramsave.h" -#include "nds.h" -#include "compressor/lz.h" - -#define CART_RAM ((vu8 *) (0x0A000000)) -#define SRAM_SAVE_MAX (65533) - -DSSaveFile::DSSaveFile() { - ptr = 0; - saveCompressed = false; - save.isValid = false; - ownsData = false; - isOpenFlag = true; - isTempFile = false; -} - -DSSaveFile::DSSaveFile(SCUMMSave *s, bool compressed, u8 *data) { - save = *s; - saveData = data; - ptr = 0; - saveCompressed = compressed; - isOpenFlag = true; - - if (saveCompressed) { - u8 *uncompressed = new unsigned char[save.size]; - if (!uncompressed) consolePrintf("Out of memory allocating %d!\n", save.size); - LZ_Uncompress(saveData, uncompressed, save.compressedSize); - saveData = uncompressed; - ownsData = true; - saveCompressed = false; -// consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize); - - } else { - ownsData = false; - origHeader = s; - } - - if (save.magic == (int) 0xBEEFCAFE) { - save.isValid = true; - } else { - save.isValid = false; - } - - isTempFile = false; - eosReached = false; -} - -DSSaveFile::~DSSaveFile() { - if (!ownsData) { - *origHeader = save; - DSSaveFileManager::instance()->flushToSaveRAM(); - } - if (ownsData) { - delete[] saveData; - } -} - -bool DSSaveFile::loadFromSaveRAM(vu8 *address) { - - SCUMMSave newSave; - - for (int t = 0; t < (int) sizeof(newSave); t++) { - ((char *) (&newSave))[t] = *(address + t); - } - - if (newSave.magic == 0xBEEFCAFE) { - newSave.isValid = true; - - *((u16 *) (0x4000204)) |= 0x3; - - saveData = new unsigned char[newSave.compressedSize]; - - for (int t = 0; t < (int) newSave.compressedSize; t++) { - ((char *) (saveData))[t] = *(address + t + sizeof(newSave)); - } - - if (ownsData) delete[] this->saveData; - save = newSave; - saveCompressed = true; - this->saveData = saveData; - ownsData = true; - ptr = 0; - - return true; - } - - return false; -} - -void DSSaveFile::compress() { - if (!saveCompressed) { - unsigned char *compBuffer = new unsigned char[(save.size * 110) / 100]; - int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size); - save.compressedSize = compSize; - - - - delete[] saveData; - - // Make the save smaller - saveData = (u8 *) realloc(compBuffer, save.compressedSize); - saveCompressed = true; - } -} - -int DSSaveFile::saveToSaveRAM(vu8 *address) { - - unsigned char *compBuffer; - bool failed; - - - int compSize; - - compress(); - - compSize = save.compressedSize; - compBuffer = saveData; - - if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) { - - DSSaveFileManager::instance()->addBytesFree(-getRamUsage()); - - // Write header - for (int t = 0; t < sizeof(save); t++) { - while (*(address + t) != ((char *) (&save))[t]) { - *(address + t) = ((char *) (&save))[t]; - } - } - - // Write compressed buffer - for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) { - while (*(address + t) != compBuffer[t - sizeof(save)]) { - *(address + t) = compBuffer[t - sizeof(save)]; - } - } - - failed = false; - } else { - failed = true; - } - - - return failed? 0: compSize + sizeof(save); - -} - -void DSSaveFile::reset() { - ptr = 0; - eosReached = false; -} - -uint32 DSSaveFile::read(void *buf, uint32 size) { - if (ptr + size > save.size) { - size = save.size - ptr; - eosReached = true; - if (size < 0) size = 0; - } - memcpy(buf, saveData + ptr, size); -// consolePrintf("byte: %d ", ((u8 *) (buf))[0]); - - ptr += size; - return size; -} - -int32 DSSaveFile::pos() const { - return ptr; -} - -int32 DSSaveFile::size() const { - return save.size; -} - -bool DSSaveFile::seek(int32 pos, int whence) { - switch (whence) { - case SEEK_SET: { - ptr = pos; - break; - } - case SEEK_CUR: { - ptr += pos; - break; - } - case SEEK_END: { - ptr = save.size + pos; - break; - } - } - eosReached = false; - return true; -} - -bool DSSaveFile::eos() const { - return eosReached; -} - -void DSSaveFile::clearErr() { - eosReached = false; -} - -bool DSSaveFile::skip(uint32 bytes) { - ptr = ptr + bytes; - if (ptr > (int) save.size) ptr = save.size; - return true; -} - -uint32 DSSaveFile::write(const void *buf, uint32 size) { - - if (ptr + size > DS_MAX_SAVE_SIZE) { - size = DS_MAX_SAVE_SIZE - ptr; - } - - memcpy(saveData + ptr, buf, size); - ptr += size; - save.size += size; - return size; -} - -bool DSSaveFile::matches(const char *prefix, int num) { - char str[16]; - if (isValid()) { - sprintf(str, "%s%02d", prefix, num); - if (!strcmp(str, save.name)) { - return true; - } else { - return false; - } - } else { - return false; - } -} - -bool DSSaveFile::matches(const char *filename) { - if (isValid()) { - return !strcmp(save.name, filename); - } else { - return false; - } -} - -void DSSaveFile::setName(char *name) { - save.isValid = true; - save.magic = 0xBEEFCAFE; - ownsData = true; - save.size = 0; - save.compressedSize = 0; - saveData = new unsigned char[DS_MAX_SAVE_SIZE]; - strcpy(save.name, name); - - if ((strstr(name, ".s99")) || (strstr(name, ".c"))) { - isTempFile = true; - } else { - isTempFile = false; - } -} - -void DSSaveFile::clearData() { - save.size = 0; - - if (saveCompressed) { - if (ownsData) { - delete[] saveData; - DSSaveFileManager::instance()->addBytesFree(getRamUsage()); - } - saveData = new unsigned char[DS_MAX_SAVE_SIZE]; - saveCompressed = false; - ownsData = true; - } - -} - -void DSSaveFile::deleteFile() { - if (isValid()) { - if (ownsData) { - DSSaveFileManager::instance()->addBytesFree(getRamUsage()); - delete[] saveData; - saveData = NULL; - } - ptr = 0; - saveCompressed = false; - save.isValid = false; - ownsData = false; - isOpenFlag = true; - } -} - -DSSaveFileManager::DSSaveFileManager() { - instancePtr = this; - - *((u16 *) (0x4000204)) |= 0x3; - swiWaitForVBlank(); - - loadAllFromSRAM(); -} - -DSSaveFileManager::~DSSaveFileManager() { - instancePtr = NULL; -} - -void DSSaveFileManager::loadAllFromSRAM() { - int addr = 1; - - for (int r = 0; r < 8; r++) { - gbaSave[r].deleteFile(); - } - - sramBytesFree = SRAM_SAVE_MAX; - - // Try to find saves in save RAM - for (int r = 0; r < 8; r++) { - if (gbaSave[r].loadFromSaveRAM(CART_RAM + addr)) { - addr += gbaSave[r].getRamUsage(); - sramBytesFree -= gbaSave[r].getRamUsage(); - } - } - -} - -void DSSaveFileManager::formatSram() { - for (int r = 0; r < SRAM_SAVE_MAX; r++) { - *(CART_RAM + r) = 0; - } - - loadAllFromSRAM(); -} - -void DSSaveFileManager::listFiles() { - for (int r = 0; r < 8; r++) { - if (gbaSave[r].isValid()) { - consolePrintf("'%s': %d bytes\n", gbaSave[r].getName(), gbaSave[r].getRamUsage()); - } - } - consolePrintf("SRAM free: %d bytes\n", getBytesFree()); -} - -DSSaveFileManager *DSSaveFileManager::instancePtr = NULL; - -DSSaveFile *DSSaveFileManager::openSavefile(const char *filename, bool saveOrLoad) { - for (int r = 0; r < 8; r++) { - if (gbaSave[r].isValid() && (gbaSave[r].matches(filename))) { -// consolePrintf("Matched save %d (%d)\n", r, gbaSave[r].getSize()); - gbaSave[r].reset(); - //consolePrintf("reset "); - if (saveOrLoad) gbaSave[r].clearData(); -// consolePrintf("cleared "); - return gbaSave[r].clone(); - } - } - - if (saveOrLoad) { - return makeSaveFile(filename, saveOrLoad); - } else { - return NULL; - } -} - - - -DSSaveFile *DSSaveFile::clone() { -// consolePrintf("Clone %s %d\n", save.name, save.size); - return new DSSaveFile(&save, saveCompressed, saveData); -} - -void DSSaveFileManager::deleteFile(const char *name) { -// consolePrintf("Deleting %s", name); - for (int r = 0; r < 8; r++) { - if (gbaSave[r].isValid() && (gbaSave[r].matches(name))) { - gbaSave[r].deleteFile(); - } - } - flushToSaveRAM(); -} - -bool DSSaveFileManager::removeSavefile(const Common::String &filename) { - consolePrintf("DSSaveFileManager::removeSavefile : Not implemented yet.\n"); - assert(false); - //TODO: Implement this. Most likely, you just have to use the code of deleteFile? - return false; -} - - -Common::StringArray DSSaveFileManager::listSavefiles(const Common::String &pattern) { - consolePrintf("DSSaveFileManager::listSavefiles : Not implemented yet.\n"); - assert(false); - return Common::StringArray(); - /* - TODO: Implement this. If you don't understand what it should do, just ask - (e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you - use Common::matchString from common/util.h and read the Doxygen docs, - then combine this with the old code below... - */ -} - - -/* -void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) { - memset(marks, true, num * sizeof(bool)); - return; - - memset(marks, false, num*sizeof(bool)); - - for (int saveNum = 0; saveNum < num; saveNum++) { - for (int r = 0; r < 8; r++) { - if (gbaSave[r].isValid() && (gbaSave[r].matches(prefix, saveNum))) { - marks[saveNum] = true; - } - } - } - -} -*/ - - -DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) { - - // Find a free save slot - int r = 0; - - while ((r < 8) && (gbaSave[r].isValid())) { - r++; - } - - if ((r == 8) && (gbaSave[r].isValid())) { - // No more saves - return NULL; - } else { - // Allocate this save -// consolePrintf("Allocated save %d\n", r); - gbaSave[r].setName((char *) filename); - gbaSave[r].reset(); - return gbaSave[r].clone(); - } -} - -void DSSaveFileManager::flushToSaveRAM() { - int cartAddr = 1; - int s; - int extraData = DSSaveFileManager::getExtraData(); - - *((u16 *) (0x4000204)) |= 0x3; - - swiWaitForVBlank(); - - int size = 0; - for (int r = 0; (r < 8); r++) { - if (gbaSave[r].isValid()) { - gbaSave[r].compress(); - if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage(); - } - } - - if (size <= SRAM_SAVE_MAX) { - - for (int r = 0; r < SRAM_SAVE_MAX; r++) { - *(CART_RAM + r) = 0; - } - - sramBytesFree = SRAM_SAVE_MAX; - - for (int r = 0; (r < 8); r++) { - if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) { - - cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr); - - /* if (s == 0) { - consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName()); - failed = true; - }*/ - } - } - } else { - - consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again."); - loadAllFromSRAM(); - - } - - DSSaveFileManager::setExtraData(extraData); -// consolePrintf("SRAM free: %d bytes\n", getBytesFree()); -} - -void DSSaveFileManager::setExtraData(int data) { - // Offset of extra data is 31. This overlaps the padding and reserved bytes of the first save entry. - // which have not been used up until now. So it should be safe. - - vu8 *sram = CART_RAM + 31; - - *(sram + 0) = 0xF0; // This is an identifier to check - *(sram + 1) = 0x0D; // that extra data is present. - - *(sram + 2) = (data & 0xFF000000) >> 24; // Now write the actual data - *(sram + 3) = (data & 0x00FF0000) >> 16; // taking care to use single - *(sram + 4) = (data & 0x0000FF00) >> 8; // byte writes (it's an 8-bit bus) - *(sram + 5) = (data & 0x000000FF); -} - -bool DSSaveFileManager::isExtraDataPresent() { - vu8 *sram = CART_RAM + 31; - - // Check for the identifier - return ((*(sram + 0) == 0xF0) && (*(sram + 1) == 0x0D)); -} - -int DSSaveFileManager::getExtraData() { - vu8 *sram = CART_RAM + 31; - - if (isExtraDataPresent()) { - int value = (*(sram + 2) << 24) | (*(sram + 3) << 16) | (*(sram + 4) << 8) | (*(sram + 5)); - return value; - } else { - return 0; - } -} - -#endif diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h deleted file mode 100644 index f2cfe0fc0b..0000000000 --- a/backends/platform/ds/arm9/source/ramsave.h +++ /dev/null @@ -1,155 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef _RAMSAVE_H_ -#define _RAMSAVE_H_ - -#include -#include "common/system.h" -#include "common/savefile.h" - - -// SaveFileManager class - -#define DS_MAX_SAVE_SIZE 150000 - -class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile { - int address; - int ptr; - bool ownsData; - bool saveCompressed; - - struct SCUMMSave { - u32 magic; // 4 - bool isValid; // 5 - bool pad; // 6 - char name[16]; // 22 - u32 size; // 26 - u32 compressedSize; // 30 - u16 extraMagic; // 32 - u32 reserved; // 36 - } __attribute__ ((packed)); - - SCUMMSave save; - u8 *saveData; - SCUMMSave *origHeader; - bool isOpenFlag; - bool isTempFile; - bool eosReached; - -public: - DSSaveFile(); - DSSaveFile(SCUMMSave *s, bool saveCompressed, u8 *data); - ~DSSaveFile(); - - void reset(); - - bool isOpen() const { return isOpenFlag; } - virtual bool eos() const; - virtual void clearErr(); - virtual bool skip(uint32 size); - - virtual int32 pos() const; - virtual int32 size() const; - virtual bool seek(int32 pos, int whence); - - uint32 read(void *buf, uint32 size); - uint32 write(const void *buf, uint32 size); - - void setName(char *name); - char *getName() { return save.name; } - - bool isValid() { return save.isValid; } - bool isTemp() { return isTempFile; } - bool matches(const char *prefix, int num); - bool matches(const char *filename); - - void clearData(); - void compress(); - - int getRamUsage() { return sizeof(save) + save.compressedSize; } - char *getRamImage() { return (char *) &save; } - - int getSize() { return save.size; } - - DSSaveFile *clone(); - - bool loadFromSaveRAM(vu8 *address); - int saveToSaveRAM(vu8 *address); - - - - void deleteFile(); - - void operator delete(void *p) { -// consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size); - } - - - -}; - - - -class DSSaveFileManager : public Common::SaveFileManager { - - DSSaveFile gbaSave[8]; - static DSSaveFileManager *instancePtr; - int sramBytesFree; - -public: - DSSaveFileManager(); - ~DSSaveFileManager(); - - static DSSaveFileManager *instance() { return instancePtr; } - - DSSaveFile *openSavefile(const char *filename, bool saveOrLoad); - - virtual Common::OutSaveFile *openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); } - virtual Common::InSaveFile *openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); } - - virtual bool removeSavefile(const Common::String &filename); - virtual Common::StringArray listSavefiles(const Common::String &pattern); - - void flushToSaveRAM(); - - void addBytesFree(int size) { sramBytesFree += size; } - int getBytesFree() { return sramBytesFree; } - - void deleteFile(char *name); - void listFiles(); - void formatSram(); - - void loadAllFromSRAM(); - - static bool isExtraDataPresent(); - static int getExtraData(); - static void setExtraData(int data); - -protected: - DSSaveFile *makeSaveFile(const Common::String &filename, bool saveOrLoad); -}; - -#endif diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index e3c18c7174..44cba006df 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -12,7 +12,6 @@ PORT_OBJS := \ arm9/source/gbampsave.o \ arm9/source/scummhelp.o \ arm9/source/osystem_ds.o \ - arm9/source/ramsave.o \ arm9/source/touchkeyboard.o \ arm9/source/zipreader.o \ arm9/source/dsoptions.o \ @@ -27,9 +26,9 @@ DATA_OBJS := \ arm9/data/default_font.o \ arm9/data/8x8font_tga.o -COMPRESSOR_OBJS := #arm9/source/compressor/lz.o - -FAT_OBJS := arm9/source/fat/disc_io.o arm9/source/fat/gba_nds_fat.o\ +FAT_OBJS := \ + arm9/source/fat/disc_io.o \ + arm9/source/fat/gba_nds_fat.o \ arm9/source/fat/io_fcsr.o \ arm9/source/fat/io_m3cf.o \ arm9/source/fat/io_mpcf.o \ @@ -50,12 +49,9 @@ FAT_OBJS := arm9/source/fat/disc_io.o arm9/source/fat/gba_nds_fat.o\ # arm9/source/fat/io_sd_common.o arm9/source/fat/io_scsd_s.o \ # arm9/source/fat/io_sc_common.o arm9/source/fat/io_sd_common.o -LIBCARTRESET_OBJS := \ -# arm9/source/libcartreset/cartreset.o - #MODULE_OBJS := $(PORT_OBJS) $(DATA_OBJS) $(FAT_OBJS) -MODULE_OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS) +MODULE_OBJS := $(DATA_OBJS) $(PORT_OBJS) $(FAT_OBJS) #--------------------------------------------------------------------------------- @@ -113,8 +109,7 @@ MODULE_DIRS += \ backends/platform/ds/arm7/source/ \ backends/platform/ds/arm7/source/libcartreset/ \ backends/platform/ds/arm9/source/ \ - backends/platform/ds/arm9/source/fat/ \ - backends/platform/ds/arm9/source/libcartreset/ + backends/platform/ds/arm9/source/fat/ # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -- cgit v1.2.3 From c4a626931bda67d909f2d836501c3f409cf9b722 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 23:23:19 +0000 Subject: DS: Code formatting svn-id: r50742 --- backends/platform/ds/arm9/source/osystem_ds.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 55475b0bff..c4ff241de0 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -315,7 +315,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int u32 pixelsLeft = w; - if (MISALIGNED16(dest)) { + if (MISALIGNED16(dest)) { // Read modify write dest--; @@ -332,7 +332,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int // We can now assume dest is aligned u16 *dest16 = (u16 *) dest; - for (dx = 0; dx < pixelsLeft; dx+=2) { + for (dx = 0; dx < pixelsLeft; dx+=2) { u16 mix; mix = *src + (*(src + 1) << 8); @@ -367,7 +367,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int u32 pixelsLeft = w; - if (MISALIGNED16(dest)) { + if (MISALIGNED16(dest)) { // Read modify write dest--; @@ -387,7 +387,7 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int u16 *dest16 = (u16 *) dest; u16 *destSub16 = (u16 *) destSub; - for (dx = 0; dx < pixelsLeft; dx+=2) { + for (dx = 0; dx < pixelsLeft; dx+=2) { u16 mix; mix = *src + (*(src + 1) << 8); -- cgit v1.2.3 From 6aa53ba3b8d7bd207aafd1ab4fa2c68b5f3e50b3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 23:23:44 +0000 Subject: DS: Remove cruft from Makefiles svn-id: r50743 --- backends/platform/ds/arm9/makefile | 47 -------------------------------------- backends/platform/ds/module.mk | 6 ----- 2 files changed, 53 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 703d5d69b7..beb55586ac 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -265,12 +265,7 @@ ifdef USE_DEBUGGER LIBS += -ldsdebugger -ldswifi9 endif -#-Lscumm -lscumm -Lbase -lbase -Lcommon -lcommon -Lgraphics -lgraphics -Lgui -lgui -Lsound -lsound EXECUTABLE = scummvm.elf -PLUGIN_PREFIX = -PLUGIN_SUFFIX = .plg -PLUGIN_EXTRA_DEPS = plugin.x plugin.syms scummvm.elf -PLUGIN_LDFLAGS = -nostartfiles -Wl,-q,-Tplugin.x,--just-symbols,scummvm.elf,--retain-symbols-file,plugin.syms -L$(ronindir)/lib MKDIR = mkdir -p RM = rm -f RM_REC = rm -rf @@ -280,12 +275,6 @@ OBJCOPY = arm-eabi-objcopy AS = arm-eabi-as HAVE_GCC3 = true -ifdef DYNAMIC_MODULES -DEFINES += -DDYNAMIC_MODULES -PRE_OBJS_FLAGS = -Wl,--whole-archive -POST_OBJS_FLAGS = -Wl,--no-whole-archive -endif - PORT_OBJS := \ $(portdir)/source/blitters_arm.o \ $(portdir)/source/cdaudio.o \ @@ -332,10 +321,6 @@ FAT_OBJS := $(portdir)/source/fat/m3sd.o -# $(portdir)/source/fat/io_cf_common.o $(portdir)/source/fat/io_m3_common.o\ -# $(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \ -# $(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o - # Files in this list will be optimisied for speed, otherwise they will be optimised for space OPTLIST := actor.cpp dsmain.cpp osystem_ds.cpp blitters.cpp mame.cpp rate.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp script.cpp #OPTLIST := @@ -371,11 +356,6 @@ clean: $(RM) $(OBJS) $(EXECUTABLE) rm -fr $(BUILD) -plugin_dist : - find . -name '*.plg' | while read p; do \ - sh-elf-strip -g -o "`basename \"$$p\" | tr '[:lower:]' '[:upper:]'`" "$$p"; \ - done - dist : SCUMMVM.BIN plugins plugin_dist @@ -394,26 +374,12 @@ endef # Replacement rule for the one in makefile.common ############## %.o: %.cpp -# echo !!!!!!!!!!!! $(notdir $<) -# ifeq ( $(notdir $<), $(findstring $(notdir $<), $(OPTLIST)) ) -# OPTFLAG=-O3 -# else -# OPTFLAG=-Os -# endif -# export OPTFLAG = ; -# echo !!!!!!!! $(OPTFLAG) $(MKDIR) $(*D)/$(DEPDIR) $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(if $(findstring $(notdir $<), $(OPTLIST)), $(OPT_SPEED), $(OPT_SIZE)) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o #--------------------------------------------------------------------------------- -#--------------------------------------------------------------------------------- -%.o : %.pcx -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - #--------------------------------------------------------------------------------- %.o : %.bin #--------------------------------------------------------------------------------- @@ -432,21 +398,8 @@ endef @echo $(notdir $<) @$(bin2o) -#--------------------------------------------------------------------------------- -%.o : %.map -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - -#--------------------------------------------------------------------------------- -%.o : %.mdl -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - #--------------------------------------------------------------------------------- %.nds: %.bin - @echo ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM $(VERSION);DS Port" ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM $(VERSION);DS Port" dsbuild $@ -l ../ndsloader.bin diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index 44cba006df..f6b69b3633 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -45,12 +45,6 @@ FAT_OBJS := \ arm9/source/fat/m3sd.o -# arm9/source/fat/io_cf_common.o arm9/source/fat/io_m3_common.o\ -# arm9/source/fat/io_sd_common.o arm9/source/fat/io_scsd_s.o \ -# arm9/source/fat/io_sc_common.o arm9/source/fat/io_sd_common.o - - -#MODULE_OBJS := $(PORT_OBJS) $(DATA_OBJS) $(FAT_OBJS) MODULE_OBJS := $(DATA_OBJS) $(PORT_OBJS) $(FAT_OBJS) -- cgit v1.2.3 From f6afba1f19b3ebf6242940f1f27c063cd34f4995 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 23:24:08 +0000 Subject: DS: Split buildrule for scummvm.nds and scummvm.ds.gba This parallels what I did in ds.mk svn-id: r50744 --- backends/platform/ds/arm9/makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index beb55586ac..079e23aec0 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -345,7 +345,7 @@ MODULE_DIRS += . ndsall: @[ -d $(BUILD) ] || mkdir -p $(BUILD) - make -C ./$(BUILD) -f ../makefile scummvm.nds + make -C ./$(BUILD) -f ../makefile scummvm.nds scummvm.ds.gba include $(srcdir)/Makefile.common @@ -400,10 +400,11 @@ endef #--------------------------------------------------------------------------------- %.nds: %.bin - ndstool -c $@ -9 scummvm.bin $(ARM7BIN) -b ../../$(LOGO) "$(shell basename $@);ScummVM $(VERSION);DS Port" - dsbuild $@ -l ../ndsloader.bin + ndstool -c $@ -9 $< $(ARM7BIN) -b ../../$(LOGO) "$(@F);ScummVM $(VERSION);DS Port" - padbin 16 $(basename $@).ds.gba +%.ds.gba: %.nds + dsbuild $< -o $@ -l $(portdir)/ndsloader.bin + padbin 16 $@ #--------------------------------------------------------------------------------- %.bin: %.elf -- cgit v1.2.3 From 4237f9a416490137f44928213a4fab090e8438b2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Jul 2010 23:24:29 +0000 Subject: DS: Fix OPT_SPEED and OPT_SIZE usage being reversed; add ARM7 files to 'make clean' svn-id: r50745 --- backends/platform/ds/ds.mk | 52 ++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 66afa01a1f..27309663d1 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -60,40 +60,42 @@ LOGO = logoa.bmp -# Files in this list will be optimisied for speed, otherwise they will be optimised for space # Compiler options for files which should be optimised for speed OPT_SPEED := -O3 # Compiler options for files which should be optimised for space OPT_SIZE := -Os -mthumb +# By default optimize for size +CXXFLAGS += $(OPT_SIZE) -# TODO: The original list contained three more files that should be optimized -# for size: actor.cpp gfx.cpp sprite.cpp -- but there are many files with these +# Files listed below will be optimisied for speed, otherwise they will be optimised for space +# TODO: speed original list contained three more files that should be optimized +# for speed: actor.cpp gfx.cpp sprite.cpp -- but there are many files with these # names, which are the "right" ones? -$(ndsdir)/arm9/source/dsmain.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -$(ndsdir)/arm9/source/osystem_ds.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -$(ndsdir)/arm9/source/blitters.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -$(ndsdir)/arm9/source/ds_main.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/isomap.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -sound/rate.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/actor_walk.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/actor_path.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/image.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -sound/fmopl.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/scumm/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/m4/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/scumm/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/cine/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/agos/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/saga/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/m4/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) -engines/agi/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +$(ndsdir)/arm9/source/dsmain.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +$(ndsdir)/arm9/source/osystem_ds.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +$(ndsdir)/arm9/source/blitters.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +$(ndsdir)/arm9/source/ds_main.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/isomap.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +sound/rate.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/actor_walk.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/actor_path.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/image.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +sound/fmopl.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/scumm/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/m4/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/scumm/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/cine/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/agos/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/m4/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/agi/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) # TODO: Fingolfin says: optimizing staticres for size would # save about 30k, so maybe consider that? -#engines/kyra/staticres.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SIZE) +#engines/kyra/staticres.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) @@ -108,7 +110,7 @@ all: scummvm.nds scummvm.ds.gba clean: dsclean dsclean: - $(RM) scummvm.nds scummvm.ds.gba + $(RM) $(addprefix $(ndsdir)/, $(ARM7_MODULE_OBJS)) scummvm.nds scummvm.ds.gba .PHONY: dsclean -- cgit v1.2.3 From 8e9d933658bce3b613879b4679321b1c71cfffd4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Jul 2010 23:18:44 +0000 Subject: SDL: Overhaul OSystem_SDL::getSupportedFormats * Do not use global constructor for the RGBList and BGRList tables anymore, by moving them inside a function. * Update the list of supported formats if the hardware screen surface changes. Previously, the list of supported pixel formats (and its order) was computed only once and then never changed. svn-id: r50832 --- backends/platform/sdl/graphics.cpp | 100 +++++++++++++++++++++---------------- backends/platform/sdl/sdl.h | 7 +++ 2 files changed, 64 insertions(+), 43 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 05870015cb..f48800f0d8 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -214,42 +214,54 @@ OSystem::TransactionError OSystem_SDL::endGFXTransaction() { } #ifdef USE_RGB_COLOR -const Graphics::PixelFormat RGBList[] = { + +Common::List OSystem_SDL::getSupportedFormats() const { + assert(!_supportedFormats.empty()); + return _supportedFormats; +} + +void OSystem_SDL::detectSupportedFormats() { + + // Clear old list + _supportedFormats.clear(); + + // Some tables with standard formats that we always list + // as "supported". If frontend code tries to use one of + // these, we will perform the necessary format + // conversion in the background. Of course this incurs a + // performance hit, but on desktop ports this should not + // matter. We still push the currently active format to + // the front, so if frontend code just uses the first + // available format, it will get one that is "cheap" to + // use. + const Graphics::PixelFormat RGBList[] = { #ifdef ENABLE_32BIT - // RGBA8888, ARGB8888, RGB888 - Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), - Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24), - Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), + // RGBA8888, ARGB8888, RGB888 + Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), + Graphics::PixelFormat(4, 8, 8, 8, 8, 16, 8, 0, 24), + Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0), #endif - // RGB565, XRGB1555, RGB555, RGBA4444, ARGB4444 - Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), - Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15), - Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), - Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), - Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12) -}; -const Graphics::PixelFormat BGRList[] = { + // RGB565, XRGB1555, RGB555, RGBA4444, ARGB4444 + Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), + Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15), + Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), + Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0), + Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12) + }; + const Graphics::PixelFormat BGRList[] = { #ifdef ENABLE_32BIT - // ABGR8888, BGRA8888, BGR888 - Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), - Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0), - Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0), + // ABGR8888, BGRA8888, BGR888 + Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24), + Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0), + Graphics::PixelFormat(3, 8, 8, 8, 0, 0, 8, 16, 0), #endif - // BGR565, XBGR1555, BGR555, ABGR4444, BGRA4444 - Graphics::PixelFormat(2, 5, 6, 5, 0, 0, 5, 11, 0), - Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15), - Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0), - Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12), - Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0) -}; - -// TODO: prioritize matching alpha masks -Common::List OSystem_SDL::getSupportedFormats() const { - static Common::List list; - static bool inited = false; - - if (inited) - return list; + // BGR565, XBGR1555, BGR555, ABGR4444, BGRA4444 + Graphics::PixelFormat(2, 5, 6, 5, 0, 0, 5, 11, 0), + Graphics::PixelFormat(2, 5, 5, 5, 1, 0, 5, 10, 15), + Graphics::PixelFormat(2, 5, 5, 5, 0, 0, 5, 10, 0), + Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12), + Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0) + }; bool BGR = false; int listLength = ARRAYSIZE(RGBList); @@ -268,31 +280,29 @@ Common::List OSystem_SDL::getSupportedFormats() const { format.aLoss = 8; // Push it first, as the prefered format. - list.push_back(format); + _supportedFormats.push_back(format); if (format.bShift > format.rShift) BGR = true; - - // Mark that we don't need to do this any more. - inited = true; } + // TODO: prioritize matching alpha masks for (int i = 0; i < listLength; i++) { - if (inited && (RGBList[i].bytesPerPixel > format.bytesPerPixel)) + if (_hwscreen && (RGBList[i].bytesPerPixel > format.bytesPerPixel)) continue; if (BGR) { if (BGRList[i] != format) - list.push_back(BGRList[i]); - list.push_back(RGBList[i]); + _supportedFormats.push_back(BGRList[i]); + _supportedFormats.push_back(RGBList[i]); } else { if (RGBList[i] != format) - list.push_back(RGBList[i]); - list.push_back(BGRList[i]); + _supportedFormats.push_back(RGBList[i]); + _supportedFormats.push_back(BGRList[i]); } } - list.push_back(Graphics::PixelFormat::createFormatCLUT8()); - return list; + _supportedFormats.push_back(Graphics::PixelFormat::createFormatCLUT8()); } + #endif bool OSystem_SDL::setGraphicsMode(int mode) { @@ -574,6 +584,10 @@ bool OSystem_SDL::loadGFXMode() { _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16, _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE ); +#ifdef USE_RGB_COLOR + detectSupportedFormats(); +#endif + if (_hwscreen == NULL) { // DON'T use error(), as this tries to bring up the debug // console, which WON'T WORK now that _hwscreen is hosed. diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 480e0af41b..5c901ba711 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -274,6 +274,13 @@ protected: #ifdef USE_RGB_COLOR Graphics::PixelFormat _screenFormat; Graphics::PixelFormat _cursorFormat; + Common::List _supportedFormats; + + /** + * Update the list of supported pixel formats. + * This method is invoked by loadGFXMode(). + */ + void detectSupportedFormats(); #endif // temporary screen (for scalers) -- cgit v1.2.3 From e2c1ee853a1cd1ce56536a4b4436a8da5277d0cb Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Jul 2010 23:19:08 +0000 Subject: SDL: Tweak OSystem_SDL::detectSupportedFormats a bit Previously, the code in OSystem_SDL::detectSupportedFormats assumed that the arrays RGBList and BGRList had the exact same length, and that the entries in each mirrored those in the other 100%. Instead of relying on that, the code now simply iterates over both lists separately. This changes the resulting order a bit, but since we never gave any guarantees on that, this should not matter. svn-id: r50833 --- backends/platform/sdl/graphics.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index f48800f0d8..35c5b57db6 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -263,9 +263,6 @@ void OSystem_SDL::detectSupportedFormats() { Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0) }; - bool BGR = false; - int listLength = ARRAYSIZE(RGBList); - Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8(); if (_hwscreen) { // Get our currently set hardware format @@ -281,25 +278,28 @@ void OSystem_SDL::detectSupportedFormats() { // Push it first, as the prefered format. _supportedFormats.push_back(format); - - if (format.bShift > format.rShift) - BGR = true; } // TODO: prioritize matching alpha masks - for (int i = 0; i < listLength; i++) { + int i; + + // Push some RGB formats + for (i = 0; i < ARRAYSIZE(RGBList); i++) { if (_hwscreen && (RGBList[i].bytesPerPixel > format.bytesPerPixel)) continue; - if (BGR) { - if (BGRList[i] != format) - _supportedFormats.push_back(BGRList[i]); + if (RGBList[i] != format) _supportedFormats.push_back(RGBList[i]); - } else { - if (RGBList[i] != format) - _supportedFormats.push_back(RGBList[i]); + } + + // Push some BGR formats + for (i = 0; i < ARRAYSIZE(BGRList); i++) { + if (_hwscreen && (BGRList[i].bytesPerPixel > format.bytesPerPixel)) + continue; + if (BGRList[i] != format) _supportedFormats.push_back(BGRList[i]); - } } + + // Finally, we always supposed 8 bit palette graphics _supportedFormats.push_back(Graphics::PixelFormat::createFormatCLUT8()); } -- cgit v1.2.3 From dcd520ce310a593e7dbc5ecac60c5f3f3e8363a6 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 12 Jul 2010 23:19:56 +0000 Subject: Get rid of yet another global object with constructor svn-id: r50835 --- backends/platform/sdl/sdl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 18c529092d..6686249416 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -96,11 +96,11 @@ AspectRatio::AspectRatio(int w, int h) { } #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS) -static const size_t AR_COUNT = 4; -static const char* desiredAspectRatioAsStrings[AR_COUNT] = { "auto", "4/3", "16/9", "16/10" }; -static const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) }; - static AspectRatio getDesiredAspectRatio() { + const size_t AR_COUNT = 4; + const char* desiredAspectRatioAsStrings[AR_COUNT] = { "auto", "4/3", "16/9", "16/10" }; + const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio(0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) }; + //TODO : We could parse an arbitrary string, if we code enough proper validation Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio"); -- cgit v1.2.3 From 762c569207f778b5b3efad9414a3cfe943424316 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 13 Jul 2010 08:00:22 +0000 Subject: PSP: Typos in trace.h svn-id: r50844 --- backends/platform/psp/trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h index ade8fd7214..5c0ea86e42 100644 --- a/backends/platform/psp/trace.h +++ b/backends/platform/psp/trace.h @@ -32,9 +32,9 @@ /* Choose to print to file/screen/both */ #ifdef __PSP_PRINT_TO_FILE__ - #define __PSP_PRINT__(format,...) PSPDebugTrace(false, format, ## __VA_ARGS__) + #define __PSP_PRINT__(format,...) PspDebugTrace(false, format, ## __VA_ARGS__) #elif defined __PSP_PRINT_TO_FILE_AND_SCREEN__ - #define __PSP_PRINT__(format,...) PSPDebugTrace(true, format, ## __VA_ARGS__) + #define __PSP_PRINT__(format,...) PspDebugTrace(true, format, ## __VA_ARGS__) #else /* default - print to screen */ #define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__) #endif /* PSP_PRINT_TO_FILE/SCREEN */ -- cgit v1.2.3 From bc0c3061100a87d14a75c72296124b741e713218 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 14 Jul 2010 04:33:35 +0000 Subject: If the ALSA driver hasn't been opened, closing it should do nothing. This keeps ScummVM from crashing if, for instance, someone accidentally closes the driver twice. svn-id: r50870 --- backends/midi/alsa.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index a82fffdf0d..6a1a8e88ae 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -150,10 +150,13 @@ int MidiDriver_ALSA::open() { } void MidiDriver_ALSA::close() { - _isOpen = false; - MidiDriver_MPU401::close(); - if (seq_handle) - snd_seq_close(seq_handle); + if (_isOpen) { + _isOpen = false; + MidiDriver_MPU401::close(); + if (seq_handle) + snd_seq_close(seq_handle); + } else + warning("MidiDriver_ALSA: Closing the driver before opening it"); } void MidiDriver_ALSA::send(uint32 b) { -- cgit v1.2.3 From 0b48a71c9955b39117e2eb35b3e398f5c95c008a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Jul 2010 18:41:38 +0000 Subject: Remove PalmOS port svn-id: r50964 --- backends/events/default/default-events.cpp | 4 +- backends/fs/palmos/palmos-fs-factory.cpp | 42 -- backends/fs/palmos/palmos-fs-factory.h | 49 -- backends/fs/palmos/palmos-fs.cpp | 212 ------- backends/midi/ypa1.cpp | 141 ----- backends/midi/zodiac.cpp | 161 ------ backends/module.mk | 1 - .../platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc | Bin 52995 -> 0 bytes backends/platform/PalmOS/Rsc/Starter.rsrc | 0 backends/platform/PalmOS/Rsc/StarterRsc.h | 395 ------------- backends/platform/PalmOS/Rsc/batLow.bmp | Bin 1592 -> 0 bytes backends/platform/PalmOS/Rsc/keyAlt.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/keyCommand.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/keyCtrl.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Rsc/modules.rcp | 71 --- backends/platform/PalmOS/Rsc/modulesrsc.h | 6 - backends/platform/PalmOS/Rsc/numpad.bmp | Bin 1336 -> 0 bytes backends/platform/PalmOS/Src/args.cpp | 106 ---- backends/platform/PalmOS/Src/args.h | 44 -- backends/platform/PalmOS/Src/base_event.cpp | 458 --------------- backends/platform/PalmOS/Src/base_gfx.cpp | 198 ------- backends/platform/PalmOS/Src/base_mouse.cpp | 101 ---- backends/platform/PalmOS/Src/be_68k.cpp | 27 - backends/platform/PalmOS/Src/be_68k.h | 27 - backends/platform/PalmOS/Src/be_base.cpp | 203 ------- backends/platform/PalmOS/Src/be_base.h | 265 --------- backends/platform/PalmOS/Src/be_os5.cpp | 169 ------ backends/platform/PalmOS/Src/be_os5.h | 189 ------- backends/platform/PalmOS/Src/be_os5ex.cpp | 103 ---- backends/platform/PalmOS/Src/be_os5ex.h | 68 --- backends/platform/PalmOS/Src/be_zodiac.cpp | 74 --- backends/platform/PalmOS/Src/be_zodiac.h | 76 --- backends/platform/PalmOS/Src/cd_aeroplayer.cpp | 166 ------ backends/platform/PalmOS/Src/cd_aeroplayer.h | 65 --- backends/platform/PalmOS/Src/cd_default.cpp | 104 ---- backends/platform/PalmOS/Src/cd_default.h | 51 -- backends/platform/PalmOS/Src/cd_msa.cpp | 261 --------- backends/platform/PalmOS/Src/cd_msa.h | 68 --- backends/platform/PalmOS/Src/cd_pockettunes.cpp | 238 -------- backends/platform/PalmOS/Src/cd_pockettunes.h | 69 --- backends/platform/PalmOS/Src/cdaudio.h | 67 --- backends/platform/PalmOS/Src/extend.cpp | 109 ---- backends/platform/PalmOS/Src/features.h | 17 - backends/platform/PalmOS/Src/globals.h | 114 ---- backends/platform/PalmOS/Src/i_zodiac.cpp | 41 -- backends/platform/PalmOS/Src/i_zodiac.h | 12 - backends/platform/PalmOS/Src/init_golcd.cpp | 121 ---- backends/platform/PalmOS/Src/init_golcd.h | 22 - backends/platform/PalmOS/Src/init_mathlib.cpp | 29 - backends/platform/PalmOS/Src/init_mathlib.h | 7 - backends/platform/PalmOS/Src/init_pa1lib.cpp | 32 -- backends/platform/PalmOS/Src/init_pa1lib.h | 22 - backends/platform/PalmOS/Src/init_palmos.cpp | 172 ------ backends/platform/PalmOS/Src/init_palmos.h | 42 -- backends/platform/PalmOS/Src/init_sony.cpp | 163 ------ backends/platform/PalmOS/Src/init_sony.h | 40 -- backends/platform/PalmOS/Src/init_stuffs.cpp | 134 ----- backends/platform/PalmOS/Src/init_stuffs.h | 11 - backends/platform/PalmOS/Src/launcher/app.cpp | 360 ------------ .../PalmOS/Src/launcher/forms/formCards.cpp | 383 ------------- .../platform/PalmOS/Src/launcher/forms/formCards.h | 33 -- .../PalmOS/Src/launcher/forms/formEditGame.cpp | 612 --------------------- .../PalmOS/Src/launcher/forms/formEditGame.h | 39 -- .../PalmOS/Src/launcher/forms/formMisc.cpp | 275 --------- .../PalmOS/Src/launcher/forms/formSelect.cpp | 278 ---------- .../PalmOS/Src/launcher/forms/formSkins.cpp | 267 --------- .../PalmOS/Src/launcher/forms/formUtil.cpp | 60 -- .../platform/PalmOS/Src/launcher/forms/formUtil.h | 23 - .../PalmOS/Src/launcher/forms/forminfo.cpp | 146 ----- .../PalmOS/Src/launcher/forms/formmain.cpp | 364 ------------ .../PalmOS/Src/launcher/forms/formmusic.cpp | 388 ------------- .../platform/PalmOS/Src/launcher/forms/forms.h | 23 - .../PalmOS/Src/launcher/forms/formtabs.cpp | 242 -------- .../platform/PalmOS/Src/launcher/forms/formtabs.h | 24 - backends/platform/PalmOS/Src/launcher/games.cpp | 548 ------------------ backends/platform/PalmOS/Src/launcher/games.h | 212 ------- backends/platform/PalmOS/Src/launcher/launch.cpp | 512 ----------------- backends/platform/PalmOS/Src/launcher/skin.cpp | 612 --------------------- backends/platform/PalmOS/Src/launcher/skin.h | 131 ----- backends/platform/PalmOS/Src/launcher/start.cpp | 367 ------------ backends/platform/PalmOS/Src/launcher/start.h | 98 ---- backends/platform/PalmOS/Src/modules.cpp | 156 ------ backends/platform/PalmOS/Src/modules.h | 22 - backends/platform/PalmOS/Src/native/oscalls.cpp | 92 ---- backends/platform/PalmOS/Src/native/oscalls.h | 58 -- backends/platform/PalmOS/Src/native/pace.h | 103 ---- backends/platform/PalmOS/Src/native/pnoARM.c | 60 -- backends/platform/PalmOS/Src/native/pnoStartup.c | 28 - backends/platform/PalmOS/Src/native/zodiacARM.cpp | 150 ----- .../platform/PalmOS/Src/native/zodiacStartup.cpp | 161 ------ backends/platform/PalmOS/Src/os5_event.cpp | 82 --- backends/platform/PalmOS/Src/os5_gfx.cpp | 309 ----------- backends/platform/PalmOS/Src/os5_mouse.cpp | 157 ------ backends/platform/PalmOS/Src/os5_overlay.cpp | 76 --- backends/platform/PalmOS/Src/os5_renderer.cpp | 118 ---- backends/platform/PalmOS/Src/os5_sound.cpp | 156 ------ backends/platform/PalmOS/Src/os5ex_sound.cpp | 43 -- backends/platform/PalmOS/Src/palmdefs.h | 21 - backends/platform/PalmOS/Src/prefixes/compile.h | 76 --- backends/platform/PalmOS/Src/prefixes/native_agi.h | 11 - .../platform/PalmOS/Src/prefixes/native_agos.h | 7 - .../platform/PalmOS/Src/prefixes/native_cine.h | 12 - .../platform/PalmOS/Src/prefixes/native_common.h | 19 - .../platform/PalmOS/Src/prefixes/native_cruise.h | 11 - .../platform/PalmOS/Src/prefixes/native_drascula.h | 7 - backends/platform/PalmOS/Src/prefixes/native_gob.h | 7 - .../platform/PalmOS/Src/prefixes/native_kyra.h | 7 - .../platform/PalmOS/Src/prefixes/native_lure.h | 11 - backends/platform/PalmOS/Src/prefixes/native_m4.h | 7 - .../platform/PalmOS/Src/prefixes/native_made.h | 7 - .../PalmOS/Src/prefixes/native_parallaction.h | 11 - .../platform/PalmOS/Src/prefixes/native_queen.h | 7 - .../platform/PalmOS/Src/prefixes/native_saga.h | 7 - .../platform/PalmOS/Src/prefixes/native_scumm.h | 12 - backends/platform/PalmOS/Src/prefixes/native_sky.h | 7 - .../platform/PalmOS/Src/prefixes/native_sword1.h | 9 - .../platform/PalmOS/Src/prefixes/native_sword2.h | 10 - .../platform/PalmOS/Src/prefixes/native_touche.h | 7 - .../platform/PalmOS/Src/prefixes/prefix_frontend.h | 9 - backends/platform/PalmOS/Src/prefixes/prefix_os5.h | 13 - .../platform/PalmOS/Src/prefixes/prefix_zodiac.h | 13 - backends/platform/PalmOS/Src/rumble.cpp | 140 ----- backends/platform/PalmOS/Src/rumble.h | 34 -- backends/platform/PalmOS/Src/snd_pa1.cpp | 113 ---- backends/platform/PalmOS/Src/stuffs.h | 32 -- backends/platform/PalmOS/Src/vibrate.h | 61 -- backends/platform/PalmOS/Src/zodiac_event.cpp | 100 ---- backends/platform/PalmOS/Src/zodiac_gfx.cpp | 309 ----------- backends/platform/PalmOS/Src/zodiac_mouse.cpp | 153 ------ backends/platform/PalmOS/Src/zodiac_overlay.cpp | 67 --- backends/platform/PalmOS/arm.bat | 3 - backends/platform/PalmOS/scummvm.mcp | Bin 1147982 -> 0 bytes 132 files changed, 1 insertion(+), 14454 deletions(-) delete mode 100644 backends/fs/palmos/palmos-fs-factory.cpp delete mode 100644 backends/fs/palmos/palmos-fs-factory.h delete mode 100644 backends/fs/palmos/palmos-fs.cpp delete mode 100644 backends/midi/ypa1.cpp delete mode 100644 backends/midi/zodiac.cpp delete mode 100644 backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc delete mode 100644 backends/platform/PalmOS/Rsc/Starter.rsrc delete mode 100644 backends/platform/PalmOS/Rsc/StarterRsc.h delete mode 100644 backends/platform/PalmOS/Rsc/batLow.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyAlt.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyCommand.bmp delete mode 100644 backends/platform/PalmOS/Rsc/keyCtrl.bmp delete mode 100644 backends/platform/PalmOS/Rsc/modules.rcp delete mode 100644 backends/platform/PalmOS/Rsc/modulesrsc.h delete mode 100644 backends/platform/PalmOS/Rsc/numpad.bmp delete mode 100644 backends/platform/PalmOS/Src/args.cpp delete mode 100644 backends/platform/PalmOS/Src/args.h delete mode 100644 backends/platform/PalmOS/Src/base_event.cpp delete mode 100644 backends/platform/PalmOS/Src/base_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/base_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/be_68k.cpp delete mode 100644 backends/platform/PalmOS/Src/be_68k.h delete mode 100644 backends/platform/PalmOS/Src/be_base.cpp delete mode 100644 backends/platform/PalmOS/Src/be_base.h delete mode 100644 backends/platform/PalmOS/Src/be_os5.cpp delete mode 100644 backends/platform/PalmOS/Src/be_os5.h delete mode 100644 backends/platform/PalmOS/Src/be_os5ex.cpp delete mode 100644 backends/platform/PalmOS/Src/be_os5ex.h delete mode 100644 backends/platform/PalmOS/Src/be_zodiac.cpp delete mode 100644 backends/platform/PalmOS/Src/be_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/cd_aeroplayer.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_aeroplayer.h delete mode 100644 backends/platform/PalmOS/Src/cd_default.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_default.h delete mode 100644 backends/platform/PalmOS/Src/cd_msa.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_msa.h delete mode 100644 backends/platform/PalmOS/Src/cd_pockettunes.cpp delete mode 100644 backends/platform/PalmOS/Src/cd_pockettunes.h delete mode 100644 backends/platform/PalmOS/Src/cdaudio.h delete mode 100644 backends/platform/PalmOS/Src/extend.cpp delete mode 100644 backends/platform/PalmOS/Src/features.h delete mode 100644 backends/platform/PalmOS/Src/globals.h delete mode 100644 backends/platform/PalmOS/Src/i_zodiac.cpp delete mode 100644 backends/platform/PalmOS/Src/i_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/init_golcd.cpp delete mode 100644 backends/platform/PalmOS/Src/init_golcd.h delete mode 100644 backends/platform/PalmOS/Src/init_mathlib.cpp delete mode 100644 backends/platform/PalmOS/Src/init_mathlib.h delete mode 100644 backends/platform/PalmOS/Src/init_pa1lib.cpp delete mode 100644 backends/platform/PalmOS/Src/init_pa1lib.h delete mode 100644 backends/platform/PalmOS/Src/init_palmos.cpp delete mode 100644 backends/platform/PalmOS/Src/init_palmos.h delete mode 100644 backends/platform/PalmOS/Src/init_sony.cpp delete mode 100644 backends/platform/PalmOS/Src/init_sony.h delete mode 100644 backends/platform/PalmOS/Src/init_stuffs.cpp delete mode 100644 backends/platform/PalmOS/Src/init_stuffs.h delete mode 100644 backends/platform/PalmOS/Src/launcher/app.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formCards.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formCards.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formEditGame.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formUtil.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formmain.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/forms.h delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/forms/formtabs.h delete mode 100644 backends/platform/PalmOS/Src/launcher/games.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/games.h delete mode 100644 backends/platform/PalmOS/Src/launcher/launch.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/skin.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/skin.h delete mode 100644 backends/platform/PalmOS/Src/launcher/start.cpp delete mode 100644 backends/platform/PalmOS/Src/launcher/start.h delete mode 100644 backends/platform/PalmOS/Src/modules.cpp delete mode 100644 backends/platform/PalmOS/Src/modules.h delete mode 100644 backends/platform/PalmOS/Src/native/oscalls.cpp delete mode 100644 backends/platform/PalmOS/Src/native/oscalls.h delete mode 100644 backends/platform/PalmOS/Src/native/pace.h delete mode 100644 backends/platform/PalmOS/Src/native/pnoARM.c delete mode 100644 backends/platform/PalmOS/Src/native/pnoStartup.c delete mode 100644 backends/platform/PalmOS/Src/native/zodiacARM.cpp delete mode 100644 backends/platform/PalmOS/Src/native/zodiacStartup.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_event.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_overlay.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_renderer.cpp delete mode 100644 backends/platform/PalmOS/Src/os5_sound.cpp delete mode 100644 backends/platform/PalmOS/Src/os5ex_sound.cpp delete mode 100644 backends/platform/PalmOS/Src/palmdefs.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/compile.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_agi.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_agos.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_cine.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_common.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_cruise.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_drascula.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_gob.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_kyra.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_lure.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_m4.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_made.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_parallaction.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_queen.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_saga.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_scumm.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sky.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sword1.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_sword2.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/native_touche.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_frontend.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_os5.h delete mode 100644 backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h delete mode 100644 backends/platform/PalmOS/Src/rumble.cpp delete mode 100644 backends/platform/PalmOS/Src/rumble.h delete mode 100644 backends/platform/PalmOS/Src/snd_pa1.cpp delete mode 100644 backends/platform/PalmOS/Src/stuffs.h delete mode 100644 backends/platform/PalmOS/Src/vibrate.h delete mode 100644 backends/platform/PalmOS/Src/zodiac_event.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_gfx.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_mouse.cpp delete mode 100644 backends/platform/PalmOS/Src/zodiac_overlay.cpp delete mode 100755 backends/platform/PalmOS/arm.bat delete mode 100644 backends/platform/PalmOS/scummvm.mcp (limited to 'backends') diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 212cb130c1..0616713eab 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -95,13 +95,11 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { case Common::EVENT_KEYDOWN: _modifierState = event.kbd.flags; // init continuous event stream - // not done on PalmOS because keyboard is emulated and keyup is not generated -#if !defined(PALMOS_MODE) _currentKeyDown.ascii = event.kbd.ascii; _currentKeyDown.keycode = event.kbd.keycode; _currentKeyDown.flags = event.kbd.flags; _keyRepeatTime = time + kKeyRepeatInitialDelay; -#endif + // Global Main Menu if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) { if (g_engine && !g_engine->isPaused()) { diff --git a/backends/fs/palmos/palmos-fs-factory.cpp b/backends/fs/palmos/palmos-fs-factory.cpp deleted file mode 100644 index 97b3644205..0000000000 --- a/backends/fs/palmos/palmos-fs-factory.cpp +++ /dev/null @@ -1,42 +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. - * - * $URL$ - * $Id$ - */ - -#if defined(PALMOS_MODE) -#include "backends/fs/palmos/palmos-fs-factory.h" -#include "backends/fs/palmos/palmos-fs.cpp" - -DECLARE_SINGLETON(PalmOSFilesystemFactory) - -AbstractFSNode *PalmOSFilesystemFactory::makeRootFileNode() const { - return new PalmOSFilesystemNode(); -} - -AbstractFSNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() const { - return new PalmOSFilesystemNode(); -} - -AbstractFSNode *PalmOSFilesystemFactory::makeFileNodePath(const Common::String &path) const { - return new PalmOSFilesystemNode(path); -} -#endif diff --git a/backends/fs/palmos/palmos-fs-factory.h b/backends/fs/palmos/palmos-fs-factory.h deleted file mode 100644 index 72729c570d..0000000000 --- a/backends/fs/palmos/palmos-fs-factory.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. - * - * $URL$ - * $Id$ - */ - -#ifndef PALMOS_FILESYSTEM_FACTORY_H -#define PALMOS_FILESYSTEM_FACTORY_H - -#include "common/singleton.h" -#include "backends/fs/fs-factory.h" - -/** - * Creates PalmOSFilesystemNode objects. - * - * Parts of this class are documented in the base interface class, FilesystemFactory. - */ -class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton { -public: - virtual AbstractFSNode *makeRootFileNode() const; - virtual AbstractFSNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFSNode *makeFileNodePath(const Common::String &path) const; - -protected: - PalmOSFilesystemFactory() {}; - -private: - friend class Common::Singleton; -}; - -#endif /*PALMOS_FILESYSTEM_FACTORY_H*/ diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp deleted file mode 100644 index 4e05f75d19..0000000000 --- a/backends/fs/palmos/palmos-fs.cpp +++ /dev/null @@ -1,212 +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. - * - * $URL$ - * $Id$ - */ - -#if defined(PALMOS_MODE) - -#include "PalmVersion.h" -#include "globals.h" - -#include "backends/fs/abstract-fs.h" -#include "backends/fs/stdiostream.h" - -/** - * Implementation of the ScummVM file system API based on PalmOS VFS API. - * - * Parts of this class are documented in the base interface class, AbstractFSNode. - */ -class PalmOSFilesystemNode : public AbstractFSNode { -protected: - Common::String _displayName; - Common::String _path; - bool _isDirectory; - bool _isValid; - bool _isPseudoRoot; // TODO: get rid of this - -public: - /** - * Creates a PalmOSFilesystemNode with the root node as path. - */ - PalmOSFilesystemNode(); - - /** - * Creates a PalmOSFilesystemNode for a given path. - * - * @param path Common::String with the path the new node should point to. - */ - PalmOSFilesystemNode(const Common::String &p); - - virtual bool exists() const { return _isValid; } - virtual Common::String getDisplayName() const { return _displayName; } - virtual Common::String getName() const { return _displayName; } - virtual Common::String getPath() const { return _path; } - virtual bool isDirectory() const { return _isDirectory; } - virtual bool isReadable() const { return true; } //FIXME: this is just a stub - virtual bool isWritable() const { return true; } //FIXME: this is just a stub - - virtual AbstractFSNode *getChild(const Common::String &n) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; - virtual AbstractFSNode *getParent() const; - - virtual Common::SeekableReadStream *createReadStream(); - virtual Common::WriteStream *createWriteStream(); - -private: - /** - * Adds a single PalmOSFilesystemNode to a given list. - * This method is used by getChildren() to populate the directory entries list. - * - * @param list List to put the file entry node in. - * @param mode Mode to use while adding the file entry to the list. - * @param base Common::String with the directory being listed. - * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. - */ - static void addFile(AbstractFSList &list, ListMode mode, const Char *base, FileInfoType* find_data); -}; - -void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const char *base, FileInfoType* find_data) { - PalmOSFilesystemNode entry; - bool isDir; - - isDir = (find_data->attributes & vfsFileAttrDirectory); - - if ((!isDir && mode == Common::FSNode::kListDirectoriesOnly) || - (isDir && mode == Common::FSNode::kListFilesOnly)) - return; - - entry._isDirectory = isDir; - entry._displayName = find_data->nameP; - entry._path = base; - entry._path += find_data->nameP; - - if (entry._isDirectory) - entry._path += "/"; - - entry._isValid = true; - entry._isPseudoRoot = false; - - list.push_back(new PalmOSFilesystemNode(entry)); -} - -PalmOSFilesystemNode::PalmOSFilesystemNode() { - _isDirectory = true; - _displayName = "Root"; - _isValid = true; - _path = "/"; - _isPseudoRoot = false; -} - -PalmOSFilesystemNode::PalmOSFilesystemNode(const Common::String &p) { - assert(p.size() > 0); - - _path = p; - _displayName = lastPathComponent(_path, '/'); - - UInt32 attr; - FileRef handle; - Err error = VFSFileOpen(gVars->VFS.volRefNum, _path.c_str(), vfsModeRead, &handle); - if (!error) { - error = VFSFileGetAttributes(handle, &attr); - VFSFileClose(handle); - } - - if (error) { - _isValid = false; - _isDirectory = false; - - } else { - _isValid = true; - _isDirectory = (attr & vfsFileAttrDirectory); - } - - _isPseudoRoot = false; -} - -AbstractFSNode *PalmOSFilesystemNode::getChild(const Common::String &n) const { - // FIXME: Pretty lame implementation! We do no error checking to speak - // of, do not check if this is a special node, etc. - assert(_isDirectory); - - Common::String newPath(_path); - if (_path.lastChar() != '/') - newPath += '/'; - newPath += n; - - return new PalmOSFilesystemNode(newPath); -} - -bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { - assert(_isDirectory); - - //TODO: honor the hidden flag - - Err error; - Char nameP[256]; - FileInfoType desc; - FileRef handle; - UInt32 dirIterator = expIteratorStart; - - desc.nameP = nameP; - desc.nameBufLen = 256; - - error = VFSFileOpen(gVars->VFS.volRefNum, _path.c_str(), vfsModeRead, &handle); - if (error) - return false; - - while (dirIterator != expIteratorStop) { - error = VFSDirEntryEnumerate(handle, &dirIterator, &desc); - if (!error) - addFile(myList, mode, _path.c_str(), &desc); - } - - VFSFileClose(handle); - return true; -} - -AbstractFSNode *PalmOSFilesystemNode::getParent() const { - PalmOSFilesystemNode *p = 0; - - if (!_isPseudoRoot) { - const char *start = _path.c_str(); - const char *end = lastPathComponent(_path, '/'); - - p = new PalmOSFilesystemNode(); - p->_path = Common::String(start, end - start); - p->_isValid = true; - p->_isDirectory = true; - p->_displayName = lastPathComponent(p->_path, '/'); - p->_isPseudoRoot =(p->_path == "/"); - } - - return p; -} - -Common::SeekableReadStream *PalmOSFilesystemNode::createReadStream() { - return StdioStream::makeFromPath(getPath().c_str(), false); -} - -Common::WriteStream *PalmOSFilesystemNode::createWriteStream() { - return StdioStream::makeFromPath(getPath().c_str(), true); -} - -#endif // PALMOS_MODE diff --git a/backends/midi/ypa1.cpp b/backends/midi/ypa1.cpp deleted file mode 100644 index fb114d625c..0000000000 --- a/backends/midi/ypa1.cpp +++ /dev/null @@ -1,141 +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. - * - * $URL$ - * $Id$ - */ - -#include "common/util.h" -#include "sound/musicplugin.h" -#include "sound/mpu401.h" - -#include "Pa1Lib.h" - -class MidiDriver_YamahaPa1:public MidiDriver_MPU401 { -public: - MidiDriver_YamahaPa1(); - int open(); - void close(); - void send(uint32 b); - -private: - UInt8 _midiHandle; - Boolean _isOpen; - }; - -MidiDriver_YamahaPa1::MidiDriver_YamahaPa1() { - _isOpen = false; - _midiHandle = 0; -} - -int MidiDriver_YamahaPa1::open() { - if (!(_isOpen = Pa1Lib_midiOpen(NULL, &_midiHandle))) - return MERR_DEVICE_NOT_AVAILABLE; - - return 0; -} - -void MidiDriver_YamahaPa1::close() { - if (_isOpen) { - _isOpen = false; - MidiDriver_MPU401::close(); - for (UInt8 channel = 0; channel < 16; channel++) { - Pa1Lib_midiControlChange(_midiHandle, channel, 120,0); // all sound off - Pa1Lib_midiControlChange(_midiHandle, channel, 121,0); // reset all controller - Pa1Lib_midiControlChange(_midiHandle, channel, 123, 0); // all notes off - } - Pa1Lib_midiClose(_midiHandle); - } -} - -void MidiDriver_YamahaPa1::send(uint32 b) { - if (!_isOpen) - return; - - UInt8 midiCmd[4]; - UInt8 chanID,mdCmd; - - midiCmd[3] = (b & 0xFF000000) >> 24; - midiCmd[2] = (b & 0x00FF0000) >> 16; - midiCmd[1] = (b & 0x0000FF00) >> 8; - midiCmd[0] = (b & 0x000000FF); - - chanID = (midiCmd[0] & 0x0F) ; - mdCmd = midiCmd[0] & 0xF0; - - switch (mdCmd) { - case 0x80: // note off - Pa1Lib_midiNoteOff(_midiHandle, chanID, midiCmd[1], 0); - break; - - case 0x90: // note on - Pa1Lib_midiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xB0: // control change - Pa1Lib_midiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xC0: // progam change - Pa1Lib_midiProgramChange(_midiHandle, chanID, midiCmd[1]); - break; - - case 0xE0: // pitchBend - Pa1Lib_midiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8))); - break; - } -} - - -// Plugin interface - -class YamahaPa1MusicPlugin : public MusicPluginObject { -public: - const char *getName() const { - return "Yamaha Pa1"; - } - - const char *getId() const { - return "ypa1"; - } - - MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; -}; - -MusicDevices YamahaPa1MusicPlugin::getDevices() const { - MusicDevices devices; - // TODO: Return a different music type depending on the configuration - // TODO: List the available devices - devices.push_back(MusicDevice(this, "", MT_GM)); - return devices; -} - -Common::Error YamahaPa1MusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_YamahaPa1(); - - return Common::kNoError; -} - -//#if PLUGIN_ENABLED_DYNAMIC(YPA1) - //REGISTER_PLUGIN_DYNAMIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin); -//#else - REGISTER_PLUGIN_STATIC(YPA1, PLUGIN_TYPE_MUSIC, YamahaPa1MusicPlugin); -//#endif diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp deleted file mode 100644 index e848315ca4..0000000000 --- a/backends/midi/zodiac.cpp +++ /dev/null @@ -1,161 +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. - * - * $URL$ - * $Id$ - */ - -#include "common/util.h" -#include "sound/musicplugin.h" -#include "sound/mpu401.h" - -#ifndef DISABLE_TAPWAVE - -#include - - -class MidiDriver_Zodiac:public MidiDriver_MPU401 { -public: - MidiDriver_Zodiac(); - int open(); - void close(); - void send(uint32 b); - void sysEx(const byte *msg, uint16 length); - -private: - TwMidiHandle _midiHandle; - Boolean _isOpen; - Int32 _oldVol; - }; - -MidiDriver_Zodiac::MidiDriver_Zodiac() { - _isOpen = false; - _midiHandle = 0; -} - -int MidiDriver_Zodiac::open() { - Err e; - - if (e = TwMidiOpen(&_midiHandle)) - return MERR_DEVICE_NOT_AVAILABLE; - - TwMidiGetMasterVolume(&_oldVol); - TwMidiSetMasterVolume(twMidiMaxVolume); // TODO : set volume based on gVars - - _isOpen = true; - return 0; -} - -void MidiDriver_Zodiac::close() { - if (_isOpen) { - _isOpen = false; - MidiDriver_MPU401::close(); - - TwMidiSetMasterVolume(_oldVol); - TwMidiClose(_midiHandle); - } -} - -void MidiDriver_Zodiac::send(uint32 b) { - if (!_isOpen) - return; - - UInt8 midiCmd[4]; - UInt8 chanID,mdCmd; - - midiCmd[3] = (b & 0xFF000000) >> 24; - midiCmd[2] = (b & 0x00FF0000) >> 16; - midiCmd[1] = (b & 0x0000FF00) >> 8; - midiCmd[0] = (b & 0x000000FF); - - chanID = (midiCmd[0] & 0x0F) ; - mdCmd = midiCmd[0] & 0xF0; - - switch (mdCmd) { - case 0x80: // note off - TwMidiNoteOff(_midiHandle, chanID, midiCmd[1], 0); - break; - - case 0x90: // note on - TwMidiNoteOn(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xB0: // control change - TwMidiControlChange(_midiHandle, chanID, midiCmd[1], midiCmd[2]); - break; - - case 0xC0: // progam change - TwMidiProgramChange(_midiHandle, chanID, midiCmd[1]); - break; - - case 0xE0: // pitchBend - TwMidiPitchBend(_midiHandle, chanID, (short)(midiCmd[1] | (midiCmd[2] << 8))); - break; - } -} - -void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) { - unsigned char buf[266]; - - buf[0] = 0xF0; - memcpy(buf + 1, msg, length); - buf[length + 1] = 0xF7; - - TwMidiSysEx(_midiHandle, 0, (byte *)buf, length + 2); -} - - -// Plugin interface - -class ZodiacMusicPlugin : public MusicPluginObject { -public: - const char *getName() const { - return "Tapwave Zodiac"; - } - - const char *getId() const { - return "zodiac"; - } - - MusicDevices getDevices() const; - Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; -}; - -MusicDevices ZodiacMusicPlugin::getDevices() const { - MusicDevices devices; - // TODO: Return a different music type depending on the configuration - // TODO: List the available devices - devices.push_back(MusicDevice(this, "", MT_GM)); - return devices; -} - -Common::Error ZodiacMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_Zodiac(); - - return Common::kNoError; -} - -//#if PLUGIN_ENABLED_DYNAMIC(ZODIAC) - //REGISTER_PLUGIN_DYNAMIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin); -//#else - REGISTER_PLUGIN_STATIC(ZODIAC, PLUGIN_TYPE_MUSIC, ZodiacMusicPlugin); -//#endif - -#endif diff --git a/backends/module.mk b/backends/module.mk index 59df56b468..fb48f3d249 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -7,7 +7,6 @@ MODULE_OBJS := \ fs/stdiostream.o \ fs/amigaos4/amigaos4-fs-factory.o \ fs/ds/ds-fs-factory.o \ - fs/palmos/palmos-fs-factory.o \ fs/posix/posix-fs-factory.o \ fs/ps2/ps2-fs-factory.o \ fs/psp/psp-fs-factory.o \ diff --git a/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc b/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc deleted file mode 100644 index 70f74412e7..0000000000 Binary files a/backends/platform/PalmOS/Rsc/Resource.Frk/Starter.rsrc and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/Starter.rsrc b/backends/platform/PalmOS/Rsc/Starter.rsrc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/backends/platform/PalmOS/Rsc/StarterRsc.h b/backends/platform/PalmOS/Rsc/StarterRsc.h deleted file mode 100644 index fba46b310b..0000000000 --- a/backends/platform/PalmOS/Rsc/StarterRsc.h +++ /dev/null @@ -1,395 +0,0 @@ -#ifndef STARTERRSC_H -#define STARTERRSC_H - -// Header generated by Constructor for Palm OS (R) 1.9.1 -// -// Generated at 12:00:06 on samedi 25 août 2007 -// -// Generated for file: Starter.rsrc -// -// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE -// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST -// -// Palm App Name: "ScummVM" -// -// Palm App Version: "1.0" - - -// Resource: tFRM 1000 -#define MainForm 1000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) -#define MainCardsButton 1003 //(Left Origin = 135, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 0, Font = Standard) -#define MainAboutButton 1012 //(Left Origin = 148, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Standard) -#define MainMSBitMap 1100 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1100, Usable = 0) -#define MainMSNoneBitMap 1110 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1110, Usable = 0) -#define MainUnnamed1010BitMap 2000 //(Left Origin = 148, Top Origin = 1, Bitmap Resource ID = 2000, Usable = 1) - -// Resource: tFRM 1200 -#define SkinsForm 1200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1203) -#define SkinsOKButton 1202 //(Left Origin = 5, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsCancelButton 1203 //(Left Origin = 43, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsDeleteButton 1205 //(Left Origin = 119, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsBeamButton 1206 //(Left Origin = 81, Top Origin = 139, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define SkinsSoundClickCheckbox 1204 //(Left Origin = 5, Top Origin = 118, Width = 93, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define SkinsSkinList 1201 //(Left Origin = 5, Top Origin = 17, Width = 146, Usable = 1, Font = Standard, Visible Items = 9) - -// Resource: tFRM 1500 -#define CardSlotForm 1500 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define CardSlotOkButton 1510 //(Left Origin = 3, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define CardSlotCancelButton 1511 //(Left Origin = 44, Top Origin = 140, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2700 -#define MiscForm 2700 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define MiscOKButton 2710 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define MiscCancelButton 2711 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2000 -#define ConvertForm 2000 //(Left Origin = 34, Top Origin = 64, Width = 91, Height = 32, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define ConvertUnnamed2001Label 2001 //(Left Origin = 7, Top Origin = 4, Usable = 1, Font = Standard) -#define ConvertUnnamed2002Label 2002 //(Left Origin = 16, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 2100 -#define BeamForm 2100 //(Left Origin = 2, Top Origin = 72, Width = 156, Height = 86, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define BeamSendButton 2105 //(Left Origin = 5, Top Origin = 69, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define BeamCancelButton 2106 //(Left Origin = 47, Top Origin = 69, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define BeamMathlibCheckbox 2101 //(Left Origin = 4, Top Origin = 28, Width = 55, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamGamesCheckbox 2103 //(Left Origin = 4, Top Origin = 40, Width = 86, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamSkinCheckbox 2104 //(Left Origin = 4, Top Origin = 52, Width = 84, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define BeamUnnamed2102Label 2102 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 2200 -#define MusicForm 2200 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define MusicOKButton 2210 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define MusicCancelButton 2211 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 2300 -#define TabMusicForm 2300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMusicMusicCheckbox 2301 //(Left Origin = 4, Top Origin = 12, Width = 100, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define TabMusicMultiMidiCheckbox 2308 //(Left Origin = 4, Top Origin = 24, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMusicTempoField 2302 //(Left Origin = 54, Top Origin = 36, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMusicTitleLabel 2303 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMusicUnnamed2304Label 2304 //(Left Origin = 21, Top Origin = 48, Usable = 1, Font = Standard) -#define TabMusicUnnamed2305Label 2305 //(Left Origin = 16, Top Origin = 60, Usable = 1, Font = Standard) -#define TabMusicUnnamed2306Label 2306 //(Left Origin = 18, Top Origin = 36, Usable = 1, Font = Standard) -#define TabMusicUnnamed2307Label 2307 //(Left Origin = 72, Top Origin = 36, Usable = 1, Font = Standard) -#define TabMusicUnnamed2309Label 2309 //(Left Origin = 28, Top Origin = 72, Usable = 1, Font = Standard) -#define TabMusicRateList 2311 //(Left Origin = 54, Top Origin = 73, Width = 55, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMusicQualityList 2313 //(Left Origin = 54, Top Origin = 60, Width = 60, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMusicDriverList 2331 //(Left Origin = 54, Top Origin = 24, Width = 65, Usable = 0, Font = Standard, Visible Items = 4) -#define TabMusicRatePopTrigger 2310 //(Left Origin = 54, Top Origin = 72, Width = 55, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2311) -#define TabMusicQualityPopTrigger 2312 //(Left Origin = 54, Top Origin = 60, Width = 50, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2313) -#define TabMusicDriverPopTrigger 2330 //(Left Origin = 54, Top Origin = 48, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2331) - -// Resource: tFRM 2500 -#define TabAudioCDForm 2500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 110, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabAudioCDMP3Checkbox 2502 //(Left Origin = 4, Top Origin = 12, Width = 125, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabAudioCDLengthSecsField 2504 //(Left Origin = 112, Top Origin = 60, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabAudioCDFirstTrackField 2507 //(Left Origin = 112, Top Origin = 50, Width = 16, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 80, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabAudioCDUnnamed2501Label 2501 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabAudioCDUnnamed2503Label 2503 //(Left Origin = 20, Top Origin = 60, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2505Label 2505 //(Left Origin = 130, Top Origin = 61, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2506Label 2506 //(Left Origin = 21, Top Origin = 48, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2508Label 2508 //(Left Origin = 25, Top Origin = 24, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2511Label 2511 //(Left Origin = 21, Top Origin = 36, Usable = 1, Font = Standard) -#define TabAudioCDUnnamed2514Label 2514 //(Left Origin = 4, Top Origin = 80, Usable = 1, Font = Standard) -#define TabAudioCDDriverList 2510 //(Left Origin = 58, Top Origin = 24, Width = 90, Usable = 0, Font = Standard, Visible Items = 4) -#define TabAudioCDFormatList 2513 //(Left Origin = 58, Top Origin = 36, Width = 70, Usable = 0, Font = Standard, Visible Items = 2) -#define TabAudioCDDriverPopTrigger 2509 //(Left Origin = 58, Top Origin = 24, Width = 90, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2510) -#define TabAudioCDFormatPopTrigger 2512 //(Left Origin = 58, Top Origin = 36, Width = 70, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 2513) - -// Resource: tFRM 2600 -#define TabVolumeForm 2600 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabVolumeUnnamed2601Label 2601 //(Left Origin = 29, Top Origin = 69, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2603Label 2603 //(Left Origin = 6, Top Origin = 0, Usable = 1, Font = Bold) -#define TabVolumeUnnamed2606Label 2606 //(Left Origin = 26, Top Origin = 15, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2607Label 2607 //(Left Origin = 12, Top Origin = 30, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2608Label 2608 //(Left Origin = 20, Top Origin = 45, Usable = 1, Font = Standard) -#define TabVolumeUnnamed2610Label 2610 //(Left Origin = 14, Top Origin = 84, Usable = 1, Font = Standard) -#define TabVolumeMusicSliderControl 2602 //(Left Origin = 58, Top Origin = 12, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeSfxSliderControl 2604 //(Left Origin = 58, Top Origin = 27, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumePalmSliderControl 2605 //(Left Origin = 58, Top Origin = 66, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 100, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeSpeechSliderControl 2609 //(Left Origin = 58, Top Origin = 42, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) -#define TabVolumeAudioCDSliderControl 2611 //(Left Origin = 58, Top Origin = 81, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 100, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0) - -// Resource: tFRM 2800 -#define TabMiscPalmOSForm 2800 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscPalmOSVibratorCheckbox 2802 //(Left Origin = 4, Top Origin = 12, Width = 128, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSNoAutoOffCheckbox 2803 //(Left Origin = 4, Top Origin = 24, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSStdPaletteCheckbox 2804 //(Left Origin = 4, Top Origin = 84, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSLargerStackCheckbox 2805 //(Left Origin = 4, Top Origin = 36, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSAdvancedCheckbox 2806 //(Left Origin = 4, Top Origin = 96, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSArrowCheckbox 2807 //(Left Origin = 4, Top Origin = 72, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSExitLauncherCheckbox 2810 //(Left Origin = 4, Top Origin = 48, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSStylusClickCheckbox 2811 //(Left Origin = 4, Top Origin = 60, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscPalmOSTabTitlePalmLabel 2801 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) - -// Resource: tFRM 2900 -#define TabMiscScummVMForm 2900 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscScummVMAutosaveCheckbox 2902 //(Left Origin = 4, Top Origin = 48, Width = 90, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDebugCheckbox 2904 //(Left Origin = 4, Top Origin = 60, Width = 90, Height = 12, Usable = 0, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDemoCheckbox 2905 //(Left Origin = 4, Top Origin = 12, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMCopyProtectionCheckbox 2906 //(Left Origin = 4, Top Origin = 24, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMAltIntroCheckbox 2908 //(Left Origin = 4, Top Origin = 36, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscScummVMDebugLevelField 2907 //(Left Origin = 101, Top Origin = 60, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 1, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMiscScummVMAutosaveField 2910 //(Left Origin = 101, Top Origin = 48, Width = 20, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabMiscScummVMTabTitleScummLabel 2901 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMiscScummVMUnnamed2903Label 2903 //(Left Origin = 97, Top Origin = 61, Usable = 1, Font = Standard) -#define TabMiscScummVMUnnamed2909Label 2909 //(Left Origin = 97, Top Origin = 48, Usable = 1, Font = Standard) -#define TabMiscScummVMUnnamed2911Label 2911 //(Left Origin = 123, Top Origin = 48, Usable = 1, Font = Standard) - -// Resource: tFRM 3000 -#define GameEditForm 3000 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1411) -#define GameEditOKButton 3020 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditCancelButton 3021 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditDeleteButton 3023 //(Left Origin = 109, Top Origin = 139, Width = 42, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define GameEditUnnamed3022GraffitiShift 3022 //(Left Origin = 87, Top Origin = 140) - -// Resource: tFRM 3100 -#define TabGameInfoForm 3100 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameInfoEntryNameField 3102 //(Left Origin = 4, Top Origin = 12, Width = 151, Height = 24, Usable = 1, Editable = 1, Underline = 1, Single Line = 0, Dynamic Size = 0, Left Justified = 1, Max Characters = 50, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoPathField 3104 //(Left Origin = 37, Top Origin = 38, Width = 118, Height = 24, Usable = 1, Editable = 1, Underline = 1, Single Line = 0, Dynamic Size = 0, Left Justified = 1, Max Characters = 150, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoGameField 3106 //(Left Origin = 37, Top Origin = 64, Width = 52, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 15, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0) -#define TabGameInfoUnnamed3101Label 3101 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameInfoUnnamed3103Label 3103 //(Left Origin = 11, Top Origin = 38, Usable = 1, Font = Standard) -#define TabGameInfoUnnamed3105Label 3105 //(Left Origin = 6, Top Origin = 64, Usable = 1, Font = Standard) -#define TabGameInfoUnnamed3107Label 3107 //(Left Origin = 4, Top Origin = 79, Usable = 1, Font = Standard) -#define TabGameInfoEngineList 3109 //(Left Origin = 37, Top Origin = 57, Width = 115, Usable = 0, Font = Standard, Visible Items = 3) -#define TabGameInfoBrowsePushButton 3110 //(Left Origin = 11, Top Origin = 50, Width = 22, Height = 12, Usable = 1, Group ID = 0, Font = Standard) -#define TabGameInfoEnginePopTrigger 3108 //(Left Origin = 37, Top Origin = 79, Width = 115, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3109) - -// Resource: tFRM 3200 -#define TabGameDisplayForm 3200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 95, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameDisplayFilterCheckbox 3205 //(Left Origin = 4, Top Origin = 36, Width = 80, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard) -#define TabGameDisplayFullscreenCheckbox 3206 //(Left Origin = 4, Top Origin = 60, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameDisplayAspectRatioCheckbox 3207 //(Left Origin = 4, Top Origin = 48, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameDisplayUnnamed3201Label 3201 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameDisplayUnnamed3202Label 3202 //(Left Origin = 5, Top Origin = 24, Usable = 1, Font = Standard) -#define TabGameDisplayUnnamed3208Label 3208 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabGameDisplayGfxListList 3204 //(Left Origin = 38, Top Origin = 12, Width = 75, Usable = 0, Font = Standard, Visible Items = 2) -#define TabGameDisplayRenderList 3210 //(Left Origin = 38, Top Origin = 24, Width = 75, Usable = 0, Font = Standard, Visible Items = 6) -#define TabGameDisplayGfxPopupPopTrigger 3203 //(Left Origin = 38, Top Origin = 12, Width = 80, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3204) -#define TabGameDisplayRenderPopTrigger 3209 //(Left Origin = 38, Top Origin = 24, Width = 85, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3209) - -// Resource: tFRM 3300 -#define TabGameOptionsForm 3300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabGameOptionsLoadSlotCheckbox 3302 //(Left Origin = 4, Top Origin = 24, Width = 85, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsStartRoomCheckbox 3303 //(Left Origin = 4, Top Origin = 36, Width = 84, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsAmigaCheckbox 3306 //(Left Origin = 4, Top Origin = 48, Width = 81, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsSubtitlesCheckbox 3307 //(Left Origin = 4, Top Origin = 60, Width = 82, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsTalkSpeedCheckbox 3308 //(Left Origin = 4, Top Origin = 12, Width = 66, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabGameOptionsLoadSlotField 3304 //(Left Origin = 92, Top Origin = 24, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 2, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsStartRoomField 3305 //(Left Origin = 92, Top Origin = 36, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsTalkSpeedField 3309 //(Left Origin = 92, Top Origin = 12, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabGameOptionsUnnamed3301Label 3301 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabGameOptionsUnnamed3314Label 3314 //(Left Origin = 88, Top Origin = 24, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3315Label 3315 //(Left Origin = 88, Top Origin = 36, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3316Label 3316 //(Left Origin = 88, Top Origin = 12, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3317Label 3317 //(Left Origin = 88, Top Origin = 48, Usable = 1, Font = Standard) -#define TabGameOptionsUnnamed3318Label 3318 //(Left Origin = 88, Top Origin = 60, Usable = 1, Font = Standard) -#define TabGameOptionsLanguageList 3311 //(Left Origin = 92, Top Origin = 15, Width = 64, Usable = 0, Font = Standard, Visible Items = 5) -#define TabGameOptionsPlatformList 3313 //(Left Origin = 92, Top Origin = 15, Width = 64, Usable = 0, Font = Standard, Visible Items = 4) -#define TabGameOptionsLanguagePopTrigger 3310 //(Left Origin = 90, Top Origin = 60, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3311) -#define TabGameOptionsPlatformPopTrigger 3312 //(Left Origin = 90, Top Origin = 48, Width = 65, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3313) - -// Resource: tFRM 3400 -#define ImportForm 3400 //(Left Origin = 34, Top Origin = 64, Width = 91, Height = 32, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define ImportUnnamed3401Label 3401 //(Left Origin = 4, Top Origin = 4, Usable = 1, Font = Standard) -#define ImportUnnamed3402Label 3402 //(Left Origin = 16, Top Origin = 16, Usable = 1, Font = Bold) - -// Resource: tFRM 1400 -#define EngineForm 1400 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define EngineOkButton 1403 //(Left Origin = 4, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define EngineCancelButton 1420 //(Left Origin = 45, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) -#define EngineUnnamed1402Label 1402 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold) -#define EngineUnnamed1404Label 1404 //(Left Origin = 4, Top Origin = 88, Usable = 1, Font = Bold) -#define EngineListList 1401 //(Left Origin = 4, Top Origin = 30, Width = 148, Usable = 1, Font = Standard, Visible Items = 5) -#define EngineSupportedList 1405 //(Left Origin = 4, Top Origin = 102, Width = 148, Usable = 1, Font = Standard, Visible Items = 3) - -// Resource: tFRM 4000 -#define InfoForm 4000 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define InfoOKButton 4020 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) - -// Resource: tFRM 4100 -#define TabInfoAboutForm 4100 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 125, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoAboutTabTitleAboutLabel 4101 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoAboutUnnamed4103Label 4103 //(Left Origin = 23, Top Origin = 58, Usable = 1, Font = Bold) -#define TabInfoAboutUnnamed4104Label 4104 //(Left Origin = 34, Top Origin = 70, Usable = 1, Font = Standard) -#define TabInfoAboutUnnamed4105Label 4105 //(Left Origin = 8, Top Origin = 82, Usable = 1, Font = Bold) - -// Resource: tFRM 4200 -#define TabInfoVersionForm 4200 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoVersionTabTitleAboutLabel 4201 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4202Label 4202 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4203Label 4203 //(Left Origin = 24, Top Origin = 24, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4204Label 4204 //(Left Origin = 4, Top Origin = 42, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4205Label 4205 //(Left Origin = 5, Top Origin = 53, Usable = 1, Font = Standard) -#define TabInfoVersionUnnamed4206Label 4206 //(Left Origin = 4, Top Origin = 72, Usable = 1, Font = Bold) -#define TabInfoVersionUnnamed4207Label 4207 //(Left Origin = 4, Top Origin = 84, Usable = 1, Font = Standard) - -// Resource: tFRM 4300 -#define TabInfoSystemForm 4300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabInfoSystemTabTitleAboutLabel 4301 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabInfoSystemUnnamed4302Label 4302 //(Left Origin = 10, Top Origin = 12, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4303Label 4303 //(Left Origin = 13, Top Origin = 24, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4304Label 4304 //(Left Origin = 5, Top Origin = 36, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4305Label 4305 //(Left Origin = 96, Top Origin = 0, Usable = 1, Font = Standard) -#define TabInfoSystemUnnamed4306Label 4306 //(Left Origin = 132, Top Origin = 0, Usable = 1, Font = Standard) - -// Resource: tFRM 1600 -#define TabCardConfigForm 1600 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 110, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabCardConfigDetectCheckbox 1602 //(Left Origin = 4, Top Origin = 86, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigCacheCheckbox 1604 //(Left Origin = 4, Top Origin = 62, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigLedCheckbox 1608 //(Left Origin = 4, Top Origin = 50, Width = 130, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardConfigCacheSizeField 1606 //(Left Origin = 68, Top Origin = 74, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1) -#define TabCardConfigTabTitleAboutLabel 1601 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabCardConfigUnnamed1605Label 1605 //(Left Origin = 21, Top Origin = 74, Usable = 1, Font = Standard) -#define TabCardConfigUnnamed1607Label 1607 //(Left Origin = 88, Top Origin = 74, Usable = 1, Font = Standard) -#define TabCardConfigSlotList 1620 //(Left Origin = 7, Top Origin = 14, Width = 146, Usable = 1, Font = Standard, Visible Items = 3) - -// Resource: tFRM 1700 -#define TabCardGameListForm 1700 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 100, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabCardGameListMoveCheckbox 1702 //(Left Origin = 4, Top Origin = 12, Width = 143, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListDeleteCheckbox 1703 //(Left Origin = 4, Top Origin = 24, Width = 142, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListConfirmCheckbox 1704 //(Left Origin = 4, Top Origin = 36, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabCardGameListUnnamed1701Label 1701 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) - -// Resource: tFRM 3500 -#define TabMiscExtsForm 3500 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 80, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) -#define TabMiscExtsLightspeedCheckbox 3502 //(Left Origin = 4, Top Origin = 24, Width = 95, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscExtsGolcdCheckbox 3505 //(Left Origin = 4, Top Origin = 12, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard) -#define TabMiscExtsTabTitleMoreLabel 3501 //(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold) -#define TabMiscExtsNothingLabel 3506 //(Left Origin = 4, Top Origin = 36, Usable = 0, Font = Standard) -#define TabMiscExtsLightspeedList 3504 //(Left Origin = 96, Top Origin = 24, Width = 50, Usable = 0, Font = Standard, Visible Items = 3) -#define TabMiscExtsLightspeedPopTrigger 3503 //(Left Origin = 96, Top Origin = 24, Width = 60, Height = 12, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 3504) - - -// Resource: Talt 1001 -#define RomIncompatibleAlert 1001 -#define RomIncompatibleOK 0 - -// Resource: Talt 1000 -#define FrmWarnAlert 1000 -#define FrmWarnOK 0 - -// Resource: Talt 1100 -#define FrmErrorAlert 1100 -#define FrmErrorCancel 0 - -// Resource: Talt 1300 -#define FrmConfirmAlert 1300 -#define FrmConfirmYes 0 -#define FrmConfirmNo 1 - -// Resource: Talt 1400 -#define FrmInfoAlert 1400 -#define FrmInfoOK 0 - - -// Resource: MBAR 1000 -#define MainFormMenuBar 1000 - - -// Resource: MENU 1000 -#define MainOptionsMenu 1000 -#define MainOptionsMisc 1000 // Command Key: I -#define MainOptionsSkins 1001 -#define MainOptionsBeam 1003 -#define MainOptionsAbout 1005 - -// Resource: MENU 1100 -#define MainGamesMenu 1100 -#define MainGamesNew 1100 // Command Key: N -#define MainGamesEdit 1101 // Command Key: E -#define MainGamesMusicSound 1102 // Command Key: M -#define MainGamesDelete 1103 -#define MainGamesMemoryCard 1105 // Command Key: C - - -// Resource: tSTR 9991 -#define ClieCatString 9991 // "32779" - -// Resource: tSTR 9990 -#define ClieDescString 9990 // "Play your favorite Point'n'Click games" - - -// Resource: PICT 1001 -#define Bitmap 1001 - -// Resource: PICT 1002 -#define Bitmap2 1002 - -// Resource: PICT 1008 -#define Bitmap3 1008 - -// Resource: PICT 1011 -#define Bitmap4 1011 - -// Resource: PICT 1012 -#define Bitmap5 1012 - -// Resource: PICT 1018 -#define Bitmap6 1018 - -// Resource: PICT 2000 -#define infoBitmap 2000 - -// Resource: PICT 1100 -#define msOnBitmap 1100 - -// Resource: PICT 1009 -#define Bitmap7 1009 - -// Resource: PICT 1010 -#define Bitmap8 1010 - -// Resource: PICT 1110 -#define msNoneBitmap 1110 - -// Resource: PICT 1020 -#define BitmapID1020Bitmap 1020 - -// Resource: PICT 1019 -#define BitmapID1019Bitmap 1019 - -// Resource: PICT 1200 -#define msOnD2Bitmap 1200 - -// Resource: PICT 1300 -#define msNoneD2Bitmap 1300 - -// Resource: PICT 2100 -#define infoD2Bitmap 2100 - -// Resource: PICT 1501 -#define ScummVMlogoD1Bitmap 1501 - -// Resource: PICT 1502 -#define ScummVMlogoD2Bitmap 1502 - -// Resource: PICT 1000 -#define icon16bitD2Bitmap 1000 - - -// Resource: tbmf 1000 -#define Icon_infoBitmapFamily 1000 - -// Resource: tbmf 1100 -#define MsOnBitmapFamily 1100 - -// Resource: tbmf 2000 -#define InfoBitmapFamily 2000 - -// Resource: tbmf 1110 -#define MsNoneBitmapFamily 1110 - -// Resource: tbmf 1200 -#define LogoBitmapFamily 1200 - - -// Resource: taif 1000 -#define Largeicons12and8bitsAppIconFamily 1000 - -// Resource: taif 1001 -#define Smallicons12and8bitsAppIconFamily 1001 - - -#endif // STARTERRSC_H diff --git a/backends/platform/PalmOS/Rsc/batLow.bmp b/backends/platform/PalmOS/Rsc/batLow.bmp deleted file mode 100644 index 1d18131450..0000000000 Binary files a/backends/platform/PalmOS/Rsc/batLow.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyAlt.bmp b/backends/platform/PalmOS/Rsc/keyAlt.bmp deleted file mode 100644 index 28165394f8..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyAlt.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyCommand.bmp b/backends/platform/PalmOS/Rsc/keyCommand.bmp deleted file mode 100644 index 1324037cd3..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyCommand.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/keyCtrl.bmp b/backends/platform/PalmOS/Rsc/keyCtrl.bmp deleted file mode 100644 index fed20fd8d0..0000000000 Binary files a/backends/platform/PalmOS/Rsc/keyCtrl.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Rsc/modules.rcp b/backends/platform/PalmOS/Rsc/modules.rcp deleted file mode 100644 index c7b17221b2..0000000000 --- a/backends/platform/PalmOS/Rsc/modules.rcp +++ /dev/null @@ -1,71 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * Copyright (C) 2001 Ludvig Strigeus - * Copyright (C) 2001-2010 The ScummVM project - * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend - * - * 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. - * - * $URL$ - * $Id$ - * - */ - -BITMAP ID 3100 -BEGIN - BITMAP "keyCommand.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3101 -BEGIN - BITMAP "keyAlt.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3102 -BEGIN - BITMAP "keyCtrl.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3120 -BEGIN - BITMAP "batLow.bmp" BPP 1 DENSITY 2 -END -BITMAP ID 3130 -BEGIN - BITMAP "numpad.bmp" BPP 1 DENSITY 2 -END - -/* -BITMAP ID 3100 "keyCommand.bmp" DENSITY 2 -BITMAP ID 3101 "keyAlt.bmp" DENSITY 2 -BITMAP ID 3102 "keyCtrl.bmp" DENSITY 2 -BITMAP ID 3120 "batLow.bmp" DENSITY 2 -BITMAP ID 3130 "numpad.bmp" DENSITY 2 -*/ -BITMAP ID 3000 "keyCommand.bmp" DENSITY 1 -BITMAP ID 3001 "keyAlt.bmp" DENSITY 1 -BITMAP ID 3002 "keyCtrl.bmp" DENSITY 1 -BITMAP ID 3020 "batLow.bmp" DENSITY 1 -BITMAP ID 3030 "numpad.bmp" DENSITY 1 - -ALERT ID 1200 - DEFAULTBUTTON 0 - ERROR -BEGIN - TITLE "ScummVM Fatal Error" - MESSAGE "^1" - BUTTONS "Exit" -END - diff --git a/backends/platform/PalmOS/Rsc/modulesrsc.h b/backends/platform/PalmOS/Rsc/modulesrsc.h deleted file mode 100644 index 14b32ee0b6..0000000000 --- a/backends/platform/PalmOS/Rsc/modulesrsc.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MODULESRSC_H -#define MODULESRSC_H - -#define FrmFatalErrorAlert 1200 - -#endif diff --git a/backends/platform/PalmOS/Rsc/numpad.bmp b/backends/platform/PalmOS/Rsc/numpad.bmp deleted file mode 100644 index 7763d76c05..0000000000 Binary files a/backends/platform/PalmOS/Rsc/numpad.bmp and /dev/null differ diff --git a/backends/platform/PalmOS/Src/args.cpp b/backends/platform/PalmOS/Src/args.cpp deleted file mode 100644 index bfc34866e3..0000000000 --- a/backends/platform/PalmOS/Src/args.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include -#include "palmdefs.h" -#include "args.h" -#include "pace.h" -#include "endianutils.h" - -Char **ArgsInit() { - // first 4 bytes keep the real address of the chunk - MemHandle argvH = MemHandleNew(sizeof(Char *) + (MAX_ARG * sizeof(Char **) + 2)); - // real addr - Char *lockP = (Char *)MemHandleLock(argvH); - // 4byte aligned - Char **argvP = (Char **)ALIGN_4BYTE(lockP); - // save real addr - argvP[0] = lockP; - // initial position - argvP++; - - for (UInt8 count = 0; count < MAX_ARG; count++) - argvP[count] = NULL; - - return argvP; -} - -void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP) { - if (argP) { - MemHandle newArg; - UInt16 len2 = 0; - UInt16 len1 = StrLen(argP); - - if (len1 > 0) { - if (parmP) - len2 = StrLen(parmP); - - (*countArgP)++; - newArg = MemHandleNew(len1 + len2 + 1); // +1 = NULL CHAR - *argvP = (Char *)MemHandleLock(newArg); - StrCopy(*argvP, argP); - - if (parmP) - StrCat(*argvP, parmP); - } - } -} - -void ArgsFree(Char **argvP) { - if (!argvP) - return; - - MemHandle oldH; - - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) { - oldH = MemPtrRecoverHandle(argvP[count]); - MemHandleUnlock(oldH); - MemHandleFree(oldH); - } - - argvP--; - oldH = MemPtrRecoverHandle(argvP[0]); - MemHandleUnlock(oldH); - MemHandleFree(oldH); -} - -void ArgsSetOwner(Char **argvP, UInt16 owner) { - if (!argvP) - return; - - MemHandle oldH; - - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) { - oldH = MemPtrRecoverHandle(argvP[count]); - MemHandleSetOwner(oldH, owner); - } - - argvP--; - oldH = MemPtrRecoverHandle(argvP[0]); - MemHandleSetOwner(oldH, owner); -} - -void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm) { - if (arm) { - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) - argvP[count] = (Char *)ByteSwap32(argvP[count]); - } - - FtrSet(appFileCreator, ftrArgsData , (UInt32)argvP); - FtrSet(appFileCreator, ftrArgsCount, (UInt32)countArg); -} - -void ArgsExportRelease(Boolean arm) { - if (arm) { - Char **argvP; - Err e = FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP); - - if (argvP) - for (UInt8 count = 0; count < MAX_ARG; count++) - if (argvP[count]) - argvP[count] = (Char *)ByteSwap32(argvP[count]); - } - - FtrUnregister(appFileCreator, ftrArgsCount); - FtrUnregister(appFileCreator, ftrArgsData); -} diff --git a/backends/platform/PalmOS/Src/args.h b/backends/platform/PalmOS/Src/args.h deleted file mode 100644 index fa988fe35f..0000000000 --- a/backends/platform/PalmOS/Src/args.h +++ /dev/null @@ -1,44 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef ARGS_H -#define ARGS_H - -#define MAX_ARG 25 - -#define ftrArgsData 1300 -#define ftrArgsCount 1301 -#define ftrVars 1302 -#define ftrStack 1303 - -Char **ArgsInit(); -void ArgsAdd(Char **argvP, const Char *argP, const Char *parmP, UInt8 *countArgP); -void ArgsFree(Char **argvP); -void ArgsSetOwner(Char **argvP, UInt16 owner); - -void ArgsExportInit(Char **argvP, UInt32 countArg, Boolean arm); -void ArgsExportRelease(Boolean arm); - -#endif diff --git a/backends/platform/PalmOS/Src/base_event.cpp b/backends/platform/PalmOS/Src/base_event.cpp deleted file mode 100644 index ae93514e34..0000000000 --- a/backends/platform/PalmOS/Src/base_event.cpp +++ /dev/null @@ -1,458 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_base.h" -#include "common/events.h" - -#ifdef STDLIB_TRACE_MEMORY -# include -#endif - -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) -extern "C" void SysEventGet(EventType *eventP, Int32 timeout); -extern "C" void SysEventAddToQueue (const EventType *eventP); -#endif - -void OSystem_PalmBase::timer_handler() { - UInt32 msecs = getMillis(); - - if (_timer.active && (msecs >= _timer.nextExpiry)) { - _timer.duration = _timer.callback(_timer.duration); - _timer.nextExpiry = msecs + _timer.duration; - } -} - -void OSystem_PalmBase::battery_handler() { - // check battery level every 15secs - if ((TimGetTicks() - _batCheckLast) > _batCheckTicks) { - UInt16 voltage, warnThreshold, criticalThreshold; - Boolean pluggedIn; - voltage = SysBatteryInfoV20(false, &warnThreshold, &criticalThreshold, NULL, NULL, &pluggedIn); - - if (!pluggedIn) { - if (voltage <= warnThreshold) { - if (!_showBatLow) { - _showBatLow = true; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, true, 2); - displayMessageOnOSD("Battery low."); - } - } else { - if (_showBatLow) { - _showBatLow = false; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, false); - } - } - - if (voltage <= criticalThreshold) { - ::EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrPowerOff; - event.data.keyDown.modifiers = commandKeyMask; -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) - SysEventAddToQueue(&event); -#else - EvtAddEventToQueue(&event); -#endif - } - } - - _batCheckLast = TimGetTicks(); - } -} - -bool OSystem_PalmBase::pollEvent(Common::Event &event) { - ::EventType ev; - Boolean handled; - UInt32 keyCurrentState; - Coord x, y; - - battery_handler(); - timer_handler(); - sound_handler(); - - for (;;) { - // check for hardkey repeat for mouse emulation - keyCurrentState = KeyCurrentState(); - - // if it was a key pressed, let the keyup event raise - if (_keyExtraPressed) { - if (gVars->arrowKeys) { - if (_keyExtraPressed & _keyExtra.bitLeft) { - if (!(keyCurrentState & _keyExtra.bitLeft)) { - _keyExtraPressed &= ~_keyExtra.bitLeft; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_LEFT; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitRight) { - if (!(keyCurrentState & _keyExtra.bitRight)) { - _keyExtraPressed &= ~_keyExtra.bitRight; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_RIGHT; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitUp) { - if (!(keyCurrentState & _keyExtra.bitUp)) { - _keyExtraPressed &= ~_keyExtra.bitUp; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_UP; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - if (_keyExtraPressed & _keyExtra.bitDown) { - if (!(keyCurrentState & _keyExtra.bitDown)) { - _keyExtraPressed &= ~_keyExtra.bitDown; - - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_DOWN; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - } - } - } - - if (_keyExtraPressed & _keyExtra.bitActionA) { - if (!(keyCurrentState & _keyExtra.bitActionA)) { - _keyExtraPressed &= ~_keyExtra.bitActionA; - - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - if (_keyExtraPressed & _keyExtra.bitActionB) { - if (!(keyCurrentState & _keyExtra.bitActionB)) { - _keyExtraPressed &= ~_keyExtra.bitActionB; - - event.type = Common::EVENT_RBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - // no more event till up is raised - return false; - } - - if (!(keyCurrentState & _keyExtraMask)) { - _lastKeyRepeat = 0; - - } else if (getMillis() >= (_keyExtraRepeat + _keyExtraDelay)) { - _keyExtraRepeat = getMillis(); - - if (gVars->arrowKeys) { - if (keyCurrentState & _keyExtra.bitLeft) { - _keyExtraPressed |= _keyExtra.bitLeft; - event.kbd.keycode = Common::KEYCODE_LEFT; - - } else if (keyCurrentState & _keyExtra.bitRight) { - _keyExtraPressed |= _keyExtra.bitRight; - event.kbd.keycode = Common::KEYCODE_RIGHT; - - } else if (keyCurrentState & _keyExtra.bitUp) { - _keyExtraPressed |= _keyExtra.bitUp; - event.kbd.keycode = Common::KEYCODE_UP; - - } else if (keyCurrentState & _keyExtra.bitDown) { - _keyExtraPressed |= _keyExtra.bitDown; - event.kbd.keycode = Common::KEYCODE_DOWN; - } - - event.type = Common::EVENT_KEYDOWN; - event.kbd.ascii = event.kbd.keycode; - event.kbd.flags = 0; - return true; - - } else { - Int8 sx = 0; - Int8 sy = 0; - - if (keyCurrentState & _keyExtra.bitUp) - sy = -1; - else if (keyCurrentState & _keyExtra.bitDown) - sy = +1; - - if (keyCurrentState & _keyExtra.bitLeft) - sx = -1; - else if (keyCurrentState & _keyExtra.bitRight) - sx = +1; - - if (sx || sy) { - simulate_mouse(event, sx, sy, &x, &y); - event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - - return true; - } - } - } - -#if defined(COMPILE_OS5) && defined(PALMOS_ARM) - SysEventGet(&ev, evtNoWait); -#else - EvtGetEvent(&ev, evtNoWait); -#endif - - if (ev.eType == keyUpEvent) { - Common::KeyCode k = Common::KEYCODE_INVALID; - switch (ev.data.keyUp.chr) { - - // arrow keys - case chrUpArrow: - k = Common::KEYCODE_UP; break; - case chrDownArrow: - k = Common::KEYCODE_DOWN; break; - case chrRightArrow: - k = Common::KEYCODE_RIGHT; break; - case chrLeftArrow: - k = Common::KEYCODE_LEFT; break; - } - - if (k) { - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = k; - event.kbd.ascii = k; - event.kbd.flags = 0; - return true; - } - - } else if (ev.eType == keyDownEvent) { - Common::KeyCode k = Common::KEYCODE_INVALID; - switch (ev.data.keyDown.chr) { - // ESC key - case vchrLaunch: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = Common::ASCII_ESCAPE; - event.kbd.flags = 0; - return true; - - // F5 = menu - case vchrMenu: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - event.kbd.flags = 0; - return true; - - // if hotsync pressed, etc... - case vchrHardCradle: - case vchrHardCradle2: - case vchrLowBattery: - case vchrFind: -// case vchrBrightness: // volume control on Zodiac, let other backends disable it - case vchrContrast: - // do nothing - return true; - - // arrow keys - case chrUpArrow: - k = Common::KEYCODE_UP; break; - case chrDownArrow: - k = Common::KEYCODE_DOWN; break; - case chrRightArrow: - k = Common::KEYCODE_RIGHT; break; - case chrLeftArrow: - k = Common::KEYCODE_LEFT; break; - - // return - case chrLineFeed: - case chrCarriageReturn: - k = Common::KEYCODE_RETURN; break; - - } - - if (k) { - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = k; - event.kbd.ascii = k; - event.kbd.flags = 0; - return true; - } - } - - if (check_event(event, &ev)) - return true; - - // prevent crash when alarm is raised - handled = ((ev.eType == keyDownEvent) && - (ev.data.keyDown.modifiers & commandKeyMask) && - ((ev.data.keyDown.chr == vchrAttnStateChanged) || - (ev.data.keyDown.chr == vchrAttnUnsnooze))); - - // graffiti strokes, auto-off, etc... - if (!handled) - if (SysHandleEvent(&ev)) - continue; - - switch (ev.eType) { - case penMoveEvent: - get_coordinates(&ev, x, y); - - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - if (abs(y - event.mouse.y) <= 2 || abs(x - event.mouse.x) <= 2) - return false; - - event.type = Common::EVENT_MOUSEMOVE; - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case penDownEvent: - get_coordinates(&ev, x, y); - - // indy fight mode - if (_useNumPad && !_overlayVisible) { - char num = '1'; - num += 9 - - (3 - (3 * x / _screenWidth )) - - (3 * (3 * y / _screenHeight)); - - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = (Common::KeyCode)num; - event.kbd.ascii = num; - event.kbd.flags = 0; - - _wasKey = true; - return true; - } - - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_MOUSEMOVE); - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case penUpEvent: - get_coordinates(&ev, x, y); - - event.type = ((gVars->stylusClick || _overlayVisible) ? Common::EVENT_LBUTTONUP : Common::EVENT_MOUSEMOVE); - if (y > _screenHeight || y < 0 || x > _screenWidth || x < 0) - return false; - - event.mouse.x = x; - event.mouse.y = y; - warpMouse(x, y); - return true; - - case keyDownEvent: - if (ev.data.keyDown.chr == vchrCommand && - (ev.data.keyDown.modifiers & commandKeyMask)) { - - _lastKeyModifier++; - _lastKeyModifier %= kModifierCount; - - if (_lastKeyModifier) - draw_osd((kDrawKeyState + _lastKeyModifier - 1), 2, _screenDest.h + 2, true); - else - draw_osd(kDrawKeyState, 2, _screenDest.h + 2, false); - - return false; - } - - char mask = 0; - UInt16 key = ev.data.keyDown.chr; - - if (_lastKeyModifier == kModifierNone) { - // for keyboard mode - if (ev.data.keyDown.modifiers & shiftKeyMask) mask |= Common::KBD_SHIFT; - if (ev.data.keyDown.modifiers & controlKeyMask) mask |= Common::KBD_CTRL; - if (ev.data.keyDown.modifiers & optionKeyMask) mask |= Common::KBD_ALT; - if (ev.data.keyDown.modifiers & commandKeyMask) mask |= Common::KBD_CTRL|Common::KBD_ALT; - } else { - // for grafiti mode - if (_lastKeyModifier == kModifierCommand) mask = Common::KBD_CTRL|Common::KBD_ALT; - if (_lastKeyModifier == kModifierAlt) mask = Common::KBD_ALT; - if (_lastKeyModifier == kModifierCtrl) mask = Common::KBD_CTRL; - } - - if (_lastKeyModifier) - draw_osd(kDrawKeyState, 2, _screenDest.h + 2, false); - _lastKeyModifier = kModifierNone; - - // F1 -> F10 key - if (key >= '0' && key <= '9' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { - key = (key == '0') ? 324 : (315 + key - '1'); - mask = 0; - -#ifdef STDLIB_TRACE_MEMORY - // print memory - } else if (key == 'm' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) { - printf("Used memory: %d\n", __stdlib_trace_memory); -#endif - // exit - } else if ((key == 'z' && mask == Common::KBD_CTRL) || (mask == Common::KBD_ALT && key == 'x')) { - event.type = Common::EVENT_QUIT; - return true; - - // num pad (indy fight mode) - } else if (key == 'n' && mask == (Common::KBD_CTRL|Common::KBD_ALT) && !_overlayVisible) { - _useNumPad = !_useNumPad; - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, _useNumPad, 1); - displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off."); - return false; - } - - // other keys - _wasKey = true; - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = (Common::KeyCode)key; - event.kbd.ascii = key; - event.kbd.flags = mask; - return true; - - default: - if (_wasKey && ev.eType != keyHoldEvent) { - event.type = Common::EVENT_KEYUP; - _wasKey = false; - return true; - } - return false; - }; - } -} diff --git a/backends/platform/PalmOS/Src/base_gfx.cpp b/backends/platform/PalmOS/Src/base_gfx.cpp deleted file mode 100644 index 46238efdc2..0000000000 --- a/backends/platform/PalmOS/Src/base_gfx.cpp +++ /dev/null @@ -1,198 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_base.h" - -/* - * Graphics modes - * - */ - -static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { - {"1x", "Normal", GFX_NORMAL}, - {"wide", "Wide", GFX_WIDE}, - {0, 0, 0} -}; - -int OSystem_PalmBase::getDefaultGraphicsMode() const { - return GFX_NORMAL; -} - -const OSystem::GraphicsMode *OSystem_PalmBase::getSupportedGraphicsModes() const { - return int_getSupportedGraphicsModes(); -} - -const OSystem::GraphicsMode *OSystem_PalmBase::int_getSupportedGraphicsModes() const { - return s_supportedGraphicsModes; -} - -int OSystem_PalmBase::getGraphicsMode() const { - return _mode; -} - -bool OSystem_PalmBase::setGraphicsMode(int mode) { - switch (mode) { - case GFX_NORMAL: - case GFX_WIDE: - _setMode = mode; - break; - - default: - warning("unknown gfx mode %d", mode); - _setMode = GFX_NORMAL; - return false; - } - - return true; -} - -/* - * Init - * - */ - -void OSystem_PalmBase::initSize(uint w, uint h, const Graphics::PixelFormat *format) { - _screenWidth = w; - _screenHeight = h; - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - unload_gfx_mode(); - _mode = _setMode; - load_gfx_mode(); - - warpMouse(200, 150); - int_initSize(w, h); -} - -/* - * Palette - * - */ -void OSystem_PalmBase::setPalette(const byte *colors, uint start, uint num) { - RGBColorType *base = _currentPalette + start; - - for (uint i = 0; i < num; i++) { - base[i].r = colors[0]; - base[i].g = colors[1]; - base[i].b = colors[2]; - - extras_palette(i + start, colors[0], colors[1], colors[2]); - colors += 4; - } - - if (start < _paletteDirtyStart) - _paletteDirtyStart = start; - - if (start + num > _paletteDirtyEnd) - _paletteDirtyEnd = start + num; -} - -void OSystem_PalmBase::grabPalette(byte *colors, uint start, uint num) { - const RGBColorType *base = _currentPalette + start; - - for (uint i = 0; i < num; ++i) { - colors[i * 4] = base[i].r; - colors[i * 4 + 1] = base[i].g; - colors[i * 4 + 2] = base[i].b; - colors[i * 4 + 3] = 0xFF; - } -} - -/* - * Screen - * - */ - -void OSystem_PalmBase::setShakePos(int shakeOffset) { - _new_shake_pos = shakeOffset; - int_setShakePos(shakeOffset); -} - -void OSystem_PalmBase::updateScreen() { - // Check whether the palette was changed in the meantime and update the - // screen surface accordingly. - if (_paletteDirtyEnd != 0 && _setPalette) { - WinSetDrawWindow(WinGetDisplayWindow()); - WinPalette(winPaletteSet, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart, _currentPalette + _paletteDirtyStart); - _paletteDirtyEnd = 0; - //_redawOSD = true; - } - if (_redawOSD) { - _redawOSD = false; - draw_osd(kDrawBatLow, _screenDest.w - 18, -16, _showBatLow, 2); - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, (_useNumPad && !_overlayVisible), 1); - } - int_updateScreen(); - -} - -void OSystem_PalmBase::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { -//return; - - MemHandle hTemp = DmGetResource('abmp', id + 100); - - if (hTemp) { - /*static const UInt32 pal[3] = { - (TwGfxComponentsToPackedRGB(0,255,0)), - (TwGfxComponentsToPackedRGB(255,255,0)), - (TwGfxComponentsToPackedRGB(255,0,0)) - };*/ - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - BmpGetDimensions(bmTemp, &w, &h, 0); - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType r = { dst.x, dst.y, w, h }; - - RectangleType c; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinGetClip(&c); - WinResetClip(); - if (show) { - WinSetDrawWindow(_screenH); - WinSetBackColor(0); - WinSetForeColor(120); // pal[color] - WinFillRectangle(&r, 0); - WinSetDrawMode(winOverlay); - WinDrawBitmap(bmTemp, 0, 0); - WinSetDrawMode(winPaint); - - } else { - WinSetBackColor(0); - WinFillRectangle(&r, 0); - } - WinSetClip(&c); - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/base_mouse.cpp b/backends/platform/PalmOS/Src/base_mouse.cpp deleted file mode 100644 index bf11a4b106..0000000000 --- a/backends/platform/PalmOS/Src/base_mouse.cpp +++ /dev/null @@ -1,101 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_base.h" - -void OSystem_PalmBase::warpMouse(int x, int y) { - if (x != _mouseCurState.x || y != _mouseCurState.y) { - x = x >= _screenWidth ? _screenWidth - 1 : x; - y = y >= _screenHeight ? _screenHeight - 1 : y; - - _mouseCurState.x = x; - _mouseCurState.y = y; - } -} - -bool OSystem_PalmBase::showMouse(bool visible) { - bool last = _mouseVisible; - _mouseVisible = visible; - - return last; -} - -void OSystem_PalmBase::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { - if (w == 0 || h == 0) - return; - - _mouseHotspotX = hotspotX; - _mouseHotspotY = hotspotY; - - _mouseKeyColor = keycolor; - - if (_mouseCurState.w != w || _mouseCurState.h != h) { - _mouseCurState.w = w; - _mouseCurState.h = h; - - if (_mouseDataP) - free(_mouseDataP); - - if (_mouseBackupP) - free(_mouseBackupP); - - _mouseDataP = (byte *)malloc(w * h); - _mouseBackupP = (byte *)malloc(w * h * 2); // if 16bit = *2 - } - - if (!_mouseBackupP) { - free(_mouseDataP); - _mouseDataP = NULL; - } - - if (_mouseDataP) - memcpy(_mouseDataP, buf, w * h); -} - -void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) { - Int16 x = _mouseCurState.x; - Int16 y = _mouseCurState.y; - Int16 slow, fact; - - _lastKeyRepeat++; - fact = _screenWidth / 320; - fact = (fact) ? fact : 1; - - if (_lastKeyRepeat > 32 * fact) - _lastKeyRepeat = 32 * fact; - - slow = (iHoriz && iVert) ? 2 : 1; - - x += iHoriz * (_lastKeyRepeat >> 2) / slow * fact; - y += iVert * (_lastKeyRepeat >> 2) / slow * fact; - - x = (x < 0 ) ? 0 : x; - x = (x >= _screenWidth ) ? _screenWidth - 1 : x; - y = (y < 0 ) ? 0 : y; - y = (y >= _screenHeight ) ? _screenHeight - 1 : y; - - *xr = x; - *yr = y; -} diff --git a/backends/platform/PalmOS/Src/be_68k.cpp b/backends/platform/PalmOS/Src/be_68k.cpp deleted file mode 100644 index 77b1e22615..0000000000 --- a/backends/platform/PalmOS/Src/be_68k.cpp +++ /dev/null @@ -1,27 +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. - * - * $URL$ - * $Id$ - * - */ - - -/* More to come */ diff --git a/backends/platform/PalmOS/Src/be_68k.h b/backends/platform/PalmOS/Src/be_68k.h deleted file mode 100644 index 77b1e22615..0000000000 --- a/backends/platform/PalmOS/Src/be_68k.h +++ /dev/null @@ -1,27 +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. - * - * $URL$ - * $Id$ - * - */ - - -/* More to come */ diff --git a/backends/platform/PalmOS/Src/be_base.cpp b/backends/platform/PalmOS/Src/be_base.cpp deleted file mode 100644 index b3caee105d..0000000000 --- a/backends/platform/PalmOS/Src/be_base.cpp +++ /dev/null @@ -1,203 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_base.h" -#include "common/config-file.h" -#include "common/config-manager.h" -#include "backends/saves/default/default-saves.h" -#include "backends/timer/default/default-timer.h" -#include "backends/fs/palmos/palmos-fs-factory.h" -#include "sound/mixer_intern.h" - -#define DEFAULT_SAVE_PATH "/PALM/Programs/ScummVM/Saved/" - - -OSystem_PalmBase::OSystem_PalmBase() { - _overlayVisible = false; - - _current_shake_pos = 0; - _new_shake_pos = 0; - - _paletteDirtyStart = 0; - _paletteDirtyEnd = 0; - - _gfxLoaded = false; - _modeChanged = false; - _setMode = GFX_NORMAL; - _mode = _setMode; - _redawOSD = false; - _setPalette = true; - - _offScreenH = NULL; - _screenH = NULL; - _offScreenP = NULL; - _screenP = NULL; - _screenPitch = gVars->screenPitch; - - _wasKey = false; - _lastKeyModifier = kModifierNone; - _lastKeyRepeat = 100; - _useNumPad = false; - _showBatLow = false; - _batCheckTicks = SysTicksPerSecond() * 15; - _batCheckLast = TimGetTicks(); - - _saveMgr = 0; - _timerMgr = 0; - _mixerMgr = 0; - - _mouseDataP = NULL; - _mouseBackupP = NULL; - _mouseVisible = false; - _mouseDrawn = false; - MemSet(&_keyExtra, sizeof(_keyExtra), 0); - MemSet(&_mouseCurState, sizeof(_mouseCurState), 0); - MemSet(&_mouseOldState, sizeof(_mouseOldState), 0); - MemSet(&_timer, sizeof(TimerType), 0); - MemSet(&_sound, sizeof(SoundType), 0); - - _keyExtraRepeat = 0; - _keyExtraPressed = 0; - _keyExtraDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25); -} - -static int timer_handler(int t) { - DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager(); - tm->handler(); - return t; -} - -void OSystem_PalmBase::initBackend() { - if (gVars->autoSave != -1) - ConfMan.setInt("autosave_period", gVars->autoSave); - - _keyExtra.bitUp = keyBitPageUp; - _keyExtra.bitDown = keyBitPageDown; - _keyExtra.bitLeft = keyBitHard2; - _keyExtra.bitRight = keyBitHard3; - - int_initBackend(); - _keyExtraMask = (_keyExtra.bitUp | _keyExtra.bitDown | _keyExtra.bitLeft | _keyExtra.bitRight | _keyExtra.bitActionA | _keyExtra.bitActionB); - - // Create the savefile manager, if none exists yet (we check for this to - // allow subclasses to provide their own). - if (_saveMgr == 0) { - _saveMgr = new DefaultSaveFileManager(DEFAULT_SAVE_PATH); - } - - // Create and hook up the mixer, if none exists yet (we check for this to - // allow subclasses to provide their own). - if (_mixerMgr == 0) { - setupMixer(); - } - - // Create and hook up the timer manager, if none exists yet (we check for - // this to allow subclasses to provide their own). - if (_timerMgr == 0) { - _timerMgr = new DefaultTimerManager(); - setTimerCallback(::timer_handler, 10); - } - - OSystem::initBackend(); -} - -void OSystem_PalmBase::getTimeAndDate(TimeDate &td) const { - time_t curTime = time(0); - struct tm t = *localtime(&curTime); - td.tm_sec = t.tm_sec; - td.tm_min = t.tm_min; - td.tm_hour = t.tm_hour; - td.tm_mday = t.tm_mday; - td.tm_mon = t.tm_mon; - td.tm_year = t.tm_year; -} - -uint32 OSystem_PalmBase::getMillis() { - return TimGetTicks() * 1000 / SysTicksPerSecond(); -} - -void OSystem_PalmBase::delayMillis(uint msecs) { - Int32 delay = computeMsecs(msecs); - - if (delay > 0) - SysTaskDelay(delay); -} - -void OSystem_PalmBase::setTimerCallback(TimerProc callback, int timer) { - if (callback != NULL) { - _timer.duration = timer; - _timer.nextExpiry = getMillis() + timer; - _timer.callback = callback; - _timer.active = true; - } else { - _timer.active = false; - } -} - -void OSystem_PalmBase::quit() { - int_quit(); - clearSoundCallback(); - unload_gfx_mode(); - - if (_mouseDataP) { - MemPtrFree(_mouseBackupP); - MemPtrFree(_mouseDataP); - } - - delete _saveMgr; - delete _timerMgr; - delete _mixerMgr; - - exit(0); -} - -Common::SaveFileManager *OSystem_PalmBase::getSavefileManager() { - return _saveMgr; -} - -Audio::Mixer *OSystem_PalmBase::getMixer() { - return _mixerMgr; -} - -Common::TimerManager *OSystem_PalmBase::getTimerManager() { - return _timerMgr; -} - -FilesystemFactory *OSystem_PalmBase::getFilesystemFactory() { - return &PalmOSFilesystemFactory::instance(); -} - - -#define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini" - -Common::SeekableReadStream *OSystem_PalmBase::createConfigReadStream() { - Common::FSNode file(PALMOS_CONFIG_FILE); - return file.createReadStream(); -} - -Common::WriteStream *OSystem_PalmBase::createConfigWriteStream() { - Common::FSNode file(PALMOS_CONFIG_FILE); - return file.createWriteStream(); -} diff --git a/backends/platform/PalmOS/Src/be_base.h b/backends/platform/PalmOS/Src/be_base.h deleted file mode 100644 index 1885114ace..0000000000 --- a/backends/platform/PalmOS/Src/be_base.h +++ /dev/null @@ -1,265 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BE_BASE_H -#define BE_BASE_H - -#include - -#include "PalmVersion.h" -#include "globals.h" - -#include "backends/base-backend.h" -#include "common/scummsys.h" -#include "common/events.h" -#include "graphics/surface.h" -#include "graphics/colormasks.h" - -namespace Audio { - class MixerImpl; -} - -namespace Common { - class SaveFileManager; - class TimerManager; -} - -enum { - GFX_NORMAL = 0, - GFX_WIDE, -}; - -// OSD key state -enum { - kModifierNone = 0, - kModifierCommand, - kModifierAlt, - kModifierCtrl, - kModifierCount -}; - -// Mouse button event -enum { - vchrMouseLeft = vchrHardKeyMax - 2, - vchrMouseRight = vchrHardKeyMax - 1 -}; - -// OSD resource id -#define kDrawKeyState 3000 -#define kDrawNumPad 3010 -#define kDrawBatLow 3020 -#define kDrawFight 3030 - -#define computeMsecs(x) ((SysTicksPerSecond() * x) / 1000) - - -//typedef void (*SoundProc)(void *param, byte *buf, int len); -typedef void (*SoundProc)(byte *buf, uint len); -typedef int (*TimerProc)(int interval); - -typedef struct { - UInt32 duration, nextExpiry; - Boolean active; - TimerProc callback; -} TimerType, *TimerPtr; - -typedef struct { - Boolean active; - void *proc; - void *param; -} SoundType, *SoundPtr; - -class OSystem_PalmBase : public BaseBackend { -private: - virtual void int_initBackend() { } - - virtual const GraphicsMode *int_getSupportedGraphicsModes() const; - virtual void int_updateScreen() = 0; - virtual void int_initSize(uint w, uint h) = 0; - virtual void int_setShakePos(int shakeOffset) { } - - virtual void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b) { } - virtual void int_quit() { } - - virtual void unload_gfx_mode() = 0; - virtual void load_gfx_mode() = 0; - - virtual void draw_mouse() = 0; - virtual void undraw_mouse() = 0; - - virtual bool check_event(Common::Event &event, EventPtr ev) = 0; - - virtual void timer_handler(); - void battery_handler(); - virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0; - void simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr); - - virtual void sound_handler() = 0; - virtual bool setupMixer() = 0; - virtual void clearSoundCallback() = 0; - -protected: - OSystem_PalmBase(); - - virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - virtual void clear_screen() = 0; - - struct MousePos { - int16 x,y,w,h; - }; - - TimerType _timer; - SoundType _sound; - - Common::SaveFileManager *_saveMgr; - Audio::MixerImpl *_mixerMgr; - Common::TimerManager *_timerMgr; - - RGBColorType _currentPalette[256]; - uint _paletteDirtyStart, _paletteDirtyEnd; - - int _mode, _setMode; - int16 _screenWidth, _screenHeight; - Boolean _modeChanged, _gfxLoaded; - UInt32 _screenPitch; - - PointType _screenOffset; - struct { - Coord w, h; - } _screenDest; - byte *_screenP, *_offScreenP; - WinHandle _screenH, _offScreenH; - - int _current_shake_pos; - int _new_shake_pos; - - Boolean _overlayVisible; - Boolean _redawOSD, _setPalette; - - UInt32 _keyExtraMask, _keyExtraPressed, _keyExtraRepeat, _keyExtraDelay; - struct { - UInt32 bitUp; - UInt32 bitDown; - UInt32 bitLeft; - UInt32 bitRight; - UInt32 bitActionA; // left mouse button - UInt32 bitActionB; // right mouse button - } _keyExtra; - - bool _mouseVisible; - bool _mouseDrawn; - MousePos _mouseCurState; - MousePos _mouseOldState; - int16 _mouseHotspotX; - int16 _mouseHotspotY; - byte _mouseKeyColor; - byte *_mouseDataP, *_mouseBackupP; - - - bool _wasKey; - UInt8 _lastKeyModifier; - UInt32 _lastKeyRepeat; - Boolean _useNumPad, _showBatLow; - UInt32 _batCheckTicks, _batCheckLast; - -public: - void initBackend(); - -/* - virtual void setFeatureState(Feature f, bool enable) {}; - - - bool hasFeature(Feature f); - bool getFeatureState(Feature f); - - virtual void beginGFXTransaction(); - virtual void endGFXTransaction(); - - virtual int16 getOverlayHeight(); - virtual int16 getOverlayWidth(); - - virtual void setCursorPalette(const byte *colors, uint start, uint num); - virtual void disableCursorPalette(bool disable); - - virtual void displayMessageOnOSD(const char *msg); -*/ - const GraphicsMode *getSupportedGraphicsModes() const; - int getGraphicsMode() const; - virtual int getDefaultGraphicsMode() const; - virtual bool setGraphicsMode(int mode); - - void initSize(uint w, uint h, const Graphics::PixelFormat *format); - int16 getWidth() { return _screenWidth; } - int16 getHeight() { return _screenHeight; } - - void setShakePos(int shakeOffset); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0; - virtual void updateScreen(); - - bool showMouse(bool visible); - void warpMouse(int x, int y); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); - - virtual void showOverlay() = 0; - virtual void hideOverlay() = 0; - virtual void clearOverlay() = 0; - virtual void grabOverlay(OverlayColor *buf, int pitch) = 0; - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0; - - int16 getOverlayWidth() { return getWidth(); } - int16 getOverlayHeight() { return getHeight(); } - - void setPalette(const byte *colors, uint start, uint num); - void grabPalette(byte *colors, uint start, uint num); - virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<565>(); } - - bool pollEvent(Common::Event &event); - - - void getTimeAndDate(TimeDate& td) const; - virtual uint32 getMillis(); - virtual void delayMillis(uint msecs); - - virtual void setTimerCallback(TimerProc callback, int interval); - - virtual MutexRef createMutex() { return NULL; } - virtual void lockMutex(MutexRef mutex) {} - virtual void unlockMutex(MutexRef mutex) {} - virtual void deleteMutex(MutexRef mutex) {} - - virtual Audio::Mixer *getMixer(); - - void quit(); - virtual void setWindowCaption(const char *caption) = 0; - - Common::SaveFileManager *getSavefileManager(); - Common::TimerManager *getTimerManager(); - FilesystemFactory *getFilesystemFactory(); - - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); -}; - -#endif diff --git a/backends/platform/PalmOS/Src/be_os5.cpp b/backends/platform/PalmOS/Src/be_os5.cpp deleted file mode 100644 index c9ef9ecf7c..0000000000 --- a/backends/platform/PalmOS/Src/be_os5.cpp +++ /dev/null @@ -1,169 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" -#include - -OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() { - _sound.active = false; - _setPalette = false; - - _workScreenH = NULL; - _overlayH = NULL; - _isSwitchable = false; - _wasRotated = false; - _cursorPaletteDisabled = true; - - MemSet(&_soundEx, sizeof(SoundExType), 0); - _soundEx.sound = &_sound; -} - -void OSystem_PalmOS5::calc_scale() { - for (int y = 0; y < _screenDest.h; y++) { - int ys = y * _screenHeight / _screenDest.h; - _scaleTableY[y] = ys * _screenWidth; - } - - for (int x = 0; x < _screenDest.w; x++) { - int xs = x * _screenWidth / _screenDest.w; - _scaleTableX[x] = xs; - } -} - -void OSystem_PalmOS5::calc_rect(Boolean fullscreen) { - Int32 w, h; - - if (fullscreen) { - w = (_ratio.adjustAspect == kRatioWidth) ? _ratio.width : gVars->screenFullWidth; - h = (_ratio.adjustAspect == kRatioHeight) ? _ratio.height : gVars->screenFullHeight; - - _screenOffset.x = (_ratio.adjustAspect == kRatioWidth) ? (gVars->screenFullWidth - _ratio.width) / 2 : 0; - _screenOffset.y = (_ratio.adjustAspect == kRatioHeight) ? (gVars->screenFullHeight - _ratio.height) / 2 : 0; - - } else { - w = gVars->screenWidth; - h = gVars->screenHeight * _screenHeight / _screenWidth; - - _screenOffset.x = 0; - _screenOffset.y = (gVars->screenHeight - h) / 2; - } - - _screenDest.w = w; - _screenDest.h = h; -} - -void OSystem_PalmOS5::int_initBackend() { - _keyExtra.bitUp = keyBitRockerUp|keyBitPageUp; - _keyExtra.bitDown = keyBitRockerDown|keyBitPageDown; - _keyExtra.bitLeft = keyBitRockerLeft; - _keyExtra.bitRight = keyBitRockerRight; - _keyExtra.bitActionA = keyBitHard3; - _keyExtra.bitActionB = keyBitHard4; -} - -bool OSystem_PalmOS5::hasFeature(Feature f) { - switch (f) { - case kFeatureCursorHasPalette: - return true; - } - - return false; -} - -void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) { - switch (f) { -/* case kFeatureFullscreenMode: - if (_gfxLoaded) - if (OPTIONS_TST(kOptModeWide) && _initMode != GFX_WIDE) { - _fullscreen = enable; - hotswap_gfx_mode(_mode); - } - break; -*/ - case kFeatureAspectRatioCorrection: - if (_mode == GFX_WIDE) { - _ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3; - //calc_rect(true); - hotswap_gfx_mode(_mode); -// TwGfxSetClip(_palmScreenP, &_dstRect); - clear_screen(); - } - break; - } -} - -void OSystem_PalmOS5::setWindowCaption(const char *caption) { -/* -FIXME/TODO: Convert caption from ISO Latin 1 to "right" encoding ? -If the output encoding is unclear or conversion impossible, -then one could just skip over any chars > 0x7F and display the rest -*/ - Err e; - Char buf[64]; - Coord w, y, h = FntLineHeight() + 2; - const Char *loading = "Loading, please wait\0"; - - // allocate bitmap - BitmapTypeV3 *bmp2P; - BitmapType *bmp1P = BmpCreate(320, (h * 3), 8, NULL, &e); - WinHandle tmpH = WinCreateBitmapWindow(bmp1P, &e); - - WinSetDrawWindow(tmpH); - WinSetBackColor(0); - WinSetTextColor(255); - WinEraseWindow(); - - // loading message - FntSetFont(boldFont); - w = FntCharsWidth(loading, StrLen(loading)); - w = (320 - w) / 2; - WinDrawChars(loading, StrLen(loading), w, 0 + h); - - // caption - FntSetFont(stdFont); - w = FntCharsWidth(caption, StrLen(caption)); - w = (320 - w) / 2; - WinDrawChars(caption, StrLen(caption), w, 0); - - // memory size - StrPrintF(buf, "memory : %ld KB", gVars->startupMemory); - w = FntCharsWidth(buf, StrLen(buf)); - w = (320 - w) / 2; - WinDrawChars(buf, StrLen(buf), w, h * 2); - - // set the bitmap as v3 - bmp2P = BmpCreateBitmapV3(bmp1P, kDensityDouble, BmpGetBits(bmp1P), NULL); - y = (80 - (h / 4) - 5); - - // draw it - WinSetDrawWindow(WinGetDisplayWindow()); - WinEraseWindow(); - WinDrawBitmap((BitmapPtr)bmp2P, 0, y); - - // free - WinDeleteWindow(tmpH, 0); - BmpDelete((BitmapPtr)bmp2P); - BmpDelete(bmp1P); -} diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h deleted file mode 100644 index 2040c7faea..0000000000 --- a/backends/platform/PalmOS/Src/be_os5.h +++ /dev/null @@ -1,189 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BE_OS5_H -#define BE_OS5_H - -#include "be_base.h" - -#if !defined(SYSTEM_CALLBACK) || defined(PALMOS_68K) -# define SYSTEM_CALLBACK -# ifdef PALMOS_ARM -# define CALLBACK_PROLOGUE \ - __asm { \ - stmfd r13!,{r9,r10}; \ - ldr r9,[r0]; \ - ldr r10,[r0,#4]; \ - } -# define CALLBACK_EPILOGUE __asm { ldmfd r13!,{r9,r10} } -# define CALLBACK_INIT(regs) \ - __asm { \ - ldr r0, = regs; \ - add r0,r0,r10; \ - str r9,[r0]; \ - str r10,[r0,#4]; \ - } -# else -# define CALLBACK_PROLOGUE \ - asm ( \ - movem.l a4-a5, -(sp); \ - move.l UserDataP, a0; \ - move.l 0(a0), a4; \ - move.l 4(a0), a5; \ - ); -# define CALLBACK_EPILOGUE asm ( movem.l (sp)+, a4-a5 ); -# define CALLBACK_INIT(regs) \ - { \ - void *ptr = ®s; \ - asm ( \ - move.l ptr, a0; \ - move.l a4, 0(a0); \ - move.l a5, 4(a0); \ - ); \ - } -# endif -#else -# define CALLBACK_PROLOGUE -# define CALLBACK_EPILOGUE -# define CALLBACK_INIT(regs) -#endif - -// TODO : change / remove this -#define gfxMakeDisplayRGB_BigEndian(_r,_g,_b) \ - ( (((_g) & 0xFC) << 11) | (((_b) & 0xF8) << 5) | ((_r) & 0xF8) | (((_g) & 0xFF) >> 5) ) - -#define gfxMakeDisplayRGB_LittleEndian(_r,_g,_b) \ - ( (((_r) & 0xF8) << 8) | (((_g) & 0xFC) << 3) | (((_b) & 0xF8) >> 3) ) - -#if CPU_TYPE == CPU_68K -#define gfxMakeDisplayRGB(_r,_g,_b) gfxMakeDisplayRGB_BigEndian(_r,_g,_b) -#else -#define gfxMakeDisplayRGB(_r,_g,_b) gfxMakeDisplayRGB_LittleEndian(_r,_g,_b) -#endif - -typedef struct { - // for real thread version only - UInt32 __reg1; - UInt32 __reg2; - - // no real thread version - Boolean set; - UInt32 size; - void *dataP; - - // default sound stuff - SndStreamRef handle; - SoundPtr sound; -} SoundExType, *SoundExPtr; -extern SoundExType _soundEx; - -class OSystem_PalmOS5 : public OSystem_PalmBase { -protected: - uint16 _nativePal[256], _mousePal[256]; - -private: - uint16 _scaleTableX[512]; - uint32 _scaleTableY[512]; - - typedef void (OSystem_PalmOS5::*RendererProc)(RectangleType &r, PointType &p); - RendererProc _render; - - Graphics::Surface _framebuffer; - - OverlayColor *_overlayP; - WinHandle _overlayH, _workScreenH; - uint16 *_workScreenP; - - Boolean _isSwitchable, _wasRotated; - - virtual void int_initBackend(); - virtual void int_updateScreen(); - virtual void int_initSize(uint w, uint h); - - virtual void unload_gfx_mode(); - virtual void load_gfx_mode(); - virtual void hotswap_gfx_mode(int mode); - - void draw_mouse(); - void undraw_mouse(); - virtual bool check_event(Common::Event &event, EventPtr ev); - void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b); - void calc_scale(); - - void render_landscapeAny(RectangleType &r, PointType &p); - void render_landscape15x(RectangleType &r, PointType &p); - void render_1x(RectangleType &r, PointType &p); - WinHandle alloc_screen(Coord w, Coord h); - virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - - virtual SndStreamVariableBufferCallback sound_callback(); - virtual void sound_handler(); - virtual bool setupMixer(); - void clearSoundCallback(); - -protected: - UInt16 _sysOldCoord, _sysOldOrientation, _sysOldTriggerState; - Boolean _stretched, _cursorPaletteDisabled; - - enum { - kRatioNone = 0, - kRatioHeight, - kRatioWidth - }; - struct { - UInt8 adjustAspect; - Coord width; // (width x 320) - Coord height; // (480 x height) - } _ratio; - - void calc_rect(Boolean fullscreen); - void get_coordinates(EventPtr ev, Coord &x, Coord &y); - void clear_screen(); - -public: - OSystem_PalmOS5(); - static OSystem *create(); - - bool hasFeature(Feature f); - void setFeatureState(Feature f, bool enable); - - void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); - virtual Graphics::Surface *lockScreen(); - virtual void unlockScreen(); - - void setCursorPalette(const byte *colors, uint start, uint num); - void disableCursorPalette(bool disable); - - void showOverlay(); - void hideOverlay(); - virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); - - void setWindowCaption(const char *caption); - -}; - -#endif diff --git a/backends/platform/PalmOS/Src/be_os5ex.cpp b/backends/platform/PalmOS/Src/be_os5ex.cpp deleted file mode 100644 index 05bf5e49ce..0000000000 --- a/backends/platform/PalmOS/Src/be_os5ex.cpp +++ /dev/null @@ -1,103 +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. - * - * $URL$ - * $Id$ - * - */ - -// for DAL.h -#define ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS - -#include "be_os5ex.h" -#include "palmdefs.h" - -#include -#include - -static TimerExType _timerEx; - -OSystem_PalmOS5Ex::OSystem_PalmOS5Ex() : OSystem_PalmOS5() { - _timerEx.timerID = 0; - _timerEx.timer = &_timer; - _timerEx.ticks = SysTicksPerSecond(); -} - -static SYSTEM_CALLBACK void timer_handler(void *userDataP) { - CALLBACK_PROLOGUE - TimerExPtr _timerEx = (TimerExPtr)userDataP; - TimerPtr _timer = _timerEx->timer; - _timer->duration = _timer->callback(_timer->duration); - KALTimerSet(_timerEx->timerID, (_timer->duration * _timerEx->ticks / 1000)); - CALLBACK_EPILOGUE -} - -void OSystem_PalmOS5Ex::setTimerCallback(TimerProc callback, int timer) { - if (_timer.active && _timerEx.timerID) - KALTimerDelete(_timerEx.timerID); - - if (callback != NULL) { - Err e; - CALLBACK_INIT(_timerEx); - _timer.duration = timer; - _timer.callback = callback; - - // create the timer - e = KALTimerCreate(&_timerEx.timerID, appFileCreator, &::timer_handler, &_timerEx); - if (!e) { - e = KALTimerSet(_timerEx.timerID, (timer * _timerEx.ticks / 1000)); - if (e) KALTimerDelete(_timerEx.timerID); - } - _timer.active = (!e); - - } else { - _timer.active = false; - } - - if (!_timer.active) - _timerEx.timerID = 0; -} - -OSystem::MutexRef OSystem_PalmOS5Ex::createMutex() { - UInt32 mutexID; - Err e = KALMutexCreate(&mutexID, appFileCreator); - return (MutexRef)(e ? NULL : mutexID); - -} - -void OSystem_PalmOS5Ex::lockMutex(MutexRef mutex) { - if (mutex) - KALMutexReserve((UInt32)mutex); -} - -void OSystem_PalmOS5Ex::unlockMutex(MutexRef mutex) { - if (mutex) - KALMutexRelease((UInt32)mutex, 0); -} - -void OSystem_PalmOS5Ex::deleteMutex(MutexRef mutex) { - if (mutex) - KALMutexDelete((UInt32)mutex); -} - -void OSystem_PalmOS5Ex::int_quit() { - if (_timerEx.timerID) - KALTimerDelete(_timerEx.timerID); -} diff --git a/backends/platform/PalmOS/Src/be_os5ex.h b/backends/platform/PalmOS/Src/be_os5ex.h deleted file mode 100644 index f9842d82ac..0000000000 --- a/backends/platform/PalmOS/Src/be_os5ex.h +++ /dev/null @@ -1,68 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BE_OS5EX_H -#define BE_OS5EX_H - -#include "be_os5.h" - -#undef dprintf // fix compilation in Zodiac mode - -#ifndef PALMOS_ARM -// Not usable with 68k mode (?), so ... -#define OSystem_PalmOS5Ex OSystem_PalmOS5 -#else - -typedef struct { - UInt32 __r9; - UInt32 __r10; - UInt32 timerID; - UInt32 ticks; - - TimerPtr timer; -} TimerExType, *TimerExPtr; - -class OSystem_PalmOS5Ex : public OSystem_PalmOS5 { -private: - void timer_handler() {} - void sound_handler() {} - void int_quit(); - - SndStreamVariableBufferCallback sound_callback(); - -public: - OSystem_PalmOS5Ex(); - static OSystem *create(); - - void setTimerCallback(TimerProc callback, int interval); - - MutexRef createMutex(); - void lockMutex(MutexRef mutex); - void unlockMutex(MutexRef mutex); - void deleteMutex(MutexRef mutex); -}; -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/be_zodiac.cpp b/backends/platform/PalmOS/Src/be_zodiac.cpp deleted file mode 100644 index d6e7e2c292..0000000000 --- a/backends/platform/PalmOS/Src/be_zodiac.cpp +++ /dev/null @@ -1,74 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_zodiac.h" - -OSystem_PalmZodiac::OSystem_PalmZodiac() : OSystem_PalmOS5Ex() { - _gfxH = NULL; - _overlayP = NULL; - _palmScreenP = NULL; - _tmpScreenP = NULL; - _stretched = false; -} - -void OSystem_PalmZodiac::int_initBackend() { - _keyExtra.bitUp = keyBitRockerUp; - _keyExtra.bitDown = keyBitRockerDown; - _keyExtra.bitLeft = keyBitRockerLeft; - _keyExtra.bitRight = keyBitRockerRight; - -// _keyExtra.bitActionA = keyBitActionD; -// _keyExtra.bitActionB = keyBitActionB; -} - -void OSystem_PalmZodiac::calc_rect(Boolean fullscreen) { - OSystem_PalmOS5::calc_rect(fullscreen); - - _dstRect.x = _screenOffset.x; - _dstRect.y = _screenOffset.y; - _dstRect.w = _screenDest.w; - _dstRect.h = _screenDest.h; -} - -void OSystem_PalmZodiac::setFeatureState(Feature f, bool enable) { - switch (f) { -/* case kFeatureFullscreenMode: - if (_gfxLoaded) - if (OPTIONS_TST(kOptModeWide) && _initMode != GFX_WIDE) { - _fullscreen = enable; - hotswap_gfx_mode(_mode); - } - break; -*/ - case kFeatureAspectRatioCorrection: - if (_mode == GFX_WIDE) { - _ratio.adjustAspect = (_ratio.adjustAspect + 1) % 3; - calc_rect(true); - TwGfxSetClip(_palmScreenP, &_dstRect); - clear_screen(); - } - break; - } -} diff --git a/backends/platform/PalmOS/Src/be_zodiac.h b/backends/platform/PalmOS/Src/be_zodiac.h deleted file mode 100644 index 28fcf29ddd..0000000000 --- a/backends/platform/PalmOS/Src/be_zodiac.h +++ /dev/null @@ -1,76 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BE_ZODIAC_H -#define BE_ZODIAC_H - -#include -#include "be_os5ex.h" - -#define MIN_OFFSET 20 - -class OSystem_PalmZodiac : public OSystem_PalmOS5Ex { -private: - - TwGfxType *_gfxH; - TwGfxSurfaceType *_palmScreenP, *_tmpScreenP; - TwGfxSurfaceType *_overlayP; - Boolean _fullscreen; - - TwGfxPointType _srcPos; - TwGfxRectType _srcRect, _dstRect; - TwGfxBitmapType _srcBmp; - - void int_initBackend(); - void int_setShakePos(int shakeOffset); - - void draw_mouse(); - void undraw_mouse(); - - void unload_gfx_mode(); - void load_gfx_mode(); - void hotswap_gfx_mode(int mode); - - void calc_rect(Boolean fullscreen); - bool check_event(Common::Event &event, EventPtr ev); - void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0); - -public: - OSystem_PalmZodiac(); - - static OSystem *create(); - - void setFeatureState(Feature f, bool enable); - - int getDefaultGraphicsMode() const; - - void updateScreen(); - - void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_aeroplayer.cpp b/backends/platform/PalmOS/Src/cd_aeroplayer.cpp deleted file mode 100644 index c30fba595c..0000000000 --- a/backends/platform/PalmOS/Src/cd_aeroplayer.cpp +++ /dev/null @@ -1,166 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "common/system.h" -#include "common/config-manager.h" - -#include "cd_aeroplayer.h" - -AeroCDPlayer::AeroCDPlayer(OSystem *sys) { - _sys = sys; - StrCopy(gameP, ConfMan.getActiveDomainName().c_str()); -} - -bool AeroCDPlayer::init() { - aeroplayer_Startup(); - _isInitialized = aeroplayer_PlayerIsActive(); - - if (_isInitialized) - _volumeLimit = aeroplayer_GetMaxVolumeIndex(); - - return _isInitialized; -} - -void AeroCDPlayer::release() { - aeroplayer_Shutdown(); - - // self delete - delete this; -} - -UInt32 AeroCDPlayer::getStatus() { - return aeroplayer_GetPlaybackStatus(); -} - -UInt32 AeroCDPlayer::getPosition() { - return aeroplayer_GetPosition_msec(); -} - -UInt32 AeroCDPlayer::getDuration() { - return aeroplayer_GetDuration_msec(); -} - -void AeroCDPlayer::setPosition(UInt32 value) { - aeroplayer_Seek_abs_msec(value); -} - -void AeroCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - aeroplayer_SetVolumeIndex((_volumeLimit * volume) / 100); -} - -bool AeroCDPlayer::poll() { - return - ( _pckLoops != 0 && - ( getPosition() < _pckTrackEndFrame && - getStatus() == AEROPLAYER_STATUS_PLAY - ) - ); -} - -void AeroCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_pckStopTime != 0 && _sys->getMillis() >= _pckStopTime) { - forceStop(); - _pckLoops = 0; - _pckStopTime = 0; - _pckTrackEndFrame = 0; - return; - } - - // not fully played - if (getPosition() < _pckTrackEndFrame && getStatus() == AEROPLAYER_STATUS_PLAY) - return; - - aeroplayer_Pause(); -// _pckStopTime = _sys->getMillis(); - - // loop again ? - if (_pckLoops > 0) - _pckLoops--; - - // loop if needed - if (_pckLoops == 0) - forceStop(); - else { - //_pckStopTime = 0; - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - setPosition(0); - } else { - setPosition(_pckTrackStartFrame); - } - - aeroplayer_Play(); - _pckEndTime = _sys->getMillis() + _pckTrackDuration; - } -} - -void AeroCDPlayer::stop() { - _pckStopTime = _sys->getMillis(); - _pckLoops = 0; - return; -} - -void AeroCDPlayer::forceStop() { - if (getStatus() != AEROPLAYER_STATUS_STOP) - aeroplayer_PlayTrack(vfsInvalidVolRef, NULL); -} - -void AeroCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - Char fileP[100]; - static const Char *ext[] = { "mp3", "ogg" }; - -// if (duration > 0) -// duration += 5; - - _pckTrack = track; - _pckLoops = num_loops; - _pckTrackStartFrame = TO_MSECS(start_frame); - _pckTrackDuration = TO_MSECS(duration); - - StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]); - aeroplayer_Pause(); - aeroplayer_PlayTrack(gVars->VFS.volRefNum, fileP); - aeroplayer_Pause(); - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - _pckTrackDuration = getDuration(); - } else { - setPosition(_pckTrackStartFrame); - if (_pckTrackDuration == 0) - _pckTrackDuration = getDuration() - _pckTrackStartFrame; - } - - aeroplayer_Play(); - - _pckStopTime = 0; - _pckTrackEndFrame = _pckTrackStartFrame + _pckTrackDuration; - _pckEndTime = _sys->getMillis() + _pckTrackDuration; -} diff --git a/backends/platform/PalmOS/Src/cd_aeroplayer.h b/backends/platform/PalmOS/Src/cd_aeroplayer.h deleted file mode 100644 index e661e06d52..0000000000 --- a/backends/platform/PalmOS/Src/cd_aeroplayer.h +++ /dev/null @@ -1,65 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CD_AEROPLAYER_H -#define CD_AEROPLAYER_H - -#include "cdaudio.h" -#include "aeroplayer_public.h" - -class AeroCDPlayer : public CDAudio { -public: - AeroCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - -private: - OSystem *_sys; - Char gameP[15]; - - UInt32 getStatus(); - void setPosition(UInt32 value); - UInt32 getDuration(); - UInt32 getPosition(); - void forceStop(); - - UInt16 _volumeLimit; - - Boolean _isPlaying; - // cdrom - UInt16 _pckLoops, _pckTrack; - UInt32 _pckTrackStartFrame, _pckTrackEndFrame; - UInt32 _pckStopTime, _pckEndTime, _pckTrackDuration; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_default.cpp b/backends/platform/PalmOS/Src/cd_default.cpp deleted file mode 100644 index 416701524d..0000000000 --- a/backends/platform/PalmOS/Src/cd_default.cpp +++ /dev/null @@ -1,104 +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. - * - * $URL$ - * $Id$ - * - */ -#include "common/system.h" -#include "cd_default.h" - -DefaultCDPlayer::DefaultCDPlayer(OSystem *sys) { - _sys = sys; -} - -bool DefaultCDPlayer::init() { - _isInitialized = true; - return _isInitialized; -} - -void DefaultCDPlayer::release() { - // self delete - delete this; -} - -bool DefaultCDPlayer::poll() { - return (_defLoops != 0 && _sys->getMillis() < _defTrackEndFrame); -} - -void DefaultCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_defStopTime != 0 && _sys->getMillis() >= _defStopTime) { - _defLoops = 0; - _defStopTime = 0; - _defTrackEndFrame = 0; - return; - } - - // not fully played - if (_sys->getMillis() < _defTrackEndFrame) - return; - - if (_defLoops == 0) - return; - - // loop again ? - if (_defLoops > 0) - _defLoops--; - - // loop if needed - if (_defLoops != 0) { - _defTrackEndFrame = _sys->getMillis() + _defTrackLength; - } -} - -void DefaultCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - _defStopTime = _sys->getMillis() + 100; - _defLoops = 0; - return; -} - -void DefaultCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - UInt32 fullLength; - - _defLoops = num_loops; - start_frame = TO_MSECS(start_frame); - duration = TO_MSECS(duration); - - // frame in milli-seconds - _defStopTime = 0; - fullLength = start_frame + gVars->CD.defaultTrackLength * 1000; - - if (duration > 0) { - _defTrackLength = duration; - } else if (start_frame > 0) { - _defTrackLength = fullLength; - _defTrackLength -= start_frame; - } else { - _defTrackLength = fullLength; - } - - // try to play the track - _defTrackEndFrame = _sys->getMillis() + _defTrackLength; -} diff --git a/backends/platform/PalmOS/Src/cd_default.h b/backends/platform/PalmOS/Src/cd_default.h deleted file mode 100644 index 69d909b1e7..0000000000 --- a/backends/platform/PalmOS/Src/cd_default.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. - * - * $URL$ - * $Id$ - * - */ - - #ifndef CD_DEFAULT_H - #define CD_DEFAULT_H - - #include "cdaudio.h" - - class DefaultCDPlayer : public CDAudio { - public: - DefaultCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - private: - OSystem *_sys; - - // cdrom - UInt16 _defLoops; - UInt32 _defStopTime, _defTrackEndFrame, _defTrackLength; - }; - - #endif diff --git a/backends/platform/PalmOS/Src/cd_msa.cpp b/backends/platform/PalmOS/Src/cd_msa.cpp deleted file mode 100644 index 5812d49b6d..0000000000 --- a/backends/platform/PalmOS/Src/cd_msa.cpp +++ /dev/null @@ -1,261 +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. - * - * $URL$ - * $Id$ - * - */ -#include -#include "common/system.h" -#include "cd_msa.h" -#include "start.h" // for appFileCreat - -static void doErr(Err e, const Char *msg) { - Char err[100]; - StrPrintF(err, "%ld : " , e); - StrCat(err,msg); - FrmCustomAlert(1000,err,0,0); -} - -MsaCDPlayer::MsaCDPlayer(OSystem *sys) { - _sys = sys; - _msaRefNum = sysInvalidRefNum; - - _msaLoops = 0; - _msaStopTime = 0; - _msaTrackEndSu = 0; -} - -bool MsaCDPlayer::init() { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - Err error = errNone; - - if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - // not found with audio adapter ?! - //if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) { - if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum))) - if (error == sysErrLibNotFound) - error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum); - - // FIXME : still don't understand how this lib works, it seems to be very unstable - // and with the very bad documentation provided by Sony it's difficult to find out why - // this doesn't work the same way on build-in MP3 device and external MP3 devices - if (!error) { - //MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ... - error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum); - - //if (error == msaErrAlreadyOpen) - // error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator); - - //error = (error != msaErrStillOpen) ? error : errNone; - } - //} - } - -// if (error) -// _msaRefNum = sysInvalidRefNum; - - _isInitialized = (_msaRefNum != sysInvalidRefNum); - initInternal(); - return _isInitialized; -} - -void MsaCDPlayer::initInternal() { - if (!_isInitialized) - return; - - Err e; - Char nameP[256]; - UInt32 dummy, albumIterater = albumIteratorStart; - - MemSet(&_msaAlbum, sizeof(_msaAlbum), 0); - _msaAlbum.maskflag = msa_INF_ALBUM; - _msaAlbum.code = msa_LANG_CODE_ASCII; - _msaAlbum.nameP = nameP; - _msaAlbum.fileNameLength = 256; - - e = MsaAlbumEnumerate(_msaRefNum, &albumIterater, &_msaAlbum); - e = MsaSetAlbum(_msaRefNum, _msaAlbum.albumRefNum, &dummy); - - // TODO : use RMC to control volume - MsaOutCapabilityType capability; - MsaOutGetCapability(_msaRefNum, &capability); - _volumeLLimit = capability.volumeLLimit; - _volumeRLimit = capability.volumeRLimit; -} - -void MsaCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - MsaOutSetVolume(_msaRefNum, (_volumeLLimit * volume) / 100, (_volumeRLimit * volume) / 100); -} - -void MsaCDPlayer::release() { - if (_isInitialized) { - if (_msaRefNum != sysInvalidRefNum) { - // stop the current track if any (needed if we use enforce open to prevent the track to play after exit) - MsaStop(_msaRefNum, true); - MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); - } - } - - // self delete - delete this; -} - -bool MsaCDPlayer::poll() { - if (!_isInitialized) - return false; - - MsaPBStatus pb; - MsaGetPBStatus(_msaRefNum, &pb); - return (_msaLoops != 0 && (pb.currentSU < _msaTrackEndSu || pb.status != msa_STOPSTATUS)); -} - -void MsaCDPlayer::update() { - if (!_isInitialized) - return; - - // get playback status - MsaPBStatus pb; - MsaGetPBStatus(_msaRefNum, &pb); - - // stop replay upon request of stopCD() - if (_msaStopTime != 0 && _sys->getMillis() >= _msaStopTime) { - MsaStop(_msaRefNum, true); - _msaLoops = 0; - _msaStopTime = 0; - _msaTrackEndSu = 0; - return; - } - - // not fully played nad still playing the correct track - // (when playing a full track the return SU is not correct - // and so we need to check if we are still playing the correct track) - if (pb.currentSU < _msaTrackEndSu) { - UInt16 trackNo; - MsaPBListIndexToTrackNo(_msaRefNum, pb.currentpblistindex, &trackNo); - if (trackNo == _msaTrack) - return; - } - - MsaStop(_msaRefNum, true); - - if (_msaLoops == 0) - return; - - // track ends and last play, force stop if still playing -/* if (_msaLoops != 1 && pb.status != msa_STOPSTATUS) { - MsaStop(_msaRefNum, true); - return; - } -*/ - // loop again ? - if (_msaLoops > 0) - _msaLoops--; - - // loop if needed - if (_msaLoops != 0) { - if (_msaStartFrame == 0 && _msaDuration == 0) - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - else - MsaPlay(_msaRefNum, _msaTrack, _msaTrackStartSu, msa_PBRATE_SP); - } -} - -void MsaCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - if (!_isInitialized) - return; - - _msaStopTime = _sys->getMillis() + 100; - _msaLoops = 0; - return; -} - -void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!_isInitialized) - return; - - if (!num_loops && !start_frame) - return; - - _msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album) - _msaLoops = num_loops; - _msaStartFrame = TO_MSECS(start_frame); - _msaDuration = TO_MSECS(duration); - - Err e; - MemHandle trackH; - - // stop current play if any - MsaStop(_msaRefNum, true); - _msaStopTime = 0; - - // retreive track infos - e = MsaGetTrackInfo(_msaRefNum, _msaTrack, 0, msa_LANG_CODE_ASCII, &trackH); - - // track exists - if (!e && trackH) { - MsaTime msaTime; - MsaTrackInfo *trackP; - UInt32 SU, fullLength; - - // FIXME (?) : this enable MsaSuToTime to return the right value in some cases - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - MsaStop(_msaRefNum, true); - - // get the msa time - trackP = (MsaTrackInfo *)MemHandleLock(trackH); - MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime); - SU = trackP->totalsu; - MemPtrUnlock(trackP); - MemHandleFree(trackH); - - // MSA frame in milli-seconds - fullLength = FROM_MIN(msaTime.minute); - fullLength += FROM_SEC(msaTime.second); - fullLength += msaTime.frame; - - if (_msaDuration > 0) { - _msaTrackLength = _msaDuration; - } else if (_msaStartFrame > 0) { - _msaTrackLength = fullLength; - _msaTrackLength -= _msaStartFrame; - } else { - _msaTrackLength = fullLength; - } - - // try to play the track - if (start_frame == 0 && duration == 0) { - MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP); - _msaTrackEndSu = SU; - } else { - // FIXME : MsaTimeToSu doesn't work ... (may work with previous FIXME) - _msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU)); - _msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU)); - _msaTrackEndSu += _msaTrackStartSu; - - if (_msaTrackEndSu > SU) - _msaTrackEndSu = SU; - - MsaPlay(_msaRefNum, _msaTrack, _msaTrackStartSu, msa_PBRATE_SP); - } - } - // TODO : use default track length if track not found -} diff --git a/backends/platform/PalmOS/Src/cd_msa.h b/backends/platform/PalmOS/Src/cd_msa.h deleted file mode 100644 index 223bc0efcf..0000000000 --- a/backends/platform/PalmOS/Src/cd_msa.h +++ /dev/null @@ -1,68 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CD_MSA_H -#define CD_MSA_H - -#include "cdaudio.h" - -class MsaCDPlayer : public CDAudio { -public: - MsaCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - - private: - void initInternal(); - - OSystem *_sys; - UInt16 _msaRefNum; - - UInt32 _volumeLLimit; - UInt32 _volumeRLimit; - - // cdrom - AlbumInfoType _msaAlbum; - UInt16 _msaLoops; - - UInt32 _msaStopTime; - - UInt32 _msaStartFrame; - UInt32 _msaDuration; - - UInt16 _msaTrack; - UInt32 _msaTrackStartSu, _msaTrackEndSu; - UInt32 _msaTrackLength; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/cd_pockettunes.cpp b/backends/platform/PalmOS/Src/cd_pockettunes.cpp deleted file mode 100644 index 5a9f3874eb..0000000000 --- a/backends/platform/PalmOS/Src/cd_pockettunes.cpp +++ /dev/null @@ -1,238 +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. - * - * $URL$ - * $Id$ - * - */ -#include "common/system.h" -#include "common/config-manager.h" - -#include "cd_pockettunes.h" - -PckTunesCDPlayer::PckTunesCDPlayer(OSystem *sys) { - _sys = sys; - StrCopy(gameP, ConfMan.getActiveDomainName().c_str()); -} - -bool PckTunesCDPlayer::init() { - PocketTunesStart(); - _isInitialized = PocketTunesIsRunning(); - _isPlaying = false; - _pAction = NULL; - - if (_isInitialized) { - _pAction = (PocketTunesAction*)MemPtrNew(sizeof(PocketTunesAction)); - _volumeLimit = getVolumeLimit(); - } - - _isInitialized = (_isInitialized && _pAction); - return _isInitialized; -} - -void PckTunesCDPlayer::release() { - PocketTunesStop(); - if (_pAction) - MemPtrFree(_pAction); - - // self delete - delete this; -} - -UInt32 PckTunesCDPlayer::getVolumeLimit() { - UInt32 value = 0; - - if (!_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueMaxVolume; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -UInt32 PckTunesCDPlayer::getStatus() { - UInt32 status = kPtunesStopped; - - if (!_isPlaying || !_pAction) - return status; - - _pAction->action = kPocketTunesActionGetStatus; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - status = _pAction->data.getStatusAction.status; - - return status; -} - -UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) { - UInt32 value = deflt; - - if (!_isPlaying || !_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueSongPosition; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -UInt32 PckTunesCDPlayer::getDuration() { - UInt32 value = gVars->CD.defaultTrackLength; - - if (!_isPlaying || !_pAction) - return value; - - _pAction->action = kPocketTunesActionGetValue; - _pAction->data.getValueAction.which = kPtunesValueSongDuration; - - EvtGetEvent(&_eAction, evtNoWait); - if (PocketTunesCallSynch(_pAction) == errNone) - value = _pAction->data.getValueAction.value; - - return value; -} - -void PckTunesCDPlayer::setPosition(UInt32 value) { - if (!_isPlaying) - return; - - PocketTunesAction *pAction = AllocateAsynchronousActionStruct(); - if (!pAction) - return; - - pAction->action = kPocketTunesActionSetValue; - pAction->data.getValueAction.which = kPtunesValueSongPosition; - pAction->data.getValueAction.value = value; - - EvtGetEvent(&_eAction, evtNoWait); - PocketTunesCall(pAction); -} - -void PckTunesCDPlayer::setVolume(int volume) { - _volumeLevel = volume; - - PocketTunesAction *pAction = AllocateAsynchronousActionStruct(); - if (!pAction) - return; - - pAction->action = kPocketTunesActionSetValue; - pAction->data.getValueAction.which = kPtunesValueVolume; - pAction->data.getValueAction.value = (_volumeLimit * volume) / 100; - - EvtGetEvent(&_eAction, evtNoWait); - PocketTunesCall(pAction); -} - -bool PckTunesCDPlayer::poll() { - return (_pckLoops != 0 && (getPosition(_pckTrackEndFrame) < _pckTrackEndFrame || getStatus() != kPtunesStopped)); -} - -void PckTunesCDPlayer::update() { - - // stop replay upon request of stopCD() - if (_pckStopTime != 0 && _sys->getMillis() >= _pckStopTime) { - PocketTunesStop(); - _pckLoops = 0; - _pckStopTime = 0; - _pckTrackEndFrame = 0; - return; - } - - // not fully played - if (getPosition(_pckTrackEndFrame) < _pckTrackEndFrame && getStatus() != kPtunesStopped) - return; - - PocketTunesStop(); - - if (_pckLoops == 0) - return; - - // loop again ? - if (_pckLoops > 0) - _pckLoops--; - - // loop if needed - if (_pckLoops != 0 && _isPlaying) { - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - setPosition(0); - } else { - setPosition(_pckTrackStartFrame); - } - - PocketTunesPlay(); - } -} - -void PckTunesCDPlayer::stop() { /* Stop CD Audio in 1/10th of a second */ - _pckStopTime = _sys->getMillis() + 100; - _pckLoops = 0; - return; -} - -void PckTunesCDPlayer::play(int track, int num_loops, int start_frame, int duration) { - if (!num_loops && !start_frame) - return; - - EventType e; - Char nameP[256], fileP[100]; - static const Char *ext[] = { "mp3", "ogg" }; - - _pckTrack = track; - _pckLoops = num_loops; - _pckTrackStartFrame = TO_MSECS(start_frame); - _pckTrackDuration = TO_MSECS(duration); - - VFSVolumeGetLabel(gVars->VFS.volRefNum, nameP, 256); - - StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]); - - if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) { - EvtGetEvent(&e, evtNoWait); - PocketTunesPauseIfPlaying(); - _isPlaying = true; - - if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) { - _pckTrackDuration = getDuration(); - } else { - setPosition(_pckTrackStartFrame); - if (_pckTrackDuration == 0) - _pckTrackDuration = getDuration() - _pckTrackStartFrame; - } - - PocketTunesPlay(); - - } else { - _isPlaying = false; - _pckTrackDuration = gVars->CD.defaultTrackLength * 1000; - } - - _pckStopTime = 0; - _pckTrackEndFrame = _pckTrackStartFrame + _pckTrackDuration; -} diff --git a/backends/platform/PalmOS/Src/cd_pockettunes.h b/backends/platform/PalmOS/Src/cd_pockettunes.h deleted file mode 100644 index 77938d846a..0000000000 --- a/backends/platform/PalmOS/Src/cd_pockettunes.h +++ /dev/null @@ -1,69 +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. - * - * $URL$ - * $Id$ - * - */ - - #ifndef CD_POCKETTUNES_H - #define CD_POCKETTUNES_H - - #include "cdaudio.h" - #include "pockettunes.h" - - class PckTunesCDPlayer : public CDAudio { - public: - PckTunesCDPlayer(OSystem *sys); - - bool init(); - void release(); - - bool poll(); - void update(); - void play(int track, int num_loops, int start_frame, int duration); - void stop(); - - void setVolume(int volume); - - private: - OSystem *_sys; - Char gameP[15]; - - PocketTunesAction *_pAction; // prevent memory fragmentation - EventType _eAction; - - UInt32 getStatus(); - void setPosition(UInt32 value); - UInt32 getDuration(); - UInt32 getPosition(UInt32 deft); - - UInt32 _volumeLimit; - UInt32 getVolumeLimit(); - - Boolean _isPlaying; - // cdrom - UInt16 _pckLoops, _pckTrack; - UInt32 _pckTrackStartFrame, _pckTrackEndFrame; - UInt32 _pckStopTime, _pckTrackDuration; - }; - - #endif - diff --git a/backends/platform/PalmOS/Src/cdaudio.h b/backends/platform/PalmOS/Src/cdaudio.h deleted file mode 100644 index 7a3f5e56e4..0000000000 --- a/backends/platform/PalmOS/Src/cdaudio.h +++ /dev/null @@ -1,67 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CDAUDIO_H -#define CDAUDIO_H - -#include "common/system.h" - -// CD frames are 1/75 sec -#define CD_FPS 75 -#define TO_MSECS(frame) ((UInt32)((frame) * 1000 / CD_FPS)) - -// consider frame at 1/1000 sec -#define FROM_MIN(mins) ((UInt32)((mins) * 60 * 1000)) -#define FROM_SEC(secs) ((UInt32)((secs) * 1000)) - -class CDAudio { -public: - CDAudio() { - _isInitialized = false; - _volumeLevel = 100; - }; - - virtual bool init() = 0; - virtual void release() = 0; - - // OSystem functions - virtual bool poll() = 0; - virtual void play(int track, int num_loops, int start_frame, int duration) = 0; - virtual void stop() = 0; - virtual void update() = 0; - - // volume in percent - virtual void setVolume(int volume) { _volumeLevel = volume; } - virtual int getVolume() const { return _volumeLevel; } - - virtual void upVolume(int value) {} - virtual void downVolume(int value) {} - -protected: - int _volumeLevel; - bool _isInitialized; -}; - -#endif diff --git a/backends/platform/PalmOS/Src/extend.cpp b/backends/platform/PalmOS/Src/extend.cpp deleted file mode 100644 index 430563a302..0000000000 --- a/backends/platform/PalmOS/Src/extend.cpp +++ /dev/null @@ -1,109 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "PalmVersion.h" -#include -#include "globals.h" - -#include "modulesrsc.h" - -void PalmFatalError(const char *err) { - WinSetDrawWindow(WinGetDisplayWindow()); - WinPalette(winPaletteSetToDefault,0,0,0); - WinSetBackColor(0); - WinEraseWindow(); - FrmCustomAlert(FrmFatalErrorAlert, err, 0,0); -} - -void DrawStatus(Boolean show) { - if (OPTIONS_TST(kOptDisableOnScrDisp)) - return; - - UInt8 x,y; - UInt32 depth, d1; - Boolean d2; - WinScreenMode(winScreenModeGet, &d1, &d1, &depth, &d2); - Int16 color = (show ? gVars->indicator.on : gVars->indicator.off); - - if (depth == 8) { - UInt8 *src = (UInt8 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); - src += gVars->screenPitch + 1; - for (y=0; y < 4; y++) { - for (x=0; x < 4; x++) - src[x] = color; - - src += gVars->screenPitch; - } - - } else if (depth == 16) { - Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow())); - src += gVars->screenPitch + 1; - for (y=0; y < 4; y++) { - for (x=0; x < 4; x++) - src[x] = color; - - src += gVars->screenPitch; - } - } -} - -#ifndef PALMOS_ARM - -// This is now required since some classes are now very big :) -#include "MemGlue.h" -void *operator new(UInt32 size) { - void *ptr = MemGluePtrNew(size); - MemSet(ptr, 0, size); - return ptr; -} - -void *operator new [] (UInt32 size) { - void *ptr = MemGluePtrNew(size); - MemSet(ptr, 0, size); - return ptr; -} -#elif defined(COMPILE_OS5) || defined(STDLIB_TRACE_MEMORY) - -void *operator new(UInt32 size) { - void *ptr = malloc(size); - MemSet(ptr, 0, size); - return ptr; -} - -void *operator new [] (UInt32 size) { - void *ptr = malloc(size); - MemSet(ptr, 0, size); - return ptr; -} - -void operator delete(void *ptr) throw() { - if (ptr) free(ptr); -} - -void operator delete[](void *ptr) throw() { - if (ptr) free(ptr); -} - -#endif diff --git a/backends/platform/PalmOS/Src/features.h b/backends/platform/PalmOS/Src/features.h deleted file mode 100644 index f82c7692fa..0000000000 --- a/backends/platform/PalmOS/Src/features.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __FEATURES_H__ -#define __FEATURES_H__ - -enum { - ftrBufferOverlay = 1000, - ftrBufferBackup, - ftrBufferHotSwap -}; - -#define FREE_FTR(num) \ - { \ - UInt32 ptr; \ - FtrGet(appFileCreator, num, &ptr); \ - if (ptr) FtrPtrFree(appFileCreator, num); \ - } - -#endif diff --git a/backends/platform/PalmOS/Src/globals.h b/backends/platform/PalmOS/Src/globals.h deleted file mode 100644 index 796832df82..0000000000 --- a/backends/platform/PalmOS/Src/globals.h +++ /dev/null @@ -1,114 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef GLOBALS_H -#define GLOBALS_H - -#include -#include "stuffs.h" - -enum { - INIT_VIBRATOR = 1 << 0x00, - INIT_PA1LIB = 1 << 0x01, - INIT_ARM = 1 << 0x02, - INIT_AUTOOFF = 1 << 0x03, - INIT_GOLCD = 1 << 0x04 -}; - -enum { - FM_QUALITY_LOW = 0, - FM_QUALITY_MED, - FM_QUALITY_HI, - FM_QUALITY_INI -}; - -typedef struct { - // common parts - UInt32 _4B, _2B; - - // 4 bytes part - UInt32 startupMemory; - UInt32 slkVersion; - UInt32 options; - UInt32 screenPitch; - - struct { - FileRef logFile; - UInt32 cacheSize; - UInt16 volRefNum; - UInt16 dummy; - } VFS; - - // 2 bytes part - UInt16 HRrefNum; - UInt16 slkRefNum; - Coord screenWidth, screenHeight; // silkarea shown - Coord screenFullWidth, screenFullHeight; // silkarea hidden - Int16 autoSave; - struct { - Int16 on; - Int16 off; - Int16 showLED; - } indicator; - - // 1 byte part - Boolean vibrator; - Boolean stdPalette; - Boolean filter; - Boolean stylusClick; - Boolean arrowKeys; - UInt8 init; - UInt8 palmVolume; - UInt8 fmQuality; - UInt8 advancedMode; - -} GlobalsDataType, *GlobalsDataPtr; - -extern GlobalsDataPtr gVars; - -#define VARS_EXPORT() gVars->_4B = 6; \ - gVars->_2B = 12; - -#define DO_VARS(z, t, o) \ - { Int8 *tmp = (Int8 *)gVars + o + 8; \ - for (Int8 cnt = 0; cnt < gVars->z; cnt++) \ - { UInt##t val = *((UInt##t *)tmp); \ - val = ByteSwap##t(val); \ - *((UInt##t *)tmp) = val; \ - tmp += (t / 8); \ - } \ - } - -#define OPTIONS_DEF() gVars->options - -#define HWR_INIT(x) (gVars->init & (x)) -#define HWR_SET(x) gVars->init |= (x) -#define HWR_RST(x) gVars->init &= ~(x) -#define HWR_RSTALL() gVars->init = 0 -#define HWR_GET() (gVars->init) - -#define ARM(x) gVars->arm[x] - -#endif diff --git a/backends/platform/PalmOS/Src/i_zodiac.cpp b/backends/platform/PalmOS/Src/i_zodiac.cpp deleted file mode 100644 index 20b06aa61f..0000000000 --- a/backends/platform/PalmOS/Src/i_zodiac.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include "extend.h" - -#ifndef DISABLE_TAPWAVE - -#include "tapwave.h" -#include "i_zodiac.h" - -// _twBmpV3 = offscreen bitmap, must be set before this call -Err ZodiacInit(void **ptrP, Int32 w, Int32 h) { - Err e; - - TwGfxSurfaceInfoType surface = { - sizeof(TwGfxSurfaceInfoType), - w, h, w * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - - e = SysSetOrientation(sysOrientationLandscape); - e = TwGfxOpen((TwGfxType **)&_twGfxLib, NULL); - e = TwGfxAllocSurface( (TwGfxType *)_twGfxLib, - (TwGfxSurfaceType **)&_twSrc, - &surface); - - e = TwGfxGetPalmDisplaySurface( (TwGfxType *)_twGfxLib, - (TwGfxSurfaceType **)&_twDst); - - return e; -} - -Err ZodiacRelease(void **ptrP) { - Err e = errNone; - - TwGfxFreeSurface((TwGfxSurfaceType *)_twSrc); - TwGfxClose((TwGfxType *)_twGfxLib); - - return e; -} - -#endif diff --git a/backends/platform/PalmOS/Src/i_zodiac.h b/backends/platform/PalmOS/Src/i_zodiac.h deleted file mode 100644 index 96a373a22e..0000000000 --- a/backends/platform/PalmOS/Src/i_zodiac.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _I_ZODIAC_H_ -#define _I_ZODIAC_H_ - -#define _twGfxLib ptrP[0] -#define _twSrc ptrP[1] -#define _twDst ptrP[2] -#define _twBmpV3 ptrP[3] - -Err ZodiacInit(void **ptrP, Int32 w, Int32 h); -Err ZodiacRelease(void **ptrP); - -#endif diff --git a/backends/platform/PalmOS/Src/init_golcd.cpp b/backends/platform/PalmOS/Src/init_golcd.cpp deleted file mode 100644 index b09d3b104e..0000000000 --- a/backends/platform/PalmOS/Src/init_golcd.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include - -#include "init_golcd.h" - -// you can use this handle directly -MemHandle gGoLcdH; - -Err GoLCDInit(MemHandle *goLcdH) { - if (!goLcdH) - return sysErrParamErr; - - Err e; - UInt16 refNum; - Boolean loaded = false; - *goLcdH = NULL; - - if (e = SysLibFind(goLcdLibName, &refNum)) - loaded = !(e = SysLibLoad(goLcdLibType, goLcdLibCreator, &refNum)); - - if (!e) - if ((e = GoLcdLibOpen(refNum))) - SysLibRemove(refNum); - - if (!e) { - MemHandle lcdH = MemHandleNew(sizeof(GoLCDType)); - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(lcdH); - MemSet(lcdP, MemHandleSize(lcdH), 0); - lcdP->refNum = refNum; - lcdP->timeout = GoLcdGetTimeout(refNum, goLcdPenTapMode); - MemPtrUnlock(lcdP); - *goLcdH = lcdH; - } - - return e; -} - -Err GoLCDRelease(MemHandle goLcdH) { - if (!goLcdH) - return sysErrParamErr; - - Err e; - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - if (lcdP->refNum != sysInvalidRefNum) - if (!(e = GoLcdLibClose(lcdP->refNum))) - e = SysLibRemove(lcdP->refNum); - - MemPtrUnlock(lcdP); - MemHandleFree(goLcdH); - - return e; -} - -Boolean GoLCDPointInBounds(MemHandle goLcdH, Coord x, Coord y) { - Boolean inBounds = false; - - if (!goLcdH) - return inBounds; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - inBounds = (lcdP->active && RctPtInRectangle(x, y, &(lcdP->bounds))); - MemPtrUnlock(lcdP); - - return inBounds; -} - -void GoLCDSetInk(MemHandle goLcdH, RGBColorType *inkP) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - MemMove(&(lcdP->ink), inkP, sizeof(RGBColorType)); - MemPtrUnlock(lcdP); -} - -void GoLCDSetBounds(MemHandle goLcdH, RectangleType *boundsP) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - MemMove(&(lcdP->bounds), boundsP, sizeof(RectangleType)); - MemPtrUnlock(lcdP); -} - -void GoLCDActivate(MemHandle goLcdH, Boolean active) { - if (!goLcdH) - return; - - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - - if (active) { - if (!lcdP->active) { - lcdP->active = true; - GoLcdSetInkState(lcdP->refNum, goLcdInkEnabled, goLcdColorOverride, &(lcdP->ink)); - GoLcdSetBounds(lcdP->refNum, &(lcdP->bounds)); - GoLcdSetGsiState(lcdP->refNum, goLcdGsiNormal, goLcdColorDefault, 0); - GoLcdSetTimeout(lcdP->refNum, goLcdPenTapMode, lcdP->timeout); - GoLcdSetStatus(lcdP->refNum, goLcdEnabled); - } - - } else { - lcdP->active = false; - GoLcdSetInkState(lcdP->refNum, goLcdInkDisabled, goLcdColorDefault, 0); - GoLcdSetStatus(lcdP->refNum, goLcdDisabled); - } - - MemPtrUnlock(lcdP); -} - -Boolean GoLCDToggle(MemHandle goLcdH) { - if (!goLcdH) - return; - - Boolean active; - GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH); - active = lcdP->active; - MemPtrUnlock(lcdP); - - GoLCDActivate(goLcdH, !active); - return (!active); -} diff --git a/backends/platform/PalmOS/Src/init_golcd.h b/backends/platform/PalmOS/Src/init_golcd.h deleted file mode 100644 index 7750a13a52..0000000000 --- a/backends/platform/PalmOS/Src/init_golcd.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INIT_GOLCD_H -#define INIT_GOLCD_H - -typedef struct { - Boolean active; - UInt16 refNum; - RectangleType bounds; - RGBColorType ink; - UInt32 timeout; -} GoLCDType; - -extern MemHandle gGoLcdH; - -Err GoLCDInit(MemHandle *goLcdH); -Err GoLCDRelease(MemHandle goLcdH); -void GoLCDSetInk(MemHandle goLcdH, RGBColorType *inkP); -void GoLCDSetBounds(MemHandle goLcdH, RectangleType *boundsP); -void GoLCDActivate(MemHandle goLcdH, Boolean active); -Boolean GoLCDToggle(MemHandle goLcdH); -Boolean GoLCDPointInBounds(MemHandle goLcdH, Coord x, Coord y); - -#endif diff --git a/backends/platform/PalmOS/Src/init_mathlib.cpp b/backends/platform/PalmOS/Src/init_mathlib.cpp deleted file mode 100644 index 1ea39c3e0a..0000000000 --- a/backends/platform/PalmOS/Src/init_mathlib.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -#include "globals.h" -#include "init_mathlib.h" -#include "mathlib.h" - -Err MathlibInit() { - Err e; - - if ((e = SysLibFind(MathLibName, &MathLibRef))) - if (e == sysErrLibNotFound) // couldn't find lib - e = SysLibLoad(LibType, MathLibCreator, &MathLibRef); - - if (e) return sysErrLibNotFound; - - e = MathLibOpen(MathLibRef, MathLibVersion); - return e; -} - -void MathlibRelease() { - UInt16 useCount; - - if (MathLibRef != sysInvalidRefNum) { - MathLibClose(MathLibRef, &useCount); - - if (!useCount) - SysLibRemove(MathLibRef); - } -} diff --git a/backends/platform/PalmOS/Src/init_mathlib.h b/backends/platform/PalmOS/Src/init_mathlib.h deleted file mode 100644 index 1901e1330d..0000000000 --- a/backends/platform/PalmOS/Src/init_mathlib.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef INIT_MATHLIB_H -#define INIT_MATHLIB_H - -Err MathlibInit(); -void MathlibRelease(); - -#endif diff --git a/backends/platform/PalmOS/Src/init_pa1lib.cpp b/backends/platform/PalmOS/Src/init_pa1lib.cpp deleted file mode 100644 index d5b0340cae..0000000000 --- a/backends/platform/PalmOS/Src/init_pa1lib.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -#include "pa1lib.h" -#include "init_pa1lib.h" - -void *sndStateOnFuncP = NULL; -void *sndStateOffFuncP = NULL; - -#define SndStateOn(a,b,c) if (sndStateOnFuncP)((sndStateOnType)(sndStateOnFuncP))(a, b, c); -#define SndStateOff(a) if (sndStateOffFuncP)((sndStateOffType)(sndStateOffFuncP))(a); - -void Pa1libInit(UInt16 vol) { - Pa1Lib_Open(); - - // Doesn't work on T4xx and T6xx series ? - FtrGet(sonySysFtrCreatorSystem, sonySysFtrNumSystemAOutSndStateOnHandlerP, (UInt32*) &sndStateOnFuncP); - FtrGet(sonySysFtrCreatorSystem, sonySysFtrNumSystemAOutSndStateOffHandlerP, (UInt32*) &sndStateOffFuncP); - - SndStateOn(aOutSndKindSp, vol, vol); - SndStateOn(aOutSndKindHp, vol, vol); - - Pa1Lib_devHpVolume(vol, vol); - Pa1Lib_devSpVolume(vol); -} - -void Pa1libRelease() { - SndStateOff(aOutSndKindSp); - SndStateOff(aOutSndKindHp); - - Pa1Lib_Close(); -} diff --git a/backends/platform/PalmOS/Src/init_pa1lib.h b/backends/platform/PalmOS/Src/init_pa1lib.h deleted file mode 100644 index d5be11d278..0000000000 --- a/backends/platform/PalmOS/Src/init_pa1lib.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INIT_PA1LIB_H -#define INIT_PA1LIB_H - -// need to move this on a .h file -#define sonySysFileCSystem 'SsYs' /* Sony overall System */ -#define sonySysFtrCreatorSystem sonySysFileCSystem - -#define sonySysFtrNumSystemBase 10000 -#define sonySysFtrNumSystemAOutSndStateOnHandlerP (sonySysFtrNumSystemBase + 4) -#define sonySysFtrNumSystemAOutSndStateOffHandlerP (sonySysFtrNumSystemBase + 5) - -typedef void (*sndStateOnType) (UInt8 /* kind */, UInt8 /* L volume 0-31 */, UInt8 /* R volume 0-31 */); -typedef void (*sndStateOffType) (UInt8 /* kind */); - -/* kind */ -#define aOutSndKindSp (0) /* Speaker volume */ -#define aOutSndKindHp (2) /* HeadPhone volume */ - -void Pa1libInit(UInt16 vol); -void Pa1libRelease(); - -#endif diff --git a/backends/platform/PalmOS/Src/init_palmos.cpp b/backends/platform/PalmOS/Src/init_palmos.cpp deleted file mode 100644 index 3a72382362..0000000000 --- a/backends/platform/PalmOS/Src/init_palmos.cpp +++ /dev/null @@ -1,172 +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. - * - * $URL$ - * $Id$ - * - */ - -#include - -#include "globals.h" -#include "init_palmos.h" - -static UInt16 autoOffDelay; - -void PalmInit(UInt8 init) { - // set screen depth - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - - if (init & INIT_AUTOOFF) { - autoOffDelay = SysSetAutoOffTime(0); - EvtResetAutoOffTimer(); - } - -} - -void PalmRelease(UInt8 init) { - if (init & INIT_AUTOOFF) { - SysSetAutoOffTime(autoOffDelay); - EvtResetAutoOffTimer(); - } -} - -Err PalmHRInit(UInt32 depth) { - Err e; - UInt32 width = 320; - UInt32 height = 320; - Boolean color = true; - - e = WinScreenMode (winScreenModeSet, &width, &height, &depth, &color); - - if (!e) { - UInt32 attr; - WinScreenGetAttribute(winScreenDensity, &attr); - e = (attr != kDensityDouble); - } - - return e; -} - -void PalmHRRelease() { - // should i do something here ? -} - -UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) { - UInt32 ftr; - UInt8 mode = 0; - - Coord sw = 160; - Coord sh = 160; - - // Hi-Density present ? - if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &ftr)) { - if (ftr >= 4) { - sw = 320; - sh = 320; - } - } - - Coord fw = sw; - Coord fh = sh; - - // if feature set, not set on Garmin iQue3600 ??? - if (!(FtrGet(sysFtrCreator, sysFtrNumInputAreaFlags, &ftr))) { - if (ftr & grfFtrInputAreaFlagCollapsible) { - UInt16 curOrientation = SysGetOrientation(); - - if (curOrientation == sysOrientationLandscape || - curOrientation == sysOrientationReverseLandscape - ) - mode = PALM_LANDSCAPE; - else - mode = PALM_PORTRAIT; - - PINSetInputTriggerState(pinInputTriggerEnabled); - PINSetInputAreaState(pinInputAreaClosed); - StatHide(); - - WinGetDisplayExtent(&fw, &fh); - fw *= 2; - fh *= 2; - - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); - PINSetInputTriggerState(pinInputTriggerDisabled); - } - } - - if (stdw) *stdw = sw; - if (stdh) *stdh = sh; - if (fullw) *fullw = fw; - if (fullh) *fullh = fh; - - return mode; -} - -void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP) { - UInt32 free, max; - - Int16 i; - Int16 nCards; - UInt16 cardNo; - UInt16 heapID; - - UInt32 storageMemory = 0; - UInt32 dynamicMemory = 0; - UInt32 storageFree = 0; - UInt32 dynamicFree = 0; - - // Iterate through each card to support devices with multiple cards. - nCards = MemNumCards(); - - for (cardNo = 0; cardNo < nCards; cardNo++) { - // Iterate through the RAM heaps on a card (excludes ROM). - for (i=0; i< MemNumRAMHeaps(cardNo); i++) { - // Obtain the ID of the heap. - heapID = MemHeapID(cardNo, i); - // Calculate the total memory and free memory of the heap. - MemHeapFreeBytes(heapID, &free, &max); - - // If the heap is dynamic, increment the dynamic memory total. - if (MemHeapDynamic(heapID)) { - dynamicMemory += MemHeapSize(heapID); - dynamicFree += free; - - // The heap is nondynamic (storage ?). - } else { - storageMemory += MemHeapSize(heapID); - storageFree += free; - } - } - } - // Reduce the stats to KB. Round the results. - dynamicMemory = dynamicMemory / 1024L; - storageMemory = storageMemory / 1024L; - - dynamicFree = dynamicFree / 1024L; - storageFree = storageFree / 1024L; - - if (dynamicMemoryP) *dynamicMemoryP = dynamicMemory; - if (storageMemoryP) *storageMemoryP = storageMemory; - if (dynamicFreeP) *dynamicFreeP = dynamicFree; - if (storageFreeP) *storageFreeP = storageFree; -} diff --git a/backends/platform/PalmOS/Src/init_palmos.h b/backends/platform/PalmOS/Src/init_palmos.h deleted file mode 100644 index d4691dd15b..0000000000 --- a/backends/platform/PalmOS/Src/init_palmos.h +++ /dev/null @@ -1,42 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef INIT_PALMOS_H -#define INIT_PALMOS_H - -#define PALM_PORTRAIT 1 -#define PALM_LANDSCAPE 2 - -void PalmInit(UInt8 init); -void PalmRelease(UInt8 init); - -Err PalmHRInit(UInt32 depth); -void PalmHRRelease(); - - -UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh); -void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP); - -#endif diff --git a/backends/platform/PalmOS/Src/init_sony.cpp b/backends/platform/PalmOS/Src/init_sony.cpp deleted file mode 100644 index f6728d08b3..0000000000 --- a/backends/platform/PalmOS/Src/init_sony.cpp +++ /dev/null @@ -1,163 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include "init_sony.h" - -UInt16 SilkInit(UInt32 *retVersion) { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - UInt32 version; - UInt16 slkRefNum; - Err e; - - // Sony HiRes+ - if (!(e = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrSilk) { - - if ((e = SysLibFind(sonySysLibNameSilk, &slkRefNum))) - if (e == sysErrLibNotFound) - e = SysLibLoad(sonySysFileTSilkLib, sonySysFileCSilkLib, &slkRefNum); - - if (!e) { - e = FtrGet(sonySysFtrCreator, sonySysFtrNumVskVersion, &version); - if (e) { - // v1 = NR - e = SilkLibOpen(slkRefNum); - if (!e) version = vskVersionNum1; - - } else { - // v2 = NX/NZ - // v3 = UX... - e = VskOpen(slkRefNum); - } - } - } else - e = sysErrLibNotFound; - } - - if (e) { - version = 0; - slkRefNum = sysInvalidRefNum; - } - - *retVersion = version; - return slkRefNum; -} - -void SilkRelease(UInt16 slkRefNum) { - if (slkRefNum != sysInvalidRefNum) - SilkLibClose(slkRefNum); -} - -UInt16 SonyHRInit(UInt32 depth) { - SonySysFtrSysInfoP sonySysFtrSysInfoP; - Err e; - UInt16 HRrefNum; - - // test if sonyHR is present - if (!(e = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) { - if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrHR) { // HR available - - if ((e = SysLibFind(sonySysLibNameHR, &HRrefNum))) - if (e == sysErrLibNotFound) // can't find lib - e = SysLibLoad( 'libr', sonySysFileCHRLib, &HRrefNum); - - // Now we can use HR lib. Executes Open library. - if (!e) e = HROpen(HRrefNum); - } - } - - if (e) HRrefNum = sysInvalidRefNum; - - if (HRrefNum != sysInvalidRefNum) { - UInt32 width = hrWidth; - UInt32 height = hrHeight; - Boolean color = true; - - e = HRWinScreenMode(HRrefNum, winScreenModeSet, &width, &height, &depth, &color); - // error ? release and return an invalid reference number - if (e) { - SonyHRRelease(HRrefNum); - HRrefNum = sysInvalidRefNum; - } - } - - return HRrefNum; -} - -void SonyHRRelease(UInt16 HRrefNum) { - if (HRrefNum != sysInvalidRefNum) { - HRClose(HRrefNum); - //SysLibRemove(HRrefNum); // never call this !! - } -} - -UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) { - UInt32 version; - UInt16 slkRefNum; - UInt8 mode = 0; - - Coord sw = 160; - Coord sh = 160; - Coord fw = sw; - Coord fh = sh; - - if (HRrefNum != sysInvalidRefNum) { - sw = hrWidth; - sh = hrHeight; - fw = sw; - fh = sh; - - slkRefNum = SilkInit(&version); - - if (slkRefNum != sysInvalidRefNum) { - if (version == vskVersionNum1) { - SilkLibEnableResize(slkRefNum); - SilkLibResizeDispWin(slkRefNum, silkResizeMax); - HRWinGetWindowExtent(HRrefNum, &fw, &fh); - SilkLibResizeDispWin(slkRefNum, silkResizeNormal); - SilkLibDisableResize(slkRefNum); - mode = SONY_PORTRAIT; - - } else { - VskSetState(slkRefNum, vskStateEnable, (version == vskVersionNum2 ? vskResizeVertically : vskResizeHorizontally)); - VskSetState(slkRefNum, vskStateResize, vskResizeNone); - HRWinGetWindowExtent(HRrefNum, &fw, &fh); - VskSetState(slkRefNum, vskStateResize, vskResizeMax); - VskSetState(slkRefNum, vskStateEnable, vskResizeDisable); - mode = (version == vskVersionNum3 ? SONY_LANDSCAPE : SONY_PORTRAIT); - } - SilkRelease(slkRefNum); - } - } - - *stdw = sw; - *stdh = sh; - *fullw = fw; - *fullh = fh; - - return mode; -} diff --git a/backends/platform/PalmOS/Src/init_sony.h b/backends/platform/PalmOS/Src/init_sony.h deleted file mode 100644 index 86224283f6..0000000000 --- a/backends/platform/PalmOS/Src/init_sony.h +++ /dev/null @@ -1,40 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef INIT_SONY_H -#define INIT_SONY_H - -#define SONY_PORTRAIT 1 -#define SONY_LANDSCAPE 2 - -UInt16 SilkInit(UInt32 *retVersion); -void SilkRelease(UInt16 slkRefNum); - -UInt16 SonyHRInit(UInt32 depth); -void SonyHRRelease(UInt16 HRrefNum); - -UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh); - -#endif diff --git a/backends/platform/PalmOS/Src/init_stuffs.cpp b/backends/platform/PalmOS/Src/init_stuffs.cpp deleted file mode 100644 index 51bfe755eb..0000000000 --- a/backends/platform/PalmOS/Src/init_stuffs.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include - -#ifndef DISABLE_SONY -#include -#endif - -#include -#include -#include -#include - -#include "globals.h" // for OPTIONS_DEF() -#include "init_stuffs.h" -#include "stuffs.h" - -#ifndef DISABLE_TAPWAVE -#define __TWKEYS_H__ // bad hack -#include "tapwave.h" -#endif - -#ifndef DISABLE_PA1LIB -#include "Pa1Lib.h" -#endif - -#ifndef DISABLE_LIGHTSPEED -#include "lightspeed_public.h" -#endif - -// TODO : check the depth to set correct value -// works only for 8bit for now -UInt32 StuffsGetPitch(Coord fullw) { - UInt32 pitch = 0; - - if (OPTIONS_TST(kOptModeHiDensity)) { - WinScreenGetAttribute(winScreenRowBytes, &pitch); - - // FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode - if (pitch < fullw) - pitch = fullw; - - } else { - pitch = fullw; - } - - return pitch; -} - -void *StuffsForceVG() { - // create an empty form to force the VG to be shown - FormType *frmP = FrmNewForm(4567, NULL, 0,0,0,0, false, 0, 0, 0); - FrmDrawForm(frmP); - return frmP; -} - -void StuffsReleaseVG(void *vg) { - FrmDeleteForm((FormPtr)vg); -} - -void StuffsGetFeatures() { - UInt32 ulProcessorType, manufacturer, version, depth; - Boolean color; - -#ifndef DISABLE_TAPWAVE - // Tapwave Zodiac libs ? - if (!FtrGet(sysFileCSystem, sysFtrNumOEMCompanyID, &manufacturer)) - if (manufacturer == twCreatorID) { - OPTIONS_SET(kOptDeviceZodiac); - OPTIONS_SET(kOpt5WayNavigatorV2); - } -#endif - - // Hi-Density present ? - if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &version)) - if (version >= 4) - OPTIONS_SET(kOptModeHiDensity); - - // OS5 ? - if (!FtrGet(sysFtrCreator, sysFtrNumROMVersion, &version)) - if (version >= kOS5Version) - OPTIONS_SET(kOptDeviceOS5); - - // ARM ? - if (!FtrGet(sysFileCSystem, sysFtrNumProcessorID, &ulProcessorType)) - if (sysFtrNumProcessorIsARM(ulProcessorType)) - OPTIONS_SET(kOptDeviceARM); - else if (ulProcessorType == sysFtrNumProcessorx86) - OPTIONS_SET(kOptDeviceProcX86); - - // 5Way Navigator - if (!FtrGet(hsFtrCreator, hsFtrIDNavigationSupported, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - - } else if (!FtrGet(sysFtrCreator, sysFtrNumFiveWayNavVersion, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - else - OPTIONS_SET(kOpt5WayNavigatorV1); - - } else if (!FtrGet(navFtrCreator, navFtrVersion, &version)) { - if (version >= 2) - OPTIONS_SET(kOpt5WayNavigatorV2); - else - OPTIONS_SET(kOpt5WayNavigatorV1); - } - - // Palm Sound API ? - if (!FtrGet(sysFileCSoundMgr, sndFtrIDVersion, &version)) - if (version >= 1) - OPTIONS_SET(kOptPalmSoundAPI); - -#ifndef DISABLE_PA1LIB - // Sony Pa1 Sound API - if (Pa1Lib_Open()) { - OPTIONS_SET(kOptSonyPa1LibAPI); - Pa1Lib_Close(); - } -#endif - - // GoLCD - if (!FtrGet(goLcdLibCreator, goLcdLibFtrNum, &version)) - OPTIONS_SET(kOptGoLcdAPI); - -#ifndef DISABLE_LIGHTSPEED - // Lightspeed - if (LS_Installed()) - OPTIONS_SET(kOptLightspeedAPI); -#endif - - // check for 16bit mode - if (!WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL, &depth, &color)) - OPTIONS_SET(((depth & 0x8000) ? kOptMode16Bit : kOptNone)); - -} diff --git a/backends/platform/PalmOS/Src/init_stuffs.h b/backends/platform/PalmOS/Src/init_stuffs.h deleted file mode 100644 index 124510eeac..0000000000 --- a/backends/platform/PalmOS/Src/init_stuffs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef INIT_STUFFS_H -#define INIT_STUFFS_H - -#define kOS5Version sysMakeROMVersion(5,0,0,sysROMStageRelease,0) - -void StuffsGetFeatures(); -UInt32 StuffsGetPitch(Coord fullw); -void *StuffsForceVG(); -void StuffsReleaseVG(void *vg); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/app.cpp b/backends/platform/PalmOS/Src/launcher/app.cpp deleted file mode 100644 index 9bb1c1479b..0000000000 --- a/backends/platform/PalmOS/Src/launcher/app.cpp +++ /dev/null @@ -1,360 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include - -#include "StarterRsc.h" -#include "palmdefs.h" -#include "start.h" -#include "globals.h" -#include "rumble.h" - -#include "mathlib.h" -#include "formCards.h" -#include "games.h" - -#include "modules.h" -#include "init_mathlib.h" -#include "init_sony.h" -#include "init_palmos.h" -#include "init_stuffs.h" - -/*********************************************************************** - * - * FUNCTION: AppStart - * - * DESCRIPTION: Get the current application's preferences. - * - * PARAMETERS: nothing - * - * RETURNED: Err value 0 if nothing went wrong - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err AppStartCheckHRmode() -{ - Err e = errNone; - UInt32 depth = (OPTIONS_TST(kOptMode16Bit) && OPTIONS_TST(kOptDeviceOS5)) ? 16 : 8; - - // try to init Sony HR mode then Palm HR mode - gVars->HRrefNum = SonyHRInit(depth); - - if (gVars->HRrefNum == sysInvalidRefNum) { - if (e = PalmHRInit(depth)) - FrmCustomAlert(FrmErrorAlert,"Your device doesn't seem to support Hi-Res or 256color mode.",0,0); - } else { - OPTIONS_SET(kOptDeviceClie); - } - - return e; -} - -static void AppStopHRMode() { - if (gVars->HRrefNum != sysInvalidRefNum) - SonyHRRelease(gVars->HRrefNum); - else - PalmHRRelease(); -} - -static Err AppStartCheckNotify() { - UInt32 romVersion; - Err err; - - err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); - if (!err) { - UInt16 cardNo; - LocalID dbID; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (!err) { - SysNotifyRegister(cardNo, dbID, sysNotifyVolumeMountedEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sysNotifyVolumeUnmountedEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sonySysNotifyMsaEnforceOpenEvent, NULL, sysNotifyNormalPriority, NULL); - SysNotifyRegister(cardNo, dbID, sysNotifyDisplayResizedEvent, NULL, sysNotifyNormalPriority, NULL); - } - } - - return err; -} - -static Err AppStartLoadSkin() { - Err err = errNone; - - // if skin defined, check if the db still exists - if (gPrefs->skin.dbID) { - UInt32 type, creator; - - // check if the DB still exists - DmSearchStateType state; - UInt16 cardNo; - LocalID dbID; - Boolean found = false; - err = DmGetNextDatabaseByTypeCreator(true, &state, 'skin', appFileCreator, false, &cardNo, &dbID); - while (!err && dbID && !found) { - found = (cardNo == gPrefs->skin.cardNo && dbID == gPrefs->skin.dbID); - err = DmGetNextDatabaseByTypeCreator(false, &state, 'skin', appFileCreator, false, &cardNo, &dbID); - } - - if (found) { - // remember to check version for next revision of the skin - err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0,0, &type, &creator); - if (!err) - if (type != 'skin' || creator != appFileCreator) - err = dmErrInvalidParam; - } - - if (!found || err) - MemSet(&(gPrefs->skin),sizeof(SkinInfoType),0); - } - - // No skin ? try to get the first one - if (!gPrefs->skin.dbID) { - DmSearchStateType stateInfo; - - err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &gPrefs->skin.cardNo, &gPrefs->skin.dbID); - if (!err) - err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - - return err; -} - -static Err AppStartCheckMathLib() { - Err e = MathlibInit(); - - switch (e) { - case errNone: - break; - case sysErrLibNotFound: - FrmCustomAlert(FrmErrorAlert,"Can't find MathLib !",0,0); - break; - default: - FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0); - break; - } - - return e; -} - -static void AppStopMathLib() { - MathlibRelease(); -} - -static void AppStartCheckScreenSize() { - Coord sw, sh, fw, fh; - UInt8 mode; - - OPTIONS_RST(kOptCollapsible); - OPTIONS_RST(kOptModeWide); - OPTIONS_RST(kOptModeLandscape); - OPTIONS_RST(kOptModeRotatable); - - // we are on a sony device - if (OPTIONS_TST(kOptDeviceClie)) { - mode = SonyScreenSize(gVars->HRrefNum, &sw, &sh, &fw, &fh); - if (mode) { - OPTIONS_SET(kOptModeWide); - OPTIONS_SET((mode == SONY_LANDSCAPE) ? kOptModeLandscape : kOptNone); - } - } else { - mode = PalmScreenSize(&sw, &sh, &fw, &fh); - if (mode) { - OPTIONS_SET(kOptCollapsible); - OPTIONS_SET(kOptModeWide); - OPTIONS_SET((mode == PALM_LANDSCAPE) ? kOptModeLandscape : kOptNone); - // TODO: doesn't work with Sony - OPTIONS_SET(SysGlueTrapExists(pinSysSetOrientation) ? kOptModeRotatable :kOptNone); - } - } - - gVars->screenWidth = sw; - gVars->screenHeight = sh; - - gVars->screenFullWidth = fw; - gVars->screenFullHeight = fh; -} - -#define max(id,value) gVars->memory[id] = (gVars->memory[id] < value ? value : gVars->memory[id]) -#define min(id,value) gVars->memory[id] = (gVars->memory[id] > value ? value : gVars->memory[id]) -#define threshold 700 - -static void AppStartSetMemory() { - UInt32 mem, def; - PalmGetMemory(0,0,0,&mem); - def = (mem > threshold) ? (mem - threshold) * 1024 : 0; - gVars->startupMemory = mem; -} - -#undef threshold -#undef min -#undef max - -Err AppStart(void) { - UInt16 dataSize, checkSize = 0; - Err error; - -#ifndef _DEBUG_ENGINE - // delete old databases - ModDelete(); -#endif - - // allocate global variables space - dataSize = sizeof(GlobalsDataType); - gVars = (GlobalsDataType *)MemPtrNew(dataSize); - MemSet(gVars, dataSize, 0); - - gVars->indicator.on = 255; - gVars->indicator.off = 0; - gVars->HRrefNum = sysInvalidRefNum; - gVars->VFS.volRefNum = vfsInvalidVolRef; - gVars->slkRefNum = sysInvalidRefNum; - gVars->options = kOptNone; - - // set memory required by the differents engines - AppStartSetMemory(); - StuffsGetFeatures(); - - // allocate prefs space - dataSize = sizeof(GlobalsPreferenceType); - gPrefs = (GlobalsPreferenceType *)MemPtrNew(dataSize); - MemSet(gPrefs, dataSize, 0); - - // Read the saved preferences / saved-state information. - if (PrefGetAppPreferences(appFileCreator, appPrefID, NULL, &checkSize, true) == noPreferenceFound || checkSize != dataSize) { - // reset all elements - MemSet(gPrefs, dataSize, 0); - - gPrefs->card.volRefNum = vfsInvalidVolRef; - gPrefs->card.cacheSize = 4096; - gPrefs->card.useCache = true; - gPrefs->card.showLED = true; - gPrefs->card.autoDetect = true; - - gPrefs->autoOff = true; - gPrefs->vibrator = RumbleExists(); - gPrefs->debug = false; - gPrefs->exitLauncher = true; - gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5); - gPrefs->stylusClick = true; - - } else { - PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true); - } - - if (!OPTIONS_TST(kOptDeviceARM)) { - error = AppStartCheckMathLib(); - if (error) return (error); - } - - error = AppStartCheckHRmode(); - if (error) return (error); - - bDirectMode = (AppStartLoadSkin() != errNone); - - // if volref previously defined, check if it's a valid one - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - VolumeInfoType volInfo; - Err err = VFSVolumeInfo(gPrefs->card.volRefNum, &volInfo); - if (err) - gPrefs->card.volRefNum = parseCards(); - } - else - gPrefs->card.volRefNum = parseCards(); - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - CardSlotCreateDirs(); - - // open games database - error = GamOpenDatabase(); - if (error) return (error); - GamImportDatabase(); - - AppStartCheckScreenSize(); - AppStartCheckNotify(); // not fatal error if not avalaible - - return error; -} - -/*********************************************************************** - * - * FUNCTION: AppStop - * - * DESCRIPTION: Save the current state of the application. - * - * PARAMETERS: nothing - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err AppStopCheckNotify() -{ - UInt32 romVersion; - Err err; - - err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion); - if (!err) { - UInt16 cardNo; - LocalID dbID; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (!err) { - SysNotifyUnregister(cardNo, dbID, sysNotifyVolumeUnmountedEvent, sysNotifyNormalPriority); - SysNotifyUnregister(cardNo, dbID, sysNotifyVolumeMountedEvent, sysNotifyNormalPriority); - // sonySysNotifyMsaEnforceOpenEvent - SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority); - } - } - - return err; -} - -void AppStop(void) { - // Close all the open forms. - FrmCloseAllForms(); - WinEraseWindow(); - WinPalette(winPaletteSetToDefault, 0, 256, NULL); - - // Close and move Game list database - GamCloseDatabase(false); - - // Write the saved preferences / saved-state information. This data - // will saved during a HotSync backup. - SavePrefs(); - - // stop all - AppStopCheckNotify(); - if (!OPTIONS_TST(kOptDeviceARM)) - AppStopMathLib(); - AppStopHRMode(); - - if (!bLaunched) - MemPtrFree(gVars); -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp b/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp deleted file mode 100644 index eb4654ed10..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formCards.cpp +++ /dev/null @@ -1,383 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "globals.h" - -typedef struct { - UInt16 volRefNum; - Char nameP[expCardInfoStringMaxLen+1]; - -} CardInfoType; - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static void CardSlotFormExit(Boolean bSave); - -static void CardSlotFreeList() { - MemHandle cards = NULL; - MemHandle items = NULL; - - if (itemsText && itemsList) { - cards = MemPtrRecoverHandle(itemsList); - items = MemPtrRecoverHandle(itemsText); - - itemsText = NULL; - itemsList = NULL; - } - itemsType = ITEM_TYPE_UNKNOWN; - - if (items && cards) { - MemHandleUnlock(items); - MemHandleUnlock(cards); - MemHandleFree(items); - MemHandleFree(cards); - } -} - -static UInt16 CardSlotFillList(Boolean getRefNum = false) { - Err err; - UInt16 index; - UInt16 volRefNum; - UInt32 volIterator = vfsIteratorStart|vfsIncludePrivateVolumes; - UInt8 counter = 0; - UInt32 other = 1; - - MemHandle items = NULL; - MemHandle cards = NULL; - CardInfoType *cardsInfo; - - // retreive card infos - while (volIterator != vfsIteratorStop) { - err = VFSVolumeEnumerate(&volRefNum, &volIterator); - - if (!err) { - Char labelP[expCardInfoStringMaxLen+1]; - MemSet(labelP, expCardInfoStringMaxLen+1, 0); - err = VFSVolumeGetLabel(volRefNum, labelP, expCardInfoStringMaxLen+1); - - if (err || StrLen(labelP) == 0) { // if no label try to retreive card type - VolumeInfoType volInfo; - err = VFSVolumeInfo(volRefNum, &volInfo); - - if (!err) { - ExpCardInfoType info; - err = ExpCardInfo(volInfo.slotRefNum, &info); - StrCopy(labelP, info.deviceClassStr); - } - - if (err) // if err default name - StrPrintF(labelP,"Other Card %ld", other++); - } - - if (!cards) - cards = MemHandleNew(sizeof(CardInfoType)); - else - MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType)); - - cardsInfo = (CardInfoType *)MemHandleLock(cards); - cardsInfo[counter].volRefNum = volRefNum; - StrCopy(cardsInfo[counter].nameP, labelP); - MemHandleUnlock(cards); - counter++; - } - } - - if (counter > 0) { - // set the list items ... - if (!getRefNum) { - for (index = 0; index < counter; index++) { - if (!items) - items = MemHandleNew(sizeof(Char *)); - else - MemHandleResize(items, MemHandleSize(items) + sizeof(Char *)); - - itemsText = (Char **)MemHandleLock(items); - itemsText[index] = cardsInfo[index].nameP; - MemHandleUnlock(items); - } - - // save globals - itemsText = (Char **)MemHandleLock(items); - itemsList = (void *)MemHandleLock(cards); - itemsType = ITEM_TYPE_CARD; - - // ... or just return a default volRefNum - } else { - UInt16 volRefNum; - - cardsInfo = (CardInfoType *)MemHandleLock(cards); - volRefNum = cardsInfo[0].volRefNum; // return the first volref - MemHandleUnlock(cards); - MemHandleFree(cards); - - return volRefNum; - } - - // no card found ? free old list in any or return invalid volref - } else { - if (!getRefNum) - CardSlotFreeList(); - else - return vfsInvalidVolRef; - } - - return counter; -} - -static void ConfigTabInit(Boolean update = false) { - ListPtr listP; - - UInt16 index; - Int16 selected = -1; - - UInt16 counter = CardSlotFillList(); - listP = (ListType *)GetObjectPtr(TabCardConfigSlotList); - - // itemsText can be NULL if counter = 0 - LstSetListChoices (listP, itemsText, counter); - if (counter > 0) { - CardInfoType *cardsInfo = (CardInfoType *)itemsList; - - for (index = 0; index < counter; index++) { - if (cardsInfo[index].volRefNum == gPrefs->card.volRefNum) { - selected = index; - break; - } - } - - LstSetSelection(listP, selected); - } - - if (!update) { - FieldType *fld1P; - Char *cacheP; - MemHandle cacheH; - - fld1P = (FieldType *)GetObjectPtr(TabCardConfigCacheSizeField); - cacheH = MemHandleNew(FldGetMaxChars(fld1P)+1); - cacheP = (Char *)MemHandleLock(cacheH); - StrIToA(cacheP, gPrefs->card.cacheSize / 1024); - MemHandleUnlock(cacheH); - - FldSetTextHandle(fld1P, cacheH); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigCacheCheckbox), gPrefs->card.useCache); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigLedCheckbox), gPrefs->card.showLED); - CtlSetValue((ControlType *)GetObjectPtr(TabCardConfigDetectCheckbox), gPrefs->card.autoDetect); - // update ? redraw the list - } else { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); - } -} - -static UInt16 ConfigTabSave() { - ControlType *cckP[3]; - FieldType *fld1P; - ListPtr listP; - FormPtr frmP; - UInt16 updateCode = frmRedrawUpdateMS; - - cckP[0] = (ControlType *)GetObjectPtr(TabCardConfigCacheCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabCardConfigLedCheckbox); - cckP[2] = (ControlType *)GetObjectPtr(TabCardConfigDetectCheckbox); - - gPrefs->card.useCache = CtlGetValue(cckP[0]); - gPrefs->card.showLED = CtlGetValue(cckP[1]); - gPrefs->card.autoDetect = CtlGetValue(cckP[2]); - - fld1P = (FieldType *)GetObjectPtr(TabCardConfigCacheSizeField); - frmP = FrmGetActiveForm(); - if (FldGetTextLength(fld1P) == 0 && CtlGetValue(cckP[0]) == 1) { - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabCardConfigCacheSizeField)); - FrmCustomAlert(FrmWarnAlert,"You must specified a cache size.",0,0); - return 0; - } - gPrefs->card.cacheSize = StrAToI(FldGetTextPtr(fld1P)) * 1024; - - Int16 selected; - CardInfoType *cardsInfo = (CardInfoType *)itemsList; - - listP = (ListType *)GetObjectPtr(TabCardConfigSlotList); - selected = LstGetSelection(listP); - if (selected == -1) { - gPrefs->card.volRefNum = vfsInvalidVolRef; - } else if (gPrefs->card.volRefNum != cardsInfo[selected].volRefNum) { - updateCode = frmRedrawUpdateMSImport; - gPrefs->card.volRefNum = cardsInfo[selected].volRefNum; - } - - CardSlotCreateDirs(); - CardSlotFreeList(); - - return updateCode; -} - -static void GameListTabInit() { - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox), gPrefs->card.moveDB); - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListDeleteCheckbox), gPrefs->card.deleteDB); - CtlSetValue((ControlType *)GetObjectPtr(TabCardGameListConfirmCheckbox), gPrefs->card.confirmMoveDB); -} - -static void GameListTabSave() { - ControlType *cckP[3]; - - cckP[0] = (ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabCardGameListDeleteCheckbox); - cckP[2] = (ControlType *)GetObjectPtr(TabCardGameListConfirmCheckbox); - - gPrefs->card.moveDB = CtlGetValue(cckP[0]); - gPrefs->card.deleteDB = CtlGetValue(cckP[1]); - gPrefs->card.confirmMoveDB = CtlGetValue(cckP[2]); -} - -static void GameListTabDraw() { - ControlType *cck1P; - FormPtr frmP = FrmGetActiveForm(); - - cck1P = (ControlType *)GetObjectPtr(TabCardGameListMoveCheckbox); - if (CtlGetValue(cck1P)) { - FrmShowObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListDeleteCheckbox)); - FrmShowObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListConfirmCheckbox)); - } else { - FrmHideObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListDeleteCheckbox)); - FrmHideObject(frmP, FrmGetObjectIndex (frmP, TabCardGameListConfirmCheckbox)); - } -} - -static void CardSlotFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - tabP = TabNewTabs(2); - TabAddContent(&frmP, tabP, "Cards", TabCardConfigForm); - TabAddContent(&frmP, tabP, "Game List", TabCardGameListForm, GameListTabDraw); - - ConfigTabInit(); - GameListTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -static void CardSlotFormSave() { - UInt16 updateCode; - updateCode = ConfigTabSave(); - if (!updateCode) return; - GameListTabSave(); - CardSlotCreateDirs(); - - TabDeleteTabs(myTabP); - FrmReturnToMain(updateCode); -} - -static void CardSlotFormCancel() { - CardSlotFreeList(); - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -Boolean CardSlotFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - CardSlotFormInit(); - handled = true; - break; - - case frmCloseEvent: - CardSlotFormCancel(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (CardSlotForm + 1) : - case (CardSlotForm + 2) : - lastTab = (eventP->data.ctlSelect.controlID - CardSlotForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case CardSlotOkButton: - CardSlotFormSave(); - break; - - case CardSlotCancelButton: - CardSlotFormCancel(); - break; - - case TabCardGameListMoveCheckbox: - GameListTabDraw(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} - -void CardSlotCreateDirs() { - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - VFSDirCreate(gPrefs->card.volRefNum, "/PALM"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Games"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Saved"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Audio"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Mods"); - VFSDirCreate(gPrefs->card.volRefNum, "/PALM/Programs/ScummVM/Themes"); - } -} - -void CardSlotFormUpdate() { - if (itemsType == ITEM_TYPE_CARD) { - CardSlotFreeList(); - ConfigTabInit(true); - } -} - -UInt16 parseCards() { - UInt16 volRefNum = CardSlotFillList(true); - CardSlotFreeList(); - return volRefNum; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formCards.h b/backends/platform/PalmOS/Src/launcher/forms/formCards.h deleted file mode 100644 index 766c4793b9..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formCards.h +++ /dev/null @@ -1,33 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __FORMCARDS_H__ -#define __FORMCARDS_H__ - -UInt16 parseCards(); -void CardSlotFormUpdate(); -void CardSlotCreateDirs(); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp b/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp deleted file mode 100644 index 0540c12577..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.cpp +++ /dev/null @@ -1,612 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include -#include - -#include "formTabs.h" -#include "forms.h" - -#include "start.h" -#include "games.h" -#include "skin.h" - -#define errBadParam 0x1000 - -static TabType *myTabP; -static UInt16 lastTab = 0; - -UInt8 gFormEditMode; - -static void GameTabInit(GameInfoType *gameInfoP) { - FieldType *fld1P, *fld2P, *fld3P; - Char *nameP, *pathP, *gameP; - MemHandle nameH, pathH, gameH; - ListType *list1P; - - list1P = (ListType *)GetObjectPtr(TabGameInfoEngineList); - - itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *)); - for (int i = 0; i < ENGINE_COUNT; i++) - itemsText[i] = (Char *)engines[i].nameP; - LstSetListChoices(list1P, itemsText, ENGINE_COUNT); - - fld1P = (FieldType *)GetObjectPtr(TabGameInfoEntryNameField); - fld2P = (FieldType *)GetObjectPtr(TabGameInfoPathField); - fld3P = (FieldType *)GetObjectPtr(TabGameInfoGameField); - - nameH = MemHandleNew(FldGetMaxChars(fld1P)+1); - pathH = MemHandleNew(FldGetMaxChars(fld2P)+1); - gameH = MemHandleNew(FldGetMaxChars(fld3P)+1); - - nameP = (Char *)MemHandleLock(nameH); - pathP = (Char *)MemHandleLock(pathH); - gameP = (Char *)MemHandleLock(gameH); - - if (gameInfoP) { - LstSetSelection(list1P, gameInfoP->engine); - LstSetTopItem(list1P, gameInfoP->engine); - StrCopy(nameP, gameInfoP->nameP); - StrCopy(pathP, gameInfoP->pathP); - StrCopy(gameP, gameInfoP->gameP); - } else { - LstSetSelection(list1P, 0); - MemSet(nameP,MemHandleSize(nameH),0); - MemSet(pathP,MemHandleSize(pathH),0); - MemSet(gameP,MemHandleSize(gameH),0); - } - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameInfoEnginePopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - MemHandleUnlock(nameH); - MemHandleUnlock(pathH); - MemHandleUnlock(gameH); - - FldSetTextHandle(fld1P, nameH); - FldSetTextHandle(fld2P, pathH); - FldSetTextHandle(fld3P, gameH); -} - -static Err GameTabSave(GameInfoType *gameInfoP) { - FieldType *fld1P, *fld2P, *fld3P; - ListType *list1P; - - FormType *frmP = FrmGetActiveForm(); - list1P = (ListType *)GetObjectPtr(TabGameInfoEngineList); - - fld1P = (FieldType *)GetObjectPtr(TabGameInfoEntryNameField); - fld2P = (FieldType *)GetObjectPtr(TabGameInfoPathField); - fld3P = (FieldType *)GetObjectPtr(TabGameInfoGameField); - - FldTrimText(fld1P); - FldTrimText(fld2P); - FldTrimText(fld3P); - - // test case - if (!gameInfoP) { - if (FldGetTextLength(fld1P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify an entry name.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoEntryNameField)); - return errBadParam; - - } else if (FldGetTextLength(fld2P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify a path.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoPathField)); - return errBadParam; - - } else if (FldGetTextLength(fld3P) == 0) { - FrmCustomAlert(FrmWarnAlert,"You must specify a game.",0,0); - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoGameField)); - return errBadParam; - } - - } else { - gameInfoP->engine = LstGetSelection(list1P); - StrCopy(gameInfoP->nameP, FldGetTextPtr(fld1P)); - StrCopy(gameInfoP->pathP, FldGetTextPtr(fld2P)); - StrCopy(gameInfoP->gameP, FldGetTextPtr(fld3P)); - - if (gameInfoP->pathP[StrLen(gameInfoP->pathP)-1] != '/') - StrCat(gameInfoP->pathP, "/"); - - MemPtrFree(itemsText); - itemsText = NULL; - } - - return errNone; -} - -static void DisplayInit(GameInfoType *gameInfoP) { - ListType *list1P, *list2P; - - list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList); - list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList); - - if (gameInfoP) { - LstSetSelection(list1P, gameInfoP->gfxMode); - LstSetSelection(list2P, gameInfoP->renderMode); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), gameInfoP->filter); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox), gameInfoP->fullscreen); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox), gameInfoP->aspectRatio); - - } else { - LstSetSelection(list1P, 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox), 0); - } - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameDisplayGfxPopupPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - CtlSetLabel((ControlType *)GetObjectPtr(TabGameDisplayRenderPopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); -} - -static Err DisplaySave(GameInfoType *gameInfoP) { - ListType *list1P, *list2P; - ControlType *cck6P, *cck7P, *cck8P; - - FormType *frmP = FrmGetActiveForm(); - - list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList); - list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList); - cck6P = (ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox); - cck7P = (ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox); - cck8P = (ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox); - - if (!gameInfoP) { - } else { - gameInfoP->gfxMode = LstGetSelection(list1P); - gameInfoP->renderMode = LstGetSelection(list2P); - gameInfoP->filter = CtlGetValue(cck6P); - gameInfoP->fullscreen = CtlGetValue(cck7P); - gameInfoP->aspectRatio = CtlGetValue(cck8P); - } - - return errNone; -} - -static void OptionsInit(GameInfoType *gameInfoP) { - ListType *list2P, *list3P; - FieldType *fld4P, *fld5P, *fld6P; - Char *loadP, *roomP, *talkP; - MemHandle loadH, roomH, talkH; - - list2P = (ListType *)GetObjectPtr(TabGameOptionsLanguageList); - list3P = (ListType *)GetObjectPtr(TabGameOptionsPlatformList); - - fld4P = (FieldType *)GetObjectPtr(TabGameOptionsLoadSlotField); - fld5P = (FieldType *)GetObjectPtr(TabGameOptionsStartRoomField); - fld6P = (FieldType *)GetObjectPtr(TabGameOptionsTalkSpeedField); - - loadH = MemHandleNew(FldGetMaxChars(fld4P)+1); - roomH = MemHandleNew(FldGetMaxChars(fld5P)+1); - talkH = MemHandleNew(FldGetMaxChars(fld6P)+1); - - loadP = (Char *)MemHandleLock(loadH); - roomP = (Char *)MemHandleLock(roomH); - talkP = (Char *)MemHandleLock(talkH); - - if (gameInfoP) { - LstSetSelection(list2P, gameInfoP->language); - LstSetTopItem(list2P, gameInfoP->language); - LstSetSelection(list3P, gameInfoP->platform); - LstSetTopItem(list3P, gameInfoP->platform); - - StrIToA(loadP, gameInfoP->loadSlot); - StrIToA(roomP, gameInfoP->bootValue); - StrIToA(talkP, gameInfoP->talkValue); - - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox), gameInfoP->autoLoad); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox), gameInfoP->bootParam); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox), gameInfoP->setPlatform); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox), gameInfoP->subtitles); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox), gameInfoP->talkSpeed); - - } else { - LstSetSelection(list2P, 0); - LstSetSelection(list3P, 0); - - StrIToA(loadP, 0); - StrIToA(roomP, 0); - StrIToA(talkP, 60); - - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox), 0); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox), 1); - CtlSetValue((ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox), 0); - } - - MemHandleUnlock(loadH); - MemHandleUnlock(roomH); - MemHandleUnlock(talkH); - - FldSetTextHandle(fld4P, loadH); - FldSetTextHandle(fld5P, roomH); - FldSetTextHandle(fld6P, talkH); - - CtlSetLabel((ControlType *)GetObjectPtr(TabGameOptionsLanguagePopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - CtlSetLabel((ControlType *)GetObjectPtr(TabGameOptionsPlatformPopTrigger), LstGetSelectionText(list3P, LstGetSelection(list3P))); -} - -static Err OptionsSave(GameInfoType *gameInfoP) { - FieldType *fld4P, *fld5P, *fld6P; - ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P; - ListType *list2P, *list3P; - - FormType *frmP = FrmGetActiveForm(); - - list2P = (ListType *)GetObjectPtr(TabGameOptionsLanguageList); - list3P = (ListType *)GetObjectPtr(TabGameOptionsPlatformList); - - fld4P = (FieldType *)GetObjectPtr(TabGameOptionsLoadSlotField); - fld5P = (FieldType *)GetObjectPtr(TabGameOptionsStartRoomField); - fld6P = (FieldType *)GetObjectPtr(TabGameOptionsTalkSpeedField); - - cck1P = (ControlType *)GetObjectPtr(TabGameOptionsLoadSlotCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabGameOptionsStartRoomCheckbox); - cck3P = (ControlType *)GetObjectPtr(TabGameOptionsAmigaCheckbox); - cck4P = (ControlType *)GetObjectPtr(TabGameOptionsSubtitlesCheckbox); - cck5P = (ControlType *)GetObjectPtr(TabGameOptionsTalkSpeedCheckbox); - - if (!gameInfoP) { - if (FldGetTextLength(fld5P) == 0 && CtlGetValue(cck2P) == 1) { - FrmCustomAlert(FrmWarnAlert,"You must specify a room number.",0,0); - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsStartRoomField)); - return errBadParam; - - } else if (FldGetTextLength(fld6P) == 0 && CtlGetValue(cck5P) == 1) { - FrmCustomAlert(FrmWarnAlert,"You must specify a talk speed.",0,0); - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsTalkSpeedField)); - return errBadParam; - } - } else { - gameInfoP->language = LstGetSelection(list2P); - gameInfoP->platform = LstGetSelection(list3P); - - gameInfoP->autoLoad = CtlGetValue(cck1P); - gameInfoP->bootParam = CtlGetValue(cck2P); - gameInfoP->setPlatform = CtlGetValue(cck3P); - gameInfoP->subtitles = (CtlGetValue(cck4P)); - gameInfoP->talkSpeed = CtlGetValue(cck5P); - - gameInfoP->loadSlot = StrAToI(FldGetTextPtr(fld4P)); - gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P)); - gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P)); - } - - return errNone; -} - -static void GameManInit(UInt16 index) { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - UInt16 active = lastTab; - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "Game", TabGameInfoForm); - TabAddContent(&frmP, tabP, "Display", TabGameDisplayForm); - TabAddContent(&frmP, tabP, "Options", TabGameOptionsForm); - - UInt16 refNum; - if (SysLibFind(kFileBrowserLibName, &refNum)) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabGameInfoBrowsePushButton)); - - if (index != dmMaxRecordIndex) { - MemHandle recordH = NULL; - GameInfoType *gameInfoP; - - recordH = DmQueryRecord(gameDB, index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - - GameTabInit(gameInfoP); - DisplayInit(gameInfoP); - OptionsInit(gameInfoP); - - MemHandleUnlock(recordH); - CtlSetUsable((ControlType *)GetObjectPtr(GameEditDeleteButton),true); - } else { - active = 0; // new game ? start with first tab - GameTabInit(0); - DisplayInit(0); - OptionsInit(0); - CtlSetUsable((ControlType *)GetObjectPtr(GameEditDeleteButton),false); - } - - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoEntryNameField)); - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, active); - - myTabP = tabP; -} - -static void GameManSave(UInt16 index) { - MemHandle recordH; - GameInfoType *gameInfoP, newGameInfo; - - if (GameTabSave(0) == errBadParam) return; - if (DisplaySave(0) == errBadParam) return; - if (OptionsSave(0) == errBadParam) return; - - if (index != dmMaxRecordIndex) { - recordH = DmGetRecord(gameDB, index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - MemMove(&newGameInfo, gameInfoP, sizeof(GameInfoType)); - - } else { - index = dmMaxRecordIndex; - GamUnselect(); - recordH = DmNewRecord(gameDB, &index, sizeof(GameInfoType)); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - - MemSet(&newGameInfo, sizeof(GameInfoType), 0); - newGameInfo.version = curItemVersion; - newGameInfo.icnID = 0xFFFF; - newGameInfo.selected = true; - - // default sound data - newGameInfo.musicInfo.volume.palm = 50; - newGameInfo.musicInfo.volume.music = 192; - newGameInfo.musicInfo.volume.sfx = 192; - newGameInfo.musicInfo.volume.speech = 192; - newGameInfo.musicInfo.volume.audiocd = 50; - - newGameInfo.musicInfo.sound.tempo = 100; - newGameInfo.musicInfo.sound.defaultTrackLength = 10; - newGameInfo.musicInfo.sound.firstTrack = 1; - } - - GameTabSave(&newGameInfo); - DisplaySave(&newGameInfo); - OptionsSave(&newGameInfo); - - DmWrite(gameInfoP, 0, &newGameInfo, sizeof(GameInfoType)); - - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - GamSortList(); - // update list position - { - RectangleType rArea; - UInt16 posIndex, maxView; - - // get the sorted index - index = GamGetSelected(); - // if new item is out of the list bounds, change current list pos - SknGetListBounds(&rArea, NULL); - maxView = rArea.extent.y / sknInfoListItemSize; - posIndex = gPrefs->listPosition; - - // if out of the current list position - if (!(index >= posIndex && index < (posIndex + maxView))) - gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed - } - - TabDeleteTabs(myTabP); - FrmReturnToMain(); - SknUpdateList(); -} - -/*********************************************************************** - * - * FUNCTION: EditGameFormSave - * FUNCTION: EditGameFormInit - * FUNCTION: EditGameFormHandleEvent - * - * DESCRIPTION: - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -void EditGameFormDelete(Boolean direct) { - UInt16 index = GamGetSelected(); - - if (index == dmMaxRecordIndex) { - FrmCustomAlert(FrmWarnAlert, "Select an entry first.",0,0); - return; - - } else if (FrmCustomAlert(FrmConfirmAlert, "Do you really want to delete this entry ?", 0, 0) == FrmConfirmYes) { - DmRemoveRecord(gameDB, index); - if (!direct) { - TabDeleteTabs(myTabP); - FrmReturnToMain(); - } - GamSortList(); - SknUpdateList(); - } -} - -static void EditGameCancel() { - if (itemsText) { - MemPtrFree(itemsText); - itemsText = NULL; - } - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void EditGameBowser() { - UInt16 refNum; - Err e; - - ControlPtr butP = (ControlType *)GetObjectPtr(TabGameInfoBrowsePushButton); - CtlSetValue(butP, 0); - - e = SysLibFind (kFileBrowserLibName, &refNum); - if (!e) { - e = FileBrowserLibOpen (refNum); - if (!e) { - UInt16 volRefNum = gPrefs->card.volRefNum; - Char *textP, *pathP = (Char *)MemPtrNew(kFileBrowserLibPathBufferSize); - pathP[0] = chrNull; - - if (FileBrowserLibShowOpenDialog(refNum, &volRefNum, pathP, 0, 0, 0, "Game Data Path", kFileBrowserLibFlagNoFiles)) { - FieldPtr fldP; - MemHandle textH; - Int16 offset, copySize, maxSize; - - fldP = (FieldType *)GetObjectPtr(TabGameInfoPathField); - maxSize = FldGetMaxChars(fldP); - textH = FldGetTextHandle(fldP); - - FldSetTextHandle(fldP, NULL); - textP = (Char *)MemHandleLock(textH); - offset = 0; - copySize = StrLen(pathP); - - if (StrNCaselessCompare(pathP, "/Palm/Programs/ScummVM/Games/", 29) == 0) { - if (StrLen(pathP) == 29) { - copySize = 1; - pathP[0] = '.'; - } else { - copySize -= 29; - offset = 29; - } - } - - if (copySize > maxSize) - copySize = maxSize; - StrNCopy(textP, pathP + offset, copySize); - - MemHandleUnlock(textH); - FldSetTextHandle(fldP, textH); - FldDrawField(fldP); - FldGrabFocus(fldP); - } - - MemPtrFree(pathP); - FileBrowserLibClose(refNum); - } - } -} - -Boolean EditGameFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmCloseEvent: - EditGameCancel(); - handled = true; - break; - - case frmOpenEvent: - switch (gFormEditMode) { - case edtModeAdd: - GameManInit(dmMaxRecordIndex); - break; - case edtModeEdit: - case edtModeParams: - default : - GameManInit(GamGetSelected()); - break; - } - handled = true; - break; - - case keyDownEvent: - switch (eventP->data.keyDown.chr) { - case chrLineFeed: - case chrCarriageReturn: - return true; - } - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (GameEditForm + 1) : - case (GameEditForm + 2) : - case (GameEditForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - GameEditForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case GameEditOKButton: - switch (gFormEditMode) { - case edtModeAdd: - GameManSave(dmMaxRecordIndex); - break; - case edtModeEdit: - case edtModeParams: - default : - GameManSave(GamGetSelected()); - break; - } - break; - - case GameEditCancelButton: - EditGameCancel(); - break; - - case GameEditDeleteButton: - EditGameFormDelete(false); - break; - - case TabGameInfoBrowsePushButton: - EditGameBowser(); - break; - - case TabGameInfoEnginePopTrigger: - FrmList(eventP, TabGameInfoEngineList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameInfoEngineList)); - break; - - case TabGameDisplayGfxPopupPopTrigger: - FrmList(eventP, TabGameDisplayGfxListList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameDisplayGfxListList)); - break; - - case TabGameDisplayRenderPopTrigger: - FrmList(eventP, TabGameDisplayRenderList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameDisplayRenderList)); - break; - - case TabGameOptionsLanguagePopTrigger: - FrmList(eventP, TabGameOptionsLanguageList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameOptionsLanguageList)); - break; - - case TabGameOptionsPlatformPopTrigger: - FrmList(eventP, TabGameOptionsPlatformList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabGameOptionsPlatformList)); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h b/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h deleted file mode 100644 index 90d271e115..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formEditGame.h +++ /dev/null @@ -1,39 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __FORMEDITGAME_H__ -#define __FORMEDITGAME_H__ - -// edit game mode -enum { - edtModeAdd, - edtModeEdit, - edtModeParams -}; - -extern UInt8 gFormEditMode; -void EditGameFormDelete(Boolean direct); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp b/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp deleted file mode 100644 index 35b44486e9..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formMisc.cpp +++ /dev/null @@ -1,275 +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. - * - * $URL$ - * $Id$ - * - */ - -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "globals.h" - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static Boolean ScummVMTabSave() { - FieldType *fld1P, *fld2P; - ControlType *cckP[11]; - FormPtr frmP; - - fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); - fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField); - - cckP[0] = (ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox); - cckP[3] = (ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox); - cckP[6] = (ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox); - cckP[9] = (ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox); - cckP[10]= (ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox); - - frmP = FrmGetActiveForm(); - if (FldGetTextLength(fld1P) == 0 && CtlGetValue(cckP[3]) == 1) { - TabSetActive(frmP, myTabP, 1); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMiscScummVMDebugLevelField)); - FrmCustomAlert(FrmWarnAlert,"You must specify a debug level.",0,0); - return false; - - } else if (FldGetTextLength(fld2P) == 0 && CtlGetValue(cckP[0]) == 1) { - TabSetActive(frmP, myTabP, 1); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMiscScummVMAutosaveField)); - FrmCustomAlert(FrmWarnAlert,"You must specify a period.",0,0); - return false; - } - - gPrefs->autoSave = CtlGetValue(cckP[0]); - gPrefs->debug = CtlGetValue(cckP[3]); - gPrefs->demoMode = CtlGetValue(cckP[6]); - gPrefs->copyProtection = CtlGetValue(cckP[9]); - gPrefs->altIntro = CtlGetValue(cckP[10]); - - gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P)); - gPrefs->autoSavePeriod = StrAToI(FldGetTextPtr(fld2P)); - - return true; -} - -static void PalmOSTabSave() { - ControlType *cckP[11]; - - if (OPTIONS_TST(kOptDeviceARM) && !OPTIONS_TST(kOptDeviceZodiac)) { - cckP[3]= (ControlType *)GetObjectPtr(TabMiscPalmOSAdvancedCheckbox); - gPrefs->advancedMode = CtlGetValue(cckP[3]); - } - - if (!OPTIONS_TST(kOptDeviceARM)) { - cckP[2] = (ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox); - gPrefs->stdPalette = CtlGetValue(cckP[2]); - } - - cckP[0] = (ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox); - cckP[4] = (ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox); - cckP[5] = (ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox); - cckP[6] = (ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox); - cckP[7] = (ControlType *)GetObjectPtr(TabMiscPalmOSArrowCheckbox); - - gPrefs->vibrator = CtlGetValue(cckP[0]); - gPrefs->autoOff = !CtlGetValue(cckP[1]); - gPrefs->setStack = CtlGetValue(cckP[4]); - gPrefs->exitLauncher = CtlGetValue(cckP[5]); - gPrefs->stylusClick = !CtlGetValue(cckP[6]); - gPrefs->arrowKeys = CtlGetValue(cckP[7]); -} - -static void ExtsTabSave() { - ControlType *cckP[2]; - - if (OPTIONS_TST(kOptLightspeedAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); - cckP[0] = (ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox); - - gPrefs->lightspeed.enable = CtlGetValue(cckP[0]); - gPrefs->lightspeed.mode = LstGetSelection(list1P); - } - if (OPTIONS_TST(kOptGoLcdAPI)) { - cckP[1] = (ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox); - gPrefs->goLCD = CtlGetValue(cckP[1]); - } -} - -static void ScummVMTabInit() { - FieldType *fld1P, *fld2P; - Char *levelP, *periodP; - MemHandle levelH, periodH; - - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox), gPrefs->autoSave); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox), gPrefs->debug); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox), gPrefs->demoMode); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox), gPrefs->copyProtection); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox), gPrefs->altIntro); - - fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); - fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField); - - levelH = MemHandleNew(FldGetMaxChars(fld1P)+1); - levelP = (Char *)MemHandleLock(levelH); - StrIToA(levelP, gPrefs->debugLevel); - MemHandleUnlock(levelH); - - periodH = MemHandleNew(FldGetMaxChars(fld2P)+1); - periodP = (Char *)MemHandleLock(periodH); - StrIToA(periodP, gPrefs->autoSavePeriod); - MemHandleUnlock(periodH); - - FldSetTextHandle(fld1P, levelH); - FldSetTextHandle(fld2P, periodH); -} - -static void PalmOSTabInit() { - if (OPTIONS_TST(kOptDeviceARM) && !OPTIONS_TST(kOptDeviceZodiac)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSAdvancedCheckbox), gPrefs->advancedMode); - - if (!OPTIONS_TST(kOptDeviceARM)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox), gPrefs->stdPalette); - - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox), gPrefs->exitLauncher); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox), gPrefs->setStack); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox), gPrefs->vibrator); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox), !gPrefs->autoOff); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox), !gPrefs->stylusClick); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSArrowCheckbox), gPrefs->arrowKeys); -} - -static void ExtsTabInit() { - if (OPTIONS_TST(kOptLightspeedAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); - LstSetSelection(list1P, gPrefs->lightspeed.mode); - CtlSetLabel((ControlType *)GetObjectPtr(TabMiscExtsLightspeedPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox), gPrefs->lightspeed.enable); - } - - if (OPTIONS_TST(kOptGoLcdAPI)) - CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox), gPrefs->goLCD); -} - -static void MiscFormSave() { - if (!ScummVMTabSave()) return; - PalmOSTabSave(); - ExtsTabSave(); - - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void MiscFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - UInt8 extsCnt = 2; - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "PalmOS", TabMiscPalmOSForm); - TabAddContent(&frmP, tabP, "ScummVM", TabMiscScummVMForm); - TabAddContent(&frmP, tabP, "More ...", TabMiscExtsForm); - - if (OPTIONS_TST(kOptDeviceARM)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscPalmOSStdPaletteCheckbox)); - TabMoveUpObject(frmP, TabMiscPalmOSAdvancedCheckbox, 12); - } - - if (!OPTIONS_TST(kOptDeviceARM) || OPTIONS_TST(kOptDeviceZodiac)) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscPalmOSAdvancedCheckbox)); - - if (!OPTIONS_TST(kOptGoLcdAPI)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsGolcdCheckbox)); - // move lightspeed - TabMoveUpObject(frmP, TabMiscExtsLightspeedCheckbox, 12); - TabMoveUpObject(frmP, TabMiscExtsLightspeedPopTrigger, 12); - TabMoveUpObject(frmP, TabMiscExtsLightspeedList, 12); - TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); - extsCnt--; - } - - if (!OPTIONS_TST(kOptLightspeedAPI)) { - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedCheckbox)); -// FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); // cannot remove this ? - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedPopTrigger)); - TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); - extsCnt--; - } - - if (extsCnt) - FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsNothingLabel)); - - PalmOSTabInit(); - ScummVMTabInit(); - ExtsTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean MiscFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - MiscFormInit(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (MiscForm + 1) : - case (MiscForm + 2) : - case (MiscForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - MiscForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case TabMiscExtsLightspeedPopTrigger: - FrmList(eventP, TabMiscExtsLightspeedList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); - break; - - case MiscOKButton: - MiscFormSave(); - break; - - case MiscCancelButton: - TabDeleteTabs(myTabP); - FrmReturnToMain(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp deleted file mode 100644 index bb0ac894c2..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp +++ /dev/null @@ -1,278 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include "StarterRsc.h" -#include "formUtil.h" -#include "games.h" -#include "start.h" - -#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0]))) - -static Char **items = NULL; -Int16 selectedEngine = -1; - -// Supported games -static const char *engine_agos[] = { - "Demon in my Pocket", - "Elvira - Mistress of the Dark", - "Elvira II - The Jaws of Cerberus", - "Jumble", - "NoPatience", - "Simon the Sorcerer I", - "Simon the Sorcerer II", - "Swampy Adventures", - "The Feeble Files", - "Waxworks" -}; - -static const char *engine_sky[] = { - "Floppy, CD and Demo" -}; - -static const char *engine_sword1[] = { - "The Shadow of the Templars (PC/Mac)", - "The Shadow of the Templars (Demo)" -}; - -static const char *engine_sword2[] = { - "The Smoking Mirror", - "The Smoking Mirror (Demo)" -}; - -static const char *engine_cine[] = { - "Future Wars", - "Operation Stealth" -}; - -static const char *engine_queen[] = { - "Flight of the Amazon Queen" -}; - -static const char *engine_lure[] = { - "Lure of the Tempress" -}; - -static const char *engine_gob[] = { - "Bargon Attack", - "Gobliiins", - "Gobliins 2", - "Goblins Quest 3", - "The Bizarre Adventures of Woodruff and the Schnibble", - "Ween: The Prophecy", -}; - -static const char *engine_kyra[] = { - "The Legend of Kyrandia", - "The Legend of Kyrandia: The Hand of Fate", - "The Legend of Kyrandia: Malcolm's Revenge" -}; - -static const char *engine_parallaction[] = { - "Nippon Safes Inc." -}; - -static const char *engine_saga[] = { - "I Have No Mouth And I Must Scream", - "Inherit the earth" -}; - -static const char *engine_scumm[] = { - "Day of the Tentacle", - "Indiana Jones and the Fate of Atlantis", - "Indiana Jones and the Last Crusade", - "Loom", - "Maniac Mansion", - "Monkey Island 2: LeChuck's Revenge", - "Passport to Adventure", - "Sam & Max Hit the Road", - "The Secret of Monkey Island" - "Zak McKracken and the Alien Mindbenders" -}; - -static const char *engine_agi[] = { - "AGI Tetris", - "Caitlyn's Destiny", - "Donald Duck's Playground", - "Fanmade AGI game", - "Gold Rush!", - "King's Quest I: Quest for the Crown", - "King's Quest II: Romancing the Throne", - "King's Quest III: To Heir Is Human", - "King's Quest IV: The Perils of Rosella", - "Leisure Suit Larry in the Land of the Lounge Lizards", - "Mixed-Up Mother Goose", - "Manhunter 1: New York", - "Manhunter 2: San Francisco", - "Police Quest I: In Pursuit of the Death Angel", - "Serguei's Destiny 1", - "Serguei's Destiny 2", - "Space Quest 0: Replicated", - "Space Quest I: The Sarien Encounter", - "Space Quest II: Vohaul's Revenge", - "Space Quest X: The Lost Chapter", - "The Black Cauldron", - "Xmas Card" -}; - -static const char *engine_touche[] = { - "Touche: The Adventures of the Fifth Musketeer" -}; - -static const char *engine_cruise[] = { - "Cruise for a Corpse" -}; - -static const struct { - int size; - const char **listP; -} supported[] = { - { ARRAYSIZE(engine_agos), engine_agos }, - { ARRAYSIZE(engine_sky), engine_sky }, - { ARRAYSIZE(engine_sword1), engine_sword1 }, - { ARRAYSIZE(engine_sword2), engine_sword2 }, - { ARRAYSIZE(engine_cine), engine_cine }, - { ARRAYSIZE(engine_queen), engine_queen }, - { ARRAYSIZE(engine_lure), engine_lure }, - { ARRAYSIZE(engine_gob), engine_gob }, - { ARRAYSIZE(engine_kyra), engine_kyra }, - { ARRAYSIZE(engine_parallaction), engine_parallaction }, - { ARRAYSIZE(engine_saga), engine_saga }, - { ARRAYSIZE(engine_scumm), engine_scumm }, - { ARRAYSIZE(engine_agi), engine_agi }, - { ARRAYSIZE(engine_touche), engine_touche }, - { ARRAYSIZE(engine_cruise), engine_cruise } -}; - -static void SelectorSetList(Int16 sel) { - ListType *listP; - FormPtr frmP = FrmGetActiveForm(); - - Boolean toBeDrawn = (items != NULL); - if (items) - MemPtrFree(items); - - listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineSupportedList)); - items = (Char **)MemPtrNew(supported[sel].size * sizeof(Char *)); - - for (int i = 0; i < supported[sel].size; i++) - items[i] = (Char *)supported[sel].listP[i]; - - LstSetListChoices (listP, items, supported[sel].size); - LstSetTopItem(listP, 0); - LstSetSelection(listP, -1); - - if (toBeDrawn) { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); - } -} - -static void SelectorFormInit() { - ListType *listP; - FormPtr frmP = FrmGetActiveForm(); - - listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineListList)); - itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *)); - - for (int i = 0; i < ENGINE_COUNT; i++) - itemsText[i] = (Char *)engines[i].nameP; - - LstSetListChoices (listP, itemsText, ENGINE_COUNT); - LstSetSelection(listP, 0); - - SelectorSetList(0); - - FrmDrawForm(frmP); -} - -static void SelectorFormFree(bool quit) { - items = NULL; - - if (!quit) { - ListType *listP = (ListType *)GetObjectPtr(EngineListList); - Int16 sel = LstGetSelection(listP); - - FrmReturnToMain(); - StartScummVM(sel); - - } else { - FrmReturnToMain(); - - if (bDirectMode) { - // force exit if nothing selected - EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrLaunch; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue(&event, 0, true); - } - } -} - -Boolean SelectorFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - SelectorFormInit(); - handled = true; - break; - - case frmCloseEvent: - SelectorFormFree(true); - handled = true; - break; - - case lstSelectEvent: - if (eventP->data.lstSelect.listID == EngineSupportedList) - LstSetSelection(eventP->data.lstSelect.pList, -1); - else - SelectorSetList(eventP->data.lstSelect.selection); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case EngineOkButton: - SelectorFormFree(false); - break; - - case EngineCancelButton: - SelectorFormFree(true); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp deleted file mode 100644 index 9566a25311..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formSkins.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#include - -#include "palmdefs.h" -#include "start.h" -#include "forms.h" -#include "skin.h" -#include "globals.h" - -static Int16 SkinsFormCompare(SkinInfoType *a, SkinInfoType *b, SortRecordInfoPtr, SortRecordInfoPtr, MemHandle) { - return StrCompare(a->nameP, b->nameP); -} - -static void SkinsFormInit(Boolean bDraw) { - MemHandle skins = NULL; - SkinInfoType *skinsInfo; - UInt16 numSkins = 0; - - FormPtr frmP; - ListType *listP; - MemHandle items = NULL; - ControlType *cck1P; - DmSearchStateType stateInfo; - UInt16 cardNo; - LocalID dbID; - - Err errInfo; - Char nameP[32]; - - itemsText = NULL; - - // parse and save skins - Err err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); - while (!err && dbID) { - errInfo = DmDatabaseInfo (cardNo, dbID, nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - if (!errInfo) - { - if (!skins) - skins = MemHandleNew(sizeof(SkinInfoType)); - else - MemHandleResize(skins, MemHandleSize(skins) + sizeof(SkinInfoType)); - - skinsInfo = (SkinInfoType *)MemHandleLock(skins); - StrCopy(skinsInfo[numSkins].nameP, nameP); - skinsInfo[numSkins].cardNo = cardNo; - skinsInfo[numSkins].dbID = dbID; - MemHandleUnlock(skins); - numSkins++; - } - err = DmGetNextDatabaseByTypeCreator(false, &stateInfo, 'skin', appFileCreator, false, &cardNo, &dbID); - } - - Int16 selected = -1; - - cck1P = (ControlType *)GetObjectPtr(SkinsSoundClickCheckbox); - CtlSetValue(cck1P, gPrefs->soundClick); - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - skinsInfo = (SkinInfoType *)MemHandleLock(skins); - SysQSort(skinsInfo, numSkins, sizeof(SkinInfoType), (CmpFuncPtr)SkinsFormCompare, 0); - - // create itemsText (TODO: create a custom draw function) - for (UInt16 index=0; index < numSkins; index++) - { - if (!items) - items = MemHandleNew(sizeof(Char *)); - else - MemHandleResize(items, MemHandleSize(items) + sizeof(Char *)); - - itemsText = (Char **)MemHandleLock(items); - itemsText[index] = skinsInfo[index].nameP; - MemHandleUnlock(items); - - if ( gPrefs->skin.cardNo == skinsInfo[index].cardNo && - gPrefs->skin.dbID == skinsInfo[index].dbID && - StrCompare(gPrefs->skin.nameP, skinsInfo[index].nameP) == 0) - selected = index; - } - // save globals and set list - itemsText = (Char **)MemHandleLock(items); - itemsList = (void *)skinsInfo; - itemsType = ITEM_TYPE_SKIN; - - LstSetListChoices (listP, itemsText, numSkins); - LstSetSelection(listP, selected); - - // bDraw = true -> draw whole from - // bDraw = false -> redraw list - if (bDraw) { - frmP = FrmGetActiveForm(); - FrmDrawForm(frmP); - } else { - WinScreenLock(winLockCopy); - LstDrawList(listP); - WinScreenUnlock(); -// LstSetSelection(listP, 0); - } -} - -static void SkinsFormExit(Boolean bSave) { - MemHandle skins; - MemHandle items; - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (bSave && selected == -1) { // may never occurred... - FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - skins = MemPtrRecoverHandle(skinsInfo); - items = MemPtrRecoverHandle(itemsText); - - itemsText = NULL; - itemsList = NULL; - itemsType = ITEM_TYPE_UNKNOWN; - - if (bSave) { - ControlType *cck1P; - - StrCopy(gPrefs->skin.nameP, skinsInfo[selected].nameP); - gPrefs->skin.cardNo = skinsInfo[selected].cardNo; - gPrefs->skin.dbID = skinsInfo[selected].dbID; - -/* DmOpenRef skinDB = SknOpenSkin(); - UInt32 depth = SknGetDepth(skinDB); - SknCloseSkin(skinDB); - - if (depth != 8 && depth != 16) depth = 8; - - if (depth == 16 && !OPTIONS_TST(kOptMode16Bit)) { - FrmCustomAlert(FrmInfoAlert, "You can only use 8bit skin on your device.", 0, 0); - gPrefs->skin.cardNo = cardNo; - gPrefs->skin.dbID = dbID; - } -*/ - cck1P = (ControlType *)GetObjectPtr(SkinsSoundClickCheckbox); - gPrefs->soundClick = CtlGetValue(cck1P); - } - - FrmReturnToMain(); - - MemHandleUnlock(items); - MemHandleUnlock(skins); - MemHandleFree(items); - MemHandleFree(skins); - - if (bSave) - SknApplySkin(); -} - -static void SkinsFormBeam() { - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - Err err; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (selected == -1) { // may never occurred... - FrmCustomAlert(FrmWarnAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - err = SendDatabase(0, skinsInfo[selected].dbID, "skin.pdb", "\nScummVM Skin"); - -// if (err) -// FrmCustomAlert(FrmErrorAlert, "Unable to beam this skin.",0,0); -} - -static void SkinsFormDelete() { - MemHandle skins; - MemHandle items; - SkinInfoType *skinsInfo; - - ListType *listP; - Int16 selected; - - listP = (ListType *)GetObjectPtr(SkinsSkinList); - selected = LstGetSelection(listP); - - if (selected == -1) { // may never occurred... - FrmCustomAlert(FrmInfoAlert, "You didn't select a skin.", 0, 0); - return; - } - - skinsInfo = (SkinInfoType *)itemsList; - skins = MemPtrRecoverHandle(skinsInfo); - items = MemPtrRecoverHandle(itemsText); - - if ( gPrefs->skin.cardNo == skinsInfo[selected].cardNo && - gPrefs->skin.dbID == skinsInfo[selected].dbID && - StrCompare(gPrefs->skin.nameP, skinsInfo[selected].nameP) == 0) { - FrmCustomAlert(FrmInfoAlert, "You cannot delete the active skin.",0,0); - return; - - } else { - Err err = DmDeleteDatabase(0, skinsInfo[selected].dbID); - if (!err) { - - itemsText = NULL; - itemsList = NULL; - itemsType = ITEM_TYPE_UNKNOWN; - - MemHandleUnlock(items); - MemHandleUnlock(skins); - MemHandleFree(items); - MemHandleFree(skins); - - SkinsFormInit(false); - } else { - FrmCustomAlert(FrmErrorAlert, "Skin deletion failed.",0,0); - } - } - -} -Boolean SkinsFormHandleEvent(EventPtr eventP) { - Boolean handled = false; - - switch (eventP->eType) { - - case frmOpenEvent: - SkinsFormInit(true); - handled = true; - break; - - case frmCloseEvent: - SkinsFormExit(false); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case SkinsOKButton: - SkinsFormExit(true); - break; - - case SkinsCancelButton: - SkinsFormExit(false); - break; - - case SkinsBeamButton: - SkinsFormBeam(); - break; - - case SkinsDeleteButton: - SkinsFormDelete(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp b/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp deleted file mode 100644 index 6d1d55e6e2..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formUtil.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include - -#include "forms.h" - -Char **itemsText = NULL; -void *itemsList = NULL; -Char itemsType = ITEM_TYPE_UNKNOWN; - -void FrmReturnToMain(UInt16 updateCode) { - // if there is a form loaded, prevent crash on OS5 - if (FrmGetFirstForm()) { - FrmUpdateForm(MainForm, updateCode); - FrmReturnToForm(MainForm); - } -} - -void FldTrimText(FieldPtr fldP) { - MemHandle tmpH; - Char *tmpP; - - tmpH = FldGetTextHandle(fldP); - FldSetTextHandle(fldP, NULL); - tmpP = (Char *)MemHandleLock(tmpH); - TxtGlueStripSpaces(tmpP, true, true); - MemHandleUnlock(tmpH); - FldSetTextHandle(fldP, tmpH); -} - -/*********************************************************************** - * - * FUNCTION: GetObjectPtr - * - * DESCRIPTION: This routine returns a pointer to an object in the current - * form. - * - * PARAMETERS: formId - id of the form to display - * - * RETURNED: void * - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -void * GetObjectPtr(UInt16 objectID) { - FormPtr frmP; - - frmP = FrmGetActiveForm(); - return FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID)); -} - -void FrmList(EventPtr eventP, UInt16 objectID) { - ListType *listP; - UInt16 listItem; - - listP = (ListType *)GetObjectPtr(objectID); - listItem = LstPopupList(listP); - CtlSetLabel(eventP->data.ctlSelect.pControl, LstGetSelectionText(listP, LstGetSelection(listP))); -} - diff --git a/backends/platform/PalmOS/Src/launcher/forms/formUtil.h b/backends/platform/PalmOS/Src/launcher/forms/formUtil.h deleted file mode 100644 index e9b87bc49f..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formUtil.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __FORMUTIL_H__ -#define __FORMUTIL_H__ - -#define frmRedrawUpdateMS (frmRedrawUpdateCode + 1) -#define frmRedrawUpdateMSImport (frmRedrawUpdateCode + 2) - -#define NO_ENGINE -1 - -// form list draw -#define ITEM_TYPE_UNKNOWN 'U' -#define ITEM_TYPE_CARD 'C' -#define ITEM_TYPE_SKIN 'S' - -extern Char **itemsText; -extern void *itemsList; -extern Char itemsType; - -void FrmReturnToMain(UInt16 updateCode = frmRedrawUpdateMS); -void * GetObjectPtr(UInt16 objectID); -void FldTrimText(FieldPtr fldP); -void FrmList(EventPtr eventP, UInt16 objectID); - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp b/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp deleted file mode 100644 index 3f4ab1b28f..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/forminfo.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" - -#include "base/version.h" -#include "globals.h" -#include "init_palmos.h" - -/*********************************************************************** - * - * FUNCTION: MiscOptionsFormSave - * FUNCTION: MiscOptionsFormInit - * FUNCTION: MiscOptionsFormHandleEvent - * - * DESCRIPTION: Misc. Options form functions - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static TabType *myTabP; -static UInt16 lastTab = 0; - -static UInt32 GetStackSize() { - MemPtr startPP, endPP; - SysGetStackInfo(&startPP, &endPP); - - return ((Char *)endPP - (Char *)startPP) / 1024L; -} - -static void VersionTabDraw() { - WinDrawChars(gScummVMVersion, StrLen(gScummVMVersion), 47, 12 + 30); - WinDrawChars(gScummVMBuildDate, StrLen(gScummVMBuildDate), 47, 24 + 30); -} - -static void SystemTabDraw() { - Coord x; - UInt32 dm, sm, df, sf, stack; - Char num[10]; - - PalmGetMemory(&sm, &dm, &sf, 0); - stack = GetStackSize(); - df = gVars->startupMemory; - - WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground)); - FntSetFont(stdFont); - - StrIToA(num, dm); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 12 + 30); - - StrIToA(num, sm); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 24 + 30); - - StrIToA(num, stack); - x = 147 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 36 + 30); - - StrIToA(num, df); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 12 + 30); - - StrIToA(num, sf); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 24 + 30); - - StrCopy(num,"-"); - x = 107 - FntCharsWidth(num, StrLen(num)) + 5; - WinDrawChars(num, StrLen(num), x, 36 + 30); -} - -static void InfoFormSave() { - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} - -static void AboutTabDraw() { - MemHandle hTemp; - BitmapPtr bmpTemp; - - hTemp = DmGetResource (bitmapRsc, 1200); - if (hTemp) { - bmpTemp = (BitmapType *)MemHandleLock(hTemp); - WinDrawBitmap(bmpTemp,3,44); - MemPtrUnlock(bmpTemp); - DmReleaseResource(hTemp); - } -} - -static void InfoFormInit() { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "About", TabInfoAboutForm, AboutTabDraw); - TabAddContent(&frmP, tabP, "Version", TabInfoVersionForm, VersionTabDraw); - TabAddContent(&frmP, tabP, "Memory", TabInfoSystemForm, SystemTabDraw); - - lastTab = 0; - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean InfoFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - InfoFormInit(); - handled = true; - break; - - case frmCloseEvent: - InfoFormSave(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (InfoForm + 1) : - case (InfoForm + 2) : - case (InfoForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - InfoForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case InfoOKButton: - InfoFormSave(); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp deleted file mode 100644 index ca2e18ee6d..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formmain.cpp +++ /dev/null @@ -1,364 +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. - * - * $URL$ - * $Id$ - * - */ - -#include - -#include "StarterRsc.h" -#include "start.h" -#include "skin.h" -#include "games.h" -#include "globals.h" - -#include "base/version.h" - -#include "formEditGame.h" -#include "formUtil.h" - -static UInt16 sknLastOn = skinButtonNone; - -static Err BeamMe() { - UInt16 cardNo; - LocalID dbID; - Err err; - - err = SysCurAppDatabase(&cardNo, &dbID); - if (dbID) - err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games"); - else - err = DmGetLastErr(); - - return err; -} - -/*********************************************************************** - * - * FUNCTION: MainFormInit - * - * DESCRIPTION: This routine initializes the MainForm form. - * - * PARAMETERS: frm - pointer to the MainForm form. - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void MainFormInit() -{ - SknApplySkin(); -} - -/*********************************************************************** - * - * FUNCTION: MainFormDoCommand - * - * DESCRIPTION: This routine performs the menu command specified. - * - * PARAMETERS: command - menu item id - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -static Boolean MainFormDoCommand(UInt16 command) -{ - Boolean handled = false; - - switch (command) { - case MainGamesMemoryCard: - FrmPopupForm(CardSlotForm); - handled = true; - break; - - case MainGamesNew: - gFormEditMode = edtModeAdd; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case MainGamesEdit: - gFormEditMode = edtModeEdit; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case MainGamesDelete: - EditGameFormDelete(true); - handled = true; - break; - - case MainOptionsBeam: - BeamMe(); - //if (BeamMe()) - //FrmCustomAlert(FrmErrorAlert,"Unable to beam ScummVM for PalmOS.",0,0); - handled = true; - break; - - case MainOptionsAbout: - FrmPopupForm(InfoForm); - handled = true; - break; - - case MainGamesMusicSound: - FrmPopupForm(MusicForm); - handled = true; - break; - - case MainOptionsSkins: - FrmPopupForm(SkinsForm); - handled = true; - break; - - case MainOptionsMisc: - FrmPopupForm(MiscForm); - handled = true; - break; - } - - MenuEraseStatus(0); - return handled; -} - -/*********************************************************************** - * - * FUNCTION: MainFormHandleEvent - * - * DESCRIPTION: This routine is the event handler for the - * "MainForm" of this application. - * - * PARAMETERS: eventP - a pointer to an EventType structure - * - * RETURNED: true if the event has handle and should not be passed - * to a higher level handler. - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -static Boolean PenDownRepeat() { - Coord x,y; - Boolean penDown, handled = false; - EvtGetPen(&x, &y, &penDown); - - if (penDown && sknLastOn) { - RectangleType r; - DmOpenRef skinDBP; - - skinDBP = SknOpenSkin(); - SknGetObjectBounds(skinDBP, sknLastOn, &r); - - if (RctPtInRectangle(x*2, y*2, &r)) { - if (SknGetState(skinDBP, sknLastOn) != sknStateSelected) { - SknSetState(skinDBP, sknLastOn, sknStateSelected); - SknShowObject(skinDBP, sknLastOn); - } - - switch (sknLastOn) { - case skinSliderUpArrow: - case skinSliderDownArrow: - handled = SknProcessArrowAction(sknLastOn); - break; - } - - } else { - if (SknGetState(skinDBP, sknLastOn) != sknStateNormal) { - SknSetState(skinDBP, sknLastOn, sknStateNormal); - SknShowObject(skinDBP, sknLastOn); - } - } - - SknCloseSkin(skinDBP); - } - - return handled; -} - - -Boolean MainFormHandleEvent(EventPtr eventP) -{ - Boolean handled = false; - FormPtr frmP; - Coord x,y; - DmOpenRef skinDBP; - - switch (eventP->eType) { - case frmUpdateEvent: - { - RectangleType r; - UInt16 idx; - IndexedColorType bgColor = UIColorGetTableEntryIndex(UIFormFill); - frmP = FrmGetFormPtr(MainForm); - - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - idx = FrmGetObjectIndex (frmP, MainMSBitMap); - else - idx = FrmGetObjectIndex (frmP, MainMSNoneBitMap); - - WinSetDrawMode(winPaint); - WinSetBackColor(bgColor); - FrmGetObjectBounds(frmP, idx, &r); - WinEraseRectangle(&r, 0); - FrmShowObject(frmP, idx); - - if (eventP->data.frmUpdate.updateCode == frmRedrawUpdateMSImport) { - GamImportDatabase(); - SknUpdateList(); - } - handled = true; - break; - } - case menuEvent: - handled = MainFormDoCommand(eventP->data.menu.itemID); - break; - - case frmOpenEvent: - MainFormInit(); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case MainCardsButton: - //gPrefs->card.volRefNum = parseCards(true); - FrmPopupForm(CardSlotForm); - break; - - case MainAboutButton: - FrmPopupForm(InfoForm); - break; - -// case MainListTypeSelTrigger: -// FrmList(eventP, MainListTypeList); -// break; - } - handled = true; - break; - - case penUpEvent: - x = eventP->screenX; - y = eventP->screenY; - lastIndex = dmMaxRecordIndex; // enable select/unselect list item - - if (sknLastOn != skinButtonNone) { - RectangleType r; - skinDBP = SknOpenSkin(); - SknGetObjectBounds(skinDBP, sknLastOn, &r); - SknSetState(skinDBP, sknLastOn, sknStateNormal); - SknShowObject(skinDBP, sknLastOn); - SknCloseSkin(skinDBP); - - if (RctPtInRectangle(x*2, y*2, &r)) { - switch (sknLastOn) { - case skinButtonGameAdd: - gFormEditMode = edtModeAdd; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case skinButtonGameAudio: - FrmPopupForm(MusicForm); - handled = true; - break; - - case skinButtonGameEdit: - case skinButtonGameParams: - gFormEditMode = edtModeParams; - FrmPopupForm(GameEditForm); - handled = true; - break; - - case skinButtonGameStart: - if (gPrefs->card.volRefNum == vfsInvalidVolRef) - FrmCustomAlert(FrmWarnAlert,"Please select/insert a memory card.", 0, 0); - else if (GamGetSelected() != dmMaxRecordIndex) - StartScummVM(); - else - FrmPopupForm(EngineForm); - handled = true; - break; - - case skinButtonGameDelete: - EditGameFormDelete(true); - break; - } - } - sknLastOn = skinButtonNone; - } - break; - - case penDownEvent: - case penMoveEvent: - if (sknLastOn == skinButtonNone) { - x = eventP->screenX; - y = eventP->screenY; - skinDBP = SknOpenSkin(); - - switch (sknLastOn = SknCheckClick(skinDBP, x,y)) { - case skinButtonNone: - break; - case skinSliderUpArrow: - case skinSliderDownArrow: - case skinButtonGameAdd: - case skinButtonGameEdit: - case skinButtonGameParams: - case skinButtonGameStart: - case skinButtonGameDelete: - case skinButtonGameAudio: - SknSetState(skinDBP, sknLastOn, sknStateSelected); - SknShowObject(skinDBP, sknLastOn); - if (gPrefs->soundClick) - SndPlaySystemSound(sndClick); - handled = true; - break; - default: - FrmCustomAlert(FrmWarnAlert,"Unknown button !",0,0); - } - SknCloseSkin(skinDBP); - SknSelect(x, y); - } - break; - - case keyDownEvent: - if ( (eventP->data.keyDown.chr >= 'a' && eventP->data.keyDown.chr <= 'z') || - (eventP->data.keyDown.chr >= 'A' && eventP->data.keyDown.chr <= 'Z')) { - if (GamJumpTo(eventP->data.keyDown.chr)) { - SknUpdateList(); - handled = true; - } - } - break; - - default: - handled = PenDownRepeat(); - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp b/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp deleted file mode 100644 index 48399efa95..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formmusic.cpp +++ /dev/null @@ -1,388 +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. - * - * $URL$ - * $Id$ - * - */ - -#include - -#include "start.h" -#include "formTabs.h" -#include "forms.h" -#include "games.h" - -#include "globals.h" - -static TabType *myTabP; -static UInt16 lastTab = 0; - -static GameInfoType *gameInfoP = NULL; - -// Music -static Boolean MusicTabSave() { - ControlType *cck1P, *cck2P; - ListType *list1P, *list2P, *list3P; - FieldType *fld1P; - UInt16 tempo; - FormPtr frmP; - - frmP = FrmGetActiveForm(); - - cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabMusicMultiMidiCheckbox); - - list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - list2P = (ListType *)GetObjectPtr(TabMusicRateList); - list3P = (ListType *)GetObjectPtr(TabMusicQualityList); - - fld1P = (FieldType *)GetObjectPtr(TabMusicTempoField); - - tempo = StrAToI(FldGetTextPtr(fld1P)); - if (tempo < 50 || tempo > 200) { - TabSetActive(frmP, myTabP, 0); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMusicTempoField)); - FrmCustomAlert(FrmErrorAlert, "Invalid tempo value (50...200)", 0, 0); - return false; - } - - gameInfoP->musicInfo.sound.music = CtlGetValue(cck1P); - gameInfoP->musicInfo.sound.multiMidi = CtlGetValue(cck2P); - - gameInfoP->musicInfo.sound.drvMusic = LstGetSelection(list1P); - gameInfoP->musicInfo.sound.rate = LstGetSelection(list2P); - gameInfoP->fmQuality = LstGetSelection(list3P); - gameInfoP->musicInfo.sound.tempo = tempo; - - return true; -} - -static void MusicTabInit() { - ControlType *cck1P, *cck2P; - ListType *list1P, *list2P, *list3P; - FieldType *fld1P; - MemHandle tempoH; - Char *tempoP; - - cck1P = (ControlType *)GetObjectPtr(TabMusicMusicCheckbox); - cck2P = (ControlType *)GetObjectPtr(TabMusicMultiMidiCheckbox); - - list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - list2P = (ListType *)GetObjectPtr(TabMusicRateList); - list3P = (ListType *)GetObjectPtr(TabMusicQualityList); - - fld1P = (FieldType *)GetObjectPtr(TabMusicTempoField); - - CtlSetValue(cck1P, gameInfoP->musicInfo.sound.music); - CtlSetValue(cck2P, gameInfoP->musicInfo.sound.multiMidi); - - if (gameInfoP->musicInfo.sound.drvMusic > 5) - gameInfoP->musicInfo.sound.drvMusic = 0; - - - LstSetSelection(list1P, gameInfoP->musicInfo.sound.drvMusic); - LstSetTopItem(list1P, gameInfoP->musicInfo.sound.drvMusic); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - LstSetSelection(list2P, gameInfoP->musicInfo.sound.rate); - LstSetTopItem(list2P, gameInfoP->musicInfo.sound.rate); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicRatePopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - - LstSetSelection(list3P, gameInfoP->fmQuality); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicQualityPopTrigger), LstGetSelectionText(list3P, LstGetSelection(list3P))); - - tempoH = MemHandleNew(FldGetMaxChars(fld1P)+1); - tempoP = (Char *)MemHandleLock(tempoH); - StrIToA(tempoP, gameInfoP->musicInfo.sound.tempo); - MemHandleUnlock(tempoH); - FldSetTextHandle(fld1P, tempoH); -} - -// Audio CD -static Boolean AudioCDTabSave() { - ControlType *cck3P; - FieldType *fld2P, *fld3P; - ListType *list1P, *list2P; - UInt16 firstTrack; - FormPtr frmP; - - frmP = FrmGetActiveForm(); - - cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); - fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField); - fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); - list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); - list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - - firstTrack = StrAToI(FldGetTextPtr(fld3P)); - if (firstTrack < 1 || firstTrack > 999) { - TabSetActive(frmP, myTabP, 2); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabAudioCDFirstTrackField)); - FrmCustomAlert(FrmErrorAlert, "Invalid track value (1...999)", 0, 0); - return false; - } - - gameInfoP->musicInfo.sound.CD = CtlGetValue(cck3P); - - gameInfoP->musicInfo.sound.drvCD = LstGetSelection(list1P); - gameInfoP->musicInfo.sound.frtCD = LstGetSelection(list2P); - - gameInfoP->musicInfo.sound.defaultTrackLength = StrAToI(FldGetTextPtr(fld2P)); - gameInfoP->musicInfo.sound.firstTrack = firstTrack; - - return true; -} - -static void AudioCDTabInit() { - ControlType *cck3P; - FieldType *fld2P, *fld3P; - ListType *list1P, *list2P; - MemHandle lengthH, firstTrackH; - Char *lengthP, *firstTrackP; - - cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox); - fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField); - fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField); - list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList); - list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - - LstSetSelection(list1P, gameInfoP->musicInfo.sound.drvCD); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - - LstSetSelection(list2P, gameInfoP->musicInfo.sound.frtCD); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P))); - - CtlSetValue(cck3P, gameInfoP->musicInfo.sound.CD); - - lengthH = MemHandleNew(FldGetMaxChars(fld2P)+1); - lengthP = (Char *)MemHandleLock(lengthH); - StrIToA(lengthP, gameInfoP->musicInfo.sound.defaultTrackLength); - MemHandleUnlock(lengthH); - FldSetTextHandle(fld2P, lengthH); - - firstTrackH = MemHandleNew(FldGetMaxChars(fld3P)+1); - firstTrackP = (Char *)MemHandleLock(firstTrackH); - StrIToA(firstTrackP, gameInfoP->musicInfo.sound.firstTrack); - MemHandleUnlock(firstTrackH); - FldSetTextHandle(fld3P, firstTrackH); -} - -// Volume -static void VolumeTabSave() { - SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; - - slid1P = (SliderControlType *)GetObjectPtr(TabVolumePalmSliderControl); - slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); - slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); - slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl); - slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl); - - CtlGetSliderValues ((ControlType *)slid1P, 0, 0, 0, &gameInfoP->musicInfo.volume.palm); - CtlGetSliderValues ((ControlType *)slid2P, 0, 0, 0, &gameInfoP->musicInfo.volume.music); - CtlGetSliderValues ((ControlType *)slid3P, 0, 0, 0, &gameInfoP->musicInfo.volume.sfx); - CtlGetSliderValues ((ControlType *)slid4P, 0, 0, 0, &gameInfoP->musicInfo.volume.speech); - CtlGetSliderValues ((ControlType *)slid5P, 0, 0, 0, &gameInfoP->musicInfo.volume.audiocd); -} - -static void VolumeTabInit() { - SliderControlType *slid1P, *slid2P, *slid3P, *slid4P, *slid5P; - UInt16 value; - - slid1P = (SliderControlType *)GetObjectPtr(TabVolumePalmSliderControl); - slid2P = (SliderControlType *)GetObjectPtr(TabVolumeMusicSliderControl); - slid3P = (SliderControlType *)GetObjectPtr(TabVolumeSfxSliderControl); - slid4P = (SliderControlType *)GetObjectPtr(TabVolumeSpeechSliderControl); - slid5P = (SliderControlType *)GetObjectPtr(TabVolumeAudioCDSliderControl); - - value = gameInfoP->musicInfo.volume.palm; - CtlSetSliderValues ((ControlType *)slid1P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.music; - CtlSetSliderValues ((ControlType *)slid2P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.sfx; - CtlSetSliderValues ((ControlType *)slid3P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.speech; - CtlSetSliderValues ((ControlType *)slid4P, 0, 0, 0, &value); - value = gameInfoP->musicInfo.volume.audiocd; - CtlSetSliderValues ((ControlType *)slid5P, 0, 0, 0, &value); -} - -static void MusicFormSave(UInt16 index) { - if (index != dmMaxRecordIndex) { - MemHandle recordH; - GameInfoType *ogameInfoP; - - if (!MusicTabSave()) return; - if (!AudioCDTabSave()) return; - VolumeTabSave(); - - recordH = DmGetRecord(gameDB, index); - ogameInfoP = (GameInfoType *)MemHandleLock(recordH); - DmWrite(ogameInfoP, 0, gameInfoP, sizeof(GameInfoType)); - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - } - - MemPtrFree(gameInfoP); - gameInfoP = NULL; - - TabDeleteTabs(myTabP); - FrmReturnToMain(); -} -static void MusicFormInit(UInt16 index) { - TabType *tabP; - FormType *frmP = FrmGetActiveForm(); - - if (index != dmMaxRecordIndex) { - MemHandle recordH = NULL; - GameInfoType *ogameInfoP; - - recordH = DmQueryRecord(gameDB, index); - ogameInfoP = (GameInfoType *)MemHandleLock(recordH); - - if (!ogameInfoP) { - FrmCustomAlert(FrmErrorAlert, "An error occurred.",0,0); - return; - } - - gameInfoP = (GameInfoType *)MemPtrNew(sizeof(GameInfoType)); - MemMove(gameInfoP, ogameInfoP, sizeof(GameInfoType)); - MemHandleUnlock(recordH); - - } else { - FrmCustomAlert(FrmWarnAlert, "Select an entry first.",0,0); - FrmReturnToMain(); - return; - } - - tabP = TabNewTabs(3); - TabAddContent(&frmP, tabP, "Sound", TabMusicForm); - TabAddContent(&frmP, tabP, "Volume", TabVolumeForm); - TabAddContent(&frmP, tabP, "Audio CD", TabAudioCDForm); - - MusicTabInit(); - AudioCDTabInit(); - VolumeTabInit(); - - FrmDrawForm(frmP); - TabSetActive(frmP, tabP, lastTab); - - myTabP = tabP; -} - -Boolean MusicFormHandleEvent(EventPtr eventP) { - FormPtr frmP = FrmGetActiveForm(); - Boolean handled = false; - - switch (eventP->eType) { - case frmOpenEvent: - MusicFormInit(GamGetSelected()); - handled = true; - break; - - case frmCloseEvent: - MusicFormSave(dmMaxRecordIndex); - handled = true; - break; - - case ctlSelectEvent: - switch (eventP->data.ctlSelect.controlID) - { - case (MusicForm + 1) : - case (MusicForm + 2) : - case (MusicForm + 3) : - lastTab = (eventP->data.ctlSelect.controlID - MusicForm - 1); - TabSetActive(frmP, myTabP, lastTab); - break; - - case TabMusicDriverPopTrigger: - FrmList(eventP, TabMusicDriverList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicDriverList)); - - if (!OPTIONS_TST(kOptDeviceZodiac) && !OPTIONS_TST(kOptSonyPa1LibAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMusicDriverList); - - if (LstGetSelection(list1P) == 4) { - FrmCustomAlert(FrmInfoAlert, "There is no built-in MIDI support on your device.", 0, 0); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - } - break; - - case TabMusicQualityPopTrigger: - FrmList(eventP, TabMusicQualityList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicQualityList)); - break; - - case TabMusicRatePopTrigger: - FrmList(eventP, TabMusicRateList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMusicRateList)); - - if (!OPTIONS_TST(kOptPalmSoundAPI)) { - ListType *list1P = (ListType *)GetObjectPtr(TabMusicRateList); - - if (LstGetSelection(list1P) != 0) { - FrmCustomAlert(FrmInfoAlert, "You cannot use this rate on your device.", 0, 0); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabMusicRatePopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - } - break; - - case TabAudioCDFormatPopTrigger: - FrmList(eventP, TabAudioCDFormatList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDFormatList)); - - if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) { - ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - break; - - case TabAudioCDDriverPopTrigger: - FrmList(eventP, TabAudioCDDriverList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabAudioCDDriverList)); - - if (LstGetSelection((ListPtr)GetObjectPtr(TabAudioCDDriverList)) == 1) { - ListType *list1P = (ListType *)GetObjectPtr(TabAudioCDFormatList); - LstSetSelection(list1P, 0); - CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); - } - break; - - case MusicOKButton: - MusicFormSave(GamGetSelected()); - break; - - case MusicCancelButton: - MusicFormSave(dmMaxRecordIndex); - break; - } - handled = true; - break; - - default: - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/forms.h b/backends/platform/PalmOS/Src/launcher/forms/forms.h deleted file mode 100644 index ca0089d8c1..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/forms.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __FORMS_H__ -#define __FORMS_H__ - -#include "StarterRsc.h" -#include "formUtil.h" - -#include "formEditGame.h" -#include "formCards.h" - - -#define HANDLER(x) Boolean x##FormHandleEvent(EventPtr eventP); - -HANDLER(Main) -HANDLER(EditGame) -HANDLER(SystemInfo) -HANDLER(Misc) -HANDLER(CardSlot) -HANDLER(Skins) -HANDLER(Music) -HANDLER(Info) -HANDLER(Selector) - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp b/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp deleted file mode 100644 index d3f18e39d7..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formtabs.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include -#include -#include - -#include "globals.h" -#include "formTabs.h" - -TabType *TabNewTabs(UInt16 cnt) { - TabType *newP = new TabType; - - newP->count = 0; - newP->width = 0; - newP->tabs = new TabDataType[cnt]; - - return newP; -} - -void TabMoveUpObject(FormType *frmP, UInt16 objID, Coord amount) { - Coord x, y; - FrmGetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), &x, &y); - FrmSetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), x, y - amount); -} - -void TabDeleteTabs(TabType *tabP) { - UInt16 cnt, num; - num = MemPtrSize(tabP->tabs) / sizeof(TabDataType); - - for (cnt = 0; cnt < num; cnt++) - FrmDeleteForm(tabP->tabs[cnt].srcP); - - delete tabP->tabs; - delete tabP; -} - -Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc) { - FormType *srcP; - UInt16 cnt; - void *objP, **dstP; - UInt16 objNum; - Coord x, y, w, h; - UInt16 id; - RectangleType r; - - dstP = (void **)frmP; - srcP = FrmInitForm(rscID); - - objNum = FrmGetNumberOfObjects(srcP); - - // save tab data - - // it's required to keep to source forms active - // while the tab form is not close for list data ptr (items text) - // TODO : fix this ! - tabP->tabs[tabP->count].srcP = srcP; - tabP->tabs[tabP->count].first = FrmGetObjectId(srcP, 0); - tabP->tabs[tabP->count].last = FrmGetObjectId(srcP, objNum - 1); - tabP->tabs[tabP->count].drawFunc= drawFunc; - tabP->count++; - tabP->active = tabP->count; - - // create tab - FntSetFont(stdFont); - x = 4 + tabP->width; - y = 16; - w = FntCharsWidth(nameP, StrLen(nameP)) + 6; - h = 12; - ControlType *addP = CtlNewControl(dstP, (FrmGetFormId(*frmP) + tabP->count), buttonCtl, nameP, x, y, w, h, stdFont, 0, true); - CtlGlueSetFrameStyle(addP, noButtonFrame); - tabP->width += w + 3; - - // create tab content - for (cnt = 0; cnt < objNum; cnt++) { - objP = FrmGetObjectPtr(srcP, cnt); - id = FrmGetObjectId(srcP, cnt); - FrmGetObjectBounds(srcP, cnt, &r); - x = r.topLeft.x - 2; - y = r.topLeft.y + 30; - w = r.extent.x; - h = r.extent.y; - - FrmSetObjectPosition(srcP, cnt, x, y); - - switch (FrmGetObjectType(srcP, cnt)) { - case frmListObj: { - // HOWTO : to auto link the list to a popup trigger the listID must be popupID + 1 if popup id - // desn't exist the triggerID will be 0 and the list will be shown, but take care to not define - // ListID - 1 object if you want to show the list. - ListType *newP; - Char **itemsP = LstGlueGetItemsText((ListType *)objP); - FontID font = LstGlueGetFont((ListType *)objP); - UInt16 visible = LstGetVisibleItems((ListType *)objP); - UInt16 items = LstGetNumberOfItems((ListType *)objP); - UInt16 trigger = id - 1; - trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0; - - LstNewList(dstP, id, x, y, w, h, font, visible, trigger); - newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - LstSetListChoices(newP, itemsP, items); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - case frmFieldObj: { - FieldAttrType attr; - FontID font = FldGetFont((FieldType *)objP); - UInt16 maxChars = FldGetMaxChars((FieldType *)objP); - FldGetAttributes((FieldType *)objP, &attr); - FldNewField(dstP, id, x, y, w, h, font, maxChars, attr.editable, attr.underlined, attr.singleLine, attr.dynamicSize, (JustificationType)attr.justification, attr.autoShift, attr.hasScrollBar, attr.numeric); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - case frmControlObj: { - const Char *textP = CtlGetLabel((ControlType *)objP); - ControlStyleType style = CtlGlueGetControlStyle((ControlType *)objP); - FontID font = CtlGlueGetFont((ControlType *)objP); - ControlType *newP = CtlNewControl(dstP, id, style, textP, x, y, w, h, font, 0, true); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - switch (style) { - case sliderCtl: - { - UInt16 min, max, page, val; - CtlGetSliderValues((ControlType *)objP, &min, &max, &page, &val); - CtlSetSliderValues(newP, &min, &max, &page, &val); - break; - } - } - break; - } - case frmLabelObj: { - const Char *textP = FrmGetLabel(srcP, id); - FontID font = FrmGlueGetLabelFont(srcP, id); - FrmNewLabel((FormType **)dstP, id, textP, x, y, font); - FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); - break; - } - - case frmBitmapObj: { -/* UInt16 family = id + 1; - FrmNewBitmap((FormType **)dstP, id, id, x, y); - //FrmHideObject((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id)); -*/ break; - } - } - } - - frmP = (FormType **)dstP; // save new form ptr - return errNone; -} - -void TabSetActive(FormType *frmP, TabType *tabP, UInt16 num) { - UInt16 cnt, idx; - RectangleType r; - TabDataPtr dataP; - - if (tabP->active == num) - return; - - dataP = &tabP->tabs[tabP->active]; - - // hide active tab objects - if (tabP->active != tabP->count) { - for (cnt = dataP->first; cnt <= dataP->last; cnt++) { - if ((idx = FrmGetObjectIndex(frmP, cnt)) != frmInvalidObjectId) - FrmHideObject(frmP, idx); - } - } - - // save active tab - tabP->active = num; - dataP = &tabP->tabs[num]; - - // draw tab limit - WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill)); - WinDrawLine(1, 14, 154,14); - WinDrawLine(1, 15, 154,15); - RctSetRectangle(&r, 1, 30, 154, 100); - WinDrawRectangle(&r, 0); - WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); - WinDrawLine(1, 28, 154,28); - - // set tabs size - for (cnt = 0; cnt < tabP->count; cnt++) { - idx = FrmGetObjectIndex (frmP, (FrmGetFormId(frmP) + cnt + 1)); - - if (idx != frmInvalidObjectId) { - FrmGetObjectBounds(frmP, idx, &r); - r.topLeft.y = (num == cnt) ? 17 : 17; - r.extent.y = (num == cnt) ? 12 : 11; - FrmSetObjectBounds(frmP, idx, &r); - - if (num == cnt) { - RGBColorType yellow = {0,255,192,0}; - - UInt8 line = /*(UIColorGetTableEntryIndex(UIFormFill) == UIColorGetTableEntryIndex(UIFieldTextHighlightBackground)) ? - WinRGBToIndex(&yellow) :*/ - UIColorGetTableEntryIndex(UIFieldTextHighlightBackground); - - r.topLeft.y -= 1; - WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame)); - WinDrawRectangleFrame(simpleFrame, &r); - WinSetForeColor(line); - WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y); - FrmShowObject(frmP, idx); - - } else { - UInt8 frame = UIColorGetTableEntryIndex(UIObjectFrame); - RGBColorType light; - WinIndexToRGB(frame, &light); - light.r = (255 - light.r) > 72 ? light.r + 72 : 255; - light.g = (255 - light.g) > 72 ? light.g + 72 : 255; - light.b = (255 - light.b) > 72 ? light.b + 72 : 255; - - WinSetForeColor(WinRGBToIndex(&light)); - WinDrawRectangleFrame(simpleFrame, &r); - WinSetForeColor(frame); - WinDrawLine(r.topLeft.x - 1, r.topLeft.y + r.extent.y, r.topLeft.x + r.extent.x, r.topLeft.y + r.extent.y); - } - - // round corner - WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill)); - if (OPTIONS_TST(kOptModeHiDensity)) { - WinSetCoordinateSystem(kCoordinatesNative); - WinDrawPixel((r.topLeft.x - 1) * 2, (r.topLeft.y - 1) * 2); - WinDrawPixel((r.topLeft.x + r.extent.x) * 2 + 1, (r.topLeft.y - 1) * 2); - WinSetCoordinateSystem(kCoordinatesStandard); - - } else { - // TODO - } - } - } - - // show objects - for (cnt = dataP->first; cnt <= dataP->last; cnt++) { - if ((idx = FrmGetObjectIndex(frmP, cnt)) != frmInvalidObjectId) - FrmShowObject(frmP, idx); - } - - // post draw function - if (dataP->drawFunc) - (dataP->drawFunc)(); -} diff --git a/backends/platform/PalmOS/Src/launcher/forms/formtabs.h b/backends/platform/PalmOS/Src/launcher/forms/formtabs.h deleted file mode 100644 index f14c2ff4e4..0000000000 --- a/backends/platform/PalmOS/Src/launcher/forms/formtabs.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __FORMTABS_H__ -#define __FORMTABS_H__ - -typedef void (TabProc)(); - -typedef struct { - FormPtr srcP; - UInt16 first; - UInt16 last; - TabProc *drawFunc; -} TabDataType, *TabDataPtr; - -typedef struct { - UInt16 count, active; - Coord width; - TabDataPtr tabs; -} TabType, *TabPtr; - -TabType *TabNewTabs (UInt16 cnt); -void TabDeleteTabs (TabType *tabP); -Err TabAddContent (FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc = 0); -void TabSetActive (FormType *frmP, TabType *tabP, UInt16 num); -void TabMoveUpObject (FormType *frmP, UInt16 objID, Coord amount); -#endif diff --git a/backends/platform/PalmOS/Src/launcher/games.cpp b/backends/platform/PalmOS/Src/launcher/games.cpp deleted file mode 100644 index c3f7ef3e4a..0000000000 --- a/backends/platform/PalmOS/Src/launcher/games.cpp +++ /dev/null @@ -1,548 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include - -#include "globals.h" -#include "palmdefs.h" -#include "start.h" -#include "games.h" -#include "skin.h" - -#include "StarterRsc.h" - -DmOpenRef gameDB = NULL; - -static Err GamUpdateList() { - if (gameDB) { - UInt16 numRecs = DmNumRecords(gameDB); - - if (numRecs > 0) { - MemHandle tmpH; - UInt32 version, size; - UInt32 *versionP; - - // get record size and version - tmpH = DmQueryRecord(gameDB, 0); - size = MemHandleSize(tmpH); - versionP = (UInt32 *)MemHandleLock(tmpH); - version = *versionP; - MemHandleUnlock(tmpH); - - // check record - if (version != curItemVersion || size != sizeof(GameInfoType)) { - UInt16 index; - GameInfoType gitCur; - void *tmpP; - FormPtr ofmP, frmP; - - // show dialog - ofmP = FrmGetActiveForm(); - frmP = FrmInitForm(ConvertForm); - FrmSetActiveForm(frmP); - FrmDrawForm(frmP); - SysTaskDelay(1 * SysTicksPerSecond()); - - MemSet(&gitCur, sizeof(GameInfoType), 0); - - if (version == itemVersion_357 || - version == itemVersion_356 || - version == itemVersion_355 || - version == itemVersion_354 || - version == itemVersion_353 || - version == itemVersion_352 || - version == itemVersion_351 || - version == itemVersion_350 || - version == itemVersion_340 || - version == itemVersion_330 || - version == itemVersion_320 || - version == itemVersion_310 || - version == itemVersion_300 || - version == itemVersion_270 || - version == itemVersion_260 || - version == itemVersion_250) { - for (index = 0; index < numRecs; index++) { - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&gitCur, tmpP, MemHandleSize(tmpH)); - MemHandleUnlock(tmpH); - - // new format - gitCur.version = curItemVersion; - - if (version < itemVersion_300) { - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - } - - if (version < itemVersion_310) - gitCur.engine = 0; - - if (version < itemVersion_320) - gitCur.renderMode = 0; - - if (version <= itemVersion_330) { - gitCur.fmQuality = 0; - gitCur.gfxMode = (gitCur.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - if (gitCur.engine == 0) gitCur.engine = 8; - else if (gitCur.engine == 1) gitCur.engine = 7; - else if (gitCur.engine == 2) gitCur.engine = 3; - else if (gitCur.engine == 3) gitCur.engine = 1; - else if (gitCur.engine == 4) gitCur.engine = 0; - else if (gitCur.engine == 5) gitCur.engine = 6; - else if (gitCur.engine == 6) gitCur.engine = 4; - else if (gitCur.engine == 7) gitCur.engine = 5; - else if (gitCur.engine == 8) gitCur.engine = 2; - - if (gitCur.renderMode == 1) gitCur.renderMode = 4; - else if (gitCur.renderMode == 2) gitCur.renderMode = 5; - else if (gitCur.renderMode == 3) gitCur.renderMode = 2; - else if (gitCur.renderMode == 4) gitCur.renderMode = 3; - else if (gitCur.renderMode == 5) gitCur.renderMode = 1; - - if (gitCur.platform == 2) gitCur.platform = 6; - else if (gitCur.platform == 5) gitCur.platform = 8; - else if (gitCur.platform == 6) gitCur.platform = 2; - - if (gitCur.language == 1) gitCur.language = 4; - else if (gitCur.language == 2) gitCur.language = 6; - else if (gitCur.language == 3) gitCur.language = 5; - else if (gitCur.language == 4) gitCur.language = 8; - else if (gitCur.language == 5) gitCur.language = 11; - else if (gitCur.language == 6) gitCur.language = 13; - else if (gitCur.language == 7) gitCur.language = 9; - else if (gitCur.language == 8) gitCur.language = 1; - else if (gitCur.language == 9) gitCur.language = 10; - else if (gitCur.language == 10) gitCur.language = 7; - else if (gitCur.language == 11) gitCur.language = 12; - else if (gitCur.language == 12) gitCur.language = 2; - else if (gitCur.language == 13) gitCur.language = 3; - - if (gitCur.musicInfo.sound.drvMusic == 1) gitCur.musicInfo.sound.drvMusic = 4; - else if (gitCur.musicInfo.sound.drvMusic == 2) gitCur.musicInfo.sound.drvMusic = 5; - else if (gitCur.musicInfo.sound.drvMusic == 4) gitCur.musicInfo.sound.drvMusic = 2; - else if (gitCur.musicInfo.sound.drvMusic == 5) gitCur.musicInfo.sound.drvMusic = 1; - } - - if (version <= itemVersion_340) { - gitCur.platform++; - - if (gitCur.language == 3) - gitCur.language = 0; - else if (gitCur.language >= 11) - gitCur.language++; - } - - if (version <= itemVersion_350) - if (gitCur.platform >= 9) - gitCur.platform++; - - if (version <= itemVersion_351) { - if (gitCur.engine >= ENGINE_LURE) // newly added engine - gitCur.engine++; - - if (gitCur.engine == ENGINE_SCUMM) // reorder - gitCur.engine = ENGINE_AGOS; - else if (gitCur.engine == ENGINE_AGOS) - gitCur.engine = ENGINE_SCUMM; - } - - if (version <= itemVersion_352) { - if (gitCur.engine >= ENGINE_CINE) // newly added engine - gitCur.engine++; - - gitCur.platform++; - } - - if (version <= itemVersion_353) - gitCur.musicInfo.sound.drvMusic++; - - if (version <= itemVersion_354) - if (gitCur.engine >= ENGINE_AGI) // newly added engine - gitCur.engine++; - - if (version <= itemVersion_355) { - gitCur.engine++; // renamed Simon -> AGOS - if (gitCur.engine == ENGINE_COUNT) - gitCur.engine = ENGINE_AGOS; - } - - if (version <= itemVersion_356) { - if (gitCur.platform >= 3) - gitCur.platform++; - } - - if (version <= itemVersion_357) - if (gitCur.engine >= ENGINE_PARALLACTION) // newly added engine - gitCur.engine++; - - if (gitCur.musicInfo.volume.palm > 100) - gitCur.musicInfo.volume.palm = 50; - - // simply resize the old record - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - - } else if (version == itemVersion_200) { - // need conversion from V2 -> V3.5.2 - GameInfoTypeV2 git0; - - for (index = 0; index < numRecs; index++) { - - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&git0, tmpP, sizeof(GameInfoTypeV2)); - MemHandleUnlock(tmpH); - - // convert to new format - gitCur.version = curItemVersion; - gitCur.icnID = 0xFFFF; - gitCur.selected = git0.selected; - StrCopy(gitCur.nameP, git0.nameP); - StrCopy(gitCur.pathP, git0.pathP); - StrCopy(gitCur.gameP, git0.gameP); - gitCur.gfxMode = (git0.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - gitCur.autoLoad = git0.autoLoad; - gitCur.bootParam = git0.bootParam; - gitCur.setPlatform = git0.setPlatform; - gitCur.subtitles = git0.subtitles; - gitCur.talkSpeed = git0.talkSpeed; - - gitCur.loadSlot = git0.loadSlot; - gitCur.bootValue = git0.bootValue; - gitCur.talkValue = git0.talkValue; - gitCur.platform = git0.platform; - gitCur.language = git0.language; - - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - - // to V3.4 - if (gitCur.platform == 2) gitCur.platform = 6; - else if (gitCur.platform == 5) gitCur.platform = 8; - else if (gitCur.platform == 6) gitCur.platform = 2; - - if (gitCur.language == 1) gitCur.language = 4; - else if (gitCur.language == 2) gitCur.language = 6; - else if (gitCur.language == 3) gitCur.language = 5; - else if (gitCur.language == 4) gitCur.language = 8; - else if (gitCur.language == 5) gitCur.language = 11; - else if (gitCur.language == 6) gitCur.language = 13; - else if (gitCur.language == 7) gitCur.language = 9; - else if (gitCur.language == 8) gitCur.language = 1; - else if (gitCur.language == 9) gitCur.language = 10; - else if (gitCur.language == 10) gitCur.language = 7; - else if (gitCur.language == 11) gitCur.language = 12; - else if (gitCur.language == 12) gitCur.language = 2; - else if (gitCur.language == 13) gitCur.language = 3; - - if (gitCur.musicInfo.sound.drvMusic == 1) gitCur.musicInfo.sound.drvMusic = 4; - else if (gitCur.musicInfo.sound.drvMusic == 2) gitCur.musicInfo.sound.drvMusic = 5; - else if (gitCur.musicInfo.sound.drvMusic == 4) gitCur.musicInfo.sound.drvMusic = 2; - else if (gitCur.musicInfo.sound.drvMusic == 5) gitCur.musicInfo.sound.drvMusic = 1; - - // to V3.5 - gitCur.platform++; - - if (gitCur.language == 3) - gitCur.language = 0; - else if (gitCur.language >= 11) - gitCur.language++; - - // to V3.5.1 - if (gitCur.platform >= 9) - gitCur.platform++; - - //to V3.5.3 - gitCur.musicInfo.sound.drvMusic++; - - // ----- - gitCur.engine = ENGINE_SCUMM; - - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - } else { - // need conversion from V0 -> V3.5.2 - GameInfoTypeV0 git0; - - for (index = 0; index < numRecs; index++) { - - // get old data - tmpH = DmQueryRecord(gameDB, index); - tmpP = MemHandleLock(tmpH); - MemMove(&git0, tmpP, sizeof(GameInfoTypeV0)); - MemHandleUnlock(tmpH); - - // convert to new format - gitCur.version = curItemVersion; - gitCur.icnID = 0xFFFF; - gitCur.selected = git0.selected; - StrCopy(gitCur.nameP, git0.nameP); - StrCopy(gitCur.pathP, git0.pathP); - StrCopy(gitCur.gameP, git0.gameP); - gitCur.gfxMode = (git0.gfxMode == 3 ? 1 : 0); // v3.4 only 2 modes - - gitCur.autoLoad = git0.autoLoad; - gitCur.bootParam = git0.bootParam; - gitCur.setPlatform = git0.amiga; // amiga become platform amiga/atari-st/machintosh - gitCur.platform = 1; - gitCur.subtitles = git0.subtitles; - gitCur.talkSpeed = git0.talkSpeed; - - gitCur.loadSlot = git0.loadSlot; - gitCur.bootValue = git0.bootValue; - gitCur.talkValue = git0.talkValue; - gitCur.platform = 2; // default to amiga - gitCur.language = git0.language; - - gitCur.musicInfo.volume.palm = 50; - gitCur.musicInfo.volume.music = 192; - gitCur.musicInfo.volume.sfx = 192; - gitCur.musicInfo.volume.speech = 192; - gitCur.musicInfo.volume.audiocd = 50; - - gitCur.musicInfo.sound.tempo = 100; - gitCur.musicInfo.sound.defaultTrackLength = 10; - gitCur.musicInfo.sound.firstTrack = 1; - - gitCur.engine = ENGINE_SCUMM; - - tmpH = DmResizeRecord(gameDB, index, sizeof(GameInfoType)); // TODO : check error on resize tmpH==NULL - tmpP = MemHandleLock(tmpH); - DmWrite(tmpP, 0, &gitCur, sizeof(GameInfoType)); - MemPtrUnlock(tmpP); - } - } - - FrmEraseForm(frmP); - FrmDeleteForm(frmP); - if (ofmP) - FrmSetActiveForm(ofmP); - } - } - } - - return errNone; -} - -Err GamOpenDatabase() { - Err err = errNone; - - gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite); - - if (!gameDB) { - err = DmCreateDatabase(0, "ScummVM-Data", appFileCreator, 'DATA', false); - if (!err) { - gameDB = DmOpenDatabaseByTypeCreator( 'DATA', appFileCreator, dmModeReadWrite); - - if (!gameDB) - err = DmGetLastErr(); - } - } - - if (err) - FrmCustomAlert(FrmErrorAlert,"Cannot open/create games list DB !",0,0); - else - err = GamUpdateList(); - - return err; -} - -void GamImportDatabase() { - if (gPrefs->card.volRefNum != vfsInvalidVolRef && gPrefs->card.moveDB) { - FileRef file; - Err e; - - e = VFSFileOpen(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", vfsModeRead, &file); - if (!e) { - UInt16 oCardNo, nCardNo; - LocalID oDbID, nDbID; - - VFSFileClose(file); - if (gPrefs->card.confirmMoveDB) - if (FrmCustomAlert(FrmConfirmAlert, "Do you want to import games database from memory card ?", 0, 0) == FrmConfirmNo) { - // prevent to replace the file on memory card - gPrefs->card.moveDB = false; - return; - } - - // get current db info and rename it - DmOpenDatabaseInfo(gameDB, &oDbID, 0, 0, &oCardNo, 0); - GamCloseDatabase(true); - e = DmDeleteDatabase(oCardNo, oDbID); - - if (!e) - if (e = VFSImportDatabaseFromFile(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", &nCardNo, &nDbID)) - FrmCustomAlert(FrmErrorAlert, "Failed to import games database from memory card.", 0, 0); - - GamOpenDatabase(); - } - } -} - -void GamCloseDatabase(Boolean ignoreCardParams) { - if (gameDB) { - LocalID dbID; - UInt16 cardNo; - - DmOpenDatabaseInfo(gameDB, &dbID, 0, 0, &cardNo, 0); - DmCloseDatabase(gameDB); - - if (!ignoreCardParams) { - if (gPrefs->card.moveDB && gPrefs->card.volRefNum != vfsInvalidVolRef) { - VFSFileRename(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", "listdata-old.pdb"); - Err e = VFSExportDatabaseToFile(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata.pdb", cardNo, dbID); - if (!e) { - VFSFileDelete(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata-old.pdb"); - if (gPrefs->card.deleteDB) - DmDeleteDatabase(cardNo, dbID); - } else { - VFSFileRename(gPrefs->card.volRefNum, "/Palm/Programs/ScummVM/listdata-old.pdb", "listdata.pdb"); - } - } - } - } - gameDB = NULL; -} - -static Int16 GamCompare(GameInfoType *a, GameInfoType *b, SortRecordInfoPtr, SortRecordInfoPtr, MemHandle) { - return StrCaselessCompare(a->nameP, b->nameP); -} - -Err GamSortList() { - return DmQuickSort (gameDB, (DmComparF *)GamCompare, 0); -} - -void GamUnselect() { - GameInfoType *game; - - MemHandle recordH; - UInt16 index; - - index = GamGetSelected(); - - if (index != dmMaxRecordIndex) { - Boolean newValue; - - recordH = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(recordH); - - newValue = false; - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - MemHandleUnlock(recordH); - DmReleaseRecord (gameDB, index, 0); - } -} - -UInt16 GamGetSelected() { - MemHandle record; - GameInfoType *game; - Boolean selected; - UInt16 index = DmNumRecords(gameDB)-1; - - while (index != (UInt16)-1) { - record = DmQueryRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - selected = game->selected; - MemHandleUnlock(record); - - if (selected) - return index; - - index--; - } - - return dmMaxRecordIndex; -} - -Boolean GamJumpTo(Char letter) { - MemHandle record; - GameInfoType *game; - Boolean found = false; - UInt16 index = 0; - UInt16 maxIndex = DmNumRecords(gameDB); - UInt16 active = GamGetSelected(); - - while (index < maxIndex) { - record = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - if (tolower(game->nameP[0]) == tolower(letter)) { - found = true; - - if (index != active) { - RectangleType rArea; - UInt16 maxView; - Boolean newValue = true; - - SknGetListBounds(&rArea, NULL); - maxView = rArea.extent.y / sknInfoListItemSize; - - GamUnselect(); - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView)) - gPrefs->listPosition = index; - } - } - - MemHandleUnlock(record); - DmReleaseRecord (gameDB, index, 0); - - index++; - - if (found) - return found; - } - - return found; -} diff --git a/backends/platform/PalmOS/Src/launcher/games.h b/backends/platform/PalmOS/Src/launcher/games.h deleted file mode 100644 index 7c381a40f4..0000000000 --- a/backends/platform/PalmOS/Src/launcher/games.h +++ /dev/null @@ -1,212 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __GAMES_H__ -#define __GAMES_H__ - -#define curItemVersion sysMakeROMVersion(3,5,8,0,0) // Parallaction engine - - -#define itemVersion_357 sysMakeROMVersion(3,5,7,0,0) // Added : Apple IIgs -#define itemVersion_356 sysMakeROMVersion(3,5,6,0,0) // Changed : Simon -> AGOS -#define itemVersion_355 sysMakeROMVersion(3,5,5,0,0) // Added : AGI engine -#define itemVersion_354 sysMakeROMVersion(3,5,4,0,0) // Added : Default/Auto music driver -#define itemVersion_353 sysMakeROMVersion(3,5,3,0,0) // Added : CinE engine and 3DO platform -#define itemVersion_352 sysMakeROMVersion(3,5,2,0,0) // Added : Lure engine -#define itemVersion_351 sysMakeROMVersion(3,5,1,0,0) // Added : Sega CD platform -#define itemVersion_350 sysMakeROMVersion(3,5,0,0,0) -#define itemVersion_340 sysMakeROMVersion(3,4,0,0,0) -#define itemVersion_330 sysMakeROMVersion(3,3,0,0,0) -#define itemVersion_320 sysMakeROMVersion(3,2,0,0,0) -#define itemVersion_310 sysMakeROMVersion(3,1,0,0,0) -#define itemVersion_300 sysMakeROMVersion(3,0,0,0,0) -#define itemVersion_270 sysMakeROMVersion(2,7,0,0,0) -#define itemVersion_260 sysMakeROMVersion(2,6,0,0,0) -#define itemVersion_250 sysMakeROMVersion(2,5,0,0,0) -#define itemVersion_200 sysMakeROMVersion(2,0,0,0,0) - -// old config structs -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[10]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - UInt16 loadSlot; - Boolean bootParam; - UInt16 bootValue; - Boolean amiga; - Boolean subtitles; - Boolean talkSpeed; - UInt16 talkValue; - UInt8 language; - -} GameInfoTypeV0; - -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[10]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - Boolean bootParam; - Boolean setPlatform; - Boolean subtitles; - Boolean talkSpeed; - - UInt16 loadSlot; - UInt16 bootValue; - UInt16 talkValue; - UInt8 platform; - UInt8 language; - -} GameInfoTypeV2; - - -// Current config -typedef struct { - struct { - UInt16 palm; - UInt16 music; - UInt16 sfx; // TODO : remove - UInt16 speech; - UInt16 audiocd; - } volume; - - struct { - // midi - Boolean multiMidi; - Boolean music; // TODO : rename this, it is enable audio option - UInt8 drvMusic; - UInt8 tempo; - // sound FX - Boolean sfx; // TODO : remove this - UInt8 rate; - // CD audio - Boolean CD; - UInt8 drvCD, frtCD; - UInt16 defaultTrackLength; - UInt16 firstTrack; - } sound; -} MusicInfoType; - -typedef struct { - UInt32 version; - UInt16 icnID; // icon to display on the list - Boolean selected; - - Char nameP[50]; // game name to display in list - Char pathP[150]; // path to the game files - Char gameP[15]; // scumm name of the game - UInt16 gfxMode; - - Boolean autoLoad; - Boolean bootParam; - Boolean setPlatform; - Boolean subtitles; - Boolean talkSpeed; - - UInt16 loadSlot; - UInt16 bootValue; - UInt16 talkValue; - UInt8 platform; - UInt8 language; // |- v2.5 - - Boolean filter; // v2.6 - Boolean fullscreen; // | - Boolean aspectRatio; // |- v2.7 - - MusicInfoType musicInfo;// v3.0 - - UInt8 engine; // |- v3.1 - UInt8 renderMode; // |- v3.2 -// Boolean use16Bit; // |- v3.3 // removed - UInt8 fmQuality; // |- v3.4 // replace use16Bit -} GameInfoType; - -enum { - ENGINE_AGOS = 0, - ENGINE_SKY, - ENGINE_SWORD1, - ENGINE_SWORD2, - ENGINE_CINE, - ENGINE_QUEEN, - ENGINE_LURE, - ENGINE_GOB, - ENGINE_KYRA, - ENGINE_PARALLACTION, - ENGINE_SAGA, - ENGINE_SCUMM, - ENGINE_AGI, - ENGINE_TOUCHE, - ENGINE_CRUISE, - ENGINE_DRASCULA, - ENGINE_COUNT -}; - -static const struct { - const char *fileP; - const char *nameP; -} engines[] = { - { "agos", "AGOS Engine" }, - { "sky", "Beneath a Steel Sky" }, - { "sword1", "Broken Sword I" }, - { "sword2", "Broken Sword II" }, - { "cine", "Delphine Cinematique v1.0" }, - { "queen", "Flight of the Amazon Queen" }, - { "lure", "Lure of the Tempress" }, - { "gob", "Gobliiins, Bargon Attack and more" }, - { "kyra", "Kyrandia" }, - { "parallaction", "Parallaction" }, - { "saga", "SAGA Engine" }, - { "scumm", "Scumm Games" }, - { "agi", "Sierra AGI" }, - { "touche", "Touche: The Adventures of the Fifth Musketeer" }, - { "cruise", "Beta -> Cruise for a Corpse" }, - { "drascula", "Beta -> Drascula" }, -}; - -// protos -Err GamOpenDatabase (); -void GamImportDatabase (); -void GamCloseDatabase (Boolean ignoreCardParams); -Err GamSortList (); -UInt16 GamGetSelected (); -void GamUnselect (); -Boolean GamJumpTo (Char letter); - -extern DmOpenRef gameDB; - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/launch.cpp b/backends/platform/PalmOS/Src/launcher/launch.cpp deleted file mode 100644 index d83a34e94c..0000000000 --- a/backends/platform/PalmOS/Src/launcher/launch.cpp +++ /dev/null @@ -1,512 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include "StarterRsc.h" - -#include "games.h" -#include "start.h" -#include "rumble.h" -#include "globals.h" -#include "features.h" -#include "formUtil.h" -#include "formCards.h" -#include "palmdefs.h" - -#include "init_palmos.h" -#include "init_stuffs.h" - -#include "modules.h" -#include "args.h" - - -#define BUILD_ERROR(m) \ - { StrCopy(msg, m); \ - StrCat(msg, "\n\nPlease check that all required files are installed on your card, and you have enough free storage memory."); \ - goto onError; } - -#define BUILD_FILE(h,m) \ - StrCopy(filename, "/Palm/Programs/ScummVM/Mods/"); \ - StrCat(filename, h); \ - StrCat(filename, m); - -#define FIND_FILE() \ - if (*volRefNum == vfsInvalidVolRef) \ - *volRefNum = ModFind(filename); - - -#define CHECK_FILE(m) \ - e = VFSFileOpen(*volRefNum, filename, vfsModeRead, &file); \ - if (e) \ - BUILD_ERROR(m) \ - else \ - VFSFileClose(file); - -#define IMPRT_FILE(m) \ - e = VFSImportDatabaseFromFile(*volRefNum, filename, &cardNo, &dbID); \ - if (e) \ - BUILD_ERROR(m) - -#define DELET_FILE(f) \ - del_dbID = DmFindDatabase(0, f); \ - if (del_dbID) \ - DmDeleteDatabase(0, del_dbID); - -void ModDelete() { - LocalID del_dbID; - - DELET_FILE("Glbs::Common"); - DELET_FILE("Glbs::Engine"); - DELET_FILE("ScummVM-Engine"); -} - -UInt16 ModFind(const Char *f) { - Err e; - UInt16 volRefNum; - FileRef r; - UInt32 volIterator = vfsIteratorStart|vfsIncludePrivateVolumes; - while (volIterator != vfsIteratorStop) { - e = VFSVolumeEnumerate(&volRefNum, &volIterator); - - if (!e) e = VFSFileOpen(volRefNum, f, vfsModeRead, &r); - if (!e) e = VFSFileClose(r); - if (!e) break; - } - - return volRefNum; -} - -static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) { - DmOpenRef dbRef = DmOpenDatabase(cardNo, dbID, dmModeReadWrite); - - if (dbRef) { - MemHandle pref = DmGetResource('pref',0); - UInt32 size = 0; - - if (pref) { - SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref); - size = data->stackSize; - - if (newSize) { - SysAppPrefsType newData; - MemMove(&newData, data, sizeof(SysAppPrefsType)); - newData.stackSize = newSize; - DmWrite(data, 0, &newData, sizeof(SysAppPrefsType)); - } - - MemPtrUnlock(data); - DmReleaseResource(pref); - } - - DmCloseDatabase(dbRef); - } -} - -static Err ModImport(UInt16 *volRefNum, UInt8 engine, Boolean *armP) { -#ifndef _DEBUG_ENGINE - char filename[256]; - UInt16 cardNo; - LocalID dbID; - UInt32 result; - FileRef file; -#endif - char msg[256]; - FormPtr ofmP, frmP; - Err e = errNone; - - ofmP = FrmGetActiveForm(); - frmP = FrmInitForm(ImportForm); - FrmSetActiveForm(frmP); - FrmDrawForm(frmP); - - // In debug mode, the engine files are directly uploaded to the simulator -#ifndef _DEBUG_ENGINE - // engine file ? - BUILD_FILE(engines[engine].fileP, ".engine"); - FIND_FILE (); - CHECK_FILE("ScummVM engine file was not found !"); - IMPRT_FILE("Cannot import engine file !"); - - // need more files ? - dbID = DmFindDatabase(0, "ScummVM-Engine"); // be sure to have the correct dbID - e = SysAppLaunch(cardNo, dbID, 0, sysAppLaunchCustomEngineGetInfo, 0, &result); - *armP = ((result & GET_MODEARM) == GET_MODEARM); - -/* ARM ONLY FOR NOW, NOT REQUIRED - // common file ? - if (!e && (result & GET_DATACOMMON)) { - BUILD_FILE("common", ".data"); - CHECK_FILE("Common data file was not found !"); - IMPRT_FILE("Cannot import common data file !"); - } - // data file ? - if (!e && (result & GET_DATAENGINE)) { - BUILD_FILE(engines[engine].fileP, ".data"); - CHECK_FILE("Engine data file was not found !"); - IMPRT_FILE("Cannot import engine data file !"); - } -*/ -#endif - // if error, cleanup - if (e) ModDelete(); - -onError: - FrmEraseForm(frmP); - FrmDeleteForm(frmP); - if (e) { - if (ofmP) FrmSetActiveForm(ofmP); - FrmCustomAlert(FrmErrorAlert, msg, 0, 0); - } - - return e; -} - -#undef DELET_FILE -#undef CHECK_FILE -#undef BUILD_FILE - -Boolean StartScummVM(Int16 engine) { - Char **argvP; - UInt8 lightspeed, argc = 0; - UInt32 stackSize; - Boolean toLauncher, direct, isARM; - Char num[6]; - - argvP = ArgsInit(); - direct = false; - - // start command line (exec name) - ArgsAdd(&argvP[argc], "-", NULL, &argc); - // standard path - ArgsAdd(&argvP[argc], "--themepath=", "/PALM/Programs/ScummVM/Themes", &argc); - - UInt16 index = GamGetSelected(); - // no game selected - if (index == dmMaxRecordIndex) { - if (engine == NO_ENGINE) { - // free args - ArgsFree(argvP); - return false; - } - - // default values - if (bDirectMode) - gPrefs->card.volRefNum = parseCards(); // always use the first removable card available (?) - - gVars->filter = true; - gVars->palmVolume = 50; - gVars->fmQuality = FM_QUALITY_INI; - direct = true; - - // somthing selected - } else { - Char pathP[256]; - MemHandle recordH; - GameInfoType *gameInfoP; - - recordH = DmQueryRecord(gameDB,index); - gameInfoP = (GameInfoType *)MemHandleLock(recordH); - engine = gameInfoP->engine; - - // build path - StrCopy(pathP,"/Palm/Programs/ScummVM/Games/"); - if (gameInfoP->pathP[0] == '/') - StrCopy(pathP, gameInfoP->pathP); - else if (!(gameInfoP->pathP[0] == '.' && StrLen(gameInfoP->pathP) == 1)) - StrCat(pathP, gameInfoP->pathP); - - // path - ArgsAdd(&argvP[argc], "-p", pathP, &argc); - - // language - if (gameInfoP->language > 0) { - const Char *lang = "zh\0cz\0gb\0en\0fr\0de\0hb\0it\0jp\0kr\0pl\0pt\0ru\0es\0se\0"; - ArgsAdd(&argvP[argc], "-q", (lang + (gameInfoP->language - 1) * 3), &argc); - } - - // fullscreen ? - if (gameInfoP->fullscreen) - ArgsAdd(&argvP[argc], "-f", NULL, &argc); - - // aspect-ratio ? - ArgsAdd(&argvP[argc], (gameInfoP->aspectRatio ? "--aspect-ratio" : "--no-aspect-ratio"), NULL, &argc); - - // gfx mode - gVars->filter = gameInfoP->filter; - - switch (gameInfoP->renderMode) { - case 1: - ArgsAdd(&argvP[argc], "--render-mode=", "amiga", &argc); - break; - case 2: - ArgsAdd(&argvP[argc], "--render-mode=", "cga", &argc); - break; - case 3: - ArgsAdd(&argvP[argc], "--render-mode=", "ega", &argc); - break; - case 4: - ArgsAdd(&argvP[argc], "--render-mode=", "hercAmber", &argc); - break; - case 5: - ArgsAdd(&argvP[argc], "--render-mode=", "hercGreen", &argc); - break; - } - - switch (gameInfoP->gfxMode) { - case 1: - ArgsAdd(&argvP[argc], "-g", "wide", &argc); - break; - default: - ArgsAdd(&argvP[argc], "-g", "1x", &argc); - break; - } - - // load state - if (gameInfoP->autoLoad) { - StrIToA(num, gameInfoP->loadSlot); - ArgsAdd(&argvP[argc], "-x", num, &argc); - } - // boot script parameter - if (gameInfoP->bootParam) { - StrIToA(num, gameInfoP->bootValue); - ArgsAdd(&argvP[argc], "-b", num, &argc); - } - // not a PC version - if (gameInfoP->setPlatform) { - static const char *platform[] = { - "3do", - "acorn", - "amiga", - "2gs", - "atari", - "c64", - "pc", - "fmtowns", - "linux", - "mac", - "nes", - "segacd", - "windows" - }; - ArgsAdd(&argvP[argc], "--platform=", platform[gameInfoP->platform], &argc); - } - - // subtitles - if (gameInfoP->subtitles) - ArgsAdd(&argvP[argc], "-n", NULL, &argc); - - // multi midi ? - if (gameInfoP->musicInfo.sound.multiMidi) - ArgsAdd(&argvP[argc], "--multi-midi", NULL, &argc); - - if (engine == ENGINE_SCUMM) { - // music tempo - StrIToA(num, gameInfoP->musicInfo.sound.tempo); - ArgsAdd(&argvP[argc], "--tempo=", num, &argc); - } - - // talk speed - if (gameInfoP->talkSpeed) { - StrIToA(num, gameInfoP->talkValue); - ArgsAdd(&argvP[argc], "--talkspeed=", num, &argc); - } - - // music driver - if (gameInfoP->musicInfo.sound.music) { - static char *drv[] = { - "auto", - "null", - "adlib", - "towns", - "pcjr", - "native", - "pcspk" - }; - - if (StrCompare(drv[gameInfoP->musicInfo.sound.drvMusic], "native") == 0) { - if (OPTIONS_TST(kOptDeviceZodiac)) - ArgsAdd(&argvP[argc], "-e", "zodiac", &argc); // Tapwave Zodiac - else if (OPTIONS_TST(kOptSonyPa1LibAPI)) - ArgsAdd(&argvP[argc], "-e", "ypa1", &argc); // Pa1Lib devices - else - ArgsAdd(&argvP[argc], "-e", "auto", &argc); // no driver, switch to auto - } else { - ArgsAdd(&argvP[argc], "-e", drv[gameInfoP->musicInfo.sound.drvMusic], &argc); - } - - // output rate - UInt32 rates[] = {4000, 8000, 11025, 22050, 44100}; - StrIToA(num, rates[gameInfoP->musicInfo.sound.rate]); - ArgsAdd(&argvP[argc], "--output-rate=", num, &argc); - - // FM quality - gVars->fmQuality = gameInfoP->fmQuality; - - } else { - ArgsAdd(&argvP[argc], "-e", "null", &argc); - } - - // volume control - StrIToA(num, gameInfoP->musicInfo.volume.sfx); - ArgsAdd(&argvP[argc], "-s", num, &argc); - StrIToA(num, gameInfoP->musicInfo.volume.music); - ArgsAdd(&argvP[argc], "-m", num, &argc); - StrIToA(num, gameInfoP->musicInfo.volume.speech); - ArgsAdd(&argvP[argc], "-r", num, &argc); - - // game name - ArgsAdd(&argvP[argc], gameInfoP->gameP, NULL, &argc); - - gVars->palmVolume = gameInfoP->musicInfo.sound.music ? gameInfoP->musicInfo.volume.palm : 0; - - MemHandleUnlock(recordH); - } // end no game / game selected - - // common command line options - - // debug level - if (gPrefs->debug) { - StrIToA(num, gPrefs->debugLevel); - ArgsAdd(&argvP[argc], "-d", num, &argc); - } - - if (engine == ENGINE_QUEEN || engine == ENGINE_SKY) { - // alternative intro ? - if (gPrefs->altIntro) - ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc); - } - - if (engine == ENGINE_SCUMM) { - // demo mode ? - if (gPrefs->demoMode) - ArgsAdd(&argvP[argc], "--demo-mode", NULL, &argc); - } - - // copy protection ? - if (gPrefs->copyProtection) - ArgsAdd(&argvP[argc], "--copy-protection", NULL, &argc); - - // exceed max args ? - if (argc > MAX_ARG) - FrmCustomAlert(FrmErrorAlert, "Too many parameters.",0,0); - - // set some common options - stackSize = (gPrefs->setStack ? STACK_LARGER : STACK_DEFAULT); - lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255); - toLauncher= (gPrefs->exitLauncher); - - // gVars values - // (gVars->HRrefNum defined in checkHRmode on Clie) -#ifndef _DEBUG_ENGINE - gVars->VFS.volRefNum = (gPrefs->card.autoDetect ? vfsInvalidVolRef : gPrefs->card.volRefNum); -#else - gVars->VFS.volRefNum = gPrefs->card.volRefNum; -#endif - gVars->vibrator = gPrefs->vibrator; - gVars->stdPalette = gPrefs->stdPalette; - gVars->VFS.cacheSize = (gPrefs->card.useCache ? gPrefs->card.cacheSize : 0); - gVars->indicator.showLED= gPrefs->card.showLED; - gVars->stylusClick = gPrefs->stylusClick; - gVars->autoSave = (gPrefs->autoSave ? gPrefs->autoSavePeriod : -1); - gVars->advancedMode = gPrefs->advancedMode; - gVars->arrowKeys = gPrefs->arrowKeys; - - // user params - HWR_RSTALL(); - - if (gPrefs->goLCD) - HWR_SET(INIT_GOLCD); - else - OPTIONS_RST(kOptGoLcdAPI); - - if (!gPrefs->autoOff) - HWR_SET(INIT_AUTOOFF); - - if (gVars->vibrator) - HWR_SET(INIT_VIBRATOR); -/* ???? - if ( musicDriver == 1 || - musicDriver == 3 || - musicDriver == 4 || - musicDriver == sysInvalidRefNum) { - HWR_SET(INIT_PA1LIB); - } -*/ - if (ModImport(&gVars->VFS.volRefNum, engine, &isARM) != errNone) { - if (bDirectMode) { - // and force exit if nothing selected - EventType event; - event.eType = keyDownEvent; - event.data.keyDown.chr = vchrLaunch; - event.data.keyDown.modifiers = commandKeyMask; - EvtAddUniqueEventToQueue(&event, 0, true); - } - ArgsFree(argvP); - return false; - } - - // reset mode if screen rotation occurred (DIA only) - if (!direct && OPTIONS_TST(kOptCollapsible)) { - UInt8 mode = PalmScreenSize(0,0, &(gVars->screenFullWidth), &(gVars->screenFullHeight)); - OPTIONS_RST(kOptModeLandscape); - OPTIONS_SET((mode == PALM_LANDSCAPE) ? kOptModeLandscape : kOptNone); - } - - // free and save globals pref memory - GamCloseDatabase(false); - FrmCloseAllForms(); - SavePrefs(); - - { - UInt16 cardNo; - UInt32 dbID; - - LaunchParamType *cmdPBP = (LaunchParamType *)MemPtrNew(sizeof(LaunchParamType)); - - MemPtrSetOwner(cmdPBP, 0); - MemPtrSetOwner(gVars, 0); - ArgsSetOwner(argvP, 0); - - cardNo = 0; - dbID = DmFindDatabase(0, "ScummVM-Engine"); - - if (isARM) - FtrSet(appFileCreator, ftrStack , (stackSize * 4)); - else - ModSetStack(stackSize, cardNo, dbID); - - cmdPBP->args.argc = argc; - cmdPBP->args.argv = argvP; - cmdPBP->gVars = gVars; - cmdPBP->lightspeed = lightspeed; - cmdPBP->exitLauncher = toLauncher; - - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch, cmdPBP); - bLaunched = true; - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/launcher/skin.cpp b/backends/platform/PalmOS/Src/launcher/skin.cpp deleted file mode 100644 index 4c3f722aa1..0000000000 --- a/backends/platform/PalmOS/Src/launcher/skin.cpp +++ /dev/null @@ -1,612 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include -#include - -#include "start.h" -#include "games.h" -#include "globals.h" -#include "skin.h" -#include "StarterRsc.h" - -UInt16 lastIndex = dmMaxRecordIndex; // last select index in the list to prevent flash -static WinHandle winLockH = NULL; - -MemPtr SknScreenLock(WinLockInitType initMode) { - Err e; - RectangleType r; - - WinGetBounds(WinGetDisplayWindow(), &r); - winLockH = WinCreateOffscreenWindow(r.extent.x, r.extent.y, nativeFormat, &e); - WinSetDrawWindow(winLockH); - - if (initMode == winLockCopy) - WinCopyRectangle(WinGetDisplayWindow(), winLockH, &r, 0, 0, winPaint); - - return BmpGetBits(WinGetBitmap(winLockH)); -} - -void SknScreenUnlock() { - RectangleType r; - - WinGetBounds(winLockH, &r); - WinCopyRectangle(winLockH, WinGetDisplayWindow(), &r, 0, 0, winPaint); - WinSetDrawWindow(WinGetDisplayWindow()); - WinDeleteWindow(winLockH, false); - winLockH = NULL; -} - -static void SknGetListColors(DmOpenRef skinDBP, UInt8 *text, UInt8 *selected, UInt8 *background) { - UInt16 colIndex; - MemHandle colH; - UInt8 *colTemp; - - // default - *text = UIColorGetTableEntryIndex (UIMenuForeground); - *selected = UIColorGetTableEntryIndex (UIMenuSelectedForeground); - *background = UIColorGetTableEntryIndex (UIMenuSelectedFill); - - if (skinDBP) { - colIndex = DmFindResource (skinDBP, sknColorsRsc, skinColors, NULL); - - if (colIndex != (UInt16)-1) { - colH = DmGetResourceIndex(skinDBP, colIndex); - - if (colH) { - colTemp = (UInt8 *)MemHandleLock(colH); - - *text = colTemp[0]; - *selected = colTemp[1]; - *background = colTemp[2]; - - MemPtrUnlock(colTemp); - DmReleaseResource(colH); - } - } - } -} - -static void SknCopyBits(DmOpenRef skinDBP, DmResID bitmapID, const RectangleType *srcRect, Coord destX, Coord destY) { - MemHandle hTemp; - BitmapPtr bmpTemp; - UInt16 index; - - Coord cx, cy, cw, ch, bw, bh; - RectangleType copy, old; - - if (skinDBP) { - // find the bitmap - index = DmFindResource (skinDBP, bitmapRsc, bitmapID, NULL); - - if (index != (UInt16)-1) { - hTemp = DmGetResourceIndex(skinDBP,index); - - if (hTemp) { - bmpTemp = (BitmapType *)MemHandleLock(hTemp); - BmpGlueGetDimensions(bmpTemp, &bw, &bh, 0); - - if (!srcRect) { - cx = 0; - cy = 0; - cw = bw; - ch = bh; - } else { - cx = srcRect->topLeft.x; - cy = srcRect->topLeft.y; - cw = srcRect->extent.x; - ch = srcRect->extent.y; - } - - if (ch) { - WinGetClip(&old); - if (OPTIONS_TST(kOptModeHiDensity)) { - Err e; - BitmapTypeV3 *bmp2P; - - // create an uncompressed version of the bitmap - WinHandle win = WinCreateOffscreenWindow(bw, bh, screenFormat, &e); - WinHandle old = WinGetDrawWindow(); - WinSetDrawWindow(win); - WinDrawBitmap(bmpTemp, 0, 0); - WinSetDrawWindow(old); - - bmp2P = BmpCreateBitmapV3(WinGetBitmap(win), kDensityDouble, BmpGetBits(WinGetBitmap(win)), NULL); - - copy.topLeft.x = destX / 2; - copy.topLeft.y = destY / 2; - copy.extent.x = cw / 2; - copy.extent.y = ch / 2; - - WinSetClip(©); - WinDrawBitmap((BitmapPtr)bmp2P, (destX - cx) / 2, (destY - cy) / 2); - BmpDelete((BitmapPtr)bmp2P); - WinDeleteWindow(win, false); - - } else { - copy.topLeft.x = destX; - copy.topLeft.y = destY; - copy.extent.x = cw; - copy.extent.y = ch; - - HRWinSetClip(gVars->HRrefNum, ©); - HRWinDrawBitmap(gVars->HRrefNum, bmpTemp, destX - cx, destY - cy); - } - WinSetClip(&old); - } - - MemPtrUnlock(bmpTemp); - DmReleaseResource(hTemp); - } - } - } -} - -void SknApplySkin() { - DmOpenRef skinDBP; - RectangleType r; - FormPtr frmP = FrmGetActiveForm(); - - // draw skin - FrmDrawForm(frmP); - SknScreenLock(winLockCopy); - - skinDBP = SknOpenSkin(); - - if (gPrefs->card.volRefNum != vfsInvalidVolRef) - FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSBitMap)); - else - FrmShowObject(frmP, FrmGetObjectIndex (frmP, MainMSNoneBitMap)); - - WinSetForeColor(255); - WinSetDrawMode(winPaint); - WinDrawLine (0, 14, 159, 14); - WinDrawLine (0, 13, 159, 13); - - SknGetObjectBounds(skinDBP, skinBackgroundImageTop, &r); - SknCopyBits(skinDBP, skinBackgroundImageTop, 0, r.topLeft.x, r.topLeft.y); - SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &r); - SknCopyBits(skinDBP, skinBackgroundImageBottom, 0, r.topLeft.x, r.topLeft.y); - - for (UInt16 resID = 1100; resID <= 7000; resID += 100) { - SknSetState(skinDBP, resID, sknStateNormal); - SknShowObject(skinDBP, resID); - } - - SknCloseSkin(skinDBP); - SknScreenUnlock(); - SknUpdateList(); -} - -void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP) { - - UInt16 bmpIndex, strIndex; - MemHandle hBmp, hStr; - BitmapType *bmpTemp; - UInt8 *strTemp; - - RctSetRectangle(rP, 0, 0, 0, 0); - - if (skinDBP) { - bmpIndex = DmFindResource (skinDBP, bitmapRsc, resID, NULL); - - if (bmpIndex != (UInt16)-1) { // if bmp exists - strIndex = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (strIndex != (UInt16)-1) { // if params exist - hBmp = DmGetResourceIndex(skinDBP,bmpIndex); - - if (hBmp) { - hStr = DmGetResourceIndex(skinDBP,strIndex); - - if (hStr) { - // buttons : state|x|y|w/h slider|draw mode|x1/y1 keep|x2/y2 keep slider - // list (160mode) : state|x|y|w|h| - bmpTemp = (BitmapType *)MemHandleLock(hBmp); - strTemp = (UInt8 *)MemHandleLock(hStr); - - BmpGlueGetDimensions(bmpTemp, &(rP->extent.x), &(rP->extent.y), 0); - rP->topLeft.x = strTemp[sknInfoPosX] * 2; - rP->topLeft.y = strTemp[sknInfoPosY] * 2; - - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - - MemPtrUnlock(bmpTemp); - DmReleaseResource(hBmp); - } - } - } - } -} - -DmOpenRef SknOpenSkin() { - return DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly); -} - -void SknCloseSkin(DmOpenRef skinDBP) { - if (skinDBP) - DmCloseDatabase(skinDBP); -} - -UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState) { - - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 oldState = 0; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - oldState = strTemp[sknInfoState]; - - if (oldState != newState) { - DmWrite(strTemp, 0, &newState, 1); - } - - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return oldState; -} - -UInt8 SknGetDepth(DmOpenRef skinDBP) { - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 depth = 8; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknDepthRsc, skinDepth, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - depth = *strTemp; - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return depth; -} - -UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID) { - UInt16 index; - MemHandle hStr; - UInt8 *strTemp; - UInt8 oldState = sknStateDisabled; - - if (skinDBP) { - index = DmFindResource (skinDBP, sknPosRsc, resID, NULL); - - if (index != (UInt16)-1) { - hStr = DmGetResourceIndex(skinDBP, index); - - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - oldState = strTemp[sknInfoState]; - MemPtrUnlock(strTemp); - DmReleaseResource(hStr); - } - } - } - - return oldState; -} - -void SknShowObject(DmOpenRef skinDBP, DmResID resID) { - RectangleType r; - UInt8 state = SknGetState(skinDBP, resID); - SknGetObjectBounds(skinDBP, resID, &r); - SknCopyBits(skinDBP, resID + state, NULL, r.topLeft.x, r.topLeft.y); -} - -void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP) { - DmOpenRef skinDBP; - UInt16 strIndex; - MemHandle hStr; - UInt8 *strTemp; - UInt16 x,y,w,h; - - skinDBP = DmOpenDatabase(gPrefs->skin.cardNo, gPrefs->skin.dbID, dmModeReadOnly); - if (skinDBP) { - strIndex = DmFindResource (skinDBP, sknPosRsc, skinList, NULL); - - if (strIndex != 0xFFFF) { // if params exist - hStr = DmGetResourceIndex(skinDBP,strIndex); - if (hStr) { - strTemp = (UInt8 *)MemHandleLock(hStr); - - x = strTemp[sknInfoPosX]; - y = strTemp[sknInfoPosY]; - w = strTemp[sknInfoListWidth]; - h = strTemp[sknInfoListSize] * sknInfoListItemSize; - - if (rAreaP) - RctSetRectangle(rAreaP ,x, y, w, h); - if (rArea2xP) - RctSetRectangle(rArea2xP, x+x, y+y, w+w, h+h); - - MemHandleUnlock(hStr); - DmReleaseResource(hStr); - } - } - - DmCloseDatabase(skinDBP); - } -} - -static void SknRedrawTools(DmOpenRef skinDBP) { - if (GamGetSelected() == dmMaxRecordIndex) { - if (SknGetState(skinDBP, skinButtonGameDelete) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameDelete,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameDelete); - } - if (SknGetState(skinDBP, skinButtonGameEdit) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameEdit,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameEdit); - } - if (SknGetState(skinDBP, skinButtonGameAudio) == sknStateNormal) { - SknSetState(skinDBP, skinButtonGameAudio,sknStateDisabled); - SknShowObject(skinDBP, skinButtonGameAudio); - } - - } else { - if (SknGetState(skinDBP, skinButtonGameDelete) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameDelete,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameDelete); - } - if (SknGetState(skinDBP, skinButtonGameEdit) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameEdit,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameEdit); - } - if (SknGetState(skinDBP, skinButtonGameAudio) == sknStateDisabled) { - SknSetState(skinDBP, skinButtonGameAudio,sknStateNormal); - SknShowObject(skinDBP, skinButtonGameAudio); - } - } -} - -static void SknRedrawSlider(DmOpenRef skinDBP, UInt16 index, UInt16 maxIndex, UInt16 perPage) { - if (maxIndex <= perPage) { - if (SknGetState(skinDBP,skinSliderUpArrow) != sknStateDisabled) { - SknSetState(skinDBP,skinSliderUpArrow,sknStateDisabled); - SknShowObject(skinDBP,skinSliderUpArrow); - } - if (SknGetState(skinDBP,skinSliderDownArrow) != sknStateDisabled) { - SknSetState(skinDBP,skinSliderDownArrow,sknStateDisabled); - SknShowObject(skinDBP,skinSliderDownArrow); - } - - } else { - if (SknGetState(skinDBP,skinSliderUpArrow) == sknStateDisabled) { - SknSetState(skinDBP,skinSliderUpArrow,sknStateNormal); - SknShowObject(skinDBP,skinSliderUpArrow); - } - if (SknGetState(skinDBP,skinSliderDownArrow) == sknStateDisabled) { - SknSetState(skinDBP,skinSliderDownArrow,sknStateNormal); - SknShowObject(skinDBP,skinSliderDownArrow); - } - } -} - -void SknUpdateList() { - MemHandle record; - Int32 index, maxIndex, maxView; - GameInfoType *game; - RectangleType rArea, rField, rCopy, rArea2x; - DmOpenRef skinDBP; - - UInt8 txtColor, norColor, selColor, bkgColor; - UInt16 x,y; - - SknScreenLock(winLockCopy); - - SknGetListBounds(&rArea, &rArea2x); - skinDBP = SknOpenSkin(); - // set default bg - WinSetForeColor(UIColorGetTableEntryIndex (UIFormFill)); - WinDrawRectangle(&rArea,0); - // copy top bg - SknGetObjectBounds(skinDBP, skinBackgroundImageTop, &rField); - RctGetIntersection(&rArea2x, &rField, &rCopy); - x = rCopy.topLeft.x; - y = rCopy.topLeft.y; - rCopy.topLeft.x -= rField.topLeft.x; - rCopy.topLeft.y -= rField.topLeft.y; - SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y); - // copy bottom bg - SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField); - RctGetIntersection(&rArea2x, &rField, &rCopy); - x = rCopy.topLeft.x; - y = rCopy.topLeft.y; - rCopy.topLeft.x -= rField.topLeft.x; - rCopy.topLeft.y -= rField.topLeft.y; - SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y); - - FntSetFont(stdFont); - - index = gPrefs->listPosition; - maxIndex = DmNumRecords(gameDB); - maxView = rArea.extent.y / sknInfoListItemSize; - - if (index > 0 && (index + maxView) > maxIndex) - index -= (index + maxView) - maxIndex; - - if (index < 0) - index = 0; - - gPrefs->listPosition = index; - - SknRedrawSlider(skinDBP, index, maxIndex, maxView); - SknRedrawTools(skinDBP); - SknGetListColors(skinDBP, &norColor, &selColor, &bkgColor); - - SknCloseSkin(skinDBP); - - while (index < (gPrefs->listPosition + maxView) && index < maxIndex) { - record = DmQueryRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - // text box - RctSetRectangle(&rField, rArea.topLeft.x, (rArea.topLeft.y + sknInfoListItemSize * (index - gPrefs->listPosition)), rArea.extent.x, sknInfoListItemSize); - WinSetClip(&rField); - - if (game->selected) { - WinSetDrawMode(winPaint); - WinSetForeColor(bkgColor); - WinDrawRectangle(&rField,0); - txtColor = selColor; - } - else - txtColor = norColor; - - // clipping - rField.topLeft.x += 2; - rField.extent.x -= 4; - WinSetClip(&rField); - // draw text mask - WinSetTextColor(255); - WinSetDrawMode(winMask); - WinPaintChars(game->nameP, StrLen(game->nameP), rField.topLeft.x, rField.topLeft.y); - // draw text - if (txtColor) { - WinSetTextColor(txtColor); - WinSetDrawMode(winOverlay); - WinPaintChars(game->nameP, StrLen(game->nameP), rField.topLeft.x, rField.topLeft.y); - } - - MemHandleUnlock(record); - index++; - } - - RctSetRectangle(&rArea,0,0,160,160); - WinSetClip(&rArea); - SknScreenUnlock(); -} - -UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my) { - UInt16 resID; - RectangleType r; - - mx *= 2; - my *= 2; - - if (skinDBP) { - for (resID = 1100; resID <= 7000; resID += 100) { - if (SknGetState(skinDBP, resID) != sknStateDisabled) { - SknGetObjectBounds(skinDBP, resID, &r); - if (RctPtInRectangle(mx, my, &r)) { - return resID; - } - } - } - } - - return 0; -} - -void SknSelect(Coord x, Coord y) { - RectangleType rArea; - SknGetListBounds(&rArea,0); - - if (RctPtInRectangle(x, y, &rArea)) { - UInt16 index; - MemHandle record; - GameInfoType *game; - UInt16 oldIndex; - - index = (y - rArea.topLeft.y) / sknInfoListItemSize + gPrefs->listPosition; - - if (index == lastIndex) - return; - - if (index < DmNumRecords(gameDB)) { - Boolean newValue; - - oldIndex = GamGetSelected(); - - if (oldIndex != index && oldIndex != dmMaxRecordIndex) - GamUnselect(); - - record = DmGetRecord(gameDB, index); - game = (GameInfoType *)MemHandleLock(record); - - newValue = !game->selected; - DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean)); - - MemHandleUnlock(record); - DmReleaseRecord (gameDB, index, 0); - - lastIndex = index; - SknUpdateList(); - } - } -} - -Boolean SknProcessArrowAction(UInt16 button) { - Boolean handled = false; - - switch (button) { - case skinSliderUpArrow: - if (gPrefs->listPosition > 0) { - gPrefs->listPosition--; - SknUpdateList(); - } - handled = true; - break; - - case skinSliderDownArrow: - RectangleType rArea; - UInt16 maxView; - - SknGetListBounds(&rArea, 0); - maxView = rArea.extent.y / sknInfoListItemSize; - - if (gPrefs->listPosition < DmNumRecords(gameDB)-maxView) { - gPrefs->listPosition++; - SknUpdateList(); - } - handled = true; - break; - } - - return handled; -} diff --git a/backends/platform/PalmOS/Src/launcher/skin.h b/backends/platform/PalmOS/Src/launcher/skin.h deleted file mode 100644 index e8a81e7e2d..0000000000 --- a/backends/platform/PalmOS/Src/launcher/skin.h +++ /dev/null @@ -1,131 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __SKIN_H__ -#define __SKIN_H__ - -// skin -#define sknInfoState 0 -#define sknInfoPosX 1 -#define sknInfoPosY 2 - -#define sknInfoMaxWOrH 3 -#define sknInfoDrawMode 4 -#define sknInfoKeepXOrY1 5 -#define sknInfoKeepXOrY2 7 - -#define sknInfoListWidth sknInfoMaxWOrH -#define sknInfoListHeight sknInfoDrawMode -#define sknInfoListSize sknInfoListHeight -#define sknInfoListItemSize 12 - -#define sknPosRsc 'sPos' -#define sknColorsRsc 'sCol' -#define sknDepthRsc 'sDep' - -#define sknStateNormal 0 -#define sknStateSelected 10 -#define sknStateDisabled 20 - -#define sknSelectedState(bmp) (bmp + sknStateSelected) -#define sknDisabledState(bmp) (bmp + sknStateDisabled) - -// skin elements -#define skinList 500 -#define skinColors 600 -#define skinDepth 700 - -#define skinButtonNone 0 - -#define skinSliderUpArrow 2000 -#define skinSliderDownArrow 2100 - -#define skinButtonGameParams 3000 -#define skinButtonGameAdd 3100 -#define skinButtonGameEdit 3200 -#define skinButtonGameAudio 3300 -#define skinButtonGameDelete 4000 -#define skinButtonGameStart 7000 - -#define skinBackgroundImageTop 1000 -#define skinBackgroundImageBottom 1010 -/// - - -#define skinToolsBackground 1100 - -#define skinListUpArrowNormal 1500 -#define skinListUpArrowOver 1510 -#define skinListUpArrowDisabled 1540 - -#define skinListDownArrowNormal 1800 -#define skinListDownArrowOver 1810 -#define skinListDownArrowDisabled 1840 - -#define skinButtonGameInfoNormal 2000 -#define skinButtonGameInfoOver 2010 -#define skinButtonGameInfoDisabled 2040 - -#define skinButtonGameParamNormal 3000 -#define skinButtonGameParamOver 3010 - -#define skinButtonGameDeleteNormal 4000 -#define skinButtonGameDeleteOver 4010 -#define skinButtonGameDeleteDisabled 4040 - -#define skinButtonVibratorNormal 5000 -#define skinButtonVibratorOver 5010 -#define skinButtonVibratorSelected 5020 -#define skinButtonVibratorSelectedOver 5030 -#define skinButtonVibratorDisabled 5040 - - -#define skinButtonSleepNormal 6000 -#define skinButtonSleepOver 6010 -#define skinButtonSleepSelected 6020 -#define skinButtonSleepSelectedOver 9030 - -#define skinButtonPlayNormal 7000 -#define skinButtonPlayOver 7010 -#define skinButtonPlayDisabled 7040 - -// protos -void SknApplySkin(); -void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP); -DmOpenRef SknOpenSkin(); -void SknCloseSkin(DmOpenRef skinDBP); -UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState); -void SknShowObject(DmOpenRef skinDBP, DmResID resID); -UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID); -void SknUpdateList(); -void SknGetListBounds(RectangleType *rAreaP, RectangleType *rArea2xP); -UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my); -void SknSelect(Coord x, Coord y); -Boolean SknProcessArrowAction(UInt16 button); -UInt8 SknGetDepth(DmOpenRef skinDBP); - -extern UInt16 lastIndex; - -#endif diff --git a/backends/platform/PalmOS/Src/launcher/start.cpp b/backends/platform/PalmOS/Src/launcher/start.cpp deleted file mode 100644 index b5e8f24884..0000000000 --- a/backends/platform/PalmOS/Src/launcher/start.cpp +++ /dev/null @@ -1,367 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include - -#include "palmdefs.h" -#include "start.h" -#include "games.h" -#include "globals.h" -#include "modules.h" -#include "skin.h" - -#include "forms.h" - -/*********************************************************************** - * - * Global variables - * - ***********************************************************************/ -GlobalsPreferencePtr gPrefs; -GlobalsDataPtr gVars; - -Boolean bDirectMode = false; -Boolean bLaunched = false; - -/*********************************************************************** - * - * Internal Constants - * - ***********************************************************************/ - -// Define the minimum OS version we support (3.5 for now). -#define kOurMinVersion sysMakeROMVersion(3,5,0,sysROMStageRelease,0) -#define kPalmOS10Version sysMakeROMVersion(1,0,0,sysROMStageRelease,0) - -/*********************************************************************** - * - * Internal Functions - * - ***********************************************************************/ - -// Callback for ExgDBWrite to send data with Exchange Manager -static Err WriteDBData(const void* dataP, UInt32* sizeP, void* userDataP) { - Err err; - *sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err); - return err; -} - -Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP) { - ExgSocketType exgSocket; - Err err; - - // Create exgSocket structure - MemSet(&exgSocket, sizeof(exgSocket), 0); - exgSocket.description = descriptionP; - exgSocket.name = nameP; - - // Start an exchange put operation - err = ExgPut(&exgSocket); - if (!err) { - err = ExgDBWrite(WriteDBData, &exgSocket, NULL, dbID, cardNo); - err = ExgDisconnect(&exgSocket, err); - } - - return err; -} - - -/*********************************************************************** - * - * FUNCTION: RomVersionCompatible - * - * DESCRIPTION: This routine checks that a ROM version is meet your - * minimum requirement. - * - * PARAMETERS: requiredVersion - minimum rom version required - * (see sysFtrNumROMVersion in SystemMgr.h - * for format) - * launchFlags - flags that indicate if the application - * UI is initialized. - * - * RETURNED: error code or zero if rom is compatible - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags) { - UInt32 romVersion; - - // See if we're on in minimum required version of the ROM or later. - FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); - if (romVersion < requiredVersion) { - if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) == - (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) { - - FrmAlert (RomIncompatibleAlert); - - // Palm OS 1.0 will continuously relaunch this app unless we switch to - // another safe one. - if (romVersion <= kPalmOS10Version) - AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL); - - } - return sysErrRomIncompatible; - } - - return errNone; -} - -/////////////////////////////////////////////////////////////////////// - - -void SavePrefs() { - if (gPrefs) { - PrefSetAppPreferences(appFileCreator, appPrefID, appPrefVersionNum, gPrefs, sizeof (GlobalsPreferenceType), true); - MemPtrFree(gPrefs); - gPrefs = NULL; - } -} - -/*********************************************************************** - * - * FUNCTION: AppHandleEvent - * - * DESCRIPTION: This routine loads form resources and set the event - * handler for the form loaded. - * - * PARAMETERS: event - a pointer to an EventType structure - * - * RETURNED: true if the event has handle and should not be passed - * to a higher level handler. - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static Boolean AppHandleEvent(EventPtr eventP) { - UInt16 formId; - FormPtr frmP; - - if (eventP->eType == frmLoadEvent) { - // Load the form resource. - formId = eventP->data.frmLoad.formID; - frmP = FrmInitForm(formId); - FrmSetActiveForm(frmP); - - // Set the event handler for the form. The handler of the currently - // active form is called by FrmHandleEvent each time is receives an - // event. - switch (formId) { - case MainForm: - FrmSetEventHandler(frmP, MainFormHandleEvent); - break; - - case SkinsForm: - FrmSetEventHandler(frmP, SkinsFormHandleEvent); - break; - - case GameEditForm: - FrmSetEventHandler(frmP, EditGameFormHandleEvent); - break; - - case MiscForm: - FrmSetEventHandler(frmP, MiscFormHandleEvent); - break; - - case CardSlotForm: - FrmSetEventHandler(frmP, CardSlotFormHandleEvent); - break; - - case MusicForm: - FrmSetEventHandler(frmP, MusicFormHandleEvent); - break; - - case InfoForm: - FrmSetEventHandler(frmP, InfoFormHandleEvent); - break; - - case EngineForm: - FrmSetEventHandler(frmP, SelectorFormHandleEvent); - break; - - default: -// ErrFatalDisplay("Invalid Form Load Event"); - break; - } - return true; - } - - return false; -} - -/*********************************************************************** - * - * FUNCTION: AppEventLoop - * - * DESCRIPTION: This routine is the event loop for the application. - * - * PARAMETERS: nothing - * - * RETURNED: nothing - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void AppEventLoop(void) { - UInt16 error; - EventType event; - - do { - EvtGetEvent(&event, evtNoWait); - - if (! SysHandleEvent(&event)) - if (! MenuHandleEvent(0, &event, &error)) - if (! AppHandleEvent(&event)) - FrmDispatchEvent(&event); - - } while (event.eType != appStopEvent); -} - -/*********************************************************************** - * - * FUNCTION: ScummVMPalmMain - * - * DESCRIPTION: This is the main entry point for the application. - * - * PARAMETERS: cmd - word value specifying the launch code. - * cmdPB - pointer to a structure that is associated with the launch code. - * launchFlags - word value providing extra information about the launch. - * - * RETURNED: Result of launch - * - * REVISION HISTORY: - * - * - ***********************************************************************/ -static void AppLaunchCmdNotify(UInt16 LaunchFlags, SysNotifyParamType * pData) { - switch (pData->notifyType) { - case sysNotifyVolumeMountedEvent: - pData->handled = true; // don't switch - - if (gPrefs) { // gPrefs exists ? so we are in the palm selector - CardSlotFormUpdate(); // redraw card list if needed - - if (gPrefs->card.volRefNum == vfsInvalidVolRef) { - VFSAnyMountParamType *notifyDetailsP = (VFSAnyMountParamType *)pData->notifyDetailsP; - gPrefs->card.volRefNum = notifyDetailsP->volRefNum; - - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - if (gPrefs->card.volRefNum != vfsInvalidVolRef) { - CardSlotCreateDirs(); - FrmUpdateForm(MainForm, frmRedrawUpdateMSImport); - } - } - } - break; - - case sysNotifyVolumeUnmountedEvent: - if (gPrefs) { - CardSlotFormUpdate(); - - if (gPrefs->card.volRefNum == (UInt16)pData->notifyDetailsP) { - gPrefs->card.volRefNum = vfsInvalidVolRef; - - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - FrmUpdateForm(MainForm, frmRedrawUpdateMS); - } - } - break; - - case sysNotifyDisplayResizedEvent: - if (gVars) - if (FrmGetFormPtr(MainForm) == FrmGetActiveForm()) - SknApplySkin(); - break; - - case sonySysNotifyMsaEnforceOpenEvent: - // what am i supposed to do here ??? - break; - } -} - -static UInt32 ScummVMPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - Err error; - - error = RomVersionCompatible (kOurMinVersion, launchFlags); - if (error) return (error); - - switch (cmd) { - case sysAppLaunchCmdNotify: - AppLaunchCmdNotify(launchFlags, (SysNotifyParamType *) cmdPBP); - break; - - case sysAppLaunchCustomEngineDelete: -#ifndef _DEBUG_ENGINE - ModDelete(); -#endif - break; - - case sysAppLaunchCmdNormalLaunch: - error = AppStart(); - if (error) - goto end; - - if (!bDirectMode) { - FrmGotoForm(MainForm); - }else { - GamUnselect(); - FrmGotoForm(EngineForm); - } - - AppEventLoop(); -end: - AppStop(); - break; - - default: - break; - - } - return error; -} - -/*********************************************************************** - * - * FUNCTION: PilotMain - * - * DESCRIPTION: This is the main entry point for the application. - * - * PARAMETERS: cmd - word value specifying the launch code. - * cmdPB - pointer to a structure that is associated with the launch code. - * launchFlags - word value providing extra information about the launch. - * RETURNED: Result of launch - * - * REVISION HISTORY: - * - * - ***********************************************************************/ - -UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - return ScummVMPalmMain(cmd, cmdPBP, launchFlags); -} diff --git a/backends/platform/PalmOS/Src/launcher/start.h b/backends/platform/PalmOS/Src/launcher/start.h deleted file mode 100644 index 3ed52b465b..0000000000 --- a/backends/platform/PalmOS/Src/launcher/start.h +++ /dev/null @@ -1,98 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __START_H__ -#define __START_H__ - -typedef struct { - Char nameP[32]; - UInt16 cardNo; - LocalID dbID; -} SkinInfoType, *SkinInfoPtr; - -typedef struct { - - //skin params - SkinInfoType skin; // card where is located the skin - Boolean soundClick; - - Boolean vibrator; - Boolean autoOff; - Boolean setStack; - Boolean exitLauncher; - Boolean goLCD; - Boolean stylusClick; - Boolean arrowKeys; - - UInt16 listPosition; - UInt16 autoSavePeriod; - - struct { - UInt16 volRefNum; - UInt32 cacheSize; - Boolean useCache; - Boolean showLED; - Boolean autoDetect; - Boolean moveDB; - Boolean deleteDB; - Boolean confirmMoveDB; - } card; - - Boolean debug; - UInt16 debugLevel; - Boolean stdPalette; - Boolean demoMode; - Boolean copyProtection; - Boolean oldarm;// TODO : free slot... - Boolean altIntro; - Boolean autoSave; - Boolean advancedMode; - - struct { - Boolean enable; - UInt8 mode; - } lightspeed; - -} GlobalsPreferenceType, *GlobalsPreferencePtr; - -extern GlobalsPreferencePtr gPrefs; - -extern Boolean bDirectMode; -extern Boolean bLaunched; - -#define appPrefID 0x00 -#define appVersionNum 0x01 -#define appPrefVersionNum 0x02 - -#define STACK_DEFAULT 8192 -#define STACK_LARGER 16384 -#define STACK_GET 0 - -Err AppStart(void); -void AppStop(void); -Boolean StartScummVM(Int16 engine = -1); -void SavePrefs(); -Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP); -#endif diff --git a/backends/platform/PalmOS/Src/modules.cpp b/backends/platform/PalmOS/Src/modules.cpp deleted file mode 100644 index b16e2cf7d5..0000000000 --- a/backends/platform/PalmOS/Src/modules.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include - -#include "palmdefs.h" -#include "args.h" -#include "globals.h" -#include "modules.h" -#include "features.h" - -#include "rumble.h" -#include "init_mathlib.h" -#include "init_pa1lib.h" -#include "init_palmos.h" -#include "init_stuffs.h" -#include "init_sony.h" -#include "init_golcd.h" - -#ifndef DISABLE_LIGHTSPEED -#include "lightspeed_public.h" -#endif - -GlobalsDataPtr gVars; - -#include "endianutils.h" -#include - -#ifdef COMPILE_ZODIAC -# include -# include -#endif - -void run(int argc, char *argv[]) { - // init args - ArgsExportInit(argv, argc, true); - - // init system - PalmHRInit(16); - PalmInit(HWR_GET()); - void *__ptr = StuffsForceVG(); - - gVars->screenPitch = StuffsGetPitch(gVars->screenFullWidth); - - // export global struct to ARM - VARS_EXPORT(); - DO_VARS(_4B, 32, 0); - DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32))); - FtrSet(appFileCreator, ftrVars , (UInt32)gVars); - - // run the module -#ifdef COMPILE_ZODIAC - NativeFuncType *entry; - TwLoadModule(0, 0, 0, 1, twLoadFlagTNA|twLoadFlagQuickRun, &entry); -#else - PnoDescriptor pno; - PnoLoadFromResources(&pno, 'ARMC', 1, appFileCreator, 1); - PnoCall(&pno, 0); - PnoUnload(&pno); -#endif - - // reset globals - DO_VARS(_4B, 32, 0); - DO_VARS(_2B, 16, (gVars->_4B * sizeof(UInt32))); - - // release - StuffsReleaseVG(__ptr); - PalmRelease(HWR_GET()); - PalmHRRelease(); - - // free args - ArgsExportRelease(true); - ArgsFree(argv); - - // release global struct - FtrUnregister(appFileCreator, ftrVars); - FtrUnregister(appFileCreator, ftrStack); - MemPtrFree(gVars); - - // reset the palette if needed - WinPalette(winPaletteSetToDefault, 0, 256, NULL); -} - -static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) -{ - UInt32 result = 0; - - switch (cmd) { - case sysAppLaunchCustomEngineGetInfo: { -#ifdef PALMOS_NATIVE - result = GET_MODEARM; -#else -# if defined(ENABLE_SCUMM) || \ - defined(ENABLE_AGOS) || \ - defined(ENABLE_SWORD1) - result = GET_DATACOMMON|GET_DATAENGINE|GET_MODE68K; -# else - result = GET_DATACOMMON|GET_MODE68K; -# endif -#endif - break; - } - - case sysAppLaunchCmdNormalLaunch: { - if (cmdPBP) { - Char **argvP; - UInt16 cardNo; - LocalID dbID; - - LaunchParamType *lp = (LaunchParamType *)cmdPBP; - - gVars = lp->gVars; - argvP = lp->args.argv; - - // get the free memory on the dynamic heap - PalmGetMemory(0,0,0, &(gVars->startupMemory)); - -#ifndef DISABLE_LIGHTSPEED - switch (lp->lightspeed) { - case 0: - LS_SetCPUSpeedHigh(); - break; - case 1: - LS_SetCPUSpeedNormal(); - break; - case 2: - LS_SetCPUSpeedLow(); - break; - } -#endif - // MemPtrSetOwner(gVars, ownerID); - // ArgsSetOwner(argvP, ownerID); // will be freed by main(...) - // MemPtrFree(lp); // will be freed by the system on exit - - run(lp->args.argc, argvP); - - cardNo = 0; - dbID = DmFindDatabase(0, "ScummVM"); - if (dbID) { - if (lp->exitLauncher) - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCustomEngineDelete,0); - else - SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdNormalLaunch,0); - } - } - break; - } - - default: - break; - - } - - return result; -} - -UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - return ModulesPalmMain(cmd, cmdPBP, launchFlags); -} diff --git a/backends/platform/PalmOS/Src/modules.h b/backends/platform/PalmOS/Src/modules.h deleted file mode 100644 index d172ad11c2..0000000000 --- a/backends/platform/PalmOS/Src/modules.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MODULES_H -#define MODULES_H - -#include "globals.h" - -#define sysAppLaunchCode_SVMRunEngine (sysAppLaunchCmdCustomBase + 0) - -void ModDelete(); - -typedef struct { - UInt8 lightspeed; - Boolean exitLauncher; - - struct { - UInt8 argc; - Char **argv; - } args; - - GlobalsDataPtr gVars; -} LaunchParamType; - -#endif diff --git a/backends/platform/PalmOS/Src/native/oscalls.cpp b/backends/platform/PalmOS/Src/native/oscalls.cpp deleted file mode 100644 index 9bfd01393f..0000000000 --- a/backends/platform/PalmOS/Src/native/oscalls.cpp +++ /dev/null @@ -1,92 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include "pace.h" - -GlobalsType global; - - -PACE_CLASS_WRAPPER(Err) - __68k_StatShow(void) { - PACE_PIN_EXEC_NP(pinStatShow, Err) -} - -PACE_CLASS_WRAPPER(Err) - __68k_StatHide(void) { - PACE_PIN_EXEC_NP(pinStatHide, Err) -} - -PACE_CLASS_WRAPPER(Err) - __68k_PINSetInputAreaState(UInt16 state) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(state) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinPINSetInputAreaState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_PINGetInputAreaState(void) { - PACE_PIN_EXEC_NP(pinPINGetInputAreaState, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_PINSetInputTriggerState(UInt16 state) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(state) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinPINSetInputTriggerState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_PINGetInputTriggerState(void) { - PACE_PIN_EXEC_NP(pinPINGetInputTriggerState, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_SysSetOrientation(UInt16 orientation) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(orientation) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinSysSetOrientation, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_SysGetOrientation(void) { - PACE_PIN_EXEC_NP(pinSysGetOrientation, UInt16) -} - -PACE_CLASS_WRAPPER(Err) - __68k_SysSetOrientationTriggerState(UInt16 triggerState) { - PACE_PARAMS_INIT() - PACE_PARAMS_ADD16(triggerState) - PACE_PARAMS_END() - PACE_PIN_EXEC(pinSysSetOrientationTriggerState, Err) -} - -PACE_CLASS_WRAPPER(UInt16) - __68k_SysGetOrientationTriggerState(void) { - PACE_PIN_EXEC_NP(pinSysGetOrientationTriggerState, UInt16) -} diff --git a/backends/platform/PalmOS/Src/native/oscalls.h b/backends/platform/PalmOS/Src/native/oscalls.h deleted file mode 100644 index 071b409130..0000000000 --- a/backends/platform/PalmOS/Src/native/oscalls.h +++ /dev/null @@ -1,58 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef _OSCALLS_H_ -#define _OSCALLS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PALMOS_ARM -# define __68K(a) __68k_##a -#else -# define __68K(a) a -#endif - -Err __68k_StatShow(); -Err __68k_StatHide(); - -Err __68k_PINSetInputAreaState(UInt16 state); -UInt16 __68k_PINGetInputAreaState(void); - -Err __68k_PINSetInputTriggerState(UInt16 state); -UInt16 __68k_PINGetInputTriggerState(void); - -Err __68k_SysSetOrientation(UInt16 orientation); -UInt16 __68k_SysGetOrientation(void); - -Err __68k_SysSetOrientationTriggerState(UInt16 triggerState); -UInt16 __68k_SysGetOrientationTriggerState(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/native/pace.h b/backends/platform/PalmOS/Src/native/pace.h deleted file mode 100644 index 37b903b2c3..0000000000 --- a/backends/platform/PalmOS/Src/native/pace.h +++ /dev/null @@ -1,103 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef PACE_H -#define PACE_H - -#include -//#include "endianutils.h" - -// local definition of the emulation state structure -typedef struct { - UInt32 instr; - UInt32 regData[8]; - UInt32 regAddress[8]; - UInt32 regPC; -} EmulStateType; - -typedef struct { - EmulStateType *emulStateP; - Call68KFuncType *call68KFuncP; -} GlobalsType; - -extern GlobalsType global; - -// TODO : check this, already defined in ARMlet_Runtime -//extern EmulStateType *g_emulStateP; -//extern Call68KFuncType *g_call68KFuncP; -#define g_emulStateP global.emulStateP -#define g_call68KFuncP global.call68KFuncP - - -#ifdef __cplusplus -# define PACE_CLASS_WRAPPER(rv) extern "C" rv -#else -# define PACE_CLASS_WRAPPER(rv) rv -#endif -#define PACE_CALLBACK_PTR g_call68KFuncP -#define PACE_EMULSTATE g_emulStateP - -#define ALIGN_4BYTE(addr) (((UInt32)(addr) + 3) & 0xFFFFFFFC) - -/****** TAKEN FROM PACEInteface.cpp (ARMlet_Runtime) ******/ -// local definition of the emulation state structure - -#define PACE_PARAMS_INIT() \ - UInt8 params[] = { - -#define PACE_PARAMS_ADD8(param) \ - (UInt8)(param), \ - 0, - -#define PACE_PARAMS_ADD16(param) \ - (UInt8)((UInt16)(param) >> 8), \ - (UInt8)(param), - -#define PACE_PARAMS_ADD32(param) \ - (UInt8)((UInt32)(param) >> 24), \ - (UInt8)((UInt32)(param) >> 16), \ - (UInt8)((UInt32)(param) >> 8), \ - (UInt8)(param), - -#define PACE_PARAMS_END() \ - }; - -// PIN -#define PACE_PIN_EXEC_NP(pinTrap, returnType) \ - PACE_EMULSTATE->regData[2] = pinTrap; \ - return ((returnType)((PACE_CALLBACK_PTR)( \ - static_cast(PACE_EMULSTATE), \ - PceNativeTrapNo(sysTrapPinsDispatch), \ - NULL, 0))); - -#define PACE_PIN_EXEC(pinTrap, returnType) \ - PACE_EMULSTATE->regData[2] = pinTrap; \ - return ((returnType)((PACE_CALLBACK_PTR)( \ - static_cast(PACE_EMULSTATE), \ - PceNativeTrapNo(sysTrapPinsDispatch), \ - ¶ms, \ - sizeof(params)))); - -#endif diff --git a/backends/platform/PalmOS/Src/native/pnoARM.c b/backends/platform/PalmOS/Src/native/pnoARM.c deleted file mode 100644 index 48c4fee972..0000000000 --- a/backends/platform/PalmOS/Src/native/pnoARM.c +++ /dev/null @@ -1,60 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifdef COMPILE_OS5 - -#include -#include -#include "pace.h" - -// Linker still looks for ARMlet_Main as entry point, but the -// "ARMlet" name is now officially discouraged. Compare an -// contrast to "PilotMain" for 68K applications. -#define PNO_Main ARMlet_Main - -/* Prepare static initializers */ -extern long __sinit__[]; -extern void __ARMlet_Startup__(); - -/* simple function pointer */ -typedef void (*StaticInitializer)(void); - -unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) { - global.emulStateP = (EmulStateType *)emulStateP; - global.call68KFuncP = call68KFuncP; - - // handle static initializers - if (__sinit__) { - long base = (long)__ARMlet_Startup__; - long s, *p; - - for (p = __sinit__; p && (s = *p) != 0; p++) - ((StaticInitializer)(s + base))(); - } - - return PilotMain(sysAppLaunchCmdNormalLaunch, userData68KP, 0); -} - -#endif diff --git a/backends/platform/PalmOS/Src/native/pnoStartup.c b/backends/platform/PalmOS/Src/native/pnoStartup.c deleted file mode 100644 index b76cac3024..0000000000 --- a/backends/platform/PalmOS/Src/native/pnoStartup.c +++ /dev/null @@ -1,28 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifdef COMPILE_OS5 -# include "(Source)/ARMlet_Startup.c" -#endif diff --git a/backends/platform/PalmOS/Src/native/zodiacARM.cpp b/backends/platform/PalmOS/Src/native/zodiacARM.cpp deleted file mode 100644 index 7323bb6d69..0000000000 --- a/backends/platform/PalmOS/Src/native/zodiacARM.cpp +++ /dev/null @@ -1,150 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "PalmVersion.h" -#include - -#include "globals.h" -#include "args.h" -#include "palmdefs.h" - -#include "rumble.h" - - -//#include -//#define DEBUG_ARM - -#include "base/main.h" -#ifdef COMPILE_ZODIAC -# include "be_zodiac.h" -#endif -#include "be_os5ex.h" - -GlobalsDataType g_vars; -GlobalsDataPtr gVars = &g_vars; -UInt32 g_stackSize; - -extern "C" void __destroy_global_chain(void); -extern void DrawStatus(Boolean show); - -static void palm_main(int argc, char **argvP) { -#ifdef COMPILE_OS5 - if (gVars->advancedMode) - g_system = new OSystem_PalmOS5Ex(); - else - g_system = new OSystem_PalmOS5(); -#elif defined(COMPILE_ZODIAC) - g_system = new OSystem_PalmZodiac(); -#else - #error "No target defined." -#endif - - assert(g_system); - - scummvm_main(argc, argvP); - - g_system->quit(); // TODO: Consider removing / replacing this! -} - -static void Go() { - void *tmp; - char **argvP; - int argc; - -#ifdef DEBUG_ARM -// Tell the debugger we want to enable full debugging - UInt32 flags = AdnDebugEnableGet(); - flags |= kAdnEnableMasterSwitch | kAdnEnableFullDebugging; - AdnDebugEnableSet(flags); -// Tell the debugger where our code lives in memory: - AdnDebugNativeRegister(sysFileTApplication, appFileCreator, 'ARMC', 1); -#endif - - // get global struct - FtrGet(appFileCreator, ftrVars, (UInt32 *)&tmp); - MemMove(gVars, tmp, sizeof(GlobalsDataType)); - - // init STDIO - stdio_set_cache(0); - stdio_init(gVars->VFS.volRefNum, "/PALM/Programs/ScummVM/scumm.log"); - if (gVars->indicator.showLED) - stdio_set_led(DrawStatus); - stdio_set_cache(gVars->VFS.cacheSize); - - // get args - FtrGet(appFileCreator, ftrArgsData, (UInt32 *)&argvP); - FtrGet(appFileCreator, ftrArgsCount, (UInt32 *)&argc); - - // init system - WinSetDrawWindow(WinGetDisplayWindow()); - if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit(); - - // run ... - DO_EXIT ( palm_main(argc, argvP); ) - - // release - if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease(); - stdio_release(); - -#ifdef DEBUG_ARM - AdnDebugNativeUnregister(); -#endif -} - -/* Stack size */ - -Int8 *g_newStack, *g_newStackPos; -void *g_oldStack; - -static asm void *StkSwap(void *newStack ,void *dummy) { - mov r1, r13 - mov r13, r0 - mov r0, r1 - bx lr -} - -extern UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { - if (cmd == sysAppLaunchCmdNormalLaunch) { - FtrGet(appFileCreator, ftrStack, &g_stackSize); - if (!g_stackSize) - g_stackSize = 32 * 1024; - - g_newStack = (Int8 *)malloc(g_stackSize + 8); - g_newStackPos = (g_newStack + g_stackSize); - g_newStackPos -= ((UInt32)g_newStackPos & 7); - - g_oldStack = StkSwap(g_newStackPos, 0); - - Go(); - - StkSwap(g_oldStack, 0); - free(g_newStack); - } - - // Destroy all constructed global objects - __destroy_global_chain(); - - return 0; -} diff --git a/backends/platform/PalmOS/Src/native/zodiacStartup.cpp b/backends/platform/PalmOS/Src/native/zodiacStartup.cpp deleted file mode 100644 index 7f6264c1ac..0000000000 --- a/backends/platform/PalmOS/Src/native/zodiacStartup.cpp +++ /dev/null @@ -1,161 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifdef COMPILE_ZODIAC - -#include - -#ifndef __PALMOS_ARMLET__ -#error "__PALMOS_ARMLET__ is not defined!!!" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This variable holds the Tapwave Native Application interface - * dispatch table. General ARM API calls will go through this table. - */ -struct TwGlue* twGlue; -const void* twEmulState; -Call68KFuncType* twCall68KFunc; - -#ifdef __MWERKS__ - -#if __PALMOS_ARMLET__ < 0x120 -#error "You must use CodeWarrior for Palm OS 9.3 or later!!!" -#endif - - -UInt32 __ARMlet_Startup__(const void*, void*, Call68KFuncType*); - -/* - * These symbols aren't real, but are linker-generated symbols that - * mark the start and end of the various data sections. - */ -extern long __DataStart__[]; -extern long __sinit__[]; -extern long __RODataStart__[]; -extern long __BSSStart__[]; -extern long __BSSEnd__[]; -extern long __CodeRelocStart__[]; -extern long __CodeRelocEnd__[]; -extern long __DataRelocStart__[]; -extern long __DataRelocEnd__[]; - -/* simple function pointer */ -typedef void (*StaticInitializer)(void); - -/* - * This function performs relocation for Tapwave Native Application. - */ -static void relocate(void) -{ - // this symbol points to the very beginning of current application - long base = (long) __ARMlet_Startup__; - long *cur, *end; - - // handle static initializers - if (__sinit__) { - long s, *p; - - for (p = __sinit__; p && (s = *p) != 0; p++) - ((StaticInitializer)(s + base))(); - } - - // handle code-to-data relocation - cur = __CodeRelocStart__; - end = __CodeRelocEnd__; - for (; cur < end; cur++) { - *(long*)(base + *cur) += base; - } - - // handle data-to-data relocation - cur = __DataRelocStart__; - end = __DataRelocEnd__; - for (; cur < end; cur++) { - *(long*)(base + *cur) += base; - } -} - -/* - * This is the real entrypoint for Tapwave Native Application. It - * depends on various CodeWarrior 9.2 compiler/linker/runtime features. - */ -static SYSTEM_CALLBACK UInt32 -Startup(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) -{ - if (emulStateP) { - twEmulState = emulStateP; - twCall68KFunc = call68KFuncP; - // COMMENT: normal pace native object launch - return PilotMain(sysAppLaunchCmdNormalLaunch, userData68KP, 0); - } else { - // Setup TNA interface dispatch table - twGlue = (struct TwGlue*) userData68KP; - - // OPTIONAL: relocate data segment - relocate(); - - // OPTIONAL: initialize the floating-point library - // _fp_init(); - - return 0; - } -} - -#pragma PIC off -asm UInt32 -__ARMlet_Startup__(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) -{ - b Startup // 0 forwarding call - nop // 4 - nop // 8 - nop // 12 - nop // 16 - nop // 20 - nop // 24 - dcd 'TWNA' // 28 Tapwave Native Application - dcd 1 // 32 version 1 - dcd 'cdwr' // 36 make this section the same as the __ARMlet_Startup__ - dcd __DataStart__ // 40 used by CodeWarrior 9.2 - dcd __RODataStart__ // 44 - dcd __BSSStart__ // 48 - dcd __BSSEnd__ // 52 - dcd __CodeRelocStart__ // 56 - dcd __CodeRelocEnd__ // 60 - dcd __DataRelocStart__ // 64 - dcd __DataRelocEnd__ // 68 -} -#pragma PIC reset - -#endif // __MWERKS__ - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/os5_event.cpp b/backends/platform/PalmOS/Src/os5_event.cpp deleted file mode 100644 index 534c2eb4f9..0000000000 --- a/backends/platform/PalmOS/Src/os5_event.cpp +++ /dev/null @@ -1,82 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::get_coordinates(EventPtr ev, Coord &x, Coord &y) { - Boolean dummy; - EvtGetPenNative(WinGetDisplayWindow(), &ev->screenX, &ev->screenY, &dummy); - - x = (ev->screenX - _screenOffset.x); - y = (ev->screenY - _screenOffset.y); - - if (_stretched) { - x = (x * _screenWidth) / _screenDest.w; - y = (y * _screenHeight) / _screenDest.h; - } -} - -bool OSystem_PalmOS5::check_event(Common::Event &event, EventPtr ev) { - if (ev->eType == keyUpEvent) { - switch (ev->data.keyUp.chr) { - case vchrHard3: - case vchrHard4: - // will be handled by hard keys - return true; - } - - } else if (ev->eType == keyDownEvent) { - switch (ev->data.keyDown.chr) { - - // hot swap gfx -// case 0x1B04: - case vchrHard1: - if (OPTIONS_TST(kOptCollapsible)) - hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE); - return false; // not a key - -// case 0x1B05: - case vchrHard2: - setFeatureState(kFeatureAspectRatioCorrection, 0); - return false; // not a key - - case vchrHard3: - _keyExtraPressed |= _keyExtra.bitActionA; - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrHard4: - _keyExtraPressed |= _keyExtra.bitActionB; - event.type = Common::EVENT_RBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp deleted file mode 100644 index 6a7b21e100..0000000000 --- a/backends/platform/PalmOS/Src/os5_gfx.cpp +++ /dev/null @@ -1,309 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" -#include "graphics/surface.h" -#include "common/config-manager.h" -#include -#include - -#include "oscalls.h" - -void OSystem_PalmOS5::int_initSize(uint w, uint h) { -} - -WinHandle OSystem_PalmOS5::alloc_screen(Coord w, Coord h) { - Err e; - WinHandle winH; - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - winH = WinCreateOffscreenWindow(w, h, nativeFormat, &e); - WinSetCoordinateSystem(old); - - return winH; -} - -void OSystem_PalmOS5::load_gfx_mode() { - Err e; - - if (_gfxLoaded) - return; - _gfxLoaded = true; - - // get command line config -// _fullscreen = ConfMan.getBool("fullscreen"); // TODO : (NORMAL mode) - _ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone; - - // precalc ratio (WIDE mode) - _ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight); - _ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth); - - _offScreenP = (byte *)malloc(_screenWidth * _screenHeight); - - MemSet(_offScreenP, _screenWidth * _screenHeight, 0); - MemSet(_nativePal, sizeof(_nativePal), 0); - MemSet(_currentPalette, sizeof(_currentPalette), 0); - - UInt32 depth = 16; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - if (OPTIONS_TST(kOptModeRotatable)) { - _sysOldOrientation = __68K(SysGetOrientation()); - _sysOldTriggerState = __68K(PINGetInputTriggerState()); - __68K(SysSetOrientation(sysOrientationLandscape)); - __68K(SysSetOrientationTriggerState(sysOrientationTriggerDisabled)); - __68K(PINSetInputTriggerState(pinInputTriggerDisabled)); - } - - gVars->indicator.on = Graphics::RGBToColor >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor >(0,0,0); - - _overlayH = alloc_screen(_screenWidth, _screenHeight); - _overlayP = (OverlayColor *)(BmpGetBits(WinGetBitmap(_overlayH))); - - _screenH = WinGetDisplayWindow(); - _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))); - - _isSwitchable = OPTIONS_TST(kOptModeLandscape) && OPTIONS_TST(kOptCollapsible); - if (!_isSwitchable) - _mode = GFX_NORMAL; - - hotswap_gfx_mode(_mode); -} - -void OSystem_PalmOS5::hotswap_gfx_mode(int mode) { - Err e; - - if (_mode != GFX_NORMAL && !_isSwitchable) - return; - - if (_workScreenH) - WinDeleteWindow(_workScreenH, false); - _workScreenH = NULL; - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - // prevent bad DIA redraw (Stat part) - if (mode == GFX_NORMAL) { - _redawOSD = true; - _stretched = (_screenWidth > gVars->screenWidth); - - if (OPTIONS_TST(kOptCollapsible)) { - //AiaSetInputAreaState(aiaInputAreaShow); // For T3 ?? - __68K(StatShow()); - __68K(PINSetInputAreaState(pinInputAreaOpen)); - } - - if (_stretched) { - calc_rect(false); - } else { - // offsets - _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2; - _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2; - } - - } else { - _redawOSD = false; - _stretched = true; - - if (OPTIONS_TST(kOptCollapsible)) { - // T3 DIA library is 68k base, there is no possible native call - //AiaSetInputAreaState(aiaInputAreaFullScreen); - __68K(PINSetInputAreaState(pinInputAreaClosed)); - __68K(StatHide()); - } - - calc_rect(true); - } - - if (_stretched) { - OPTIONS_SET(kOptDisableOnScrDisp); - if (_screenHeight == 200 && _screenDest.h == 300) { - _render = &OSystem_PalmOS5::render_landscape15x; - } else { - _render = &OSystem_PalmOS5::render_landscapeAny; - calc_scale(); - } - } else { - OPTIONS_RST(kOptDisableOnScrDisp); - _render = &OSystem_PalmOS5::render_1x; - } - - _workScreenH = alloc_screen(_screenDest.w, _screenDest.h); - _workScreenP = (uint16 *)(BmpGetBits(WinGetBitmap(_workScreenH))); - MemSet(_workScreenP, _screenDest.w * _screenDest.h * 2, 0); - - _mode = mode; - clear_screen(); -} - -void OSystem_PalmOS5::unload_gfx_mode() { - if (!_gfxLoaded) - return; - _gfxLoaded = false; - - // mouse data freed in quit() - free(_offScreenP); - - if (_workScreenH) - WinDeleteWindow(_workScreenH, false); - if (_overlayH) - WinDeleteWindow(_overlayH, false); - - _workScreenH = NULL; - _overlayH = NULL; - - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - if (OPTIONS_TST(kOptModeRotatable)) { - __68K(PINSetInputTriggerState(_sysOldTriggerState)); - __68K(SysSetOrientation(_sysOldOrientation)); - } - - WinSetCoordinateSystem(_sysOldCoord); -} - -void OSystem_PalmOS5::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { - // Clip the coordinates - if (x < 0) { - w += x; - buf -= x; - x = 0; - } - - if (y < 0) { - h += y; - buf -= y * pitch; - y = 0; - } - - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (h > _screenHeight - y) - h = _screenHeight - y; - - if (w <= 0 || h <= 0) - return; - - byte *dst = _offScreenP + y * _screenWidth + x; - - if (w == pitch && w == _screenWidth) { - MemMove(dst, buf, w * h); - } else { - do { - MemMove(dst, buf, w); - dst += _screenWidth; - buf += pitch; - } while (--h); - } -} - -Graphics::Surface *OSystem_PalmOS5::lockScreen() { - _framebuffer.pixels = _offScreenP; - _framebuffer.w = _screenWidth; - _framebuffer.h = _screenHeight; - _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; - - return &_framebuffer; -} - -void OSystem_PalmOS5::unlockScreen() { - // The screen is always completely update anyway, so we don't have to force a full update here. -} - -void OSystem_PalmOS5::int_updateScreen() { - RectangleType r; - PointType p; - - draw_mouse(); - ((this)->*(_render))(r, p); - - _sysOldCoord = WinSetCoordinateSystem(kCoordinatesNative); - WinCopyRectangle(_workScreenH, _screenH, &r, p.x, p.y, winPaint); - WinSetCoordinateSystem(_sysOldCoord); - undraw_mouse(); -} - -void OSystem_PalmOS5::clear_screen() { - RGBColorType rgb = { 0,0,0,0 }; - WinSetDrawWindow(WinGetDisplayWindow()); - WinSetBackColorRGB(&rgb, 0); - WinEraseWindow(); -} - -void OSystem_PalmOS5::extras_palette(uint8 index, uint8 r, uint8 g, uint8 b) { - _nativePal[index] = gfxMakeDisplayRGB(r, g, b); -} - -void OSystem_PalmOS5::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { - if (_mode != GFX_NORMAL) - return; -// MemHandle hTemp = DmGetResource(bitmapRsc, id); - MemHandle hTemp = DmGetResource('abmp', id + 100); - - if (hTemp) { - RGBColorType oldRGB; - static const RGBColorType pal[4] = { - {0,0,255,0}, - {0,255,255,0}, - {0,255,0,0}, - {0,0,0,0} - }; - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - BmpGetDimensions(bmTemp, &w, &h, 0); - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType c, r = { dst.x, dst.y, w, h }; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinSetDrawWindow(_screenH); - WinGetClip(&c); - WinResetClip(); - - if (show) { - WinSetForeColorRGB(&pal[3], &oldRGB); - WinSetBackColorRGB(&pal[color], &oldRGB); - WinDrawBitmap(bmTemp, dst.x, dst.y); - } else { - WinSetBackColorRGB(&pal[3], &oldRGB); - WinFillRectangle(&r, 0); - } - - WinSetClip(&c); - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/os5_mouse.cpp b/backends/platform/PalmOS/Src/os5_mouse.cpp deleted file mode 100644 index c019e1607d..0000000000 --- a/backends/platform/PalmOS/Src/os5_mouse.cpp +++ /dev/null @@ -1,157 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num) { - for (uint i = 0; i < num; i++) { - _mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]); - colors += 4; - } - - _cursorPaletteDisabled = false; -} - -void OSystem_PalmOS5::disableCursorPalette(bool disable) { - _cursorPaletteDisabled = disable; -} - -// TODO: this code is almost the same as Zodiac version. -void OSystem_PalmOS5::draw_mouse() { - if (!_mouseDataP || _mouseDrawn || !_mouseVisible) - return; - - byte *src = _mouseDataP; - - int x = _mouseCurState.x - _mouseHotspotX; - int y = _mouseCurState.y - _mouseHotspotY; - int w = _mouseCurState.w; - int h = _mouseCurState.h; - - // clip the mouse rect - if (y < 0) { - src -= y * w; - h += y; - y = 0; - } - if (x < 0) { - src -= x; - w += x; - x = 0; - } - - if (h > _screenHeight - y) - h = _screenHeight - y; - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (w <= 0 || h <= 0) - return; - - // store the bounding box so that undraw mouse can restore the area the - // mouse currently covers to its original content - _mouseOldState.x = x; - _mouseOldState.y = y; - _mouseOldState.w = w; - _mouseOldState.h = h; - - byte color; - int ww; - - if (_overlayVisible) { - uint16 *bak = (uint16 *)_mouseBackupP; - uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - uint16 *dst = _overlayP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = pal[color]; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - - } else { - byte *bak = _mouseBackupP; - byte *dst =_offScreenP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = color; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - } - - _mouseDrawn = true; -} - -void OSystem_PalmOS5::undraw_mouse() { - if (!_mouseDrawn) - return; - - int h = _mouseOldState.h; - - // no need to do clipping here, since draw_mouse() did that already - if (_overlayVisible) { - uint16 *dst = _overlayP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - uint16 *bak = (uint16 *)_mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w * 2); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - - } else { - byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - byte *bak = _mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - } - - _mouseDrawn = false; -} diff --git a/backends/platform/PalmOS/Src/os5_overlay.cpp b/backends/platform/PalmOS/Src/os5_overlay.cpp deleted file mode 100644 index 7e16a6b7b9..0000000000 --- a/backends/platform/PalmOS/Src/os5_overlay.cpp +++ /dev/null @@ -1,76 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" -#include "common/endian.h" - -void OSystem_PalmOS5::showOverlay() { - // hide fight indicator - draw_osd(kDrawFight, _screenDest.w - 34, _screenDest.h + 2, false); - - undraw_mouse(); - _overlayVisible = true; - clearOverlay(); -} - -void OSystem_PalmOS5::hideOverlay() { - undraw_mouse(); - _overlayVisible = false; - _redawOSD = true; -} - -void OSystem_PalmOS5::clearOverlay() { - if (!_overlayVisible) - return; - - byte *src = _offScreenP; - uint16 *dst = _overlayP; - int cnt = _screenWidth * _screenHeight; - do { - *dst++ = _nativePal[*src++]; - } while (--cnt); -} - -void OSystem_PalmOS5::grabOverlay(OverlayColor *buf, int pitch) { - OverlayColor *src = _overlayP; - int h = _screenHeight; - do { - memcpy(buf, src, _screenWidth * 2); - src += _screenWidth; - buf += pitch; - } while (--h); -} - -void OSystem_PalmOS5::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - if (w == 0 || h == 0) - return; - - OverlayColor *dst = _overlayP + x + y * _screenWidth; - do { - memcpy(dst, buf, w * 2); - dst += _screenWidth; - buf += pitch; - } while (--h); -} diff --git a/backends/platform/PalmOS/Src/os5_renderer.cpp b/backends/platform/PalmOS/Src/os5_renderer.cpp deleted file mode 100644 index fea3ec28d7..0000000000 --- a/backends/platform/PalmOS/Src/os5_renderer.cpp +++ /dev/null @@ -1,118 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" - -void OSystem_PalmOS5::render_1x(RectangleType &r, PointType &p) { - Coord o = 0; - - if (_overlayVisible) { - uint16 *src = _overlayP; - uint16 *dst = _workScreenP; - MemMove(dst, src, _screenWidth * _screenHeight * 2); - - } else { - byte *src = _offScreenP; - uint16 *dst = _workScreenP; - int cnt = _screenWidth * _screenHeight; - o = _current_shake_pos; - - do { - *dst++ = _nativePal[*src++]; - } while (--cnt); - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, _screenWidth, _screenHeight - o); -} - -void OSystem_PalmOS5::render_landscapeAny(RectangleType &r, PointType &p) { - Coord x, y, o = 0; - uint16 *dst = _workScreenP; - - if (_overlayVisible) { - for (y = 0; y < _screenDest.h; y++) { - uint16 *src = _overlayP + *(_scaleTableY + y); - for (x = 0; x < _screenDest.w; x++) { - *dst++ = *(src + *(_scaleTableX + x)); - } - } - - } else { - o = _current_shake_pos; - - for (y = 0; y < _screenDest.h; y++) { - byte *src = _offScreenP + *(_scaleTableY + y); - for (x = 0; x < _screenDest.w; x++) { - *dst++ = *(_nativePal + *(src + *(_scaleTableX + x))); - } - } - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, _screenDest.w, _screenDest.h - o); -} - -void OSystem_PalmOS5::render_landscape15x(RectangleType &r, PointType &p) { - Coord x, y, o = 0; - uint16 *dst = _workScreenP; - - if (_overlayVisible) { - uint16 *src = _overlayP; - - for (y = 0; y < 100; y++) { - // draw 2 lines - for (x = 0; x < 320; x++) { - *dst++ = *src++; - *dst++ = *src; - *dst++ = *src++; - } - // copy the second to the next line - MemMove(dst, dst - 480, 480 * 2); - dst += 480; - } - } else { - byte *src = _offScreenP; - o = _current_shake_pos; - - for (y = 0; y < 100; y++) { - // draw 2 lines - for (x = 0; x < 320; x++) { - *dst++ = _nativePal[*src++]; - *dst++ = _nativePal[*src]; - *dst++ = _nativePal[*src++]; - } - // copy the second to the next line - MemMove(dst, dst - 480, 480 * 2); - dst += 480; - } - } - - p.x = _screenOffset.x; - p.y = _screenOffset.y + o; - RctSetRectangle(&r, 0, 0, 480, 300 - o); -} diff --git a/backends/platform/PalmOS/Src/os5_sound.cpp b/backends/platform/PalmOS/Src/os5_sound.cpp deleted file mode 100644 index 73ab64c0d5..0000000000 --- a/backends/platform/PalmOS/Src/os5_sound.cpp +++ /dev/null @@ -1,156 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5.h" -#include "common/config-manager.h" -#include "sound/mixer_intern.h" - - -#ifdef PALMOS_ARM -# ifdef COMPILE_ZODIAC -# define SAMPLES_PER_SEC 44100 -# else -# define SAMPLES_PER_SEC 22050 -# endif -#else -# define SAMPLES_PER_SEC 8000 -#endif - - -SoundExType _soundEx; - -static Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { - SoundExType *_soundEx = (SoundExType *)UserDataP; - SoundType *_sound = _soundEx->sound; - - if (_soundEx->set && _soundEx->size) { - MemMove(bufferP, _soundEx->dataP, _soundEx->size); - *bufferSizeP = _soundEx->size; - _soundEx->set = false; - - } else { - _soundEx->size = *bufferSizeP; - MemSet(bufferP, 128, 0); - *bufferSizeP = 128; - } - - return errNone; -} - -void OSystem_PalmOS5::sound_handler() { - if (_sound.active) { - if (_soundEx.size && !_soundEx.set) { - if (!_soundEx.dataP) - _soundEx.dataP = MemPtrNew(_soundEx.size); - - _mixerMgr->mixCallback((byte *)_soundEx.dataP, _soundEx.size); - _soundEx.set = true; - } - }// TODO : no Sound API case -} - -SndStreamVariableBufferCallback OSystem_PalmOS5::sound_callback() { - return sndCallback; -} - -bool OSystem_PalmOS5::setupMixer() { - Err e; - Boolean success = false; - - uint32 samplesPerSec; - if (ConfMan.hasKey("output_rate")) - samplesPerSec = ConfMan.getInt("output_rate"); - else - samplesPerSec = SAMPLES_PER_SEC; - - _mixerMgr = new Audio::MixerImpl(this, samplesPerSec); - - if (!_sound.active) { - if (gVars->fmQuality != FM_QUALITY_INI) { - ConfMan.setBool("FM_medium_quality", (gVars->fmQuality == FM_QUALITY_MED)); - ConfMan.setBool("FM_high_quality", (gVars->fmQuality == FM_QUALITY_HI)); - } - -#if defined (COMPILE_OS5) - CALLBACK_INIT(_soundEx); -#endif - _sound.proc = 0; - _sound.param = _mixerMgr; - _sound.active = true; // always true when we call this function, false when sound is off - - _soundEx.handle = 0; - _soundEx.size = 0; // set by the callback - _soundEx.set = false; - _soundEx.dataP = NULL; // set by the handler - - // try to create sound stream - if (OPTIONS_TST(kOptPalmSoundAPI)) { - e = SndStreamCreateExtended( - &_soundEx.handle, - sndOutput, - sndFormatPCM, - samplesPerSec, - sndInt16Little, - sndStereo, - sound_callback(), - &_soundEx, - 8192 -#ifdef COMPILE_OS5 - ,true -#endif - ); - - e = e ? e : SndStreamStart(_soundEx.handle); - e = e ? e : SndStreamSetVolume(_soundEx.handle, 1024L * gVars->palmVolume / 100); - success = (e == errNone); - - // no Sound API - } else { - _soundEx.size = 512; - _soundEx.dataP = MemPtrNew(_soundEx.size); - } - } - // if not true some scenes (indy3 256,...) may freeze (ESC to skip) - - _mixerMgr->setReady(true); - - return true; -} - -void OSystem_PalmOS5::clearSoundCallback() { - if (_sound.active) { - if (OPTIONS_TST(kOptPalmSoundAPI)) { - SndStreamStop(_soundEx.handle); - SndStreamDelete(_soundEx.handle); - } - - if (_soundEx.dataP) - MemPtrFree(_soundEx.dataP); - } - - _sound.active = false; - _soundEx.handle = NULL; - _soundEx.dataP = NULL; -} diff --git a/backends/platform/PalmOS/Src/os5ex_sound.cpp b/backends/platform/PalmOS/Src/os5ex_sound.cpp deleted file mode 100644 index f27f5a202d..0000000000 --- a/backends/platform/PalmOS/Src/os5ex_sound.cpp +++ /dev/null @@ -1,43 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_os5ex.h" -#include "sound/mixer_intern.h" - -static SYSTEM_CALLBACK Err sndCallbackEx(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) { - CALLBACK_PROLOGUE - SoundType *_sound = ((SoundExType *)UserDataP)->sound; -// ((SoundProc)_sound->proc)(_sound->param, (byte *)bufferP, *bufferSizeP); - - Audio::MixerImpl *_mixerMgr = ( Audio::MixerImpl *)_sound->param; - _mixerMgr->mixCallback((byte *)bufferP, *bufferSizeP); - - CALLBACK_EPILOGUE - return errNone; -} - -SndStreamVariableBufferCallback OSystem_PalmOS5Ex::sound_callback() { - return sndCallbackEx; -} diff --git a/backends/platform/PalmOS/Src/palmdefs.h b/backends/platform/PalmOS/Src/palmdefs.h deleted file mode 100644 index d37b533a21..0000000000 --- a/backends/platform/PalmOS/Src/palmdefs.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef PALMDEFS_H -#define PALMDEFS_H - -#define appFileCreator 'ScVM' -#define sysAppLaunchCustomEngineDelete (sysAppLaunchCmdCustomBase + 0) -#define sysAppLaunchCustomEngineGetInfo (sysAppLaunchCmdCustomBase + 1) - -enum { - GET_NONE = 0, - GET_DATACOMMON = 1 << 1, - GET_DATAENGINE = 1 << 2, - - GET_MODE68K = 1 << 14, - GET_MODEARM = 1 << 15, -}; - -SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP) - SYS_TRAP(sysTrapSysGetAppInfo); - - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/compile.h b/backends/platform/PalmOS/Src/prefixes/compile.h deleted file mode 100644 index bb7230187a..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/compile.h +++ /dev/null @@ -1,76 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __COMPILE_H__ -#define __COMPILE_H__ - -#undef ENABLE_SCUMM -#undef ENABLE_SCUMM_7_8 -#undef ENABLE_HE - -#undef ENABLE_AGOS -#undef ENABLE_SKY -#undef ENABLE_SWORD1 -#undef ENABLE_SWORD2 -#undef ENABLE_QUEEN -#undef ENABLE_SAGA -#undef ENABLE_KYRA -#undef ENABLE_AWE -#undef ENABLE_GOB -#undef ENABLE_LURE -#undef ENABLE_CINE -#undef ENABLE_AGI -#undef ENABLE_TOUCHE -#undef ENABLE_PARALLACTION -#undef ENABLE_CRUISE -#undef ENABLE_DRASCULA - -// ScummVM -#define USE_SCALERS -#define DISABLE_FANCY_THEMES -//#define CT_NO_TRANSPARENCY -//#define REDUCE_MEMORY_USAGE - -#include "compile_base.h" - -//#define DISABLE_ADLIB -//#define DISABLE_LIGHTSPEED - -#ifdef COMPILE_ZODIAC -# undef DISABLE_FANCY_THEMES -# define USE_ZLIB -// set an external ZLIB since save/load implementation -// doesn't support built-in zodiac version which is 1.1.4 -// (seen inflateInit2 which err on "MAX_WBITS + 32") -# define USE_ZLIB_EXTERNAL -# define DISABLE_SONY -#endif - -#ifdef COMPILE_OS5 -# define DISABLE_TAPWAVE -# define USE_ZLIB -#endif - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_agi.h b/backends/platform/PalmOS/Src/prefixes/native_agi.h deleted file mode 100644 index f3feee8c70..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_agi.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_AGI STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_agos.h b/backends/platform/PalmOS/Src/prefixes/native_agos.h deleted file mode 100644 index 8a804e3116..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_agos.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_AGOS STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_cine.h b/backends/platform/PalmOS/Src/prefixes/native_cine.h deleted file mode 100644 index 3d19d9c557..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_cine.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_CINE STATIC_PLUGIN -#define _DEBUG - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_common.h b/backends/platform/PalmOS/Src/prefixes/native_common.h deleted file mode 100644 index af4db70932..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_common.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ZNATIVE_COMMON_H -#define ZNATIVE_COMMON_H - -#include "compile.h" - -#define __TWNEW_H__ - -#define PALMOS_ARM -#define DISABLE_LIGHTSPEED - -#define USE_MAD -#define USE_TREMOR -#define USE_VORBIS -//#define USE_MPEG2 - -// enable assert -//#define _DEBUG - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_cruise.h b/backends/platform/PalmOS/Src/prefixes/native_cruise.h deleted file mode 100644 index 89e6e65a70..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_cruise.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_CRUISE STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_drascula.h b/backends/platform/PalmOS/Src/prefixes/native_drascula.h deleted file mode 100644 index 35bc381af4..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_drascula.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_DRASCULA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_gob.h b/backends/platform/PalmOS/Src/prefixes/native_gob.h deleted file mode 100644 index 9cb34099d0..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_gob.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_GOB STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_kyra.h b/backends/platform/PalmOS/Src/prefixes/native_kyra.h deleted file mode 100644 index 3b09c63a6f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_kyra.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_KYRA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_lure.h b/backends/platform/PalmOS/Src/prefixes/native_lure.h deleted file mode 100644 index 71835ee644..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_lure.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_LURE STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_m4.h b/backends/platform/PalmOS/Src/prefixes/native_m4.h deleted file mode 100644 index 3bf85460a6..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_m4.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_M4 STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_made.h b/backends/platform/PalmOS/Src/prefixes/native_made.h deleted file mode 100644 index fd439ed181..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_made.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_MADE STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_parallaction.h b/backends/platform/PalmOS/Src/prefixes/native_parallaction.h deleted file mode 100644 index e8d46cc382..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_parallaction.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_PARALLACTION STATIC_PLUGIN - -#undef USE_MAD -#undef USE_VORBIS -#undef USE_TREMOR - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_queen.h b/backends/platform/PalmOS/Src/prefixes/native_queen.h deleted file mode 100644 index 85bb5a0a04..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_queen.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_QUEEN STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_saga.h b/backends/platform/PalmOS/Src/prefixes/native_saga.h deleted file mode 100644 index 19db05b633..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_saga.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SAGA STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_scumm.h b/backends/platform/PalmOS/Src/prefixes/native_scumm.h deleted file mode 100644 index b8433a3fa8..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_scumm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SCUMM STATIC_PLUGIN -#define ENABLE_SCUMM_7_8 -#define ENABLE_HE - -#define USE_ARM_GFX_ASM -#define USE_ARM_SMUSH_ASM - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sky.h b/backends/platform/PalmOS/Src/prefixes/native_sky.h deleted file mode 100644 index 49b157471f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sky.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SKY STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sword1.h b/backends/platform/PalmOS/Src/prefixes/native_sword1.h deleted file mode 100644 index 6ae7bb9050..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sword1.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SWORD1 STATIC_PLUGIN -#define USE_MPEG2 -#define USE_VORBIS - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_sword2.h b/backends/platform/PalmOS/Src/prefixes/native_sword2.h deleted file mode 100644 index 5e9c45b047..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_sword2.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_SWORD2 STATIC_PLUGIN -#undef _DEBUG -#define USE_MPEG2 -#define USE_VORBIS - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/native_touche.h b/backends/platform/PalmOS/Src/prefixes/native_touche.h deleted file mode 100644 index acf50e2787..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/native_touche.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#include "native_common.h" -#define ENABLE_TOUCHE STATIC_PLUGIN - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h b/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h deleted file mode 100644 index 8473214746..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_frontend.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -#define PALMOS_68K -#define PALMOS_MODE - -//#define _DEBUG_ENGINE - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_os5.h b/backends/platform/PalmOS/Src/prefixes/prefix_os5.h deleted file mode 100644 index 6d84c543af..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_os5.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -// PalmOS -#define PALMOS_MODE -#define PALMOS_68K -#define PALMOS_NATIVE - -#define COMPILE_OS5 -#define DISABLE_SONY -#define DISABLE_PA1LIB - -#endif diff --git a/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h b/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h deleted file mode 100644 index 49331d356f..0000000000 --- a/backends/platform/PalmOS/Src/prefixes/prefix_zodiac.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef PREFIX_H -#define PREFIX_H - -// PalmOS -#define PALMOS_MODE -#define PALMOS_68K -#define PALMOS_NATIVE - -#define COMPILE_ZODIAC -#define DISABLE_SONY -#define DISABLE_PA1LIB - -#endif diff --git a/backends/platform/PalmOS/Src/rumble.cpp b/backends/platform/PalmOS/Src/rumble.cpp deleted file mode 100644 index 513152f49c..0000000000 --- a/backends/platform/PalmOS/Src/rumble.cpp +++ /dev/null @@ -1,140 +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. - * - * $URL$ - * $Id$ - * - */ - -#include -#include "globals.h" -#include "vibrate.h" -#include "rumble.h" - -#ifndef DISABLE_TAPWAVE -#include "tapwave.h" - -TwDeviceHandle hRumble; -#endif - -Boolean RumbleExists() { - Boolean exists = false; - Err e; - -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - e = TwDeviceOpen(&hRumble, "vibrator0", "w"); - if (!e) { - exists = true; - TwDeviceClose(hRumble); - } - - } else -#endif - { -#ifndef PALMOS_ARM - - UInt32 romVersion; - - e = FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion); - if (!e) { - if (romVersion >= sysMakeROMVersion(4,0,0,sysROMStageRelease,0)) { - Boolean active = false; - e = HwrVibrateAttributes(0, kHwrVibrateActive, &active); - exists = (!e) ? true : exists; - } - } -#endif - } - - - return exists; -} - -void RumbleRun(Boolean active) { -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - if (active) { - UInt8 buf[] = { '\64', '\100' }; - TwDeviceControl(hRumble, 'play', buf, sizeof(buf)); - } else { - TwDeviceControl(hRumble, 'stop', 0, 0); - } - - } else -#endif - { -#ifndef PALMOS_ARM - UInt32 pattern = active ? 0xFF000000 : 0x00000000; - - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateActive, &active); -#endif - } - -} - -Boolean RumbleInit() { - Boolean done = false; - -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - Err e = TwDeviceOpen(&hRumble, "vibrator0", "w"); - done = (!e); - - } else -#endif - { -#ifndef PALMOS_ARM - if (RumbleExists()) { - UInt16 cycle = (SysTicksPerSecond())/2; - UInt32 pattern = 0xFF000000; - UInt16 delay = 1; - UInt16 repeat = 1; - - HwrVibrateAttributes(1, kHwrVibrateRate, &cycle); - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateDelay, &delay); - HwrVibrateAttributes(1, kHwrVibrateRepeatCount, &repeat); - - done = true; - } -#endif - } - return done; -} - -void RumbleRelease() { -#ifndef DISABLE_TAPWAVE - if (OPTIONS_TST(kOptDeviceZodiac)) { - TwDeviceClose(hRumble); - - } else -#endif - { -#ifndef PALMOS_ARM - UInt32 pattern = 0x00000000; - Boolean active = false; - - HwrVibrateAttributes(1, kHwrVibratePattern, &pattern); - HwrVibrateAttributes(1, kHwrVibrateActive, &active); -#endif - } -} diff --git a/backends/platform/PalmOS/Src/rumble.h b/backends/platform/PalmOS/Src/rumble.h deleted file mode 100644 index 680c0eb164..0000000000 --- a/backends/platform/PalmOS/Src/rumble.h +++ /dev/null @@ -1,34 +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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef __RUMBLE_H__ -#define __RUMBLE_H__ - -Boolean RumbleExists (); -void RumbleRun (Boolean active); -Boolean RumbleInit (); -void RumbleRelease (); - -#endif diff --git a/backends/platform/PalmOS/Src/snd_pa1.cpp b/backends/platform/PalmOS/Src/snd_pa1.cpp deleted file mode 100644 index ddaf6495f6..0000000000 --- a/backends/platform/PalmOS/Src/snd_pa1.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include - -#include "native.h" -#include "globals.h" - -#ifdef COMPILE_PA1SND -# include -#endif - - -static Int32 diffLookup[16] = { - 1,3,5,7,9,11,13,15, - -1,-3,-5,-7,-9,-11,-13,-15, -}; - -static Int32 indexScale[16] = { - 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266, - 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 /* same value for speedup */ -}; - -static int limit(int val,int min,int max) { - if (valmax) return max; - else return val; -} - -void pcm2adpcm(Int16 *src, UInt8 *dst, UInt32 length) { -#ifndef COMPILE_PA1SND -/* - if (OPTIONS_TST(kOptDeviceARM)) { - PnoDescriptor pno; - ARMPa1SndType userData = {src, dst, length}; - - MemPtr armP = _PnoInit(ARM_PA1SND, &pno); - _PnoCall(&pno, &userData); - _PnoFree(&pno, armP); - - return; - } -*/ - int data,val,diff; - int signal,step; -#else - long chan1, chan2; - long data,val,diff; - long signal,step; -#endif - - signal = 0; - step = 0x7F; - length >>= 3; // 16bit stereo -> 4bit mono - - do { - - // high nibble -#ifdef COMPILE_PA1SND - chan1 = ByteSwap16(*src); - src++; - chan2 = ByteSwap16(*src); - src++; - - diff = ((chan1 + chan2) >> 1) - signal; -#else - diff = ((*src++ + *src++) >> 1) - signal; -#endif - diff <<= 3; - diff /= step; - - val = abs(diff) >> 1; - - if (val > 7) val = 7; - if (diff < 0) val+= 8; - - signal+= (step * diffLookup[val]) >> 3; - signal = limit(signal, -32768, 32767); - - step = (step * indexScale[val]) >> 8; - step = limit(step, 0x7F, 0x6000); - - data = val; - - // low nibble -#ifdef COMPILE_PA1SND - chan1 = ByteSwap16(*src); - src++; - chan2 = ByteSwap16(*src); - src++; - - diff = ((chan1 + chan2) >> 1) - signal; -#else - diff = ((*src++ + *src++) >> 1) - signal; -#endif - diff <<= 3; - diff /= step; - - val = abs(diff) >> 1; - - if (val > 7) val = 7; - if (diff < 0) val+= 8; - - signal+= (step * diffLookup[val]) >> 3; - signal = limit(signal, -32768, 32767); - - step = (step * indexScale[val]) >> 8; - step = limit(step, 0x7F, 0x6000); - - data |= val << 4; - - *dst++ = (UInt8)data; - - } while (--length); - -} diff --git a/backends/platform/PalmOS/Src/stuffs.h b/backends/platform/PalmOS/Src/stuffs.h deleted file mode 100644 index 25bf17c8c6..0000000000 --- a/backends/platform/PalmOS/Src/stuffs.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef STUFFS_H -#define STUFFS_H - -enum { - kOptNone = 0, - kOptDeviceARM = 1 << 0x00, - kOptDeviceOS5 = 1 << 0x01, - kOptDeviceClie = 1 << 0x02, - kOptDeviceZodiac = 1 << 0x03, - kOptModeWide = 1 << 0x04, - kOptModeLandscape = 1 << 0x05, - kOptMode16Bit = 1 << 0x06, - kOptModeHiDensity = 1 << 0x07, - kOptCollapsible = 1 << 0x08, - kOptDisableOnScrDisp = 1 << 0x09, - kOpt5WayNavigatorV1 = 1 << 0x0A, - kOpt5WayNavigatorV2 = 1 << 0x0B, - kOptPalmSoundAPI = 1 << 0x0C, - kOptSonyPa1LibAPI = 1 << 0x0D, - kOptGoLcdAPI = 1 << 0x0E, - kOptLightspeedAPI = 1 << 0x0F, - kOptModeRotatable = 1 << 0x10, - - kOptDeviceProcX86 = 1 << 0x1F // DEBUG only -}; - -// WARNING : you need to define OPTIONS_DEF() -#define OPTIONS_TST(x) (OPTIONS_DEF() & (x)) -#define OPTIONS_SET(x) OPTIONS_DEF() |= (x) -#define OPTIONS_RST(x) OPTIONS_DEF() &= ~(x) - -#endif diff --git a/backends/platform/PalmOS/Src/vibrate.h b/backends/platform/PalmOS/Src/vibrate.h deleted file mode 100644 index 37604be5b7..0000000000 --- a/backends/platform/PalmOS/Src/vibrate.h +++ /dev/null @@ -1,61 +0,0 @@ -/********************************************************************** -** ** -** vibrate.h ** -** ** -** Definitions for setting/retrieving the state of the vibrator on ** -** PalmOS 4.x devices. These calls are not officially supported by ** -** Palm Inc and subsidiaries. It is not guaranteed that these calls ** -** will work at all or at least the same on every device. YOU ARE ** -** USING THESE ENTIRELY ON YOUR VERY OWN RISK ! ** -** ** -** Please send corrections to dseifert@dseifert.com ** -**********************************************************************/ - -#include - -/* HwrVibrateAttributes takes three arguments: -** Boolean set Should the setting be set (1) or retrieved (0) -** UInt32 setting what should be set -** void* value pointer to the value to set, or to store the -** retrieved setting -*/ - -Err HwrVibrateAttributes(Boolean set, UInt32 setting, void *value) - SYS_TRAP(sysTrapHwrVibrateAttributes); - -/* to determine whether the vibrator is supported on a specific device, you -** need to make sure that you are running on PalmOS 4.x (so that the -** trap exists), that the attention manager exists and you need to check -** whether HwrVibrateAttributes(0, 1, &active) returns an error code of -** 0. ('active' is a Boolean). -*/ - - -/***************************************************************/ -/* For the second parameter, the following defines can be used */ -/***************************************************************/ - -/* *value points to a Boolean stating the state of the vibrator */ -#define kHwrVibrateActive 1 - -/* *value points to a UInt16, specifying the length of one cycle. -** value is in ticks (1/100 seconds) */ -#define kHwrVibrateRate 2 - -/* *value points to a UInt32, specifying the pattern of vibrating -** -** example: -** 0xFFFFFFFF stay on, no vibrating -** 0x0F0F0F0F vibrate four times in equal intervals -** 0xAAAAAAAA vibrate really fast (not recommended) -** 0x0F0F0000 vibrate twice, then pause -*/ -#define kHwrVibratePattern 3 - -/* *value points to a UInt16, specifying the delay between two -** cycles in ticks */ -#define kHwrVibrateDelay 4 - -/* *value points to a UInt16 specifying the amount of repeats. */ -#define kHwrVibrateRepeatCount 5 - diff --git a/backends/platform/PalmOS/Src/zodiac_event.cpp b/backends/platform/PalmOS/Src/zodiac_event.cpp deleted file mode 100644 index f629c4cbd6..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_event.cpp +++ /dev/null @@ -1,100 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_zodiac.h" - -bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) { - if (ev->eType == keyUpEvent) { - switch (ev->data.keyDown.chr) { - case vchrActionLeft: - event.type = Common::EVENT_LBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrActionRight: - event.type = Common::EVENT_RBUTTONUP; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - } - - } else if (ev->eType == keyDownEvent) { - switch (ev->data.keyDown.chr) { - // F5 = menu - case vchrThumbWheelBack: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - event.kbd.flags = 0; - return true; - - case vchrTriggerLeft: - hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE); - return false; // not a key - - case vchrTriggerRight: - setFeatureState(kFeatureAspectRatioCorrection, 0); - return false; // not a key - - case vchrActionLeft: - event.type = Common::EVENT_LBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - case vchrActionRight: - event.type = Common::EVENT_RBUTTONDOWN; - event.mouse.x = _mouseCurState.x; - event.mouse.y = _mouseCurState.y; - return true; - - // skip text - case vchrActionDown: - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_PERIOD; - event.kbd.ascii = '.'; - event.kbd.flags = 0; - return true; - - // trun off - case vchrAutoOff: - case vchrPowerOff: - // pause the sound thread if any - if (_sound.active) - SndStreamPause(_soundEx.handle, true); - break; - - case vchrLateWakeup: - // resume the sound thread if any - if (_sound.active) - SndStreamPause(_soundEx.handle, false); - break; - } - - } - - return false; -} diff --git a/backends/platform/PalmOS/Src/zodiac_gfx.cpp b/backends/platform/PalmOS/Src/zodiac_gfx.cpp deleted file mode 100644 index 98c563e101..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_gfx.cpp +++ /dev/null @@ -1,309 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_zodiac.h" -#include "common/config-manager.h" -#include "rumble.h" - -static asm Err _TwGfxOpen(void **aResult, void *aInfoResult) { - stmfd sp!, {r4-r11,lr} - ldr r9, [r9] - ldr r9, [r9] - sub sp, sp, #0x24 - mov r6, r0 - mov r7, r1 - ldr pc, =0x200995F0 -} - -int OSystem_PalmZodiac::getDefaultGraphicsMode() const { - return GFX_WIDE; -} - -void OSystem_PalmZodiac::load_gfx_mode() { - Err e; - - if (_gfxLoaded) - return; - _gfxLoaded = true; - - // get command line config - _fullscreen = ConfMan.getBool("fullscreen"); // TODO : (NORMAL mode) - _ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone; - - // precalc ratio (WIDE mode) - _ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight); - _ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth); - - _offScreenP = (byte *)MemPtrNew(_screenWidth * _screenHeight); - - MemSet(_offScreenP, _screenWidth * _screenHeight, 0); - MemSet(_nativePal, sizeof(_nativePal), 0); - MemSet(_currentPalette, sizeof(_currentPalette), 0); - - UInt32 depth = 16; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - - _sysOldOrientation = SysGetOrientation(); - _sysOldTriggerState = PINGetInputTriggerState(); - SysSetOrientation(sysOrientationLandscape); - SysSetOrientationTriggerState(sysOrientationTriggerDisabled); - PINSetInputTriggerState(pinInputTriggerDisabled); - - gVars->indicator.on = Graphics::RGBToColor >(0,255,0); - gVars->indicator.off = Graphics::RGBToColor >(0,0,0); - - _screenH = WinGetDisplayWindow(); - _screenP = (byte *)BmpGetBits(WinGetBitmap(_screenH)); - - e = _TwGfxOpen((void **)&_gfxH, 0); - e = TwGfxGetPalmDisplaySurface(_gfxH, &_palmScreenP); - - // overlay buffer - TwGfxSurfaceInfoType nfo = { - sizeof(TwGfxSurfaceInfoType), - _screenWidth, _screenHeight, _screenWidth * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - e = TwGfxAllocSurface(_gfxH, &_overlayP, &nfo); - - // prepare main bitmap - _srcBmp.size = sizeof(TwGfxBitmapType); - _srcBmp.width = _screenWidth; - _srcBmp.height = _screenHeight; - _srcBmp.rowBytes = _screenWidth; - _srcBmp.pixelFormat = twGfxPixelFormat8bpp; - _srcBmp.data = _offScreenP; - _srcBmp.palette = (UInt16 *)_nativePal; - - _srcRect.x = 0; - _srcRect.y = 0; - _srcRect.w = _screenWidth; - _srcRect.h = _screenHeight; - - hotswap_gfx_mode(_mode); -} - -void OSystem_PalmZodiac::hotswap_gfx_mode(int mode) { - Err e; - TwGfxSetClip(_palmScreenP, 0); - WinSetDrawWindow(_screenH); - - _screenDest.w = _screenWidth; - _screenDest.h = _screenHeight; - - // prevent bad DIA redraw (Stat part) - if (mode == GFX_NORMAL) { - _redawOSD = true; - _stretched = (_screenWidth > gVars->screenWidth); - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); - - if (_stretched) { - calc_rect(false); - } else { - // offsets - _screenOffset.x = (gVars->screenWidth - _screenWidth) / 2; - _screenOffset.y = (gVars->screenHeight - _screenHeight) / 2; - - // clip Tapwave API - TwGfxRectType rt = { _screenOffset.x, _screenOffset.y, _screenWidth, _screenHeight }; - TwGfxSetClip(_palmScreenP, &rt); - } - - } else { - _redawOSD = false; - _stretched = true; - PINSetInputAreaState(pinInputAreaClosed); - StatHide(); - - calc_rect(true); - } - - if (_stretched) { - OPTIONS_SET(kOptDisableOnScrDisp); - TwGfxSetClip(_palmScreenP, &_dstRect); - - if (!_tmpScreenP) { - // wide buffer - TwGfxSurfaceInfoType nfo = { - sizeof(TwGfxSurfaceInfoType), - _screenWidth, _screenHeight, _screenWidth * 2, - twGfxLocationAcceleratorMemory, - twGfxPixelFormatRGB565_LE - }; - e = TwGfxAllocSurface(_gfxH, &_tmpScreenP, &nfo); - } - } else { - OPTIONS_RST(kOptDisableOnScrDisp); - if (_tmpScreenP) { - e = TwGfxFreeSurface(_tmpScreenP); - _tmpScreenP = NULL; - } - } - - _mode = mode; - _srcPos.x = _screenOffset.x; - _srcPos.y = _screenOffset.y; - clear_screen(); -// updateScreen(); -} - -void OSystem_PalmZodiac::unload_gfx_mode() { - Err e; - - if (!_gfxLoaded) - return; - _gfxLoaded = false; - - if (_tmpScreenP) { - e = TwGfxFreeSurface(_tmpScreenP); - _tmpScreenP = NULL; - } - - e = TwGfxFreeSurface(_overlayP); - e = TwGfxClose(_gfxH); - - UInt32 depth = 8; - WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL); - clear_screen(); - - MemPtrFree(_offScreenP); - - PINSetInputTriggerState(_sysOldTriggerState); - SysSetOrientation(_sysOldOrientation); - StatShow(); - PINSetInputAreaState(pinInputAreaOpen); -} - -static void rumblePack(Boolean active) { - if (!gVars->vibrator) - return; - - RumbleRun(active); -} - -void OSystem_PalmZodiac::int_setShakePos(int shakeOffset) { - if (shakeOffset == 0) - rumblePack(false); -} - -void OSystem_PalmZodiac::updateScreen() { - Err e; - - // draw the mouse pointer - draw_mouse(); - - // update the screen - if (_overlayVisible) { - if (_stretched) { - TwGfxRectType dst = {_dstRect.x, _dstRect.y, _dstRect.w, _dstRect.h}; - e = TwGfxStretchBlt2(_palmScreenP, &dst, _overlayP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); - } else { - e = TwGfxBitBlt(_palmScreenP, &_srcPos, _overlayP, &_srcRect); - } - - } else { - if (_stretched) { - TwGfxPointType pos = {0, 0}; - TwGfxRectType dst = {_dstRect.x, _dstRect.y, _dstRect.w, _dstRect.h}; - - if (_new_shake_pos != _current_shake_pos) { - TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _dstRect.w, _new_shake_pos }; - - if (_new_shake_pos != 0) { - TwGfxFillRect(_palmScreenP, &r, 0); - rumblePack(_new_shake_pos >= 3); - } - r.y += dst.h; - r.h = _current_shake_pos; - TwGfxFillRect(_palmScreenP, &r, 0); - - _current_shake_pos = _new_shake_pos; - dst.y += _new_shake_pos; - } - e = TwGfxDrawBitmap(_tmpScreenP, &pos, &_srcBmp); - e = TwGfxWaitForVBlank(_gfxH); - e = TwGfxStretchBlt2(_palmScreenP, &dst, _tmpScreenP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); - - } else { - TwGfxPointType pos = {_srcPos.x, _srcPos.y}; - - if (_new_shake_pos != _current_shake_pos) { - if (_new_shake_pos != 0) { - TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _screenWidth, _new_shake_pos }; - TwGfxFillRect(_palmScreenP, &r, 0); - rumblePack(_new_shake_pos >= 3); - } - _current_shake_pos = _new_shake_pos; - pos.y += _new_shake_pos; - } - e = TwGfxDrawBitmap(_palmScreenP, &pos, &_srcBmp); - } - } - - // undraw the mouse - undraw_mouse(); -} - -void OSystem_PalmZodiac::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) { - if (_mode != GFX_NORMAL) - return; - MemHandle hTemp = DmGetResource(bitmapRsc, id + 100); - - if (hTemp) { - RGBColorType oldRGB; - static const RGBColorType pal[4] = { - {0,0,255,0}, - {0,255,255,0}, - {0,255,0,0}, - {0,0,0,0} - }; - - BitmapType *bmTemp; - bmTemp = (BitmapType *)MemHandleLock(hTemp); - - Coord w, h; - WinGetBitmapDimensions(bmTemp, &w, &h); // return the size of the low density bmp - - PointType dst = { _screenOffset.x + x, _screenOffset.y + y }; - RectangleType c, r = { dst.x, dst.y, w * 2, h * 2 }; - - UInt16 old = WinSetCoordinateSystem(kCoordinatesNative); - WinSetDrawWindow(_screenH); - if (show) { - WinSetForeColorRGB(&pal[3], &oldRGB); - WinSetBackColorRGB(&pal[color], &oldRGB); - WinPaintBitmap(bmTemp, dst.x, dst.y); - } else { - WinSetBackColorRGB(&pal[3], &oldRGB); - WinFillRectangle(&r, 0); - } - WinSetCoordinateSystem(old); - - MemPtrUnlock(bmTemp); - DmReleaseResource(hTemp); - } -} diff --git a/backends/platform/PalmOS/Src/zodiac_mouse.cpp b/backends/platform/PalmOS/Src/zodiac_mouse.cpp deleted file mode 100644 index 39a789aaa1..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_mouse.cpp +++ /dev/null @@ -1,153 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_zodiac.h" - -void OSystem_PalmZodiac::draw_mouse() { - if (!_mouseDataP || _mouseDrawn || !_mouseVisible) - return; - - byte *src = _mouseDataP; - - int x = _mouseCurState.x - _mouseHotspotX; - int y = _mouseCurState.y - _mouseHotspotY; - int w = _mouseCurState.w; - int h = _mouseCurState.h; - - // clip the mouse rect - if (y < 0) { - src -= y * w; - h += y; - y = 0; - } - if (x < 0) { - src -= x; - w += x; - x = 0; - } - - if (h > _screenHeight - y) - h = _screenHeight - y; - if (w > _screenWidth - x) - w = _screenWidth - x; - - if (w <= 0 || h <= 0) - return; - - // store the bounding box so that undraw mouse can restore the area the - // mouse currently covers to its original content - _mouseOldState.x = x; - _mouseOldState.y = y; - _mouseOldState.w = w; - _mouseOldState.h = h; - - byte color; - int ww; - - if (_overlayVisible) { - uint16 *bak = (uint16 *)_mouseBackupP; - uint16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal; - uint16 *dst; - - TwGfxLockSurface(_overlayP, (void **)&dst); - dst += y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = pal[color]; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - - TwGfxUnlockSurface(_overlayP, true); - - } else { - byte *bak = _mouseBackupP; - byte *dst =_offScreenP + y * _screenWidth + x; - - do { - ww = w; - do { - *bak++ = *dst; - color = *src++; - - // transparent, don't draw - if (color != _mouseKeyColor) - *dst = color; - dst++; - } while (--ww); - - src += _mouseCurState.w - w; - dst += _screenWidth - w; - } while (--h); - } - - _mouseDrawn = true; -} - -void OSystem_PalmZodiac::undraw_mouse() { - if (!_mouseDrawn) - return; - - int h = _mouseOldState.h; - - // no need to do clipping here, since draw_mouse() did that already - if (_overlayVisible) { - uint16 *dst; - uint16 *bak = (uint16 *)_mouseBackupP; - - TwGfxLockSurface(_overlayP, (void **)&dst); - dst += _mouseOldState.y * _screenWidth + _mouseOldState.x; - - do { - MemMove(dst, bak, _mouseOldState.w * 2); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - - TwGfxUnlockSurface(_overlayP, true); - - } else { - byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x; - byte *bak = _mouseBackupP; - - do { - MemMove(dst, bak, _mouseOldState.w); - dst += _screenWidth; - bak += _mouseOldState.w; - } while (--h); - } - - _mouseDrawn = false; -} diff --git a/backends/platform/PalmOS/Src/zodiac_overlay.cpp b/backends/platform/PalmOS/Src/zodiac_overlay.cpp deleted file mode 100644 index f8322e8fa5..0000000000 --- a/backends/platform/PalmOS/Src/zodiac_overlay.cpp +++ /dev/null @@ -1,67 +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. - * - * $URL$ - * $Id$ - * - */ - -#include "be_zodiac.h" -#include "common/endian.h" - -void OSystem_PalmZodiac::clearOverlay() { - if (!_overlayVisible) - return; - - Err e; - TwGfxPointType pos = {0, 0}; - TwGfxBitmapType bmp = { - sizeof(TwGfxBitmapType), - _screenWidth, _screenHeight, _screenWidth, twGfxPixelFormat8bpp, - (void *)_offScreenP, (UInt16 *)_nativePal - }; - e = TwGfxDrawBitmap(_overlayP, &pos, &bmp); -} - -void OSystem_PalmZodiac::grabOverlay(OverlayColor *buf, int pitch) { - Err e; - OverlayColor *src; - - e = TwGfxLockSurface(_overlayP, (void **)&src); - int h = _screenHeight; - do { - memcpy(buf, src, _screenWidth * 2); - src += _screenWidth; - buf += pitch; - } while (--h); - - e = TwGfxUnlockSurface(_overlayP, 0); -} - -void OSystem_PalmZodiac::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - Err e; - TwGfxPointType pos = {x, y}; - TwGfxBitmapType bmp = { - sizeof(TwGfxBitmapType), - w, h, pitch * 2 , twGfxPixelFormatRGB565_LE, - (void *)buf, 0 - }; - e = TwGfxDrawBitmap(_overlayP, &pos, &bmp); -} diff --git a/backends/platform/PalmOS/arm.bat b/backends/platform/PalmOS/arm.bat deleted file mode 100755 index 547ae391fe..0000000000 --- a/backends/platform/PalmOS/arm.bat +++ /dev/null @@ -1,3 +0,0 @@ -as.exe --defsym PALMOS_MODE=1 ../../../sound/rate_arm_asm.s -o Obj/rate_arm_asm.o -as.exe --defsym PALMOS_MODE=1 ../../../engines/scumm/gfxARM.s -o Obj/gfxARM.o -as.exe --defsym PALMOS_MODE=1 ../../../engines/scumm/smush/codec47ARM.s -o Obj/codec47ARM.o diff --git a/backends/platform/PalmOS/scummvm.mcp b/backends/platform/PalmOS/scummvm.mcp deleted file mode 100644 index a01967d059..0000000000 Binary files a/backends/platform/PalmOS/scummvm.mcp and /dev/null differ -- cgit v1.2.3 From 58a1fbc13c116d3fa69c426c0cdeb459d354fbf0 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 18 Jul 2010 06:49:56 +0000 Subject: Made memcpy faster but not as fast with uncached mem. svn-id: r50980 --- backends/platform/psp/display_client.cpp | 15 +- backends/platform/psp/memory.cpp | 627 ++++++++++++++++++++----------- backends/platform/psp/memory.h | 211 +++++++---- backends/platform/psp/module.mk | 3 +- backends/platform/psp/psp_main.cpp | 11 +- 5 files changed, 559 insertions(+), 308 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp index c5a6250188..71b505ec7c 100644 --- a/backends/platform/psp/display_client.cpp +++ b/backends/platform/psp/display_client.cpp @@ -340,11 +340,17 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u if (pitch == realWidthInBytes && pitch == recWidthInBytes) { //memcpy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth)); - Copier::copy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth), _pixelFormat); + else + PspMemory::fastCopy(dst, buf, _pixelFormat.pixelsToBytes(recHeight * recWidth)); } else { do { //memcpy(dst, buf, recWidthInBytes); - Copier::copy(dst, buf, recWidthInBytes, &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, buf, recWidthInBytes, _pixelFormat); + else + PspMemory::fastCopy(dst, buf, recWidthInBytes); buf += pitch; dst += realWidthInBytes; } while (--recHeight); @@ -363,7 +369,10 @@ void Buffer::copyToArray(byte *dst, int pitch) { do { //memcpy(dst, src, sourceWidthInBytes); - Copier::copy(dst, src, sourceWidthInBytes, &_pixelFormat); + if (_pixelFormat.swapRB) + PspMemory::fastSwap(dst, src, sourceWidthInBytes, _pixelFormat); + else + PspMemory::fastCopy(dst, src, sourceWidthInBytes); src += realWidthInBytes; dst += pitch; } while (--h); diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp index e134a7d0f4..d66650aee5 100644 --- a/backends/platform/psp/memory.cpp +++ b/backends/platform/psp/memory.cpp @@ -1,223 +1,404 @@ -/* 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. - * - * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#include "common/scummsys.h" -#include "common/singleton.h" -#include "common/list.h" -#include "backends/platform/psp/psppixelformat.h" -#include "backends/platform/psp/memory.h" - -// Class Copier -------------------------------------------------------------------------- -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - -void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) { - DEBUG_ENTER_FUNC(); - - uint32 prefixDst = (((uint32)dst) & 0x3); - prefixDst = prefixDst ? 4 - prefixDst : 0; // prefix only if we have address % 4 != 0 - uint32 prefixSrc = (((uint32)src) & 0x3); - prefixSrc = prefixSrc ? 4 - prefixSrc : 0; // prefix only if we have address % 4 != 0 - uint32 *dst32, *src32; - bool swapRB = format ? format->swapRB : false; // take swap value from pixelformat if it's given -#ifdef __PSP_DEBUG_PRINT__ - uint32 debugBytes = bytes; - const byte *debugDst = dst, *debugSrc = src; -#endif - uint32 words, remainingBytes; - - //PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%d], swap[%s], prefixDst[%u], prefixSrc[%u]\n", dst, src, bytes, swapRB ? "true" : "false", prefixDst, prefixSrc); - - if (prefixDst || prefixSrc) { // we're not aligned to word boundaries - if (prefixDst != prefixSrc) { // worst case: we can never be aligned. this mode is highly inefficient. try to get engines not to use this mode too much - PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src, dst); - if ((prefixDst & 1) || (prefixSrc & 1)) - copy8(dst, src, bytes); // no swap is possible on 8 bit - else - copy16((uint16 *)dst, (uint16 *)src, bytes, format); - - goto test; - } - - // Do the prefix: the part to get us aligned - if (prefixDst & 1) { // byte - copy8(dst, src, prefixDst); // no swap available - } else { // short - copy16((uint16 *)dst, (uint16 *)src, prefixDst, format); - } - if (bytes > prefixDst) // check that we can afford to subtract from bytes - bytes -= prefixDst; - else { - return; - } - dst32 = (uint32 *)(dst + prefixDst); - src32 = (uint32 *)(src + prefixSrc); - } else { // We're aligned to word boundaries - dst32 = (uint32 *)dst; - src32 = (uint32 *)src; - } - - words = bytes >> 2; - remainingBytes = bytes & 0x3; - - if (swapRB) { // need to swap - for (; words > 0; words--) { - *dst32 = format->swapRedBlue32(*src32); - dst32++; - src32++; - } - } else { // no swapping - for (; words > 0; words--) { - *dst32 = *src32; - dst32++; - src32++; - } - } - - // Do any remaining bytes - if (remainingBytes) { - if (remainingBytes & 1) // we have bytes left - copy8((byte *)dst32, (byte *)src32, remainingBytes); - else // 16bits left - copy16((uint16*)dst32, (uint16 *)src32, remainingBytes, format); - } - -test: - // debug -#ifdef __PSP_DEBUG_PRINT__ - bool mismatch = false; - - for (uint32 i = 0; i < debugBytes; i++) { - if (debugDst[i] != debugSrc[i]) { - if (mismatch == false) { - PSP_DEBUG_PRINT_SAMELN("mismatch in copy:\n"); - PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u], swap[%s], prefixDst[%u], prefixSrc[%u]\n", debugDst, debugSrc, debugBytes, swapRB ? "true" : "false", prefixDst, prefixSrc); - mismatch = true; - } - PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); - } - } - if (mismatch) - PSP_DEBUG_PRINT("\n"); -#endif - - return; // So we have something to jump to with the label -} - -inline void Copier::copy8(byte *dst, const byte *src, uint32 bytes) { - for (; bytes > 0; bytes--) { - *dst = *src; - dst++; - src++; - } -} - -inline void Copier::copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format /* = NULL */) { - uint32 shorts = bytes >> 1; - uint32 remainingBytes = bytes & 1; - bool swapRB = format ? format->swapRB : false; - - if (swapRB) { - for (; shorts > 0 ; shorts--) { - *dst = format->swapRedBlue16(*src); - dst++; - src++; - } - } else { - for (; shorts > 0 ; shorts--) { - *dst = *src; - dst++; - src++; - } - } - if (remainingBytes) - *(byte *)dst = *(byte *)src; -} - - -// Class VramAllocator ----------------------------------- - -DECLARE_SINGLETON(VramAllocator) - -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - - -void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { - DEBUG_ENTER_FUNC(); - assert(size > 0); - - byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; - Common::List::iterator i; - - // Find a block that fits, starting from the beginning - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - byte *currAddress = (*i).address; - - if (currAddress - lastAddress >= size) // We found a match - break; - - if ((*i).getEnd() > lastAddress) - lastAddress = (byte *)(*i).getEnd(); - } - - if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { - PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", - size, _bytesAllocated); - return NULL; - } - - _allocList.insert(i, Allocation(lastAddress, size)); - _bytesAllocated += size; - - PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); - PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - - return lastAddress; -} - -// Deallocate a block from VRAM -void VramAllocator::deallocate(void *address) { - DEBUG_ENTER_FUNC(); - address = (byte *)CACHED(address); // Make sure all addresses are the same - - Common::List::iterator i; - - // Find the Allocator to deallocate - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - if ((*i).address == address) { - _bytesAllocated -= (*i).size; - _allocList.erase(i); - PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); - return; - } - } - - PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); -} +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include "common/singleton.h" +#include "common/list.h" +#include "backends/platform/psp/PSPPixelFormat.h" +#include "backends/platform/psp/memory.h" + +// Class Copier -------------------------------------------------------------------------- +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +//#define TEST_MEMORY_COPY + +// swapRB is used to swap red and blue in the display +void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const byte *debugDst = dst, *debugSrc = src; +#endif + + PSP_DEBUG_PRINT("copy(): dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst) & 0x3); + + if (prefixDst) { + prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0 + PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst); + + bytes -= prefixDst; // remember we assume bytes >= 4 + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + copy8(dst, src, bytes); +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif + return; + } + + while (prefixDst--) { + *dst++ = *src++; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); + } else { + copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); + } + +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif +} + +void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { + + bool mismatch = false; + PSP_INFO_PRINT("testing memcpy..."); + + for (uint32 i = 0; i < debugBytes; i++) { + if (debugDst[i] != debugSrc[i]) { + if (mismatch == false) { + PSP_DEBUG_PRINT_SAMELN("**** mismatch in copy! ****\n"); + PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); + } + } + if (mismatch) { + PSP_DEBUG_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + +// +// used to swap red and blue +void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix + + if (prefixDst) { + bytes -= prefixDst; // remember we assume bytes > 4 + *dst16++ = *src16++; + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { // check if it's worthwhile to continue + swap16(dst16, src16, bytes, format); + return; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src16) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); + swap32Misaligned((uint32 *)dst16, (uint16 *)src16, bytes, format); + } else { + swap32Aligned((uint32 *)dst16, (uint32 *)src16, bytes, format); + } +} + +void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { + PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); + + int words8 = bytes >> 5; + + // try blocks of 8 words at a time + if (words8) { + while (words8--) { + dst32[0] = src32[0]; + dst32[1] = src32[1]; + dst32[2] = src32[2]; + dst32[3] = src32[3]; + dst32[4] = src32[4]; + dst32[5] = src32[5]; + dst32[6] = src32[6]; + dst32[7] = src32[7]; + dst32 += 8; + src32 += 8; + } + } + + int words4 = (bytes & 0x1F) >> 4; + + // try blocks of 4 words at a time + if (words4) { + dst32[0] = src32[0]; + dst32[1] = src32[1]; + dst32[2] = src32[2]; + dst32[3] = src32[3]; + dst32 += 4; + src32 += 4; + } + + int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above + int wordsLeft = bytesLeft >> 2; + + // now just do single words + while (wordsLeft) { + *dst32++ = *src32++; + wordsLeft--; + } + + bytesLeft = bytes & 0x3; // get remaining bytes + + PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); + + byte *dst = (byte *)dst32; + byte *src = (byte *)src32; + + while (bytesLeft--) { + *dst++ = *src++; + } +} + +void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + int words = bytes >> 2; + + // try blocks of 4 words at a time + for (; words - 4 >= 0; words -= 4) { + dst32[0] = format.swapRedBlue32(src32[0]); + dst32[1] = format.swapRedBlue32(src32[1]); + dst32[2] = format.swapRedBlue32(src32[2]); + dst32[3] = format.swapRedBlue32(src32[3]); + dst32 += 4; + src32 += 4; + } + + // now just do words + for (; words > 0; words--) { + *dst32++ = format.swapRedBlue32(*src32++); + } + + uint32 remainingBytes = bytes & 0x3; + + if (remainingBytes) { // for swap, must be a 16 bit value + *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); // only 1 short left + } +} + + +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { + PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); + + uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment + uint32 offset; + + switch (alignSrc) { + case 1: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); + break; + case 2: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); + break; + case 3: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); + break; + } + + uint32 remainingBytes = bytes & 3; + + if (remainingBytes) { + byte *dst = (byte *)dst32; + src += offset; + dst += offset; + copy8(dst, src, remainingBytes); + } +} + +// returns offset in dst +uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { + uint32 *origDst32 = dst32; + register uint32 dstWord, srcWord; + + PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], words[%d]\n", alignSrc, dst32, src32, words); + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + + srcWord = src32[0]; + + while (words4--) { + dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << lastShiftValue; + dst32[0] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << lastShiftValue; + dst32[1] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << lastShiftValue; + dst32[2] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << lastShiftValue; + dst32[3] = dstWord; + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + srcWord = *src32++; + + while (words--) { + dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << lastShiftValue; + *dst32++ = dstWord; + } + } + + return (byte *)dst32 - (byte *)origDst32; +} +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + if (bytes < MIN_AMOUNT_FOR_MISALIGNED_COPY) { // less than a certain number of bytes it's just not worth it + swap16((uint16 *)dst32, src16, bytes, format); + return; + } + + int words = bytes >> 2; + uint32 remainingBytes = bytes & 3; + + uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment + + // we read one word ahead of what we write + // setup the first read + uint32 lastWord = ((*src32++) >> 16) & 0xFFFF; + + for (; words; words--) { + uint32 srcWord = *src32++; + uint32 curWord = (srcWord >> 16) & 0xFFFF; + lastWord |= (srcWord & 0xFFFF) << 16; // take the part of the src that belongs to this word + *dst32++ = format.swapRedBlue32(lastWord); + lastWord = curWord; + } + + if (remainingBytes) { // add in the remaining stuff + *(uint16 *)dst32 = format.swapRedBlue16((uint16)lastWord); + } +} + +inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { + PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + + uint32 shorts = bytes >> 1; + uint32 remainingBytes = bytes & 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = *src16++; + } + if (remainingBytes) + *(byte *)dst16 = *(byte *)src16; +} + +// Class VramAllocator ----------------------------------- + +DECLARE_SINGLETON(VramAllocator) + +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + + +void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { + DEBUG_ENTER_FUNC(); + assert(size > 0); + + byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; + Common::List::iterator i; + + // Find a block that fits, starting from the beginning + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + byte *currAddress = (*i).address; + + if (currAddress - lastAddress >= size) // We found a match + break; + + if ((*i).getEnd() > lastAddress) + lastAddress = (byte *)(*i).getEnd(); + } + + if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { + PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", + size, _bytesAllocated); + return NULL; + } + + _allocList.insert(i, Allocation(lastAddress, size)); + _bytesAllocated += size; + + PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); + PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); + + return lastAddress; +} + +// Deallocate a block from VRAM +void VramAllocator::deallocate(void *address) { + DEBUG_ENTER_FUNC(); + address = (byte *)CACHED(address); // Make sure all addresses are the same + + Common::List::iterator i; + + // Find the Allocator to deallocate + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + if ((*i).address == address) { + _bytesAllocated -= (*i).size; + _allocList.erase(i); + PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); + return; + } + } + + PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); +} diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index a198095090..81a77cca1c 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -1,80 +1,131 @@ - -/* 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. - * - * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#ifndef PSP_MEMORY_H -#define PSP_MEMORY_H - -#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ -#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ - -/** - * Class that does memory copying and swapping if needed - */ -class Copier { -public: - static void copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *format = NULL); - static void copy8(byte *dst, const byte *src, uint32 bytes); - static void copy16(uint16 *dst, const uint16 *src, uint32 bytes, PSPPixelFormat *format = NULL); -}; - -/** - * Class that allocates memory in the VRAM - */ -class VramAllocator : public Common::Singleton { -public: - VramAllocator() : _bytesAllocated(0) {} - void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes - void deallocate(void *pointer); - - static inline bool isAddressInVram(void *address) { - if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) - return true; - return false; - } - - -private: - /** - * Used to allocate in VRAM - */ - struct Allocation { - byte *address; - uint32 size; - void *getEnd() { return address + size; } - Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} - Allocation() : address(0), size(0) {} - }; - - enum { - VRAM_START_ADDRESS = 0x04000000, - VRAM_END_ADDRESS = 0x04200000, - VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations - }; - Common::List _allocList; // List of allocations - uint32 _bytesAllocated; -}; - -#endif /* PSP_MEMORY_H */ + +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#ifndef PSP_MEMORY_H +#define PSP_MEMORY_H + +#include "backends/platform/psp/psppixelformat.h" +#include "common/list.h" + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 +#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 + +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +/** + * Class that does memory copying and swapping if needed + */ +class PspMemory { +private: + static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); + static void copy(byte *dst, const byte *src, uint32 bytes); + static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); + static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); + static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); + static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); + static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); + + // For swapping, we know that we have multiples of 16 bits + static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + uint32 shorts = bytes >> 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = format.swapRedBlue16(*src16++); + } + } + + static void copy8(byte *dst, const byte *src, uint32 bytes) { + PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + while (bytes--) { + *dst++ = *src++; + } + } + +public: + // This is the interface to the outside world + static void fastCopy(byte *dst, const byte *src, uint32 bytes) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { + copy8(dst, src, bytes); + } else { // go to more powerful copy + copy(dst, src, bytes); + } + } + + static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { + swap16((uint16 *)dst, (uint16 *)src, bytes, format); + } else { // go to more powerful copy + swap((uint16 *)dst, (uint16 *)src, bytes, format); + } + } +}; + +/** + * Class that allocates memory in the VRAM + */ +class VramAllocator : public Common::Singleton { +public: + VramAllocator() : _bytesAllocated(0) {} + void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes + void deallocate(void *pointer); + + static inline bool isAddressInVram(void *address) { + if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) + return true; + return false; + } + + +private: + /** + * Used to allocate in VRAM + */ + struct Allocation { + byte *address; + uint32 size; + void *getEnd() { return address + size; } + Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} + Allocation() : address(0), size(0) {} + }; + + enum { + VRAM_START_ADDRESS = 0x04000000, + VRAM_END_ADDRESS = 0x04200000, + VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations + }; + Common::List _allocList; // List of allocations + uint32 _bytesAllocated; +}; + +#endif /* PSP_MEMORY_H */ diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk index e9c896acfd..855554e980 100644 --- a/backends/platform/psp/module.mk +++ b/backends/platform/psp/module.mk @@ -16,7 +16,8 @@ MODULE_OBJS := powerman.o \ audio.o \ thread.o \ rtc.o \ - mp3.o + mp3.o \ + tests.o MODULE_DIRS += \ backends/platform/psp/ diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index c26aed539e..b84702115f 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -44,12 +44,15 @@ #include "backends/plugins/psp/psp-provider.h" #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" +#include "backends/platform/psp/tests.h" #include "backends/platform/psp/trace.h" #ifdef ENABLE_PROFILING #include #endif +#define ENABLE_TESTS /* to enable tests of PSP architecture */ + /** * Define the module info section * @@ -153,7 +156,7 @@ int SetupCallbacks(void) { #undef main int main(void) { //change clock rate to 333mhz - scePowerSetClockFrequency(333, 333, 166); + scePowerSetClockFrequency(222, 222, 111); PowerManager::instance(); // Setup power manager @@ -169,6 +172,12 @@ int main(void) { PluginManager::instance().addPluginProvider(new PSPPluginProvider()); #endif +#ifdef ENABLE_TESTS + PSP_INFO_PRINT("running tests\n"); + tests(); + sceKernelSleepThread(); +#endif + int res = scummvm_main(argc, argv); g_system->quit(); // TODO: Consider removing / replacing this! -- cgit v1.2.3 From 844a332f8de4ab74ec1c739c2ab6f41e8d957d53 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 18 Jul 2010 06:59:25 +0000 Subject: PSP: forgot test files svn-id: r50981 --- backends/platform/psp/tests.cpp | 656 ++++++++++++++++++++++++++++++++++++++++ backends/platform/psp/tests.h | 26 ++ 2 files changed, 682 insertions(+) create mode 100644 backends/platform/psp/tests.cpp create mode 100644 backends/platform/psp/tests.h (limited to 'backends') diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp new file mode 100644 index 0000000000..25c07fd723 --- /dev/null +++ b/backends/platform/psp/tests.cpp @@ -0,0 +1,656 @@ +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "backends/platform/psp/rtc.h" +#include "backends/platform/psp/thread.h" +#include "backends/platform/psp/memory.h" + + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +//#define __PSP_DEBUG_FUNCS__ +//#define __PSP_DEBUG_PRINT__ + +// Results: (333Mhz/222Mhz) +// Getting a tick: 1-2 us +// Getting a time structure: 9/14us +// ie. using a tick and just dividing by 1000 saves us time. + +#include "backends/platform/psp/trace.h" + +void test_ticks() { + uint32 ticksPerSecond = sceRtcGetTickResolution(); + PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond); + + uint32 currentTicks1[2]; + uint32 currentTicks2[2]; + + sceRtcGetCurrentTick((u64 *)currentTicks1); + sceRtcGetCurrentTick((u64 *)currentTicks2); + PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks1[0], currentTicks1[1], currentTicks1[0], currentTicks1[1]); + PSP_INFO_PRINT("current tick[%x %x][%u %u]\n", currentTicks2[0], currentTicks2[1], currentTicks2[0], currentTicks2[1]); + + pspTime time; + sceRtcSetTick(&time, (u64 *)currentTicks2); + PSP_INFO_PRINT("current tick in time, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time.year, time.month, time.day, time.hour, time.minutes, time.seconds, time.microseconds); + + pspTime time1; + pspTime time2; + sceRtcGetCurrentClockLocalTime(&time1); + sceRtcGetCurrentClockLocalTime(&time2); + PSP_INFO_PRINT("time1, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time1.year, time1.month, time1.day, time1.hour, time1.minutes, time1.seconds, time1.microseconds); + PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds); +} + +void test_getMicros() { + uint32 time1, time2, time3, time4; + time1 = PspRtc::instance().getMicros(); + time2 = PspRtc::instance().getMicros(); + time3 = PspRtc::instance().getMicros(); + time4 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1); +} + +void read_and_time(uint32 bytes, char *buffer, FILE *file) { + uint32 time1 = PspRtc::instance().getMicros(); + // test minimal read + fread(buffer, bytes, 1, file); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Reading %d byte takes %dus\n", bytes, time2-time1); +} + +/* + 333MHz/222MHz + Reading 1 byte takes 2590us / 3167 + Reading 10 byte takes 8us / 9 + Reading 50 byte takes 8us / 11 + Reading 100 byte takes 8us / 11 + Reading 1000 byte takes 915us / 1131 + Reading 1000 byte takes 911us + Reading 1000 byte takes 914us + Reading 1000 byte takes 943us + Reading 1000 byte takes 915us + Reading 1000 byte takes 923us + Reading 1000 byte takes 22us + Reading 1000 byte takes 916us + Reading 1000 byte takes 913us / 1,120 + Reading 1000 byte takes 909us / 1,122 + Reading 2000 byte takes 1806us / 2,284 + Reading 3000 byte takes 2697us / 3,374 + Reading 4000 byte takes 3652us / 4,592 + Reading 5000 byte takes 4551us / 5,544 + Reading 6000 byte takes 5356us / 6,676 + Reading 7000 byte takes 6800us / 8,358 + Reading 8000 byte takes 6794us / 8,454 + Reading 9000 byte takes 6782us / 8,563 + Reading 10000 byte takes 8497us / 10,631 + Reading 30000 byte takes 25995us / 32,473 + Reading 50000 byte takes 42467us / 52,893 + Reading 80000 byte takes 68457us / 85,291 + Reading 100000 byte takes 85103us / 106,163 + Reading 500000 byte takes 427337us / 531,679 + Reading 1000000 byte takes 854831us / 1,063,107 +*/ +// Function to test the impact of MS reads +// These tests can't be done from shell - the cache screws them up +void test_ms_reads() { + FILE *file; + file = fopen("ms0:/psp/music/track1.mp3", "r"); + + char *buffer = (char *)malloc(2 * 1024 * 1024); + + read_and_time(1, buffer, file); + read_and_time(10, buffer, file); + read_and_time(50, buffer, file); + read_and_time(100, buffer, file); + for (int i = 0; i< 10; i++) + read_and_time(1000, buffer, file); + read_and_time(2000, buffer, file); + read_and_time(3000, buffer, file); + read_and_time(4000, buffer, file); + read_and_time(5000, buffer, file); + read_and_time(6000, buffer, file); + read_and_time(7000, buffer, file); + read_and_time(8000, buffer, file); + read_and_time(9000, buffer, file); + read_and_time(10000, buffer, file); + read_and_time(30000, buffer, file); + read_and_time(50000, buffer, file); + read_and_time(80000, buffer, file); + read_and_time(100000, buffer, file); + read_and_time(500000, buffer, file); + read_and_time(1000000, buffer, file); + + fclose(file); + free(buffer); +} + +void seek_and_time(int bytes, int origin, FILE *file) { + char buffer[1000]; + + uint32 time1 = PspRtc::instance().getMicros(); + // test minimal read + fseek(file, bytes, origin); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Seeking %d byte from %d took %dus\n", bytes, origin, time2-time1); + + time1 = PspRtc::instance().getMicros(); + // test minimal read + fread(buffer, 1000, 1, file); + time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Reading 1000 bytes took %dus\n", time2-time1); +} + +/* +333MHz +Seeking 0 byte from 0 took 946us +Reading 1000 bytes took 1781us +Seeking 5 byte from 0 took 6us +Reading 1000 bytes took 19us +Seeking 1000 byte from 0 took 5us +Reading 1000 bytes took 913us +Seeking 100 byte from 0 took 955us +Reading 1000 bytes took 906us +Seeking 10000 byte from 0 took 963us +Reading 1000 bytes took 905us +Seeking -5 byte from 1 took 1022us +Reading 1000 bytes took 949us +Seeking -100 byte from 1 took 1040us +Reading 1000 bytes took 907us +Seeking 100 byte from 1 took 1044us +Reading 1000 bytes took 930us +Seeking 0 byte from 2 took 7211us +Reading 1000 bytes took 80us +Seeking 10000 byte from 2 took 3636us +Reading 1000 bytes took 110us +*/ + +void test_seeks() { + FILE *file; + file = fopen("ms0:/psp/music/track1.mp3", "r"); + + seek_and_time(0, SEEK_SET, file); + seek_and_time(5, SEEK_SET, file); + seek_and_time(1000, SEEK_SET, file); + seek_and_time(100, SEEK_SET, file); + seek_and_time(10000, SEEK_SET, file); + seek_and_time(-5, SEEK_CUR, file); + seek_and_time(-100, SEEK_CUR, file); + seek_and_time(100, SEEK_CUR, file); + seek_and_time(0, SEEK_END, file); + seek_and_time(-10000, SEEK_END, file); + + fclose(file); +} + +// 222: 5-7us +int testGetThreadId() { + uint32 time1 = PspRtc::instance().getMicros(); + int threadId = sceKernelGetThreadId(); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Getting thread ID %d took %dus\n", threadId, time2-time1); + + return threadId; +} + +// 222: 4-5us +void testGetPriority() { + uint32 time1 = PspRtc::instance().getMicros(); + int priority = sceKernelGetThreadCurrentPriority(); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Getting thread priority %d took %dus\n", priority, time2-time1); +} + +// 222: 9-10us +void testChangePriority(int id, int priority) { + uint32 time1 = PspRtc::instance().getMicros(); + sceKernelChangeThreadPriority(id, priority); + uint32 time2 = PspRtc::instance().getMicros(); + + PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1); +} + +void test_thread() { + int id; + id = testGetThreadId(); + testGetThreadId(); + testGetPriority(); + testGetPriority(); + testChangePriority(id, 30); + testChangePriority(id, 35); + testChangePriority(id, 25); + + // test context switch time + for (int i=0; i<10; i++) { + uint time1 = PspRtc::instance().getMicros(); + PspThread::delayMicros(0); + uint time2 = PspRtc::instance().getMicros(); + PSP_INFO_PRINT("poll %d. context switch Time = %dus\n", i, time2-time1); // 10-15us + } +} + +int test_mem_read(uint32 words) { + uint32 __attribute__((aligned(64))) buffer[1024]; + register uint32 r = 0; + + // uncached + uint32 *pBuffer = (uint32 *)UNCACHED(buffer); + + uint32 time1 = PspRtc::instance().getMicros(); + + for (int i=0; i= 4 - - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue - copy8(dst, src, bytes); -#ifdef TEST_MEMORY_COPY - testCopy(debugDst, debugSrc, debugBytes); -#endif - return; - } - - while (prefixDst--) { - *dst++ = *src++; - } - } - - // check the source pointer alignment now - uint32 alignSrc = (((uint32)src) & 0x3); - - if (alignSrc) { // we'll need to realign our reads - copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); - } else { - copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); - } - -#ifdef TEST_MEMORY_COPY - testCopy(debugDst, debugSrc, debugBytes); -#endif -} - -void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { - - bool mismatch = false; - PSP_INFO_PRINT("testing memcpy..."); - - for (uint32 i = 0; i < debugBytes; i++) { - if (debugDst[i] != debugSrc[i]) { - if (mismatch == false) { - PSP_DEBUG_PRINT_SAMELN("**** mismatch in copy! ****\n"); - PSP_DEBUG_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); - mismatch = true; - } - PSP_DEBUG_PRINT_SAMELN("%x!=%x ", debugSrc[i], debugDst[i]); - } - } - if (mismatch) { - PSP_DEBUG_PRINT("\n"); - } else { - PSP_INFO_PRINT("ok\n"); - } -} - -// -// used to swap red and blue -void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - - // align the destination pointer first - uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix - - if (prefixDst) { - bytes -= prefixDst; // remember we assume bytes > 4 - *dst16++ = *src16++; - - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { // check if it's worthwhile to continue - swap16(dst16, src16, bytes, format); - return; - } - } - - // check the source pointer alignment now - uint32 alignSrc = (((uint32)src16) & 0x3); - - if (alignSrc) { // we'll need to realign our reads - PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); - swap32Misaligned((uint32 *)dst16, (uint16 *)src16, bytes, format); - } else { - swap32Aligned((uint32 *)dst16, (uint32 *)src16, bytes, format); - } -} - -void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { - PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); - - int words8 = bytes >> 5; - - // try blocks of 8 words at a time - if (words8) { - while (words8--) { - dst32[0] = src32[0]; - dst32[1] = src32[1]; - dst32[2] = src32[2]; - dst32[3] = src32[3]; - dst32[4] = src32[4]; - dst32[5] = src32[5]; - dst32[6] = src32[6]; - dst32[7] = src32[7]; - dst32 += 8; - src32 += 8; - } - } - - int words4 = (bytes & 0x1F) >> 4; - - // try blocks of 4 words at a time - if (words4) { - dst32[0] = src32[0]; - dst32[1] = src32[1]; - dst32[2] = src32[2]; - dst32[3] = src32[3]; - dst32 += 4; - src32 += 4; - } - - int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above - int wordsLeft = bytesLeft >> 2; - - // now just do single words - while (wordsLeft) { - *dst32++ = *src32++; - wordsLeft--; - } - - bytesLeft = bytes & 0x3; // get remaining bytes - - PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); - - byte *dst = (byte *)dst32; - byte *src = (byte *)src32; - - while (bytesLeft--) { - *dst++ = *src++; - } -} - -void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - int words = bytes >> 2; - - // try blocks of 4 words at a time - for (; words - 4 >= 0; words -= 4) { - dst32[0] = format.swapRedBlue32(src32[0]); - dst32[1] = format.swapRedBlue32(src32[1]); - dst32[2] = format.swapRedBlue32(src32[2]); - dst32[3] = format.swapRedBlue32(src32[3]); - dst32 += 4; - src32 += 4; - } - - // now just do words - for (; words > 0; words--) { - *dst32++ = format.swapRedBlue32(*src32++); - } - - uint32 remainingBytes = bytes & 0x3; - - if (remainingBytes) { // for swap, must be a 16 bit value - *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); // only 1 short left - } -} - - -// More challenging -- need to shift -// Assume dst is aligned -void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { - PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); - - uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment - uint32 offset; - - switch (alignSrc) { - case 1: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); - break; - case 2: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); - break; - case 3: - offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); - break; - } - - uint32 remainingBytes = bytes & 3; - - if (remainingBytes) { - byte *dst = (byte *)dst32; - src += offset; - dst += offset; - copy8(dst, src, remainingBytes); - } -} - -// returns offset in dst -uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { - uint32 *origDst32 = dst32; - register uint32 dstWord, srcWord; - - PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], words[%d]\n", alignSrc, dst32, src32, words); - - // Try to do groups of 4 words - uint32 words4 = bytes >> 4; - - srcWord = src32[0]; - - while (words4--) { - dstWord = srcWord >> shiftValue; - srcWord = src32[1]; - dstWord |= srcWord << lastShiftValue; - dst32[0] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[2]; - dstWord |= srcWord << lastShiftValue; - dst32[1] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[3]; - dstWord |= srcWord << lastShiftValue; - dst32[2] = dstWord; - dstWord = srcWord >> shiftValue; - srcWord = src32[4]; - dstWord |= srcWord << lastShiftValue; - dst32[3] = dstWord; - src32 += 4; - dst32 += 4; - } - - uint32 words = (bytes & 0xF) >> 2; - - // we read one word ahead of what we write - // setup the first read - if (words) { - srcWord = *src32++; - - while (words--) { - dstWord = srcWord >> shiftValue; - srcWord = *src32++; - dstWord |= srcWord << lastShiftValue; - *dst32++ = dstWord; - } - } - - return (byte *)dst32 - (byte *)origDst32; -} -// More challenging -- need to shift -// Assume dst is aligned -void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - DEBUG_ENTER_FUNC(); - if (bytes < MIN_AMOUNT_FOR_MISALIGNED_COPY) { // less than a certain number of bytes it's just not worth it - swap16((uint16 *)dst32, src16, bytes, format); - return; - } - - int words = bytes >> 2; - uint32 remainingBytes = bytes & 3; - - uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment - - // we read one word ahead of what we write - // setup the first read - uint32 lastWord = ((*src32++) >> 16) & 0xFFFF; - - for (; words; words--) { - uint32 srcWord = *src32++; - uint32 curWord = (srcWord >> 16) & 0xFFFF; - lastWord |= (srcWord & 0xFFFF) << 16; // take the part of the src that belongs to this word - *dst32++ = format.swapRedBlue32(lastWord); - lastWord = curWord; - } - - if (remainingBytes) { // add in the remaining stuff - *(uint16 *)dst32 = format.swapRedBlue16((uint16)lastWord); - } -} - -inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { - PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); - - uint32 shorts = bytes >> 1; - uint32 remainingBytes = bytes & 1; - - for (; shorts > 0 ; shorts--) { - *dst16++ = *src16++; - } - if (remainingBytes) - *(byte *)dst16 = *(byte *)src16; -} - -// Class VramAllocator ----------------------------------- - -DECLARE_SINGLETON(VramAllocator) - -//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - - -void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { - DEBUG_ENTER_FUNC(); - assert(size > 0); - - byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; - Common::List::iterator i; - - // Find a block that fits, starting from the beginning - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - byte *currAddress = (*i).address; - - if (currAddress - lastAddress >= size) // We found a match - break; - - if ((*i).getEnd() > lastAddress) - lastAddress = (byte *)(*i).getEnd(); - } - - if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { - PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", - size, _bytesAllocated); - return NULL; - } - - _allocList.insert(i, Allocation(lastAddress, size)); - _bytesAllocated += size; - - PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); - PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - - return lastAddress; -} - -// Deallocate a block from VRAM -void VramAllocator::deallocate(void *address) { - DEBUG_ENTER_FUNC(); - address = (byte *)CACHED(address); // Make sure all addresses are the same - - Common::List::iterator i; - - // Find the Allocator to deallocate - for (i = _allocList.begin(); i != _allocList.end(); ++i) { - if ((*i).address == address) { - _bytesAllocated -= (*i).size; - _allocList.erase(i); - PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); - return; - } - } - - PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); -} +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#include "common/scummsys.h" +#include "common/singleton.h" +#include "common/list.h" +#include "backends/platform/psp/PSPPixelFormat.h" +#include "backends/platform/psp/memory.h" + +// Class Copier -------------------------------------------------------------------------- +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +//#define TEST_MEMORY_COPY + +extern "C" { + +void *__wrap_memcpy(void *dst, void *src, size_t bytes) { + PspMemory::fastCopy((byte *)dst, (byte *)src, bytes); + return dst; +} + +} + +void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const byte *debugDst = dst, *debugSrc = src; +#endif + + PSP_DEBUG_PRINT("copy(): dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst) & 0x3); + + if (prefixDst) { + prefixDst = 4 - prefixDst; // prefix only if we have address % 4 != 0 + PSP_DEBUG_PRINT("prefixDst[%d]\n", prefixDst); + + bytes -= prefixDst; // remember we assume bytes >= 4 + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + copy8(dst, src, bytes + prefixDst); +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif + return; + } + + while (prefixDst--) { + *dst++ = *src++; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + copy32Misaligned((uint32 *)dst, src, bytes, alignSrc); + } else { + copy32Aligned((uint32 *)dst, (uint32 *)src, bytes); + } + +#ifdef TEST_MEMORY_COPY + testCopy(debugDst, debugSrc, debugBytes); +#endif +} + +void PspMemory::testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes) { + + bool mismatch = false; + PSP_INFO_PRINT("testing fastCopy..."); + + for (uint32 i = 0; i < debugBytes; i++) { + if (debugDst[i] != debugSrc[i]) { + if (!mismatch) { + PSP_INFO_PRINT("**** mismatch in copy! ****\n"); + PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_INFO_PRINT("[%d]%x!=%x ", i, debugSrc[i], debugDst[i]); + } + } + if (mismatch) { + PSP_INFO_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + +// +// used to swap red and blue +void PspMemory::swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + +#ifdef TEST_MEMORY_COPY + uint32 debugBytes = bytes; + const uint16 *debugDst = dst16, *debugSrc = src16; +#endif + + // align the destination pointer first + uint32 prefixDst = (((uint32)dst16) & 0x3); // for swap, we can only have 2 or 0 as our prefix + + if (prefixDst) { + bytes -= prefixDst; // remember we assume bytes > 4 + *dst16++ = format.swapRedBlue16(*src16++); + + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { // check if it's worthwhile to continue + swap16(dst16, src16, bytes, format); + +#ifdef TEST_MEMORY_COPY + testSwap(debugDst, debugSrc, debugBytes, format); +#endif + return; + } + } + + // check the source pointer alignment now + uint32 alignSrc = (((uint32)src16) & 0x3); + + if (alignSrc) { // we'll need to realign our reads + PSP_DEBUG_PRINT("misaligned copy of %u bytes from %p to %p\n", bytes, src16, dst16); + swap32Misaligned((uint32 *)dst16, src16, bytes, format); + } else { + swap32Aligned((uint32 *)dst16, (const uint32 *)src16, bytes, format); + } + +#ifdef TEST_MEMORY_COPY + testSwap(debugDst, debugSrc, debugBytes, format); +#endif + +} + +void PspMemory::testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format) { + + bool mismatch = false; + PSP_INFO_PRINT("testing fastSwap..."); + + uint32 shorts = debugBytes >> 1; + + for (uint32 i = 0; i < shorts; i++) { + if (debugDst[i] != format.swapRedBlue16(debugSrc[i])) { + if (!mismatch) { + PSP_INFO_PRINT("**** mismatch in swap! ****\n"); + PSP_INFO_PRINT("dst[%p], src[%p], bytes[%u]\n", debugDst, debugSrc, debugBytes); + mismatch = true; + } + PSP_INFO_PRINT("[%d]%x!=%x ", i<<1, format.swapRedBlue16(debugSrc[i]), debugDst[i]); + } + } + if (mismatch) { + PSP_INFO_PRINT("\n"); + } else { + PSP_INFO_PRINT("ok\n"); + } +} + + +void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes) { + PSP_DEBUG_PRINT("copy32Aligned(): dst32[%p], src32[%p], bytes[%d]\n", dst32, src32, bytes); + + int words8 = bytes >> 5; + + // try blocks of 8 words at a time + if (words8) { + while (words8--) { + uint32 a, b, c, d; + a = src32[0]; + b = src32[1]; + c = src32[2]; + d = src32[3]; + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + a = src32[4]; + b = src32[5]; + c = src32[6]; + d = src32[7]; + dst32[4] = a; + dst32[5] = b; + dst32[6] = c; + dst32[7] = d; + dst32 += 8; + src32 += 8; + } + } + + int words4 = (bytes & 0x1F) >> 4; + + // try blocks of 4 words at a time + if (words4) { + uint32 a, b, c, d; + a = src32[0]; + b = src32[1]; + c = src32[2]; + d = src32[3]; + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + dst32 += 4; + src32 += 4; + } + + int bytesLeft = (bytes & 0xF); // only look at bytes left after we did the above + int wordsLeft = bytesLeft >> 2; + + // now just do single words + while (wordsLeft) { + *dst32++ = *src32++; + wordsLeft--; + } + + bytesLeft = bytes & 0x3; // get remaining bytes + + PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft); + + byte *dst = (byte *)dst32; + byte *src = (byte *)src32; + + while (bytesLeft--) { + *dst++ = *src++; + } +} + +void PspMemory::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + int words4 = bytes >> 4; + + // try blocks of 4 words at a time + while (words4--) { + uint32 a, b, c, d; + a = format.swapRedBlue32(src32[0]); + b = format.swapRedBlue32(src32[1]); + c = format.swapRedBlue32(src32[2]); + d = format.swapRedBlue32(src32[3]); + dst32[0] = a; + dst32[1] = b; + dst32[2] = c; + dst32[3] = d; + dst32 += 4; + src32 += 4; + } + + uint32 bytesLeft = bytes & 0xF; + uint32 words = bytesLeft >> 2; + + // now just do words + while (words--) { + *dst32++ = format.swapRedBlue32(*src32++); + } + + bytesLeft = bytes & 0x3; + + if (bytesLeft) { // for swap, can only be 1 short left + *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32)); + } +} + + +// More challenging -- need to shift +// Assume dst is aligned +void PspMemory::copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc) { + PSP_DEBUG_PRINT("copy32Misaligned: dst32[%p], src[%p], bytes[%d], alignSrc[%d]\n", dst32, src, bytes, alignSrc); + + uint32 *src32 = (uint32 *)(((uint32)src) & 0xFFFFFFFC); // remove misalignment + uint32 offset; + + switch (alignSrc) { + case 1: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 8, 24); + break; + case 2: + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 16, 16); + break; + default: /* 3 */ + offset = misaligned32Detail(dst32, src32, bytes, alignSrc, 24, 8); + break; + } + + uint32 remainingBytes = bytes & 3; + + if (remainingBytes) { + byte *dst = (byte *)dst32; + src += offset; + dst += offset; + copy8(dst, src, remainingBytes); + } +} + +// returns offset in dst +uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue) { + uint32 *origDst32 = dst32; + register uint32 dstWord, srcWord; + + PSP_DEBUG_PRINT("misaligned32Detail(): alignSrc[%d], dst32[%p], src32[%p], bytes[%d]\n", alignSrc, dst32, src32, bytes); + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + + srcWord = src32[0]; + + while (words4--) { + dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << lastShiftValue; + dst32[0] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << lastShiftValue; + dst32[1] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << lastShiftValue; + dst32[2] = dstWord; + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << lastShiftValue; + dst32[3] = dstWord; + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + src32++; // we already loaded the value, so just increment + + while (words--) { + dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << lastShiftValue; + *dst32++ = dstWord; + } + } + + return (byte *)dst32 - (byte *)origDst32; +} + +// More challenging -- need to shift +// We assume dst is aligned +void PspMemory::swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + DEBUG_ENTER_FUNC(); + + const uint32 shiftValue = 16; + uint32 *src32 = (uint32 *)(((uint32)src16) & 0xFFFFFFFC); // remove misalignment + + // Try to do groups of 4 words + uint32 words4 = bytes >> 4; + uint32 srcWord = src32[0]; // preload + + while (words4--) { + uint32 dstWord = srcWord >> shiftValue; + srcWord = src32[1]; + dstWord |= srcWord << shiftValue; + dst32[0] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[2]; + dstWord |= srcWord << shiftValue; + dst32[1] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[3]; + dstWord |= srcWord << shiftValue; + dst32[2] = format.swapRedBlue32(dstWord); + dstWord = srcWord >> shiftValue; + srcWord = src32[4]; + dstWord |= srcWord << shiftValue; + dst32[3] = format.swapRedBlue32(dstWord); + src32 += 4; + dst32 += 4; + } + + uint32 words = (bytes & 0xF) >> 2; + + // we read one word ahead of what we write + // setup the first read + if (words) { + //srcWord = *src32++; // don't need this. already loaded + src32++; // we already have the value loaded in + + while (words--) { + uint32 dstWord = srcWord >> shiftValue; + srcWord = *src32++; + dstWord |= srcWord << shiftValue; + *dst32++ = format.swapRedBlue32(dstWord); + } + } + + uint32 bytesLeft = bytes & 3; + + if (bytesLeft) { // for swap, can only be 1 short left + *((uint16 *)dst32) = format.swapRedBlue16((uint16)(srcWord >> shiftValue)); + } +} + +inline void PspMemory::copy16(uint16 *dst16, const uint16 *src16, uint32 bytes) { + PSP_DEBUG_PRINT("copy16(): dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + + uint32 shorts = bytes >> 1; + uint32 remainingBytes = bytes & 1; + + for (; shorts > 0 ; shorts--) { + *dst16++ = *src16++; + } + if (remainingBytes) + *(byte *)dst16 = *(byte *)src16; +} + +// Class VramAllocator ----------------------------------- + +DECLARE_SINGLETON(VramAllocator) + +//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + + +void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { + DEBUG_ENTER_FUNC(); + assert(size > 0); + + byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS; + Common::List::iterator i; + + // Find a block that fits, starting from the beginning + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + byte *currAddress = (*i).address; + + if (currAddress - lastAddress >= size) // We found a match + break; + + if ((*i).getEnd() > lastAddress) + lastAddress = (byte *)(*i).getEnd(); + } + + if (lastAddress + size > (byte *)VRAM_END_ADDRESS) { + PSP_DEBUG_PRINT("No space for allocation of %d bytes. %d bytes already allocated.\n", + size, _bytesAllocated); + return NULL; + } + + _allocList.insert(i, Allocation(lastAddress, size)); + _bytesAllocated += size; + + PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); + PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); + + return lastAddress; +} + +// Deallocate a block from VRAM +void VramAllocator::deallocate(void *address) { + DEBUG_ENTER_FUNC(); + address = (byte *)CACHED(address); // Make sure all addresses are the same + + Common::List::iterator i; + + // Find the Allocator to deallocate + for (i = _allocList.begin(); i != _allocList.end(); ++i) { + if ((*i).address == address) { + _bytesAllocated -= (*i).size; + _allocList.erase(i); + PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); + return; + } + } + + PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); +} diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index 81a77cca1c..c9b3d21cb6 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -1,131 +1,132 @@ - -/* 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. - * - * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ - * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ - * - */ - -#ifndef PSP_MEMORY_H -#define PSP_MEMORY_H - -#include "backends/platform/psp/psppixelformat.h" -#include "common/list.h" - -#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ -#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ - -#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 -#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 - -//#define __PSP_DEBUG_PRINT__ - -#include "backends/platform/psp/trace.h" - -/** - * Class that does memory copying and swapping if needed - */ -class PspMemory { -private: - static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); - static void copy(byte *dst, const byte *src, uint32 bytes); - static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); - static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); - static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); - static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); - static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); - static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); - static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); - - // For swapping, we know that we have multiples of 16 bits - static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); - uint32 shorts = bytes >> 1; - - for (; shorts > 0 ; shorts--) { - *dst16++ = format.swapRedBlue16(*src16++); - } - } - - static void copy8(byte *dst, const byte *src, uint32 bytes) { - PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); - while (bytes--) { - *dst++ = *src++; - } - } - -public: - // This is the interface to the outside world - static void fastCopy(byte *dst, const byte *src, uint32 bytes) { - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { - copy8(dst, src, bytes); - } else { // go to more powerful copy - copy(dst, src, bytes); - } - } - - static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { - if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { - swap16((uint16 *)dst, (uint16 *)src, bytes, format); - } else { // go to more powerful copy - swap((uint16 *)dst, (uint16 *)src, bytes, format); - } - } -}; - -/** - * Class that allocates memory in the VRAM - */ -class VramAllocator : public Common::Singleton { -public: - VramAllocator() : _bytesAllocated(0) {} - void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes - void deallocate(void *pointer); - - static inline bool isAddressInVram(void *address) { - if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) - return true; - return false; - } - - -private: - /** - * Used to allocate in VRAM - */ - struct Allocation { - byte *address; - uint32 size; - void *getEnd() { return address + size; } - Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} - Allocation() : address(0), size(0) {} - }; - - enum { - VRAM_START_ADDRESS = 0x04000000, - VRAM_END_ADDRESS = 0x04200000, - VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations - }; - Common::List _allocList; // List of allocations - uint32 _bytesAllocated; -}; - -#endif /* PSP_MEMORY_H */ + +/* 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. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $ + * $Id: osys_psp.cpp 46126 2009-11-24 14:18:46Z fingolfin $ + * + */ + +#ifndef PSP_MEMORY_H +#define PSP_MEMORY_H + +#include "backends/platform/psp/psppixelformat.h" +#include "common/list.h" + +#define UNCACHED(x) ((byte *)(((uint32)(x)) | 0x40000000)) /* make an uncached access */ +#define CACHED(x) ((byte *)(((uint32)(x)) & 0xBFFFFFFF)) /* make an uncached access into a cached one */ + +#define MIN_AMOUNT_FOR_COMPLEX_COPY 8 +#define MIN_AMOUNT_FOR_MISALIGNED_COPY 8 + +//#define __PSP_DEBUG_PRINT__ + +#include "backends/platform/psp/trace.h" + +/** + * Class that does memory copying and swapping if needed + */ +class PspMemory { +private: + static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); + static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format); + static void copy(byte *dst, const byte *src, uint32 bytes); + static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); + static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); + static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); + static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); + static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); + + // For swapping, we know that we have multiples of 16 bits + static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + uint32 shorts = bytes >> 1; + + while (shorts--) { + *dst16++ = format.swapRedBlue16(*src16++); + } + } + + static void copy8(byte *dst, const byte *src, uint32 bytes) { + PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + while (bytes--) { + *dst++ = *src++; + } + } + +public: + // This is the interface to the outside world + static void fastCopy(byte *dst, const byte *src, uint32 bytes) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) { + copy8(dst, src, bytes); + } else { // go to more powerful copy + copy(dst, src, bytes); + } + } + + static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { + if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { + swap16((uint16 *)dst, (uint16 *)src, bytes, format); + } else { // go to more powerful copy + swap((uint16 *)dst, (uint16 *)src, bytes, format); + } + } +}; + +/** + * Class that allocates memory in the VRAM + */ +class VramAllocator : public Common::Singleton { +public: + VramAllocator() : _bytesAllocated(0) {} + void *allocate(int32 size, bool smallAllocation = false); // smallAllocation e.g. palettes + void deallocate(void *pointer); + + static inline bool isAddressInVram(void *address) { + if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS) + return true; + return false; + } + + +private: + /** + * Used to allocate in VRAM + */ + struct Allocation { + byte *address; + uint32 size; + void *getEnd() { return address + size; } + Allocation(void *Address, uint32 Size) : address((byte *)Address), size(Size) {} + Allocation() : address(0), size(0) {} + }; + + enum { + VRAM_START_ADDRESS = 0x04000000, + VRAM_END_ADDRESS = 0x04200000, + VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations + }; + Common::List _allocList; // List of allocations + uint32 _bytesAllocated; +}; + +#endif /* PSP_MEMORY_H */ diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index b84702115f..dba9a8fc2b 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -44,15 +44,13 @@ #include "backends/plugins/psp/psp-provider.h" #include "backends/platform/psp/psppixelformat.h" #include "backends/platform/psp/osys_psp.h" -#include "backends/platform/psp/tests.h" +#include "backends/platform/psp/tests.h" /* for unit/speed tests */ #include "backends/platform/psp/trace.h" #ifdef ENABLE_PROFILING #include #endif -#define ENABLE_TESTS /* to enable tests of PSP architecture */ - /** * Define the module info section * @@ -156,7 +154,7 @@ int SetupCallbacks(void) { #undef main int main(void) { //change clock rate to 333mhz - scePowerSetClockFrequency(222, 222, 111); + scePowerSetClockFrequency(333, 333, 166); PowerManager::instance(); // Setup power manager @@ -172,10 +170,11 @@ int main(void) { PluginManager::instance().addPluginProvider(new PSPPluginProvider()); #endif -#ifdef ENABLE_TESTS +/* unit/speed tests */ +#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) PSP_INFO_PRINT("running tests\n"); - tests(); - sceKernelSleepThread(); + psp_tests(); + sceKernelSleepThread(); // that's it. That's all we're doing #endif int res = scummvm_main(argc, argv); diff --git a/backends/platform/psp/tests.cpp b/backends/platform/psp/tests.cpp index 25c07fd723..d1bdb9e640 100644 --- a/backends/platform/psp/tests.cpp +++ b/backends/platform/psp/tests.cpp @@ -23,6 +23,13 @@ * */ +// PSP speed and unit tests. Activate in tests.h +// You may also want to build without any engines. + +#include "backends/platform/psp/tests.h" + +#if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) + #include "common/scummsys.h" #include #include @@ -51,7 +58,36 @@ #include "backends/platform/psp/trace.h" -void test_ticks() { +class PspSpeedTests { +public: + void tickSpeed(); + void getMicrosSpeed(); + void seekSpeed(); + void msReadSpeed(); + void threadFunctionsSpeed(); + void semaphoreSpeed(); + static int threadFunc(SceSize args, void *argp); + void semaphoreManyThreadSpeed(); + void fastCopySpeed(); + +private: + enum { + MEMCPY_BUFFER_SIZE = 8192 + }; + static PspSemaphore _sem; // semaphore + + void readAndTime(uint32 bytes, char *buffer, FILE *file); + void seekAndTime(int bytes, int origin, FILE *file); + void fastCopySpecificSize(byte *dst, byte *src, uint32 bytes); + void fastCopyDifferentSizes(byte *dst, byte *src); + int getThreadIdSpeed(); + void getPrioritySpeed(); + void changePrioritySpeed(int id, int priority); +}; + +PspSemaphore PspSpeedTests::_sem(0); + +void PspSpeedTests::tickSpeed() { uint32 ticksPerSecond = sceRtcGetTickResolution(); PSP_INFO_PRINT("ticksPerSecond[%d]\n", ticksPerSecond); @@ -75,7 +111,7 @@ void test_ticks() { PSP_INFO_PRINT("time2, year[%d] month[%d] day[%d] hour[%d] minutes[%d] seconds[%d] us[%d]\n", time2.year, time2.month, time2.day, time2.hour, time2.minutes, time2.seconds, time2.microseconds); } -void test_getMicros() { +void PspSpeedTests::getMicrosSpeed() { uint32 time1, time2, time3, time4; time1 = PspRtc::instance().getMicros(); time2 = PspRtc::instance().getMicros(); @@ -85,7 +121,7 @@ void test_getMicros() { PSP_INFO_PRINT("getMicros() times: %d, %d, %d\n", time4-time3, time3-time2, time2-time1); } -void read_and_time(uint32 bytes, char *buffer, FILE *file) { +void PspSpeedTests::readAndTime(uint32 bytes, char *buffer, FILE *file) { uint32 time1 = PspRtc::instance().getMicros(); // test minimal read fread(buffer, bytes, 1, file); @@ -101,18 +137,8 @@ void read_and_time(uint32 bytes, char *buffer, FILE *file) { Reading 50 byte takes 8us / 11 Reading 100 byte takes 8us / 11 Reading 1000 byte takes 915us / 1131 - Reading 1000 byte takes 911us - Reading 1000 byte takes 914us - Reading 1000 byte takes 943us - Reading 1000 byte takes 915us - Reading 1000 byte takes 923us - Reading 1000 byte takes 22us - Reading 1000 byte takes 916us - Reading 1000 byte takes 913us / 1,120 - Reading 1000 byte takes 909us / 1,122 Reading 2000 byte takes 1806us / 2,284 Reading 3000 byte takes 2697us / 3,374 - Reading 4000 byte takes 3652us / 4,592 Reading 5000 byte takes 4551us / 5,544 Reading 6000 byte takes 5356us / 6,676 Reading 7000 byte takes 6800us / 8,358 @@ -120,47 +146,40 @@ void read_and_time(uint32 bytes, char *buffer, FILE *file) { Reading 9000 byte takes 6782us / 8,563 Reading 10000 byte takes 8497us / 10,631 Reading 30000 byte takes 25995us / 32,473 - Reading 50000 byte takes 42467us / 52,893 Reading 80000 byte takes 68457us / 85,291 Reading 100000 byte takes 85103us / 106,163 - Reading 500000 byte takes 427337us / 531,679 - Reading 1000000 byte takes 854831us / 1,063,107 */ // Function to test the impact of MS reads // These tests can't be done from shell - the cache screws them up -void test_ms_reads() { +void PspSpeedTests::msReadSpeed() { FILE *file; file = fopen("ms0:/psp/music/track1.mp3", "r"); char *buffer = (char *)malloc(2 * 1024 * 1024); - read_and_time(1, buffer, file); - read_and_time(10, buffer, file); - read_and_time(50, buffer, file); - read_and_time(100, buffer, file); - for (int i = 0; i< 10; i++) - read_and_time(1000, buffer, file); - read_and_time(2000, buffer, file); - read_and_time(3000, buffer, file); - read_and_time(4000, buffer, file); - read_and_time(5000, buffer, file); - read_and_time(6000, buffer, file); - read_and_time(7000, buffer, file); - read_and_time(8000, buffer, file); - read_and_time(9000, buffer, file); - read_and_time(10000, buffer, file); - read_and_time(30000, buffer, file); - read_and_time(50000, buffer, file); - read_and_time(80000, buffer, file); - read_and_time(100000, buffer, file); - read_and_time(500000, buffer, file); - read_and_time(1000000, buffer, file); + readAndTime(1, buffer, file); + readAndTime(10, buffer, file); + readAndTime(50, buffer, file); + readAndTime(100, buffer, file); + readAndTime(1000, buffer, file); + readAndTime(2000, buffer, file); + readAndTime(3000, buffer, file); + readAndTime(5000, buffer, file); + readAndTime(6000, buffer, file); + readAndTime(7000, buffer, file); + readAndTime(8000, buffer, file); + readAndTime(9000, buffer, file); + readAndTime(10000, buffer, file); + readAndTime(30000, buffer, file); + readAndTime(50000, buffer, file); + readAndTime(80000, buffer, file); + readAndTime(100000, buffer, file); fclose(file); free(buffer); } -void seek_and_time(int bytes, int origin, FILE *file) { +void PspSpeedTests::seekAndTime(int bytes, int origin, FILE *file) { char buffer[1000]; uint32 time1 = PspRtc::instance().getMicros(); @@ -202,26 +221,26 @@ Seeking 10000 byte from 2 took 3636us Reading 1000 bytes took 110us */ -void test_seeks() { +void PspSpeedTests::seekSpeed() { FILE *file; file = fopen("ms0:/psp/music/track1.mp3", "r"); - seek_and_time(0, SEEK_SET, file); - seek_and_time(5, SEEK_SET, file); - seek_and_time(1000, SEEK_SET, file); - seek_and_time(100, SEEK_SET, file); - seek_and_time(10000, SEEK_SET, file); - seek_and_time(-5, SEEK_CUR, file); - seek_and_time(-100, SEEK_CUR, file); - seek_and_time(100, SEEK_CUR, file); - seek_and_time(0, SEEK_END, file); - seek_and_time(-10000, SEEK_END, file); + seekAndTime(0, SEEK_SET, file); + seekAndTime(5, SEEK_SET, file); + seekAndTime(1000, SEEK_SET, file); + seekAndTime(100, SEEK_SET, file); + seekAndTime(10000, SEEK_SET, file); + seekAndTime(-5, SEEK_CUR, file); + seekAndTime(-100, SEEK_CUR, file); + seekAndTime(100, SEEK_CUR, file); + seekAndTime(0, SEEK_END, file); + seekAndTime(-10000, SEEK_END, file); fclose(file); } // 222: 5-7us -int testGetThreadId() { +int PspSpeedTests::getThreadIdSpeed() { uint32 time1 = PspRtc::instance().getMicros(); int threadId = sceKernelGetThreadId(); uint32 time2 = PspRtc::instance().getMicros(); @@ -232,7 +251,7 @@ int testGetThreadId() { } // 222: 4-5us -void testGetPriority() { +void PspSpeedTests::getPrioritySpeed() { uint32 time1 = PspRtc::instance().getMicros(); int priority = sceKernelGetThreadCurrentPriority(); uint32 time2 = PspRtc::instance().getMicros(); @@ -241,7 +260,7 @@ void testGetPriority() { } // 222: 9-10us -void testChangePriority(int id, int priority) { +void PspSpeedTests::changePrioritySpeed(int id, int priority) { uint32 time1 = PspRtc::instance().getMicros(); sceKernelChangeThreadPriority(id, priority); uint32 time2 = PspRtc::instance().getMicros(); @@ -249,15 +268,16 @@ void testChangePriority(int id, int priority) { PSP_INFO_PRINT("Changing thread priority to %d for id %d took %dus\n", priority, id, time2-time1); } -void test_thread() { +void PspSpeedTests::threadFunctionsSpeed() { + // very unscientific -- just ballpark int id; - id = testGetThreadId(); - testGetThreadId(); - testGetPriority(); - testGetPriority(); - testChangePriority(id, 30); - testChangePriority(id, 35); - testChangePriority(id, 25); + id = getThreadIdSpeed(); + getThreadIdSpeed(); + getPrioritySpeed(); + getPrioritySpeed(); + changePrioritySpeed(id, 30); + changePrioritySpeed(id, 35); + changePrioritySpeed(id, 25); // test context switch time for (int i=0; i<10; i++) { @@ -268,118 +288,12 @@ void test_thread() { } } -int test_mem_read(uint32 words) { - uint32 __attribute__((aligned(64))) buffer[1024]; - register uint32 r = 0; +void PspSpeedTests::semaphoreSpeed() { + PspSemaphore sem(1); - // uncached - uint32 *pBuffer = (uint32 *)UNCACHED(buffer); - uint32 time1 = PspRtc::instance().getMicros(); - for (int i=0; i= 0) - break; + if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { + // subscribe to MIDI port + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { + error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); } - - if (i >= ARRAYSIZE(defaultPorts)) - error("Can't subscribe to MIDI port (65:0) or (17:0)"); } printf("Connected to Alsa sequencer client [%d:%d]\n", seq_client, seq_port); @@ -230,24 +197,6 @@ void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) { send_event(1); } -int MidiDriver_ALSA::parse_addr(const char *arg, int *client, int *port) { - const char *p; - - if (isdigit(*arg)) { - if ((p = strpbrk(arg, ADDR_DELIM)) == NULL) - return -1; - *client = atoi(arg); - *port = atoi(p + 1); - } else { - if (*arg == 's' || *arg == 'S') { - *client = SND_SEQ_ADDRESS_SUBSCRIBERS; - *port = 0; - } else - return -1; - } - return 0; -} - void MidiDriver_ALSA::send_event(int do_flush) { snd_seq_ev_set_direct(&ev); snd_seq_ev_set_source(&ev, my_port); @@ -261,6 +210,43 @@ void MidiDriver_ALSA::send_event(int do_flush) { // Plugin interface +class AlsaDevice { +public: + AlsaDevice(Common::String name, MusicType mt, int client, int port); + Common::String getName(); + MusicType getType(); + int getClient(); + int getPort(); + +private: + Common::String _name; + MusicType _type; + int _client; + int _port; +}; + +typedef Common::List AlsaDevices; + +AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client, int port) + : _name(name), _type(mt), _client(client), _port(port) { +} + +Common::String AlsaDevice::getName() { + return _name; +} + +MusicType AlsaDevice::getType() { + return _type; +} + +int AlsaDevice::getClient() { + return _client; +} + +int AlsaDevice::getPort() { + return _port; +} + class AlsaMusicPlugin : public MusicPluginObject { public: const char *getName() const { @@ -271,8 +257,12 @@ public: return "alsa"; } + AlsaDevices getAlsaDevices() const; MusicDevices getDevices() const; Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const; + +private: + static int parse_addr(const char *arg, int *client, int *port); }; #define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) @@ -286,11 +276,10 @@ static int check_permission(snd_seq_port_info_t *pinfo) return 0; } -MusicDevices AlsaMusicPlugin::getDevices() const { - MusicDevices devices; - - snd_seq_t *seq; - if (my_snd_seq_open(&seq) < 0) +AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { + AlsaDevices devices; + snd_seq_t *seq_handle; + if (my_snd_seq_open(&seq_handle) < 0) return devices; // can't open sequencer snd_seq_client_info_t *cinfo; @@ -298,32 +287,154 @@ MusicDevices AlsaMusicPlugin::getDevices() const { snd_seq_port_info_t *pinfo; snd_seq_port_info_alloca(&pinfo); snd_seq_client_info_set_client(cinfo, -1); - while (snd_seq_query_next_client(seq, cinfo) >= 0) { + while (snd_seq_query_next_client(seq_handle, cinfo) >= 0) { bool found_valid_port = false; /* reset query info */ snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo)); snd_seq_port_info_set_port(pinfo, -1); - while (!found_valid_port && snd_seq_query_next_port(seq, pinfo) >= 0) { + while (!found_valid_port && snd_seq_query_next_port(seq_handle, pinfo) >= 0) { if (check_permission(pinfo)) { found_valid_port = true; - // TODO: Return a different music type depending on the configuration - devices.push_back(MusicDevice(this, snd_seq_client_info_get_name(cinfo), MT_GM)); - //snd_seq_client_info_get_client(cinfo) : snd_seq_port_info_get_port(pinfo) + + const char *name = snd_seq_client_info_get_name(cinfo); + // TODO: Can we figure out the appropriate music type? + MusicType type = MT_GM; + int client = snd_seq_client_info_get_client(cinfo); + int port = snd_seq_port_info_get_port(pinfo); + + devices.push_back(AlsaDevice(name, type, client, port)); } } } - snd_seq_close(seq); + snd_seq_close(seq_handle); return devices; } -Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const { - *mididriver = new MidiDriver_ALSA(); +MusicDevices AlsaMusicPlugin::getDevices() const { + MusicDevices devices; + Common::Array used; + AlsaDevices::iterator d; + int i; + + AlsaDevices alsaDevices = getAlsaDevices(); + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + used.push_back(false); + } + + // Since the default behaviour is to use the first device in the list, + // try to put something sensible there. We used to have 17:0 and 65:0 + // as defaults. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + int client = d->getClient(); + if (client == 17 || client == 65) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + used[i] = true; + } + } + + // 128:0 is probably TiMidity, or something like that, so that's + // probably a good second choice. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + if (d->getClient() == 128) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + used[i] = true; + } + } + + // Add the remaining devices in the order they were found. + + for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + + if (!used[i]) { + devices.push_back(MusicDevice(this, d->getName(), d->getType())); + } + } + + return devices; +} + +Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle dev) const { + bool found = false; + int seq_client, seq_port; + + const char *var = NULL; + + // TODO: Upgrade from old alsa_port setting. This probably isn't the + // right place to do that, though. + + if (ConfMan.hasKey("alsa_port")) { + warning("AlsaMusicPlugin: Found old 'alsa_port' setting, which will be ignored"); + } + + // The SCUMMVM_PORT environment variable can still be used to override + // any config setting. + + var = getenv("SCUMMVM_PORT"); + if (var) { + warning("AlsaMusicPlugin: SCUMMVM_PORT environment variable overrides config settings"); + if (parse_addr(var, &seq_client, &seq_port) >= 0) { + found = true; + } else { + warning("AlsaMusicPlugin: Invalid port %s, using config settings instead", var); + } + } + + // Try to match the setting to an available ALSA device. + + if (!found && dev) { + AlsaDevices alsaDevices = getAlsaDevices(); + + for (AlsaDevices::iterator d = alsaDevices.begin(); d != alsaDevices.end(); ++d) { + MusicDevice device(this, d->getName(), d->getType()); + + if (device.getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) { + found = true; + seq_client = d->getClient(); + seq_port = d->getPort(); + break; + } + } + } + + // Still nothing? Try a sensible default. + + if (!found) { + // TODO: What's a sensible default anyway? And exactly when do + // we get to this case? + + warning("AlsaMusicPlugin: Using 17:0 as default ALSA port"); + seq_client = 17; + seq_port = 0; + } + + *mididriver = new MidiDriver_ALSA(seq_client, seq_port); return Common::kNoError; } +int AlsaMusicPlugin::parse_addr(const char *arg, int *client, int *port) { + const char *p; + + if (isdigit(*arg)) { + if ((p = strpbrk(arg, ADDR_DELIM)) == NULL) + return -1; + *client = atoi(arg); + *port = atoi(p + 1); + } else { + if (*arg == 's' || *arg == 'S') { + *client = SND_SEQ_ADDRESS_SUBSCRIBERS; + *port = 0; + } else + return -1; + } + return 0; +} + //#if PLUGIN_ENABLED_DYNAMIC(ALSA) //REGISTER_PLUGIN_DYNAMIC(ALSA, PLUGIN_TYPE_MUSIC, AlsaMusicPlugin); //#else -- cgit v1.2.3 From 211fcfe7bab49ceeb5e81f4dcb1be7e73c58d7c9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Jul 2010 08:24:34 +0000 Subject: MIDI: Build and use ALSA driver if and only if USE_ALSA is defined svn-id: r51053 --- backends/midi/alsa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 076655bfed..a895ef8b80 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -24,7 +24,7 @@ #include "common/scummsys.h" -#if defined(UNIX) && defined(USE_ALSA) +#if defined(USE_ALSA) #include "common/config-manager.h" #include "common/util.h" -- cgit v1.2.3 From 37aa8a7499e6aa1698beb7e241c42ba19475a83a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 20 Jul 2010 08:25:13 +0000 Subject: BUILD: Unify adding -DUNIX to DEFINES; complete SEQ MIDI detection * Added a yes/no variable _unix to configure, which controls when -DUNIX is added to DEFINES * Enable SEQ MIDI via _seq_midi by default on UNIX type systems, except for those which override that. * Switch SEQ MIDI code to check #define USE_SEQ_MIDI (alternatively, we could compile it only conditionally...) svn-id: r51055 --- backends/midi/seq.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index b1815adee5..06685df59a 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -28,7 +28,7 @@ * both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html) */ -#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__) +#if defined(USE_SEQ_MIDI) #include "common/util.h" #include "sound/musicplugin.h" -- cgit v1.2.3 From 5b3f31feec43db358c1ad9bb38a7e602b5a90bb0 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 20 Jul 2010 08:56:53 +0000 Subject: General: Fixed building the SEQ MIDI driver An #include was missing, causing the driver to never be built. Also fixed what looked like a cut-and-paste error in generating the features string. svn-id: r51056 --- backends/midi/seq.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends') diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 06685df59a..e3d2c35b39 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -28,6 +28,8 @@ * both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html) */ +#include "common/scummsys.h" + #if defined(USE_SEQ_MIDI) #include "common/util.h" -- cgit v1.2.3 From 7b485a797884dc24ddcde990dba450ca610875d9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 23 Jul 2010 12:09:54 +0000 Subject: GP2XWIZ: Fix warning svn-id: r51203 --- backends/platform/gp2xwiz/gp2xwiz-graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp index 6abddd52f3..f6ad226d42 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp @@ -138,7 +138,7 @@ bool OSystem_GP2XWIZ::loadGFXMode() { if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) _videoMode.aspectRatioCorrection = false; - OSystem_SDL::loadGFXMode(); + return OSystem_SDL::loadGFXMode(); } void OSystem_GP2XWIZ::drawMouse() { -- cgit v1.2.3 From b3f08d183b5fdafa850dc87401fc74d71476ef5d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 Jul 2010 16:38:31 +0000 Subject: SDL: Fix bug #3025258 Bug #3025258: "Cursor Leaves Trail in GUI when Screen is Shaking". Based on patch provided by eriktorbjorn but extended with another edge case. svn-id: r51212 --- backends/platform/sdl/graphics.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index 35c5b57db6..a97a153f3c 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -783,7 +783,8 @@ void OSystem_SDL::internUpdateScreen() { #endif // If the shake position changed, fill the dirty area with blackness - if (_currentShakePos != _newShakePos) { + if (_currentShakePos != _newShakePos || + (_mouseNeedsRedraw && _mouseBackup.y <= _currentShakePos)) { SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; if (_videoMode.aspectRatioCorrection && !_overlayVisible) @@ -1681,7 +1682,7 @@ void OSystem_SDL::undrawMouse() { return; if (_mouseBackup.w != 0 && _mouseBackup.h != 0) - addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); + addDirtyRect(x, y - _currentShakePos, _mouseBackup.w, _mouseBackup.h); } void OSystem_SDL::drawMouse() { -- cgit v1.2.3 From d508ba67663c3150d2c7052cf568234e8739bdfb Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Tue, 27 Jul 2010 11:16:44 +0000 Subject: Remove Android themeengine patch - an improved version is now part of the main ScummVM codebase thanks to fingolfin :) svn-id: r51362 --- backends/platform/android/README.build | 4 - .../android/scummvm-android-themeengine.patch | 135 --------------------- 2 files changed, 139 deletions(-) delete mode 100644 backends/platform/android/scummvm-android-themeengine.patch (limited to 'backends') diff --git a/backends/platform/android/README.build b/backends/platform/android/README.build index 3d1cf433a7..1c407bd469 100644 --- a/backends/platform/android/README.build +++ b/backends/platform/android/README.build @@ -67,10 +67,6 @@ toolchains around. Building ScummVM ================ -Apply the theme engine patch: - - patch -p1 < backends/platform/android/scummvm-android-themeengine.patch - (Optionally) compress scummmodern.zip: (ScummVM usually ships it uncompressed, but Android can read it more efficiently if it is compressed *before* adding it to the apk) diff --git a/backends/platform/android/scummvm-android-themeengine.patch b/backends/platform/android/scummvm-android-themeengine.patch deleted file mode 100644 index 1eafe7fb62..0000000000 --- a/backends/platform/android/scummvm-android-themeengine.patch +++ /dev/null @@ -1,135 +0,0 @@ -diff -r 884e66fd1b9c gui/ThemeEngine.cpp ---- a/gui/ThemeEngine.cpp Tue Apr 13 09:30:52 2010 +1000 -+++ b/gui/ThemeEngine.cpp Fri May 28 23:24:43 2010 +1000 -@@ -390,21 +390,19 @@ - - // Try to create a Common::Archive with the files of the theme. - if (!_themeArchive && !_themeFile.empty()) { -- Common::FSNode node(_themeFile); -- if (node.getName().hasSuffix(".zip") && !node.isDirectory()) { -+ Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile); -+ if (member && member->getName().hasSuffix(".zip")) { - #ifdef USE_ZLIB -- Common::Archive *zipArchive = Common::makeZipArchive(node); -+ Common::Archive *zipArchive = Common::makeZipArchive(member->createReadStream()); - - if (!zipArchive) { -- warning("Failed to open Zip archive '%s'.", node.getPath().c_str()); -+ warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str()); - } - _themeArchive = zipArchive; - #else - warning("Trying to load theme '%s' in a Zip archive without zLib support", _themeFile.c_str()); - return false; - #endif -- } else if (node.isDirectory()) { -- _themeArchive = new Common::FSDirectory(node); - } - } - -@@ -1436,6 +1434,30 @@ - return tok.empty(); - } - -+bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName) { -+ Common::File stream; -+ bool foundHeader = false; -+ -+ if (member.getName().hasSuffix(".zip")) { -+#ifdef USE_ZLIB -+ Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream()); -+ -+ if (zipArchive && zipArchive->hasFile("THEMERC")) { -+ stream.open("THEMERC", *zipArchive); -+ } -+ -+ delete zipArchive; -+#endif -+ } -+ -+ if (stream.isOpen()) { -+ Common::String stxHeader = stream.readLine(); -+ foundHeader = themeConfigParseHeader(stxHeader, themeName); -+ } -+ -+ return foundHeader; -+} -+ - bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &themeName) { - Common::File stream; - bool foundHeader = false; -@@ -1493,10 +1515,6 @@ - if (ConfMan.hasKey("themepath")) - listUsableThemes(Common::FSNode(ConfMan.get("themepath")), list); - --#ifdef DATA_PATH -- listUsableThemes(Common::FSNode(DATA_PATH), list); --#endif -- - #if defined(MACOSX) || defined(IPHONE) - CFURLRef resourceUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); - if (resourceUrl) { -@@ -1509,10 +1527,7 @@ - } - #endif - -- if (ConfMan.hasKey("extrapath")) -- listUsableThemes(Common::FSNode(ConfMan.get("extrapath")), list); -- -- listUsableThemes(Common::FSNode("."), list, 1); -+ listUsableThemes(SearchMan, list); - - // Now we need to strip all duplicates - // TODO: It might not be the best idea to strip duplicates. The user might -@@ -1531,6 +1546,34 @@ - output.clear(); - } - -+void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List &list) { -+ ThemeDescriptor td; -+ -+#ifdef USE_ZLIB -+ Common::ArchiveMemberList fileList; -+ archive.listMatchingMembers(fileList, "*.zip"); -+ for (Common::ArchiveMemberList::iterator i = fileList.begin(); -+ i != fileList.end(); ++i) { -+ td.name.clear(); -+ if (themeConfigUsable(**i, td.name)) { -+ td.filename = (*i)->getName(); -+ td.id = (*i)->getDisplayName(); -+ -+ // If the name of the node object also contains -+ // the ".zip" suffix, we will strip it. -+ if (td.id.hasSuffix(".zip")) { -+ for (int j = 0; j < 4; ++j) -+ td.id.deleteLastChar(); -+ } -+ -+ list.push_back(td); -+ } -+ } -+ -+ fileList.clear(); -+#endif -+} -+ - void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List &list, int depth) { - if (!node.exists() || !node.isReadable() || !node.isDirectory()) - return; -diff -r 884e66fd1b9c gui/ThemeEngine.h ---- a/gui/ThemeEngine.h Tue Apr 13 09:30:52 2010 +1000 -+++ b/gui/ThemeEngine.h Fri May 28 23:24:43 2010 +1000 -@@ -560,11 +560,13 @@ - static void listUsableThemes(Common::List &list); - private: - static bool themeConfigUsable(const Common::FSNode &node, Common::String &themeName); -+ static bool themeConfigUsable(const Common::ArchiveMember &member, Common::String &themeName); - static bool themeConfigParseHeader(Common::String header, Common::String &themeName); - - static Common::String getThemeFile(const Common::String &id); - static Common::String getThemeId(const Common::String &filename); - static void listUsableThemes(const Common::FSNode &node, Common::List &list, int depth = -1); -+ static void listUsableThemes(Common::Archive &archive, Common::List &list); - - protected: - OSystem *_system; /** Global system object. */ -- cgit v1.2.3 From 2db4e71b6693f47f2fc48c78e8cff5e570c1f8d1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 Jul 2010 13:01:10 +0000 Subject: ALSA: Simplify device querying code. Thanks to eriktorbjorn for some quick testing. svn-id: r51366 --- backends/midi/alsa.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index a895ef8b80..1f7f7d2ba3 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -314,46 +314,41 @@ AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { MusicDevices AlsaMusicPlugin::getDevices() const { MusicDevices devices; - Common::Array used; AlsaDevices::iterator d; - int i; AlsaDevices alsaDevices = getAlsaDevices(); - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - used.push_back(false); - } - // Since the default behaviour is to use the first device in the list, // try to put something sensible there. We used to have 17:0 and 65:0 // as defaults. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - int client = d->getClient(); + for (d = alsaDevices.begin(); d != alsaDevices.end();) { + const int client = d->getClient(); + if (client == 17 || client == 65) { devices.push_back(MusicDevice(this, d->getName(), d->getType())); - used[i] = true; + d = alsaDevices.erase(d); + } else { + ++d; } } // 128:0 is probably TiMidity, or something like that, so that's // probably a good second choice. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { + for (d = alsaDevices.begin(); d != alsaDevices.end();) { if (d->getClient() == 128) { devices.push_back(MusicDevice(this, d->getName(), d->getType())); - used[i] = true; + d = alsaDevices.erase(d); + } else { + ++d; } } // Add the remaining devices in the order they were found. - for (i = 0, d = alsaDevices.begin(); d != alsaDevices.end(); ++i, ++d) { - - if (!used[i]) { - devices.push_back(MusicDevice(this, d->getName(), d->getType())); - } - } + for (d = alsaDevices.begin(); d != alsaDevices.end(); ++d) + devices.push_back(MusicDevice(this, d->getName(), d->getType())); return devices; } -- cgit v1.2.3 From 47f93e9d07e64b8746d9008afb1234744e095914 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 27 Jul 2010 16:35:28 +0000 Subject: ALSA: Tweak capability and type flags for the MIDI port This keeps ScummVM's own port from being included in the list of available MIDI devices. svn-id: r51378 --- backends/midi/alsa.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 1f7f7d2ba3..2b36cdc3cf 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -93,9 +93,14 @@ int MidiDriver_ALSA::open() { } snd_seq_set_client_group(seq_handle, "input"); - my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0", - SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE | - SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_MIDI_GENERIC); + // According to http://www.alsa-project.org/~tiwai/alsa-subs.html + // you can set read or write capabilities to allow other clients to + // read or write the port. I don't think we need that, unless maybe + // to be able to record the sound, but I can't get that to work even + // with those capabilities. + + my_port = snd_seq_create_simple_port(seq_handle, "SCUMMVM port 0", 0, + SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION); if (my_port < 0) { snd_seq_close(seq_handle); -- cgit v1.2.3 From bbd3f0dbb3f76417237882ae8dfe5acfab73b50b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 27 Jul 2010 17:18:02 +0000 Subject: ALSA: Be more intelligent when picking MIDI port Often, a client has more than one available port. Pick the first one that isn't already in use. For instance, on my computer client 17 is the "Emu10k1 WaveTable", and it has four available ports. If, say, aplaymidi is already playing on port 17:0, ScummVM will use port 17:1 instead. Otherwise the two programs will mess up each others instruments and controller settings. Of course, in reality I doubt that anyone will run two different MIDI playing applications at once. svn-id: r51380 --- backends/midi/alsa.cpp | 76 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 25 deletions(-) (limited to 'backends') diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp index 2b36cdc3cf..4f73d7384b 100644 --- a/backends/midi/alsa.cpp +++ b/backends/midi/alsa.cpp @@ -48,6 +48,17 @@ #define my_snd_seq_open(seqp) snd_seq_open(seqp, SND_SEQ_OPEN) #endif +#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) + +static int check_permission(snd_seq_port_info_t *pinfo) +{ + if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) { + if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)) + return 1; + } + return 0; +} + /* * parse address string */ @@ -109,7 +120,41 @@ int MidiDriver_ALSA::open() { } if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) { - // subscribe to MIDI port + // Subscribe to MIDI port. Prefer one that doesn't already have + // any connections, unless we've forced a port number already. + if (seq_port == -1) { + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + + snd_seq_get_any_client_info(seq_handle, seq_client, cinfo); + + int first_port = -1; + int found_port = -1; + + snd_seq_port_info_set_client(pinfo, seq_client); + snd_seq_port_info_set_port(pinfo, -1); + while (found_port == -1 && snd_seq_query_next_port(seq_handle, pinfo) >= 0) { + if (check_permission(pinfo)) { + if (first_port == -1) + first_port = snd_seq_port_info_get_port(pinfo); + if (found_port == -1 && snd_seq_port_info_get_write_use(pinfo) == 0) + found_port = snd_seq_port_info_get_port(pinfo); + } + } + + if (found_port == -1) { + // Should we abort here? For now, use the first + // available port. + seq_port = first_port; + warning("MidiDriver_ALSA: All ports on client %d (%s) are already in use", seq_client, snd_seq_client_info_get_name(cinfo)); + } else { + seq_port = found_port; + } + } + if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) { error("Can't subscribe to MIDI port (%d:%d) see README for help", seq_client, seq_port); } @@ -217,23 +262,21 @@ void MidiDriver_ALSA::send_event(int do_flush) { class AlsaDevice { public: - AlsaDevice(Common::String name, MusicType mt, int client, int port); + AlsaDevice(Common::String name, MusicType mt, int client); Common::String getName(); MusicType getType(); int getClient(); - int getPort(); private: Common::String _name; MusicType _type; int _client; - int _port; }; typedef Common::List AlsaDevices; -AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client, int port) - : _name(name), _type(mt), _client(client), _port(port) { +AlsaDevice::AlsaDevice(Common::String name, MusicType mt, int client) + : _name(name), _type(mt), _client(client) { } Common::String AlsaDevice::getName() { @@ -248,10 +291,6 @@ int AlsaDevice::getClient() { return _client; } -int AlsaDevice::getPort() { - return _port; -} - class AlsaMusicPlugin : public MusicPluginObject { public: const char *getName() const { @@ -270,17 +309,6 @@ private: static int parse_addr(const char *arg, int *client, int *port); }; -#define perm_ok(pinfo,bits) ((snd_seq_port_info_get_capability(pinfo) & (bits)) == (bits)) - -static int check_permission(snd_seq_port_info_t *pinfo) -{ - if (perm_ok(pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE)) { - if (!(snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_NO_EXPORT)) - return 1; - } - return 0; -} - AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { AlsaDevices devices; snd_seq_t *seq_handle; @@ -306,9 +334,7 @@ AlsaDevices AlsaMusicPlugin::getAlsaDevices() const { // TODO: Can we figure out the appropriate music type? MusicType type = MT_GM; int client = snd_seq_client_info_get_client(cinfo); - int port = snd_seq_port_info_get_port(pinfo); - - devices.push_back(AlsaDevice(name, type, client, port)); + devices.push_back(AlsaDevice(name, type, client)); } } } @@ -395,7 +421,7 @@ Common::Error AlsaMusicPlugin::createInstance(MidiDriver **mididriver, MidiDrive if (device.getCompleteId().equals(MidiDriver::getDeviceString(dev, MidiDriver::kDeviceId))) { found = true; seq_client = d->getClient(); - seq_port = d->getPort(); + seq_port = -1; break; } } -- cgit v1.2.3 From 264d17ccc7644440d4cd3dc64e14f3e0bd431fd4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:02:14 +0000 Subject: BUILD: Compile & link certain files only for specific BACKEND values svn-id: r51465 --- backends/module.mk | 47 +++++++++++++++++++++++++++++--------- backends/platform/dc/Makefile | 2 ++ backends/platform/ds/arm9/makefile | 2 ++ backends/platform/ds/module.mk | 1 - backends/platform/n64/Makefile | 2 ++ backends/platform/ps2/Makefile.gdb | 2 ++ backends/platform/ps2/Makefile.ps2 | 2 ++ backends/platform/psp/Makefile | 3 ++- 8 files changed, 48 insertions(+), 13 deletions(-) (limited to 'backends') diff --git a/backends/module.mk b/backends/module.mk index fb48f3d249..e0a3f4c683 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -6,16 +6,9 @@ MODULE_OBJS := \ fs/abstract-fs.o \ fs/stdiostream.o \ fs/amigaos4/amigaos4-fs-factory.o \ - fs/ds/ds-fs-factory.o \ fs/posix/posix-fs-factory.o \ - fs/ps2/ps2-fs-factory.o \ - fs/psp/psp-fs-factory.o \ - fs/psp/psp-stream.o \ fs/symbian/symbian-fs-factory.o \ fs/windows/windows-fs-factory.o \ - fs/wii/wii-fs-factory.o \ - fs/n64/n64-fs-factory.o \ - fs/n64/romfsstream.o \ keymapper/action.o \ keymapper/keymap.o \ keymapper/keymapper.o \ @@ -29,22 +22,54 @@ MODULE_OBJS := \ midi/timidity.o \ midi/dmedia.o \ midi/windows.o \ - plugins/dc/dc-provider.o \ plugins/posix/posix-provider.o \ plugins/sdl/sdl-provider.o \ plugins/win32/win32-provider.o \ - plugins/psp/psp-provider.o \ saves/savefile.o \ saves/default/default-saves.o \ saves/posix/posix-saves.o \ - saves/psp/psp-saves.o \ timer/default/default-timer.o \ - timer/psp/timer.o \ vkeybd/image-map.o \ vkeybd/polygon.o \ vkeybd/virtual-keyboard.o \ vkeybd/virtual-keyboard-gui.o \ vkeybd/virtual-keyboard-parser.o +ifeq ($(BACKEND),dc) +MODULE_OBJS += \ + plugins/dc/dc-provider.o +endif + +ifeq ($(BACKEND),ds) +MODULE_OBJS += \ + fs/ds/ds-fs-factory.o \ + fs/ds/ds-fs.o +endif + +ifeq ($(BACKEND),n64) +MODULE_OBJS += \ + fs/n64/n64-fs-factory.o \ + fs/n64/romfsstream.o +endif + +ifeq ($(BACKEND),ps2) +MODULE_OBJS += \ + fs/ps2/ps2-fs-factory.o +endif + +ifeq ($(BACKEND),psp) +MODULE_OBJS += \ + fs/psp/psp-fs-factory.o \ + fs/psp/psp-stream.o \ + plugins/psp/psp-provider.o \ + saves/psp/psp-saves.o \ + timer/psp/timer.o +endif + +ifeq ($(BACKEND),wii) +MODULE_OBJS += \ + fs/wii/wii-fs-factory.o +endif + # Include common rules include $(srcdir)/rules.mk diff --git a/backends/platform/dc/Makefile b/backends/platform/dc/Makefile index 2dcf9b7a7c..4494e8da78 100644 --- a/backends/platform/dc/Makefile +++ b/backends/platform/dc/Makefile @@ -69,6 +69,8 @@ OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \ MODULE_DIRS += ./ +BACKEND := dc + include $(srcdir)/Makefile.common scummvm.bin : scummvm.elf diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 079e23aec0..c99342c28e 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -251,6 +251,8 @@ ifdef WRAP_MALLOC DEFINES += -DWRAP_MALLOC endif +BACKEND := ds + INCLUDES= -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/engines \ -I$(portdir)/data -I$(portdir)/../commoninclude \ -I$(portdir)/source -I$(portdir)/source/mad \ diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index f6b69b3633..5f186f2528 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -8,7 +8,6 @@ PORT_OBJS := \ arm9/source/blitters_arm.o \ arm9/source/cdaudio.o \ arm9/source/dsmain.o \ - ../../fs/ds/ds-fs.o \ arm9/source/gbampsave.o \ arm9/source/scummhelp.o \ arm9/source/osystem_ds.o \ diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile index 914e6e9c9e..b8b2e61f77 100644 --- a/backends/platform/n64/Makefile +++ b/backends/platform/n64/Makefile @@ -64,6 +64,8 @@ ENABLE_SCUMM = $(ENABLED) OBJS := nintendo64.o osys_n64_base.o osys_n64_events.o osys_n64_utilities.o pakfs_save_manager.o framfs_save_manager.o +BACKEND := n64 + include $(srcdir)/Makefile.common MODULE_DIRS += ./ diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb index 41ac58d629..53646a9546 100644 --- a/backends/platform/ps2/Makefile.gdb +++ b/backends/platform/ps2/Makefile.gdb @@ -75,6 +75,8 @@ OBJS := backends/platform/ps2/DmaPipe.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 bf7ac0aca0..d2a8d210e4 100644 --- a/backends/platform/ps2/Makefile.ps2 +++ b/backends/platform/ps2/Makefile.ps2 @@ -75,6 +75,8 @@ OBJS := backends/platform/ps2/DmaPipe.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/psp/Makefile b/backends/platform/psp/Makefile index 994d201f65..617ef7c8cc 100644 --- a/backends/platform/psp/Makefile +++ b/backends/platform/psp/Makefile @@ -64,7 +64,6 @@ ifeq ($(PSPSDK),) $(error $$(PSPSDK) cannot be obtained.) endif - # Variables for common Scummvm makefile CXX = psp-g++ CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti @@ -151,6 +150,8 @@ OBJS := powerman.o \ mp3.o \ tests.o +BACKEND := psp + # Include common Scummvm makefile include $(srcdir)/Makefile.common -- cgit v1.2.3 From 2692e55208d8945b24d9a6c451a61856ed601a94 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:02:30 +0000 Subject: BUILD: Fix MODULE_DIRS for WinCE port svn-id: r51466 --- backends/platform/wince/module.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/wince/module.mk b/backends/platform/wince/module.mk index 6e328b0af4..6b438f91c9 100644 --- a/backends/platform/wince/module.mk +++ b/backends/platform/wince/module.mk @@ -29,7 +29,9 @@ MODULE_OBJS := \ smartLandScale.o MODULE_DIRS += \ - backends/platform/wince/ + backends/platform/wince/ \ + backends/platform/wince/CEgui/ \ + backends/platform/wince/CEkeys/ # We don't use the rules.mk here on purpose OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) $(OBJS) -- cgit v1.2.3 From d22ebd358dec75762c97f30d8a2fa8630e4268c2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 13:03:21 +0000 Subject: BUILD: Unify how MODULE_DIRS is computed for backends This should help avoid situations where MODULE_DIRS is not set to a complete list of build dirs (which causes troubles with the automatic header dependency detection logic). On the long run, we should replace the relevant code by a macro or also use rules.mk for this (with yet another if/else case add to it). svn-id: r51467 --- backends/platform/android/module.mk | 9 ++++----- backends/platform/dc/module.mk | 9 ++++----- backends/platform/ds/module.mk | 9 ++++----- backends/platform/gp2x/module.mk | 9 ++++----- backends/platform/gp2xwiz/module.mk | 9 ++++----- backends/platform/iphone/module.mk | 9 ++++----- backends/platform/linuxmoto/module.mk | 9 ++++----- backends/platform/n64/module.mk | 9 ++++----- backends/platform/null/module.mk | 9 ++++----- backends/platform/ps2/module.mk | 9 ++++----- backends/platform/psp/module.mk | 9 ++++----- backends/platform/samsungtv/module.mk | 9 ++++----- backends/platform/sdl/module.mk | 9 ++++----- backends/platform/wii/module.mk | 9 ++++----- backends/platform/wince/module.mk | 11 ++++------- 15 files changed, 60 insertions(+), 77 deletions(-) (limited to 'backends') diff --git a/backends/platform/android/module.mk b/backends/platform/android/module.mk index c7b98b996d..b457b388b1 100644 --- a/backends/platform/android/module.mk +++ b/backends/platform/android/module.mk @@ -3,11 +3,10 @@ MODULE := backends/platform/android MODULE_OBJS := \ android.o asset-archive.o video.o -MODULE_DIRS += \ - backends/platform/android/ - -# 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))) JAVA_SRC = \ $(MODULE)/org/inodes/gus/scummvm/ScummVM.java \ diff --git a/backends/platform/dc/module.mk b/backends/platform/dc/module.mk index eecb91909c..c52ca1a474 100644 --- a/backends/platform/dc/module.mk +++ b/backends/platform/dc/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/dc MODULE_OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \ label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o -MODULE_DIRS += \ - backends/platform/dc/ - -# 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))) diff --git a/backends/platform/ds/module.mk b/backends/platform/ds/module.mk index 5f186f2528..7298267db4 100644 --- a/backends/platform/ds/module.mk +++ b/backends/platform/ds/module.mk @@ -98,11 +98,10 @@ $(MODULE)/arm9/source/touchkeyboard.o: \ MODULE_DIRS += \ - backends/platform/ds/ \ backends/platform/ds/arm7/source/ \ backends/platform/ds/arm7/source/libcartreset/ \ - backends/platform/ds/arm9/source/ \ - backends/platform/ds/arm9/source/fat/ -# 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))) diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk index 50a771219a..d4f145c64f 100644 --- a/backends/platform/gp2x/module.mk +++ b/backends/platform/gp2x/module.mk @@ -7,8 +7,7 @@ MODULE_OBJS := \ graphics.o \ gp2x.o \ -MODULE_DIRS += \ - backends/platform/gp2x/ - -# 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))) diff --git a/backends/platform/gp2xwiz/module.mk b/backends/platform/gp2xwiz/module.mk index f457d51615..edf2f2a717 100644 --- a/backends/platform/gp2xwiz/module.mk +++ b/backends/platform/gp2xwiz/module.mk @@ -6,11 +6,10 @@ MODULE_OBJS := \ gp2xwiz-hw.o \ gp2xwiz-main.o -MODULE_DIRS += \ - backends/platform/gp2xwiz/ - -# 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 \ No newline at end of file diff --git a/backends/platform/iphone/module.mk b/backends/platform/iphone/module.mk index 28bc8d3ac7..9768e6ded4 100644 --- a/backends/platform/iphone/module.mk +++ b/backends/platform/iphone/module.mk @@ -10,8 +10,7 @@ MODULE_OBJS := \ iphone_keyboard.o \ blit_arm.o -MODULE_DIRS += \ - backends/platform/iphone/ - -# 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))) diff --git a/backends/platform/linuxmoto/module.mk b/backends/platform/linuxmoto/module.mk index 8123d6e2ac..316ecbf78e 100644 --- a/backends/platform/linuxmoto/module.mk +++ b/backends/platform/linuxmoto/module.mk @@ -7,11 +7,10 @@ MODULE_OBJS := \ linuxmoto-sdl.o \ hardwarekeys.o -MODULE_DIRS += \ - backends/platform/linuxmoto/ - -# 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: The linuxmoto backend is based on the SDL one, so we load that, too. include $(srcdir)/backends/platform/sdl/module.mk diff --git a/backends/platform/n64/module.mk b/backends/platform/n64/module.mk index 34a7badb44..8fb6ba49ab 100644 --- a/backends/platform/n64/module.mk +++ b/backends/platform/n64/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/n64 MODULE_OBJS := \ nintendo64.o -MODULE_DIRS += \ - backends/platform/n64/ - -# 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))) diff --git a/backends/platform/null/module.mk b/backends/platform/null/module.mk index 12a2cbc510..30345d7ac2 100644 --- a/backends/platform/null/module.mk +++ b/backends/platform/null/module.mk @@ -3,8 +3,7 @@ MODULE := backends/platform/null MODULE_OBJS := \ null.o -MODULE_DIRS += \ - backends/platform/null/ - -# 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))) diff --git a/backends/platform/ps2/module.mk b/backends/platform/ps2/module.mk index 86b12cb668..bf95a5501d 100644 --- a/backends/platform/ps2/module.mk +++ b/backends/platform/ps2/module.mk @@ -18,8 +18,7 @@ MODULE_OBJS := \ ps2time.o \ ps2debug.o -MODULE_DIRS += \ - backends/platform/ps2/ - -# 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))) diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk index 855554e980..4652189ab4 100644 --- a/backends/platform/psp/module.mk +++ b/backends/platform/psp/module.mk @@ -19,8 +19,7 @@ MODULE_OBJS := powerman.o \ mp3.o \ tests.o -MODULE_DIRS += \ - backends/platform/psp/ - -# 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))) diff --git a/backends/platform/samsungtv/module.mk b/backends/platform/samsungtv/module.mk index 27e2cfa77d..d7ebe75080 100644 --- a/backends/platform/samsungtv/module.mk +++ b/backends/platform/samsungtv/module.mk @@ -5,8 +5,7 @@ MODULE_OBJS := \ main.o \ samsungtv.o -MODULE_DIRS += \ - backends/platform/samsungtv/ - -# 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))) diff --git a/backends/platform/sdl/module.mk b/backends/platform/sdl/module.mk index f6ec769253..43751a57b2 100644 --- a/backends/platform/sdl/module.mk +++ b/backends/platform/sdl/module.mk @@ -7,8 +7,7 @@ MODULE_OBJS := \ main.o \ sdl.o -MODULE_DIRS += \ - backends/platform/sdl/ - -# 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))) diff --git a/backends/platform/wii/module.mk b/backends/platform/wii/module.mk index cf55a182c0..88e75fba26 100644 --- a/backends/platform/wii/module.mk +++ b/backends/platform/wii/module.mk @@ -8,8 +8,7 @@ MODULE_OBJS := \ osystem_sfx.o \ osystem_events.o -MODULE_DIRS += \ - backends/platform/wii/ - -# 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))) diff --git a/backends/platform/wince/module.mk b/backends/platform/wince/module.mk index 6b438f91c9..2d852670f8 100644 --- a/backends/platform/wince/module.mk +++ b/backends/platform/wince/module.mk @@ -28,10 +28,7 @@ MODULE_OBJS := \ PocketSCUMM.o \ smartLandScale.o -MODULE_DIRS += \ - backends/platform/wince/ \ - backends/platform/wince/CEgui/ \ - backends/platform/wince/CEkeys/ - -# 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))) -- cgit v1.2.3 From 8de57b0b2942cfd039c5bef47699809f2b5ccc60 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 16:24:08 +0000 Subject: DS: Get rid of DS_NON_SCUMM_BUILD and DS_SCUMM_BUILD svn-id: r51473 --- backends/platform/ds/arm9/makefile | 24 ++++++++++++------------ backends/platform/ds/arm9/source/dsoptions.cpp | 6 ------ 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index c99342c28e..fac50178b4 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -110,7 +110,7 @@ USE_ARM_COSTUME_ASM = 1 #WRAP_MALLOC = 1 ifdef DS_BUILD_A - DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM + DEFINES = -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM LOGO = logoa.bmp ENABLE_SCUMM = STATIC_PLUGIN USE_ARM_GFX_ASM = 1 @@ -118,7 +118,7 @@ ifdef DS_BUILD_A endif ifdef DS_BUILD_B - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_B + DEFINES = -DDS_BUILD_B LOGO = logob.bmp ENABLE_SKY = STATIC_PLUGIN ENABLE_QUEEN = STATIC_PLUGIN @@ -126,14 +126,14 @@ ifdef DS_BUILD_B endif ifdef DS_BUILD_C - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_C + DEFINES = -DDS_BUILD_C LOGO = logoc.bmp ENABLE_AGOS = STATIC_PLUGIN BUILD=scummvm-C endif ifdef DS_BUILD_D - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_D + DEFINES = -DDS_BUILD_D LOGO = logod.bmp ENABLE_GOB = STATIC_PLUGIN ENABLE_CINE = STATIC_PLUGIN @@ -142,42 +142,42 @@ ifdef DS_BUILD_D endif ifdef DS_BUILD_E - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_E + DEFINES = -DDS_BUILD_E LOGO = logoe.bmp ENABLE_SAGA = STATIC_PLUGIN BUILD=scummvm-E endif ifdef DS_BUILD_F - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_F + DEFINES = -DDS_BUILD_F LOGO = logof.bmp ENABLE_KYRA = STATIC_PLUGIN BUILD=scummvm-F endif ifdef DS_BUILD_G - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_G + DEFINES = -DDS_BUILD_G LOGO = logog.bmp ENABLE_LURE = STATIC_PLUGIN BUILD=scummvm-G endif ifdef DS_BUILD_H - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_H + DEFINES = -DDS_BUILD_H LOGO = logoh.bmp ENABLE_PARALLACTION = STATIC_PLUGIN BUILD=scummvm-H endif ifdef DS_BUILD_I - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_I + DEFINES = -DDS_BUILD_I LOGO = logoi.bmp ENABLE_MADE = STATIC_PLUGIN BUILD=scummvm-I endif ifdef DS_BUILD_K - DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_K + DEFINES = -DDS_BUILD_K LOGO = logok.bmp ENABLE_CRUISE = STATIC_PLUGIN BUILD=scummvm-K @@ -185,14 +185,14 @@ endif #ifdef DS_BUILD_L -# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_L +# DEFINES = -DDS_BUILD_L # LOGO = logog.bmp # ENABLE_DRASCULA = STATIC_PLUGIN # BUILD=scummvm-K #endif #ifdef DS_BUILD_M -# DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_M +# DEFINES = -DDS_BUILD_M # LOGO = logog.bmp # ENABLE_TUCKER = STATIC_PLUGIN # BUILD=scummvm-K diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp index cc89c41017..6721a4910a 100644 --- a/backends/platform/ds/arm9/source/dsoptions.cpp +++ b/backends/platform/ds/arm9/source/dsoptions.cpp @@ -128,12 +128,6 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { _radioButtonMode = false; -#ifdef DS_SCUMM_BUILD - if (!DS::isGBAMPAvailable()) { -// addButton(this, 100, 140, "Delete Save", 0, 'dels', 'D'); - } -#endif - // new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", Graphics::kTextAlignCenter); -- cgit v1.2.3 From 148c830d769aaf4fd4e08e46284d419ff0c93f18 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 29 Jul 2010 16:24:25 +0000 Subject: DS: Add WRAP_MALLOC support to ds.mk, update comments svn-id: r51474 --- backends/platform/ds/ds.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 27309663d1..97f104c391 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -12,6 +12,11 @@ # build I: --enable-made --disable-mad # build K: --enable-cruise --disable-mad # +# However, this could be automated using a simple script, which generates +# subdirs for each build, and runs configure in those subdirs with the right +# parameters (all builds would still share the same set of source code files, +# thanks to our "out of tree" building support). +# # This does not currently take care of some things: # * It does not #define DS_BUILD_A etc. -- most uses of that should be # eliminated, though. Only usage should be for selecting the default config @@ -21,6 +26,9 @@ # too; we need to investigate those. # * It does not currently adjust the logo. Ideally, if we ever get real plugin # support, that should be necessary anymore anyway. +# * No support for USE_DEBUGGER and USE_PROFILER yet. I envision that we would +# integrate them with the --enable-debug and --enable-profiling configure options, +# I simply haven't gotten around to do that yet. # * ... # Set location of ndsdir so that we can easily refer to files in it @@ -59,6 +67,12 @@ LOGO = logoa.bmp # folder. +ifdef WRAP_MALLOC + LDFLAGS += -Wl,--wrap,malloc + DEFINES += -DWRAP_MALLOC +endif + + # Compiler options for files which should be optimised for speed OPT_SPEED := -O3 -- cgit v1.2.3 From 3e8a972602663810465414cd9aad6dddab6a2f14 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Thu, 29 Jul 2010 19:11:49 +0000 Subject: DC: Specialize createConfig{Read,Write}Stream Implement platform-specific variants of createConfigReadStream() and createConfigWriteStream(), instead of inheriting the BaseBackend definitions. Nonstandard behavious is as follows: * createConfigWriteStream() always returns 0 (read-only filesystem) * createConfigReadStream() returns an empty MemoryReadStream instead of NULL if scummvm.ini does not exist. This is to make sure that loadDefaultConfigFile() always clears out any old config data, as I'll want to restart config parsing from scratch after a disc swap. svn-id: r51478 --- backends/platform/dc/dc.h | 3 +++ backends/platform/dc/dcmain.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) (limited to 'backends') diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index e87a0a8c90..057ab283cf 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -233,6 +233,9 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys Common::SaveFileManager *createSavefileManager(); + + Common::SeekableReadStream *createConfigReadStream(); + Common::WriteStream *createConfigWriteStream(); }; diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 5a9286093f..5fde919650 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -31,6 +31,7 @@ #include "icon.h" #include "DCLauncherDialog.h" #include +#include #include "backends/plugins/dc/dc-provider.h" #include "sound/mixer_intern.h" @@ -206,6 +207,16 @@ void OSystem_Dreamcast::getTimeAndDate(TimeDate &td) const { td.tm_year = t.tm_year; } +Common::SeekableReadStream *OSystem_Dreamcast::createConfigReadStream() { + Common::FSNode file("/scummvm.ini"); + Common::SeekableReadStream *s = file.createReadStream(); + return s? s : new Common::MemoryReadStream((const byte *)"", 0); +} + +Common::WriteStream *OSystem_Dreamcast::createConfigWriteStream() { + return 0; +} + void DCHardware::dc_init_hardware() { #ifndef NOSERIAL -- cgit v1.2.3 From 630127bc077e56c619c816a89e1d577c38b5eafb Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Thu, 29 Jul 2010 20:37:56 +0000 Subject: DC: Let scummvm.ini override autodetect of games If a game CD has a scummvm.ini file with at least one game domain in it, the normal autodetection is now bypassed and a menu of only the games in the .ini file is presented instead. The descriptions of the games are taken from the .ini file, but icons are still scanned for in the old fashion. Note that previously ScummVM would read global options from the scummvm.ini file on the boot disc (if present), but now global options are instead taken from the scummvm.ini on the game disc (in case of a disc swap). svn-id: r51480 --- backends/platform/dc/selector.cpp | 98 ++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 31 deletions(-) (limited to 'backends') diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 0d8e0a0188..0d9b931d2c 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "dc.h" #include "icon.h" #include "label.h" @@ -200,12 +201,43 @@ static bool uniqueGame(const char *base, const char *dir, return true; } -static int findGames(Game *games, int max) +static int findGames(Game *games, int max, bool use_ini) { Dir *dirs = new Dir[MAX_DIR]; - int curr_game = 0, curr_dir = 0, num_dirs = 1; - dirs[0].node = Common::FSNode(""); - while (curr_game < max && curr_dir < num_dirs) { + int curr_game = 0, curr_dir = 0, num_dirs = 0; + + if (use_ini) { + ConfMan.loadDefaultConfigFile(); + Common::ConfigManager::DomainMap &game_domains = ConfMan.getGameDomains(); + for(Common::ConfigManager::DomainMap::const_iterator i = + game_domains.begin(); curr_game < max && i != game_domains.end(); i++) { + Common::String path = (*i)._value["path"]; + if (path.size() && path.lastChar() != '/') + path += "/"; + int j; + for (j=0; j= num_dirs) { + if (num_dirs >= MAX_DIR) + continue; + dirs[j = num_dirs++].node = Common::FSNode(path); + } + if (curr_game < max) { + strcpy(games[curr_game].filename_base, (*i)._key.c_str()); + strncpy(games[curr_game].dir, dirs[j].node.getPath().c_str(), 256); + games[curr_game].dir[255] = '\0'; + games[curr_game].language = Common::UNK_LANG; + games[curr_game].platform = Common::kPlatformUnknown; + strcpy(games[curr_game].text, (*i)._value["description"].c_str()); + curr_game++; + } + } + } else { + dirs[num_dirs++].node = Common::FSNode(""); + } + + while ((curr_game < max || use_ini) && curr_dir < num_dirs) { strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252); dirs[curr_dir].name[251] = '\0'; dirs[curr_dir].deficon[0] = '\0'; @@ -214,44 +246,46 @@ static int findGames(Game *games, int max) for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end(); ++entry) { if (entry->isDirectory()) { - if (num_dirs < MAX_DIR && strcasecmp(entry->getDisplayName().c_str(), - "install")) { + if (!use_ini && num_dirs < MAX_DIR && + strcasecmp(entry->getDisplayName().c_str(), "install")) { dirs[num_dirs].node = *entry; num_dirs++; } } else if (isIcon(*entry)) strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str()); - else + else if(!use_ini) files.push_back(*entry); } - GameList candidates = EngineMan.detectGames(files); - - for (GameList::const_iterator ge = candidates.begin(); - ge != candidates.end(); ++ge) - if (curr_game < max) { - strcpy(games[curr_game].filename_base, ge->gameid().c_str()); - strcpy(games[curr_game].dir, dirs[curr_dir-1].name); - games[curr_game].language = ge->language(); - games[curr_game].platform = ge->platform(); - if (uniqueGame(games[curr_game].filename_base, - games[curr_game].dir, - games[curr_game].language, - games[curr_game].platform, games, curr_game)) { - - strcpy(games[curr_game].text, ge->description().c_str()); + if (!use_ini) { + GameList candidates = EngineMan.detectGames(files); + + for (GameList::const_iterator ge = candidates.begin(); + ge != candidates.end(); ++ge) + if (curr_game < max) { + strcpy(games[curr_game].filename_base, ge->gameid().c_str()); + strcpy(games[curr_game].dir, dirs[curr_dir-1].name); + games[curr_game].language = ge->language(); + games[curr_game].platform = ge->platform(); + if (uniqueGame(games[curr_game].filename_base, + games[curr_game].dir, + games[curr_game].language, + games[curr_game].platform, games, curr_game)) { + + strcpy(games[curr_game].text, ge->description().c_str()); #if 0 - printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n", - games[curr_game].text, - (int)games[curr_game].language, - (int)games[curr_game].platform, - games[curr_game].dir, games[curr_game].filename_base, - dirs[curr_dir-1].name); + printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n", + games[curr_game].text, + (int)games[curr_game].language, + (int)games[curr_game].platform, + games[curr_game].dir, games[curr_game].filename_base, + dirs[curr_dir-1].name); #endif - curr_game++; + curr_game++; + } } - } + } } for (int i=0; i> 4; - srcWord = src32[0]; - - while (words4--) { + srcWord = *src32; // preload 1st word so we read ahead + + for (; words4; words4--) { dstWord = srcWord >> shiftValue; srcWord = src32[1]; dstWord |= srcWord << lastShiftValue; @@ -348,22 +344,29 @@ uint32 PspMemory::misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, dst32 += 4; } - uint32 words = (bytes & 0xF) >> 2; + uint32 words = (bytes & 0xF) >> 2; // now get remaining words // we read one word ahead of what we write // setup the first read - if (words) { - src32++; // we already loaded the value, so just increment + + for (; words ;words--) { + dstWord = srcWord >> shiftValue; + srcWord = src32[1]; // we still go one ahead + src32++; + dstWord |= srcWord << lastShiftValue; + *dst32++ = dstWord; + } + + uint32 bytesLeft = bytes & 3; // and remaining bytes - while (words--) { - dstWord = srcWord >> shiftValue; - srcWord = *src32++; - dstWord |= srcWord << lastShiftValue; - *dst32++ = dstWord; + if (bytesLeft) { + byte *dst8 = (byte *)dst32; + byte *src8 = ((byte *)src32) + ((uint32)src & 0x3); // get exact location we should be at + + for(; bytesLeft; bytesLeft--) { + *dst8++ = *src8++; } } - - return (byte *)dst32 - (byte *)origDst32; } // More challenging -- need to shift diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index c9b3d21cb6..793bc94888 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -52,7 +52,6 @@ private: static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); - static uint32 misaligned32Detail(uint32 *dst32, uint32 *src32, uint32 bytes, uint32 alignSrc, const uint32 shiftValue, const uint32 lastShiftValue); static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); -- cgit v1.2.3 From 450b82355d05f52bb900bcd4656ea850442b5140 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 31 Jul 2010 22:42:42 +0000 Subject: DS: Fix custom DS build system svn-id: r51555 --- backends/platform/ds/arm9/makefile | 4 ++-- backends/platform/ds/arm9/source/portdefs.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index fac50178b4..78638bdab8 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -297,14 +297,14 @@ ifdef USE_PROFILER endif -DATA_OBJS := +DATA_OBJS := \ $(portdir)/data/icons.o \ $(portdir)/data/keyboard.o \ $(portdir)/data/keyboard_pal.o \ $(portdir)/data/default_font.o \ $(portdir)/data/8x8font_tga.o -FAT_OBJS := +FAT_OBJS := \ $(portdir)/source/fat/disc_io.o \ $(portdir)/source/fat/gba_nds_fat.o \ $(portdir)/source/fat/io_fcsr.o \ diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index bdb42993d1..c08f994e8e 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -26,6 +26,9 @@ #ifndef _PORTDEFS_H_ #define _PORTDEFS_H_ +// 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. #include -- cgit v1.2.3 From 4b9df2203f065293ac4067f76fd58afe87d4e3c8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 31 Jul 2010 22:43:09 +0000 Subject: DS: Add shell script which emulates old DS builds using configure&make svn-id: r51556 --- backends/platform/ds/setup-builddirs.sh | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 backends/platform/ds/setup-builddirs.sh (limited to 'backends') diff --git a/backends/platform/ds/setup-builddirs.sh b/backends/platform/ds/setup-builddirs.sh new file mode 100755 index 0000000000..9d9cf3ffb6 --- /dev/null +++ b/backends/platform/ds/setup-builddirs.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# TODO: Allow specifying (a list of) build ids (a, b, ...) on the command line. +# TODO: Allow overriding the LOGO variable + +# TODO: Computer srcdir in a better way +srcdir=../../../`dirname $0`/.. + +BASE_PARAM="--host=ds --disable-translation --disable-all-engines" + +for build in a b c d e f g h i k; do + echo "--- Setting up build $build ---" + mkdir -p build-$build && cd build-$build + case $build in + a) + EXTRA_PARAM="--enable-scumm" + ;; + b) + EXTRA_PARAM="--enable-sky --enable-queen" + ;; + c) + EXTRA_PARAM="--enable-agos" + ;; + d) + EXTRA_PARAM="--enable-gob --enable-cine --enable-agi" + ;; + e) + EXTRA_PARAM="--enable-saga --disable-mad" + ;; + f) + EXTRA_PARAM="--enable-kyra --disable-mad" + ;; + g) + EXTRA_PARAM="--enable-lure" + ;; + h) + EXTRA_PARAM="--enable-parallaction" + ;; + i) + EXTRA_PARAM="--enable-made --disable-mad" + ;; + k) + EXTRA_PARAM="--enable-cruise --disable-mad" + ;; + *) + echo "Invalid build $build selected" + exit 1 + ;; + esac + + defname="DS_BUILD_`echo $build | tr '[a-z]' '[A-Z]'`" + CPPFLAGS="$CPPFLAGS -D$defname" + $srcdir/configure $BASE_PARAM $EXTRA_PARAM + cd .. + echo DONE + echo +done -- cgit v1.2.3 From 57ad0408461b5551ae16962940e7f8e57fa43522 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 31 Jul 2010 22:48:49 +0000 Subject: DS: Remove now redundant ds-fs.o from PORT_OBJS svn-id: r51558 --- backends/platform/ds/arm9/makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 78638bdab8..0446f84dad 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -281,7 +281,6 @@ PORT_OBJS := \ $(portdir)/source/blitters_arm.o \ $(portdir)/source/cdaudio.o \ $(portdir)/source/dsmain.o \ - $(portdir)/../../../fs/ds/ds-fs.o \ $(portdir)/source/gbampsave.o \ $(portdir)/source/scummhelp.o \ $(portdir)/source/osystem_ds.o \ -- cgit v1.2.3 From 0db8427f46674f8a835e606aa01eef4b50bf0f22 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Sun, 1 Aug 2010 07:15:43 +0000 Subject: iPhone: changed GL_NEAREST to GL_LINEAR in miniaturization filter as per forum post 29/7/10 svn-id: r51567 --- backends/platform/iphone/iphone_video.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index faa0719b6c..cd8b38acb3 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -276,7 +276,7 @@ uint getSizeNextPOT(uint size) { glGenTextures(1, &_screenTexture); glBindTexture(GL_TEXTURE_2D, _screenTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); if (_textureBuffer) { free(_textureBuffer); -- cgit v1.2.3 From 2e94391d982656a9120483796c36fd8d46529a36 Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Sun, 1 Aug 2010 17:16:39 +0000 Subject: CONFIGURE: add support for N64 port to configure svn-id: r51581 --- backends/platform/n64/module.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/n64/module.mk b/backends/platform/n64/module.mk index 8fb6ba49ab..429b63802e 100644 --- a/backends/platform/n64/module.mk +++ b/backends/platform/n64/module.mk @@ -1,7 +1,12 @@ MODULE := backends/platform/n64 MODULE_OBJS := \ - nintendo64.o + nintendo64.o \ + osys_n64_base.o \ + osys_n64_events.o \ + osys_n64_utilities.o \ + pakfs_save_manager.o \ + framfs_save_manager.o # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) -- cgit v1.2.3 From 2682721aac813939f61105c40584373e3a30053c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 2 Aug 2010 17:11:43 +0000 Subject: DS: Reorder & complete list of OPT_SPEED files; some tweaks Add -mno-thumb to OPT_SPEED to override the -mthumb from OPT_SIZE. svn-id: r51636 --- backends/platform/ds/ds.mk | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk index 97f104c391..a9ed3e0096 100644 --- a/backends/platform/ds/ds.mk +++ b/backends/platform/ds/ds.mk @@ -75,7 +75,7 @@ endif # Compiler options for files which should be optimised for speed -OPT_SPEED := -O3 +OPT_SPEED := -O3 -mno-thumb # Compiler options for files which should be optimised for space OPT_SIZE := -Os -mthumb @@ -83,31 +83,46 @@ OPT_SIZE := -Os -mthumb # By default optimize for size CXXFLAGS += $(OPT_SIZE) -# Files listed below will be optimisied for speed, otherwise they will be optimised for space -# TODO: speed original list contained three more files that should be optimized -# for speed: actor.cpp gfx.cpp sprite.cpp -- but there are many files with these -# names, which are the "right" ones? +# Files listed below will be optimisied for speed, otherwise they will be optimised for space. +# TODO: Several of these files probably should not be optimized for speed, but for now +# we replicate the *precise* list from the old DS makefile, to ensure full compatibility. +# Eventually, we should tune this list. +$(ndsdir)/arm9/source/blitters.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) $(ndsdir)/arm9/source/dsmain.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) $(ndsdir)/arm9/source/osystem_ds.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -$(ndsdir)/arm9/source/blitters.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -$(ndsdir)/arm9/source/ds_main.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/saga/isomap.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +base/main.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) sound/rate.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/saga/actor_walk.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +sound/softsynth/opl/mame.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/agi/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/agos/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/agos/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/cine/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/cruise/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/cruise/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/draci/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/draci/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/gob/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/groovie/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/kyra/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/m4/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/m4/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/m4/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/made/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) engines/saga/actor_path.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/saga/image.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -sound/fmopl.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/actor_walk.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) engines/saga/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/scumm/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/m4/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/scumm/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/cine/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/agos/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) engines/saga/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/image.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/isomap.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/saga/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) engines/saga/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/m4/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -engines/agi/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -# TODO: Fingolfin says: optimizing staticres for size would +engines/sci/engine/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/scumm/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/scumm/gfx.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/scumm/script.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/sword2/sprite.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +engines/teenagent/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) +# TODO: Fingolfin says: optimizing kyra/staticres.o for size would # save about 30k, so maybe consider that? #engines/kyra/staticres.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED) -- cgit v1.2.3 From 8a3a41bc2b14c9eedeafc588de42e05860809045 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 2 Aug 2010 17:12:03 +0000 Subject: DS: More closely immitate CXXFLAGS of custom DS build system svn-id: r51637 --- backends/platform/ds/arm9/makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/makefile b/backends/platform/ds/arm9/makefile index 0446f84dad..eedf75c256 100644 --- a/backends/platform/ds/arm9/makefile +++ b/backends/platform/ds/arm9/makefile @@ -205,7 +205,6 @@ CXX = arm-eabi-g++ LD = arm-eabi-g++ CFLAGS = -Wno-multichar -Wall\ - -Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \ -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\ -mthumb-interwork -DUSE_ARM_COSTUME_ASM=1 -DDISABLE_SID -- cgit v1.2.3 From 8d1890d9313bab67997353e68241a1ceb8d15fb2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 2 Aug 2010 17:12:20 +0000 Subject: DS: Disable debug mode in setup-builddirs.sh svn-id: r51638 --- backends/platform/ds/setup-builddirs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/ds/setup-builddirs.sh b/backends/platform/ds/setup-builddirs.sh index 9d9cf3ffb6..11aacc1233 100755 --- a/backends/platform/ds/setup-builddirs.sh +++ b/backends/platform/ds/setup-builddirs.sh @@ -6,7 +6,7 @@ # TODO: Computer srcdir in a better way srcdir=../../../`dirname $0`/.. -BASE_PARAM="--host=ds --disable-translation --disable-all-engines" +BASE_PARAM="--host=ds --disable-translation --disable-debug --disable-all-engines" for build in a b c d e f g h i k; do echo "--- Setting up build $build ---" -- cgit v1.2.3 From 2f4d2b58de1e4109cb454180b402708146476a8c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 2 Aug 2010 17:12:52 +0000 Subject: DS: Allow disabling assert via NDEBUG; cleanup svn-id: r51640 --- backends/platform/ds/arm9/source/portdefs.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'backends') diff --git a/backends/platform/ds/arm9/source/portdefs.h b/backends/platform/ds/arm9/source/portdefs.h index c08f994e8e..cc38d66a73 100644 --- a/backends/platform/ds/arm9/source/portdefs.h +++ b/backends/platform/ds/arm9/source/portdefs.h @@ -52,6 +52,7 @@ #define STREAM_AUDIO_FROM_DISK #endif +// FIXME: What is "NO_DEBUG_MSGS" good for? #define NO_DEBUG_MSGS // This is defined in dsmain.cpp @@ -68,16 +69,22 @@ void consolePrintf(const char *format, ...); #undef assert #endif +#ifdef NDEBUG + +#define assert(e) ((void)0) + +#else + +// FIXME: Shouldn't assert() also bail out / exit / halt the program? Right now we just +// print an error message... #define assert(s) \ do { \ - if (!(s)) \ + if (!(s)) { \ consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__); \ + } \ } while (0) -//#include "ds-fs.h" - -//#define debug(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__) -//#define debug(fmt, ...) debug(0, fmt, ##__VA_ARGS__) +#endif // FIXME: Since I can't change the engine at the moment (post lockdown) this define can go here. // This define changes the mouse-relative motion which doesn't make sense on a touch screen to -- cgit v1.2.3 From bde60490adf6ef10cfe68460b12c310377641c4a Mon Sep 17 00:00:00 2001 From: Fabio Battaglia Date: Mon, 2 Aug 2010 20:28:14 +0000 Subject: N64: mention hkz-libn64 download location in port readme svn-id: r51656 --- backends/platform/n64/README.N64 | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backends') diff --git a/backends/platform/n64/README.N64 b/backends/platform/n64/README.N64 index 1cdd82e1e9..276436b676 100644 --- a/backends/platform/n64/README.N64 +++ b/backends/platform/n64/README.N64 @@ -13,6 +13,8 @@ Requirements Build cart images from sources ============================== +You can download hkz-libn64 sources from here: http://hkzlab.ipv7.net/consoles.html +hkz-libn64 is a library to control Nintendo64 hardware (es, video, audio, input, etc.). * TODO * Build cart images from binaries -- cgit v1.2.3 From 3b4b00cf5099e3720ae93bff17c7778389b5ff62 Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Tue, 3 Aug 2010 12:29:08 +0000 Subject: PSP: Factored out thread creation routines into PspThreadable class. This should aid in further optimizations. svn-id: r51685 --- backends/platform/psp/audio.cpp | 45 +++++-------------------------- backends/platform/psp/audio.h | 10 +++---- backends/platform/psp/display_manager.cpp | 30 ++++++--------------- backends/platform/psp/display_manager.h | 12 +++++---- backends/platform/psp/thread.cpp | 45 ++++++++++++++++++++++++++++++- backends/platform/psp/thread.h | 20 ++++++++++++-- 6 files changed, 89 insertions(+), 73 deletions(-) (limited to 'backends') diff --git a/backends/platform/psp/audio.cpp b/backends/platform/psp/audio.cpp index bf1fb9ab41..e540733162 100644 --- a/backends/platform/psp/audio.cpp +++ b/backends/platform/psp/audio.cpp @@ -28,7 +28,6 @@ #include "common/scummsys.h" #include "backends/platform/psp/audio.h" -#include "backends/platform/psp/thread.h" //#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */ //#define __PSP_DEBUG_PRINT__ /* For debug printouts */ @@ -85,43 +84,13 @@ bool PspAudio::open(uint32 freq, uint32 numOfChannels, uint32 numOfSamples, call _init = true; _paused = true; // start in paused mode - createThread(); + threadCreateAndStart("audioThread", PRIORITY_AUDIO_THREAD, STACK_AUDIO_THREAD); // start the consumer thread return true; } -bool PspAudio::createThread() { - DEBUG_ENTER_FUNC(); - int threadId = sceKernelCreateThread("audioThread", thread, PRIORITY_AUDIO_THREAD, STACK_AUDIO_THREAD, THREAD_ATTR_USER, 0); - - if (threadId < 0) { // error - PSP_ERROR("failed to create audio thread. Error code %d\n", threadId); - return false; - } - - PspAudio *_this = this; // trick to get into context when the thread starts - - if (sceKernelStartThread(threadId, sizeof(uint32 *), &_this) < 0) { - PSP_ERROR("failed to start thread %d\n", threadId); - return false; - } - - PSP_DEBUG_PRINT("created audio thread[%x]\n", threadId); - - return true; -} - -// Static function to be called upon thread startup. Will call a non-static function -int PspAudio::thread(SceSize, void *__this) { - DEBUG_ENTER_FUNC(); - PspAudio *_this = *(PspAudio **)__this; // get our this for the context - - _this->audioThread(); - return 0; -}; - // The real thread function -void PspAudio::audioThread() { +void PspAudio::threadFunction() { assert(_callback); PSP_DEBUG_PRINT_FUNC("audio thread started\n"); @@ -129,15 +98,15 @@ void PspAudio::audioThread() { if (_paused) PSP_DEBUG_PRINT("audio thread paused\n"); while (_paused) { // delay until we stop pausing - sceKernelDelayThread(100000); // 100ms + PspThread::delayMicros(100000); // 100ms if (!_paused) PSP_DEBUG_PRINT("audio thread unpaused\n"); } - PSP_DEBUG_PRINT("remaining samples[%d]\n", remainingSamples); + PSP_DEBUG_PRINT("remaining samples[%d]\n", _remainingSamples); PSP_DEBUG_PRINT("filling buffer[%d]\n", _bufferToFill); - _callback(_userData, _buffers[_bufferToFill], _bufferSize); // ask mixer to fill in + _callback(_userData, _buffers[_bufferToFill], _bufferSize); // ask mixer to fill in data nextBuffer(_bufferToFill); PSP_DEBUG_PRINT("playing buffer[%d].\n", _bufferToPlay); @@ -151,7 +120,7 @@ void PspAudio::audioThread() { PSP_DEBUG_PRINT("audio thread exiting. ****************************\n"); } -// Much faster than using % +// Much faster than using %, especially with conditional moves (MIPS) inline void PspAudio::nextBuffer(int &bufferIdx) { DEBUG_ENTER_FUNC(); bufferIdx++; @@ -176,6 +145,6 @@ inline bool PspAudio::playBuffer() { } void PspAudio::close() { - PSP_DEBUG_PRINT("close had been called ***************\n"); + PSP_DEBUG_PRINT("close has been called ***************\n"); _init = false; } diff --git a/backends/platform/psp/audio.h b/backends/platform/psp/audio.h index 603f8f6bfc..eeba598fed 100644 --- a/backends/platform/psp/audio.h +++ b/backends/platform/psp/audio.h @@ -26,13 +26,15 @@ #ifndef PSP_AUDIO_H #define PSP_AUDIO_H -class PspAudio { +#include "backends/platform/psp/thread.h" + +class PspAudio : public PspThreadable { public: enum { NUM_BUFFERS = 2, FREQUENCY = 44100 /* only frequency we allow */ }; - typedef void (* callbackFunc)(void *userData, byte *samples, int len); + typedef void (* callbackFunc)(void *userData, byte *samples, int len); // audio callback to call PspAudio() : _pspChannel(0), _numOfChannels(0), _numOfSamples(0), _callback(0), _bufferToPlay(0), _bufferToFill(0), @@ -43,14 +45,12 @@ public: ~PspAudio() { close(); } bool playBuffer(); void nextBuffer(int &bufferIdx); - static int thread(SceSize, void *); - void audioThread(); bool open(uint32 freq, uint32 numOfChannels, uint32 numOfSamples, callbackFunc callback, void *userData); - bool createThread(); void close(); uint32 getFrequency() { return FREQUENCY; } void pause() { _paused = true; } void unpause() { _paused = false; } + virtual void threadFunction(); // actual audio thread private: int _pspChannel; // chosen hardware output channel diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index a9f33f6091..5037543f12 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -34,7 +34,6 @@ #include "backends/platform/psp/default_display_client.h" #include "backends/platform/psp/cursor.h" #include "backends/platform/psp/pspkeyboard.h" -#include "backends/platform/psp/thread.h" #define USE_DISPLAY_CALLBACK // to use callback for finishing the render #include "backends/platform/psp/display_manager.h" @@ -65,37 +64,24 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = { void MasterGuRenderer::setupCallbackThread() { DEBUG_ENTER_FUNC(); - int thid = sceKernelCreateThread("displayCbThread", guCallbackThread, PRIORITY_DISPLAY_THREAD, STACK_DISPLAY_THREAD, THREAD_ATTR_USER, 0); - PSP_DEBUG_PRINT("Display CB thread id is %x\n", thid); - - // We want to pass the pointer to this, but we'll have to take address of this so use a little trick - MasterGuRenderer *_this = this; - - if (thid >= 0) { - sceKernelStartThread(thid, sizeof(uint32 *), &_this); - } else - PSP_ERROR("failed to create display callback thread\n"); + // start the thread that updates the display + threadCreateAndStart("DisplayCbThread", PRIORITY_DISPLAY_THREAD, STACK_DISPLAY_THREAD); } -// thread that reacts to the callback -int MasterGuRenderer::guCallbackThread(SceSize, void *__this) { +// this function gets called by PspThread when starting the new thread +void MasterGuRenderer::threadFunction() { DEBUG_ENTER_FUNC(); - // Dereferenced the copied value which was this - MasterGuRenderer *_this = *(MasterGuRenderer **)__this; - // Create the callback. It should always get the pointer to MasterGuRenderer - _this->_callbackId = sceKernelCreateCallback("Display Callback", guCallback, _this); - if (_this->_callbackId < 0) { - PSP_ERROR("failed to create display callback\n"); - return -1; + _callbackId = sceKernelCreateCallback("Display Callback", guCallback, this); + if (_callbackId < 0) { + PSP_ERROR("failed to create display callback\n"); } PSP_DEBUG_PRINT("created callback. Going to sleep\n"); - sceKernelSleepThreadCB(); // sleep until we get a callback - return 0; + sceKernelSleepThreadCB(); // sleep until we get a callback } // This callback is called when the render is finished. It swaps the buffers diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h index dbbdf2022c..1f7320902c 100644 --- a/backends/platform/psp/display_manager.h +++ b/backends/platform/psp/display_manager.h @@ -26,10 +26,12 @@ #ifndef PSP_DISPLAY_MAN_H #define PSP_DISPLAY_MAN_H +#include "backends/platform/psp/thread.h" + /** * Class used only by DisplayManager to start/stop GU rendering */ -class MasterGuRenderer { +class MasterGuRenderer : public PspThreadable { public: MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true), _callbackId(-1) {} void guInit(); @@ -37,15 +39,15 @@ public: void guPostRender(); void guShutDown(); bool isRenderFinished() { return _renderFinished; } - void setupCallbackThread(); + void setupCallbackThread(); private: + virtual void threadFunction(); // for the display callback thread static uint32 _displayList[]; uint32 _lastRenderTime; // For measuring rendering time void guProgramDisplayBufferSizes(); - static int guCallbackThread(SceSize, void *); // for the graphics callbacks - static int guCallback(int, int, void *__this); + static int guCallback(int, int, void *__this); // for the display callback bool _renderFinished; // for sync with render callback - int _callbackId; // to keep track of render callback + int _callbackId; // to keep track of render callback }; class Screen; diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp index c19ff5f9e3..916b1e553b 100644 --- a/backends/platform/psp/thread.cpp +++ b/backends/platform/psp/thread.cpp @@ -28,7 +28,50 @@ #include "backends/platform/psp/thread.h" #include "backends/platform/psp/trace.h" -// Class PspThread -------------------------------------------------- +// Class PspThreadable -------------------------------------------------- +// Inherit this to create C++ threads easily + +bool PspThreadable::threadCreateAndStart(const char *threadName, int priority, int stackSize, bool useVfpu /*= false*/) { + DEBUG_ENTER_FUNC(); + + if (_threadId != -1) { + PSP_ERROR("thread already created!\n"); + return false; + } + + _threadId = sceKernelCreateThread(threadName, __threadCallback, priority, stackSize, THREAD_ATTR_USER, 0); // add VFPU support + + if (_threadId < 0) { + PSP_ERROR("failed to create %s thread. Error code %d\n", threadName, _threadId); + return false; + } + + // We want to pass the pointer to this, but we'll have to take address of this so use a little trick + PspThreadable *_this = this; + + if (sceKernelStartThread(_threadId, sizeof(uint32 *), &_this) < 0) { + PSP_ERROR("failed to start %s thread id[%d]\n", threadName, _threadId); + return false; + } + + PSP_DEBUG_PRINT("Started %s thread with id[%x]\n", threadName, _threadId); + + return true; +} + +// Callback function to be called by PSP kernel +int PspThreadable::__threadCallback(SceSize, void *__this) { + DEBUG_ENTER_FUNC(); + + PspThreadable *_this = *(PspThreadable **)__this; // Dereference the copied value which was 'this' + + _this->threadFunction(); // call the virtual function + + return 0; +} + +// PspThread class +// Utilities to access general thread functions void PspThread::delayMillis(uint32 ms) { sceKernelDelayThread(ms * 1000); diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h index 27d53903d6..de1c10a2aa 100644 --- a/backends/platform/psp/thread.h +++ b/backends/platform/psp/thread.h @@ -26,11 +26,26 @@ #ifndef PSP_THREAD_H #define PSP_THREAD_H +#include #include "common/scummsys.h" +// class to inherit for creating threads +class PspThreadable { +protected: + int _threadId; + virtual void threadFunction() = 0; // this function will be called when the thread starts +public: + PspThreadable() : _threadId(-1) {} // constructor + virtual ~PspThreadable() {} // destructor + static int __threadCallback(SceSize, void *__this); // used to get called by sceKernelStartThread() Don't override + bool threadCreateAndStart(const char *threadName, int priority, int stackSize, bool useVfpu = false); +}; + +// class for thread utils class PspThread { -public: - static void delayMillis(uint32 ms); +public: + // static functions + static void delayMillis(uint32 ms); // delay the current thread static void delayMicros(uint32 us); }; @@ -85,6 +100,7 @@ enum ThreadPriority { }; enum StackSizes { + STACK_DEFAULT = 4 * 1024, STACK_AUDIO_THREAD = 16 * 1024, STACK_TIMER_THREAD = 32 * 1024, STACK_DISPLAY_THREAD = 2 * 1024, -- cgit v1.2.3 From 5216d816168072bf2c2587eacb970abb92762513 Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Fri, 6 Aug 2010 10:15:27 +0000 Subject: Don't include engines/sci as userinclude path, causes conflicts with graphics/ inclusion svn-id: r51779 --- backends/platform/symbian/mmp/scummvm_sci.mmp.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends') diff --git a/backends/platform/symbian/mmp/scummvm_sci.mmp.in b/backends/platform/symbian/mmp/scummvm_sci.mmp.in index 2466f0ec2d..1748be29b9 100644 --- a/backends/platform/symbian/mmp/scummvm_sci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sci.mmp.in @@ -58,7 +58,7 @@ SOURCEPATH ..\..\..\..\engines\sci // *** Include paths -USERINCLUDE ..\..\..\..\engines ..\..\..\..\engines\sci +USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\common ..\..\..\..\gui ..\..\..\..\sound ..\src SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src -- cgit v1.2.3 From 0c940edb711e6e1a59b25d907425bed5fbcb8e1a Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Fri, 6 Aug 2010 10:58:51 +0000 Subject: Start to support Flac when building! svn-id: r51781 --- .../symbian/BuildPackageUpload_LocalSettings.pl | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl index cd107f59ca..a9e7aa562a 100644 --- a/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl +++ b/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl @@ -42,12 +42,12 @@ 'zlib' => 'zlib.lib', 'mad' => 'libmad.lib', 'tremor' => 'libtremor.lib', - 'mpeg2' => 'libmpeg2.lib' + 'flac' => 'libflac.lib' ); # these are normally enabled for each variation #$DefaultFeatures = qw(zlib,mad); - $DefaultFeatures = qw(zlib,mad,tremor); + $DefaultFeatures = qw(zlib,mad,tremor,flac); ################################################################################################################## ## @@ -229,6 +229,45 @@ # now you can add $VariationSets only built on this PC below this line :) } + elsif ($ENV{'COMPUTERNAME'} eq "EMBEDDEV_VAIO1") ################################################################# + { + $Producer = "AnotherGuest"; + $RedirectSTDERR = 1; + $HaltOnError = 0; + $SkipExistingPackages = 1; + $ReallyQuiet = 1; + + #$FTP_Host = "host.com"; + #$FTP_User = "ag@host.com"; + #$FTP_Pass = "password"; + #$FTP_Dir = "cvsbuilds"; + + #$SDK_RootDirs{'UIQ2'}= "D:\\UIQ2"; + $SDK_RootDirs{'UIQ3'}= "G:\\UIQ3"; + #$SDK_RootDirs{'S60v1'}= "D:\\S60v1"; + #$SDK_RootDirs{'S60v2'}= "D:\\S60v2"; + $SDK_RootDirs{'S60v3'}= "G:\\S60v3"; + #$SDK_RootDirs{'S80'}= "D:\\S80"; + #$SDK_RootDirs{'S90'}= "D:\\S90"; + $ECompXL_BinDir= "D:\\ECompXL\\"; + if (0) # so we can turn them on/off easily + { +# $SDK_LibraryDirs{'ALL'}{'zlib.lib'} = "C:\\S\\zlib-1.2.2\\epoc"; +# $SDK_LibraryDirs{'ALL'}{'libmad.lib'} = "C:\\S\\libmad-0.15.1b\\group"; +# $SDK_LibraryDirs{'ALL'}{'libtremor.lib'}= "C:\\tremor\\epoc"; + $SDK_LibraryDirs{'UIQ2'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\UIQ"; + $SDK_LibraryDirs{'S60v1'}{'esdl.lib'} = $SDK_LibraryDirs{'S60v2'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S60"; + $SDK_LibraryDirs{'S80'}{'esdl.lib'} = "E:\\WICKED\\ESDL\\epoc\\S80"; + $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 :) + + } + else ######################################################################################################### { print "ERROR: Computer name ".$ENV{'COMPUTERNAME'}." not recognized! Plz edit _LocalSettings.pl!"; -- cgit v1.2.3 From 39e6bb3257e279c60bdf473015d080363ea67945 Mon Sep 17 00:00:00 2001 From: Lars Persson Date: Fri, 6 Aug 2010 13:55:16 +0000 Subject: Enabled translation by default. Include common/error.cpp in uiq3 makefile svn-id: r51784 --- backends/platform/symbian/BuildPackageUpload_AllVersions.pl | 1 + backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in | 7 +++++-- backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'backends') diff --git a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl index 3543dc8d19..62fcef0275 100644 --- a/backends/platform/symbian/BuildPackageUpload_AllVersions.pl +++ b/backends/platform/symbian/BuildPackageUpload_AllVersions.pl @@ -61,6 +61,7 @@ $ftp_url = "FTP://$FTP_User\@$FTP_Host/$FTP_Dir/"; $ExtraMacros = "MACRO NONSTANDARD_PORT\n"; $ExtraMacros .= "MACRO ENABLE_VKEYBD\n"; $ExtraMacros .= "MACRO DISABLE_FANCY_THEMES\n"; +$ExtraMacros .= "MACRO USE_TRANSLATION\n"; # prep nice list of SDKs #while( ($SDK, $RootDir) = each(%SDK_RootDirs) ) diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in index bd65c3b5e7..99cbb264c2 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in @@ -110,13 +110,13 @@ SOURCEPATH ..\..\..\..\base //STOP_AUTO_OBJECTS_BASE_// -SOURCEPATH ..\..\..\..\ +SOURCEPATH ..\..\..\.. // backend EPOC/SDL/ESDL specific includes SOURCE backends\platform\sdl\events.cpp SOURCE backends\platform\sdl\graphics.cpp -SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\platform\sdl\hardwarekeys.cpp +SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp @@ -127,6 +127,9 @@ SOURCE gui\KeysDialog.cpp SOURCE gui\Actions.cpp SOURCE gui\Dialog.cpp +// Common error +source common\error.cpp + // Special for graphics source graphics\iff.cpp diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in index 34207df5cf..3509714152 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in @@ -110,13 +110,13 @@ SOURCEPATH ..\..\..\..\base //STOP_AUTO_OBJECTS_BASE_// -SOURCEPATH ..\..\..\..\ +SOURCEPATH ..\..\..\.. // backend EPOC/SDL/ESDL specific includes SOURCE backends\platform\sdl\events.cpp SOURCE backends\platform\sdl\graphics.cpp -SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\platform\sdl\hardwarekeys.cpp +SOURCE backends\platform\sdl\sdl.cpp SOURCE backends\fs\symbian\symbian-fs-factory.cpp SOURCE backends\platform\symbian\src\SymbianOS.cpp SOURCE backends\platform\symbian\src\SymbianActions.cpp @@ -127,6 +127,9 @@ SOURCE gui\KeysDialog.cpp SOURCE gui\Actions.cpp SOURCE gui\Dialog.cpp +// Common error +source common\error.cpp + // Special for graphics source graphics\iff.cpp -- cgit v1.2.3