From 2df00cd64bed217bb5ee1d133a9d43eea49bd467 Mon Sep 17 00:00:00 2001
From: stephena <stephena@8b62c5a3-ac7e-4cc8-8f21-d9a121418aba>
Date: Sat, 21 May 2005 19:35:59 +0000
Subject: [PATCH] Fixed inttypes support so that Stella compiles in Visual C+
 .Net (which is currently the lowest supported version of Visual Studio that
 Stella can be compiled in).  It seems that VS.Net already knows about the
 inttypes, so an explicit 'include <inttypes.h>' isn't required.  However,
 when compiling under MingW, the include *is* required.

MingW is still the preferred environment for compiling Stella though, as
VS.Net doesn't read the SDL environment variables.  So if you're working
on Stella, feel free to use VS.Net (as long as you don't use anything
specific to that environment).  But all binary releases of Stella will use
MingW, and code that doesn't work in MingW will be reworked/removed.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@435 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
---
 stella/src/build/makefile                      | 11 +++++++++--
 stella/src/emucore/TIA.cxx                     |  8 +++-----
 stella/src/emucore/m6502/src/bspf/src/bspf.hxx | 16 ++++------------
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/stella/src/build/makefile b/stella/src/build/makefile
index b0c057337..ecdfcae56 100644
--- a/stella/src/build/makefile
+++ b/stella/src/build/makefile
@@ -13,7 +13,7 @@
 ## See the file "license" for information on usage and redistribution of
 ## this file, and for a DISCLAIMER OF ALL WARRANTIES.
 ##
-## $Id: makefile,v 1.82 2005-05-19 18:42:36 stephena Exp $
+## $Id: makefile,v 1.83 2005-05-21 19:35:58 stephena Exp $
 ##============================================================================
 
 ##============================================================================
@@ -46,6 +46,10 @@ OPTIMIZATIONS  =
 ### change to number of CPU's you have
  NUMBER_CPU = 1
 
+### to explictly provide inttypes.h
+### some platforms include it as part of another header, so including
+### it again would cause an error
+ HAVE_INTTYPES = 1
 
 ##============================================================================
 ## All done, type make to get a list of frontends
@@ -106,7 +110,10 @@ ifdef SOUND_SUPPORT
   OPTIONS += -DSOUND_SUPPORT
 endif
 
-
+ifdef SOUND_SUPPORT
+  OPTIONS += -DHAVE_INTTYPES
+endif
+    
 default:
 	@echo ""
 	@echo "To build Stella type: 'make <version>'"
diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx
index 59a3818df..82636cff5 100644
--- a/stella/src/emucore/TIA.cxx
+++ b/stella/src/emucore/TIA.cxx
@@ -13,7 +13,7 @@
 // See the file "license" for information on usage and redistribution of
 // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 //
-// $Id: TIA.cxx,v 1.42 2005-05-21 16:12:13 stephena Exp $
+// $Id: TIA.cxx,v 1.43 2005-05-21 19:35:58 stephena Exp $
 //============================================================================
 
 #include <cassert>
@@ -21,8 +21,6 @@
 #include <cstring>
 #include <iostream>
 
-#include <inttypes.h>
-
 #include "Console.hxx"
 #include "Control.hxx"
 #include "M6502.hxx"
@@ -249,7 +247,7 @@ void TIA::systemCyclesReset()
   uInt32 cycles = mySystem->cycles();
 
   // Adjust the sound cycle indicator
-  mySound->adjustCycleCounter(-cycles);
+  mySound->adjustCycleCounter(-1 * cycles);
 
   // Adjust the dump cycle
   myDumpDisabledCycle -= cycles;
@@ -503,7 +501,7 @@ void TIA::update()
   mySystem->resetCycles();
 
   // Setup clocks that'll be used for drawing this frame
-  myClockWhenFrameStarted = -clocks;
+  myClockWhenFrameStarted = -1 * clocks;
   myClockStartDisplay = myClockWhenFrameStarted + myStartDisplayOffset;
   myClockStopDisplay = myClockWhenFrameStarted + myStopDisplayOffset;
   myClockAtLastUpdate = myClockStartDisplay;
diff --git a/stella/src/emucore/m6502/src/bspf/src/bspf.hxx b/stella/src/emucore/m6502/src/bspf/src/bspf.hxx
index 71854591a..cd703a25e 100644
--- a/stella/src/emucore/m6502/src/bspf/src/bspf.hxx
+++ b/stella/src/emucore/m6502/src/bspf/src/bspf.hxx
@@ -13,7 +13,7 @@
 // See the file "license" for information on usage and redistribution of
 // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 //
-// $Id: bspf.hxx,v 1.4 2004-05-28 22:07:57 stephena Exp $
+// $Id: bspf.hxx,v 1.5 2005-05-21 19:35:59 stephena Exp $
 //============================================================================
 
 #ifndef BSPF_HXX
@@ -24,7 +24,7 @@
   that need to be defined for different operating systems.
 
   @author Bradford W. Mott
-  @version $Id: bspf.hxx,v 1.4 2004-05-28 22:07:57 stephena Exp $
+  @version $Id: bspf.hxx,v 1.5 2005-05-21 19:35:59 stephena Exp $
 */
 
 // Types for 8-bit signed and unsigned integers
@@ -52,16 +52,8 @@ typedef unsigned int uInt32;
   using namespace std;
 #endif
 
-#ifdef BSPF_WIN32
-  // pragma to avoid all of the int <-> bool conversion warnings
-//  #pragma warning(disable: 4800)
-#endif
-
-// Some old compilers do not support the bool type
-#ifdef BSPF_BOOL
-  #define bool int
-  #define true 1
-  #define false 0
+#ifdef HAVE_INTTYPES
+  #include <inttypes.h>
 #endif
 
 // Defines to help with path handling