SCI: More cleanup

svn-id: r38758
This commit is contained in:
Max Horn 2009-02-21 22:40:58 +00:00
parent 41b1f19a5d
commit d6e397233f
11 changed files with 30 additions and 51 deletions

View file

@ -38,12 +38,23 @@
#include <errno.h> #include <errno.h>
#include <sys/stat.h> // for S_IREAD/S_IWRITE #include <sys/stat.h> // for S_IREAD/S_IWRITE
// FIXME: Get rid of the following (needed for O_RDONLY etc.)
#include <fcntl.h>
namespace Sci { namespace Sci {
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
#ifdef WIN32
# define FO_BINARY "b"
#else
# define FO_BINARY ""
#endif
static int _savegame_indices_nr = -1; // means 'uninitialized' static int _savegame_indices_nr = -1; // means 'uninitialized'
static struct _savegame_index_struct { static struct _savegame_index_struct {

View file

@ -696,7 +696,6 @@ static int c_version(EngineState * s) {
return -1; return -1;
} }
sciprintf("FreeSCI, version " VERSION "\n");
sciprintf("Resource file version: %s\n", sci_version_types[s->resmgr->sci_version]); 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), sciprintf("Emulated interpreter version: %d.%03d.%03d\n", SCI_VERSION_MAJOR(s->version),
SCI_VERSION_MINOR(s->version), SCI_VERSION_PATCHLEVEL(s->version)); SCI_VERSION_MINOR(s->version), SCI_VERSION_PATCHLEVEL(s->version));

View file

@ -79,6 +79,9 @@ MODULE_OBJS = \
sfx/player/players.o \ sfx/player/players.o \
sfx/player/polled.o \ sfx/player/polled.o \
sfx/player/realtime.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/seq/sequencers.o \
sfx/softseq/amiga.o \ sfx/softseq/amiga.o \
sfx/softseq/opl2.o \ sfx/softseq/opl2.o \

View file

@ -229,8 +229,6 @@ Common::Error SciEngine::go() {
map_MIDI_instruments(resmgr); map_MIDI_instruments(resmgr);
#endif #endif
sciprintf("Imported FreeSCI, version "VERSION"\n");
EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState)); EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState));
memset(gamestate, 0, sizeof(EngineState)); memset(gamestate, 0, sizeof(EngineState));
gamestate->resmgr = resmgr; gamestate->resmgr = resmgr;

View file

@ -396,7 +396,7 @@ static int _scir_scan_new_sources(ResourceManager *mgr, int *detected_version, R
return NULL; return NULL;
} }
if (resource_error == SCI_ERROR_RESMAP_NOT_FOUND) { 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; 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), resource_error = sci1_read_resource_map(mgr, source, scir_get_volume(mgr, source, 0),
&mgr->_resources, &mgr->_resourcesNr, detected_version); &mgr->_resources, &mgr->_resourcesNr, detected_version);
if (resource_error == SCI_ERROR_RESMAP_NOT_FOUND) { 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; resource_error = SCI_ERROR_NO_RESOURCE_FILES_FOUND;
} }

View file

@ -106,10 +106,7 @@ static int detect_odd_sci01(Common::File &file) {
if (read_ok) { if (read_ok) {
sprintf(filename, "resource.%03i", SCI0_RESFILE_GET_FILE(buf + 2)); sprintf(filename, "resource.%03i", SCI0_RESFILE_GET_FILE(buf + 2));
Common::File temp; if (!Common::File::exists(filename)) {
// FIXME: Maybe better to use File::exists here?
if (!temp.open(filename)) {
files_ok = 0; files_ok = 0;
break; break;
} }

View file

@ -23,11 +23,8 @@
* *
*/ */
#ifdef HAVE_CONFIG_H #include "common/scummsys.h"
# include <config.h> #include "sci/sfx/device.h"
#endif
#include "../device.h"
#include <stdio.h>
#include "sci/tools.h" #include "sci/tools.h"

View file

@ -48,9 +48,7 @@ void print_tabs_id(int nr, songit_id_t id) {
fprintf(stderr, "[%08lx] ", id); fprintf(stderr, "[%08lx] ", id);
} }
#ifndef HAVE_MEMCHR static unsigned char *sci_memchr(void *_data, int c, int n) {
static void *
memchr(void *_data, int c, int n) {
unsigned char *data = (unsigned char *) _data; unsigned char *data = (unsigned char *) _data;
while (n && !(*data == c)) { while (n && !(*data == c)) {
@ -63,7 +61,6 @@ memchr(void *_data, int c, int n) {
else else
return NULL; return NULL;
} }
#endif
static void _common_init(base_song_iterator_t *self) { static void _common_init(base_song_iterator_t *self) {
self->fade.action = FADE_ACTION_NONE; 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)) { while ((tries--) && (offset < self->size) && (!found_it)) {
/* Search through the garbage manually */ /* 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, SCI0_END_OF_SONG,
self->size - offset); self->size - offset);

View file

@ -23,10 +23,7 @@
* *
*/ */
#include <stdio.h> #include "common/scummsys.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "../sequencer.h" #include "../sequencer.h"
#ifdef HAVE_SYS_SOUNDCARD_H #ifdef HAVE_SYS_SOUNDCARD_H

View file

@ -47,6 +47,9 @@
#include "sci/include/engine.h" #include "sci/include/engine.h"
// FIXME: Get rid of the following (needed for O_RDONLY etc.)
#include <fcntl.h>
namespace Sci { namespace Sci {
// FIXME: Get rid of G_DIR_SEPARATOR / G_DIR_SEPARATOR_S // FIXME: Get rid of G_DIR_SEPARATOR / G_DIR_SEPARATOR_S
@ -59,7 +62,7 @@ namespace Sci {
#endif #endif
#ifdef HAVE_SYS_TIME_H #ifndef _MSC_VER
# include <sys/time.h> # include <sys/time.h>
#endif #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) { void sci_gettime(long *seconds, long *useconds) {
struct timeval tv; struct timeval tv;

View file

@ -44,27 +44,6 @@
/*#define _SCI_RESOURCE_DEBUG */ /*#define _SCI_RESOURCE_DEBUG */
/*#define _SCI_DECOMPRESS_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 <unistd.h>
#endif
// FIXME: Get rid of the following (needed for O_RDONLY etc.)
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
// FIXME: rework sci_dir_t to use common/fs.h and remove these includes // FIXME: rework sci_dir_t to use common/fs.h and remove these includes
#include <sys/types.h> #include <sys/types.h>
#ifndef _MSC_VER #ifndef _MSC_VER
@ -73,11 +52,9 @@
#include <io.h> #include <io.h>
#endif #endif
// FIXME: For chdir() etc.
#ifdef WIN32 #ifndef _MSC_VER
# define FO_BINARY "b" #include <unistd.h>
#else
# define FO_BINARY ""
#endif #endif
namespace Sci { namespace Sci {