Commit of the X11 driver using the new OSystem interface. Plus some warning fixes and gameDetector hacks.

svn-id: r4024
This commit is contained in:
Lionel Ulmer 2002-04-20 17:41:42 +00:00
parent 32d69e8c02
commit c673d1c760
8 changed files with 551 additions and 539 deletions

46
Makefile.x11 Normal file
View file

@ -0,0 +1,46 @@
# $Header$
CC = gcc
CFLAGS = -g -O -Wall -Wstrict-prototypes -Wuninitialized -Wno-long-long -Wno-multichar -DCOMPRESSED_SOUND_FILE
DEFINES = -DUNIX_X11
LDFLAGS := -L/usr/X11R6/lib -L/usr/local/lib
INCLUDES:= -I/usr/X11R6/include -I./ -I./sound -I/usr/local/include
CPPFLAGS= $(DEFINES) $(INCLUDES)
# Add -lmad for -DCOMPRESSED_SOUND_FILE
LIBS = -lXext -lX11 -lncurses -lm -lmad -lpthread
ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
INCS = scumm.h scummsys.h stdafx.h
OBJS = actor.o boxes.o costume.o gfx.o object.o resource.o \
saveload.o script.o scummvm.o sound.o string.o \
sys.o verbs.o script_v1.o script_v2.o debug.o gui.o \
sound/imuse.o sound/fmopl.o sound/mixer.o debugrl.o \
akos.o vars.o insane.o gameDetector.o init.o mp3_cd.o\
v3/resource_v3.o v4/resource_v4.o 2xsai.o main.o \
simon/midi.o simon/simon.o simon/simonsys.o sound/mididrv.o x11.o
DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \
scummvm.dsp scummvm.dsw sound/fmopl.h gui.h sound.h
.cpp.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
all: scummvm
scummvm: $(OBJS)
$(CC) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
$(OBJS): Makefile
clean:
rm -f $(OBJS) scummvm
dist:
rm -f $(ZIPFILE)
zip -q $(ZIPFILE) $(DISTFILES)
check:
$(OBJS): $(INCS)

View file

