[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/arm decompressrle0.cpp,NONE,1.1 decompressrle7.cpp,NONE,1.1 decompresstony.cpp,NONE,1.1 drawsprite.cpp,NONE,1.1 fastshrink.cpp,NONE,1.1 pno_common.h,NONE,1.1 pno_queen.h,NONE,1.1 pno_scumm.h,NONE,1.1 pno_sword1.h,NONE,1.1 renderparallax.cpp,NONE,1.1 screendraw.cpp,NONE,1.1 PNOMain.cpp,1.5,1.6 blit.cpp,1.1,1.2 copyrectangle.cpp,1.2,1.3 drawstrip.cpp,1.1,1.2 native.h,1.4,1.5 proc3.cpp,1.3,1.4 widelandscape.cpp,1.2,1.3 wideportrait.cpp,1.2,1.3 blit.h,1.1,NONE copyrectangle.h,1.2,NONE drawstrip.h,1.1,NONE proc3.h,1.1,NONE widelandscape.h,1.2,NONE wideportrait.h,1.2,NONE
Chris Apers
chrilith at users.sourceforge.net
Mon Dec 20 09:34:11 CET 2004
Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5315
Modified Files:
PNOMain.cpp blit.cpp copyrectangle.cpp drawstrip.cpp native.h
proc3.cpp widelandscape.cpp wideportrait.cpp
Added Files:
decompressrle0.cpp decompressrle7.cpp decompresstony.cpp
drawsprite.cpp fastshrink.cpp pno_common.h pno_queen.h
pno_scumm.h pno_sword1.h renderparallax.cpp screendraw.cpp
Removed Files:
blit.h copyrectangle.h drawstrip.h proc3.h widelandscape.h
wideportrait.h
Log Message:
- Better ARM support
--- NEW FILE: decompressrle0.cpp ---
#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;
}
--- NEW FILE: decompressrle7.cpp ---
#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;
}
--- NEW FILE: decompresstony.cpp ---
#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;
}
--- NEW FILE: drawsprite.cpp ---
#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;
}
--- NEW FILE: fastshrink.cpp ---
#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;
}
--- NEW FILE: pno_common.h ---
#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
--- NEW FILE: pno_queen.h ---
#ifndef PNOQUEEN_H
#define PNOQUEEN_H
#define COMPILE_QUEEN
unsigned long Display_blit(void *userData68KP);
#endif
--- NEW FILE: pno_scumm.h ---
#ifndef PNOSCUMM_H
#define PNOSCUMM_H
#define COMPILE_SCUMM
unsigned long Gdi_drawStripToScreen(void *userData68KP);
unsigned long CostumeRenderer_proc3(void *userData68KP);
#endif
--- NEW FILE: pno_sword1.h ---
#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
--- NEW FILE: renderparallax.cpp ---
#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;
}
--- NEW FILE: screendraw.cpp ---
#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;
}
Index: PNOMain.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/PNOMain.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- PNOMain.cpp 6 Oct 2004 09:35:02 -0000 1.5
+++ PNOMain.cpp 20 Dec 2004 17:33:40 -0000 1.6
@@ -15,37 +15,46 @@
Call68KFuncType *call68KFuncP);
unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) {
- unsigned long retVal = 0;
-
-#ifdef COMPILE_PACE
- // needed before making any OS calls using the
- // PACEInterface library
- InitPACEInterface(emulStateP, call68KFuncP);
-#endif
+ PnoProc *func[] = {
+#if defined(COMPILE_COMMON)
+ OSystem_CopyRectToScreen,
+ OSystem_updateScreen_widePortrait,
+ OSystem_updateScreen_wideLandscape,
+// MemoryStream_ReadBuffer
-#ifdef COMPILE_WIDELANDSCAPE
- OSystem_updateScreen_wideLandscape(userData68KP);
-#endif
+#elif defined(COMPILE_QUEEN)
+ Display_blit
-#ifdef COMPILE_WIDEPORTRAIT
- OSystem_updateScreen_widePortrait(userData68KP);
-#endif
+#elif defined(COMPILE_SCUMM)
+ Gdi_drawStripToScreen,
+ CostumeRenderer_proc3
-#ifdef COMPILE_COPYRECT
- OSystem_CopyRectToScreen(userData68KP);
-#endif
+#elif defined(COMPILE_SWORD1)
+ Screen_draw,
+ Screen_drawSprite,
+ Screen_fastShrink,
+ Screen_renderParallax,
+ Screen_decompressTony,
+ Screen_decompressRLE7,
+ Screen_decompressRLE0
-#ifdef COMPILE_COSTUMEPROC3
- retVal = CostumeRenderer_proc3(userData68KP);
#endif
+ };
-#ifdef COMPILE_DRAWSTRIP
- Gdi_drawStripToScreen(userData68KP);
-#endif
+ // needed before making any OS calls using the
+ // PACEInterface library
+ InitPACEInterface(emulStateP, call68KFuncP);
-#ifdef COMPILE_BLIT
- Display_blit(userData68KP);
-#endif
+ 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 ByteSwap32(retVal);
+ return (retVal);
}
Index: blit.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/blit.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- blit.cpp 6 Oct 2004 09:35:02 -0000 1.1
+++ blit.cpp 20 Dec 2004 17:33:40 -0000 1.2
@@ -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 @@
dstBuf += dstPitch;
}
}
-}
\ No newline at end of file
+
+ return 0;
+}
Index: copyrectangle.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/copyrectangle.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- copyrectangle.cpp 6 Oct 2004 09:33:21 -0000 1.2
+++ copyrectangle.cpp 20 Dec 2004 17:33:40 -0000 1.3
@@ -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 @@
buf += pitch;
} while (--h);
}
+
+ return 0;
}
Index: drawstrip.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/drawstrip.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- drawstrip.cpp 12 Sep 2004 12:42:07 -0000 1.1
+++ drawstrip.cpp 20 Dec 2004 17:33:40 -0000 1.2
@@ -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 @@
dst += _vm_screenWidth;
text += _textSurface_pitch;
}
-}
\ No newline at end of file
+
+ return 0;
+}
Index: native.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/native.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- native.h 9 Nov 2004 11:35:17 -0000 1.4
+++ native.h 20 Dec 2004 17:33:40 -0000 1.5
@@ -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 {
- RSC_WIDELANDSCAPE = 1,
- RSC_WIDEPORTRAIT,
- RSC_COPYRECT,
- RSC_COSTUMEPROC3,
- RSC_DRAWSTRIP,
- RSC_BLIT
+ COMMON_COPYRECT = 0,
+ COMMON_WPORTRAIT,
+ COMMON_WLANDSCAPE,
+// COMMON_SNDBUFFER
};
enum {
- PNO_COPYRECT = 0,
- PNO_WIDE,
- PNO_COSTUMEPROC3,
- PNO_DRAWSTRIP,
- PNO_BLIT,
- PNO_COUNT
+ QUEEN_BLIT = 0
+};
+
+enum {
+ SCUMM_DRAWSTRIP = 0,
+ SCUMM_PROC3
+};
+
+enum {
+ SWORD1_SCREENDRAW = 0,
+ SWORD1_DRAWSPRITE,
+ SWORD1_FASTSHRINK,
+ SWORD1_RENDERPARALLAX,
+ SWORD1_DECOMPTONY,
+ SWORD1_DECOMPRLE7,
+ SWORD1_DECOMPRLE0
};
// types
@@ -43,20 +56,6 @@
} 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 @@
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
Index: proc3.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/proc3.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- proc3.cpp 11 Oct 2004 13:27:13 -0000 1.3
+++ proc3.cpp 20 Dec 2004 17:33:40 -0000 1.4
@@ -95,8 +95,8 @@
}
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 @@
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 @@
} 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;
+}
Index: widelandscape.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/widelandscape.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- widelandscape.cpp 6 Oct 2004 09:33:26 -0000 1.2
+++ widelandscape.cpp 20 Dec 2004 17:33:41 -0000 1.3
@@ -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 @@
MemMove(dst, dst - 480, 480);
dst += 480;
}
+
+ return 0;
}
Index: wideportrait.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/wideportrait.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- wideportrait.cpp 6 Oct 2004 09:33:26 -0000 1.2
+++ wideportrait.cpp 20 Dec 2004 17:33:41 -0000 1.3
@@ -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 @@
MemMove(dst, dst - WIDE_PITCH, 300); // 300 = 200 x 1.5
dst += WIDE_PITCH;
}
+
+ return 0;
}
--- blit.h DELETED ---
--- copyrectangle.h DELETED ---
--- drawstrip.h DELETED ---
--- proc3.h DELETED ---
--- widelandscape.h DELETED ---
--- wideportrait.h DELETED ---
More information about the Scummvm-git-logs
mailing list