[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src extend.cpp,1.2,1.2.2.1 extend.h,1.2,1.2.2.1 palm.cpp,1.4,1.4.2.1 palm.h,1.3,1.3.2.1 palmsave.cpp,1.2,1.2.2.1 palmstart.cpp,1.4,1.4.2.1 extras.cpp,1.2,NONE extras.h,1.2,NONE
Chris Apers
chrilith at users.sourceforge.net
Tue May 6 07:34:09 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1:/tmp/cvs-serv31632
Modified Files:
Tag: branch-0-4-0
extend.cpp extend.h palm.cpp palm.h palmsave.cpp palmstart.cpp
Removed Files:
Tag: branch-0-4-0
extras.cpp extras.h
Log Message:
Branch update
Index: extend.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/extend.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- extend.cpp 30 Apr 2003 20:57:10 -0000 1.2
+++ extend.cpp 6 May 2003 14:33:55 -0000 1.2.2.1
@@ -24,6 +24,8 @@
#include "extend.h"
#include "string.h"
#include "palm.h"
+
+const Char *SCUMMVM_SAVEPATH = "/PALM/Programs/ScummVM/Saved/";
/*
//Sony clie PalmOS<5
void BmpDrawDDBitmap(const FormType *formP, DmResID bitmapID)
@@ -108,4 +110,4 @@
part = StrTok(NULL," ");
}
-}
\ No newline at end of file
+}
Index: extend.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/extend.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- extend.h 30 Apr 2003 21:05:00 -0000 1.2
+++ extend.h 6 May 2003 14:33:56 -0000 1.2.2.1
@@ -23,12 +23,14 @@
#ifndef EXTEND_H
#define EXTEND_H
-extern const Char *SCUMMVM_SAVEPATH; // extras.cpp
+extern const Char *SCUMMVM_SAVEPATH;
#define DISABLE_SKY
#define DISABLE_SIMON
-#define OutputDebugString PalmFatalError
+#define appFileCreator 'ScVM'
+
+int main(int argc, char **argv);
void WinDrawWarpChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth);
UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr);
Index: palm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palm.cpp,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- palm.cpp 2 May 2003 15:30:05 -0000 1.4
+++ palm.cpp 6 May 2003 14:33:56 -0000 1.4.2.1
@@ -20,53 +20,20 @@
*
*/
-#include "stdafx.h"
#include "scumm.h"
-#include "mididrv.h"
-#include "gameDetector.h"
#include "common/scaler.h"
#include "palm.h"
-#include "starterrsc.h"
-#include "pa1lib.h"
-#include "sonychars.h"
-
-#define SAVEDELAY (5 * 60 * 1000) // five minutes
-#define EXITDELAY (100) // delay to exit : calc button : double tap 1/500 sec
-
-#define SCREEN_OVERLAY 0
-
-static DmOpenRef gStgMemory = NULL;
-
-static void MemStgInit() {
- if (!gStgMemory)
- {
- LocalID localID = DmFindDatabase(0, "Scumm-Memory");
- if (localID) DmDeleteDatabase(0, localID);
-
- if (DmCreateDatabase (0, "Scumm-Memory", 'ScVM', 'DATA', false) != errNone)
- return;
-
- localID = DmFindDatabase(0, "Scumm-Memory");
- gStgMemory = DmOpenDatabase(0, localID, dmModeReadWrite|dmModeExclusive);
- }
-}
+#include "vibrate.h"
-static void MemStgCleanup() {
- if (gStgMemory) {
- DmCloseDatabase(gStgMemory);
- LocalID localID = DmFindDatabase(0, "Scumm-Memory");
- if (localID)
- DmDeleteDatabase(0, localID);
- }
-}
+#define EXITDELAY (500) // delay to exit : calc button : double tap 1/500 sec
+#define ftrOverlayPtr (1000)
OSystem *OSystem_PALMOS::create(UInt16 gfx_mode) {
OSystem_PALMOS *syst = new OSystem_PALMOS();
syst->_mode = gfx_mode;
syst->_vibrate = gVars->vibrator;
-
return syst;
}
@@ -112,40 +79,38 @@
255 ,255,87 ,0,
255 ,255,255,0
};
-
// palette for preload dialog
set_palette(startupPalette,0,16);
- MemStgInit();
switch(_mode)
{
case GFX_FLIPPING:
- palm_offscreen = WinScreenLock(winLockErase) + _screeny;
- palm_screen = palm_offscreen;
+ _offScreenP = WinScreenLock(winLockErase) + _screeny;
+ _screenP = _offScreenP;
gVars->screenLocked = true;
_renderer_proc = &update_screen__flipping;
break;
case GFX_DOUBLEBUFFER:
- h_palm_screen = WinGetDisplayWindow();
- palm_screen = (byte *)(BmpGetBits(WinGetBitmap(h_palm_screen))) + _screeny;
- h_palm_offscreen= WinCreateOffscreenWindow(SCREEN_WIDTH, SCREEN_HEIGHT, screenFormat, &e);
- palm_offscreen = (byte *)(BmpGetBits(WinGetBitmap(h_palm_offscreen)));
+ _screenH = WinGetDisplayWindow();
+ _screenP = (byte *)(BmpGetBits(WinGetBitmap(_screenH))) + _screeny;
+ _offScreenH = WinCreateOffscreenWindow(_screenWidth, _screenHeight, screenFormat, &e);
+ _offScreenP = (byte *)(BmpGetBits(WinGetBitmap(_offScreenH)));
_renderer_proc = &update_screen__dbuffer;
break;
case GFX_NORMAL:
default:
- h_palm_offscreen= WinGetDisplayWindow();
- palm_offscreen = (byte *)(BmpGetBits(WinGetBitmap(h_palm_offscreen))) + _screeny;
- palm_screen = palm_offscreen;
+ _offScreenH = WinGetDisplayWindow();
+ _offScreenP = (byte *)(BmpGetBits(WinGetBitmap(_offScreenH))) + _screeny;
+ _screenP = _offScreenP;
_renderer_proc = &update_screen__direct;
break;
}
-// h_palm_tmpscreen = WinCreateOffscreenWindow(SCREEN_WIDTH, SCREEN_HEIGHT, screenFormat, &e);
-// palm_tmpscreen = (byte *)(BmpGetBits(WinGetBitmap(h_palm_tmpscreen)));
- UInt16 index = SCREEN_OVERLAY;
- tmpScreenHandle = DmNewRecord(gStgMemory, &index, SCREEN_WIDTH * SCREEN_HEIGHT);
- tmpScreen = (byte *)MemHandleLock(tmpScreenHandle);
+ // try to allocate on storage heap
+ FtrPtrNew(appFileCreator, ftrOverlayPtr, _screenWidth * _screenHeight, (void **)&_tmpScreenP);
+ // failed ? dynamic heap
+ if (!_tmpScreenP)
+ _tmpScreenP = (byte *)malloc(_screenWidth * _screenHeight);
_overlaySaved = false;
}
@@ -157,20 +122,21 @@
WinScreenUnlock();
break;
case GFX_DOUBLEBUFFER:
- WinDeleteWindow(h_palm_offscreen,false);
+ WinDeleteWindow(_offScreenH,false);
break;
}
-// WinDeleteWindow(h_palm_tmpscreen,false);
- if (tmpScreenHandle)
- MemPtrUnlock(tmpScreen);
- MemStgCleanup();
+ if (_tmpScreenP)
+ if (MemPtrDataStorage(_tmpScreenP))
+ FtrPtrFree(appFileCreator, ftrOverlayPtr);
+ else
+ free(_tmpScreenP);
}
void OSystem_PALMOS::init_size(uint w, uint h) {
- SCREEN_WIDTH = w;
- SCREEN_HEIGHT = h;
+ _screenWidth = w;
+ _screenHeight = h;
_overlay_visible = false;
_quit = false;
@@ -181,24 +147,21 @@
set_mouse_pos(200,150);
_currentPalette = (RGBColorType*)calloc(sizeof(RGBColorType), 256);
- _mouse_backup = (byte*)malloc(MAX_MOUSE_W * MAX_MOUSE_H);
+ _mouseBackupP = (byte*)malloc(MAX_MOUSE_W * MAX_MOUSE_H);
load_gfx_mode();
}
void OSystem_PALMOS::copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) {
-
- byte *dst;
-
/* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */
- if (_mouse_drawn)
+ if (_mouseDrawn)
undraw_mouse();
- dst = palm_offscreen + y * SCREEN_WIDTH + x;
+ byte *dst = _offScreenP + y * _screenWidth + x;
do {
memcpy(dst, buf, w);
- dst += SCREEN_WIDTH;
+ dst += _screenWidth;
buf += pitch;
} while (--h);
}
@@ -207,18 +170,18 @@
{
RectangleType r;
UInt8 *screen;
- UInt32 size = SCREEN_WIDTH*SCREEN_HEIGHT + 6400; // 10 pix top and bottom border
+ UInt32 size = _screenWidth * _screenHeight + 6400; // 10 pix top and bottom border
Boolean shaked = false;
UInt32 move = 0;
// shake screen
if (_current_shake_pos != _new_shake_pos) {
if (gVars->HRrefNum) {
- RctSetRectangle(&r, 0, _decaly - _new_shake_pos, SCREEN_WIDTH, SCREEN_HEIGHT + (_new_shake_pos << 2));
+ RctSetRectangle(&r, 0, _decaly - _new_shake_pos, _screenWidth, _screenHeight + (_new_shake_pos << 2));
HRWinScrollRectangle(gVars->HRrefNum, &r, winDown, _new_shake_pos, NULL);
} else {
- move = (_new_shake_pos * SCREEN_WIDTH);
- screen = palm_offscreen - 3200;
+ move = (_new_shake_pos * _screenWidth);
+ screen = _offScreenP - 3200;
MemMove(screen + move, screen, size);
}
@@ -233,13 +196,13 @@
// update screen
WinScreenUnlock();
- palm_offscreen = WinScreenLock(winLockCopy) + _screeny;
- palm_screen = palm_offscreen;
+ _offScreenP = WinScreenLock(winLockCopy) + _screeny;
+ _screenP = _offScreenP;
if (shaked) {
if (gVars->HRrefNum) {
HRWinScrollRectangle(gVars->HRrefNum, &r, winUp, _new_shake_pos, NULL);
} else {
- screen = palm_offscreen - 3200;
+ screen = _offScreenP - 3200;
MemMove(screen, screen + move, size);
}
}
@@ -249,13 +212,13 @@
void OSystem_PALMOS::update_screen__dbuffer()
{
UInt32 move = 0;
- UInt32 size = SCREEN_WIDTH*SCREEN_HEIGHT;
+ UInt32 size = _screenWidth * _screenHeight;
// shake screen
if (_current_shake_pos != _new_shake_pos) {
- move = (_new_shake_pos * SCREEN_WIDTH);
+ move = (_new_shake_pos * _screenWidth);
// copy clear bottom of the screen to top to cover shaking image
- MemMove(palm_screen, palm_screen + size , move);
+ MemMove(_screenP, _screenP + size , move);
if (_vibrate) {
Boolean active = (_new_shake_pos >= 3);
@@ -265,7 +228,7 @@
_current_shake_pos = _new_shake_pos;
}
// update screen
- MemMove(palm_screen + move, palm_offscreen, size - move);
+ MemMove(_screenP + move, _offScreenP, size - move);
}
void OSystem_PALMOS::update_screen__direct()
@@ -309,11 +272,11 @@
}
bool OSystem_PALMOS::show_mouse(bool visible) {
- if (_mouse_visible == visible)
+ if (_mouseVisible == visible)
return visible;
- bool last = _mouse_visible;
- _mouse_visible = visible;
+ bool last = _mouseVisible;
+ _mouseVisible = visible;
if (visible)
draw_mouse();
@@ -327,21 +290,21 @@
}
void OSystem_PALMOS::set_mouse_pos(int x, int y) {
- if (x != _mouse_cur_state.x || y != _mouse_cur_state.y) {
- _mouse_cur_state.x = x;
- _mouse_cur_state.y = y;
+ if (x != _mouseCurState.x || y != _mouseCurState.y) {
+ _mouseCurState.x = x;
+ _mouseCurState.y = y;
undraw_mouse();
}
}
void OSystem_PALMOS::set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
- _mouse_cur_state.w = w;
- _mouse_cur_state.h = h;
+ _mouseCurState.w = w;
+ _mouseCurState.h = h;
- _mouse_hotspot_x = hotspot_x;
- _mouse_hotspot_y = hotspot_y;
+ _mouseHotspotX = hotspot_x;
+ _mouseHotspotY = hotspot_y;
- _mouse_data = (byte*)buf;
+ _mouseDataP = (byte*)buf;
undraw_mouse();
}
@@ -406,8 +369,8 @@
}
void OSystem_PALMOS::SimulateArrowKeys(Event *event, Int8 iHoriz, Int8 iVert, Boolean repeat) {
- Int16 x = _mouse_cur_state.x;
- Int16 y = _mouse_cur_state.y;
+ Int16 x = _mouseCurState.x;
+ Int16 y = _mouseCurState.y;
if (repeat) {
lastKeyRepeat += 100;
@@ -422,9 +385,9 @@
y = y + iVert * (lastKeyRepeat/100);
x = (x < 0 ) ? 0 : x;
- x = (x >= SCREEN_WIDTH ) ? SCREEN_WIDTH-1 : x;
+ x = (x >= _screenWidth ) ? _screenWidth-1 : x;
y = (y < 0 ) ? 0 : y;
- y = (y >= SCREEN_HEIGHT ) ? SCREEN_HEIGHT-1 : y;
+ y = (y >= _screenHeight ) ? _screenHeight-1 : y;
event->event_code = EVENT_MOUSEMOVE;
@@ -443,7 +406,7 @@
MemHandle hTemp;
BitmapType *bmTemp;
UInt32 *bmData;
- UInt8 *scr = palm_screen + SCREEN_WIDTH * (SCREEN_HEIGHT + 2) + 2;
+ UInt8 *scr = _screenP + _screenWidth * (_screenHeight + 2) + 2;
hTemp = DmGetResource(bitmapRsc,bmpID);
@@ -458,7 +421,7 @@
else
*scr++ = gVars->indicator.off;
}
- scr += SCREEN_WIDTH - 32;
+ scr += _screenWidth - 32;
bmData++;
}
@@ -469,7 +432,7 @@
for (j = 0; j < 32; j++) {
*scr++ = gVars->indicator.off;
}
- scr += SCREEN_WIDTH - 32;
+ scr += _screenWidth - 32;
}
}
}
@@ -477,7 +440,6 @@
bool OSystem_PALMOS::poll_event(Event *event) {
EventType ev;
Boolean handled;
-// UInt32 button = 0;
uint32 current_msecs;
UInt32 keyCurrentState = 0;
Boolean funcButton = false;
@@ -497,9 +459,6 @@
if(_sound.active)
check_sound();
-// if (_msg.state != 0)
-// drawMessage();
-
// timer handler
if (_timer.active && (current_msecs >= _timer.next_expiry)) {
_timer.duration = _timer.callback(_timer.duration);
@@ -545,8 +504,8 @@
// mouse emulation
case vchrHard1: // left button
event->event_code = EVENT_LBUTTONDOWN;
- event->mouse.x = _mouse_cur_state.x;
- event->mouse.y = _mouse_cur_state.y;
+ event->mouse.x = _mouseCurState.x;
+ event->mouse.y = _mouseCurState.y;
lastKeyPressed = -1;
return true;
@@ -572,8 +531,8 @@
case vchrHard4: // right button
event->event_code = EVENT_RBUTTONDOWN;
- event->mouse.x = _mouse_cur_state.x;
- event->mouse.y = _mouse_cur_state.y;
+ event->mouse.x = _mouseCurState.x;
+ event->mouse.y = _mouseCurState.y;
lastKeyPressed = -1;
return true;
@@ -639,7 +598,7 @@
}
case penMoveEvent:
- if (ev.screenY*2-_decaly > SCREEN_HEIGHT || ev.screenY*2-_decaly < 0)
+ if (ev.screenY*2-_decaly > _screenHeight || ev.screenY*2-_decaly < 0)
return true;
if (lastEvent != penMoveEvent && (abs(ev.screenY*2-event->mouse.y) <= 2 || abs(ev.screenX*2-event->mouse.x) <= 2)) // move only if
@@ -654,7 +613,7 @@
case penDownEvent:
lastEvent = penDownEvent;
- if (ev.screenY*2-_decaly > SCREEN_HEIGHT || ev.screenY*2-_decaly < 0)
+ if (ev.screenY*2-_decaly > _screenHeight || ev.screenY*2-_decaly < 0)
return true;
event->event_code = EVENT_LBUTTONDOWN;
@@ -666,7 +625,7 @@
case penUpEvent:
event->event_code = EVENT_LBUTTONUP;
- if (ev.screenY*2-_decaly > SCREEN_HEIGHT || ev.screenY*2-_decaly < 0)
+ if (ev.screenY*2-_decaly > _screenHeight || ev.screenY*2-_decaly < 0)
return true;
event->mouse.x = ev.screenX*2;
@@ -688,28 +647,29 @@
if (StrCaselessCompare(value->caption,"ScummVM") == 0)
return 1;
- UInt16 w1 = FntCharsWidth(value->caption,StrLen(value->caption));
+ Char *caption = "Loading...\0";
+ Char *build = "Build on " __DATE__ ", " __TIME__ " GMT+1\0";
+ UInt16 h0 = FntLineHeight() + 2;
+ UInt16 w1;
+
+ WinSetTextColor(255);
+ WinSetForeColor(255);
if (gVars->HRrefNum != sysInvalidRefNum) {
- Char *caption = "Loading...\0";
- UInt16 h0 = FntLineHeight() + 2;
- UInt16 w1;
-
- WinSetTextColor(255);
HRFntSetFont(gVars->HRrefNum,hrTinyBoldFont);
- w1 = FntCharsWidth(caption,StrLen(caption)) * 1;
+ w1 = FntCharsWidth(caption,StrLen(caption));
w1 = (320 - w1) / 2;
HRWinDrawChars(gVars->HRrefNum,caption,StrLen(caption),w1,80);
HRFntSetFont(gVars->HRrefNum,hrTinyFont);
- w1 = FntCharsWidth(value->caption,StrLen(value->caption)) * 1;
+ w1 = FntCharsWidth(value->caption,StrLen(value->caption));
w1 = (320 - w1) / 2;
HRWinDrawChars(gVars->HRrefNum,value->caption,StrLen(value->caption),w1,80 + h0);
+ HRWinDrawLine(gVars->HRrefNum, 40, 85 + h0 * 2, 280, 85 + h0 * 2);
+ w1 = FntCharsWidth(build,StrLen(build));
+ w1 = (320 - w1) / 2;
+ HRWinDrawChars(gVars->HRrefNum,build,StrLen(build),w1,90 + h0 * 2);
} else {
- Char *caption = "Loading...\0";
- UInt16 w1;
-
- WinSetTextColor(255);
FntSetFont(boldFont);
w1 = FntCharsWidth(caption,StrLen(caption));
w1 = (160 - w1) / 2;
@@ -732,36 +692,37 @@
if (_quit)
return;
+
if (g_scumm)
g_scumm->_quit = true;
if (_currentPalette)
free(_currentPalette);
- if (_mouse_backup)
- free(_mouse_backup);
- if (_sndData)
- MemPtrFree(_sndData);
+ if (_mouseBackupP)
+ free(_mouseBackupP);
- unload_gfx_mode();
+ if (_sndTempP)
+ MemPtrFree(_sndTempP);
+ if (_sndDataP)
+ MemPtrFree(_sndDataP);
+ unload_gfx_mode();
_quit = true;
- _currentPalette = NULL;
- _mouse_backup = NULL;
}
void OSystem_PALMOS::draw_mouse() {
- if (_mouse_drawn || !_mouse_visible || _quit)
+ if (_mouseDrawn || !_mouseVisible || _quit)
return;
- _mouse_cur_state.y = _mouse_cur_state.y>=SCREEN_HEIGHT ? SCREEN_HEIGHT-1 : _mouse_cur_state.y;
+ _mouseCurState.y = _mouseCurState.y >= _screenHeight ? _screenHeight - 1 : _mouseCurState.y;
- int x = _mouse_cur_state.x - _mouse_hotspot_x;
- int y = _mouse_cur_state.y - _mouse_hotspot_y;
- int w = _mouse_cur_state.w;
- int h = _mouse_cur_state.h;
+ int x = _mouseCurState.x - _mouseHotspotX;
+ int y = _mouseCurState.y - _mouseHotspotY;
+ int w = _mouseCurState.w;
+ int h = _mouseCurState.h;
byte color;
- byte *src = _mouse_data; // Image representing the mouse
- byte *bak = _mouse_backup; // Surface used to backup the area obscured by the mouse
- byte *dst; // Surface we are drawing into
+ byte *src = _mouseDataP; // Image representing the mouse
+ byte *bak = _mouseBackupP; // Surface used to backup the area obscured by the mouse
+ byte *dst; // Surface we are drawing into
// clip the mouse rect, and addjust the src pointer accordingly
@@ -772,27 +733,27 @@
}
if (y < 0) {
h += y;
- src -= y * _mouse_cur_state.w;
+ src -= y * _mouseCurState.w;
y = 0;
}
- if (w > SCREEN_WIDTH - x)
- w = SCREEN_WIDTH - x;
- if (h > SCREEN_HEIGHT - y)
- h = SCREEN_HEIGHT - y;
-
- // Store the bounding box so that undraw mouse can restore the area the
- // mouse currently covers to its original content.
- _mouse_old_state.x = x;
- _mouse_old_state.y = y;
- _mouse_old_state.w = w;
- _mouse_old_state.h = h;
+ if (w > _screenWidth - x)
+ w = _screenWidth - x;
+ if (h > _screenHeight - y)
+ h = _screenHeight - y;
// Quick check to see if anything has to be drawn at all
if (w <= 0 || h <= 0)
return;
+ // Store the bounding box so that undraw mouse can restore the area the
+ // mouse currently covers to its original content.
+ _mouseOldState.x = x;
+ _mouseOldState.y = y;
+ _mouseOldState.w = w;
+ _mouseOldState.h = h;
+
// Draw the mouse cursor; backup the covered area in "bak"
- dst = palm_offscreen + y * SCREEN_WIDTH + x;
+ dst = _offScreenP + y * _screenWidth + x;
while (h > 0) {
int width = w;
while (width > 0) {
@@ -803,33 +764,33 @@
dst++;
width--;
}
- src += _mouse_cur_state.w - w;
+ src += _mouseCurState.w - w;
bak += MAX_MOUSE_W - w;
- dst += SCREEN_WIDTH - w;
+ dst += _screenWidth - w;
h--;
}
// Finally, set the flag to indicate the mouse has been drawn
- _mouse_drawn = true;
+ _mouseDrawn = true;
}
void OSystem_PALMOS::undraw_mouse() {
- if (!_mouse_drawn || _quit)
+ if (!_mouseDrawn || _quit)
return;
- _mouse_drawn = false;
+ _mouseDrawn = false;
- byte *dst, *bak = _mouse_backup;
- const int old_mouse_x = _mouse_old_state.x;
- const int old_mouse_y = _mouse_old_state.y;
- const int old_mouse_w = _mouse_old_state.w;
- const int old_mouse_h = _mouse_old_state.h;
+ byte *dst, *bak = _mouseBackupP;
+ const int old_mouse_x = _mouseOldState.x;
+ const int old_mouse_y = _mouseOldState.y;
+ const int old_mouse_w = _mouseOldState.w;
+ const int old_mouse_h = _mouseOldState.h;
int x,y;
// No need to do clipping here, since draw_mouse() did that already
- dst = palm_offscreen + old_mouse_y * SCREEN_WIDTH + old_mouse_x;
- for (y = 0; y < old_mouse_h; ++y, bak += MAX_MOUSE_W, dst += SCREEN_WIDTH) {
+ dst = _offScreenP + old_mouse_y * _screenWidth + old_mouse_x;
+ for (y = 0; y < old_mouse_h; ++y, bak += MAX_MOUSE_W, dst += _screenWidth) {
for (x = 0; x < old_mouse_w; ++x) {
dst[x] = bak[x];
}
@@ -857,11 +818,9 @@
_current_shake_pos = 0;
_new_shake_pos = 0;
- memset(&_mouse_old_state,0,sizeof(MousePos));
- memset(&_mouse_cur_state,0,sizeof(MousePos));
+ memset(&_mouseOldState,0,sizeof(MousePos));
+ memset(&_mouseCurState,0,sizeof(MousePos));
- _msg.state = 0;
-
_paletteDirtyStart = 0;
_paletteDirtyEnd = 0;
@@ -870,15 +829,16 @@
_sound.active = false;
_currentPalette = NULL;
- _mouse_backup = NULL;
+ _mouseBackupP = NULL;
lastKeyPressed = -1;
lastKeyRepeat = 100;
lastKeyModifier = MD_NONE;
- _isPlaying = false;
-
- _sndData = (UInt8 *)MemPtrNew(512);
+ // sound
+ _isSndPlaying = false;
+ _sndTempP = (UInt8 *)MemPtrNew(4096);
+ _sndDataP = (UInt8 *)MemPtrNew(1024);
}
void OSystem_PALMOS::move_screen(int dx, int dy, int height) {
@@ -892,25 +852,25 @@
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
- copy_rect((byte *)palm_offscreen + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
+ copy_rect((byte *)_offScreenP + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
- copy_rect((byte *)palm_offscreen + SCREEN_WIDTH * (y - dy), SCREEN_WIDTH, 0, y, SCREEN_WIDTH, 1);
+ copy_rect((byte *)_offScreenP + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
- for (int x = SCREEN_WIDTH - 1; x >= dx; x--)
- copy_rect((byte *)palm_offscreen + x - dx, SCREEN_WIDTH, x, 0, 1, height);
+ for (int x = _screenWidth - 1; x >= dx; x--)
+ copy_rect((byte *)_offScreenP + x - dx, _screenWidth, x, 0, 1, height);
} else {
// move left
// copy from left to right
- for (int x = 0; x < SCREEN_WIDTH; x++)
- copy_rect((byte *)palm_offscreen + x - dx, SCREEN_WIDTH, x, 0, 1, height);
+ for (int x = 0; x < _screenWidth; x++)
+ copy_rect((byte *)_offScreenP + x - dx, _screenWidth, x, 0, 1, height);
}
} else {
// free movement
@@ -918,55 +878,6 @@
}
}
-void OSystem_PALMOS::drawMessage() {
- UInt32 msecs = get_msecs();
-
- if ((msecs - _msg.time) >= _msg.wait) {
- Int16 y = _msg.position * _msg.state + (_msg.state == -1 ? 320 : 308);
- _msg.time = msecs;
-
- WinSetDrawMode(winPaint);
- WinSetBackColor(0);
- WinSetTextColor(_msg.color);
- HRFntSetFont(gVars->HRrefNum,hrTinyFont);
- HRWinDrawChars(gVars->HRrefNum, _msg.text, StrLen(_msg.text), 2, y);
-
- _msg.position += 2;
- if (_msg.position > 12) {
- _msg.position = 0;
- _msg.state *= -1;
- _msg.wait = 5000;
- _msg.state = (_msg.state == -1 ? 0 : _msg.state);
- } else {
- _msg.wait = 100;
- }
- }
-}
-
-void OSystem_PALMOS::deleteMessage() {
- if (_msg.state != 0) {
- Int16 y = _msg.position * _msg.state + (_msg.state == -1 ? 320 : 308);
- WinSetDrawMode(winPaint);
- WinSetBackColor(0);
- WinSetTextColor(0);
- HRFntSetFont(gVars->HRrefNum,hrTinyFont);
- HRWinDrawChars(gVars->HRrefNum, _msg.text, StrLen(_msg.text), 2, y);
- }
-}
-
-void OSystem_PALMOS::addMessage(const Char *msg) {
-
- if (_msg.state != 0)
- deleteMessage();
-
- _msg.state = -1;
- _msg.position = 0;
- StrCopy(_msg.text,msg);
- _msg.time = get_msecs();
- _msg.wait = 100;
- _msg.color = RGBToColor(255,255,255);
-}
-
bool OSystem_PALMOS::set_sound_proc(void *param, SoundProc *proc, byte format) {
_sound.active = true;
@@ -978,11 +889,10 @@
void OSystem_PALMOS::check_sound() {
// currently not supported
- _sound.proc(_sound.param, _sndData, 512);
+ _sound.proc(_sound.param, _sndTempP, 256);
}
-void OSystem_PALMOS::show_overlay()
-{
+void OSystem_PALMOS::show_overlay() {
// hide the mouse
undraw_mouse();
@@ -990,92 +900,88 @@
clear_overlay();
}
-void OSystem_PALMOS::hide_overlay()
-{
+void OSystem_PALMOS::hide_overlay() {
// hide the mouse
undraw_mouse();
_overlay_visible = false;
_overlaySaved = false;
- memmove(palm_offscreen, tmpScreen, SCREEN_WIDTH*SCREEN_HEIGHT);
+ memmove(_offScreenP, _tmpScreenP, _screenWidth * _screenHeight);
}
-void OSystem_PALMOS::clear_overlay()
-{
+void OSystem_PALMOS::clear_overlay() {
if (!_overlay_visible)
return;
// hide the mouse
undraw_mouse();
- if (!_overlaySaved)
- { //memmove(palm_tmpscreen, palm_offscreen, SCREEN_WIDTH*SCREEN_HEIGHT);
- DmWrite(tmpScreen, 0, palm_offscreen, SCREEN_WIDTH*SCREEN_HEIGHT);
+ if (!_overlaySaved) {
+ if (MemPtrDataStorage(_tmpScreenP))
+ DmWrite(_tmpScreenP, 0, _offScreenP, _screenWidth * _screenHeight);
+ else
+ MemMove(_tmpScreenP, _offScreenP, _screenWidth * _screenHeight);
_overlaySaved = true;
}
}
-void OSystem_PALMOS::grab_overlay(byte *buf, int pitch)
-{
+void OSystem_PALMOS::grab_overlay(byte *buf, int pitch) {
if (!_overlay_visible)
return;
// hide the mouse
undraw_mouse();
- byte *src = tmpScreen;
- int h = SCREEN_HEIGHT;
+ byte *src = _tmpScreenP;
+ int h = _screenHeight;
do {
- memcpy(buf, src, SCREEN_WIDTH);
- src += SCREEN_WIDTH;
+ memcpy(buf, src, _screenWidth);
+ src += _screenWidth;
buf += pitch;
} while (--h);
}
-void OSystem_PALMOS::copy_rect_overlay(const byte *buf, int pitch, int x, int y, int w, int h)
-{
+void OSystem_PALMOS::copy_rect_overlay(const byte *buf, int pitch, int x, int y, int w, int h) {
if (!_overlay_visible)
return;
undraw_mouse();
- byte *dst = palm_offscreen + y * SCREEN_WIDTH + x;
+ byte *dst = _offScreenP + y * _screenWidth + x;
do {
memcpy(dst, buf, w);
- dst += SCREEN_WIDTH;
+ dst += _screenWidth;
buf += pitch;
} while (--h);
}
int16 OSystem_PALMOS::get_height() {
- return SCREEN_HEIGHT;
+ return _screenHeight;
}
int16 OSystem_PALMOS::get_width() {
- return SCREEN_WIDTH;
+ return _screenWidth;
}
-byte OSystem_PALMOS::RGBToColor(uint8 r, uint8 g, uint8 b)
-{
+byte OSystem_PALMOS::RGBToColor(uint8 r, uint8 g, uint8 b) {
NewGuiColor color = 255;
byte nearest = 255;
byte check;
byte r2,g2,b2;
- for (int i=0; i<256; i++)
+ for (int i = 0; i < 256; i++)
{
r2 = _currentPalette[i].r;
g2 = _currentPalette[i].g;
b2 = _currentPalette[i].b;
- check = (ABS(r2 - r) + ABS(g2 - g) + ABS(b2 - b))/3;
+ check = (ABS(r2 - r) + ABS(g2 - g) + ABS(b2 - b)) / 3;
if (check == 0) // perfect match
return i;
- else if (check<nearest) // else save and continue
- {
+ else if (check < nearest) { // else save and continue
color = i;
nearest = check;
}
@@ -1084,9 +990,8 @@
return color;
}
-void OSystem_PALMOS::ColorToRGB(byte color, uint8 &r, uint8 &g, uint8 &b)
-{
+void OSystem_PALMOS::ColorToRGB(byte color, uint8 &r, uint8 &g, uint8 &b) {
r = _currentPalette[color].r;
g = _currentPalette[color].g;
b = _currentPalette[color].b;
-}
\ No newline at end of file
+}
Index: palm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palm.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- palm.h 2 May 2003 15:30:06 -0000 1.3
+++ palm.h 6 May 2003 14:33:57 -0000 1.3.2.1
@@ -24,30 +24,7 @@
#define PALM_H
#include <SonyClie.h>
-#include "SonySndLib.h"
-#include "vibrate.h"
-#include "globals.h"
#include "system.h"
-/*
-typedef struct {
-
- UInt16 HRrefNum;
- UInt16 volRefNum;
- FileRef logFile;
-
- Boolean screenLocked;
- Boolean vibrator;
-
-} GlobalsDataType;
-*/
-//extern UInt16 gHRrefNum;
-//extern Boolean gVibrator;
-//extern Boolean gFlipping;
-//extern Boolean gScreenLocked;
-//extern GlobalsDataType *gVars;
-
-//Err CheckHRmode();
-
Err HwrDisplayPalette(UInt8 operation, Int16 startIndex,
UInt16 paletteEntries, RGBColorType *tableP)
@@ -157,53 +134,37 @@
static OSystem *create(UInt16 gfx_mode);
UInt8 _sndHandle;
- Boolean _isPlaying;
+ Boolean _isSndPlaying;
protected:
bool _overlay_visible;
private:
- struct {
- Int16 state;
- Int16 position;
- UInt32 time;
- UInt32 wait;
- UInt8 color;
- Char text[100];
- } _msg;
-
- void addMessage(const Char *msg);
- void drawMessage();
- void deleteMessage();
-
typedef void (OSystem_PALMOS::*RendererProc)(void);
RendererProc _renderer_proc;
- UInt8 *_sndData;
+ UInt8 *_sndDataP, *_sndTempP;
void update_screen__flipping();
void update_screen__dbuffer();
void update_screen__direct();
- WinHandle h_palm_screen;
- WinHandle h_palm_offscreen;
-// WinHandle h_palm_tmpscreen;
- MemHandle tmpScreenHandle;
+ WinHandle _screenH;
+ WinHandle _offScreenH;
- byte *palm_screen;
- byte *palm_offscreen;
-// byte *palm_tmpscreen;
- byte *tmpScreen;
+ byte *_screenP;
+ byte *_offScreenP;
+ byte *_tmpScreenP;
- bool _mouse_visible;
- bool _mouse_drawn;
+ bool _mouseVisible;
+ bool _mouseDrawn;
enum {
- MAX_MOUSE_W = 40,
+ MAX_MOUSE_W = 40, // must be 80x80 with 640x480 games
MAX_MOUSE_H = 40
};
- int SCREEN_WIDTH, SCREEN_HEIGHT;
+ int _screenWidth, _screenHeight;
bool _overlaySaved;
struct MousePos {
@@ -211,12 +172,12 @@
};
UInt16 _mode;
- byte *_mouse_data;
- byte *_mouse_backup;
- MousePos _mouse_cur_state;
- MousePos _mouse_old_state;
- int16 _mouse_hotspot_x;
- int16 _mouse_hotspot_y;
+ byte *_mouseDataP;
+ byte *_mouseBackupP;
+ MousePos _mouseCurState;
+ MousePos _mouseOldState;
+ int16 _mouseHotspotX;
+ int16 _mouseHotspotY;
int _current_shake_pos;
int _new_shake_pos;
@@ -271,13 +232,8 @@
eventsEnum lastEvent;
- // sound support
- SndPcmFormatType _snd_format;
- SndPcmOptionsType _snd_options;
-
-
OSystem_PALMOS();
};
-#endif
\ No newline at end of file
+#endif
Index: palmsave.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palmsave.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- palmsave.cpp 30 Apr 2003 21:05:01 -0000 1.2
+++ palmsave.cpp 6 May 2003 14:33:57 -0000 1.2.2.1
@@ -22,14 +22,11 @@
#include <ctype.h>
#include "common/scummsys.h"
-//#include "common/stdafx.h"
#include "common/engine.h"
#include "scumm/saveload.h"
#include "palm.h"
-//#include "gui/newgui.h"
-//#include "gui/message.h"
-#define MAX_BLOCK 64000
+#define MAX_BLOCK 64000 // store in memory, before dump to file
// SaveFile class
@@ -77,7 +74,7 @@
int PalmSaveFile::fwrite(void *buf, int size, int cnt) {
UInt32 fullsize = size*cnt;
- if (fullsize<=MAX_BLOCK)
+ if (fullsize <= MAX_BLOCK)
{
if (!_readWriteData)
_readWriteData = (byte *)malloc(MAX_BLOCK);
@@ -103,24 +100,6 @@
class PalmSaveFileManager : public SaveFileManager {
public:
-/* SaveFile *open_savefile(const char *filename,
- bool saveOrLoad)
- {
- PalmSaveFile *sf = new PalmSaveFile(filename,
- (saveOrLoad? "wb":"rb"));
- if(!sf->is_open()) {
- delete sf;
- sf = NULL;
- }
- return sf;
- }
-
- void list_savefiles(const char *prefix,
- bool *marks, int num)
- {
- memset(marks, true, num*sizeof(bool));
- }
-*/
SaveFile *open_savefile(const char *filename, bool saveOrLoad);
void list_savefiles(const char *prefix, bool *marks, int num);
};
Index: palmstart.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palmstart.cpp,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- palmstart.cpp 5 May 2003 12:22:44 -0000 1.4
+++ palmstart.cpp 6 May 2003 14:33:57 -0000 1.4.2.1
@@ -21,15 +21,19 @@
*/
#include <PalmOS.h>
+#include <PalmOSGlue.h>
#include <SonyClie.h>
+
#include "StarterRsc.h"
-#include "extras.h"
#include "skin.h"
#include "globals.h"
#include "pa1lib.h"
#include "scumm_globals.h"
#include "extend.h" // for disable state
+#include "mathlib.h"
+#include "vibrate.h"
+
void MemExtInit();
void MemExtCleanup();
/***********************************************************************
@@ -136,7 +140,6 @@
* Internal Constants
*
***********************************************************************/
-#define appFileCreator 'ScVM' // register your own at http://www.palmos.com/dev/creatorid/
#define appVersionNum 0x01
#define appPrefID 0x00
#define appPrefVersionNum 0x01
--- extras.cpp DELETED ---
--- extras.h DELETED ---
More information about the Scummvm-git-logs
mailing list