[Scummvm-cvs-logs] CVS: scummvm/common engine.cpp,1.18,1.19 engine.h,1.21,1.22 file.cpp,1.26,1.27 gameDetector.cpp,1.87,1.88 main.cpp,1.25,1.26 savefile.h,1.2,1.3 scummsys.h,1.19,1.20 timer.cpp,1.7,1.8 util.cpp,1.9,1.10

Max Horn fingolfin at users.sourceforge.net
Wed Apr 30 05:45:03 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv29322

Modified Files:
	engine.cpp engine.h file.cpp gameDetector.cpp main.cpp 
	savefile.h scummsys.h timer.cpp util.cpp 
Log Message:
more PalmOS changes

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/engine.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- engine.cpp	26 Apr 2003 11:44:13 -0000	1.18
+++ engine.cpp	30 Apr 2003 12:43:53 -0000	1.19
@@ -54,6 +54,8 @@
 
 #ifdef _WIN32_WCE
 	dir = _gameDataPath;
+#elif defined(__PALM_OS__)
+	dir = SCUMMVM_SAVEPATH;
 #else
 
 #if !defined(MACOS_CARBON)
@@ -104,8 +106,13 @@
 }
 
 void NORETURN CDECL error(const char *s, ...) {
+#ifdef __PALM_OS__
+	char buf_input[256]; // 1024 is too big overflow the stack
+	char buf_output[256];
+#else
 	char buf_input[1024];
 	char buf_output[1024];
+#endif
 	va_list va;
 
 	va_start(va, s);
@@ -132,6 +139,10 @@
 	drawError(buf_output);
 #endif
 
+#ifdef __PALM_OS__
+	PalmFatalError(buf_output);
+#endif
+
 	// Finally exit. quit() will terminate the program if g_system iss present
 	if (g_system)
 		g_system->quit();
@@ -140,7 +151,11 @@
 }
 
 void CDECL warning(const char *s, ...) {
+#ifdef __PALM_OS__
+	char buf[256]; // 1024 is too big overflow the stack
+#else
 	char buf[1024];
+#endif
 	va_list va;
 
 	va_start(va, s);
@@ -161,7 +176,11 @@
 uint16 _debugLevel = 1;
 
 void CDECL debug(int level, const char *s, ...) {
+#ifdef __PALM_OS__
+	char buf[256]; // 1024 is too big overflow the stack
+#else
 	char buf[1024];
+#endif
 	va_list va;
 
 	if (level > _debugLevel)

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/engine.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- engine.h	26 Apr 2003 11:44:13 -0000	1.21
+++ engine.h	30 Apr 2003 12:43:53 -0000	1.22
@@ -82,7 +82,6 @@
 // in this header. This serves two purposes:
 // 1) Clean seperation from the game modules (scumm, simon) and the generic code
 // 2) Faster (compiler doesn't have to parse lengthy header files)
-
 #ifndef DISABLE_SCUMM
 extern const VersionSettings *Engine_SCUMM_targetList();
 extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst);

Index: file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/file.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- file.cpp	10 Apr 2003 13:44:50 -0000	1.26
+++ file.cpp	30 Apr 2003 12:43:54 -0000	1.27
@@ -33,8 +33,8 @@
 		if (buf[strlen(buf)-1] != ':' && buf[strlen(buf)-1] != '/')
 #endif
 
-#ifndef __GP32__
-			strcat(buf, "/");
+#if !defined(__GP32__) && !defined(__PALM_OS__)
+		strcat(buf, "/");	// prevent double /
 #endif
 	}
 	strcat(buf, filename);
@@ -61,7 +61,9 @@
 #ifdef __MORPHOS__
 			if (buf[strlen(buf) - 1] != ':' && buf[strlen(buf) - 1] != '/')
 #endif
-			strcat(buf, "/");
+#ifndef __PALM_OS__
+			strcat(buf, "/");	// PALMOS
+#endif
 		}
 		strcat(buf, dirs[l]);
 		int8 len = strlen(buf);

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- gameDetector.cpp	26 Apr 2003 11:44:13 -0000	1.87
+++ gameDetector.cpp	30 Apr 2003 12:43:54 -0000	1.88
@@ -38,6 +38,9 @@
                             current_option = NULL
 
 // DONT FIXME: DO NOT ORDER ALPHABETICALY, THIS IS ORDERED BY IMPORTANCE/CATEGORY! :)
