ref: ff3cdf8959575c3018d03ecee76a7cb98a4b2754
parent: 284ae8bef0b4c30b9fa33120b0e850cee28b6bc5
author: unknown <fabien@fabien-PC.(none)>
date: Thu Dec 13 12:43:42 EST 2012
Building and Running on Windows :) !
--- a/Engine/src/a.h
+++ b/Engine/src/a.h
@@ -8,7 +8,11 @@
#ifndef _INCLUDE_A_H_
#define _INCLUDE_A_H_
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
#ifdef __cplusplus
extern "C" {
--- a/Engine/src/build.h
+++ b/Engine/src/build.h
@@ -7,8 +7,11 @@
#ifndef _INCLUDE_BUILD_H_
#define _INCLUDE_BUILD_H_
-
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
#define MAXSECTORS 1024
#define MAXWALLS 8192
--- a/Engine/src/cache1d.c
+++ b/Engine/src/cache1d.c
@@ -23,7 +23,7 @@
#include "../../Game/src/cvar_defs.h"
#include "types.h"
-#include "file_lib.H"
+//#include "file_lib.H"
#if (defined USE_PHYSICSFS)
#include "physfs.h"
@@ -555,7 +555,7 @@
return (crc);
}
-int32_t kopen4load(const uint8_t *filename, int readfromGRP)
+int32_t kopen4load(const char *filename, int readfromGRP)
{ // FIX_00072: all files are now 1st searched in Duke's root folder and then in the GRP.
#if (defined USE_PHYSICSFS)
int i;
@@ -1000,9 +1000,9 @@
}
-int32_t TCkopen4load(const uint8_t *filename, int readfromGRP)
+int32_t TCkopen4load(const char *filename, int readfromGRP)
{
- uint8_t fullfilename[512];
+ char fullfilename[512];
int32_t result = 0;
if(game_dir[0] != '\0' && !readfromGRP)
--- a/Engine/src/cache1d.h
+++ b/Engine/src/cache1d.h
@@ -29,7 +29,7 @@
void uninitgroupfile(void);
unsigned short crc16(uint8_t *data_p, unsigned short length);
unsigned int crc32_update(uint8_t *buf, unsigned int length, unsigned int crc_to_update);
-int32_t kopen4load(const uint8_t *filename, int readfromGRP);
+int32_t kopen4load(const char *filename, int readfromGRP);
int32_t kread(int32_t handle, void *buffer, int32_t leng);
int kread8(int32_t handle, uint8_t *buffer);
int kread16(int32_t handle, short *buffer);
--- a/Engine/src/display.h
+++ b/Engine/src/display.h
@@ -68,7 +68,7 @@
/* set these in your _platform_init() implementation. */
extern int _argc;
-extern uint8_t **_argv;
+extern char **_argv;
/* !!! gads, look at all the namespace polution... */
extern int32_t xres, yres, bytesperline, imageSize, maxpages;
@@ -101,7 +101,7 @@
/* these need to be implemented by YOUR driver. */
-void _platform_init(int argc, uint8_t **argv, const uint8_t *title, const uint8_t *icon);
+void _platform_init(int argc, char **argv, const char *title, const char *iconName);
void _idle(void);
void _handle_events(void);
void *_getVideoBase(void);
--- a/Engine/src/enet/include/enet.h
+++ b/Engine/src/enet/include/enet.h
@@ -384,7 +384,7 @@
@retval < 0 on failure
@returns the address of the given hostName in address on success
*/
-extern int enet_address_set_host (ENetAddress *address, const uint8_t *hostName );
+extern int enet_address_set_host (ENetAddress *address, const char *hostName );
/** Attempts to do a reserve lookup of the host field in the address parameter.
@param address address used for reverse lookup
--- a/Engine/src/enet/include/types.h
+++ b/Engine/src/enet/include/types.h
@@ -5,7 +5,11 @@
#ifndef __ENET_TYPES_H__
#define __ENET_TYPES_H__
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
typedef uint8_t enet_uint8; /**< unsigned 8-bit type */
typedef unsigned short enet_uint16; /**< unsigned 16-bit type */
--- a/Engine/src/enet/win32.c
+++ b/Engine/src/enet/win32.c
@@ -67,7 +67,7 @@
}
int
-enet_address_set_host (ENetAddress * address, const uint8_t * name)
+enet_address_set_host (ENetAddress * address, const char * name)
{
struct hostent * hostEntry;
--- a/Engine/src/engine_protos.h
+++ b/Engine/src/engine_protos.h
@@ -24,67 +24,6 @@
/* Prototypes for the build engine */
-#if 0
-/* game.c */
-extern void initsb(uint8_t dadigistat, uint8_t damusistat, int32_t dasamplerate, uint8_t danumspeakers, uint8_t dabytespersample, uint8_t daintspersec, uint8_t daquality);
-extern void uninitsb(void);
-extern int loadsong(uint8_t *filename);
-extern void musicon(void);
-extern void musicoff(void);
-extern void wsayfollow(uint8_t *dafilename, int32_t dafreq, int32_t davol, int32_t *daxplc, int32_t *dayplc, uint8_t followstat);
-extern void wsay(uint8_t *dafilename, int32_t dafreq, int32_t volume1, int32_t volume2);
-extern void preparesndbuf(void);
-extern void setears(int32_t daposx, int32_t daposy, int32_t daxvect, int32_t dayvect);
-extern void timerhandler(void);
-extern void keyhandler(void);
-extern void initlava(void);
-extern void movelava(uint8_t *dapic);
-extern void drawtilebackground(int32_t thex, int32_t they, short tilenum, int8_t shade, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, uint8_t dapalnum);
-extern void printext(int32_t x, int32_t y, uint8_t *buffer, short tilenum, uint8_t invisiblecol);
-extern void drawstatusflytime(short snum);
-extern void drawstatusbar(short snum);
-extern void setup3dscreen(void);
-extern void setinterpolation(int32_t *posptr);
-extern void stopinterpolation(int32_t *posptr);
-extern void updateinterpolations(void);
-extern void restoreinterpolations(void);
-extern void searchmap(short startsector);
-extern void prepareboard(uint8_t *daboardfilename);
-extern int32_t changehealth(short snum, short deltahealth);
-extern void changenumbombs(short snum, short deltanumbombs);
-extern void changenummissiles(short snum, short deltanummissiles);
-extern void changenumgrabbers(short snum, short deltanumgrabbers);
-extern void findrandomspot(int32_t *x, int32_t *y, short *sectnum);
-extern void operatesector(short dasector);
-extern void shootgun(short snum, int32_t x, int32_t y, int32_t z, short daang, int32_t dahoriz, short dasectnum, uint8_t guntype);
-extern void operatesprite(short dasprite);
-extern void checktouchsprite(short snum, short sectnum);
-extern void checkgrabbertouchsprite(short snum, short sectnum);
-extern void activatehitag(short dahitag);
-extern void processinput(short snum);
-extern void movethings(void);
-extern void fakedomovethings(void);
-extern void fakedomovethingscorrect(void);
-extern void doanimations(void);
-extern void warp(int32_t *x, int32_t *y, int32_t *z, short *daang, short *dasector);
-extern void warpsprite(short spritenum);
-extern int testneighborsectors(short sect1, short sect2);
-extern void tagcode(void);
-extern void bombexplode(int32_t i);
-extern void statuslistcode(void);
-extern void checkmasterslaveswitch(void);
-extern void getpackets(void);
-extern void initplayersprite(short snum);
-extern void analyzesprites(int32_t dax, int32_t day);
-extern void updatesectorz(int32_t x, int32_t y, int32_t z, short *sectnum);
-extern void drawoverheadmap(int32_t cposx, int32_t cposy, int32_t czoom, short cang);
-extern void drawscreen(short snum, int32_t dasmoothratio);
-extern int loadgame(void);
-extern int savegame(void);
-extern void faketimerhandler(void);
-extern void waitforeverybody(void);
-#endif
-
/* cache1d.c */
extern void initcache(int32_t dacachestart, int32_t dacachesize);
extern void allocache(int32_t *newhandle, int32_t newbytes, uint8_t *newlockptr);
@@ -93,7 +32,7 @@
extern void reportandexit(uint8_t *errormessage);
extern int32_t initgroupfile(const uint8_t *filename);
extern void uninitgroupfile(void);
-extern int32_t kopen4load(const uint8_t *filename,int readfromGRP);
+extern int32_t kopen4load(const char *filename,int readfromGRP);
extern int32_t kread(int32_t handle, void *buffer, int32_t leng);
extern int32_t klseek(int32_t handle, int32_t offset, int32_t whence);
extern int32_t kfilelength(int32_t handle);
@@ -110,7 +49,7 @@
extern uint8_t _readlastkeyhit(void);
extern int mprotect_align(const void *addr, size_t len, int prot);
extern void unprotect_ASM_pages(void);
-extern void _platform_init(int argc, uint8_t **argv, const uint8_t *title, const uint8_t *icon);
+extern void _platform_init(int argc, char **argv, const char *title, const char *icon);
extern int setvesa(int32_t x, int32_t y);
extern int screencapture(uint8_t *filename, uint8_t inverseit);
extern void setvmode(int mode);
--- a/Engine/src/mmulti_stable.cpp
+++ b/Engine/src/mmulti_stable.cpp
@@ -487,7 +487,7 @@
for(i = 0; i < gcom->numplayers-1; ++i)
{
ENetPeer *peer;
- char szHostName[64];
+ uint8_t szHostName[64];
address.host = allowed_addresses[i].host; //ip;
@@ -710,7 +710,7 @@
address.host = pEvent->peer->address.host; //ip;
address.port = pEvent->peer->address.port; //m_nPort;
- char szHostName[64];
+ uint8_t szHostName[64];
enet_address_get_host(&address, szHostName, 64);
printf("Connection Established with: (%s)\n", szHostName);
--- a/Engine/src/pragmas.h
+++ b/Engine/src/pragmas.h
@@ -8,7 +8,7 @@
#ifndef __PRAGMAS_H__
#define __PRAGMAS_H__
-#include "platform.h" //for __int64
+#include "platform.h"
static __inline void swapchar(uint8_t *p1, uint8_t *p2)
{ uint8_t tmp = *p1; *p1 = *p2; *p2 = tmp; }
@@ -48,32 +48,32 @@
void vlin16first (int32_t i1, int32_t i2);
-static inline int sqr (int input1) { return input1*input1; }
+static inline int32_t sqr (int32_t input1) { return input1*input1; }
/* internal use:32x32 = 64bit */
-static inline int64_t mul32_64(int i1,int i2)
+static inline int64_t mul32_64(int32_t i1,int32_t i2)
{
- return (__int64)i1*i2;
+ return (int64_t)i1*i2;
}
-static inline int scale (int input1, int input2, int input3)
+static inline int scale (int32_t input1, int32_t input2, int32_t input3)
{
return (int)(mul32_64(input1,input2)/(int64_t)input3);
}
-static inline int mulscale (int input1, int input2, int input3)
+static inline int mulscale (int32_t input1, int32_t input2, int32_t input3)
{
return (int)(mul32_64(input1,input2)>>input3);
}
-static inline int dmulscale (int input1, int input2, int input3,int input4,int input5)
+static inline int dmulscale (int32_t input1, int32_t input2, int32_t input3,int32_t input4,int32_t input5)
{
return (int)((mul32_64(input1,input2) + mul32_64(input3,input4))>>input5);
}
-static inline int tmulscale(int i1, int i2, int i3, int i4, int i5, int i6,int shift)
+static inline int tmulscale(int32_t i1, int32_t i2, int32_t i3, int32_t i4, int32_t i5, int32_t i6,int32_t shift)
{
return (int)((mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift);
}
-static inline int divscale(int i1, int i2, int i3)
+static inline int32_t divscale(int32_t i1, int32_t i2, int32_t i3)
{
- return (int)(((int64_t)i1<<i3)/i2);
+ return (int32_t)(((int64_t)i1<<i3)/i2);
}
#define DEFFUNCS \
@@ -111,30 +111,30 @@
DEFFUN(32)
#define DEFFUN(N) \
-static __inline int mulscale##N(int input1, int input2) \
+static __inline int mulscale##N(int32_t input1, int32_t input2) \
{ return mulscale(input1,input2,N); }
DEFFUNCS
#undef DEFFUN
#define DEFFUN(N) \
-static __inline int dmulscale##N(int input1, int input2,int input3,int input4) \
+static __inline int dmulscale##N(int32_t input1, int32_t input2,int32_t input3,int32_t input4) \
{ return dmulscale(input1,input2,input3,input4,N); }
DEFFUNCS
#undef DEFFUN
#define DEFFUN(N) \
-static __inline int tmulscale##N(int i1, int i2,int i3,int i4,int i5,int i6) \
+static __inline int tmulscale##N(int32_t i1, int32_t i2,int32_t i3,int32_t i4,int32_t i5,int32_t i6) \
{ return tmulscale(i1,i2,i3,i4,i5,i6,N); }
DEFFUNCS
#undef DEFFUN
#define DEFFUN(N) \
-static __inline int divscale##N(int input1, int input2) \
+static __inline int divscale##N(int32_t input1, int32_t input2) \
{ return divscale(input1,input2,N); }
DEFFUNCS
#undef DEFFUN
-static __inline int ksgn(int i1)
+static inline int ksgn(int32_t i1)
{
if (i1 < 0) return -1;
else if (i1 > 0) return 1;
@@ -141,15 +141,15 @@
else return 0;
}
-static __inline int sgn(int i1) { return ksgn(i1); }
-static __inline int klabs (int i1)
+static inline int sgn(int32_t i1) { return ksgn(i1); }
+static inline int klabs (int32_t i1)
{
if (i1 < 0) i1 = -i1;
return i1;
}
-static __inline int mul3 (int i1) { return i1*3; }
-static __inline int mul5 (int i1) { return i1*5; }
-static __inline int mul9 (int i1) { return i1*9; }
+static inline int mul3 (int32_t i1) { return i1*3; }
+static inline int mul5 (int32_t i1) { return i1*5; }
+static inline int mul9 (int32_t i1) { return i1*9; }
void copybufreverse(void *S, void *D, int32_t c);
void copybuf(void *s, void *d, int32_t c);
--- a/Engine/src/sdl_driver.c
+++ b/Engine/src/sdl_driver.c
@@ -321,7 +321,7 @@
int _argc = 0;
-uint8_t **_argv = NULL;
+char **_argv = NULL;
/* !!! move these elsewhere? */
int32_t xres, yres, bytesperline, frameplace, frameoffset, imageSize, maxpages;
@@ -345,8 +345,8 @@
int32_t total_render_time = 1;
int32_t total_rendered_frames = 0;
-static uint8_t *title = NULL;
-static uint8_t *titleshort = NULL;
+static char *titleNameLong = NULL;
+static char *titleNameShort = NULL;
void restore256_palette (void);
void set16color_palette (void);
@@ -524,7 +524,7 @@
setupmouse();
- SDL_WM_SetCaption(title, titleshort);
+ SDL_WM_SetCaption(titleNameLong, titleNameShort);
xdim = xres = surface->w;
ydim = yres = surface->h;
@@ -1071,9 +1071,9 @@
/* lousy -ansi flag. :) */
-static uint8_t *string_dupe(const uint8_t *str)
+static char *string_dupe(const char *str)
{
- uint8_t *retval = malloc(strlen(str) + 1);
+ char *retval = malloc(strlen(str) + 1);
if (retval != NULL)
strcpy(retval, str);
return(retval);
@@ -1182,7 +1182,7 @@
}
-void _platform_init(int argc, uint8_t **argv, const uint8_t *title, const uint8_t *icon)
+void _platform_init(int argc, uint8_t **argv, const char *title, const char *iconName)
{
int i;
int32_t timeElapsed;
@@ -1243,11 +1243,11 @@
if (title == NULL)
title = "BUILD";
- if (icon == NULL)
- icon = "BUILD";
+ if (iconName == NULL)
+ iconName = "BUILD";
- title = string_dupe(title);
- titleshort = string_dupe(icon);
+ titleNameLong = string_dupe(title);
+ titleNameShort = string_dupe(iconName);
sdl_flags = BFullScreen ? SDL_FULLSCREEN : 0;
@@ -2479,7 +2479,9 @@
//} /* getticks */
-#if PLATFORM_WIN32
+#if 0// PLATFORM_WIN32 Timer on windows 98 used to be really poor but now it is very accurate
+ // We can just used what SDL uses, now need for QueryPerformanceFrequency or QueryPerformanceCounter
+ // (which I bet SDL is using anyway).
int TIMER_GetPlatformTicksInOneSecond(int64_t* t)
{
--- a/Engine/src/win32_compat.h
+++ b/Engine/src/win32_compat.h
@@ -14,6 +14,8 @@
* See the included license file "BUILDLIC.TXT" for license info.
* This file IS NOT A PART OF Ken Silverman's original release
*/
+
+
#ifndef _INCLUDE_WIN32_COMPAT_H_
#define _INCLUDE_WIN32_COMPAT_H_
@@ -130,6 +132,10 @@
#endif /* defined _MSC_VER */
#define snprintf _snprintf
+
+//Damn you Microsoft, how hard would it REALLY be to support C99 ?!??!?!
+#define inline
+#include "windows/inttypes.h"
#endif
--- /dev/null
+++ b/Engine/src/windows/inttypes.h
@@ -1,0 +1,305 @@
+// ISO C9x compliant inttypes.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_INTTYPES_H_ // [
+#define _MSC_INTTYPES_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include "stdint.h"
+
+// 7.8 Format conversion of integer types
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+// 7.8.1 Macros for format specifiers
+
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
+
+// The fprintf macros for signed integers are:
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
+
+// The fprintf macros for unsigned integers are:
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
+
+// The fscanf macros for signed integers are:
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64 // [
+# define SCNdPTR "I64d"
+# define SCNiPTR "I64i"
+#else // _WIN64 ][
+# define SCNdPTR "ld"
+# define SCNiPTR "li"
+#endif // _WIN64 ]
+
+// The fscanf macros for unsigned integers are:
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64 // [
+# define SCNoPTR "I64o"
+# define SCNuPTR "I64u"
+# define SCNxPTR "I64x"
+# define SCNXPTR "I64X"
+#else // _WIN64 ][
+# define SCNoPTR "lo"
+# define SCNuPTR "lu"
+# define SCNxPTR "lx"
+# define SCNXPTR "lX"
+#endif // _WIN64 ]
+
+#endif // __STDC_FORMAT_MACROS ]
+
+// 7.8.2 Functions for greatest-width integer types
+
+// 7.8.2.1 The imaxabs function
+#define imaxabs _abs64
+
+// 7.8.2.2 The imaxdiv function
+
+// This is modified version of div() function from Microsoft's div.c found
+// in %MSVC.NET%\crt\src\div.c
+#ifdef STATIC_IMAXDIV // [
+static
+#else // STATIC_IMAXDIV ][
+_inline
+#endif // STATIC_IMAXDIV ]
+imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
+{
+ imaxdiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ if (numer < 0 && result.rem > 0) {
+ // did division wrong; must fix up
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
+
+// 7.8.2.3 The strtoimax and strtoumax functions
+#define strtoimax _strtoi64
+#define strtoumax _strtoui64
+
+// 7.8.2.4 The wcstoimax and wcstoumax functions
+#define wcstoimax _wcstoi64
+#define wcstoumax _wcstoui64
+
+
+#endif // _MSC_INTTYPES_H_ ]
--- /dev/null
+++ b/Engine/src/windows/stdint.h
@@ -1,0 +1,247 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2008 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+# include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+#else
+ typedef signed __int8 int8_t;
+ typedef signed __int16 int16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+#endif
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef signed __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 signed int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C INT64_C
+#define UINTMAX_C UINT64_C
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
--- a/Game/src/audiolib/fx_man.c
+++ b/Game/src/audiolib/fx_man.c
@@ -499,7 +499,7 @@
int FX_SetCallBack
(
- void ( *function )( unsigned long )
+ void ( *function )( uint32_t )
)
{
@@ -998,7 +998,7 @@
int FX_PlayLoopedWAV
(
- char *ptr,
+ uint8_t *ptr,
long loopstart,
long loopend,
int pitchoffset,
--- a/Game/src/audiolib/fx_man.h
+++ b/Game/src/audiolib/fx_man.h
@@ -32,7 +32,11 @@
#define __FX_MAN_H
#include "sndcards.h"
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
typedef struct
{
--- a/Game/src/audiolib/music.h
+++ b/Game/src/audiolib/music.h
@@ -66,7 +66,7 @@
#define MUSIC_LoopSong ( 1 == 1 )
#define MUSIC_PlayOnce ( !MUSIC_LoopSong )
-uint8_t *MUSIC_ErrorString( int ErrorNumber );
+char *MUSIC_ErrorString( int ErrorNumber );
int MUSIC_Init( int SoundCard, int Address );
int MUSIC_Shutdown( void );
void MUSIC_SetMaxFMMidiChannel( int channel );
--- a/Game/src/cvar_defs.h
+++ b/Game/src/cvar_defs.h
@@ -1,7 +1,11 @@
#ifndef _CVARDEFS_H_
#define _CVARDEFS_H_
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
void CVARDEFS_Init();
void CVARDEFS_Render();
--- a/Game/src/cvars.c
+++ b/Game/src/cvars.c
@@ -2,7 +2,7 @@
#include "cvar_defs.h"
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
#define MAX_CVARS 32
--- a/Game/src/cvars.h
+++ b/Game/src/cvars.h
@@ -4,7 +4,11 @@
#define REGCONVAR(varname, varhelp, variable, function) CVAR_RegisterCvar(varname, varhelp, &variable, &function)
#define REGCONFUNC(varname, varhelp, function) CVAR_RegisterCvar(varname, varhelp, NULL, &function)
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
typedef void (*function_t) (void* binding);
--- a/Game/src/file_lib.h
+++ b/Game/src/file_lib.h
@@ -48,7 +48,7 @@
// SafeOpenWrite - Opens a file for writing, returns handle
//
//==========================================================================
-int32 SafeOpenWrite ( const uint8_t * filename, int32 filetype );
+int32 SafeOpenWrite ( const char * filename, int32 filetype );
//==========================================================================
//
@@ -55,7 +55,7 @@
// SafeOpenRead - Opens a file for reading, returns handle
//
//==========================================================================
-int32 SafeOpenRead ( const uint8_t * filename, int32 filetype );
+int32 SafeOpenRead ( const char * filename, int32 filetype );
//==========================================================================
//
@@ -62,7 +62,7 @@
// SafeOpenAppend - Opens a file for appending, returns handle
//
//==========================================================================
-int32 SafeOpenAppend ( const uint8_t * filename, int32 filetype );
+int32 SafeOpenAppend ( const char * filename, int32 filetype );
//==========================================================================
//
@@ -76,7 +76,7 @@
// SafeFileExists - Checks for existence of file
//
//==========================================================================
-boolean SafeFileExists ( const uint8_t * filename );
+boolean SafeFileExists ( const char * filename );
//==========================================================================
//
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -8063,7 +8063,7 @@
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
int i=0,kbdKey ;
- uint8_t groupfile[9][512];
+ char groupfile[9][512];
int grpID ;
if(game_dir[0] != '\0')
@@ -10740,7 +10740,7 @@
// makes smaller files. Doesn't freeze or lag the game anymore.
void takescreenshot(void)
{
- uint8_t szFilename[256];
+ char szFilename[256];
int i;
uint8_t score[20];
time_t time4file;
--- a/Game/src/global.c
+++ b/Game/src/global.c
@@ -560,9 +560,9 @@
return handle;
}
-boolean SafeFileExists ( const uint8_t * _filename )
+boolean SafeFileExists ( const char * _filename )
{
- uint8_t filename[MAX_PATH];
+ char filename[MAX_PATH];
strncpy(filename, _filename, sizeof (filename));
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
@@ -575,10 +575,10 @@
}
-int32 SafeOpenWrite (const uint8_t *_filename, int32 filetype)
+int32 SafeOpenWrite (const char *_filename, int32 filetype)
{
int handle;
- uint8_t filename[MAX_PATH];
+ char filename[MAX_PATH];
strncpy(filename, _filename, sizeof (filename));
filename[sizeof (filename) - 1] = '\0';
FixFilePath(filename);
--- a/Game/src/midi/databuf.h
+++ b/Game/src/midi/databuf.h
@@ -17,6 +17,12 @@
#ifndef DATA_H
#define DATA_H
+#ifdef _WIN32
+ #include "../../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
+
#ifndef ALPHA_LINUX_CXX
# include <cstdio>
# include <cstring>
@@ -27,6 +33,8 @@
#include <fstream>
#include <iomanip>
+
+/*
typedef uint8_t uint8;
typedef unsigned short uint16;
typedef uint32_t uint32;
@@ -34,12 +42,13 @@
typedef int8_t sint8;
typedef signed short sint16;
typedef int32_t sint32;
+*/
class DataSource
{
protected:
union uint_float {
- uint32 i;
+ uint32_t i;
float f;
};
@@ -48,18 +57,18 @@
virtual ~DataSource() {};
virtual unsigned int read1() =0;
- virtual uint16 read2() =0;
- virtual uint16 read2high() =0;
- virtual uint32 read4() =0;
- virtual uint32 read4high() =0;
+ virtual uint16_t read2() =0;
+ virtual uint16_t read2high() =0;
+ virtual uint32_t read4() =0;
+ virtual uint32_t read4high() =0;
virtual float readf() =0;
- virtual void read(uint8_t *, int) =0;
+ virtual void read(uint8_t *, int32_t) =0;
- virtual void write1(unsigned int) =0;
- virtual void write2(uint16) =0;
- virtual void write2high(uint16) =0;
- virtual void write4(uint32) =0;
- virtual void write4high(uint32) =0;
+ virtual void write1(uint32_t) =0;
+ virtual void write2(uint16_t) =0;
+ virtual void write2high(uint16_t) =0;
+ virtual void write4(uint32_t) =0;
+ virtual void write4high(uint32_t) =0;
virtual void writef(float) =0;
virtual void write(uint8_t *, int) =0;
@@ -76,7 +85,7 @@
data is being passed 'non-const' anyway */
const uint8_t *buf;
uint8_t *buf_ptr;
- sint32 size;
+ int32_t size;
public:
BufferDataSource(uint8_t *data, unsigned int len)
{
@@ -103,7 +112,7 @@
return (b0);
};
- virtual uint16 read2()
+ virtual uint16_t read2()
{
uint8_t b0, b1;
b0 = static_cast<uint8_t >(*buf_ptr++);
@@ -111,7 +120,7 @@
return (b0 | (b1 << 8));
};
- virtual uint16 read2high()
+ virtual uint16_t read2high()
{
uint8_t b0, b1;
b1 = static_cast<uint8_t >(*buf_ptr++);
@@ -119,7 +128,7 @@
return (b0 | (b1 << 8));
};
- virtual uint32 read4()
+ virtual uint32_t read4()
{
uint8_t b0, b1, b2, b3;
b0 = static_cast<uint8_t >(*buf_ptr++);
@@ -129,7 +138,7 @@
return (b0 | (b1<<8) | (b2<<16) | (b3<<24));
};
- virtual uint32 read4high()
+ virtual uint32_t read4high()
{
uint8_t b0, b1, b2, b3;
b3 = static_cast<uint8_t >(*buf_ptr++);
@@ -161,13 +170,13 @@
*buf_ptr++ = val & 0xff;
};
- virtual void write2(uint16 val)
+ virtual void write2(uint16_t val)
{
*buf_ptr++ = val & 0xff;
*buf_ptr++ = (val>>8) & 0xff;
};
- virtual void write2high(uint16 val)
+ virtual void write2high(uint16_t val)
{
*buf_ptr++ = (val>>8) & 0xff;
*buf_ptr++ = val & 0xff;
@@ -174,7 +183,7 @@
};
- virtual void write4(uint32 val)
+ virtual void write4(uint32_t val)
{
*buf_ptr++ = val & 0xff;
*buf_ptr++ = (val>>8) & 0xff;
@@ -182,7 +191,7 @@
*buf_ptr++ = (val>>24)&0xff;
};
- virtual void write4high(uint32 val)
+ virtual void write4high(uint32_t val)
{
*buf_ptr++ = (val>>24)&0xff;
*buf_ptr++ = (val>>16)&0xff;
@@ -200,7 +209,7 @@
*buf_ptr++ = (uif.i>>24)&0xff;
};
- virtual void write(uint8_t *b, int len)
+ virtual void write(uint8_t *b, int32_t len)
{
memcpy(buf_ptr, b, len);
buf_ptr += len;
--- a/Game/src/midi/win_midiout.cpp
+++ b/Game/src/midi/win_midiout.cpp
@@ -185,7 +185,7 @@
// List all the midi devices.
MIDIOUTCAPS caps;
- signed int32_t dev_count = (signed long) midiOutGetNumDevs();
+ int32_t dev_count = (signed long) midiOutGetNumDevs();
std::cout << dev_count << " Midi Devices Detected" << endl;
std::cout << "Listing midi devices:" << endl;
@@ -208,7 +208,7 @@
giveinfo();
if (mmsys_err != MMSYSERR_NOERROR)
{
- uint8_t buf[512];
+ char buf[512];
giveinfo();
midiOutGetErrorText(mmsys_err, buf, 512);
@@ -245,9 +245,9 @@
void Windows_MidiOut::thread_play ()
{
int repeat = false;
- uint32 aim = 0;
- sint32 diff = 0;
- uint32 last_tick = 0;
+ uint32_t aim = 0;
+ int32_t diff = 0;
+ uint32_t last_tick = 0;
XMIDIEventList *evntlist = NULL;
midi_event *event = NULL;
NoteStack notes_on;
@@ -269,9 +269,9 @@
giveinfo();
int s_track = 0;
- uint32 s_aim = 0;
- sint32 s_diff = 0;
- uint32 s_last_tick = 0;
+ uint32_t s_aim = 0;
+ int32_t s_diff = 0;
+ uint32_t s_last_tick = 0;
NoteStack s_notes_on;
XMIDIEventList *s_evntlist = NULL;
midi_event *s_event = NULL;
@@ -291,7 +291,7 @@
new_volume = -1;
for (int i = 0; i < 16; i++) {
- uint32 message = i;
+ uint32_t message = i;
message |= MIDI_STATUS_CONTROLLER << 4;
message |= 7 << 8;
message |= ((volumes[i] * vol_multi)/0xFF)<<16;
@@ -374,7 +374,7 @@
else if (event->status < 0xF0)
{
unsigned int type = event->status >> 4;
- uint32 data = event->data[0] | (event->data[1] << 8);
+ uint32_t data = event->data[0] | (event->data[1] << 8);
// Channel volume
if (type == MIDI_STATUS_CONTROLLER && event->data[0] == 0x7) {
@@ -742,7 +742,7 @@
return playing!=0;
}
-const uint8_t *Windows_MidiOut::copyright(void)
+const char *Windows_MidiOut::copyright(void)
{
giveinfo();
return "Internal Win32 Midiout Midi Player for Pentagram. Version 1.2a";
@@ -810,10 +810,10 @@
#include "../duke3d.h"
#include "cache1d.h"
-static uint8_t warningMessage[80];
-static uint8_t errorMessage[80];
+static char warningMessage[80];
+static char errorMessage[80];
-uint8_t *MUSIC_ErrorString(int ErrorNumber)
+char *MUSIC_ErrorString(int ErrorNumber)
{
switch (ErrorNumber)
{
@@ -864,10 +864,10 @@
static int music_loopflag = MUSIC_PlayOnce;
static Windows_MidiOut *midi_device = NULL;
-extern void musdebug(const uint8_t *fmt, ...);
+extern void musdebug(const char *fmt, ...);
extern void init_debugging(void);
-extern void setWarningMessage(const uint8_t *msg);
-extern void setErrorMessage(const uint8_t *msg);
+extern void setWarningMessage(const char *msg);
+extern void setErrorMessage(const char *msg);
extern int MUSIC_ErrorCode;
#define __FX_TRUE (1 == 1)
#define __FX_FALSE (!__FX_TRUE)
@@ -875,7 +875,7 @@
#pragma message (" The win_midi code is temp until the SDL midi code functions properly ")
#pragma message (" STUBBED musdebug ")
-void musdebug(const uint8_t *fmt, ...)
+void musdebug(const char *fmt, ...)
{
#if 0
va_list ap;
@@ -893,7 +893,7 @@
} // snddebug
#pragma message (" STUBBED setErrorMessage ")
-static void setErrorMessage(const uint8_t *msg)
+static void setErrorMessage(const char *msg)
{
#if 0
strncpy(errorMessage, msg, sizeof (errorMessage));
@@ -1092,7 +1092,7 @@
return(MUSIC_Ok);
} // MUSIC_PlaySong
-int MUSIC_PlayExtSong(uint8_t *fn)
+int MUSIC_PlayExtSong(char *fn)
{
MUSIC_StopSong();
@@ -1127,10 +1127,10 @@
extern uint8_t ApogeePath[256];
-static void CheckAndPlayMusicType(const uint8_t * szName, const uint8_t * szType)
+static void CheckAndPlayMusicType(const char * szName, const char * szType)
{
- uint8_t fpath[1024] = {'\0'};
+ char fpath[1024] = {'\0'};
// Is this a TC?
if(game_dir[0] != '\0')
@@ -1162,7 +1162,7 @@
}
// Duke3D-specific. --ryan.
-void PlayMusic(uint8_t *fn)
+void PlayMusic(char *fn)
{
//extern int File_Exists(uint8_t *fn);
//extern void GetOnlyNameOfFile(uint8_t *fn);
@@ -1169,8 +1169,8 @@
short fp;
int32_t l;
- uint8_t *cfn;
- uint8_t *buffer;
+ char *cfn;
+ char *buffer;
uint8_t fpath[19] = {'\0'};
cfn = fn;
@@ -1224,13 +1224,13 @@
} // MUSIC_GetContext
-void MUSIC_SetSongTick(unsigned int32_t PositionInTicks)
+void MUSIC_SetSongTick(uint32_t PositionInTicks)
{
musdebug("STUB ... MUSIC_SetSongTick().\n");
} // MUSIC_SetSongTick
-void MUSIC_SetSongTime(unsigned int32_t milliseconds)
+void MUSIC_SetSongTime(uint32_t milliseconds)
{
musdebug("STUB ... MUSIC_SetSongTime().\n");
}// MUSIC_SetSongTime
--- a/Game/src/midi/win_midiout.h
+++ b/Game/src/midi/win_midiout.h
@@ -19,6 +19,8 @@
#ifndef WIN_MIDIOUT_H
#define WIN_MIDIOUT_H
+
+
#if (__GNUG__ >= 2) && (!defined WIN32)
# pragma interface
#endif
@@ -44,6 +46,13 @@
#include <mmsystem.h>
#include "xmidi.h"
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+ #define inline
+#else
+ #include <inttypes.h>
+#endif
+
class Windows_MidiOut
{
public:
@@ -52,7 +61,7 @@
virtual void stop_track(void);
virtual void stop_sfx(void);
virtual bool is_playing(void);
- virtual const uint8_t *copyright(void);
+ virtual const char *copyright(void);
// PSMDEX - Pentagram Streaming Midi Driver Extensions
virtual int max_streams();
@@ -109,34 +118,34 @@
void reset_channel (int i);
// Microsecond Clock
- unsigned int32_t start;
- unsigned int32_t sfx_start;
+ uint32_t start;
+ uint32_t sfx_start;
inline void wmoInitClock ()
{ start = GetTickCount()*6; }
- inline void wmoAddOffset (unsigned int32_t offset)
+ inline void wmoAddOffset (uint32_t offset)
{ start += offset; }
- inline unsigned int32_t wmoGetTime ()
+ inline uint32_t wmoGetTime ()
{ return GetTickCount()*6 - start; }
- inline unsigned int32_t wmoGetStart ()
+ inline uint32_t wmoGetStart ()
{ return start; }
- inline unsigned int32_t wmoGetRealTime ()
+ inline uint32_t wmoGetRealTime ()
{ return GetTickCount()*6; }
inline void wmoInitSFXClock ()
{ sfx_start = GetTickCount()*6; }
- inline void wmoAddSFXOffset (unsigned int32_t offset)
+ inline void wmoAddSFXOffset (uint32_t offset)
{ sfx_start += offset; }
- inline unsigned int32_t wmoGetSFXTime ()
+ inline uint32_t wmoGetSFXTime ()
{ return GetTickCount()*6 - sfx_start; }
- inline unsigned int32_t wmoGetSFXStart ()
+ inline uint32_t wmoGetSFXStart ()
{ return sfx_start; }
};
--- a/Game/src/midi/xmidi.cpp
+++ b/Game/src/midi/xmidi.cpp
@@ -376,7 +376,7 @@
}
}
-XMIDIEventList *XMIDI::GetEventList (uint32 track)
+XMIDIEventList *XMIDI::GetEventList (uint32_t track)
{
if (!events)
{
@@ -441,7 +441,7 @@
//
// Get a Conventional Variable Length Quantity
//
-int XMIDI::GetVLQ (DataSource *source, uint32 &quant)
+int XMIDI::GetVLQ (DataSource *source, uint32_t &quant)
{
int i;
quant = 0;
@@ -468,7 +468,7 @@
//
// Get a XMIDI Variable Length Quantity
//
-int XMIDI::GetVLQ2 (DataSource *source, uint32 &quant)
+int XMIDI::GetVLQ2 (DataSource *source, uint32_t &quant)
{
int i;
quant = 0;
@@ -829,12 +829,12 @@
//
// This is used by Midi's ONLY! It will do nothing with Xmidi
//
-void XMIDI::AdjustTimings(uint32 ppqn)
+void XMIDI::AdjustTimings(uint32_t ppqn)
{
- uint32 tempo = 500000;
- uint32 time_prev = 0;
- uint32 hs_rem = 0;
- uint32 hs = 0;
+ uint32_t tempo = 500000;
+ uint32_t time_prev = 0;
+ uint32_t hs_rem = 0;
+ uint32_t hs = 0;
ppqn *= 10000;
@@ -1032,7 +1032,7 @@
int XMIDI::ConvertNote (const int time, const uint8_t status, DataSource *source, const int size)
{
- uint32 delta = 0;
+ uint32_t delta = 0;
int data;
data = source->read1();
@@ -1104,9 +1104,9 @@
int XMIDI::ConvertFiletoList (DataSource *source, const bool is_xmi, first_state &fs)
{
int time = 0; // 120th of a second
- uint32 data;
+ uint32_t data;
int end = 0;
- uint32 status = 0;
+ uint32_t status = 0;
int play_size = 2;
int file_size = source->getSize();
int retval = 0;
@@ -1199,7 +1199,7 @@
if (status == 0xFF)
{
int pos = source->getPos();
- uint32 data = source->read1();
+ uint32_t data = source->read1();
if (data == 0x2F) // End, of track
end = 1;
@@ -1228,7 +1228,7 @@
int XMIDI::ExtractTracksFromXmi (DataSource *source)
{
int num = 0;
- uint32 len = 0;
+ uint32_t len = 0;
uint8_t buf[32];
first_state fs;
@@ -1284,10 +1284,10 @@
return num;
}
-int XMIDI::ExtractTracksFromMid (DataSource *source, const uint32 ppqn, const int num_tracks, const bool type1)
+int XMIDI::ExtractTracksFromMid (DataSource *source, const uint32_t ppqn, const int num_tracks, const bool type1)
{
int num = 0;
- uint32 len = 0;
+ uint32_t len = 0;
uint8_t buf[32];
int chan_mask = 0;
@@ -1340,10 +1340,10 @@
int XMIDI::ExtractTracks (DataSource *source)
{
- uint32 i = 0;
+ uint32_t i = 0;
int start;
- uint32 len;
- uint32 chunk_len;
+ uint32_t len;
+ uint32_t chunk_len;
int count;
uint8_t buf[32];
@@ -1497,7 +1497,7 @@
if (type == 1) num_tracks = 1;
events = Calloc<XMIDIEventList*>(num_tracks); //new midi_event *[info.tracks];
- const uint32 ppqn = source->read2high();
+ const uint32_t ppqn = source->read2high();
for (i = 0; i < num_tracks; i++)
events[i] = Calloc<XMIDIEventList>();
@@ -1619,7 +1619,7 @@
//
// Write a Conventional Variable Length Quantity
//
-int XMIDIEventList::PutVLQ(DataSource *dest, uint32 value)
+int XMIDIEventList::PutVLQ(DataSource *dest, uint32_t value)
{
int buffer;
int i = 1;
@@ -1643,16 +1643,16 @@
// Converts and event list to a MTrk
// Returns bytes of the array
// buf can be NULL
-uint32 XMIDIEventList::ConvertListToMTrk (DataSource *dest)
+uint32_t XMIDIEventList::ConvertListToMTrk (DataSource *dest)
{
int time = 0;
int lasttime = 0;
midi_event *event;
- uint32 delta;
+ uint32_t delta;
uint8_t last_status = 0;
- uint32 i = 8;
- uint32 j;
- uint32 size_pos=0;
+ uint32_t i = 8;
+ uint32_t j;
+ uint32_t size_pos=0;
if (dest)
{
--- a/Game/src/midi/xmidi.h
+++ b/Game/src/midi/xmidi.h
@@ -78,11 +78,11 @@
uint8_t data[2];
- uint32 len; // Length of SysEx Data
+ uint32_t len; // Length of SysEx Data
uint8_t *buffer; // SysEx Data
int duration; // Duration of note (120 Hz)
midi_event *next_note; // The next note on the stack
- uint32 note_time; // Time note stops playing (6000th of second)
+ uint32_t note_time; // Time note stops playing (6000th of second)
midi_event *next;
};
@@ -102,7 +102,7 @@
}
// Pops the top of the stack if its off_time is <= time (6000th of second)
- inline midi_event *PopTime(uint32 time) {
+ inline midi_event *PopTime(uint32_t time) {
if (notes && notes->note_time <= time) {
midi_event *note = notes;
notes = note->next_note;
@@ -175,7 +175,7 @@
}
- inline void Push(midi_event *event, uint32 time) {
+ inline void Push(midi_event *event, uint32_t time) {
event->note_time = time;
event->next_note = 0;
@@ -215,8 +215,8 @@
int counter;
// Helper funcs for Write
- int PutVLQ(DataSource *dest, uint32 value);
- uint32 ConvertListToMTrk (DataSource *dest);
+ int PutVLQ(DataSource *dest, uint32_t value);
+ uint32_t ConvertListToMTrk (DataSource *dest);
static void DeleteEventList (midi_event *list);
@@ -237,7 +237,7 @@
class XMIDI
{
protected:
- uint16 num_tracks;
+ uint16_t num_tracks;
private:
XMIDIEventList **events;
@@ -267,7 +267,7 @@
int number_of_tracks() { return num_tracks; }
// External Event list functions
- XMIDIEventList *GetEventList (uint32 track);
+ XMIDIEventList *GetEventList (uint32_t track);
// Not yet implimented
// int apply_patch (int track, DataSource *source);
@@ -286,10 +286,10 @@
void CreateNewEvent (int time);
// Variable length quantity
- int GetVLQ (DataSource *source, uint32 &quant);
- int GetVLQ2 (DataSource *source, uint32 &quant);
+ int GetVLQ (DataSource *source, uint32_t &quant);
+ int GetVLQ2 (DataSource *source, uint32_t &quant);
- void AdjustTimings(uint32 ppqn); // This is used by Midi's ONLY!
+ void AdjustTimings(uint32_t ppqn); // This is used by Midi's ONLY!
void ApplyFirstState(first_state &fs, int chan_mask);
int ConvertNote (const int time, const uint8_t status, DataSource *source, const int size);
@@ -299,7 +299,7 @@
int ConvertFiletoList (DataSource *source, const bool is_xmi, first_state& fs);
int ExtractTracksFromXmi (DataSource *source);
- int ExtractTracksFromMid (DataSource *source, const uint32 ppqn, const int num_tracks, const bool type1);
+ int ExtractTracksFromMid (DataSource *source, const uint32_t ppqn, const int num_tracks, const bool type1);
int ExtractTracks (DataSource *source);
};
--- a/Game/src/types.h
+++ b/Game/src/types.h
@@ -27,7 +27,11 @@
#ifndef _types_public
#define _types_public
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
#ifdef __cplusplus
extern "C" {
--- a/Game/src/util_lib.h
+++ b/Game/src/util_lib.h
@@ -30,7 +30,11 @@
//
//***************************************************************************
-#include <inttypes.h>
+#ifdef _WIN32
+ #include "../../Engine/src/windows/inttypes.h"
+#else
+ #include <inttypes.h>
+#endif
#ifndef _util_lib_public
#define _util_lib_public