diff -urN STYMulator-0.21a/src/stsoundlib/lzh/lzh.h 01-STYMulator-0.21a-stdint_h/src/stsoundlib/lzh/lzh.h --- STYMulator-0.21a/src/stsoundlib/lzh/lzh.h 2006-06-29 23:18:00.000000000 +0200 +++ 01-STYMulator-0.21a-stdint_h/src/stsoundlib/lzh/lzh.h 2010-04-24 14:12:54.641623494 +0200 @@ -38,10 +38,23 @@ #define BUFSIZE (1024 * 4) -typedef unsigned char uchar; /* 8 bits or more */ -typedef unsigned int uint; /* 16 bits or more */ -typedef unsigned short ushort; /* 16 bits or more */ -typedef unsigned long ulong; /* 32 bits or more */ +#if defined(_WIN32) || defined(_WIN64) + +typedef unsigned char lzh_uchar; /* 8 bits or more */ +typedef unsigned int lzh_uint; /* 16 bits or more */ +typedef unsigned short lzh_ushort; /* 16 bits or more */ +typedef unsigned long lzh_ulong; /* 32 bits or more */ + +#else + +#include + +typedef uint8_t lzh_uchar; +typedef uint16_t lzh_ushort; +typedef uint_fast32_t lzh_uint; +typedef uint_fast32_t lzh_ulong; + +#endif #ifndef CHAR_BIT #define CHAR_BIT 8 @@ -51,7 +64,7 @@ #define UCHAR_MAX 255 #endif -typedef ushort BITBUFTYPE; +typedef lzh_ushort BITBUFTYPE; #define BITBUFSIZ (CHAR_BIT * sizeof (BITBUFTYPE)) #define DICBIT 13 /* 12(-lh4-) or 13(-lh5-) */ @@ -86,9 +99,9 @@ //---------------------------------------------- // New stuff to handle memory IO //---------------------------------------------- - uchar * m_pSrc; + lzh_uchar * m_pSrc; int m_srcSize; - uchar * m_pDst; + lzh_uchar * m_pDst; int m_dstSize; int DataIn(void *pBuffer,int nBytes); @@ -100,39 +113,39 @@ // Original Lzhxlib static func //---------------------------------------------- void fillbuf (int n); - ushort getbits (int n); + lzh_ushort getbits (int n); void init_getbits (void); - int make_table (int nchar, uchar *bitlen,int tablebits, ushort *table); + int make_table (int nchar, lzh_uchar *bitlen,int tablebits, lzh_ushort *table); void read_pt_len (int nn, int nbit, int i_special); void read_c_len (void); - ushort decode_c(void); - ushort decode_p(void); + lzh_ushort decode_c(void); + lzh_ushort decode_p(void); void huf_decode_start (void); void decode_start (void); - void decode (uint count, uchar buffer[]); + void decode (lzh_uint count, lzh_uchar buffer[]); //---------------------------------------------- // Original Lzhxlib static vars //---------------------------------------------- int fillbufsize; - uchar buf[BUFSIZE]; - uchar outbuf[DICSIZ]; - ushort left [2 * NC - 1]; - ushort right[2 * NC - 1]; + lzh_uchar buf[BUFSIZE]; + lzh_uchar outbuf[DICSIZ]; + lzh_ushort left [2 * NC - 1]; + lzh_ushort right[2 * NC - 1]; BITBUFTYPE bitbuf; - uint subbitbuf; + lzh_uint subbitbuf; int bitcount; int decode_j; /* remaining bytes to copy */ - uchar c_len[NC]; - uchar pt_len[NPT]; - uint blocksize; - ushort c_table[4096]; - ushort pt_table[256]; + lzh_uchar c_len[NC]; + lzh_uchar pt_len[NPT]; + lzh_uint blocksize; + lzh_ushort c_table[4096]; + lzh_ushort pt_table[256]; int with_error; - uint fillbuf_i; // NOTE: these ones are not initialized at constructor time but inside the fillbuf and decode func. - uint decode_i; + lzh_uint fillbuf_i; // NOTE: these ones are not initialized at constructor time but inside the fillbuf and decode func. + lzh_uint decode_i; }; diff -urN STYMulator-0.21a/src/stsoundlib/lzh/lzhlib.cpp 01-STYMulator-0.21a-stdint_h/src/stsoundlib/lzh/lzhlib.cpp --- STYMulator-0.21a/src/stsoundlib/lzh/lzhlib.cpp 2006-07-11 18:17:17.000000000 +0200 +++ 01-STYMulator-0.21a-stdint_h/src/stsoundlib/lzh/lzhlib.cpp 2010-04-23 14:29:58.830703823 +0200 @@ -92,9 +92,9 @@ bitbuf |= subbitbuf >> (bitcount -= n); } -ushort CLzhDepacker::getbits (int n) +lzh_ushort CLzhDepacker::getbits (int n) { - ushort x; + lzh_ushort x; x = bitbuf >> (BITBUFSIZ - n); fillbuf (n); return x; @@ -112,11 +112,11 @@ * maketbl.c */ -int CLzhDepacker::make_table (int nchar, uchar *bitlen, - int tablebits, ushort *table) +int CLzhDepacker::make_table (int nchar, lzh_uchar *bitlen, + int tablebits, lzh_ushort *table) { - ushort count[17], weight[17], start[18], *p; - uint jutbits, avail, mask; + lzh_ushort count[17], weight[17], start[18], *p; + lzh_uint jutbits, avail, mask; int i,ch,len,nextcode; for (i = 1; i <= 16; i++) @@ -127,7 +127,7 @@ start[1] = 0; for (i = 1; i <= 16; i++) start[i + 1] = start[i] + (count[i] << (16 - i)); - if (start[17] != (ushort) (1U << 16)) + if (start[17] != (lzh_ushort) (1U << 16)) return (1); /* error: bad table */ jutbits = 16 - tablebits; @@ -140,7 +140,7 @@ weight[i++] = 1U << (16 - i); i = start[tablebits + 1] >> jutbits; - if (i != (ushort) (1U << 16)) + if (i != (lzh_ushort) (1U << 16)) { int k = 1U << tablebits; while (i != k) @@ -161,7 +161,7 @@ } else { - uint k = start[len]; + lzh_uint k = start[len]; p = &table[k >> jutbits]; i = len - tablebits; while (i != 0) @@ -194,7 +194,7 @@ { int i, n; short c; - ushort mask; + lzh_ushort mask; n = getbits (nbit); if (n == 0) @@ -221,7 +221,7 @@ } } fillbuf ((c < 7) ? 3 : c - 3); - pt_len[i++] = uchar(c); + pt_len[i++] = lzh_uchar(c); if (i == i_special) { c = getbits (2); @@ -238,7 +238,7 @@ void CLzhDepacker::read_c_len (void) { short i, c, n; - ushort mask; + lzh_ushort mask; n = getbits (CBIT); if (n == 0) @@ -288,9 +288,9 @@ } } -ushort CLzhDepacker::decode_c (void) +lzh_ushort CLzhDepacker::decode_c (void) { - ushort j, mask; + lzh_ushort j, mask; if (blocksize == 0) { @@ -318,9 +318,9 @@ return j; } -ushort CLzhDepacker::decode_p (void) +lzh_ushort CLzhDepacker::decode_p (void) { - ushort j, mask; + lzh_ushort j, mask; j = pt_table[bitbuf >> (BITBUFSIZ - 8)]; if (j >= NP) @@ -365,9 +365,9 @@ * smaller, into the array 'buffer[]' of size 'DICSIZ' or more. Call * decode_start() once for each new file before calling this function. */ -void CLzhDepacker::decode (uint count, uchar buffer[]) +void CLzhDepacker::decode (lzh_uint count, lzh_uchar buffer[]) { - uint r, c; + lzh_uint r, c; r = 0; while (--decode_j >= 0) @@ -406,9 +406,9 @@ with_error = 0; - m_pSrc = (uchar*)pSrc; + m_pSrc = (lzh_uchar*)pSrc; m_srcSize = srcSize; - m_pDst = (uchar*)pDst; + m_pDst = (lzh_uchar*)pDst; m_dstSize = dstSize; decode_start (); @@ -416,7 +416,7 @@ int origsize = dstSize; while (origsize != 0) { - int n = (uint) ((origsize > DICSIZ) ? DICSIZ : origsize); + int n = (lzh_uint) ((origsize > DICSIZ) ? DICSIZ : origsize); decode (n, outbuf); if (with_error) break; diff -urN STYMulator-0.21a/src/stsoundlib/YmTypes.h 01-STYMulator-0.21a-stdint_h/src/stsoundlib/YmTypes.h --- STYMulator-0.21a/src/stsoundlib/YmTypes.h 2007-03-06 07:53:46.000000000 +0100 +++ 01-STYMulator-0.21a-stdint_h/src/stsoundlib/YmTypes.h 2010-04-21 18:22:52.773471284 +0200 @@ -44,45 +44,44 @@ // These settings are ok for Windows 32bits platform. #ifdef YM_INTEGER_ONLY -typedef __int64 yms64; +typedef __int64 yms64; #else -typedef float ymfloat; +typedef float ymfloat; #endif -typedef signed char yms8; // 8 bits signed integer -typedef signed short yms16; // 16 bits signed integer -typedef signed long yms32; // 32 bits signed integer +typedef signed char yms8; /* 8 bits signed integer */ +typedef signed short yms16; /* 16 bits signed integer */ +typedef signed long yms32; /* 32 bits signed integer */ -typedef unsigned char ymu8; // 8 bits unsigned integer -typedef unsigned short ymu16; // 16 bits unsigned integer -typedef unsigned long ymu32; // 32 bits unsigned integer +typedef unsigned char ymu8; /* 8 bits unsigned integer */ +typedef unsigned short ymu16; /* 16 bits unsigned integer */ +typedef unsigned long ymu32; /* 32 bits unsigned integer */ -typedef int ymint; // Native "int" for speed purpose. StSound suppose int is signed and at least 32bits. If not, change it to match to yms32 +typedef int ymint; /* Native "int" for speed purpose. StSound suppose int is signed and at least 32bits. If not, change it to match to yms32 */ -typedef char ymchar; // 8 bits char character (used for null terminated strings) +typedef char ymchar; /* 8 bits char character (used for null terminated strings) */ -#else // These settings are O.K. for GNU/Linux 32/64bit platforms (done by Grzegorz Tomasz Stanczyk) +#else + +#include #ifdef YM_INTEGER_ONLY -typedef long long int yms64; +typedef int64_t yms64; #else -typedef float ymfloat; +typedef float ymfloat; #endif -typedef signed char yms8; // 8 bits signed integer -typedef signed short yms16; // 16 bits signed integer -//changed for 64bit GNU/Linux compatibility by Grzegorz Stanczyk (2007.03.06) -//typedef signed long yms32; // 32 bits signed integer -typedef signed int yms32; // 32 bits signed integer - -typedef unsigned char ymu8; // 8 bits unsigned integer -typedef unsigned short ymu16; // 16 bits unsigned integer -//changed for 64bit GNU/Linux compatibility by Grzegorz Stanczyk (2007.03.06) -//typedef unsigned long ymu32; // 32 bits unsigned integer -typedef unsigned int ymu32; // 32 bits unsigned integer - -typedef int ymint; // Native "int" for speed purpose. StSound suppose int is signed and at least 32bits. If not, change it to match to yms32 - -typedef char ymchar; // 8 bits char character (used for null terminated strings) +typedef int8_t yms8; /* 8 bits signed integer */ +typedef int16_t yms16; /* 16 bits signed integer */ +typedef int32_t yms32; /* 32 bits signed integer */ + +typedef uint8_t ymu8; /* 8 bits unsigned integer */ +typedef uint16_t ymu16; /* 16 bits unsigned integer */ +typedef uint32_t ymu32; /* 32 bits unsigned integer */ + +/* Native "int" for speed purpose. StSound suppose int is signed and at least 32bits. If not, change it to match to yms32 */ +/*typedef int32_t ymint; */ +typedef int ymint; +typedef char ymchar; /* 8 bits char character (used for null terminated strings) */ #endif @@ -93,8 +92,8 @@ //----------------------------------------------------------- // Multi-platform //----------------------------------------------------------- -typedef int ymbool; // boolean ( theorically nothing is assumed for its size in StSound,so keep using int) -typedef yms16 ymsample; // StSound emulator render mono 16bits signed PCM samples +typedef int ymbool; /* boolean ( theorically nothing is assumed for its size in StSound,so keep using int) */ +typedef yms16 ymsample; /* StSound emulator render mono 16bits signed PCM samples */ #define YMFALSE (0) #define YMTRUE (!YMFALSE)