[Scummvm-cvs-logs] scummvm master -> 1c1786b16f34e4e998a5e1677427bdc75d318a93
djwillis
John.Willis at Distant-earth.com
Sat Jun 11 18:11:48 CEST 2011
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
045ee136b5 GPH: Update launch script for the GP2X build to match other GPH devices.
181ea053f4 GPH: Make helper script produce a non-plugin build for the GP2X.
64b8587507 GPH: Cleanup and some WIP refactoring.
f759ff1704 BACKENDS: Remove stale GP2X code references.
7878c1ec49 GP2X: Remove remnants of the old GP2X backend.
4fcd65d885 OPENPANDORA: Start to cleanup the backend and move controls into remapkey.
1c1786b16f OPENPANDORA: Use the SDL plugin provider not the main POSIX one.
Commit: 045ee136b599b21edefbd53ba9842d4da630d70d
https://github.com/scummvm/scummvm/commit/045ee136b599b21edefbd53ba9842d4da630d70d
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:00:17-07:00
Commit Message:
GPH: Update launch script for the GP2X build to match other GPH devices.
Changed paths:
backends/platform/gph/devices/gp2x/scummvm.gpe
diff --git a/backends/platform/gph/devices/gp2x/scummvm.gpe b/backends/platform/gph/devices/gp2x/scummvm.gpe
index e8983aa..51a49f7 100644
--- a/backends/platform/gph/devices/gp2x/scummvm.gpe
+++ b/backends/platform/gph/devices/gp2x/scummvm.gpe
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Remount SD with forced Sync, does this really work?
mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
@@ -8,7 +8,7 @@ mount -o sync,remount /dev/mmcsd/disc0/part1 /mnt/sd/
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
# Run ScummVM, important this bit.
-./scummvm.gph
+./scummvm.gph --fullscreen --gfx-mode=1x --config=$(pwd)/.scummvmrc
# Sync the SD card to check that everything is written.
sync
Commit: 181ea053f47420089b8aada5a2fdbc7b5e292bc8
https://github.com/scummvm/scummvm/commit/181ea053f47420089b8aada5a2fdbc7b5e292bc8
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:00:17-07:00
Commit Message:
GPH: Make helper script produce a non-plugin build for the GP2X.
* Plugins are acting up on the old GP2X so disable for now until I get a chance to work on them some more.
Changed paths:
backends/platform/gph/build/gp2x-config.sh
diff --git a/backends/platform/gph/build/gp2x-config.sh b/backends/platform/gph/build/gp2x-config.sh
index f474c4d..a9b28b2 100644
--- a/backends/platform/gph/build/gp2x-config.sh
+++ b/backends/platform/gph/build/gp2x-config.sh
@@ -23,8 +23,9 @@ cd ../../../..
--enable-tremor --with-tremor-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-zlib --with-zlib-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
--enable-mad --with-mad-prefix=/opt/open2x/gcc-4.1.1-glibc-2.3.6 \
- --enable-vkeybd --enable-plugins --default-dynamic
-# --disable-release --enable-debug
+ --enable-vkeybd
+
# --enable-plugins --default-dynamic
+# --disable-release --enable-debug
echo Generating config for GP2X complete. Check for errors.
Commit: 64b8587507ee3cec2c38d505d2310f81b0b97ff0
https://github.com/scummvm/scummvm/commit/64b8587507ee3cec2c38d505d2310f81b0b97ff0
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:07:08-07:00
Commit Message:
GPH: Cleanup and some WIP refactoring.
Changed paths:
backends/events/gph/gph-events.cpp
backends/graphics/gph/gph-graphics.cpp
backends/graphics/gph/gph-graphics.h
backends/platform/gph/gph-backend.cpp
backends/platform/gph/gph-main.cpp
backends/platform/gph/gph-sdl.h
diff --git a/backends/events/gph/gph-events.cpp b/backends/events/gph/gph-events.cpp
index 8bb3a3b..b461f85 100644
--- a/backends/events/gph/gph-events.cpp
+++ b/backends/events/gph/gph-events.cpp
@@ -187,7 +187,6 @@ GPHEventSource::GPHEventSource()
// }
//}
-
void GPHEventSource::moveStick() {
bool stickBtn[32];
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index b650289..eb748f2 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -35,8 +35,8 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{0, 0, 0}
};
-GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *boss)
- : SdlGraphicsManager(boss) {
+GPHGraphicsManager::GPHGraphicsManager(SdlEventSource *sdlEventSource)
+ : SdlGraphicsManager(sdlEventSource) {
}
const OSystem::GraphicsMode *GPHGraphicsManager::getSupportedGraphicsModes() const {
@@ -110,21 +110,43 @@ void GPHGraphicsManager::setGraphicsModeIntern() {
blitCursor();
}
-void GPHGraphicsManager::initSize(uint w, uint h) {
+void GPHGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
+#ifdef USE_RGB_COLOR
+ // Avoid redundant format changes
+ Graphics::PixelFormat newFormat;
+ if (!format)
+ newFormat = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ newFormat = *format;
+
+ assert(newFormat.bytesPerPixel > 0);
+
+ if (newFormat != _videoMode.format) {
+ _videoMode.format = newFormat;
+ _transactionDetails.formatChanged = true;
+ _screenFormat = newFormat;
+ }
+#endif
+
+
// Avoid redundant res changes
if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
_videoMode.screenWidth = w;
_videoMode.screenHeight = h;
+
if (w > 320 || h > 240){
setGraphicsMode(GFX_HALF);
setGraphicsModeIntern();
_sdlEventSource->toggleMouseGrab();
}
+ _videoMode.overlayWidth = 320;
+ _videoMode.overlayHeight = 240;
+
_transactionDetails.sizeChanged = true;
}
@@ -433,26 +455,65 @@ void GPHGraphicsManager::hideOverlay() {
}
-bool GPHGraphicsManager::loadGFXMode() {
-
- /* Forcefully disable aspect ratio correction for games
- that start with a native 240px height resolution
- This corrects games with non-standard resolutions
- such as MM Nes (256x240).
- */
+//bool GPHGraphicsManager::loadGFXMode() {
+
+
+// _videoMode.overlayWidth = 320;
+// _videoMode.overlayHeight = 240;
+// _videoMode.fullscreen = true;
+//
+// /* Forcefully disable aspect ratio correction for games
+// that start with a native 240px height resolution
+// This corrects games with non-standard resolutions
+// such as MM Nes (256x240).
+// */
+// if(_videoMode.screenHeight == 240) {
+// _videoMode.aspectRatioCorrection = false;
+// }
+
+// debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight);
+// if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
+// _videoMode.aspectRatioCorrection = false;
+// setGraphicsMode(GFX_HALF);
+// debug("GraphicsMode set to HALF");
+// } else {
+// setGraphicsMode(GFX_NORMAL);
+// debug("GraphicsMode set to NORMAL");
+// }
+
+
+// if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
+// //_videoMode.overlayWidth = _videoMode.screenWidth / 2;
+// //_videoMode.overlayHeight = _videoMode.screenHeight / 2;
+// _videoMode.overlayWidth = 320;
+// _videoMode.overlayHeight = 240;
+// _videoMode.fullscreen = true;
+// } else {
+//
+// _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+// _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+//
+// if (_videoMode.aspectRatioCorrection)
+// _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+//
+// //_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+// //_videoMode.hardwareHeight = effectiveScreenHeight();
+// _videoMode.hardwareWidth = 320;
+// _videoMode.hardwareHeight = 240;
+//
+// }
+
+// return SdlGraphicsManager::loadGFXMode();
+//}
- if(_videoMode.screenHeight == 240) {
- _videoMode.aspectRatioCorrection = false;
- }
-
- debug("Game ScreenMode = %d*%d", _videoMode.screenWidth, _videoMode.screenHeight);
+bool GPHGraphicsManager::loadGFXMode() {
if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
_videoMode.aspectRatioCorrection = false;
setGraphicsMode(GFX_HALF);
- debug("GraphicsMode set to HALF");
+// printf("GFX_HALF\n");
} else {
setGraphicsMode(GFX_NORMAL);
- debug("GraphicsMode set to NORMAL");
+// printf("GFX_NORMAL\n");
}
if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h
index 6ba2b34..fc3dc57 100644
--- a/backends/graphics/gph/gph-graphics.h
+++ b/backends/graphics/gph/gph-graphics.h
@@ -24,7 +24,7 @@
#define BACKENDS_GRAPHICS_GPH_H
#include "backends/graphics/sdl/sdl-graphics.h"
-#include "graphics/scaler/aspect.h" // for aspect2Real
+#include "graphics/scaler/aspect.h" // for aspect2Real
#include "graphics/scaler/downscaler.h"
enum {
@@ -40,7 +40,7 @@ public:
bool getFeatureState(OSystem::Feature f);
int getDefaultGraphicsMode() const;
- void initSize(uint w, uint h);
+ void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
bool setGraphicsMode(const char *name);
bool setGraphicsMode(int mode);
diff --git a/backends/platform/gph/gph-backend.cpp b/backends/platform/gph/gph-backend.cpp
index cb52da4..ae3466b 100644
--- a/backends/platform/gph/gph-backend.cpp
+++ b/backends/platform/gph/gph-backend.cpp
@@ -56,8 +56,15 @@
/* Dump console info to files. */
#define DUMP_STDOUT
+OSystem_GPH::OSystem_GPH()
+ :
+ OSystem_POSIX() {
+}
+
void OSystem_GPH::initBackend() {
+ assert(!_inited);
+
// Create the events manager
if (_eventSource == 0)
_eventSource = new GPHEventSource();
@@ -81,7 +88,7 @@ void OSystem_GPH::initBackend() {
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
+ error("Could not obtain current working directory.");
} else {
printf("Current working directory: %s\n", workDirName);
}
@@ -155,7 +162,8 @@ void OSystem_GPH::initBackend() {
/* Trigger autosave every 4 minutes - On low batts 5 mins is about your warning time. */
ConfMan.registerDefault("autosave_period", 4 * 60);
- /* Make sure that aspect ratio correction is enabled on the 1st run to stop users asking me what the 'wasted space' is ;-). */
+ /* Make sure that aspect ratio correction is enabled on the 1st run to stop
+ users asking me what the 'wasted space' at the bottom is ;-). */
ConfMan.registerDefault("aspect_ratio", true);
/* Make sure SDL knows that we have a joystick we want to use. */
@@ -164,10 +172,10 @@ void OSystem_GPH::initBackend() {
/* Now setup any device specific user options (Left handed mode, that sort of thing). */
// GPH::setOptions();
- printf("%s\n", "Passing to OSystem::SDL initBackend.");
-
/* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
+
+ _inited = true;
}
void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
@@ -176,7 +184,7 @@ void OSystem_GPH::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
+ error("Error: Could not obtain current working directory.");
}
Common::FSNode workdirNode(workDirName);
@@ -215,5 +223,5 @@ void OSystem_GPH::quit() {
fclose(stderr);
#endif /* DUMP_STDOUT */
- OSystem_SDL::quit();
+ OSystem_POSIX::quit();
}
diff --git a/backends/platform/gph/gph-main.cpp b/backends/platform/gph/gph-main.cpp
index f91ec8f..1a8c668 100644
--- a/backends/platform/gph/gph-main.cpp
+++ b/backends/platform/gph/gph-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/gph/gph-sdl.h"
-#include "backends/plugins/sdl/sdl-provider.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "base/main.h"
#if defined(GPH_DEVICE)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_GPH *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+ PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
diff --git a/backends/platform/gph/gph-sdl.h b/backends/platform/gph/gph-sdl.h
index 68a641e..8b943f9 100644
--- a/backends/platform/gph/gph-sdl.h
+++ b/backends/platform/gph/gph-sdl.h
@@ -28,8 +28,8 @@
#include "backends/base-backend.h"
#include "backends/platform/sdl/sdl.h"
#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gph/gph-graphics.h"
#include "backends/events/gph/gph-events.h"
+#include "backends/graphics/gph/gph-graphics.h"
#define __GP2XWIZ__
@@ -39,6 +39,8 @@
class OSystem_GPH : public OSystem_POSIX {
public:
+ OSystem_GPH();
+
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
Commit: f759ff17046be2ef2bcc0c068d1ae2cfbed3e520
https://github.com/scummvm/scummvm/commit/f759ff17046be2ef2bcc0c068d1ae2cfbed3e520
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:07:08-07:00
Commit Message:
BACKENDS: Remove stale GP2X code references.
Changed paths:
backends/module.mk
diff --git a/backends/module.mk b/backends/module.mk
index 27058be..d1feae4 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -118,14 +118,6 @@ MODULE_OBJS += \
graphics/gph/gph-graphics.o
endif
-# TODO/FIXME: The gp2xsdl files are only compiled if GP2X_OLD is defined,
-# which currently is never the case (unless the user manually requests it).
-# ifeq ($(BACKEND),gp2x)
-# MODULE_OBJS += \
-# events/gp2xsdl/gp2xsdl-events.o \
-# graphics/gp2xsdl/gp2xsdl-graphics.o
-# endif
-
ifeq ($(BACKEND),linuxmoto)
MODULE_OBJS += \
events/linuxmotosdl/linuxmotosdl-events.o \
Commit: 7878c1ec4933dcedf20ab20e15a671a2209c4838
https://github.com/scummvm/scummvm/commit/7878c1ec4933dcedf20ab20e15a671a2209c4838
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:07:08-07:00
Commit Message:
GP2X: Remove remnants of the old GP2X backend.
The GP2X is now folded into the GPH backend (as the GP2X device).
Changed paths:
R backends/events/gp2xsdl/gp2xsdl-events.cpp
R backends/events/gp2xsdl/gp2xsdl-events.h
R backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp
R backends/graphics/gp2xsdl/gp2xsdl-graphics.h
R backends/platform/gp2x/build/clean.sh
R backends/platform/gp2x/gp2x-common.h
R backends/platform/gp2x/gp2x-hw.cpp
R backends/platform/gp2x/gp2x-hw.h
R backends/platform/gp2x/gp2x-main.cpp
R backends/platform/gp2x/gp2x-mem.cpp
R backends/platform/gp2x/gp2x-mem.h
R backends/platform/gp2x/gp2x.cpp
R backends/platform/gp2x/module.mk
diff --git a/backends/events/gp2xsdl/gp2xsdl-events.cpp b/backends/events/gp2xsdl/gp2xsdl-events.cpp
deleted file mode 100644
index 5f5ff66..0000000
--- a/backends/events/gp2xsdl/gp2xsdl-events.cpp
+++ /dev/null
@@ -1,465 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-
-#if defined(GP2X_OLD)
-
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-
-#include "backends/platform/sdl/sdl.h"
-
-#include "common/translation.h"
-
-// FIXME move joystick defines out and replace with confile file options
-// we should really allow users to map any key to a joystick button using the keymapper.
-#define JOY_DEADZONE 2200
-
-#define JOY_XAXIS 0
-#define JOY_YAXIS 1
-
-/* Quick default button states for modifiers. */
-int BUTTON_STATE_L = false;
-
-enum {
- /* DPAD/Stick */
- BUTTON_UP = 0,
- BUTTON_UPLEFT = 1,
- BUTTON_LEFT = 2,
- BUTTON_DOWNLEFT = 3,
- BUTTON_DOWN = 4,
- BUTTON_DOWNRIGHT = 5,
- BUTTON_RIGHT = 6,
- BUTTON_UPRIGHT = 7,
- /* Joystick Buttons */
- BUTTON_MENU = 8, // Start on F100 GP2X
- BUTTON_SELECT = 9,
- BUTTON_L = 10,
- BUTTON_R = 11,
- BUTTON_A = 12,
- BUTTON_B = 13,
- BUTTON_X = 14,
- BUTTON_Y = 15,
- BUTTON_VOLUP = 16,
- BUTTON_VOLDOWN = 17,
- BUTTON_CLICK = 18
-};
-
-enum {
- /* Unused Joystick Buttons on the GP2X */
- BUTTON_HOME = 51,
- BUTTON_HOLD = 52,
- BUTTON_HELP = 53,
- BUTTON_HELP2 = 54
-};
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-GP2XSdlEventSource::GP2XSdlEventSource()
- : _buttonStateL(false){
-}
-
-void GP2XSdlEventSource::SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event) {
- event.kbd.flags = 0;
-
- if (mod & KMOD_SHIFT)
- event.kbd.flags |= Common::KBD_SHIFT;
- if (mod & KMOD_ALT)
- event.kbd.flags |= Common::KBD_ALT;
- if (mod & KMOD_CTRL)
- event.kbd.flags |= Common::KBD_CTRL;
-
- // Sticky flags
- if (mod & KMOD_NUM)
- event.kbd.flags |= Common::KBD_NUM;
- if (mod & KMOD_CAPS)
- event.kbd.flags |= Common::KBD_CAPS;
-}
-
-void GP2XSdlEventSource::moveStick() {
- bool stickBtn[32];
-
- memcpy(stickBtn, _stickBtn, sizeof(stickBtn));
-
- if ((stickBtn[0])||(stickBtn[2])||(stickBtn[4])||(stickBtn[6]))
- stickBtn[1] = stickBtn[3] = stickBtn[5] = stickBtn[7] = 0;
-
- if ((stickBtn[1])||(stickBtn[2])||(stickBtn[3])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = -1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = -4;
- } else if ((stickBtn[5])||(stickBtn[6])||(stickBtn[7])) {
- if (_km.x_down_count!=2) {
- _km.x_vel = 1;
- _km.x_down_count = 1;
- } else
- _km.x_vel = 4;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-
- if ((stickBtn[0])||(stickBtn[1])||(stickBtn[7])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = -1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = -4;
- } else if ((stickBtn[3])||(stickBtn[4])||(stickBtn[5])) {
- if (_km.y_down_count!=2) {
- _km.y_vel = 1;
- _km.y_down_count = 1;
- } else
- _km.y_vel = 4;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-}
-
-/* GP2X Input mappings.
-Single Button
-
-Movement:
-
-GP2X_BUTTON_UP Cursor Up
-GP2X_BUTTON_DOWN Cursor Down
-GP2X_BUTTON_LEFT Cursor Left
-GP2X_BUTTON_RIGHT Cursor Right
-
-GP2X_BUTTON_UPLEFT Cursor Up Left
-GP2X_BUTTON_UPRIGHT Cursor Up Right
-GP2X_BUTTON_DOWNLEFT Cursor Down Left
-GP2X_BUTTON_DOWNRIGHT Cursor Down Right
-
-Button Emulation:
-
-GP2X_BUTTON_CLICK Left Mouse Click (GP2X only)
-GP2X_BUTTON_A . (Period)
-GP2X_BUTTON_B Left Mouse Click
-GP2X_BUTTON_Y Space Bar
-GP2X_BUTTON_X Right Mouse Click
-GP2X_BUTTON_L Combo Modifier (Left Trigger)
-GP2X_BUTTON_R Return (Right Trigger)
-GP2X_BUTTON_MENU F5 (Game Menu)
-GP2X_BUTTON_SELECT Escape
-GP2X_BUTTON_VOLUP /dev/mixer Global Volume Up
-GP2X_BUTTON_VOLDOWN /dev/mixer Global Volume Down
-
-Combos:
-
-GP2X_BUTTON_VOLUP & GP2X_BUTTON_VOLDOWN 0 (For Monkey 2 CP) or Virtual Keyboard if enabled
-GP2X_BUTTON_L & GP2X_BUTTON_SELECT Common::EVENT_QUIT (Calls Sync() to make sure SD is flushed)
-GP2X_BUTTON_L & GP2X_BUTTON_MENU Common::EVENT_MAINMENU (ScummVM Global Main Menu)
-GP2X_BUTTON_L & GP2X_BUTTON_A Common::EVENT_PREDICTIVE_DIALOG for predictive text entry box (AGI games)
-GP2X_BUTTON_L & GP2X_BUTTON_Y Toggles setZoomOnMouse() for larger then 320*240 games to scale to the point + raduis. (GP2X only)
-*/
-
-bool GP2XSdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) {
- SDLModToOSystemKeyFlags(SDL_GetModState(), event);
-
- if (remapKey(ev, event))
- return true;
-
- event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym;
- event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
-
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
-
- _stickBtn[ev.jbutton.button] = 1;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- if (BUTTON_STATE_L == true) {
- ((GP2XSdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->toggleZoomOnMouse();
- fillMouseEvent(event, _km.x, _km.y);
- } else {
- event.type = Common::EVENT_LBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- }
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONDOWN;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = true;
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_QUIT;
- } else {
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_PREDICTIVE_DIALOG;
- } else {
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
- }
- } else {
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYDOWN;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- GP2X_HW::mixerMoveVolume(2);
- if (GP2X_HW::volumeLevel == 100) {
- g_system->displayMessageOnOSD(_("Maximum Volume"));
- } else {
- g_system->displayMessageOnOSD(_("Increasing Volume"));
- }
- break;
-
- case BUTTON_VOLDOWN:
- GP2X_HW::mixerMoveVolume(1);
- if (GP2X_HW::volumeLevel == 0) {
- g_system->displayMessageOnOSD(_("Minimal Volume"));
- } else {
- g_system->displayMessageOnOSD(_("Decreasing Volume"));
- }
- break;
- case BUTTON_HOLD:
- event.type = Common::EVENT_QUIT;
- break;
- case BUTTON_HELP2:
- GPH::ToggleTapMode();
- if (GPH::tapmodeLevel == TAPMODE_LEFT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_RIGHT) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
- } else if (GPH::tapmodeLevel == TAPMODE_HOVER) {
- g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
- }
- break;
- }
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
- _stickBtn[ev.jbutton.button] = 0;
- event.kbd.flags = 0;
-
- switch (ev.jbutton.button) {
- case BUTTON_UP:
- case BUTTON_UPLEFT:
- case BUTTON_LEFT:
- case BUTTON_DOWNLEFT:
- case BUTTON_DOWN:
- case BUTTON_DOWNRIGHT:
- case BUTTON_RIGHT:
- case BUTTON_UPRIGHT:
- moveStick();
- event.type = Common::EVENT_MOUSEMOVE;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_B:
- case BUTTON_CLICK:
- if (BUTTON_STATE_L == true) {
- break;
- } else {
- event.type = Common::EVENT_LBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- }
- break;
- case BUTTON_X:
- event.type = Common::EVENT_RBUTTONUP;
- fillMouseEvent(event, _km.x, _km.y);
- break;
- case BUTTON_L:
- BUTTON_STATE_L = false;
- break;
- case BUTTON_SELECT:
- case BUTTON_HOME:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_A:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_PERIOD;
- event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0);
- break;
- case BUTTON_Y:
- event.type = Common::EVENT_KEYUP;
- event.kbd.keycode = Common::KEYCODE_SPACE;
- event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0);
- break;
- case BUTTON_MENU:
- case BUTTON_HELP:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
- event.type = Common::EVENT_MAINMENU;
- } else {
- event.kbd.keycode = Common::KEYCODE_F5;
- event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_R:
- event.type = Common::EVENT_KEYUP;
- if (BUTTON_STATE_L == true) {
-#ifdef ENABLE_VKEYBD
- event.kbd.keycode = Common::KEYCODE_F7;
- event.kbd.ascii = mapKey(SDLK_F7, ev.key.keysym.mod, 0);
-#else
- event.kbd.keycode = Common::KEYCODE_0;
- event.kbd.ascii = mapKey(SDLK_0, ev.key.keysym.mod, 0);
-#endif
- } else {
- event.kbd.keycode = Common::KEYCODE_RETURN;
- event.kbd.ascii = mapKey(SDLK_RETURN, ev.key.keysym.mod, 0);
- }
- break;
- case BUTTON_VOLUP:
- break;
- case BUTTON_VOLDOWN:
- break;
- case BUTTON_HOLD:
- break;
- case BUTTON_HELP2:
- break;
- }
- return true;
-}
-
-bool GP2XSdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) {
- int axis = ev.jaxis.value;
- if ( axis > JOY_DEADZONE) {
- axis -= JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else if ( axis < -JOY_DEADZONE ) {
- axis += JOY_DEADZONE;
- event.type = Common::EVENT_MOUSEMOVE;
- } else
- axis = 0;
-
- if ( ev.jaxis.axis == JOY_XAXIS) {
-#ifdef JOY_ANALOG
- _km.x_vel = axis/2000;
- _km.x_down_count = 0;
-#else
- if (axis != 0) {
- _km.x_vel = (axis > 0) ? 1:-1;
- _km.x_down_count = 1;
- } else {
- _km.x_vel = 0;
- _km.x_down_count = 0;
- }
-#endif
-
- } else if (ev.jaxis.axis == JOY_YAXIS) {
-#ifndef JOY_INVERT_Y
- axis = -axis;
-#endif
-#ifdef JOY_ANALOG
- _km.y_vel = -axis / 2000;
- _km.y_down_count = 0;
-#else
- if (axis != 0) {
- _km.y_vel = (-axis > 0) ? 1: -1;
- _km.y_down_count = 1;
- } else {
- _km.y_vel = 0;
- _km.y_down_count = 0;
- }
-#endif
- }
-
- fillMouseEvent(event, _km.x, _km.y);
- return true;
-}
-
-bool GP2XSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
- return false;
-}
-
-#endif
diff --git a/backends/events/gp2xsdl/gp2xsdl-events.h b/backends/events/gp2xsdl/gp2xsdl-events.h
deleted file mode 100644
index 0d74c1b..0000000
--- a/backends/events/gp2xsdl/gp2xsdl-events.h
+++ /dev/null
@@ -1,56 +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.
- *
- */
-
-#if !defined(BACKEND_EVENTS_SDL_GP2X_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER)
-#define BACKEND_EVENTS_SDL_GP2X_H
-
-#include "backends/events/sdl/sdl-events.h"
-
-/**
- * SDL events manager for GP2X
- */
-class GP2XSdlEventSource : public SdlEventSource {
-public:
- GP2XSdlEventSource();
-
-protected:
- bool _stickBtn[32];
-
- /** Button state for L button modifier */
- bool _buttonStateL;
-
- /**
- * Handles the stick movement
- */
- void moveStick();
-
- virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
- virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
-
- virtual void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event);
-
- virtual bool remapKey(SDL_Event &ev, Common::Event &event);
-};
-
-#endif
diff --git a/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp b/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp
deleted file mode 100644
index 6e5a35a..0000000
--- a/backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-
-#if defined(GP2X_OLD)
-
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "graphics/scaler/aspect.h"
-#include <SDL_gp2x.h>
-
-static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
- {"Fullscreen", "1x", GFX_NORMAL},
- {0, 0, 0}
-};
-
-GP2XSdlGraphicsManager::GP2XSdlGraphicsManager(SdlEventSource *sdlEventSource)
- : SdlGraphicsManager(sdlEventSource), _adjustZoomOnMouse(false) {
-}
-
-const OSystem::GraphicsMode *GP2XSdlGraphicsManager::getSupportedGraphicsModes() const {
- return s_supportedGraphicsModes;
-}
-
-int GP2XSdlGraphicsManager::getDefaultGraphicsMode() const {
- return GFX_NORMAL;
-}
-
-
-bool GP2XSdlGraphicsManager::hasFeature(OSystem::Feature f) {
- if (f == OSystem::kFeatureIconifyWindow)
- return false;
-
- return SdlGraphicsManager::hasFeature(f);
-}
-
-void GP2XSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
- if (f != OSystem::kFeatureIconifyWindow)
- SdlGraphicsManager::setFeatureState(f, enable);
-}
-
-void GP2XSdlGraphicsManager::drawMouse() {
- if (!_mouseVisible || !_mouseSurface) {
- _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0;
- return;
- }
-
- SDL_Rect zoomdst;
- SDL_Rect dst;
- int scale;
- int hotX, hotY;
- int tmpScreenWidth, tmpScreenHeight;
-
- // Temp vars to ensure we zoom to the LCD resolution or greater.
- tmpScreenWidth = _videoMode.screenWidth;
- tmpScreenHeight = _videoMode.screenHeight;
-
- if (_videoMode.screenHeight <= 240) {
- tmpScreenHeight = 240;
- }
-
- if (_videoMode.screenWidth <= 320) {
- tmpScreenWidth = 320;
- }
-
- dst.x = _mouseCurState.x;
- dst.y = _mouseCurState.y;
-
- if (!_overlayVisible) {
- scale = _videoMode.scaleFactor;
- dst.w = _mouseCurState.vW;
- dst.h = _mouseCurState.vH;
- hotX = _mouseCurState.vHotX;
- hotY = _mouseCurState.vHotY;
- } else {
- scale = 1;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
- hotX = _mouseCurState.rHotX;
- hotY = _mouseCurState.rHotY;
- }
-
- // The mouse is undrawn using virtual coordinates, i.e. they may be
- // scaled and aspect-ratio corrected.
-
- _mouseBackup.x = dst.x - hotX;
- _mouseBackup.y = dst.y - hotY;
- _mouseBackup.w = dst.w;
- _mouseBackup.h = dst.h;
-
- // We draw the pre-scaled cursor image, so now we need to adjust for
- // scaling, shake position and aspect ratio correction manually.
-
- if (!_overlayVisible) {
- dst.y += _currentShakePos;
- }
-
- if (_videoMode.aspectRatioCorrection && !_overlayVisible)
- dst.y = real2Aspect(dst.y);
-
- dst.x = scale * dst.x - _mouseCurState.rHotX;
- dst.y = scale * dst.y - _mouseCurState.rHotY;
- dst.w = _mouseCurState.rW;
- dst.h = _mouseCurState.rH;
-
- // Hacking about with the zoom around mouse pointer stuff.
- if (_adjustZoomOnMouse){
-
- zoomdst.w = (tmpScreenWidth / 2);
- zoomdst.h = (tmpScreenHeight / 2);
-
- // Create a zoomed rect centered on the mouse pointer.
- // Will pan 1/4 of the screen.
-
- if (dst.x > ((tmpScreenWidth / 4) * 3)) {
- zoomdst.x = (tmpScreenWidth / 2);
- } else {
- zoomdst.x = (dst.x - (tmpScreenWidth / 4));
- if (zoomdst.x < 0) {
- zoomdst.x = 0;
- }
- }
-
- if (dst.y > ((tmpScreenHeight / 4) * 3)) {
- zoomdst.y = (tmpScreenHeight / 2);
- } else {
- zoomdst.y = (dst.y - (tmpScreenHeight / 4));
- if (zoomdst.y < 0) {
- zoomdst.y = 0;
- }
- }
- SDL_GP2X_Display(&zoomdst);
- } else {
-
- // Make sure we are looking at the whole screen otherwise.
-
- zoomdst.x = 0;
- zoomdst.y = 0;
- zoomdst.w = (tmpScreenWidth);
- zoomdst.h = (tmpScreenHeight);
-
- SDL_GP2X_Display(&zoomdst);
- };
-
- // Note that SDL_BlitSurface() and addDirtyRect() will both perform any
- // clipping necessary
-
- if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
- error("SDL_BlitSurface failed: %s", SDL_GetError());
-
- // The screen will be updated using real surface coordinates, i.e.
- // they will not be scaled or aspect-ratio corrected.
-
- addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);
-}
-
-void GP2XSdlGraphicsManager::toggleZoomOnMouse() {
- _adjustZoomOnMouse = !_adjustZoomOnMouse;
-}
-
-#endif
diff --git a/backends/graphics/gp2xsdl/gp2xsdl-graphics.h b/backends/graphics/gp2xsdl/gp2xsdl-graphics.h
deleted file mode 100644
index 341b913..0000000
--- a/backends/graphics/gp2xsdl/gp2xsdl-graphics.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef BACKENDS_GRAPHICS_SDL_GP2X_H
-#define BACKENDS_GRAPHICS_SDL_GP2X_H
-
-#include "backends/graphics/sdl/sdl-graphics.h"
-
-class GP2XSdlGraphicsManager : public SdlGraphicsManager {
-public:
- GP2XSdlGraphicsManager(SdlEventSource *sdlEventSource);
-
- virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- virtual int getDefaultGraphicsMode() const;
- virtual void drawMouse();
-
- virtual bool hasFeature(OSystem::Feature f);
- virtual void setFeatureState(OSystem::Feature f, bool enable);
-
- // Toggles zoom adjust on mouse
- void toggleZoomOnMouse();
-
-protected:
- bool _adjustZoomOnMouse;
-};
-
-#endif
diff --git a/backends/platform/gp2x/build/clean.sh b/backends/platform/gp2x/build/clean.sh
deleted file mode 100755
index 0979f6c..0000000
--- a/backends/platform/gp2x/build/clean.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-export CXX=arm-open2x-linux-g++
-export CC=arm-open2x-linux-gcc
-export CXXFLAGS=-march=armv4t
-export LDFLAGS=-static
-
-cd ../../../..
-
-echo Cleaning ScummVM for GP2X.
-make clean
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
deleted file mode 100644
index 7efdd71..0000000
--- a/backends/platform/gp2x/gp2x-common.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PLATFORM_SDL_GP2X_H
-#define PLATFORM_SDL_GP2X_H
-
-#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
-#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-
-#ifndef PATH_MAX
- #define PATH_MAX 255
-#endif
-
-class OSystem_GP2X : public OSystem_POSIX {
-public:
- OSystem_GP2X() {}
-
- void initBackend();
- void quit();
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- void initSDL();
-
-protected:
-
-};
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
deleted file mode 100644
index 074c668..0000000
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- * Thanks to Rlyeh, Snaff, Squidge, Hermes, PS2Reality and RobBrown
- * for there help with us all getting to grips with this.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "gp2x-common.h"
-
-#include "gp2x-hw.h"
-#include "gp2x-mem.h"
-
-// Linux includes to let us goof about with the system in a 'standard' way.
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-extern "C" {
-static unsigned long gp2x_dev[8]={0,0,0,0,0,0,0,0};//, gp2x_ticks_per_second;
-}
-
-namespace GP2X_HW {
-
-enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
-};
-
-int volumeLevel = VOLUME_INITIAL;
-
-/* system registers */
-static struct
-{
- unsigned short SYSCLKENREG,SYSCSETREG,FPLLVSETREG,DUALINT920,DUALINT940,DUALCTRL940;
-}
-system_reg;
-
-static unsigned short dispclockdiv;
-
-static volatile unsigned short *MEM_REG;
-
-#define SYS_CLK_FREQ 7372800
-
-void deviceInit() {
- // Open devices
- if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR);
- if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY);
- if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-}
-
-void deviceDeinit() {
- // Close devices
- {
- int i;
- for (i=0;i<8;i++)
- {
- if (gp2x_dev[i])
- {
- close(gp2x_dev[i]);
- }
- }
- }
-
- MEM_REG[0x91c>>1] = system_reg.SYSCSETREG;
- MEM_REG[0x910>>1] = system_reg.FPLLVSETREG;
- MEM_REG[0x3B40>>1] = system_reg.DUALINT920;
- MEM_REG[0x3B42>>1] = system_reg.DUALINT940;
- MEM_REG[0x3B48>>1] = system_reg.DUALCTRL940;
- MEM_REG[0x904>>1] = system_reg.SYSCLKENREG;
- MEM_REG[0x924>>1] = dispclockdiv;
-
- unpatchMMU();
-}
-
-void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if(direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if(soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
-}
-
-void setCpuspeed(unsigned int mhz)
-{
- set_FCLK(mhz);
- set_DCLK_Div(0);
- set_920_Div(0);
-}
-
-int getBattLevel() {
- int devbatt;
- unsigned short currentval=0;
- devbatt = open("/dev/batt", O_RDONLY);
- read (devbatt, ¤tval, 2);
- close (devbatt);
- return (currentval);
-}
-
-void set_display_clock_div(unsigned div)
-{
- div=((div & 63) | 64)<<8;
- MEM_REG[0x924>>1]=(MEM_REG[0x924>>1] & ~(255<<8)) | div;
-}
-
-
-void set_FCLK(unsigned MHZ)
-{
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
- MHZ*=1000000;
- mdiv=(MHZ*pdiv)/SYS_CLK_FREQ;
- mdiv=((mdiv-8)<<8) & 0xff00;
- pdiv=((pdiv-2)<<2) & 0xfc;
- scale&=3;
- v=mdiv | pdiv | scale;
- MEM_REG[0x910>>1]=v;
-}
-
-
-void set_920_Div(unsigned short div)
-{
- unsigned short v;
- v = MEM_REG[0x91c>>1] & (~0x3);
- MEM_REG[0x91c>>1] = (div & 0x7) | v;
-}
-
-
-void set_DCLK_Div( unsigned short div )
-{
- unsigned short v;
- v = (unsigned short)( MEM_REG[0x91c>>1] & (~(0x7 << 6)) );
- MEM_REG[0x91c>>1] = ((div & 0x7) << 6) | v;
-}
-
-
-void Disable_940(void)
-{
- MEM_REG[0x3B42>>1];
- MEM_REG[0x3B42>>1]=0;
- MEM_REG[0x3B46>>1]=0xffff;
- MEM_REG[0x3B48>>1]|= (1 << 7);
- MEM_REG[0x904>>1]&=0xfffe;
-}
-
-void gp2x_video_wait_vsync(void)
-{
- MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2;
- while (!(MEM_REG[0x2846>>1] & 2));
-}
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-int tapmodeLevel = TAPMODE_LEFT;
-
-void ToggleTapMode() {
- if (tapmodeLevel == TAPMODE_LEFT) {
- tapmodeLevel = TAPMODE_RIGHT;
- } else if (tapmodeLevel == TAPMODE_RIGHT) {
- tapmodeLevel = TAPMODE_HOVER;
- } else if (tapmodeLevel == TAPMODE_HOVER) {
- tapmodeLevel = TAPMODE_LEFT;
- } else {
- tapmodeLevel = TAPMODE_LEFT;
- }
-}
-
-
-} /* namespace GPH */
diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h
deleted file mode 100644
index 3c66400..0000000
--- a/backends/platform/gp2x/gp2x-hw.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- *
- */
-
-#ifndef GP2X_HW_H
-#define GP2X_HW_H
-
-namespace GP2X_HW {
-
-#define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer
-#define SYS_CLK_FREQ 7372800 // Clock Frequency
-
-extern int volumeLevel;
-
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
-extern void setCpuspeed(unsigned int cpuspeed);
-extern int getBattLevel();
-
-extern void save_system_regs(void); /* save some registers */
-extern void set_display_clock_div(unsigned div);
-extern void set_FCLK(unsigned MHZ); /* adjust the clock frequency (in Mhz units) */
-extern void set_920_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void Disable_940(void); /* 940t down */
-extern void gp2x_video_wait_vsync(void);
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-extern int tapmodeLevel;
-
-extern void ToggleTapMode();
-
-} /* namespace GPH */
-
-#endif //GP2X_HW_H
diff --git a/backends/platform/gp2x/gp2x-main.cpp b/backends/platform/gp2x/gp2x-main.cpp
deleted file mode 100644
index f1ee5ed..0000000
--- a/backends/platform/gp2x/gp2x-main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/plugins/sdl/sdl-provider.h"
-#include "base/main.h"
-
-#if defined(GP2X)
-int main(int argc, char *argv[]) {
-
- // Create our OSystem instance
- g_system = new OSystem_GP2X();
- assert(g_system);
-
- // Pre initialize the backend
- ((OSystem_GP2X *)g_system)->init();
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
-
- // Free OSystem
- delete (OSystem_GP2X *)g_system;
-
- return res;
-}
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp
deleted file mode 100644
index 8d22bf8..0000000
--- a/backends/platform/gp2x/gp2x-mem.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory tweaking stuff.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-extern "C" {
-static volatile unsigned short *gp2x_memregs;
-}
-
-void SetClock (unsigned c) {
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
-
- // Set ARM920t clock
- c *= 1000000;
- mdiv = (c*pdiv) / SYS_CLK_FREQ;
- mdiv = ((mdiv-8)<<8) & 0xff00;
- pdiv = ((pdiv-2)<<2) & 0xfc;
- scale &= 3;
- v = mdiv | pdiv | scale;
- gp2x_memregs[0x910>>1] = v;
-}
-
-void patchMMU (void) {
- //volatile unsigned int *secbuf = (unsigned int *)malloc (204800);
-
- printf ("Reconfiguring cached memory regions...\n");
-
- //hackpgtable();
- //printf ("Sucess...\n");
-
- system("/sbin/rmmod mmuhack");
- system("/sbin/insmod -f mmuhack.o");
-
- int mmufd = open("/dev/mmuhack", O_RDWR);
-
- if(mmufd < 0) {
- printf ("Upper memory uncached (attempt failed, access to upper memory will be slower)...\n");
- } else {
- printf ("Upper memory cached...\n");
- close(mmufd);
- }
-}
-
-void unpatchMMU (void) {
- printf ("Restoreing cached memory regions...\n");
- system("/sbin/rmmod mmuhack");
-}
diff --git a/backends/platform/gp2x/gp2x-mem.h b/backends/platform/gp2x/gp2x-mem.h
deleted file mode 100644
index b2cd00a..0000000
--- a/backends/platform/gp2x/gp2x-mem.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory Stuff.
- *
- */
-
-#ifndef GP2X_MEM_H
-#define GP2X_MEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Use Squidge's MMU patch rather then myown (his is neater).
-// The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;).
-
-//extern void InitRam (void);
-//extern void CloseRam (void);
-// Set ARM920t clock frequency
-extern void SetClock (unsigned c);
-extern void patchMMU (void);
-extern void unpatchMMU (void);
-
-#define SYS_CLK_FREQ 7372800
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif //GP2X_MEM_H
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
deleted file mode 100644
index 0e28a6b..0000000
--- a/backends/platform/gp2x/gp2x.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Main backend.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/sdl/sdl-sys.h"
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-#include "backends/saves/default/default-saves.h"
-
-#include "common/config-manager.h"
-#include "common/debug.h"
-
-// Disable for normal serial logging.
-#define DUMP_STDOUT
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-void OSystem_GP2X::initBackend() {
- // Setup default save path to be workingdir/saves
- char savePath[PATH_MAX + 1];
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
- } else {
- printf("Current working directory: %s\n", workDirName);
- }
-
- strcpy(savePath, workDirName);
- strcat(savePath, "/saves");
- printf("Current save directory: %s\n", savePath);
- struct stat sb;
- if (stat(savePath, &sb) == -1)
- if (errno == ENOENT) // Create the dir if it does not exist
- if (mkdir(savePath, 0755) != 0)
- warning("mkdir for '%s' failed", savePath);
-
- ConfMan.registerDefault("savepath", savePath);
-
- #ifdef DUMP_STDOUT
- // The GP2X has a serial console but most users do not use this so we
- // output all our STDOUT and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX + 1];
- char STDERR_FILE[PATH_MAX + 1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- /* Flush the output in case anything is queued */
- fclose(stdout);
- fclose(stderr);
-
- /* Redirect standard input and standard output */
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
- }
-
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
- }
-
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
-
- // Setup other defaults.
- ConfMan.registerDefault("aspect_ratio", true);
-
- /* Up default volume values as we use a seperate system level volume anyway. */
- ConfMan.registerDefault("music_volume", 192);
- ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("speech_volume", 192);
- ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
-
- ConfMan.setBool("FM_low_quality", true);
-
- /* Initialize any GP2X specific stuff we may want (Batt Status, scaler etc.) */
- GP2X_HW::deviceInit();
-
- /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
- GP2X_HW::mixerMoveVolume(0);
-
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GP2XSdlEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new GP2XSdlGraphicsManager(_eventSource);
-
- /* Pass to POSIX method to do the heavy lifting */
- OSystem_POSIX::initBackend();
-}
-
-void OSystem_GP2X::initSDL() {
- // Check if SDL has not been initialized
- if (!_initedSDL) {
- uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
- if (ConfMan.hasKey("disable_sdl_parachute"))
- sdlFlags |= SDL_INIT_NOPARACHUTE;
-
- // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
- if (SDL_Init(sdlFlags) == -1)
- error("Could not initialize SDL: %s", SDL_GetError());
-
- // Enable unicode support if possible
- SDL_EnableUNICODE(1);
-
- _initedSDL = true;
- }
-}
-
-void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- /* Setup default extra data paths for engine data files and plugins */
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__GP2X_WORKDIR__", new Common::FSDirectory(workDirName), priority);
- }
-
- char enginedataPath[PATH_MAX+1];
-
- strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "/engine-data");
-
- Common::FSNode engineNode(enginedataPath);
- if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__GP2X_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "/plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__GP2X_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
- }
-}
-
-void OSystem_GP2X::quit() {
- GP2X_HW::deviceDeinit();
-
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
-
- OSystem_POSIX::quit();
-}
diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk
deleted file mode 100644
index 4846f16..0000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/gp2x
-
-MODULE_OBJS := \
- gp2x-hw.o \
- gp2x-main.o \
- gp2x-mem.o \
- gp2x.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-
-# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk
Commit: 4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7
https://github.com/scummvm/scummvm/commit/4fcd65d885f14b88d3ef3cbdf1bbedd5884c72a7
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:07:21-07:00
Commit Message:
OPENPANDORA: Start to cleanup the backend and move controls into remapkey.
* Work in progress.
Changed paths:
backends/events/openpandora/op-events.cpp
backends/events/openpandora/op-events.h
backends/graphics/openpandora/op-graphics.cpp
backends/graphics/openpandora/op-graphics.h
backends/platform/openpandora/op-backend.cpp
backends/platform/openpandora/op-main.cpp
backends/platform/openpandora/op-sdl.h
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index 4b67cbf..72bc56c 100644
--- a/backends/events/openpandora/op-events.cpp
+++ b/backends/events/openpandora/op-events.cpp
@@ -24,7 +24,6 @@
/*
* OpenPandora: Device Specific Event Handling.
- *
*/
#if defined(OPENPANDORA)
@@ -35,6 +34,8 @@
#include "backends/platform/openpandora/op-options.h"
#include "common/translation.h"
+#include "common/util.h"
+#include "common/events.h"
/* Quick default button states for modifiers. */
int BUTTON_STATE_L = false;
@@ -50,6 +51,68 @@ OPEventSource::OPEventSource()
: _buttonStateL(false){
}
+/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
+
+bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONDOWN;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONDOWN;
+#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
+ else if (ev.button.button == SDL_BUTTON_WHEELUP)
+ event.type = Common::EVENT_WHEELUP;
+ else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
+ event.type = Common::EVENT_WHEELDOWN;
+#endif
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONDOWN;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
+bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
+ if (ev.button.button == SDL_BUTTON_LEFT){
+ if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ event.type = Common::EVENT_LBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ event.type = Common::EVENT_RBUTTONUP;
+ else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ event.type = Common::EVENT_MOUSEMOVE;
+ else
+ event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
+ }
+ else if (ev.button.button == SDL_BUTTON_RIGHT)
+ event.type = Common::EVENT_RBUTTONUP;
+#if defined(SDL_BUTTON_MIDDLE)
+ else if (ev.button.button == SDL_BUTTON_MIDDLE)
+ event.type = Common::EVENT_MBUTTONUP;
+#endif
+ else
+ return false;
+
+ fillMouseEvent(event, ev.button.x, ev.button.y);
+
+ return true;
+}
+
/* On the OpenPandora by default the ABXY and L/R Trigger buttons are returned by SDL as
(A): SDLK_HOME (B): SDLK_END (X): SDLK_PAGEDOWN (Y): SDLK_PAGEUP (L): SDLK_RSHIFT (R): SDLK_RCTRL
*/
@@ -124,65 +187,4 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return false;
}
-/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
-
-bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONDOWN;
-#if defined(SDL_BUTTON_WHEELUP) && defined(SDL_BUTTON_WHEELDOWN)
- else if (ev.button.button == SDL_BUTTON_WHEELUP)
- event.type = Common::EVENT_WHEELUP;
- else if (ev.button.button == SDL_BUTTON_WHEELDOWN)
- event.type = Common::EVENT_WHEELDOWN;
-#endif
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONDOWN;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
-
-bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
- if (ev.button.button == SDL_BUTTON_LEFT){
- if (BUTTON_STATE_L == true) /* BUTTON_STATE_L = Left Trigger Held, force Right Click */
- event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
- event.type = Common::EVENT_LBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
- event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
- event.type = Common::EVENT_MOUSEMOVE;
- else
- event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
- }
- else if (ev.button.button == SDL_BUTTON_RIGHT)
- event.type = Common::EVENT_RBUTTONUP;
-#if defined(SDL_BUTTON_MIDDLE)
- else if (ev.button.button == SDL_BUTTON_MIDDLE)
- event.type = Common::EVENT_MBUTTONUP;
-#endif
- else
- return false;
-
- fillMouseEvent(event, ev.button.x, ev.button.y);
-
- return true;
-}
#endif
diff --git a/backends/events/openpandora/op-events.h b/backends/events/openpandora/op-events.h
index 9aa6379..25f79e6 100644
--- a/backends/events/openpandora/op-events.h
+++ b/backends/events/openpandora/op-events.h
@@ -28,17 +28,22 @@
/**
* Events manager for the OpenPandora.
*/
+
class OPEventSource : public SdlEventSource {
public:
OPEventSource();
protected:
- /** Button state for L button modifier */
+
+ /**
+ * Button state for L button modifier
+ */
bool _buttonStateL;
- bool remapKey(SDL_Event &ev, Common::Event &event);
+
bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+ bool remapKey(SDL_Event &ev, Common::Event &event);
};
#endif /* BACKEND_EVENTS_OP_H */
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 20ee5df..c861763 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -26,15 +26,13 @@
#include "backends/graphics/openpandora/op-graphics.h"
#include "backends/events/openpandora/op-events.h"
-#include "backends/platform/openpandora/op-sdl.h"
-#include "common/mutex.h"
-#include "common/util.h"
-
+//#include "backends/platform/openpandora/op-sdl.h"
#include "graphics/scaler/aspect.h"
-#include "graphics/surface.h"
+#include "common/mutex.h"
+#include "common/textconsole.h"
-OPGraphicsManager::OPGraphicsManager(SdlEventSource *boss)
- : SdlGraphicsManager(boss) {
+OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource)
+ : SdlGraphicsManager(sdlEventSource) {
}
bool OPGraphicsManager::loadGFXMode() {
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index b0d4298..4bb89ca 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -33,30 +33,30 @@ enum {
class OPGraphicsManager : public SdlGraphicsManager {
public:
- OPGraphicsManager(SdlEventSource *boss);
-
- bool hasFeature(OSystem::Feature f);
- void setFeatureState(OSystem::Feature f, bool enable);
- bool getFeatureState(OSystem::Feature f);
- int getDefaultGraphicsMode() const;
-
- void initSize(uint w, uint h);
- const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
- bool setGraphicsMode(const char *name);
- bool setGraphicsMode(int mode);
- void setGraphicsModeIntern();
- void internUpdateScreen();
- void showOverlay();
- void hideOverlay();
+ OPGraphicsManager(SdlEventSource *sdlEventSource);
+
+// bool hasFeature(OSystem::Feature f);
+// void setFeatureState(OSystem::Feature f, bool enable);
+// bool getFeatureState(OSystem::Feature f);
+// int getDefaultGraphicsMode() const;
+
+// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL);
+// const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
+// bool setGraphicsMode(const char *name);
+// bool setGraphicsMode(int mode);
+// void setGraphicsModeIntern();
+// void internUpdateScreen();
+// void showOverlay();
+// void hideOverlay();
bool loadGFXMode();
- void drawMouse();
- void undrawMouse();
- virtual void warpMouse(int x, int y);
+// void drawMouse();
+// void undrawMouse();
+// virtual void warpMouse(int x, int y);
- SdlGraphicsManager::MousePos *getMouseCurState();
- SdlGraphicsManager::VideoState *getVideoMode();
+// SdlGraphicsManager::MousePos *getMouseCurState();
+// SdlGraphicsManager::VideoState *getVideoMode();
- virtual void adjustMouseEvent(const Common::Event &event);
+// virtual void adjustMouseEvent(const Common::Event &event);
};
#endif /* BACKENDS_GRAPHICS_OP_H */
diff --git a/backends/platform/openpandora/op-backend.cpp b/backends/platform/openpandora/op-backend.cpp
index 6bac4ea..5231e97 100644
--- a/backends/platform/openpandora/op-backend.cpp
+++ b/backends/platform/openpandora/op-backend.cpp
@@ -20,13 +20,16 @@
*
*/
+#if defined(OPENPANDORA)
+
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "backends/platform/openpandora/op-sdl.h"
-#include "base/main.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/mixer/doublebuffersdl/doublebuffersdl-mixer.h"
+#include "backends/platform/openpandora/op-sdl.h"
+#include "backends/plugins/posix/posix-provider.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
@@ -35,6 +38,7 @@
#include "common/debug.h"
#include "common/events.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "audio/mixer_intern.h"
@@ -52,15 +56,29 @@
static SDL_Cursor *hiddenCursor;
-static Uint32 timer_handler(Uint32 interval, void *param) {
- ((DefaultTimerManager *)param)->handler();
- return interval;
+OSystem_OP::OSystem_OP()
+ :
+ OSystem_POSIX() {
}
+//static Uint32 timer_handler(Uint32 interval, void *param) {
+// ((DefaultTimerManager *)param)->handler();
+// return interval;
+//}
+
void OSystem_OP::initBackend() {
assert(!_inited);
+ // Create the events manager
+ if (_eventSource == 0)
+ _eventSource = new OPEventSource();
+
+ // Create the graphics manager
+ if (_graphicsManager == 0) {
+ _graphicsManager = new OPGraphicsManager(_eventSource);
+ }
+
// int joystick_num = ConfMan.getInt("joystick_num");
// uint32 sdlFlags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
//
@@ -76,12 +94,12 @@ void OSystem_OP::initBackend() {
//
// Create the mixer manager
- if (_mixer == 0) {
- _mixerManager = new DoubleBufferSDLMixerManager();
+// if (_mixer == 0) {
+// _mixerManager = new DoubleBufferSDLMixerManager();
// Setup and start mixer
- _mixerManager->init();
- }
+// _mixerManager->init();
+// }
/* Setup default save path to be workingdir/saves */
@@ -103,7 +121,7 @@ void OSystem_OP::initBackend() {
if (mkdir(savePath, 0755) != 0)
warning("mkdir for '%s' failed!", savePath);
-// _savefileManager = new DefaultSaveFileManager(savePath);
+ _savefileManager = new DefaultSaveFileManager(savePath);
#ifdef DUMP_STDOUT
// The OpenPandora has a serial console on the EXT connection but most users do not use this so we
@@ -161,22 +179,32 @@ void OSystem_OP::initBackend() {
/* Make sure SDL knows that we have a joystick we want to use. */
ConfMan.setInt("joystick_num", 0);
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new OPEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new OPGraphicsManager(_eventSource);
-
// _graphicsMutex = createMutex();
- // Invoke parent implementation of this method
+ /* Pass to POSIX method to do the heavy lifting */
OSystem_POSIX::initBackend();
_inited = true;
}
+ // enable joystick
+// if (joystick_num > -1 && SDL_NumJoysticks() > 0) {
+// printf("Using joystick: %s\n", SDL_JoystickName(0));
+// _joystick = SDL_JoystickOpen(joystick_num);
+// }
+//
+// setupMixer();
+
+ // Note: We could implement a custom SDLTimerManager by using
+ // SDL_AddTimer. That might yield better timer resolution, but it would
+ // also change the semantics of a timer: Right now, ScummVM timers
+ // *never* run in parallel, due to the way they are implemented. If we
+ // switched to SDL_AddTimer, each timer might run in a separate thread.
+ // However, not all our code is prepared for that, so we can't just
+ // switch. Still, it's a potential future change to keep in mind.
+// _timer = new DefaultTimerManager();
+// _timerID = SDL_AddTimer(10, &timer_handler, _timer);
+
void OSystem_OP::initSDL() {
// Check if SDL has not been initialized
if (!_initedSDL) {
@@ -219,13 +247,14 @@ void OSystem_OP::initSDL() {
// _videoMode.fullscreen = true;
_initedSDL = true;
+
+// OSystem_POSIX::initSDL();
}
}
void OSystem_OP::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
/* Setup default extra data paths for engine data files and plugins */
-
char workDirName[PATH_MAX+1];
if (getcwd(workDirName, PATH_MAX) == NULL) {
@@ -256,3 +285,5 @@ void OSystem_OP::quit() {
OSystem_POSIX::quit();
}
+
+#endif
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index ab777fe..ae9d288 100644
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -20,8 +20,6 @@
*
*/
-
-#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/openpandora/op-sdl.h"
#include "backends/plugins/posix/posix-provider.h"
#include "base/main.h"
@@ -35,7 +33,7 @@ int main(int argc, char *argv[]) {
assert(g_system);
// Pre initialize the backend
- //((OSystem_OP *)g_system)->init();
+ ((OSystem_OP *)g_system)->init();
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
diff --git a/backends/platform/openpandora/op-sdl.h b/backends/platform/openpandora/op-sdl.h
index 9d92472..d493c39 100644
--- a/backends/platform/openpandora/op-sdl.h
+++ b/backends/platform/openpandora/op-sdl.h
@@ -26,12 +26,12 @@
#if defined(OPENPANDORA)
#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
+#include "backends/platform/sdl/sdl-sys.h"
#include "backends/platform/sdl/posix/posix.h"
#include "backends/events/openpandora/op-events.h"
#include "backends/graphics/openpandora/op-graphics.h"
-#define __OPENPANDORA__
+//#define MIXER_DOUBLE_BUFFERING 1
#ifndef PATH_MAX
#define PATH_MAX 255
@@ -39,16 +39,22 @@
class OSystem_OP : public OSystem_POSIX {
public:
- OSystem_OP() {}
+ OSystem_OP();
/* Platform Setup Stuff */
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
void initBackend();
- void initSDL();
void quit();
protected:
-
+ bool _inited;
+ bool _initedSDL;
+
+ /**
+ * Initialse the SDL library
+ * with an OpenPandora workaround.
+ */
+ virtual void initSDL();
};
#endif
#endif //OP_SDL_H
Commit: 1c1786b16f34e4e998a5e1677427bdc75d318a93
https://github.com/scummvm/scummvm/commit/1c1786b16f34e4e998a5e1677427bdc75d318a93
Author: David-John Willis (John.Willis at Distant-earth.com)
Date: 2011-06-11T09:08:54-07:00
Commit Message:
OPENPANDORA: Use the SDL plugin provider not the main POSIX one.
Changed paths:
backends/platform/openpandora/op-main.cpp
diff --git a/backends/platform/openpandora/op-main.cpp b/backends/platform/openpandora/op-main.cpp
index ae9d288..bb359e7 100644
--- a/backends/platform/openpandora/op-main.cpp
+++ b/backends/platform/openpandora/op-main.cpp
@@ -21,7 +21,7 @@
*/
#include "backends/platform/openpandora/op-sdl.h"
-#include "backends/plugins/posix/posix-provider.h"
+#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
#if defined(OPENPANDORA)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
((OSystem_OP *)g_system)->init();
#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+ PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
More information about the Scummvm-git-logs
mailing list