aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/events/gp2xsdl/gp2xsdl-events.cpp465
-rw-r--r--backends/events/gp2xsdl/gp2xsdl-events.h56
-rw-r--r--backends/graphics/gp2xsdl/gp2xsdl-graphics.cpp180
-rw-r--r--backends/graphics/gp2xsdl/gp2xsdl-graphics.h46
-rwxr-xr-xbackends/platform/gp2x/build/clean.sh17
-rw-r--r--backends/platform/gp2x/gp2x-common.h49
-rw-r--r--backends/platform/gp2x/gp2x-hw.cpp228
-rw-r--r--backends/platform/gp2x/gp2x-hw.h62
-rw-r--r--backends/platform/gp2x/gp2x-main.cpp50
-rw-r--r--backends/platform/gp2x/gp2x-mem.cpp84
-rw-r--r--backends/platform/gp2x/gp2x-mem.h51
-rw-r--r--backends/platform/gp2x/gp2x.cpp208
-rw-r--r--backends/platform/gp2x/module.mk15
13 files changed, 0 insertions, 1511 deletions
diff --git a/backends/events/gp2xsdl/gp2xsdl-events.cpp b/backends/events/gp2xsdl/gp2xsdl-events.cpp
deleted file mode 100644
index 5f5ff66319..0000000000
--- 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 0d74c1bcac..0000000000
--- 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 6e5a35a1b1..0000000000
--- 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 341b913acd..0000000000
--- 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 0979f6c7d6..0000000000
--- a/backends/platform/gp2x/build/clean.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-echo Quick script to make building all the time less painful.
-
-# Set the paths up here to support the build.
-
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin:$PATH
-export PATH=/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin:$PATH
-export CXX=arm-open2x-linux-g++
-export CC=arm-open2x-linux-gcc
-export CXXFLAGS=-march=armv4t
-export LDFLAGS=-static
-
-cd ../../../..
-
-echo Cleaning ScummVM for GP2X.
-make clean
diff --git a/backends/platform/gp2x/gp2x-common.h b/backends/platform/gp2x/gp2x-common.h
deleted file mode 100644
index 7efdd7164c..0000000000
--- a/backends/platform/gp2x/gp2x-common.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PLATFORM_SDL_GP2X_H
-#define PLATFORM_SDL_GP2X_H
-
-#include "backends/base-backend.h"
-#include "backends/platform/sdl/sdl.h"
-#include "backends/platform/sdl/posix/posix.h"
-#include "backends/graphics/gp2xsdl/gp2xsdl-graphics.h"
-#include "backends/events/gp2xsdl/gp2xsdl-events.h"
-
-#ifndef PATH_MAX
- #define PATH_MAX 255
-#endif
-
-class OSystem_GP2X : public OSystem_POSIX {
-public:
- OSystem_GP2X() {}
-
- void initBackend();
- void quit();
- void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- void initSDL();
-
-protected:
-
-};
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-hw.cpp b/backends/platform/gp2x/gp2x-hw.cpp
deleted file mode 100644
index 074c668b5f..0000000000
--- a/backends/platform/gp2x/gp2x-hw.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- * Thanks to Rlyeh, Snaff, Squidge, Hermes, PS2Reality and RobBrown
- * for there help with us all getting to grips with this.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "gp2x-common.h"
-
-#include "gp2x-hw.h"
-#include "gp2x-mem.h"
-
-// Linux includes to let us goof about with the system in a 'standard' way.
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-extern "C" {
-static unsigned long gp2x_dev[8]={0,0,0,0,0,0,0,0};//, gp2x_ticks_per_second;
-}
-
-namespace GP2X_HW {
-
-enum {
- VOLUME_NOCHG = 0,
- VOLUME_DOWN = 1,
- VOLUME_UP = 2,
- VOLUME_CHANGE_RATE = 8,
- VOLUME_MIN = 0,
- VOLUME_INITIAL = 60,
- VOLUME_MAX = 100
-};
-
-int volumeLevel = VOLUME_INITIAL;
-
-/* system registers */
-static struct
-{
- unsigned short SYSCLKENREG,SYSCSETREG,FPLLVSETREG,DUALINT920,DUALINT940,DUALCTRL940;
-}
-system_reg;
-
-static unsigned short dispclockdiv;
-
-static volatile unsigned short *MEM_REG;
-
-#define SYS_CLK_FREQ 7372800
-
-void deviceInit() {
- // Open devices
- if (!gp2x_dev[0]) gp2x_dev[0] = open("/dev/mixer", O_RDWR);
- if (!gp2x_dev[1]) gp2x_dev[1] = open("/dev/batt", O_RDONLY);
- if (!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-}
-
-void deviceDeinit() {
- // Close devices
- {
- int i;
- for (i=0;i<8;i++)
- {
- if (gp2x_dev[i])
- {
- close(gp2x_dev[i]);
- }
- }
- }
-
- MEM_REG[0x91c>>1] = system_reg.SYSCSETREG;
- MEM_REG[0x910>>1] = system_reg.FPLLVSETREG;
- MEM_REG[0x3B40>>1] = system_reg.DUALINT920;
- MEM_REG[0x3B42>>1] = system_reg.DUALINT940;
- MEM_REG[0x3B48>>1] = system_reg.DUALCTRL940;
- MEM_REG[0x904>>1] = system_reg.SYSCLKENREG;
- MEM_REG[0x924>>1] = dispclockdiv;
-
- unpatchMMU();
-}
-
-void mixerMoveVolume(int direction) {
- if (volumeLevel <= 10) {
- if (direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE/2;
- if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;
- } else {
- if(direction == VOLUME_UP) volumeLevel += VOLUME_CHANGE_RATE;
- if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;
- }
-
- if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN;
- if (volumeLevel > VOLUME_MAX) volumeLevel = VOLUME_MAX;
-
- unsigned long soundDev = open("/dev/mixer", O_RDWR);
-
- if(soundDev) {
- int vol = ((volumeLevel << 8) | volumeLevel);
- ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
- close(soundDev);
- }
-}
-
-void setCpuspeed(unsigned int mhz)
-{
- set_FCLK(mhz);
- set_DCLK_Div(0);
- set_920_Div(0);
-}
-
-int getBattLevel() {
- int devbatt;
- unsigned short currentval=0;
- devbatt = open("/dev/batt", O_RDONLY);
- read (devbatt, &currentval, 2);
- close (devbatt);
- return (currentval);
-}
-
-void set_display_clock_div(unsigned div)
-{
- div=((div & 63) | 64)<<8;
- MEM_REG[0x924>>1]=(MEM_REG[0x924>>1] & ~(255<<8)) | div;
-}
-
-
-void set_FCLK(unsigned MHZ)
-{
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
- MHZ*=1000000;
- mdiv=(MHZ*pdiv)/SYS_CLK_FREQ;
- mdiv=((mdiv-8)<<8) & 0xff00;
- pdiv=((pdiv-2)<<2) & 0xfc;
- scale&=3;
- v=mdiv | pdiv | scale;
- MEM_REG[0x910>>1]=v;
-}
-
-
-void set_920_Div(unsigned short div)
-{
- unsigned short v;
- v = MEM_REG[0x91c>>1] & (~0x3);
- MEM_REG[0x91c>>1] = (div & 0x7) | v;
-}
-
-
-void set_DCLK_Div( unsigned short div )
-{
- unsigned short v;
- v = (unsigned short)( MEM_REG[0x91c>>1] & (~(0x7 << 6)) );
- MEM_REG[0x91c>>1] = ((div & 0x7) << 6) | v;
-}
-
-
-void Disable_940(void)
-{
- MEM_REG[0x3B42>>1];
- MEM_REG[0x3B42>>1]=0;
- MEM_REG[0x3B46>>1]=0xffff;
- MEM_REG[0x3B48>>1]|= (1 << 7);
- MEM_REG[0x904>>1]&=0xfffe;
-}
-
-void gp2x_video_wait_vsync(void)
-{
- MEM_REG[0x2846>>1]=(MEM_REG[0x2846>>1] | 0x20) & ~2;
- while (!(MEM_REG[0x2846>>1] & 2));
-}
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-enum {
- /* Touchscreen TapMode */
- TAPMODE_LEFT = 0,
- TAPMODE_RIGHT = 1,
- TAPMODE_HOVER = 2
-};
-
-int tapmodeLevel = TAPMODE_LEFT;
-
-void ToggleTapMode() {
- if (tapmodeLevel == TAPMODE_LEFT) {
- tapmodeLevel = TAPMODE_RIGHT;
- } else if (tapmodeLevel == TAPMODE_RIGHT) {
- tapmodeLevel = TAPMODE_HOVER;
- } else if (tapmodeLevel == TAPMODE_HOVER) {
- tapmodeLevel = TAPMODE_LEFT;
- } else {
- tapmodeLevel = TAPMODE_LEFT;
- }
-}
-
-
-} /* namespace GPH */
diff --git a/backends/platform/gp2x/gp2x-hw.h b/backends/platform/gp2x/gp2x-hw.h
deleted file mode 100644
index 3c66400124..0000000000
--- a/backends/platform/gp2x/gp2x-hw.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Hardware Stuff.
- *
- */
-
-#ifndef GP2X_HW_H
-#define GP2X_HW_H
-
-namespace GP2X_HW {
-
-#define GP2X_MAXVOL 100 // Highest level permitted by GP2X's mixer
-#define SYS_CLK_FREQ 7372800 // Clock Frequency
-
-extern int volumeLevel;
-
-extern void deviceInit();
-extern void deviceDeinit();
-extern void mixerMoveVolume(int);
-extern void setCpuspeed(unsigned int cpuspeed);
-extern int getBattLevel();
-
-extern void save_system_regs(void); /* save some registers */
-extern void set_display_clock_div(unsigned div);
-extern void set_FCLK(unsigned MHZ); /* adjust the clock frequency (in Mhz units) */
-extern void set_920_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-extern void Disable_940(void); /* 940t down */
-extern void gp2x_video_wait_vsync(void);
-
-} /* namespace GP2X_HW */
-
-namespace GPH {
-
-extern int tapmodeLevel;
-
-extern void ToggleTapMode();
-
-} /* namespace GPH */
-
-#endif //GP2X_HW_H
diff --git a/backends/platform/gp2x/gp2x-main.cpp b/backends/platform/gp2x/gp2x-main.cpp
deleted file mode 100644
index f1ee5ed5f3..0000000000
--- a/backends/platform/gp2x/gp2x-main.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/plugins/sdl/sdl-provider.h"
-#include "base/main.h"
-
-#if defined(GP2X)
-int main(int argc, char *argv[]) {
-
- // Create our OSystem instance
- g_system = new OSystem_GP2X();
- assert(g_system);
-
- // Pre initialize the backend
- ((OSystem_GP2X *)g_system)->init();
-
-#ifdef DYNAMIC_MODULES
- PluginManager::instance().addPluginProvider(new SDLPluginProvider());
-#endif
-
- // Invoke the actual ScummVM main entry point:
- int res = scummvm_main(argc, argv);
-
- // Free OSystem
- delete (OSystem_GP2X *)g_system;
-
- return res;
-}
-
-#endif
diff --git a/backends/platform/gp2x/gp2x-mem.cpp b/backends/platform/gp2x/gp2x-mem.cpp
deleted file mode 100644
index 8d22bf8130..0000000000
--- a/backends/platform/gp2x/gp2x-mem.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory tweaking stuff.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include <stdio.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-extern "C" {
-static volatile unsigned short *gp2x_memregs;
-}
-
-void SetClock (unsigned c) {
- unsigned v;
- unsigned mdiv,pdiv=3,scale=0;
-
- // Set ARM920t clock
- c *= 1000000;
- mdiv = (c*pdiv) / SYS_CLK_FREQ;
- mdiv = ((mdiv-8)<<8) & 0xff00;
- pdiv = ((pdiv-2)<<2) & 0xfc;
- scale &= 3;
- v = mdiv | pdiv | scale;
- gp2x_memregs[0x910>>1] = v;
-}
-
-void patchMMU (void) {
- //volatile unsigned int *secbuf = (unsigned int *)malloc (204800);
-
- printf ("Reconfiguring cached memory regions...\n");
-
- //hackpgtable();
- //printf ("Sucess...\n");
-
- system("/sbin/rmmod mmuhack");
- system("/sbin/insmod -f mmuhack.o");
-
- int mmufd = open("/dev/mmuhack", O_RDWR);
-
- if(mmufd < 0) {
- printf ("Upper memory uncached (attempt failed, access to upper memory will be slower)...\n");
- } else {
- printf ("Upper memory cached...\n");
- close(mmufd);
- }
-}
-
-void unpatchMMU (void) {
- printf ("Restoreing cached memory regions...\n");
- system("/sbin/rmmod mmuhack");
-}
diff --git a/backends/platform/gp2x/gp2x-mem.h b/backends/platform/gp2x/gp2x-mem.h
deleted file mode 100644
index b2cd00a587..0000000000
--- a/backends/platform/gp2x/gp2x-mem.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Memory Stuff.
- *
- */
-
-#ifndef GP2X_MEM_H
-#define GP2X_MEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Use Squidge's MMU patch rather then myown (his is neater).
-// The effect if not that great but cacheing the upper RAM is no bad thing (tm) ;).
-
-//extern void InitRam (void);
-//extern void CloseRam (void);
-// Set ARM920t clock frequency
-extern void SetClock (unsigned c);
-extern void patchMMU (void);
-extern void unpatchMMU (void);
-
-#define SYS_CLK_FREQ 7372800
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif //GP2X_MEM_H
diff --git a/backends/platform/gp2x/gp2x.cpp b/backends/platform/gp2x/gp2x.cpp
deleted file mode 100644
index 0e28a6b738..0000000000
--- a/backends/platform/gp2x/gp2x.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * GP2X: Main backend.
- *
- */
-
-// Disable symbol overrides so that we can use system headers.
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "backends/platform/sdl/sdl-sys.h"
-#include "backends/platform/gp2x/gp2x-common.h"
-#include "backends/platform/gp2x/gp2x-hw.h"
-#include "backends/platform/gp2x/gp2x-mem.h"
-
-#include "backends/saves/default/default-saves.h"
-
-#include "common/config-manager.h"
-#include "common/debug.h"
-
-// Disable for normal serial logging.
-#define DUMP_STDOUT
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-void OSystem_GP2X::initBackend() {
- // Setup default save path to be workingdir/saves
- char savePath[PATH_MAX + 1];
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Could not obtain current working directory");
- } else {
- printf("Current working directory: %s\n", workDirName);
- }
-
- strcpy(savePath, workDirName);
- strcat(savePath, "/saves");
- printf("Current save directory: %s\n", savePath);
- struct stat sb;
- if (stat(savePath, &sb) == -1)
- if (errno == ENOENT) // Create the dir if it does not exist
- if (mkdir(savePath, 0755) != 0)
- warning("mkdir for '%s' failed", savePath);
-
- ConfMan.registerDefault("savepath", savePath);
-
- #ifdef DUMP_STDOUT
- // The GP2X has a serial console but most users do not use this so we
- // output all our STDOUT and STDERR to files for debug purposes.
- char STDOUT_FILE[PATH_MAX + 1];
- char STDERR_FILE[PATH_MAX + 1];
-
- strcpy(STDOUT_FILE, workDirName);
- strcpy(STDERR_FILE, workDirName);
- strcat(STDOUT_FILE, "/scummvm.stdout.txt");
- strcat(STDERR_FILE, "/scummvm.stderr.txt");
-
- /* Flush the output in case anything is queued */
- fclose(stdout);
- fclose(stderr);
-
- /* Redirect standard input and standard output */
- FILE *newfp = freopen(STDOUT_FILE, "w", stdout);
- if (newfp == NULL) {
- #if !defined(stdout)
- stdout = fopen(STDOUT_FILE, "w");
- #else
- newfp = fopen(STDOUT_FILE, "w");
- if (newfp) {
- *stdout = *newfp;
- }
- #endif
- }
-
- newfp = freopen(STDERR_FILE, "w", stderr);
- if (newfp == NULL) {
- #if !defined(stderr)
- stderr = fopen(STDERR_FILE, "w");
- #else
- newfp = fopen(STDERR_FILE, "w");
- if (newfp) {
- *stderr = *newfp;
- }
- #endif
- }
-
- setbuf(stderr, NULL);
- printf("%s\n", "Debug: STDOUT and STDERR redirected to text files.");
- #endif /* DUMP_STDOUT */
-
- // Setup other defaults.
- ConfMan.registerDefault("aspect_ratio", true);
-
- /* Up default volume values as we use a seperate system level volume anyway. */
- ConfMan.registerDefault("music_volume", 192);
- ConfMan.registerDefault("sfx_volume", 192);
- ConfMan.registerDefault("speech_volume", 192);
- ConfMan.registerDefault("autosave_period", 3 * 60); // Trigger autosave every 3 minutes - On low batts 4 mins is about your warning time.
-
- ConfMan.setBool("FM_low_quality", true);
-
- /* Initialize any GP2X specific stuff we may want (Batt Status, scaler etc.) */
- GP2X_HW::deviceInit();
-
- /* Set Default hardware mixer volume to a preset level (VOLUME_INITIAL). This is done to 'reset' volume level if set by other apps. */
- GP2X_HW::mixerMoveVolume(0);
-
- // Create the events manager
- if (_eventSource == 0)
- _eventSource = new GP2XSdlEventSource();
-
- // Create the graphics manager
- if (_graphicsManager == 0)
- _graphicsManager = new GP2XSdlGraphicsManager(_eventSource);
-
- /* Pass to POSIX method to do the heavy lifting */
- OSystem_POSIX::initBackend();
-}
-
-void OSystem_GP2X::initSDL() {
- // Check if SDL has not been initialized
- if (!_initedSDL) {
- uint32 sdlFlags = SDL_INIT_EVENTTHREAD;
- if (ConfMan.hasKey("disable_sdl_parachute"))
- sdlFlags |= SDL_INIT_NOPARACHUTE;
-
- // Initialize SDL (SDL Subsystems are initiliazed in the corresponding sdl managers)
- if (SDL_Init(sdlFlags) == -1)
- error("Could not initialize SDL: %s", SDL_GetError());
-
- // Enable unicode support if possible
- SDL_EnableUNICODE(1);
-
- _initedSDL = true;
- }
-}
-
-void OSystem_GP2X::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
- /* Setup default extra data paths for engine data files and plugins */
- char workDirName[PATH_MAX + 1];
-
- if (getcwd(workDirName, PATH_MAX) == NULL) {
- error("Error: Could not obtain current working directory");
- }
-
- Common::FSNode workdirNode(workDirName);
- if (workdirNode.exists() && workdirNode.isDirectory()) {
- s.add("__GP2X_WORKDIR__", new Common::FSDirectory(workDirName), priority);
- }
-
- char enginedataPath[PATH_MAX+1];
-
- strcpy(enginedataPath, workDirName);
- strcat(enginedataPath, "/engine-data");
-
- Common::FSNode engineNode(enginedataPath);
- if (engineNode.exists() && engineNode.isDirectory()) {
- s.add("__GP2X_ENGDATA__", new Common::FSDirectory(enginedataPath), priority);
- }
-
- char pluginsPath[PATH_MAX+1];
-
- strcpy(pluginsPath, workDirName);
- strcat(pluginsPath, "/plugins");
-
- Common::FSNode pluginsNode(pluginsPath);
- if (pluginsNode.exists() && pluginsNode.isDirectory()) {
- s.add("__GP2X_PLUGINS__", new Common::FSDirectory(pluginsPath), priority);
- }
-}
-
-void OSystem_GP2X::quit() {
- GP2X_HW::deviceDeinit();
-
- #ifdef DUMP_STDOUT
- printf("%s\n", "Debug: STDOUT and STDERR text files closed.");
- fclose(stdout);
- fclose(stderr);
- #endif /* DUMP_STDOUT */
-
- OSystem_POSIX::quit();
-}
diff --git a/backends/platform/gp2x/module.mk b/backends/platform/gp2x/module.mk
deleted file mode 100644
index 4846f162cb..0000000000
--- a/backends/platform/gp2x/module.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-MODULE := backends/platform/gp2x
-
-MODULE_OBJS := \
- gp2x-hw.o \
- gp2x-main.o \
- gp2x-mem.o \
- gp2x.o
-
-# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
-MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
-OBJS := $(MODULE_OBJS) $(OBJS)
-MODULE_DIRS += $(sort $(dir $(MODULE_OBJS)))
-
-# Hack to ensure the SDL backend is built so we can use OSystem_SDL.
--include $(srcdir)/backends/platform/sdl/module.mk