aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorChris Apers2006-02-12 18:58:54 +0000
committerChris Apers2006-02-12 18:58:54 +0000
commit5e4a4f779d37aed83adcd768aae04064217f6ae7 (patch)
tree48cae7f62fe595c372bfead8aa5cbb92d4316701 /backends
parent3dc99262a2460ab2c6d24e476673a2489c24b982 (diff)
downloadscummvm-rg350-5e4a4f779d37aed83adcd768aae04064217f6ae7.tar.gz
scummvm-rg350-5e4a4f779d37aed83adcd768aae04064217f6ae7.tar.bz2
scummvm-rg350-5e4a4f779d37aed83adcd768aae04064217f6ae7.zip
- Removed unused StrReplace function
- DrawStatus now support 8 and 16bit display - Coordinate system is now used correctly (set only when needed), no more need to reset it in PalmFatalError - Added new/delete operators for ARM OS5 mode svn-id: r20638
Diffstat (limited to 'backends')
-rw-r--r--backends/PalmOS/Src/extend.cpp101
-rw-r--r--backends/PalmOS/Src/extend.h2
2 files changed, 38 insertions, 65 deletions
diff --git a/backends/PalmOS/Src/extend.cpp b/backends/PalmOS/Src/extend.cpp
index cd45291830..302f414a81 100644
--- a/backends/PalmOS/Src/extend.cpp
+++ b/backends/PalmOS/Src/extend.cpp
@@ -1,6 +1,7 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,81 +22,53 @@
*
*/
-#include <PalmOS.h>
-#include <string.h>
-
-#include "extend.h"
+#include <stdlib.h>
#include "globals.h"
-#include "enginersc.h"
+
+#include "modulesrsc.h"
const Char *SCUMMVM_SAVEPATH = "/PALM/Programs/ScummVM/Saved/";
void PalmFatalError(const Char *err) {
WinSetDrawWindow(WinGetDisplayWindow());
WinPalette(winPaletteSetToDefault,0,0,0);
-
- if (OPTIONS_TST(kOptModeHiDensity))
- WinSetCoordinateSystem(kCoordinatesStandard);
-
+ WinSetBackColor(0);
WinEraseWindow();
FrmCustomAlert(FrmFatalErrorAlert, err, 0,0);
}
-
void DrawStatus(Boolean show) {
if (OPTIONS_TST(kOptDisableOnScrDisp))
return;
- UInt8 x,y;
- UInt8 *screen = (UInt8 *)(BmpGetBits(WinGetBitmap(WinGetDisplayWindow())));
- UInt8 color = (show? gVars->indicator.on : gVars->indicator.off);
-
- screen += gVars->screenPitch + 1;
- for(y=0; y < 4; y++) {
- for(x=0; x < 4; x++)
- screen[x] = color;
-
- screen += gVars->screenPitch;
+ UInt8 x,y;
+ UInt32 depth, d1;
+ Boolean d2;
+ WinScreenMode(winScreenModeGet, &d1, &d1, &depth, &d2);
+ Int16 color = (show ? gVars->indicator.on : gVars->indicator.off);
+
+ if (depth == 8) {
+ UInt8 *src = (UInt8 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow()));
+ src += gVars->screenPitch + 1;
+ for(y=0; y < 4; y++) {
+ for(x=0; x < 4; x++)
+ src[x] = color;
+
+ src += gVars->screenPitch;
+ }
+
+ } else if (depth == 16) {
+ Int16 *src = (Int16 *)BmpGetBits(WinGetBitmap(WinGetDisplayWindow()));
+ src += gVars->screenPitch + 1;
+ for(y=0; y < 4; y++) {
+ for(x=0; x < 4; x++)
+ src[x] = color;
+
+ src += gVars->screenPitch;
+ }
}
}
-UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr) {
- Char *found;
- Boolean quit = false;
- UInt16 occurences = 0;
- UInt16 newLength;
- UInt16 l1 = StrLen(fndParamStr);
- UInt16 l2 = 0;
- UInt16 l3 = StrLen(ioStr);
- UInt16 next = 0;
-
- if (inParamStr)
- l2 = StrLen(inParamStr); // can be null to know how many occur.
-
- while (((found = StrStr(ioStr+next, fndParamStr)) != NULL) && (!quit)) {
- occurences++;
- newLength = (StrLen(ioStr) - l1 + l2);
-
- if ( newLength > inMaxLen ) {
- quit = true;
- occurences--;
-
- } else if (inParamStr) {
- MemMove(found + l2, found + l1, inMaxLen-(found-ioStr+l2));
- MemMove(found, inParamStr, l2);
- next = found - ioStr + l2;
-
- } else
- next = found - ioStr + l1;
- }
-
- if (inParamStr)
- ioStr[l3 + l2*occurences - l1*occurences] = 0;
-
- return occurences;
-}
-
-
#ifndef PALMOS_ARM
// This is now required since some classes are now very big :)
@@ -111,25 +84,25 @@ void *operator new [] (UInt32 size) {
MemSet(ptr, 0, size);
return ptr;
}
-#else
-/*
+#elif defined(COMPILE_OS5)
+
__inline void *operator new(UInt32 size) {
- void *ptr = MemPtrNew(size);
+ void *ptr = malloc(size);
MemSet(ptr, 0, size);
return ptr;
}
__inline void *operator new [] (UInt32 size) {
- void *ptr = MemPtrNew(size);
+ void *ptr = malloc(size);
MemSet(ptr, 0, size);
return ptr;
}
__inline void operator delete(void *ptr) throw() {
- if (ptr) MemPtrFree(ptr);
+ if (ptr) free(ptr);
}
__inline void operator delete[](void *ptr) throw() {
- if (ptr) MemPtrFree(ptr);
-}*/
+ if (ptr) free(ptr);
+}
#endif
diff --git a/backends/PalmOS/Src/extend.h b/backends/PalmOS/Src/extend.h
index eefef788ae..c5c74852a2 100644
--- a/backends/PalmOS/Src/extend.h
+++ b/backends/PalmOS/Src/extend.h
@@ -1,6 +1,7 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -27,7 +28,6 @@
extern const Char *SCUMMVM_SAVEPATH;
int main(int argc, char **argv);
-UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr);
void PalmFatalError(const Char *err);
void DrawStatus(Boolean show);