@ -340,12 +340,21 @@ int GameDetector::detectMain(int argc, char **argv)
_noSubtitles = 0; // use by default - should this depend on soundtrack? _noSubtitles = 0; // use by default - should this depend on soundtrack?
_gfx_mode = GFX_DOUBLESIZE; _gfx_mode = GFX_DOUBLESIZE;
_gfx_driver = GD_AUTO;
_sfx_volume = 100; _sfx_volume = 100;
#ifdef USE_NULL_DRIVER #if defined(USE_NULL_DRIVER)
_gfx_driver = GD_NULL; _gfx_driver = GD_NULL;
#elif defined(__DC__)
_gfx_driver = GD_DC;
#elif defined(UNIX_X11)
_gfx_driver = GD_X;
#elif defined(__MORPHOS__)
_gfx_driver = GD_MORPHOS;
#elif defined(WIN32_WCE)
_gfx_driver = GD_WINCE;
#else
/* SDL is the default driver for now */
_gfx_driver = GD_SDL;
#endif #endif
_gameDataPath = NULL; _gameDataPath = NULL;
@ -396,41 +405,26 @@ int GameDetector::detectMain(int argc, char **argv)
} }
OSystem *GameDetector::createSystem() { OSystem *GameDetector::createSystem() {
#ifdef __MORPHOS__
_gfx_driver = GD_MORPHOS;
#endif
/* auto is to use SDL */ /* auto is to use SDL */
switch(_gfx_driver) { switch(_gfx_driver) {
#ifdef __DC__ #if defined(UNIX_X11)
case GD_AUTO:
return OSystem_Dreamcast_create();
#else
case GD_SDL:
case GD_AUTO:
#ifdef _WIN32_WCE
return OSystem_WINCE3_create();
#endif
#if !defined(__MORPHOS__)
return OSystem_SDL_create(_gfx_mode, _fullScreen);
#endif
case GD_WIN32:
/* not implemented yet */
break;
case GD_X: case GD_X:
/* not implemented yet */ return OSystem_X11_create();
break; #elif defined(__DC__)
case GD_DC:
return OSystem_Dreamcast_create();
#elif defined(WIN32_WCE)
case GD_WINCE:
return OSystem_WINCE3_create();
#elif defined(__MORPHOS__)
case GD_MORPHOS: case GD_MORPHOS:
#if defined(__MORPHOS__)
return OSystem_MorphOS_create(_gameId, _gfx_mode, _fullScreen); return OSystem_MorphOS_create(_gameId, _gfx_mode, _fullScreen);
#endif #elif defined(USE_NULL_DRIVER)
break;
#ifdef USE_NULL_DRIVER
case GD_NULL: case GD_NULL:
return OSystem_NULL_create(); return OSystem_NULL_create();
#endif #else
case GD_SDL:
return OSystem_SDL_create(_gfx_mode, _fullScreen);
#endif #endif
} }

View file

@ -911,7 +911,6 @@ void Scumm::o5_cursorCommand()
{ {
int i, j, k; int i, j, k;
int16 table[16]; int16 table[16];
byte origop = _opcode;
switch ((_opcode = fetchScriptByte()) & 0x1F) { switch ((_opcode = fetchScriptByte()) & 0x1F) {
case 1: /* cursor show */ case 1: /* cursor show */
_cursorState = 1; _cursorState = 1;

View file

@ -102,12 +102,19 @@ typedef signed long int32;
#define START_PACK_STRUCTS pack (push,1) #define START_PACK_STRUCTS pack (push,1)
#define END_PACK_STRUCTS pack(pop) #define END_PACK_STRUCTS pack(pop)
#elif (defined(UNIX) || defined(__APPLE__)) #elif (defined(UNIX) || defined(__APPLE__) || defined(UNIX_X11))
#define scumm_stricmp strcasecmp #define scumm_stricmp strcasecmp
#define CHECK_HEAP #define CHECK_HEAP
#ifdef UNIX_X11
/* You need to set those manually */
#define SCUMM_LITTLE_ENDIAN
/* #define SCUMM_NEED_ALIGNMENT */
#else
/* need this for the SDL_BYTEORDER define */ /* need this for the SDL_BYTEORDER define */
#include <SDL_byteorder.h> #include <SDL_byteorder.h>
@ -119,6 +126,7 @@ typedef signed long int32;
#else #else
#error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set. #error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set.
#endif #endif
#endif
#define FORCEINLINE inline #define FORCEINLINE inline
#define CDECL #define CDECL

View file

@ -220,7 +220,7 @@ struct VgaFile1Struct0x6 {
}; };
/* dummy typedefs to make it compile in *nix */ /* dummy typedefs to make it compile in *nix */
#if defined(UNIX) || defined(__MORPHOS__) || defined(__DC__) #if defined(UNIX) || defined(UNIX_X11) || defined(__MORPHOS__) || defined(__DC__)
typedef void* HMIDISTRM; typedef void* HMIDISTRM;
typedef void* HMIDIOUT; typedef void* HMIDIOUT;
typedef uint32 UINT; typedef uint32 UINT;

View file

@ -781,7 +781,7 @@ void MidiDriver::midiInitNull()
#ifdef WIN32 #ifdef WIN32
#include <winsock.h> #include <winsock.h>
#elif defined(UNIX) #elif (defined(UNIX) || defined(UNIX_X11))
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -122,6 +122,7 @@ OSystem *OSystem_NULL_create();
OSystem *OSystem_MorphOS_create(int game_id, int gfx_driver, bool full_screen); OSystem *OSystem_MorphOS_create(int game_id, int gfx_driver, bool full_screen);
OSystem *OSystem_Dreamcast_create(); OSystem *OSystem_Dreamcast_create();
OSystem *OSystem_WINCE3_create(); OSystem *OSystem_WINCE3_create();
OSystem *OSystem_X11_create();
enum { enum {
GFX_NORMAL = 0, GFX_NORMAL = 0,
@ -135,13 +136,12 @@ enum {
/* Graphics drivers */ /* Graphics drivers */
enum { enum {
GD_AUTO = 0, GD_NULL = 0,
GD_SDL = 1, GD_SDL,
GD_WIN32 = 2, GD_X,
GD_X = 3, GD_MORPHOS,
GD_NULL = 4, GD_WINCE,
GD_MORPHOS = 5, GD_DC
GD_WINCE = 6
}; };

959
x11.cpp

File diff suppressed because it is too large Load diff