+#ifdef __PALM_OS__
+static const char USAGE_STRING[] = "NoUsageString"; // save more data segment space
+#else
 static const char USAGE_STRING[] = 
 	"ScummVM - Scumm Interpreter\n"
 	"Syntax:\n"
@@ -73,13 +76,14 @@
 	"\t-d[<num>]  - enable debug output (debug level [1])\n"
 	"\t-u         - dump scripts\n"
 ;
-
+#endif
 // This contains a pointer to a list of all supported games.
 const VersionSettings *version_settings = NULL;
 
 static const struct GraphicsMode gfx_modes[] = {
 	{"normal", "Normal (no scaling)", GFX_NORMAL},
 	{"1x", "Normal (no scaling)", GFX_NORMAL},
+#ifndef __PALM_OS__	// reduce contant data size
 	{"2x", "2x", GFX_DOUBLESIZE},
 	{"3x", "3x", GFX_TRIPLESIZE},
 	{"2xsai", "2xSAI", GFX_2XSAI},
@@ -88,6 +92,10 @@
 	{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
 	{"tv2x", "TV2x", GFX_TV2X},
 	{"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
+#else
+	{"flipping", "Page Flipping", GFX_FLIPPING},
+	{"dbuffer", "Double Buffer", GFX_DOUBLEBUFFER},
+#endif
 	{0, 0}
 };
 
@@ -108,6 +116,7 @@
 static const struct MusicDriver music_drivers[] = {
 	{"auto", "Default", MD_AUTO},
 	{"null", "No music", MD_NULL},
+#ifndef __PALM_OS__	// reduce contant data size
 	{"windows", "Windows MIDI", MD_WINDOWS},
 	{"seq", "SEQ", MD_SEQ},
 	{"qt", "QuickTime", MD_QTMUSIC},
@@ -115,6 +124,9 @@
 	{"etude", "Etude", MD_ETUDE},
 	{"alsa", "ALSA", MD_ALSA},
 	{"adlib", "Adlib", MD_ADLIB},
+#else
+	{"ypa1", "Yamaha Pa1", MD_YPA1},
+#endif
 	{0, 0, 0}
 };
 
@@ -493,7 +505,11 @@
 	switch(drv) {
 	case MD_AUTO:
 	case MD_NULL: return true;
+#ifndef __PALM_OS__	// not avalaible on palmos : Clie use only ADPCM data and cannot be converted on the fly, may be possible on TT ?
 	case MD_ADLIB: return true;
+#else
+	case MD_YPA1: return true;
+#endif
 #if defined(WIN32) && !defined(_WIN32_WCE)
 	case MD_WINDOWS: return true;
 #endif
@@ -588,14 +604,17 @@
 	/* Use the adlib sound driver if auto mode is selected,
 	 * and the game is one of those that want adlib as
 	 * default */
+#ifndef __PALM_OS__ // currently adlib is not supported, is this really needed ?
 	if (_midi_driver == MD_AUTO && _features & GF_ADLIB_DEFAULT) {
 		_midi_driver = MD_ADLIB;
 		_use_adlib = true;
 	}
+#endif
 
 	if (!_gameDataPath) {
 		warning("No path was provided. Assuming the data files are in the current directory");
 		_gameDataPath = "";
+#ifndef __PALM_OS__	// add last slash also in File::fopenNoCase, so this is not needed
 	} else if (_gameDataPath[strlen(_gameDataPath)-1] != '/'
 #ifdef __MORPHOS__
 					&& _gameDataPath[strlen(_gameDataPath)-1] != ':'
@@ -607,6 +626,7 @@
 		// need to allocate 2 extra bytes, one for the "/" and one for the NULL terminator
 		_gameDataPath = (char *)malloc((strlen(slashless) + 2) * sizeof(char));
 		sprintf(_gameDataPath, "%s/", slashless);
+#endif
 	}
 
 	return (0);
@@ -627,6 +647,8 @@
 	return OSystem_MAC_create(_gfx_mode, _fullScreen);
 #elif defined(__GP32__)	// ph0x
 	return OSystem_GP32_create(GFX_NORMAL, true);
+#elif defined(__PALM_OS__) //chrilith
+	return OSystem_PALMOS_create(_gfx_mode);
 #else
 	/* SDL is the default driver for now */
 	return OSystem_SDL_create(_gfx_mode, _fullScreen);
@@ -639,13 +661,15 @@
 
 	if (drv == MD_AUTO) {
 #if defined (WIN32) && !defined(_WIN32_WCE)
-	drv = MD_WINDOWS;	// MD_WINDOWS is default MidiDriver on windows targets
+		drv = MD_WINDOWS; // MD_WINDOWS is default MidiDriver on windows targets
 #elif defined(MACOSX)
-	drv = MD_COREAUDIO;
+		drv = MD_COREAUDIO;
+#elif defined(__PALM_OS__)	// must be before mac
+		drv = MD_YPA1;
 #elif defined(macintosh)
-	drv = MD_QTMUSIC;
+		drv = MD_QTMUSIC;
 #elif defined(__MORPHOS__)
-	drv = MD_ETUDE;
+		drv = MD_ETUDE;
 #elif defined (_WIN32_WCE) || defined(UNIX) || defined(X11_BACKEND)
 	// Always use MIDI emulation via adlib driver on CE and UNIX device
 
@@ -658,7 +682,11 @@
 	switch(drv) {
 	case MD_AUTO:
 	case MD_NULL:		return MidiDriver_NULL_create();
+#ifndef __PALM_OS__
 	case MD_ADLIB:		_use_adlib = true; return MidiDriver_ADLIB_create();
+#else
+	case MD_YPA1:		return MidiDriver_YamahaPa1_create();
+#endif
 #if defined(WIN32) && !defined(_WIN32_WCE)
 	case MD_WINDOWS:	return MidiDriver_WIN_create();
 #endif
@@ -668,7 +696,7 @@
 #if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX)
 	case MD_SEQ:		return MidiDriver_SEQ_create();
 #endif
-#if defined(MACOSX) || defined(macintosh)
+#if (defined(MACOSX) || defined(macintosh)) && !defined(__PALM_OS__)
 	case MD_QTMUSIC:	return MidiDriver_QT_create();
 #endif
 #if defined(MACOSX)

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/main.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- main.cpp	25 Mar 2003 00:26:52 -0000	1.25
+++ main.cpp	30 Apr 2003 12:43:54 -0000	1.26
@@ -160,6 +160,9 @@
 		GetWindowsDirectory(scummhome, 256);
 		strcat(scummhome, "\\");
 		strcat(scummhome, DEFAULT_CONFIG_FILE);
+	#elif defined(__PALM_OS__)
+		strcpy(scummhome,"/PALM/Programs/ScummVM/");
+		strcat(scummhome, DEFAULT_CONFIG_FILE);
 	#else
 		strcpy(scummhome, DEFAULT_CONFIG_FILE);
 	#endif
@@ -225,10 +228,11 @@
 
 	// ...and quit (the return 0 should never be reached)
 	system->quit();
-
+	delete system;	// palmos leaks
 	return 0;
 }
 
+#ifndef __PALM_OS__
 void *operator new(size_t size) {
 	return calloc(size, 1);
 }
@@ -236,4 +240,4 @@
 void operator delete(void *ptr) {
 	free(ptr);
 }
-
+#endif

Index: savefile.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/savefile.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- savefile.h	17 Dec 2002 09:29:28 -0000	1.2
+++ savefile.h	30 Apr 2003 12:43:55 -0000	1.3
@@ -35,6 +35,8 @@
 	//Should go away.  See scumm/saveload.cpp and scumm/imuse.cpp
 	virtual int fseek(long offs, int whence) = 0;
 	virtual int feof() = 0;
+#elif defined(__PALM_OS__)
+	virtual int feof() = 0;
 #endif
 };
 
@@ -58,6 +60,9 @@
 #ifdef _WIN32_WCE
 	int fseek(long offs, int whence)
 		{ return ::fseek(fh, offs, whence); }
+	int feof()
+		{ return ::feof(fh); }
+#elif defined(__PALM_OS__)
 	int feof()
 		{ return ::feof(fh); }
 #endif

Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scummsys.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- scummsys.h	6 Apr 2003 18:01:36 -0000	1.19
+++ scummsys.h	30 Apr 2003 12:43:55 -0000	1.20
@@ -151,6 +151,41 @@
 	#define NORETURN
 	#endif
 
+#elif defined(__PALMOS_TRAPS__)	// PALMOS
+  #include <PalmOS.h>
+  #include <stdio.h>
+  #include "extend.h"
+
+  #define __PALM_OS__
+  #define scumm_stricmp stricmp// FIXME - this is definitly wrong. Try strcasecmp?
+  
+  #define CHECK_HEAP
+  #define SCUMM_BIG_ENDIAN
+  #define SCUMM_NEED_ALIGNMENT
+  #define NONSTANDARD_SAVE
+  
+  #define FORCEINLINE inline
+  #define CDECL 
+  
+  typedef unsigned char byte;
+  typedef unsigned char uint8;
+  typedef unsigned short uint16;
+  typedef unsigned long uint32;
+  typedef unsigned int uint;
+  typedef signed char int8;
+  typedef signed short int16;
+  typedef signed long int32;
+  typedef Boolean bool;
+  
+  #define START_PACK_STRUCTS pack (1)
+  #define END_PACK_STRUCTS   pack ()
+  #define GCC_PACK
+  #define NORETURN
+  #define NEED_STRDUP
+  
+  #define NEWGUI_256
+  typedef byte NewGuiColor;	// NEWGUI to 256 colors
+
 #elif defined(macintosh)
 	#include <stdio.h>
 
@@ -384,7 +419,9 @@
 /* Initialized operator new */
 // FIXME - get rid of these new/delete overrides!!! They conflict with the
 // Standard C++ library, and they are only there to support lazy programmers anyway.
+#ifndef __PALM_OS__
 void * operator new(size_t size);
 void operator delete(void *ptr);
+#endif
 
 #endif

Index: timer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/timer.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- timer.cpp	6 Mar 2003 21:45:30 -0000	1.7
+++ timer.cpp	30 Apr 2003 12:43:56 -0000	1.8
@@ -27,6 +27,8 @@
 static Engine * eng;
 
 Timer::Timer(Engine * engine) {
+	memset(this,0,sizeof(Timer)); //palmos
+	
 	_initialized = false;
 	_timerRunning = false;
 	eng = _engine = engine;

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- util.cpp	6 Mar 2003 21:45:32 -0000	1.9
+++ util.cpp	30 Apr 2003 12:43:56 -0000	1.10
@@ -24,8 +24,9 @@
 //
 // 8-bit alpha blending routines
 //
+#ifndef __PALM_OS__
 static int BlendCache[256][256];
-
+#endif
 //
 // Find the entry in the given palette which matches the color defined by
 // the tripel (r,b,g) most closely.
@@ -54,6 +55,7 @@
 // Blend two 8 bit colors into a third, all colors being defined by palette indices.
 //
 int Blend(int src, int dst, byte *palette) {
+#ifndef __PALM_OS__
 	int r, g, b;
 	int alpha = 128;	// Level of transparency [0-256]
 	byte *srcpal = palette + (dst * 3);
@@ -75,17 +77,22 @@
 	b /= 256;
 
 	return (BlendCache[dst][src] = RGBMatch(palette, r , g , b ));
+#else
+	return 0;
+#endif
 }
 
 //
 // Reset the blending cache
 //
 void ClearBlendCache(byte *palette, int weight) {
+#ifndef __PALM_OS__
 	for (int i = 0; i < 256; i++)
 		for (int j = 0 ; j < 256 ; j++)
 //			BlendCache[i][j] = i;	// No alphablending
 //			BlendCache[i][j] = j;	// 100% translucent
 			BlendCache[i][j] = -1;	// Enable alphablending
+#endif
 }
 
 //





More information about the Scummvm-git-logs mailing list