From 311344b4451894120fa4688e431c67d5f08bd2fe Mon Sep 17 00:00:00 2001
From: Paweł Kołodziejski
Date: Sun, 15 Feb 2009 09:56:04 +0000
Subject: fixed msvc9 compilation
svn-id: r38208
---
dists/msvc9/sci.vcproj | 236 +++++++++++++++++++++++++++++++++++
engines/sci/engine/game.c | 14 ---
engines/sci/engine/kernel.c | 4 +
engines/sci/engine/kfile.c | 5 +
engines/sci/engine/scriptconsole.c | 4 +-
engines/sci/engine/scriptdebug.c | 22 +++-
engines/sci/gfx/gfx_res_options.c | 1 +
engines/sci/include/resource.h | 7 +-
engines/sci/include/sci_memory.h | 7 ++
engines/sci/include/scitypes.h | 6 +
engines/sci/include/sfx_core.h | 2 +
engines/sci/scicore/fnmatch.c | 2 -
engines/sci/scicore/games.h | 2 +-
engines/sci/scicore/resource_patch.c | 3 +
engines/sci/scicore/tools.c | 18 ++-
engines/sci/sfx/seq/sequencers.c | 2 +-
engines/sci/sfx/softseq/opl2.c | 4 +-
17 files changed, 314 insertions(+), 25 deletions(-)
diff --git a/dists/msvc9/sci.vcproj b/dists/msvc9/sci.vcproj
index d545e3759e..61a8b5efca 100644
--- a/dists/msvc9/sci.vcproj
+++ b/dists/msvc9/sci.vcproj
@@ -646,6 +646,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/engines/sci/engine/game.c b/engines/sci/engine/game.c
index d630b3c963..63d3fb9e94 100644
--- a/engines/sci/engine/game.c
+++ b/engines/sci/engine/game.c
@@ -25,20 +25,6 @@
***************************************************************************/
-
-/* Attempt to guess if recent version of Platform SDK */
-#ifdef _MSC_VER
-# pragma message("******************** IMPORTANT MESSAGE ********************")
-# pragma message("You must have installed a recent Platform and DirectX SDK")
-# pragma message("for this build to be successful. Download MS SDKs from:")
-# pragma message("www.microsoft.com/msdownload/platformsdk/sdkupdate")
-# pragma message("***********************************************************")
-# include
-# if (WINVER < 0x500)
-# error *** BUILD FAILED: Need more recent SDKs or fix your SDK paths in Tools Options ***
-# endif
-#endif
-
#include "sci/include/sciresource.h"
#include "sci/include/engine.h"
#include "sci/include/versions.h"
diff --git a/engines/sci/engine/kernel.c b/engines/sci/engine/kernel.c
index e0092bfb69..ec7ac6e241 100644
--- a/engines/sci/engine/kernel.c
+++ b/engines/sci/engine/kernel.c
@@ -32,6 +32,10 @@
# include
#endif /* _WIN32 */
+#ifdef _MSC_VER
+# include
+#endif
+
#include "sci/include/gfx_operations.h"
#include "sci/engine/kernel_types.h"
diff --git a/engines/sci/engine/kfile.c b/engines/sci/engine/kfile.c
index de260ca4d7..04abbb8782 100644
--- a/engines/sci/engine/kfile.c
+++ b/engines/sci/engine/kfile.c
@@ -27,6 +27,11 @@
#include "sci/include/engine.h"
+
+#ifdef _MSC_VER
+#define MAX_PATHLEN MAXPATHLEN
+#endif
+
#ifdef _WIN32
# ifndef PATH_MAX
# define PATH_MAX 255
diff --git a/engines/sci/engine/scriptconsole.c b/engines/sci/engine/scriptconsole.c
index 661fa253e9..d208210d4a 100644
--- a/engines/sci/engine/scriptconsole.c
+++ b/engines/sci/engine/scriptconsole.c
@@ -27,8 +27,8 @@
/* Second half of the console implementation: VM dependent stuff */
/* Remember, it doesn't have to be fast. */
-#include
-#include
+#include "sci/include/sci_memory.h"
+#include "sci/include/engine.h"
#ifdef SCI_CONSOLE
state_t *con_gamestate = NULL;
diff --git a/engines/sci/engine/scriptdebug.c b/engines/sci/engine/scriptdebug.c
index a3e31e3b7c..36d80c01c8 100644
--- a/engines/sci/engine/scriptdebug.c
+++ b/engines/sci/engine/scriptdebug.c
@@ -37,10 +37,30 @@
#include "sci/include/reg_t_hashmap.h"
#ifdef _WIN32
-# include
# include
# include
#endif
+
+# ifdef sleep
+# undef sleep
+# endif
+
+#ifdef _MSC_VER
+# include
+# define sleep(x) \
+ do { \
+ if (x == 0) { \
+ Sleep(0); \
+ } else { \
+ if (timeBeginPeriod(1) != TIMERR_NOERROR) \
+ fprintf(stderr, "timeBeginPeriod(1) failed\n"); \
+ Sleep(x); \
+ if (timeEndPeriod(1) != TIMERR_NOERROR) \
+ fprintf(stderr, "timeEndPeriod(1) failed\n"); \
+ } \
+ } while (0);
+#endif
+
#ifdef HAVE_UNISTD_H
# include
/* Assume this is a sufficient precondition */
diff --git a/engines/sci/gfx/gfx_res_options.c b/engines/sci/gfx/gfx_res_options.c
index 0692fece0f..0a58f5aa94 100644
--- a/engines/sci/gfx/gfx_res_options.c
+++ b/engines/sci/gfx/gfx_res_options.c
@@ -30,6 +30,7 @@
#include "sci/include/gfx_system.h"
#include "sci/include/gfx_options.h"
#include "sci/include/gfx_resmgr.h"
+#include "sci/include/resource.h"
#include
diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h
index aa3e31a671..03069006ac 100644
--- a/engines/sci/include/resource.h
+++ b/engines/sci/include/resource.h
@@ -60,6 +60,7 @@
#ifdef SCUMMVM
//TODO: Remove these defines by replacing their functionality by their ScummVM counterparts
#define HAVE_ISBLANK
+#ifndef _MSC_VER
#define HAVE_UNISTD_H
#define HAVE_FCNTL_H
#define HAVE_UNLINK
@@ -68,6 +69,7 @@
#define HAVE_FNMATCH_H
#define HAVE_SYS_TIME_H
#define HAVE_GETTIMEOFDAY
+#endif
#define VERSION "0.6.4"
#endif // SCUMMVM
@@ -107,7 +109,6 @@
#ifdef _WIN32
# include
-# include
#else /* !_WIN32 */
# define DLLEXTERN
#endif /* !_WIN32 */
@@ -121,6 +122,10 @@
# include
# include
# include
+# undef strcasecmp
+# undef strncasecmp
+# define strcasecmp _stricmp
+# define strncasecmp _strnicmp
#endif
diff --git a/engines/sci/include/sci_memory.h b/engines/sci/include/sci_memory.h
index 9ef7fa41cb..4b02454e1d 100644
--- a/engines/sci/include/sci_memory.h
+++ b/engines/sci/include/sci_memory.h
@@ -81,6 +81,13 @@
# define scim_inline inline
#endif
+#ifdef _MSC_VER
+# undef strcasecmp
+# undef strncasecmp
+# define strcasecmp _stricmp
+# define strncasecmp _strnicmp
+#endif
+
/********** macros for error messages **********/
/*
diff --git a/engines/sci/include/scitypes.h b/engines/sci/include/scitypes.h
index b252d59565..be13a1d03b 100644
--- a/engines/sci/include/scitypes.h
+++ b/engines/sci/include/scitypes.h
@@ -33,7 +33,13 @@
// TODO: rework sci_dir_t to use common/fs.h and remove these includes
#include
+#ifndef _MSC_VER
#include
+#else
+#include
+# undef inline /* just to be sure it is not defined */
+# define inline __inline
+#endif
typedef int8 gint8;
typedef uint8 guint8;
diff --git a/engines/sci/include/sfx_core.h b/engines/sci/include/sfx_core.h
index 9a04e9f9e5..3b8498b5bc 100644
--- a/engines/sci/include/sfx_core.h
+++ b/engines/sci/include/sfx_core.h
@@ -30,7 +30,9 @@
#ifndef _SFX_CORE_H_
#define _SFX_CORE_H_
+#ifndef _MSC_VER
#include
+#endif
#define SFX_OK 0
#define SFX_ERROR -1
diff --git a/engines/sci/scicore/fnmatch.c b/engines/sci/scicore/fnmatch.c
index ffc9a1b451..a3b5a0ad69 100644
--- a/engines/sci/scicore/fnmatch.c
+++ b/engines/sci/scicore/fnmatch.c
@@ -27,8 +27,6 @@
#include /* for debugging */
-#include
-#include
#include
#if defined (HAVE_STRING_H)
diff --git a/engines/sci/scicore/games.h b/engines/sci/scicore/games.h
index d8b9642fba..b5c4a02b29 100644
--- a/engines/sci/scicore/games.h
+++ b/engines/sci/scicore/games.h
@@ -32,7 +32,7 @@
# error "You shouldn't be including this header file."
#endif
-#include
+#include "sci/include/versions.h"
typedef struct _sci_game {
int id; /* currently CRC of resource.001 */
diff --git a/engines/sci/scicore/resource_patch.c b/engines/sci/scicore/resource_patch.c
index b17058c09b..037b082476 100644
--- a/engines/sci/scicore/resource_patch.c
+++ b/engines/sci/scicore/resource_patch.c
@@ -29,6 +29,9 @@
#include "sci/include/sciresource.h"
#include "sci/include/sci_memory.h"
+#ifdef _WIN32
+#include
+#endif
void
sci0_sprintf_patch_file_name(char *string, resource_t *res)
diff --git a/engines/sci/scicore/tools.c b/engines/sci/scicore/tools.c
index 11bc00d5a7..802a4f9db1 100644
--- a/engines/sci/scicore/tools.c
+++ b/engines/sci/scicore/tools.c
@@ -35,9 +35,25 @@
#ifdef _MSC_VER
# include
# include
-# include
+# include
# include
# include
+# ifdef sleep
+# undef sleep
+# endif
+
+# define sleep(x) \
+ do { \
+ if (x == 0) { \
+ Sleep(0); \
+ } else { \
+ if (timeBeginPeriod(1) != TIMERR_NOERROR) \
+ fprintf(stderr, "timeBeginPeriod(1) failed\n"); \
+ Sleep(x); \
+ if (timeEndPeriod(1) != TIMERR_NOERROR) \
+ fprintf(stderr, "timeEndPeriod(1) failed\n"); \
+ } \
+ } while (0);
#else
#ifdef _WIN32
# include
diff --git a/engines/sci/sfx/seq/sequencers.c b/engines/sci/sfx/seq/sequencers.c
index cb43381fa9..3ba7f25a46 100644
--- a/engines/sci/sfx/seq/sequencers.c
+++ b/engines/sci/sfx/seq/sequencers.c
@@ -26,7 +26,7 @@
***************************************************************************/
#include "../sequencer.h"
-#include
+#include "sci/include/resource.h"
#ifndef SCUMMVM
extern sfx_sequencer_t sfx_sequencer_gm;
diff --git a/engines/sci/sfx/softseq/opl2.c b/engines/sci/sfx/softseq/opl2.c
index ed2f3001c8..c19de1388a 100644
--- a/engines/sci/sfx/softseq/opl2.c
+++ b/engines/sci/sfx/softseq/opl2.c
@@ -17,8 +17,8 @@
***************************************************************************/
-#include
-#include
+#include "sci/include/resource.h"
+#include "sci/include/sfx_iterator.h"
#include "../softseq.h"
#include "../adlib.h"
#include
--
cgit v1.2.3