[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/arm ArmNative.h,1.2,1.3 PNOMain.cpp,1.2,1.3 copy_rect.cpp,1.1,1.2

Chris Apers chrilith at users.sourceforge.net
Tue May 25 06:44:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3400

Modified Files:
	ArmNative.h PNOMain.cpp copy_rect.cpp 
Log Message:
New ARM functions (sound, copyrect, wide display)

Index: ArmNative.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/ArmNative.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ArmNative.h	28 Mar 2004 16:30:46 -0000	1.2
+++ ArmNative.h	25 May 2004 13:43:00 -0000	1.3
@@ -1,43 +1,68 @@
 #ifndef _ARMNATIVE_H_
 #define _ARMNATIVE_H_
 
+#include "PNOLoader.h"
+
 #ifdef WIN32
 	#include "testing/SimNative.h"
 	#include "testing/oscalls.h"
 #endif
 
-// functions
-typedef unsigned long (*PnoProc)(void *userData68KP);
+//#define DISABLE_ARM
+//#define DEBUG_ARM
 
-#define DECLARE(x)	unsigned long x(void *userData68KP);
+// rsrc
+enum {
+	ARM_PA1SND		= 1,
+	ARM_STREAMSND,
+	ARM_OWIDELS,
+	ARM_OWIDEPT,
+	ARM_OCOPYRECT
+};
+
+#define TRUE	1
+#define FALSE	0
+
+// types
+typedef struct {
+	void *srcP;
+	void *dstP;
+	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 {
-	UInt32 func;
 	void *dst;
 	void *src;
-	
-} DataOSysWideType , *DataOSysWidePtr;
+} OSysWideType , *OSysWidePtr;
 
 typedef struct {
-	UInt32 func;
 	void *dst;
 	const void *buf;
 	UInt32 pitch, _offScreenPitch;
 	UInt32 w, h;
-} DataOSysCopyRectType, *DataOSysCopyRectPtr;
-
-DECLARE(OSystem_PALMOS_update_screen__wide_portrait)
-DECLARE(OSystem_PALMOS_update_screen__wide_landscape)
-DECLARE(OSystem_PALMOS_copyRectToScreen)
+} OSysCopyType, *OSysCopyPtr;
 
-// rsrc
-#define ARMCODE_1	1000
+// calls
+MemPtr	_PceInit(DmResID resID);
+UInt32	_PceCall(void *armP, void *userDataP);
+void	_PceFree(void *armP);
 
-// function indexes
-enum {
-	kOSysWidePortrait = 0,
-	kOSysWideLandscape,
-	kOSysCopyRect
-};
+MemPtr	_PnoInit(DmResID resID, PnoDescriptor *pnoP);
+UInt32	_PnoCall(PnoDescriptor *pnoP, void *userDataP);
+void	_PnoFree(PnoDescriptor *pnoP, MemPtr armP);
 
 #endif
\ No newline at end of file

Index: PNOMain.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/PNOMain.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PNOMain.cpp	28 Mar 2004 16:30:46 -0000	1.2
+++ PNOMain.cpp	25 May 2004 13:43:00 -0000	1.3
@@ -5,56 +5,47 @@
 // "ARMlet" name is now officially discouraged.  Compare an
 // contrast to "PilotMain" for 68K applications.
 #define PNO_Main ARMlet_Main
-// entry point
-extern "C"
-unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP);
-
-#ifndef WIN32
 
