- Better ARM support
svn-id: r16174
This commit is contained in:
parent
374c427c61
commit
7a4f4889a9
28 changed files with 500 additions and 152 deletions
|
@ -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
|
||||
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);
|
||||
|
||||
#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);
|
||||
return (retVal);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
27
backends/PalmOS/Src/arm/decompressrle0.cpp
Executable file
27
backends/PalmOS/Src/arm/decompressrle0.cpp
Executable file
|
@ -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;
|
||||
}
|
27
backends/PalmOS/Src/arm/decompressrle7.cpp
Executable file
27
backends/PalmOS/Src/arm/decompressrle7.cpp
Executable file
|
@ -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;
|
||||
}
|
31
backends/PalmOS/Src/arm/decompresstony.cpp
Executable file
31
backends/PalmOS/Src/arm/decompresstony.cpp
Executable file
|
@ -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;
|
||||
}
|
26
backends/PalmOS/Src/arm/drawsprite.cpp
Executable file
26
backends/PalmOS/Src/arm/drawsprite.cpp
Executable file
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef _OP_COSTUME2_H__
|
||||
#define _OP_COSTUME2_H__
|
||||
|
||||
#include <PalmOS.h>
|
||||
|
||||
#define COMPILE_DRAWSTRIP
|
||||
|
||||
void Gdi_drawStripToScreen(void *userData68KP);
|
||||
|
||||
#endif
|
54
backends/PalmOS/Src/arm/fastshrink.cpp
Executable file
54
backends/PalmOS/Src/arm/fastshrink.cpp
Executable file
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
|
@ -42,20 +55,6 @@ typedef struct {
|
|||
UInt32 length;
|
||||
} 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;
|
||||
|
@ -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
|
||||
|
|
11
backends/PalmOS/Src/arm/pno_common.h
Executable file
11
backends/PalmOS/Src/arm/pno_common.h
Executable file
|
@ -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
|
8
backends/PalmOS/Src/arm/pno_queen.h
Executable file
8
backends/PalmOS/Src/arm/pno_queen.h
Executable file
|
@ -0,0 +1,8 @@
|
|||
#ifndef PNOQUEEN_H
|
||||
#define PNOQUEEN_H
|
||||
|
||||
#define COMPILE_QUEEN
|
||||
|
||||
unsigned long Display_blit(void *userData68KP);
|
||||
|
||||
#endif
|
9
backends/PalmOS/Src/arm/pno_scumm.h
Executable file
9
backends/PalmOS/Src/arm/pno_scumm.h
Executable file
|
@ -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
|
14
backends/PalmOS/Src/arm/pno_sword1.h
Executable file
14
backends/PalmOS/Src/arm/pno_sword1.h
Executable file
|
@ -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
|
26
backends/PalmOS/Src/arm/pnodefs.h
Executable file
26
backends/PalmOS/Src/arm/pnodefs.h
Executable file
|
@ -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
|
|
@ -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;
|
||||
}
|
||||
return _scaleIndexX;
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef _OP_COSTUME_H__
|
||||
#define _OP_COSTUME_H__
|
||||
|
||||
#include <PalmOS.h>
|
||||
|
||||
#define COMPILE_COSTUMEPROC3
|
||||
|
||||
UInt32 CostumeRenderer_proc3(void *userData68KP);
|
||||
|
||||
#endif
|
76
backends/PalmOS/Src/arm/renderparallax.cpp
Executable file
76
backends/PalmOS/Src/arm/renderparallax.cpp
Executable file
|
@ -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;
|
||||
}
|
24
backends/PalmOS/Src/arm/screendraw.cpp
Executable file
24
backends/PalmOS/Src/arm/screendraw.cpp
Executable file
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <VFSMgr.h>
|
||||
#include "scumm_globals.h"
|
||||
#include "arm/native.h"
|
||||
#include "arm/pnodefs.h"
|
||||
|
||||
enum {
|
||||
kOptNone = 0,
|
||||
|
@ -62,6 +62,12 @@ enum {
|
|||
INIT_AUTOOFF = 1 << 0x03
|
||||
};
|
||||
|
||||
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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue