aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/fs/posix/posix-fs.cpp8
-rw-r--r--common/engine.cpp4
-rw-r--r--common/gameDetector.cpp5
-rw-r--r--common/scummsys.h30
-rw-r--r--common/system.h4
-rw-r--r--common/util.h7
-rw-r--r--scumm/scummvm.cpp29
7 files changed, 69 insertions, 18 deletions
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 5cdda13bc2..d74bfdca57 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -18,7 +18,7 @@
* $Header$
*/
-#if defined(UNIX)
+#if defined(UNIX) || defined (__GP32__) //ph0x
#include "../fs.h"
@@ -29,6 +29,12 @@
#include <dirent.h>
#include <stdio.h>
+#ifdef __GP32__ //ph0x FIXME: implement and move to portdefs.h
+#define opendir(x) (0)
+#define readdir(x) (0)
+#define closedir(x) (0)
+#endif
+
/*
* Implementation of the ScummVM file system API based on POSIX.
*/
diff --git a/common/engine.cpp b/common/engine.cpp
index 4540a99fcb..2ccc9a9a4a 100644
--- a/common/engine.cpp
+++ b/common/engine.cpp
@@ -102,7 +102,11 @@ void CDECL warning(const char *s, ...)
vsprintf(buf, s, va);
va_end(va);
+#ifdef __GP32__ //ph0x FIXME: implement fprint?
+ printf("WARNING: %s\n", buf);
+#else
fprintf(stderr, "WARNING: %s!\n", buf);
+#endif
#if defined( USE_WINDBG )
strcat(buf, "\n");
OutputDebugString(buf);
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 8dd4d6a318..3389cc7a5b 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -120,6 +120,8 @@ GameDetector::GameDetector()
_gfx_driver = GD_WINCE;
#elif defined(MACOS_CARBON)
_gfx_driver = GD_MAC;
+#elif defined(__GP32__) // ph0x
+ _gfx_driver = GD_GP32;
#else
/* SDL is the default driver for now */
_gfx_driver = GD_SDL;
@@ -621,6 +623,9 @@ OSystem *GameDetector::createSystem() {
#elif defined(USE_NULL_DRIVER)
case GD_NULL:
return OSystem_NULL_create();
+#elif defined(__GP32__) //ph0x
+ case GD_GP32:
+ return OSystem_GP32_create(GFX_NORMAL, true);
#else
case GD_SDL:
return OSystem_SDL_create(_gfx_mode, _fullScreen);
diff --git a/common/scummsys.h b/common/scummsys.h
index de56a78121..a8e06f9cf0 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -88,11 +88,11 @@ const bool true(1), false(0);
typedef unsigned char byte;
typedef unsigned char uint8;
typedef unsigned short uint16;
- typedef unsigned int uint32;
+ typedef unsigned long uint32;
typedef unsigned int uint;
typedef signed char int8;
typedef signed short int16;
- typedef signed int int32;
+ typedef signed long int32;
#define START_PACK_STRUCTS pack (push,1)
#define END_PACK_STRUCTS pack(pop)
@@ -241,11 +241,35 @@ const bool true(1), false(0);
#define START_PACK_STRUCTS pack (push,1)
#define END_PACK_STRUCTS pack(pop)
+#elif defined __GP32__ //ph0x
+ #define CDECL
+ #define SCUMM_NEED_ALIGNMENT
+ #define SCUMM_LITTLE_ENDIAN
+ #define NONSTANDARD_SAVE
+
+ #define scumm_stricmp stricmp
+ #define CHECK_HEAP
+
+ #define FORCEINLINE inline
+ #define NORETURN __attribute__((__noreturn__))
+ #define GCC_PACK __attribute__((packed))
+ #define _HEAPOK 0
+
+ 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;
+
+ #define START_PACK_STRUCTS pack (push,1)
+ #define END_PACK_STRUCTS pack(pop)
#else
#error No system type defined
#endif
-
#define SWAP_BYTES(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
#if defined(SCUMM_LITTLE_ENDIAN)
diff --git a/common/system.h b/common/system.h
index 5cae9b691d..d6447f2537 100644
--- a/common/system.h
+++ b/common/system.h
@@ -183,6 +183,7 @@ extern OSystem *OSystem_Dreamcast_create();
extern OSystem *OSystem_WINCE3_create();
extern OSystem *OSystem_X11_create();
extern OSystem *OSystem_MAC_create(int gfx_mode, bool full_screen);
+extern OSystem *OSystem_GP32_create(int gfx_mode, bool full_screen); //ph0x
enum {
GFX_NORMAL = 0,
@@ -203,7 +204,8 @@ enum {
GD_MORPHOS,
GD_WINCE,
GD_MAC,
- GD_DC
+ GD_DC,
+ GD_GP32 //ph0x
};
enum {
diff --git a/common/util.h b/common/util.h
index 3218a8546d..37576bd8af 100644
--- a/common/util.h
+++ b/common/util.h
@@ -45,6 +45,13 @@ static inline void SWAP(int &a, int &b) { int tmp=a; a=b; b=tmp; }
#define GREEN_FROM_16(x) ((((x)>>5)&0x1F) << 3)
#define BLUE_FROM_16(x) (((x)&0x1F) << 3)
+#elif defined(__GP32__) //ph0x
+// GP32 format 5-5-5-1 (first bit means intensity)
+#define RGB_TO_16(r,g,b) (((((r)>>3)&0x1F) << 11) | ((((g)>>3)&0x1F) << 6) | (((b)>>3)&0x1F)<<1)
+#define RED_FROM_16(x) ((((x)>>11)&0x1F) << 3)
+#define GREEN_FROM_16(x) ((((x)>>6) &0x1F) << 3)
+#define BLUE_FROM_16(x) ((((x)>>1) &0x1F) << 3)
+
#else
// Assume the 16 bit graphics data is in 5-6-5 format
#define RGB_TO_16(r,g,b) (((((r)>>3)&0x1F) << 11) | ((((g)>>2)&0x3F) << 5) | (((b)>>3)&0x1F))
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index b07552641a..447733d89f 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -22,22 +22,21 @@
#include "stdafx.h"
#include "scumm.h"
+#include "sound/mixer.h"
+#include "sound/mididrv.h"
+#include "scumm/sound.h"
+#include "scumm/imuse.h"
+#include "scumm/bundle.h"
#include "actor.h"
-#include "bundle.h"
#include "debug.h"
#include "dialogs.h"
-#include "imuse.h"
+#include "gameDetector.h"
+#include "gui/newgui.h"
+#include "gui/message.h"
#include "object.h"
#include "resource.h"
-#include "sound.h"
#include "string.h"
-#include "verbs.h"
-#include "common/gameDetector.h"
#include "common/config-file.h"
-#include "gui/newgui.h"
-#include "gui/message.h"
-#include "sound/mixer.h"
-#include "sound/mididrv.h"
#ifdef _WIN32_WCE
extern void drawError(char*);
@@ -150,7 +149,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
if (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0))
_system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
}
-
+#ifndef __GP32__ //ph0x FIXME, "quick dirty hack"
/* Bind the mixer to the system => mixer will be invoked
* automatically when samples need to be generated */
_silentDigitalImuse = false;
@@ -188,7 +187,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
_imuse->set_music_volume(_sound->_sound_volume_music);
}
-
+#endif // ph0x-hack
// Load game from specified slot, if any
if (detector->_save_slot != -1) {
@@ -1362,6 +1361,10 @@ void NORETURN CDECL error(const char *s, ...)
vsprintf(buf, s, va);
va_end(va);
+#ifdef __GP32__ //ph0x FIXME?
+ printf("ERROR: %s\n", buf);
+#endif
+
if (g_scumm && g_scumm->_currentScript != 0xFF) {
ScriptSlot *ss = &g_scumm->vm.slot[g_scumm->_currentScript];
fprintf(stderr, "Error(%d:%d:0x%X): %s!\n",
@@ -1419,11 +1422,11 @@ void Scumm::waitForTimer(int msec_delay) {
switch(event.event_code) {
case OSystem::EVENT_KEYDOWN:
if (event.kbd.keycode >= '0' && event.kbd.keycode<='9'
- && (event.kbd.flags == OSystem::KBD_ALT ||
+ && (event.kbd.flags == OSystem::KBD_SHIFT ||
event.kbd.flags == OSystem::KBD_CTRL)) {
_saveLoadSlot = event.kbd.keycode - '0';
sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
- _saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
+ _saveLoadFlag = (event.kbd.flags == OSystem::KBD_SHIFT) ? 1 : 2;
_saveLoadCompatible = false;
} else if (event.kbd.flags==OSystem::KBD_CTRL) {
if (event.kbd.keycode=='f')