aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/PalmOS/Src
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/PalmOS/Src')
-rw-r--r--backends/platform/PalmOS/Src/base_event.cpp225
-rw-r--r--backends/platform/PalmOS/Src/be_os5.h8
-rwxr-xr-xbackends/platform/PalmOS/Src/launcher/forms/formSelect.cpp3
-rw-r--r--backends/platform/PalmOS/Src/launcher/games.h4
-rw-r--r--backends/platform/PalmOS/Src/os5_gfx.cpp25
-rw-r--r--backends/platform/PalmOS/Src/os5_renderer.cpp40
-rw-r--r--backends/platform/PalmOS/Src/zodiac_event.cpp4
7 files changed, 214 insertions, 95 deletions
diff --git a/backends/platform/PalmOS/Src/base_event.cpp b/backends/platform/PalmOS/Src/base_event.cpp
index d28fd913c0..a3913529b6 100644
--- a/backends/platform/PalmOS/Src/base_event.cpp
+++ b/backends/platform/PalmOS/Src/base_event.cpp
@@ -93,73 +93,137 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
sound_handler();
for(;;) {
+ // check for hardkey repeat for mouse emulation
+ keyCurrentState = KeyCurrentState();
+
// if it was a key pressed, let the keyup event raise
- if (_wasKey) {
- // check for hardkey repeat for mouse emulation
- keyCurrentState = KeyCurrentState();
-
- if (!(keyCurrentState & _keyExtraMask)) {
- _lastKeyRepeat = 0;
-
- } else if (getMillis() >= (_keyExtraRepeat + _keyExtraDelay)) {
- _keyExtraRepeat = getMillis();
-
- if (gVars->arrowKeys) {
-/* if HARD_KEY(Up, chrUpArrow)
- else if HARD_KEY(Down, chrDownArrow)
- else if HARD_KEY(Left, chrLeftArrow)
- else if HARD_KEY(Right, chrRightArrow)
-*/
- } else {
- // button released ?
- if (_keyExtraPressed) {
- if (_keyExtraPressed & _keyExtra.bitActionA) {
- if (!(keyCurrentState & _keyExtra.bitActionA)) {
- _keyExtraPressed &= ~_keyExtra.bitActionA;
-
- event.type = Common::EVENT_LBUTTONUP;
- event.mouse.x = _mouseCurState.x;
- event.mouse.y = _mouseCurState.y;
- return true;
- }
- }
-
- if (_keyExtraPressed & _keyExtra.bitActionB) {
- if (!(keyCurrentState & _keyExtra.bitActionB)) {
- _keyExtraPressed &= ~_keyExtra.bitActionB;
-
- event.type = Common::EVENT_RBUTTONUP;
- event.mouse.x = _mouseCurState.x;
- event.mouse.y = _mouseCurState.y;
- return true;
- }
- }
+ if (_keyExtraPressed) {
+ if (gVars->arrowKeys) {
+ if (_keyExtraPressed & _keyExtra.bitLeft) {
+ if (!(keyCurrentState & _keyExtra.bitLeft)) {
+ _keyExtraPressed &= ~_keyExtra.bitLeft;
+
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_LEFT;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+ return true;
+ }
+ }
+ if (_keyExtraPressed & _keyExtra.bitRight) {
+ if (!(keyCurrentState & _keyExtra.bitRight)) {
+ _keyExtraPressed &= ~_keyExtra.bitRight;
+
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_RIGHT;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+ return true;
+ }
+ }
+ if (_keyExtraPressed & _keyExtra.bitUp) {
+ if (!(keyCurrentState & _keyExtra.bitUp)) {
+ _keyExtraPressed &= ~_keyExtra.bitUp;
+
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_UP;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+ return true;
+ }
+ }
+ if (_keyExtraPressed & _keyExtra.bitDown) {
+ if (!(keyCurrentState & _keyExtra.bitDown)) {
+ _keyExtraPressed &= ~_keyExtra.bitDown;
+
+ event.type = Common::EVENT_KEYUP;
+ event.kbd.keycode = Common::KEYCODE_DOWN;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+ return true;
}
+ }
+ }
- Int8 sx = 0;
- Int8 sy = 0;
-
- if (keyCurrentState & _keyExtra.bitUp)
- sy = -1;
- else if (keyCurrentState & _keyExtra.bitDown)
- sy = +1;
-
- if (keyCurrentState & _keyExtra.bitLeft)
- sx = -1;
- else if (keyCurrentState & _keyExtra.bitRight)
- sx = +1;
-
- if (sx || sy) {
- simulate_mouse(event, sx, sy, &x, &y);
- event.type = Common::EVENT_MOUSEMOVE;
- event.mouse.x = x;
- event.mouse.y = y;
- warpMouse(x, y);
+ if (_keyExtraPressed & _keyExtra.bitActionA) {
+ if (!(keyCurrentState & _keyExtra.bitActionA)) {
+ _keyExtraPressed &= ~_keyExtra.bitActionA;
- return true;
- }
+ event.type = Common::EVENT_LBUTTONUP;
+ event.mouse.x = _mouseCurState.x;
+ event.mouse.y = _mouseCurState.y;
+ return true;
+ }
+ }
+
+ if (_keyExtraPressed & _keyExtra.bitActionB) {
+ if (!(keyCurrentState & _keyExtra.bitActionB)) {
+ _keyExtraPressed &= ~_keyExtra.bitActionB;
+
+ event.type = Common::EVENT_RBUTTONUP;
+ event.mouse.x = _mouseCurState.x;
+ event.mouse.y = _mouseCurState.y;
+ return true;
}
}
+
+ // no more event till up is raised
+ return false;
+ }
+
+ if (!(keyCurrentState & _keyExtraMask)) {
+ _lastKeyRepeat = 0;
+
+ } else if (getMillis() >= (_keyExtraRepeat + _keyExtraDelay)) {
+ _keyExtraRepeat = getMillis();
+
+ if (gVars->arrowKeys) {
+ if (keyCurrentState & _keyExtra.bitLeft) {
+ _keyExtraPressed |= _keyExtra.bitLeft;
+ event.kbd.keycode = Common::KEYCODE_LEFT;
+
+ } else if (keyCurrentState & _keyExtra.bitRight) {
+ _keyExtraPressed |= _keyExtra.bitRight;
+ event.kbd.keycode = Common::KEYCODE_RIGHT;
+
+ } else if (keyCurrentState & _keyExtra.bitUp) {
+ _keyExtraPressed |= _keyExtra.bitUp;
+ event.kbd.keycode = Common::EVENT_KEYUP;
+
+ } else if (keyCurrentState & _keyExtra.bitDown) {
+ _keyExtraPressed |= _keyExtra.bitDown;
+ event.kbd.keycode = Common::KEYCODE_DOWN;
+ }
+
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.ascii = event.kbd.keycode;
+ event.kbd.flags = 0;
+ return true;
+
+ } else {
+ Int8 sx = 0;
+ Int8 sy = 0;
+
+ if (keyCurrentState & _keyExtra.bitUp)
+ sy = -1;
+ else if (keyCurrentState & _keyExtra.bitDown)
+ sy = +1;
+
+ if (keyCurrentState & _keyExtra.bitLeft)
+ sx = -1;
+ else if (keyCurrentState & _keyExtra.bitRight)
+ sx = +1;
+
+ if (sx || sy) {
+ simulate_mouse(event, sx, sy, &x, &y);
+ event.type = Common::EVENT_MOUSEMOVE;
+ event.mouse.x = x;
+ event.mouse.y = y;
+ warpMouse(x, y);
+
+ return true;
+ }
+ }
}
#if defined(COMPILE_OS5) && defined(PALMOS_ARM)
@@ -174,13 +238,13 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
// arrow keys
case chrUpArrow:
- k = 273; break;
+ k = Common::KEYCODE_UP; break;
case chrDownArrow:
- k = 274; break;
- case chrLeftArrow:
- k = 275; break;
+ k = Common::KEYCODE_DOWN; break;
case chrRightArrow:
- k = 276; break;
+ k = Common::KEYCODE_RIGHT; break;
+ case chrLeftArrow:
+ k = Common::KEYCODE_LEFT; break;
}
if (k) {
@@ -197,16 +261,16 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
// ESC key
case vchrLaunch:
event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = 27;
- event.kbd.ascii = 27;
+ event.kbd.keycode = Common::KEYCODE_ESCAPE;
+ event.kbd.ascii = Common::ASCII_ESCAPE;
event.kbd.flags = 0;
return true;
// F5 = menu
case vchrMenu:
event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = 319;
- event.kbd.ascii = 319;
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = Common::ASCII_F5;
event.kbd.flags = 0;
return true;
@@ -222,13 +286,13 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
// arrow keys
case chrUpArrow:
- k = 273; break;
+ k = Common::KEYCODE_UP; break;
case chrDownArrow:
- k = 274; break;
- case chrLeftArrow:
- k = 275; break;
+ k = Common::KEYCODE_DOWN; break;
case chrRightArrow:
- k = 276; break;
+ k = Common::KEYCODE_RIGHT; break;
+ case chrLeftArrow:
+ k = Common::KEYCODE_LEFT; break;
}
if (k) {
@@ -249,13 +313,11 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
((ev.data.keyDown.chr == vchrAttnStateChanged) ||
(ev.data.keyDown.chr == vchrAttnUnsnooze)));
-
// graffiti strokes, auto-off, etc...
if (!handled)
if (SysHandleEvent(&ev))
continue;
-
switch(ev.eType) {
case penMoveEvent:
get_coordinates(&ev, x, y);
@@ -349,8 +411,13 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
// F1 -> F10 key
if (key >= '0' && key <= '9' && mask == (Common::KBD_CTRL|Common::KBD_ALT)) {
- key = (key == '0') ? 324 : (315 + key - '1');
- mask = 0;
+ key = (key - '0' + 10 - 1) % 10; // '0' -> 9, '1' -> 0, '2' -> 1, ...
+ _wasKey = true;
+ event.type = Common::EVENT_KEYDOWN;
+ event.kbd.keycode = Common::KEYCODE_F1 + key;
+ event.kbd.ascii = Common::ASCII_F1 + key;
+ event.kbd.flags = 0;
+ return true;
#ifdef STDLIB_TRACE_MEMORY
// print memory
diff --git a/backends/platform/PalmOS/Src/be_os5.h b/backends/platform/PalmOS/Src/be_os5.h
index fc5f9e667f..bb38c51ca6 100644
--- a/backends/platform/PalmOS/Src/be_os5.h
+++ b/backends/platform/PalmOS/Src/be_os5.h
@@ -110,6 +110,8 @@ private:
typedef void (OSystem_PalmOS5::*RendererProc)(RectangleType &r, PointType &p);
RendererProc _render;
+ Graphics::Surface _framebuffer;
+
OverlayColor *_overlayP;
WinHandle _overlayH, _workScreenH;
int16 *_workScreenP;
@@ -131,8 +133,7 @@ private:
void calc_scale();
void render_landscapeAny(RectangleType &r, PointType &p);
- void render_landscape(RectangleType &r, PointType &p);
- void render_portrait(RectangleType &r, PointType &p);
+ void render_landscape15x(RectangleType &r, PointType &p);
void render_1x(RectangleType &r, PointType &p);
WinHandle alloc_screen(Coord w, Coord h);
virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0);
@@ -169,7 +170,8 @@ public:
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
void clearScreen();
- bool grabRawScreen(Graphics::Surface *surf);
+ virtual Graphics::Surface *lockScreen();
+ virtual void unlockScreen();
void setCursorPalette(const byte *colors, uint start, uint num);
void disableCursorPalette(bool disable);
diff --git a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp
index 5f61c85cae..085fb2499a 100755
--- a/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp
+++ b/backends/platform/PalmOS/Src/launcher/forms/formSelect.cpp
@@ -28,7 +28,8 @@
#include "formUtil.h"
#include "games.h"
#include "start.h"
-#include "common/util.h"
+
+#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
static Char **items = NULL;
Int16 selectedEngine = -1;
diff --git a/backends/platform/PalmOS/Src/launcher/games.h b/backends/platform/PalmOS/Src/launcher/games.h
index c277bec4cc..d807d6b64d 100644
--- a/backends/platform/PalmOS/Src/launcher/games.h
+++ b/backends/platform/PalmOS/Src/launcher/games.h
@@ -186,14 +186,14 @@ static const struct {
{ "cine", "Delphine Cinematique v1.0" },
{ "queen", "Flight of the Amazon Queen" },
{ "lure", "Lure of the Tempress" },
- { "gob", "Gobliiins, Bargon Attack and more ..." },
+ { "gob", "Gobliiins, Bargon Attack and more" },
{ "kyra", "Kyrandia" },
{ "parallaction", "Parallaction" },
{ "saga", "SAGA Engine" },
{ "scumm", "Scumm Games" },
{ "agi", "Sierra AGI" },
{ "touche", "Touche: The Adventures of the Fifth Musketeer" },
- { "cruise", "Cruise for a Corpse" },
+ { "cruise", "Beta -> Cruise for a Corpse" },
};
// protos
diff --git a/backends/platform/PalmOS/Src/os5_gfx.cpp b/backends/platform/PalmOS/Src/os5_gfx.cpp
index 247acf6f46..be5d28bc56 100644
--- a/backends/platform/PalmOS/Src/os5_gfx.cpp
+++ b/backends/platform/PalmOS/Src/os5_gfx.cpp
@@ -137,9 +137,13 @@ void OSystem_PalmOS5::hotswap_gfx_mode(int mode) {
}
if (_stretched) {
- calc_scale();
OPTIONS_SET(kOptDisableOnScrDisp);
- _render = &OSystem_PalmOS5::render_landscapeAny;
+ if (_screenHeight == 200 && _screenDest.h == 300) {
+ _render = &OSystem_PalmOS5::render_landscape15x;
+ } else {
+ _render = &OSystem_PalmOS5::render_landscapeAny;
+ calc_scale();
+ }
} else {
OPTIONS_RST(kOptDisableOnScrDisp);
_render = &OSystem_PalmOS5::render_1x;
@@ -215,13 +219,18 @@ void OSystem_PalmOS5::copyRectToScreen(const byte *buf, int pitch, int x, int y,
}
}
-bool OSystem_PalmOS5::grabRawScreen(Graphics::Surface *surf) {
- assert(surf);
+Graphics::Surface *OSystem_PalmOS5::lockScreen() {
+ _framebuffer.pixels = _offScreenP;
+ _framebuffer.w = _screenWidth;
+ _framebuffer.h = _screenHeight;
+ _framebuffer.pitch = _screenWidth;
+ _framebuffer.bytesPerPixel = 1;
- surf->create(_screenWidth, _screenHeight, 1);
- MemMove(surf->pixels, _offScreenP, _screenWidth * _screenHeight);
-
- return true;
+ return &_framebuffer;
+}
+
+void OSystem_PalmOS5::unlockScreen() {
+ // The screen is always completely update anyway, so we don't have to force a full update here.
}
void OSystem_PalmOS5::int_updateScreen() {
diff --git a/backends/platform/PalmOS/Src/os5_renderer.cpp b/backends/platform/PalmOS/Src/os5_renderer.cpp
index fdae35acd5..4580db4d53 100644
--- a/backends/platform/PalmOS/Src/os5_renderer.cpp
+++ b/backends/platform/PalmOS/Src/os5_renderer.cpp
@@ -76,3 +76,43 @@ void OSystem_PalmOS5::render_landscapeAny(RectangleType &r, PointType &p) {
p.y = _screenOffset.y + o;
RctSetRectangle(&r, 0, 0, _screenDest.w, _screenDest.h - o);
}
+
+void OSystem_PalmOS5::render_landscape15x(RectangleType &r, PointType &p) {
+ Coord x, y, o = 0;
+ int16 *dst = _workScreenP;
+
+ if (_overlayVisible) {
+ int16 *src = _overlayP;
+
+ for (y = 0; y < 100; y++) {
+ // draw 2 lines
+ for (x = 0; x < 320; x++) {
+ *dst++ = *src++;
+ *dst++ = *src;
+ *dst++ = *src++;
+ }
+ // copy the second to the next line
+ MemMove(dst, dst - 480, 480 * 2);
+ dst += 480;
+ }
+ } else {
+ byte *src = _offScreenP;
+ o = _current_shake_pos;
+
+ for (y = 0; y < 100; y++) {
+ // draw 2 lines
+ for (x = 0; x < 320; x++) {
+ *dst++ = _nativePal[*src++];
+ *dst++ = _nativePal[*src];
+ *dst++ = _nativePal[*src++];
+ }
+ // copy the second to the next line
+ MemMove(dst, dst - 480, 480 * 2);
+ dst += 480;
+ }
+ }
+
+ p.x = _screenOffset.x;
+ p.y = _screenOffset.y + o;
+ RctSetRectangle(&r, 0, 0, 480, 300 - o);
+}
diff --git a/backends/platform/PalmOS/Src/zodiac_event.cpp b/backends/platform/PalmOS/Src/zodiac_event.cpp
index 4962ad2b72..84ecc27097 100644
--- a/backends/platform/PalmOS/Src/zodiac_event.cpp
+++ b/backends/platform/PalmOS/Src/zodiac_event.cpp
@@ -46,8 +46,8 @@ bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) {
// F5 = menu
case vchrThumbWheelBack:
event.type = Common::EVENT_KEYDOWN;
- event.kbd.keycode = 319;
- event.kbd.ascii = 319;
+ event.kbd.keycode = Common::KEYCODE_F5;
+ event.kbd.ascii = Common::ASCII_F5;
event.kbd.flags = 0;
return true;