From d6e397233f7abb76b60bae6c4a0dc8052c1b3e17 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 21 Feb 2009 22:40:58 +0000 Subject: [PATCH] SCI: More cleanup svn-id: r38758 --- engines/sci/engine/kfile.cpp | 11 +++++++++++ engines/sci/engine/scriptconsole.cpp | 1 - engines/sci/module.mk | 3 +++ engines/sci/sci.cpp | 2 -- engines/sci/scicore/resource.cpp | 4 ++-- engines/sci/scicore/resource_map.cpp | 5 +---- engines/sci/sfx/device/devices.cpp | 7 ++----- engines/sci/sfx/iterator.cpp | 7 ++----- engines/sci/sfx/seq/oss-adlib.cpp | 5 +---- engines/sci/tools.cpp | 7 +++++-- engines/sci/tools.h | 29 +++------------------------- 11 files changed, 30 insertions(+), 51 deletions(-) diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index e6cd961d805..16daa38f84b 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -38,12 +38,23 @@ #include #include // for S_IREAD/S_IWRITE +// FIXME: Get rid of the following (needed for O_RDONLY etc.) +#include + + namespace Sci { #ifndef O_BINARY #define O_BINARY 0 #endif +#ifdef WIN32 +# define FO_BINARY "b" +#else +# define FO_BINARY "" +#endif + + static int _savegame_indices_nr = -1; // means 'uninitialized' static struct _savegame_index_struct { diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index f7106194573..65cf110f610 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -696,7 +696,6 @@ static int c_version(EngineState * s) { return -1; } - sciprintf("FreeSCI, version " VERSION "\n"); sciprintf("Resource file version: %s\n", sci_version_types[s->resmgr->sci_version]); sciprintf("Emulated interpreter version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(s->version), SCI_VERSION_MINOR(s->version), SCI_VERSION_PATCHLEVEL(s->version)); diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 6e6c73716f3..00dfdbb0cf4 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -79,6 +79,9 @@ MODULE_OBJS = \ sfx/player/players.o \ sfx/player/polled.o \ sfx/player/realtime.o \ + sfx/seq/gm.o \ + sfx/seq/instrument-map.o \ + sfx/seq/map-mt32-to-gm.o \ sfx/seq/sequencers.o \ sfx/softseq/amiga.o \ sfx/softseq/opl2.o \ diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 17a9f5114a1..fc262334c18 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -229,8 +229,6 @@ Common::Error SciEngine::go() { map_MIDI_instruments(resmgr); #endif - sciprintf("Imported FreeSCI, version "VERSION"\n"); - EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState)); memset(gamestate, 0, sizeof(EngineState)); gamestate->resmgr = resmgr; diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index d12d261c019..5f2e2ce2778 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -396,7 +396,7 @@ static int _scir_scan_new_sources(ResourceManager *mgr, int *detected_version, R return NULL; } if (resource_error == SCI_ERROR_RESMAP_NOT_FOUND) { - // fixme: Try reading w/o resource.map + // FIXME: Try reading w/o resource.map resource_error = SCI_ERROR_NO_RESOURCE_FILES_FOUND; } @@ -414,7 +414,7 @@ static int _scir_scan_new_sources(ResourceManager *mgr, int *detected_version, R resource_error = sci1_read_resource_map(mgr, source, scir_get_volume(mgr, source, 0), &mgr->_resources, &mgr->_resourcesNr, detected_version); if (resource_error == SCI_ERROR_RESMAP_NOT_FOUND) { - // fixme: Try reading w/o resource.map + // FIXME: Try reading w/o resource.map resource_error = SCI_ERROR_NO_RESOURCE_FILES_FOUND; } diff --git a/engines/sci/scicore/resource_map.cpp b/engines/sci/scicore/resource_map.cpp index c30525584aa..93129f193d9 100644 --- a/engines/sci/scicore/resource_map.cpp +++ b/engines/sci/scicore/resource_map.cpp @@ -106,10 +106,7 @@ static int detect_odd_sci01(Common::File &file) { if (read_ok) { sprintf(filename, "resource.%03i", SCI0_RESFILE_GET_FILE(buf + 2)); - Common::File temp; - - // FIXME: Maybe better to use File::exists here? - if (!temp.open(filename)) { + if (!Common::File::exists(filename)) { files_ok = 0; break; } diff --git a/engines/sci/sfx/device/devices.cpp b/engines/sci/sfx/device/devices.cpp index c15c6e03a2a..a2d2cd58b3d 100644 --- a/engines/sci/sfx/device/devices.cpp +++ b/engines/sci/sfx/device/devices.cpp @@ -23,11 +23,8 @@ * */ -#ifdef HAVE_CONFIG_H -# include -#endif -#include "../device.h" -#include +#include "common/scummsys.h" +#include "sci/sfx/device.h" #include "sci/tools.h" diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 7e04883ffce..baa6572658b 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -48,9 +48,7 @@ void print_tabs_id(int nr, songit_id_t id) { fprintf(stderr, "[%08lx] ", id); } -#ifndef HAVE_MEMCHR -static void * -memchr(void *_data, int c, int n) { +static unsigned char *sci_memchr(void *_data, int c, int n) { unsigned char *data = (unsigned char *) _data; while (n && !(*data == c)) { @@ -63,7 +61,6 @@ memchr(void *_data, int c, int n) { else return NULL; } -#endif static void _common_init(base_song_iterator_t *self) { self->fade.action = FADE_ACTION_NONE; @@ -491,7 +488,7 @@ static int _sci0_get_pcm_data(sci0_song_iterator_t *self, while ((tries--) && (offset < self->size) && (!found_it)) { /* Search through the garbage manually */ - unsigned char *fc = (unsigned char*)memchr(self->data + offset, + unsigned char *fc = sci_memchr(self->data + offset, SCI0_END_OF_SONG, self->size - offset); diff --git a/engines/sci/sfx/seq/oss-adlib.cpp b/engines/sci/sfx/seq/oss-adlib.cpp index 24f936e089f..f1c7bbf1b9d 100644 --- a/engines/sci/sfx/seq/oss-adlib.cpp +++ b/engines/sci/sfx/seq/oss-adlib.cpp @@ -23,10 +23,7 @@ * */ -#include -#ifdef HAVE_UNISTD_H -# include -#endif +#include "common/scummsys.h" #include "../sequencer.h" #ifdef HAVE_SYS_SOUNDCARD_H diff --git a/engines/sci/tools.cpp b/engines/sci/tools.cpp index 95b5dd12751..95558afdb8c 100644 --- a/engines/sci/tools.cpp +++ b/engines/sci/tools.cpp @@ -47,6 +47,9 @@ #include "sci/include/engine.h" +// FIXME: Get rid of the following (needed for O_RDONLY etc.) +#include + namespace Sci { // FIXME: Get rid of G_DIR_SEPARATOR / G_DIR_SEPARATOR_S @@ -59,7 +62,7 @@ namespace Sci { #endif -#ifdef HAVE_SYS_TIME_H +#ifndef _MSC_VER # include #endif @@ -148,7 +151,7 @@ void _SCIGNUkdebug(const char *funcname, EngineState *s, const char *file, int l } -#if defined(HAVE_GETTIMEOFDAY) +#ifndef _MSC_VER void sci_gettime(long *seconds, long *useconds) { struct timeval tv; diff --git a/engines/sci/tools.h b/engines/sci/tools.h index a40c763b894..75280357426 100644 --- a/engines/sci/tools.h +++ b/engines/sci/tools.h @@ -44,27 +44,6 @@ /*#define _SCI_RESOURCE_DEBUG */ /*#define _SCI_DECOMPRESS_DEBUG*/ -//TODO: Remove these defines by replacing their functionality by their ScummVM counterparts -#define HAVE_MEMCHR -#define HAVE_FCNTL_H -#ifndef _MSC_VER -#define HAVE_UNISTD_H -#define HAVE_SYS_TIME_H -#define HAVE_GETTIMEOFDAY -#endif -#define VERSION "0.6.4" - -// FIXME: Mostly for close() in lots of places. Get rid of this! -#ifndef _MSC_VER -#include -#endif - -// FIXME: Get rid of the following (needed for O_RDONLY etc.) -#ifdef HAVE_FCNTL_H -# include -#endif - - // FIXME: rework sci_dir_t to use common/fs.h and remove these includes #include #ifndef _MSC_VER @@ -73,11 +52,9 @@ #include #endif - -#ifdef WIN32 -# define FO_BINARY "b" -#else -# define FO_BINARY "" +// FIXME: For chdir() etc. +#ifndef _MSC_VER +#include #endif namespace Sci {