aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS/Src/arm
diff options
context:
space:
mode:
authorChris Apers2004-09-12 12:42:07 +0000
committerChris Apers2004-09-12 12:42:07 +0000
commitf413780189cc734dccad8fb87106f5ab9c9dd5d7 (patch)
tree50441bf13a5aa948691de2b50f10f9eb7564c94c /backends/PalmOS/Src/arm
parentedc26ee3a7d5d18b2c0bf8750092644123d7fd3d (diff)
downloadscummvm-rg350-f413780189cc734dccad8fb87106f5ab9c9dd5d7.tar.gz
scummvm-rg350-f413780189cc734dccad8fb87106f5ab9c9dd5d7.tar.bz2
scummvm-rg350-f413780189cc734dccad8fb87106f5ab9c9dd5d7.zip
New ARM optimized functions
svn-id: r15040
Diffstat (limited to 'backends/PalmOS/Src/arm')
-rw-r--r--backends/PalmOS/Src/arm/PNOMain.cpp28
-rw-r--r--backends/PalmOS/Src/arm/drawstrip.cpp33
-rw-r--r--backends/PalmOS/Src/arm/drawstrip.h10
-rw-r--r--backends/PalmOS/Src/arm/proc3.cpp126
-rw-r--r--backends/PalmOS/Src/arm/proc3.h10
5 files changed, 191 insertions, 16 deletions
diff --git a/backends/PalmOS/Src/arm/PNOMain.cpp b/backends/PalmOS/Src/arm/PNOMain.cpp
index 54569b2502..c85d694e22 100644
--- a/backends/PalmOS/Src/arm/PNOMain.cpp
+++ b/backends/PalmOS/Src/arm/PNOMain.cpp
@@ -1,5 +1,5 @@
#include "PACEInterfaceLib.h"
-#include "ArmNative.h"
+#include "native.h"
// Linker still looks for ARMlet_Main as entry point, but the
// "ARMlet" name is now officially discouraged. Compare an
@@ -23,29 +23,25 @@ unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncTy
InitPACEInterface(emulStateP, call68KFuncP);
#endif
-#ifdef COMPILE_PA1SND
- ARMPa1SndPtr userData = (ARMPa1SndPtr)userData68KP;
- pcm2adpcm ( (Int16 *)ReadUnaligned32(&(userData->srcP)),
- (UInt8 *)ReadUnaligned32(&(userData->dstP)),
- ReadUnaligned32(&(userData->length))
- );
+#ifdef COMPILE_WIDELANDSCAPE
+ OSystem_updateScreen_wideLandscape(userData68KP);
#endif
-#ifdef COMPILE_STREAMSND
- retVal = (unsigned long)sndCallback;
+#ifdef COMPILE_WIDEPORTRAIT
+ OSystem_updateScreen_widePortrait(userData68KP);
#endif
-#ifdef COMPILE_OWIDELS
- O_WideLandscape(userData68KP);
+#ifdef COMPILE_COPYRECT
+ OSystem_CopyRectToScreen(userData68KP);
#endif
-#ifdef COMPILE_OWIDEPT
- O_WidePortrait(userData68KP);
+#ifdef COMPILE_COSTUMEPROC3
+ retVal = CostumeRenderer_proc3(userData68KP);
#endif
-#ifdef COMPILE_OCOPYRECT
- O_CopyRectToScreen(userData68KP);
+#ifdef COMPILE_DRAWSTRIP
+ Gdi_drawStripToScreen(userData68KP);
#endif
- return retVal;
+ return ByteSwap32(retVal);
}
diff --git a/backends/PalmOS/Src/arm/drawstrip.cpp b/backends/PalmOS/Src/arm/drawstrip.cpp
new file mode 100644
index 0000000000..f2f07a8f24
--- /dev/null
+++ b/backends/PalmOS/Src/arm/drawstrip.cpp
@@ -0,0 +1,33 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE DrawStripType
+#include "macros.h"
+
+#define CHARSET_MASK_TRANSPARENCY 253
+
+void Gdi_drawStripToScreen(void *userData68KP) {
+// import variables
+ SET32 (int ,width )
+ SET32 (int ,height )
+ SETPTR (const byte * ,src )
+ SETPTR (byte * ,dst )
+ SETPTR (const byte * ,text )
+ SET32 (int ,_vm_screenWidth )
+ SET16 (uint16 ,vs_pitch )
+ SET16 (uint16 ,_textSurface_pitch )
+// end of import
+
+ // Compose the text over the game graphics
+ for (int h = 0; h < height; ++h) {
+ for (int w = 0; w < width; ++w) {
+ if (text[w] == CHARSET_MASK_TRANSPARENCY)
+ dst[w] = src[w];
+ else
+ dst[w] = text[w];
+ }
+ src += vs_pitch;
+ dst += _vm_screenWidth;
+ text += _textSurface_pitch;
+ }
+} \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/drawstrip.h b/backends/PalmOS/Src/arm/drawstrip.h
new file mode 100644
index 0000000000..a9f412ca1c
--- /dev/null
+++ b/backends/PalmOS/Src/arm/drawstrip.h
@@ -0,0 +1,10 @@
+#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/proc3.cpp b/backends/PalmOS/Src/arm/proc3.cpp
new file mode 100644
index 0000000000..0d9d15e5cb
--- /dev/null
+++ b/backends/PalmOS/Src/arm/proc3.cpp
@@ -0,0 +1,126 @@
+#include "native.h"
+#include "endianutils.h"
+
+#define MAIN_TYPE CostumeProc3Type
+#include "macros.h"
+
+#define MSETPTR(type, member) v1.member = _GETPTR(v1comp, V1CodecType, member, type);
+#define MSET32(type, member) v1.member = _GET32(v1comp, V1CodecType, member, type);
+#define MSET8(type, member) v1.member = _GET8(v1comp, V1CodecType, member, type);
+
+UInt32 CostumeRenderer_proc3(void *userData68KP) {
+// import variables
+ V1Type v1;
+
+ SETPTRV (V1CodecType * , v1, v1comp )
+
+ SETPTR (const byte * ,revBitMask )
+ SETPTR (const byte * ,_srcptr )
+ SET32 (int ,_height )
+ SET8 (byte ,_scaleIndexX )
+ SET8 (byte ,_scaleIndexY )
+ SET8 (byte ,_scaleX )
+ SET8 (byte ,_scaleY )
+ SET32 (int32 ,_numStrips )
+ SET32 (int ,_outwidth )
+ SET32 (int ,_outheight )
+ SETPTR (byte * ,_shadow_table )
+ SETPTR (byte * ,_vm_proc_special_palette )
+ SETPTR (byte * ,_palette )
+ SET8 (byte ,_shadow_mode )
+
+ MSETPTR (const byte * ,scaletable )
+ MSET8 (byte ,mask )
+ MSET8 (byte ,shr )
+ MSET8 (byte ,repcolor )
+ MSET8 (byte ,replen )
+ MSET32 (int ,scaleXstep )
+ MSET32 (int ,x )
+ MSET32 (int ,y )
+ MSET32 (int ,scaleXindex )
+ MSET32 (int ,scaleYindex )
+ MSET32 (int ,skip_width )
+ MSETPTR (byte * ,destptr )
+ MSETPTR (byte * ,mask_ptr )
+// end of import
+
+ const byte *mask, *src;
+ byte *dst;
+ byte len, maskbit;
+ int y;
+ uint color, height, pcolor;
+ const byte *scaleytab;
+ bool masked;
+
+ y = v1.y;
+ src = _srcptr;
+ dst = v1.destptr;
+ len = v1.replen;
+ color = v1.repcolor;
+ height = _height;
+
+ scaleytab = &v1.scaletable[_scaleIndexY];
+ maskbit = revBitMask[v1.x & 7];
+ mask = v1.mask_ptr + v1.x / 8;
+
+ if (len)
+ goto StartPos;
+
+ do {
+ len = *src++;
+ color = len >> v1.shr;
+ len &= v1.mask;
+
+ if (!len)
+ len = *src++;
+
+ do {
+ if (_scaleY == 255 || *scaleytab++ < _scaleY) {
+ masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit));
+
+ if (color && !masked) {
+ // FIXME: Fully implement _shadow_mode.in Sam & Max
+ // For now, it's enough for transparency.
+ if (_shadow_mode & 0x20) {
+ pcolor = _vm_proc_special_palette[*dst];
+ } else {
+ pcolor = _palette[color];
+ if (pcolor == 13 && _shadow_table)
+ pcolor = _shadow_table[*dst];
+ }
+ *dst = pcolor;
+ }
+ dst += _outwidth;
+ mask += _numStrips;
+ y++;
+ }
+ if (!--height) {
+ if (!--v1.skip_width)
+ goto end_jump;
+ height = _height;
+ y = v1.y;
+
+ scaleytab = &v1.scaletable[_scaleIndexY];
+
+
+ if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
+ v1.x += v1.scaleXstep;
+ if (v1.x < 0 || v1.x >= _outwidth)
+ goto end_jump;
+ maskbit = revBitMask[v1.x & 7];
+ v1.destptr += v1.scaleXstep;
+ }
+ _scaleIndexX += v1.scaleXstep;
+ dst = v1.destptr;
+ mask = v1.mask_ptr + v1.x / 8;
+ }
+ StartPos:;
+ } while (--len);
+ } while (1);
+
+end_jump:
+// v1comp->x = ByteSwap32(v1.x);
+// v1comp->destptr = (byte *)ByteSwap32(v1.destptr);
+
+ return _scaleIndexX;
+} \ No newline at end of file
diff --git a/backends/PalmOS/Src/arm/proc3.h b/backends/PalmOS/Src/arm/proc3.h
new file mode 100644
index 0000000000..f7dd40b593
--- /dev/null
+++ b/backends/PalmOS/Src/arm/proc3.h
@@ -0,0 +1,10 @@
+#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