aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/psp/cursor.cpp26
-rw-r--r--backends/platform/psp/display_manager.cpp36
-rw-r--r--backends/platform/psp/display_manager.h6
-rw-r--r--backends/platform/psp/input.cpp91
-rw-r--r--backends/platform/psp/input.h4
-rw-r--r--backends/platform/psp/osys_psp.cpp8
-rw-r--r--backends/platform/symbian/README2
7 files changed, 109 insertions, 64 deletions
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp
index 0760bd1354..b7c69d5b98 100644
--- a/backends/platform/psp/cursor.cpp
+++ b/backends/platform/psp/cursor.cpp
@@ -162,7 +162,7 @@ bool Cursor::increaseXY(int32 incX, int32 incY) {
int32 oldX = _x, oldY = _y;
- // adjust for differences in X and Y
+ // adjust for screen resolution
adjustXYForScreenSize(incX, incY);
_x += incX;
@@ -204,29 +204,15 @@ void Cursor::setLimits(uint32 width, uint32 height) {
inline void Cursor::adjustXYForScreenSize(int32 &x, int32 &y) {
DEBUG_ENTER_FUNC();
// We have our speed calibrated for the y axis at 480x272. The idea is to adjust this for other
- // resolutions and for x, which is wider.
+ // resolutions
int32 newX = x, newY = y;
- // adjust width movement to match height (usually around 1.5)
- if (_mouseLimitWidth >= _mouseLimitHeight + (_mouseLimitHeight >> 1))
- newX = newX + (newX >> 1);
-
if (_mouseLimitWidth >= 600) { // multiply by 2
- newX <<= 1;
- newY <<= 1;
+ newX *= 2;
+ newY *= 2;
} else if (_mouseLimitWidth >= 480) { // multiply by 1.5
- newX = newX + (newX >> 1);
- newY = newY + (newY >> 1);
- }
-
- // Divide all movements by 8
- newX >>= 3;
- newY >>= 3;
-
- // Make sure we didn't destroy minimum movement
- if (!((x && !newX) || (y && !newY))) {
- x = newX;
- y = newY;
+ newX = newX + (newX / 2);
+ newY = newY + (newY / 2);
}
}
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 2e995c809e..33bf190d70 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -35,6 +35,8 @@
#include "backends/platform/psp/pspkeyboard.h"
#include "backends/platform/psp/image_viewer.h"
+#include "common/config-manager.h"
+
#define USE_DISPLAY_CALLBACK // to use callback for finishing the render
#include "backends/platform/psp/display_manager.h"
@@ -54,8 +56,8 @@ uint32 __attribute__((aligned(16))) MasterGuRenderer::_displayList[2048];
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
{ "Original Resolution", "Original Resolution", ORIGINAL_RESOLUTION },
- { "Keep Aspect Ratio", "Keep Aspect Ratio", KEEP_ASPECT_RATIO },
- { "Full Screen", "Full Screen", STRETCHED_FULL_SCREEN },
+ { "Fit to Screen", "Fit to Screen", FIT_TO_SCREEN },
+ { "Stretch to Screen", "Stretch to Screen", STRETCH_TO_SCREEN },
{0, 0, 0}
};
@@ -358,26 +360,32 @@ void DisplayManager::calculateScaleParams() {
switch (_graphicsMode) {
case ORIGINAL_RESOLUTION:
// check if we can fit the original resolution inside the screen
- if ((_displayParams.screenSource.width < PSP_SCREEN_WIDTH) &&
- (_displayParams.screenSource.height < PSP_SCREEN_HEIGHT)) {
+ if ((_displayParams.screenSource.width <= PSP_SCREEN_WIDTH) &&
+ (_displayParams.screenSource.height <= PSP_SCREEN_HEIGHT)) {
_displayParams.screenOutput.width = _displayParams.screenSource.width;
_displayParams.screenOutput.height = _displayParams.screenSource.height;
- } else { // revert to stretch to fit
- _displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
- _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT;
+ break;
}
- break;
- case KEEP_ASPECT_RATIO: { // maximize the height while keeping aspect ratio
- float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
+ // else revert to fit to screen
+ case FIT_TO_SCREEN: { // maximize the height while keeping aspect ratio
+ float aspectRatio;
+
+ if (ConfMan.getBool("aspect_ratio")) {
+ aspectRatio = 4.0f / 3.0f;
+ } else {
+ aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
+ }
- _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
+ _displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
_displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio);
- if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) // we can't have wider than the screen
+ if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) { // shrink if wider than screen
+ _displayParams.screenOutput.height = (uint32)(((float)PSP_SCREEN_HEIGHT * (float)PSP_SCREEN_WIDTH) / (float)_displayParams.screenOutput.width);
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
+ }
}
break;
- case STRETCHED_FULL_SCREEN: // we simply stretch to the whole screen
+ case STRETCH_TO_SCREEN: // we simply stretch to the whole screen
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT;
break;
@@ -458,7 +466,7 @@ bool DisplayManager::renderAll() {
inline bool DisplayManager::isTimeToUpdate() {
-#define MAX_FPS 30
+#define MAX_FPS 60 // was 30
uint32 now = g_system->getMillis();
if (now - _lastUpdateTime < (1000 / MAX_FPS))
diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h
index b1b748a68c..e33328de4b 100644
--- a/backends/platform/psp/display_manager.h
+++ b/backends/platform/psp/display_manager.h
@@ -105,8 +105,8 @@ class DisplayManager {
public:
enum GraphicsModeID { ///> Possible output formats onscreen
ORIGINAL_RESOLUTION,
- KEEP_ASPECT_RATIO,
- STRETCHED_FULL_SCREEN
+ FIT_TO_SCREEN,
+ STRETCH_TO_SCREEN
};
DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0),
_imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {}
@@ -118,7 +118,7 @@ public:
bool setGraphicsMode(int mode);
bool setGraphicsMode(const char *name);
int getGraphicsMode() const { return _graphicsMode; }
- uint32 getDefaultGraphicsMode() const { return STRETCHED_FULL_SCREEN; }
+ uint32 getDefaultGraphicsMode() const { return FIT_TO_SCREEN; }
const OSystem::GraphicsMode* getSupportedGraphicsModes() const { return _supportedModes; }
// Setters for pointers
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 4d7577eb94..7a2047f28e 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -23,6 +23,7 @@
#include <pspctrl.h>
#include "gui/message.h"
#include "backends/platform/psp/input.h"
+#include "common/config-manager.h"
//#define __PSP_DEBUG_FUNCS__ /* Uncomment for debugging the stack */
//#define __PSP_DEBUG_PRINT__ /* Uncomment for debug prints */
@@ -36,7 +37,7 @@
#define PSP_TRIGGERS (PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER)
#define PSP_ALL_BUTTONS (PSP_DPAD | PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START | PSP_CTRL_SELECT)
-#define PAD_CHECK_TIME 53
+#define PAD_CHECK_TIME 13 // was 53
Button::Button() {
clear();
@@ -273,39 +274,77 @@ bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
return _buttonPad.getEventFromButtonState(event, pspEvent, buttonState);
}
- int32 analogStepX = pad.Lx; // Goes up to 255.
+ int32 analogStepX = pad.Lx; // Goes up to 255.
int32 analogStepY = pad.Ly;
analogStepX = modifyNubAxisMotion(analogStepX);
analogStepY = modifyNubAxisMotion(analogStepY);
+ int32 speedFactor = 25;
+ switch (ConfMan.getInt("kbdmouse_speed")) {
+ // 0.25 keyboard pointer speed
+ case 0:
+ speedFactor = 100;
+ break;
+ // 0.5 speed
+ case 1:
+ speedFactor = 50;
+ break;
+ // 0.75 speed
+ case 2:
+ speedFactor = 33;
+ break;
+ // 1.0 speed
+ case 3:
+ speedFactor = 25;
+ break;
+ // 1.25 speed
+ case 4:
+ speedFactor = 20;
+ break;
+ // 1.5 speed
+ case 5:
+ speedFactor = 17;
+ break;
+ // 1.75 speed
+ case 6:
+ speedFactor = 14;
+ break;
+ // 2.0 speed
+ case 7:
+ speedFactor = 12;
+ break;
+ default:
+ speedFactor = 25;
+ }
+
+ // the larger the factor, the slower the cursor will move
+ int32 additionalFactor = 16;
+ if (_shifted) {
+ additionalFactor = 192;
+ }
+
+ int32 factor = (speedFactor * additionalFactor) / 25;
+
+ // hi-res cumulative analog delta for sub-pixel cursor positioning
+ _hiresX += (analogStepX * 1024) / factor;
+ _hiresY += (analogStepY * 1024) / factor;
+
+ analogStepX = (_hiresX / 1024);
+ analogStepY = (_hiresY / 1024);
+
+ // keep track of remainder for true sub-pixel cursor position
+ _hiresX %= 1024;
+ _hiresY %= 1024;
+
int32 oldX = _cursor->getX();
int32 oldY = _cursor->getY();
if (analogStepX != 0 || analogStepY != 0) {
PSP_DEBUG_PRINT("raw x[%d], y[%d]\n", analogStepX, analogStepY);
-
- // If no movement then this has no effect
- if (_shifted) {
- // Fine control mode for analog
- if (analogStepX != 0) {
- if (analogStepX > 0)
- _cursor->increaseXY(2, 0);
- else
- _cursor->increaseXY(-2, 0);
- }
-
- if (analogStepY != 0) {
- if (analogStepY > 0)
- _cursor->increaseXY(0, 2);
- else
- _cursor->increaseXY(0, -2);
- }
- } else { // Regular speed movement
- _cursor->increaseXY(analogStepX, 0);
- _cursor->increaseXY(0, analogStepY);
- }
+ _cursor->increaseXY(analogStepX, 0);
+ _cursor->increaseXY(0, analogStepY);
int32 newX = _cursor->getX();
int32 newY = _cursor->getY();
@@ -338,7 +377,8 @@ void Nub::translateToDpadState(int dpadX, int dpadY, uint32 &buttonState) {
inline int32 Nub::modifyNubAxisMotion(int32 input) {
DEBUG_ENTER_FUNC();
- const int MIN_NUB_MOTION = 30;
+
+ int MIN_NUB_MOTION = 10 * ConfMan.getInt("joystick_deadzone");
input -= 128; // Center on 0.
@@ -349,6 +389,9 @@ inline int32 Nub::modifyNubAxisMotion(int32 input) {
else // between these points, dampen the response to 0
input = 0;
+ if (input != 0) { // scaled deadzone
+ input = (input * 128)/(128 - MIN_NUB_MOTION);
+ }
return input;
}
diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h
index 05b575e0b0..ff89b9faec 100644
--- a/backends/platform/psp/input.h
+++ b/backends/platform/psp/input.h
@@ -139,6 +139,8 @@ private:
Cursor *_cursor; // to enable changing/getting cursor position
ShiftMode _shifted;
+ int32 _hiresX; // to accumulate analog X over many frames
+ int32 _hiresY; // to accumulate analog Y over many frames
bool _dpadMode;
ButtonPad _buttonPad; // private buttonpad for dpad mode
@@ -146,7 +148,7 @@ private:
int32 modifyNubAxisMotion(int32 input);
void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data
public:
- Nub() : _shifted(UNSHIFTED), _dpadMode(false) { }
+ Nub() : _shifted(UNSHIFTED), _dpadMode(false), _hiresX(0), _hiresY(0) { }
void init() { _buttonPad.initButtons(); }
void setCursor(Cursor *cursor) { _cursor = cursor; }
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index e31456fb70..314580fd37 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -64,6 +64,11 @@ OSystem_PSP::~OSystem_PSP() {}
void OSystem_PSP::initBackend() {
DEBUG_ENTER_FUNC();
+ ConfMan.registerDefault("aspect_ratio", false);
+ ConfMan.registerDefault("gfx_mode", "Fit to Screen");
+ ConfMan.registerDefault("kbdmouse_speed", 3);
+ ConfMan.registerDefault("joystick_deadzone", 3);
+
// Instantiate real time clock
PspRtc::instance();
@@ -109,7 +114,8 @@ void OSystem_PSP::engineDone() {
}
bool OSystem_PSP::hasFeature(Feature f) {
- return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorPalette);
+ return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorPalette ||
+ f == kFeatureKbdMouseSpeed || f == kFeatureJoystickDeadzone);
}
void OSystem_PSP::setFeatureState(Feature f, bool enable) {
diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README
index cdff5f9787..867a683f41 100644
--- a/backends/platform/symbian/README
+++ b/backends/platform/symbian/README
@@ -1,7 +1,7 @@
ScummVM - ScummVM ported to EPOC/SymbianOS
- Copyright (C) 2008-2017 ScummVM Team
+ Copyright (C) 2008-2018 ScummVM Team
Copyright (C) 2013-2013 Fedor Strizhniou aka zanac
Copyright (C) 2003-2013 Lars 'AnotherGuest' Persson
Copyright (C) 2002-2008 Jurgen 'SumthinWicked' Braam