aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS
diff options
context:
space:
mode:
authorChris Apers2004-12-20 17:38:31 +0000
committerChris Apers2004-12-20 17:38:31 +0000
commit7a4f4889a907cdc3adba60b38e03a148c075e92f (patch)
tree4a8c4d3792162380791f96b8186f85c5a5485108 /backends/PalmOS
parent374c427c61b258cf85fbbc2ad76674c62ce2ce4e (diff)
downloadscummvm-rg350-7a4f4889a907cdc3adba60b38e03a148c075e92f.tar.gz
scummvm-rg350-7a4f4889a907cdc3adba60b38e03a148c075e92f.tar.bz2
scummvm-rg350-7a4f4889a907cdc3adba60b38e03a148c075e92f.zip
- Better ARM support
svn-id: r16174
Diffstat (limited to 'backends/PalmOS')
-rw-r--r--backends/PalmOS/Src/arm/PNOMain.cpp65
-rw-r--r--backends/PalmOS/Src/arm/blit.cpp6
-rw-r--r--backends/PalmOS/Src/arm/blit.h11
-rw-r--r--backends/PalmOS/Src/arm/copyrectangle.cpp4
-rw-r--r--backends/PalmOS/Src/arm/copyrectangle.h11
-rwxr-xr-xbackends/PalmOS/Src/arm/decompressrle0.cpp27
-rwxr-xr-xbackends/PalmOS/Src/arm/decompressrle7.cpp27
-rwxr-xr-xbackends/PalmOS/Src/arm/decompresstony.cpp31
-rwxr-xr-xbackends/PalmOS/Src/arm/drawsprite.cpp26
-rw-r--r--backends/PalmOS/Src/arm/drawstrip.cpp6
-rw-r--r--backends/PalmOS/Src/arm/drawstrip.h10
-rwxr-xr-xbackends/PalmOS/Src/arm/fastshrink.cpp54
-rw-r--r--backends/PalmOS/Src/arm/native.h118
-rwxr-xr-xbackends/PalmOS/Src/arm/pno_common.h11
-rwxr-xr-xbackends/PalmOS/Src/arm/pno_queen.h8
-rwxr-xr-xbackends/PalmOS/Src/arm/pno_scumm.h9
-rwxr-xr-xbackends/PalmOS/Src/arm/pno_sword1.h14
-rwxr-xr-xbackends/PalmOS/Src/arm/pnodefs.h26
-rw-r--r--backends/PalmOS/Src/arm/proc3.cpp14
-rw-r--r--backends/PalmOS/Src/arm/proc3.h10
-rwxr-xr-xbackends/PalmOS/Src/arm/renderparallax.cpp76
-rwxr-xr-xbackends/PalmOS/Src/arm/screendraw.cpp24
-rw-r--r--backends/PalmOS/Src/arm/widelandscape.cpp4
-rw-r--r--backends/PalmOS/Src/arm/widelandscape.h11
-rw-r--r--backends/PalmOS/Src/arm/wideportrait.cpp4
-rw-r--r--backends/PalmOS/Src/arm/wideportrait.h11
-rw-r--r--backends/PalmOS/Src/globals.h15
-rw-r--r--backends/PalmOS/Src/init_arm.cpp21
28 files changed, 501 insertions, 153 deletions
diff --git a/backends/PalmOS/Src/arm/PNOMain.cpp b/backends/PalmOS/Src/arm/PNOMain.cpp
index 1c1b2c051b..87175335ab 100644
--- a/backends/PalmOS/Src/arm/PNOMain.cpp
+++ b/backends/PalmOS/Src/arm/PNOMain.cpp
@@ -15,37 +15,46 @@ unsigned long PNO_Main(
Call68KFuncType *call68KFuncP);
unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) {
- unsigned long retVal = 0;
+ PnoProc *func[] = {
+#if defined(COMPILE_COMMON)
+ OSystem_CopyRectToScreen,
+ OSystem_updateScreen_widePortrait,
+ OSystem_updateScreen_wideLandscape,
+// MemoryStream_ReadBuffer
+
+#elif defined(COMPILE_QUEEN)
+ Display_blit
+
+#elif defined(COMPILE_SCUMM)
+ Gdi_drawStripToScreen,
+ CostumeRenderer_proc3
+
+#elif defined(COMPILE_SWORD1)
+ Screen_draw,
+ Screen_drawSprite,
+ Screen_fastShrink,
+ Screen_renderParallax,
+ Screen_decompressTony,
+ Screen_decompressRLE7,
+ Screen_decompressRLE0
+
+#endif
+ };
-#ifdef COMPILE_PACE
// needed before making any OS calls using the
// PACEInterface library
InitPACEInterface(emulStateP, call68KFuncP);
-#endif
-#ifdef COMPILE_WIDELANDSCAPE
- OSystem_updateScreen_wideLandscape(userData68KP);
-#endif
-
-#ifdef COMPILE_WIDEPORTRAIT
- OSystem_updateScreen_widePortrait(userData68KP);
-#endif
-
-#ifdef COMPILE_COPYRECT
- OSystem_CopyRectToScreen(userData68KP);
-#endif
-
-#ifdef COMPILE_COSTUMEPROC3
- retVal = CostumeRenderer_proc3(userData68KP);
-#endif
-
-#ifdef COMPILE_DRAWSTRIP
- Gdi_drawStripToScreen(userData68KP);
-#endif
-
-#ifdef COMPILE_BLIT
- Display_blit(userData68KP);
-#endif
-
- return ByteSwap32(retVal);
+ unsigned long retVal = 0;
+ PnoType *pno = (PnoType *)ByteSwap32(userData68KP);
+ UInt32 funcID = ReadUnaligned32(&pno->funcID);
+ void *dataP = (void *)ReadUnaligned32(&pno->dataP);
+/*
+char buf[100];
+StrIToA(buf,funcID);
+WinDrawChars(buf,StrLen(buf),30,0);
+*/
+ retVal = func[funcID](dataP);
+
+ return (retVal);
}
diff --git a/backends/PalmOS/Src/arm/blit.cpp b/backends/PalmOS/Src/arm/blit.cpp
index cbbb7416c0..674b4dd365 100644
--- a/backends/PalmOS/Src/arm/blit.cpp
+++ b/backends/PalmOS/Src/arm/blit.cpp
@@ -6,7 +6,7 @@
#define memcpy MemMove
-void Display_blit(void *userData68KP) {
+UInt32 Display_blit(void *userData68KP) {
// import variables
SETPTR (uint8 *, dstBuf )
SETPTR (const uint8 *, srcBuf )
@@ -47,4 +47,6 @@ void Display_blit(void *userData68KP) {
dstBuf += dstPitch;
}
}
-} \ No newline at end of file
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/blit.h b/backends/PalmOS/Src/arm/blit.h
deleted file mode 100644
index 2e8ece77fe..0000000000
--- a/backends/PalmOS/Src/arm/blit.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __BLIT_H__
-#define __BLIT_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_BLIT
-#define COMPILE_PACE
-
-void Display_blit(void *userData68KP);
-
-#endif \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/copyrectangle.cpp b/backends/PalmOS/Src/arm/copyrectangle.cpp
index 24088791b4..ede630c976 100644
--- a/backends/PalmOS/Src/arm/copyrectangle.cpp
+++ b/backends/PalmOS/Src/arm/copyrectangle.cpp
@@ -4,7 +4,7 @@
#define MAIN_TYPE CopyRectangleType
#include "macros.h"
-void OSystem_CopyRectToScreen(void *userData68KP) {
+UInt32 OSystem_CopyRectToScreen(void *userData68KP) {
// import variables
SETPTR (UInt8 *, dst )
SETPTR (UInt8 *, buf )
@@ -23,4 +23,6 @@ void OSystem_CopyRectToScreen(void *userData68KP) {
buf += pitch;
} while (--h);
}
+
+ return 0;
}
diff --git a/backends/PalmOS/Src/arm/copyrectangle.h b/backends/PalmOS/Src/arm/copyrectangle.h
deleted file mode 100644
index 45a5e70a52..0000000000
--- a/backends/PalmOS/Src/arm/copyrectangle.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __WIDE_LS_H__
-#define __WIDE_LS_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_COPYRECT
-#define COMPILE_PACE
-
-void OSystem_CopyRectToScreen(void *userData68KP);
-
-#endif
diff --git a/backends/PalmOS/Src/arm/decompressrle0.cpp b/backends/PalmOS/Src/arm/decompressrle0.cpp
new file mode 100755
index 0000000000..d6ac2d6c80
--- /dev/null
+++ b/backends/PalmOS/Src/arm/decompressrle0.cpp
@@ -0,0 +1,27 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE CompressType
+#include "macros.h"
+
+UInt32 Screen_decompressRLE0(void *userData68KP) {
+// import variables
+ SETPTR (uint8 * ,src );
+ SET32 (uint32 ,compSize);
+ SETPTR (uint8 * ,dest );
+// end of import
+
+ uint8 *srcBufEnd = src + compSize;
+ while (src < srcBufEnd) {
+ uint8 color = *src++;
+ if (color) {
+ *dest++ = color;
+ } else {
+ uint8 skip = *src++;
+ MemSet(dest, skip, 0);
+ dest += skip;
+ }
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/decompressrle7.cpp b/backends/PalmOS/Src/arm/decompressrle7.cpp
new file mode 100755
index 0000000000..49976d6a95
--- /dev/null
+++ b/backends/PalmOS/Src/arm/decompressrle7.cpp
@@ -0,0 +1,27 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE CompressType
+#include "macros.h"
+
+UInt32 Screen_decompressRLE7(void *userData68KP) {
+// import variables
+ SETPTR (UInt8 * ,src );
+ SET32 (UInt32, compSize);
+ SETPTR (UInt8 * ,dest );
+// end of import
+
+ uint8 *compBufEnd = src + compSize;
+ while (src < compBufEnd) {
+ uint8 code = *src++;
+ if ((code > 127) || (code == 0))
+ *dest++ = code;
+ else {
+ code++;
+ MemSet(dest, code, *src++);
+ dest += code;
+ }
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/decompresstony.cpp b/backends/PalmOS/Src/arm/decompresstony.cpp
new file mode 100755
index 0000000000..7b602816ac
--- /dev/null
+++ b/backends/PalmOS/Src/arm/decompresstony.cpp
@@ -0,0 +1,31 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE CompressType
+#include "macros.h"
+
+UInt32 Screen_decompressTony(void *userData68KP) {
+// import variables
+ SETPTR (UInt8 * ,src );
+ SET32 (UInt32, compSize);
+ SETPTR (UInt8 * ,dest );
+// end of import
+
+ uint8 *endOfData = src + compSize;
+ while (src < endOfData) {
+ uint8 numFlat = *src++;
+ if (numFlat) {
+ MemSet(dest, numFlat, *src);
+ src++;
+ dest += numFlat;
+ }
+ if (src < endOfData) {
+ uint8 numNoFlat = *src++;
+ MemMove(dest, src, numNoFlat);
+ src += numNoFlat;
+ dest += numNoFlat;
+ }
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/drawsprite.cpp b/backends/PalmOS/Src/arm/drawsprite.cpp
new file mode 100755
index 0000000000..3c368c17ef
--- /dev/null
+++ b/backends/PalmOS/Src/arm/drawsprite.cpp
@@ -0,0 +1,26 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE DrawSpriteType
+#include "macros.h"
+
+UInt32 Screen_drawSprite(void *userData68KP) {
+// import variables
+ SETPTR (UInt8 * ,sprData );
+ SET16 (UInt16, sprHeight );
+ SET16 (UInt16, sprWidth );
+ SET16 (UInt16, sprPitch );
+ SETPTR (UInt8 * ,dest );
+ SET16 (UInt16, _scrnSizeX );
+// end of import
+
+ for (uint16 cnty = 0; cnty < sprHeight; cnty++) {
+ for (uint16 cntx = 0; cntx < sprWidth; cntx++)
+ if (sprData[cntx])
+ dest[cntx] = sprData[cntx];
+ sprData += sprPitch;
+ dest += _scrnSizeX;
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/drawstrip.cpp b/backends/PalmOS/Src/arm/drawstrip.cpp
index f2f07a8f24..6d8d178fb8 100644
--- a/backends/PalmOS/Src/arm/drawstrip.cpp
+++ b/backends/PalmOS/Src/arm/drawstrip.cpp
@@ -6,7 +6,7 @@
#define CHARSET_MASK_TRANSPARENCY 253
-void Gdi_drawStripToScreen(void *userData68KP) {
+UInt32 Gdi_drawStripToScreen(void *userData68KP) {
// import variables
SET32 (int ,width )
SET32 (int ,height )
@@ -30,4 +30,6 @@ void Gdi_drawStripToScreen(void *userData68KP) {
dst += _vm_screenWidth;
text += _textSurface_pitch;
}
-} \ No newline at end of file
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/drawstrip.h b/backends/PalmOS/Src/arm/drawstrip.h
deleted file mode 100644
index a9f412ca1c..0000000000
--- a/backends/PalmOS/Src/arm/drawstrip.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _OP_COSTUME2_H__
-#define _OP_COSTUME2_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_DRAWSTRIP
-
-void Gdi_drawStripToScreen(void *userData68KP);
-
-#endif \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/fastshrink.cpp b/backends/PalmOS/Src/arm/fastshrink.cpp
new file mode 100755
index 0000000000..b46843e793
--- /dev/null
+++ b/backends/PalmOS/Src/arm/fastshrink.cpp
@@ -0,0 +1,54 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE FastShrinkType
+#include "macros.h"
+
+UInt32 Screen_fastShrink(void *userData68KP) {
+// import variables
+ SETPTR (UInt8 * ,src );
+ SET32 (UInt32, width );
+ SET32 (UInt32, height );
+ SET32 (uint32, scale );
+ SETPTR (UInt8 * ,dest );
+// end of import
+
+ uint32 resHeight = (height * scale) >> 8;
+ uint32 resWidth = (width * scale) >> 8;
+ uint32 step = 0x10000 / scale;
+ uint8 columnTab[160];
+ uint32 res = step >> 1;
+ for (uint16 cnt = 0; cnt < resWidth; cnt++) {
+ columnTab[cnt] = (uint8)(res >> 8);
+ res += step;
+ }
+
+ uint32 newRow = step >> 1;
+ uint32 oldRow = 0;
+
+ uint8 *destPos = dest;
+ uint16 lnCnt;
+ for (lnCnt = 0; lnCnt < resHeight; lnCnt++) {
+ while (oldRow < (newRow >> 8)) {
+ oldRow++;
+ src += width;
+ }
+ for (uint16 colCnt = 0; colCnt < resWidth; colCnt++) {
+ *destPos++ = src[columnTab[colCnt]];
+ }
+ newRow += step;
+ }
+ // scaled, now stipple shadows if there are any
+ for (lnCnt = 0; lnCnt < resHeight; lnCnt++) {
+ uint16 xCnt = lnCnt & 1;
+ destPos = dest + lnCnt * resWidth + (lnCnt & 1);
+ while (xCnt < resWidth) {
+ if (*destPos == 200)
+ *destPos = 0;
+ destPos += 2;
+ xCnt += 2;
+ }
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/native.h b/backends/PalmOS/Src/arm/native.h
index a1132d2093..bbbc4ab0ea 100644
--- a/backends/PalmOS/Src/arm/native.h
+++ b/backends/PalmOS/Src/arm/native.h
@@ -1,38 +1,51 @@
#ifndef _ARMNATIVE_H_
#define _ARMNATIVE_H_
-#include "PNOLoader.h"
-
-//#define DISABLE_ARM
-//#define DEBUG_ARM
+#include "arm/pnodefs.h"
#ifndef __PALM_OS__
typedef UInt8 byte;
typedef UInt8 uint8;
typedef Int32 int32;
+typedef UInt32 uint32;
+typedef Int16 int16;
typedef UInt16 uint16;
typedef unsigned int uint;
#endif
-// rsrc
+typedef struct {
+ UInt32 funcID;
+ void *dataP;
+} PnoType;
+
+typedef UInt32 (PnoProc)(void *);
+
+enum {
+ COMMON_COPYRECT = 0,
+ COMMON_WPORTRAIT,
+ COMMON_WLANDSCAPE,
+// COMMON_SNDBUFFER
+};
+
+enum {
+ QUEEN_BLIT = 0
+};
+
enum {
- RSC_WIDELANDSCAPE = 1,
- RSC_WIDEPORTRAIT,
- RSC_COPYRECT,
- RSC_COSTUMEPROC3,
- RSC_DRAWSTRIP,
- RSC_BLIT
+ SCUMM_DRAWSTRIP = 0,
+ SCUMM_PROC3
};
enum {
- PNO_COPYRECT = 0,
- PNO_WIDE,
- PNO_COSTUMEPROC3,
- PNO_DRAWSTRIP,
- PNO_BLIT,
- PNO_COUNT
+ SWORD1_SCREENDRAW = 0,
+ SWORD1_DRAWSPRITE,
+ SWORD1_FASTSHRINK,
+ SWORD1_RENDERPARALLAX,
+ SWORD1_DECOMPTONY,
+ SWORD1_DECOMPRLE7,
+ SWORD1_DECOMPRLE0
};
// types
@@ -43,20 +56,6 @@ typedef struct {
} ARMPa1SndType, *ARMPa1SndPtr;
typedef struct {
- void *proc;
- void *param;
-
- void *handle; // sound handle
- UInt32 size; // buffer size
- UInt32 slot;
- UInt32 active, // is the sound handler active
- set, // is the buffer filled
- wait; // do we need to wait for sound completion
- void *dataP, // main buffer
- *tmpP; // tmp buffer (convertion)
-} SoundDataType;
-
-typedef struct {
void *dst;
void *src;
} WideType;
@@ -142,4 +141,61 @@ typedef struct {
byte masked;
} BlitType;
+// Sword1
+typedef struct {
+ uint8 *data;
+ uint32 *lineIndexes;
+ uint8 *_screenBuf;
+ uint16 _scrnSizeX;
+ uint16 scrnScrlX;
+ uint16 scrnScrlY;
+ uint16 paraScrlX;
+ uint16 paraScrlY;
+ uint16 scrnWidth;
+ uint16 scrnHeight;
+} ParallaxType;
+
+typedef struct {
+ uint8 *sprData;
+ uint8 *dest;
+ uint16 sprHeight;
+ uint16 sprWidth;
+ uint16 sprPitch;
+ uint16 _scrnSizeX;
+} DrawSpriteType;
+
+typedef struct {
+ uint8 *src;
+ uint8 *dest;
+ uint16 _scrnSizeX;
+ uint16 _scrnSizeY;
+} DrawType;
+
+typedef struct {
+ uint8 *src;
+ uint8 *dest;
+ uint32 width;
+ uint32 height;
+ uint32 scale;
+} FastShrinkType;
+
+typedef struct {
+ uint8 *src;
+ uint32 compSize;
+ uint8 *dest;
+} CompressType;
+
+typedef struct {
+ int32 samples;
+ int32 len;
+ int16 *buffer;
+ const byte *_ptr;
+ int32 is16Bit;
+ int32 isUnsigned;
+ int32 isLE;
+} ReadBufferType;
+
+// Warning : all the struct MUST be 4byte align and even
+// from one member to another
+
#endif
diff --git a/backends/PalmOS/Src/arm/pno_common.h b/backends/PalmOS/Src/arm/pno_common.h
new file mode 100755
index 0000000000..1bc98694ba
--- /dev/null
+++ b/backends/PalmOS/Src/arm/pno_common.h
@@ -0,0 +1,11 @@
+#ifndef PNOCOMMON_H
+#define PNOCOMMON_H
+
+#define COMPILE_COMMON
+
+unsigned long OSystem_CopyRectToScreen(void *userData68KP);
+unsigned long MemoryStream_ReadBuffer(void *userData68KP);
+unsigned long OSystem_updateScreen_widePortrait(void *userData68KP);
+unsigned long OSystem_updateScreen_wideLandscape(void *userData68KP);
+
+#endif
diff --git a/backends/PalmOS/Src/arm/pno_queen.h b/backends/PalmOS/Src/arm/pno_queen.h
new file mode 100755
index 0000000000..243e730fd7
--- /dev/null
+++ b/backends/PalmOS/Src/arm/pno_queen.h
@@ -0,0 +1,8 @@
+#ifndef PNOQUEEN_H
+#define PNOQUEEN_H
+
+#define COMPILE_QUEEN
+
+unsigned long Display_blit(void *userData68KP);
+
+#endif
diff --git a/backends/PalmOS/Src/arm/pno_scumm.h b/backends/PalmOS/Src/arm/pno_scumm.h
new file mode 100755
index 0000000000..c195ce28a8
--- /dev/null
+++ b/backends/PalmOS/Src/arm/pno_scumm.h
@@ -0,0 +1,9 @@
+#ifndef PNOSCUMM_H
+#define PNOSCUMM_H
+
+#define COMPILE_SCUMM
+
+unsigned long Gdi_drawStripToScreen(void *userData68KP);
+unsigned long CostumeRenderer_proc3(void *userData68KP);
+
+#endif
diff --git a/backends/PalmOS/Src/arm/pno_sword1.h b/backends/PalmOS/Src/arm/pno_sword1.h
new file mode 100755
index 0000000000..9c9775c57a
--- /dev/null
+++ b/backends/PalmOS/Src/arm/pno_sword1.h
@@ -0,0 +1,14 @@
+#ifndef PNOSWORD1_H
+#define PNOSWORD1_H
+
+#define COMPILE_SWORD1
+
+unsigned long Screen_decompressRLE0(void *userData68KP);
+unsigned long Screen_decompressRLE7(void *userData68KP);
+unsigned long Screen_decompressTony(void *userData68KP);
+unsigned long Screen_drawSprite(void *userData68KP);
+unsigned long Screen_fastShrink(void *userData68KP);
+unsigned long Screen_renderParallax(void *userData68KP);
+unsigned long Screen_draw(void *userData68KP);
+
+#endif
diff --git a/backends/PalmOS/Src/arm/pnodefs.h b/backends/PalmOS/Src/arm/pnodefs.h
new file mode 100755
index 0000000000..3fda3c3635
--- /dev/null
+++ b/backends/PalmOS/Src/arm/pnodefs.h
@@ -0,0 +1,26 @@
+#ifndef PNODEFS_H
+#define PNODEFS_H
+
+#include "PNOLoader.h"
+
+// Defined in PnoLoader, used to preinit PnoCall
+typedef struct PnoEntryHeader {
+ UInt32 r10Value;
+ UInt32 pnoMainAddress;
+ UInt32 userDataP;
+} PnoEntryHeader;
+
+#define ALIGN_4BYTE(addr) (((UInt32)(addr) + 3) & 0xFFFFFFFC)
+
+enum {
+ ARM_COMMON = 0,
+ ARM_ENGINE,
+ ARM_COUNT
+};
+
+enum {
+ RSC_ARMCOMMON = 100,
+ RSC_ARMENGINE = 101
+};
+
+#endif
diff --git a/backends/PalmOS/Src/arm/proc3.cpp b/backends/PalmOS/Src/arm/proc3.cpp
index 650d05ab37..c56776492d 100644
--- a/backends/PalmOS/Src/arm/proc3.cpp
+++ b/backends/PalmOS/Src/arm/proc3.cpp
@@ -95,8 +95,8 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
}
if (!--height) {
if (!--v1.skip_width)
- return _scaleIndexX;
- //goto end_jump;
+ //return _scaleIndexX;
+ goto end_jump;
height = _height;
y = v1.y;
@@ -106,8 +106,8 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
v1.x += v1.scaleXstep;
if (v1.x < 0 || v1.x >= _out_w)
- return _scaleIndexX;
- //goto end_jump;
+ //return _scaleIndexX;
+ goto end_jump;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
}
@@ -119,9 +119,9 @@ UInt32 CostumeRenderer_proc3(void *userData68KP) {
} while (--len);
} while (1);
-//end_jump:
+end_jump:
// v1comp->x = ByteSwap32(v1.x);
// v1comp->destptr = (byte *)ByteSwap32(v1.destptr);
-// return _scaleIndexX;
-} \ No newline at end of file
+ return _scaleIndexX;
+}
diff --git a/backends/PalmOS/Src/arm/proc3.h b/backends/PalmOS/Src/arm/proc3.h
deleted file mode 100644
index f7dd40b593..0000000000
--- a/backends/PalmOS/Src/arm/proc3.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _OP_COSTUME_H__
-#define _OP_COSTUME_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_COSTUMEPROC3
-
-UInt32 CostumeRenderer_proc3(void *userData68KP);
-
-#endif \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/renderparallax.cpp b/backends/PalmOS/Src/arm/renderparallax.cpp
new file mode 100755
index 0000000000..8c710d7c2e
--- /dev/null
+++ b/backends/PalmOS/Src/arm/renderparallax.cpp
@@ -0,0 +1,76 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE ParallaxType
+#include "macros.h"
+
+#define READ_LE_UINT32(ptr) *(const uint32 *)(ptr)
+
+UInt32 Screen_renderParallax(void *userData68KP) {
+// import variables
+ SETPTR (UInt8 * ,data );
+ SETPTR (UInt32 * ,lineIndexes);
+ SETPTR (UInt8 * ,_screenBuf );
+ SET16 (UInt16, _scrnSizeX );
+ SET16 (UInt16, scrnScrlX );
+ SET16 (UInt16, scrnScrlY );
+ SET16 (UInt16, paraScrlX );
+ SET16 (UInt16, paraScrlY );
+ SET16 (UInt16, scrnWidth );
+ SET16 (UInt16, scrnHeight );
+// end of import
+
+ for (uint16 cnty = 0; cnty < scrnHeight; cnty++) {
+ uint8 *src = data + READ_LE_UINT32(lineIndexes + cnty + paraScrlY);
+ uint8 *dest = _screenBuf + scrnScrlX + (cnty + scrnScrlY) * _scrnSizeX;
+ uint16 remain = paraScrlX;
+ uint16 xPos = 0;
+ bool copyFirst = false;
+ while (remain) { // skip past the first part of the parallax to get to the right scrolling position
+ uint8 doSkip = *src++;
+ if (doSkip <= remain)
+ remain -= doSkip;
+ else {
+ xPos = doSkip - remain;
+ dest += xPos;
+ remain = 0;
+ }
+ if (remain) {
+ uint8 doCopy = *src++;
+ if (doCopy <= remain) {
+ remain -= doCopy;
+ src += doCopy;
+ } else {
+ uint16 remCopy = doCopy - remain;
+ MemMove(dest, src + remain, remCopy);
+ dest += remCopy;
+ src += doCopy;
+ xPos = remCopy;
+ remain = 0;
+ }
+ } else
+ copyFirst = true;
+ }
+ while (xPos < scrnWidth) {
+ if (!copyFirst) {
+ if (uint8 skip = *src++) {
+ dest += skip;
+ xPos += skip;
+ }
+ } else
+ copyFirst = false;
+ if (xPos < scrnWidth) {
+ if (uint8 doCopy = *src++) {
+ if (xPos + doCopy > scrnWidth)
+ doCopy = scrnWidth - xPos;
+ MemMove(dest, src, doCopy);
+ dest += doCopy;
+ xPos += doCopy;
+ src += doCopy;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/screendraw.cpp b/backends/PalmOS/Src/arm/screendraw.cpp
new file mode 100755
index 0000000000..75495d3daf
--- /dev/null
+++ b/backends/PalmOS/Src/arm/screendraw.cpp
@@ -0,0 +1,24 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE DrawType
+#include "macros.h"
+
+UInt32 Screen_draw(void *userData68KP) {
+// import variables
+ SET16 (UInt16, _scrnSizeX );
+ SET16 (UInt16, _scrnSizeY );
+ SETPTR (UInt8 * ,src );
+ SETPTR (UInt8 * ,dest );
+// end of import
+
+ for (uint16 cnty = 0; cnty < _scrnSizeY; cnty++)
+ for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) {
+ if (*src)
+ *dest = *src;
+ dest++;
+ src++;
+ }
+
+ return 0;
+}
diff --git a/backends/PalmOS/Src/arm/widelandscape.cpp b/backends/PalmOS/Src/arm/widelandscape.cpp
index 38c4e5777e..c1b47d2cc9 100644
--- a/backends/PalmOS/Src/arm/widelandscape.cpp
+++ b/backends/PalmOS/Src/arm/widelandscape.cpp
@@ -5,7 +5,7 @@
#define MAIN_TYPE WideType
#include "macros.h"
-void OSystem_updateScreen_wideLandscape(void *userData68KP) {
+UInt32 OSystem_updateScreen_wideLandscape(void *userData68KP) {
// import variables
SETPTR(UInt8 * ,dst)
SETPTR(UInt8 * ,src)
@@ -24,5 +24,7 @@ void OSystem_updateScreen_wideLandscape(void *userData68KP) {
MemMove(dst, dst - 480, 480);
dst += 480;
}
+
+ return 0;
}
diff --git a/backends/PalmOS/Src/arm/widelandscape.h b/backends/PalmOS/Src/arm/widelandscape.h
deleted file mode 100644
index eebddd9e0d..0000000000
--- a/backends/PalmOS/Src/arm/widelandscape.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __WIDE_LS_H__
-#define __WIDE_LS_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_WIDELANDSCAPE
-#define COMPILE_PACE
-
-void OSystem_updateScreen_wideLandscape(void *userData68KP);
-
-#endif
diff --git a/backends/PalmOS/Src/arm/wideportrait.cpp b/backends/PalmOS/Src/arm/wideportrait.cpp
index 44ad083f28..7ee0af034a 100644
--- a/backends/PalmOS/Src/arm/wideportrait.cpp
+++ b/backends/PalmOS/Src/arm/wideportrait.cpp
@@ -5,7 +5,7 @@
#define MAIN_TYPE WideType
#include "macros.h"
-void OSystem_updateScreen_widePortrait(void *userData68KP) {
+UInt32 OSystem_updateScreen_widePortrait(void *userData68KP) {
// import variables
SETPTR(UInt8 * ,dst)
SETPTR(UInt8 * ,src)
@@ -38,4 +38,6 @@ void OSystem_updateScreen_widePortrait(void *userData68KP) {
MemMove(dst, dst - WIDE_PITCH, 300); // 300 = 200 x 1.5
dst += WIDE_PITCH;
}
+
+ return 0;
}
diff --git a/backends/PalmOS/Src/arm/wideportrait.h b/backends/PalmOS/Src/arm/wideportrait.h
deleted file mode 100644
index c9f756368f..0000000000
--- a/backends/PalmOS/Src/arm/wideportrait.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __WIDE_PT_H__
-#define __WIDE_PT_H__
-
-#include <PalmOS.h>
-
-#define COMPILE_WIDEPORTRAIT
-#define COMPILE_PACE
-
-void OSystem_updateScreen_widePortrait(void *userData68KP);
-
-#endif
diff --git a/backends/PalmOS/Src/globals.h b/backends/PalmOS/Src/globals.h
index c2e0148b31..a991a9b972 100644
--- a/backends/PalmOS/Src/globals.h
+++ b/backends/PalmOS/Src/globals.h
@@ -25,7 +25,7 @@
#include <VFSMgr.h>
#include "scumm_globals.h"
-#include "arm/native.h"
+#include "arm/pnodefs.h"
enum {
kOptNone = 0,
@@ -63,6 +63,12 @@ enum {
};
typedef struct {
+ char headerBuffer[sizeof(PnoEntryHeader) + 2];
+ PnoEntryHeader *alignedHeader;
+ PnoDescriptor pnoDesc;
+} PNOInitType;
+
+typedef struct {
DmOpenRef globals[GBVARS_COUNT];
UInt32 memory[kMemGamesCount];
@@ -73,8 +79,6 @@ typedef struct {
UInt16 volRefNum;
UInt16 slkRefNum;
UInt32 slkVersion;
- Boolean skinSet;
- Boolean pinUpdate;
FileRef logFile;
@@ -86,10 +90,7 @@ typedef struct {
Coord screenFullWidth, screenFullHeight; // silkarea hidden
UInt32 screenPitch;
- struct {
- PnoDescriptor pnoDesc;
- MemPtr pnoPtr;
- } arm[PNO_COUNT];
+ PNOInitType arm[ARM_COUNT];
struct {
UInt8 on;
diff --git a/backends/PalmOS/Src/init_arm.cpp b/backends/PalmOS/Src/init_arm.cpp
index 77aea25cee..1770a489da 100644
--- a/backends/PalmOS/Src/init_arm.cpp
+++ b/backends/PalmOS/Src/init_arm.cpp
@@ -5,17 +5,20 @@
static void PnoInit(DmResID resID,PNOInitType *pnoP) {
// Load and allocate PNO
MemHandle armH = DmGetResource('ARMC', resID);
- MemPtr armP = MemHandleLock(armH);
- PnoLoad(&pnoP->pnoDesc, armP);
- MemPtrUnlock(armP);
- DmReleaseResource(armH);
- // Init PNO
- PnoEntryHeader *header = (PnoEntryHeader *)ALIGN_4BYTE(pnoP->headerBuffer);
- pnoP->alignedHeader = header;
+ if (armH) {
+ MemPtr armP = MemHandleLock(armH);
+ PnoLoad(&pnoP->pnoDesc, armP);
+ MemPtrUnlock(armP);
+ DmReleaseResource(armH);
+
+ // Init PNO
+ PnoEntryHeader *header = (PnoEntryHeader *)ALIGN_4BYTE(pnoP->headerBuffer);
+ pnoP->alignedHeader = header;
- header->r10Value = pnoP->pnoDesc.r10Value;
- header->pnoMainAddress = pnoP->pnoDesc.pnoMainAddress;
+ header->r10Value = pnoP->pnoDesc.r10Value;
+ header->pnoMainAddress = pnoP->pnoDesc.pnoMainAddress;
+ }
}
void ARMInit() {