-#pragma thumb off
-asm void * __ARMlet_Take_Func_Addr__(void *f)
-{
-    sub     r0, r0, r10         //  0 convert pointer to zero-based address
-    ldr     r12, [pc, #8]       //  4 load zero-based address of this routine plus offset into r12
-    sub     r12, pc, r12        //  8 compute start of PNO by subtracting this from PC
-    add     r0, r0, r12         // 12 add PNO start to function pointer
-    bx      lr                  // 16 return to caller
-    dcd     __ARMlet_Take_Func_Addr__ + 16    // 20
-}
-#pragma thumb reset
+// ------------------------
 
-#else
-#define	__ARMlet_Take_Func_Addr__(x)	x
-#endif
+extern "C"
+unsigned long PNO_Main(
+	const void *emulStateP, 
+	void *userData68KP, 
+	Call68KFuncType *call68KFuncP);
 
 unsigned long PNO_Main(const void *emulStateP, void *userData68KP, Call68KFuncType *call68KFuncP) {
-/*	const PnoProc call[] = {
-		(PnoProc)__ARMlet_Take_Func_Addr__(OSystem_PALMOS_update_screen__wide_portrait),
-		(PnoProc)__ARMlet_Take_Func_Addr__(OSystem_PALMOS_update_screen__wide_landscape),
-		//OSystem_PALMOS_copyRectToScreen
-	};
-*/
-#ifndef WIN32
+	unsigned long retVal = 0;
+
+#ifdef COMPILE_PACE
 	// needed before making any OS calls using the 
 	// PACEInterface library
 	InitPACEInterface(emulStateP, call68KFuncP);
-#else
-	global.call68KFuncP = call68KFuncP;
-	global.emulStateP = emulStateP;
-	global.userData68KP = userData68KP;
 #endif
 
-	UInt32 run = ByteSwap32(*(UInt32 *)userData68KP);
+#ifdef COMPILE_PA1SND
+	ARMPa1SndPtr userData = (ARMPa1SndPtr)userData68KP;
+	pcm2adpcm	(	(Int16 *)ReadUnaligned32(&(userData->srcP)),
+					(UInt8 *)ReadUnaligned32(&(userData->dstP)),
+					ReadUnaligned32(&(userData->length))
+				);
+#endif
 
-	switch (run) {
-		case 0:
-			OSystem_PALMOS_update_screen__wide_portrait(userData68KP);
-			break;
-		case 1:
-			OSystem_PALMOS_update_screen__wide_landscape(userData68KP);
-			break;
-	}
+#ifdef COMPILE_STREAMSND
+	retVal = (unsigned long)sndCallback;
+#endif
 
-	return 0;
-//	return call[run](userData68KP);
+#ifdef COMPILE_OWIDELS
+	O_WideLandscape(userData68KP);
+#endif
+
+#ifdef COMPILE_OWIDEPT
+	O_WidePortrait(userData68KP);
+#endif
+
+#ifdef COMPILE_OCOPYRECT
+	O_CopyRectToScreen(userData68KP);
+#endif
+
+	return retVal;
 }

Index: copy_rect.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/arm/copy_rect.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- copy_rect.cpp	5 Feb 2004 14:02:23 -0000	1.1
+++ copy_rect.cpp	25 May 2004 13:43:00 -0000	1.2
@@ -1,17 +1,16 @@
-#include "PACEInterfaceLib.h"
 #include "ArmNative.h"
 #include "endianutils.h"
 #include "../shared.h"
 
-unsigned long OSystem_PALMOS_copy_rect(void *userData68KP) {
-	UInt8* dataP = (UInt8 *)userData68KP;
+void O_CopyRectToScreen(void *userData68KP) {
+	OSysCopyPtr dataP = (OSysCopyType *)userData68KP;
 
-	UInt8 *dst = (UInt8 *)ReadUnaligned32(dataP + 2);		// ->dst
-	UInt8 *buf = (UInt8 *)ReadUnaligned32(dataP + 6);		// ->buf
-	UInt32 pitch = ReadUnaligned32(dataP + 10);				// ->pitch
-	UInt32 _offScreenPitch = ReadUnaligned32(dataP + 14);	// ->_offScreenPitch
-	UInt32 w = ReadUnaligned32(dataP + 18);					// ->w
-	UInt32 h = ReadUnaligned32(dataP + 22);					// ->h
+	UInt8 *dst = (UInt8 *)ReadUnaligned32(&(dataP->dst));
+	UInt8 *buf = (UInt8 *)ReadUnaligned32(&(dataP->buf));
+	UInt32 pitch = ReadUnaligned32(&(dataP->pitch));
+	UInt32 _offScreenPitch = ReadUnaligned32(&(dataP->_offScreenPitch));
+	UInt32 w = ReadUnaligned32(&(dataP->w));
+	UInt32 h = ReadUnaligned32(&(dataP->h));
 
 	if (_offScreenPitch == pitch && pitch == w) {
 		MemMove(dst, buf, h * w);
@@ -22,6 +21,4 @@
 			buf += pitch;
 		} while (--h);
 	}
-
-	return 0;
-}
\ No newline at end of file
+}





More information about the Scummvm-git-logs mailing list