cleaning up scummsys.h a bit (in preparation of using configure eventually). Most notable, uint32 etc. will be 'unsigned int' not 'unsigned long'. Except for 16 bit systems that should be right, and configure will replace this by a proper check for data type sizes anyway
svn-id: r5290
This commit is contained in:
parent
4585debc18
commit
7a58ae782e
5 changed files with 431 additions and 440 deletions
|
@ -18,11 +18,14 @@
|
||||||
* $Header$
|
* $Header$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef __SCUMMSYS_H_
|
#ifndef SCUMMSYS_H
|
||||||
#define __SCUMMSYS_H_
|
#define SCUMMSYS_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// TODO - use config.h, generated by configure
|
||||||
|
//#include "config.h"
|
||||||
|
|
||||||
#if defined(HAVE_NO_BOOL)
|
#if defined(HAVE_NO_BOOL)
|
||||||
typedef int bool;
|
typedef int bool;
|
||||||
const bool true(1), false(0);
|
const bool true(1), false(0);
|
||||||
|
@ -30,210 +33,206 @@ const bool true(1), false(0);
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
//#pragma warning (disable: 4244)
|
//#pragma warning (disable: 4244)
|
||||||
//#pragma warning (disable: 4101)
|
//#pragma warning (disable: 4101)
|
||||||
|
|
||||||
#define scumm_stricmp stricmp
|
#define scumm_stricmp stricmp
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
|
||||||
#if defined(CHECK_HEAP)
|
#if defined(CHECK_HEAP)
|
||||||
#undef CHECK_HEAP
|
#undef CHECK_HEAP
|
||||||
#define CHECK_HEAP checkHeap();
|
#define CHECK_HEAP checkHeap();
|
||||||
#else
|
#else
|
||||||
#define CHECK_HEAP
|
#define CHECK_HEAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCUMM_LITTLE_ENDIAN
|
#define SCUMM_LITTLE_ENDIAN
|
||||||
|
|
||||||
#define FORCEINLINE __forceinline
|
#define FORCEINLINE __forceinline
|
||||||
#define NORETURN _declspec(noreturn)
|
#define NORETURN _declspec(noreturn)
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned short uint16;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef signed char int8;
|
typedef signed char int8;
|
||||||
typedef signed short int16;
|
typedef signed short int16;
|
||||||
typedef signed long int32;
|
typedef signed long int32;
|
||||||
|
|
||||||
#define START_PACK_STRUCTS pack (push,1)
|
#define START_PACK_STRUCTS pack (push,1)
|
||||||
#define END_PACK_STRUCTS pack(pop)
|
#define END_PACK_STRUCTS pack(pop)
|
||||||
#define GCC_PACK
|
#define GCC_PACK
|
||||||
|
|
||||||
#elif defined(__MINGW32__)
|
#elif defined(__MINGW32__)
|
||||||
|
|
||||||
#define scumm_stricmp stricmp
|
#define scumm_stricmp stricmp
|
||||||
#define CHECK_HEAP
|
#define CHECK_HEAP
|
||||||
#define SCUMM_LITTLE_ENDIAN
|
#define SCUMM_LITTLE_ENDIAN
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
#define FORCEINLINE inline
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
#define GCC_PACK __attribute__((packed))
|
#define GCC_PACK __attribute__((packed))
|
||||||
#define _HEAPOK 0
|
#define _HEAPOK 0
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned short uint16;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef signed char int8;
|
typedef signed char int8;
|
||||||
typedef signed short int16;
|
typedef signed short int16;
|
||||||
typedef signed long int32;
|
typedef signed long int32;
|
||||||
|
|
||||||
#define START_PACK_STRUCTS pack (push,1)
|
#define START_PACK_STRUCTS pack (push,1)
|
||||||
#define END_PACK_STRUCTS pack(pop)
|
#define END_PACK_STRUCTS pack(pop)
|
||||||
|
|
||||||
#elif defined(UNIX) || defined(__APPLE__)
|
#elif defined(UNIX) || defined(__APPLE__)
|
||||||
|
|
||||||
#define scumm_stricmp strcasecmp
|
#define scumm_stricmp strcasecmp
|
||||||
|
|
||||||
#define CHECK_HEAP
|
#define CHECK_HEAP
|
||||||
|
|
||||||
#ifdef X11_BACKEND
|
#ifdef X11_BACKEND
|
||||||
|
|
||||||
/* You need to set those manually */
|
/* You need to set those manually */
|
||||||
#define SCUMM_LITTLE_ENDIAN
|
// #define SCUMM_LITTLE_ENDIAN
|
||||||
/* #define SCUMM_NEED_ALIGNMENT */
|
/* #define SCUMM_NEED_ALIGNMENT */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* need this for the SDL_BYTEORDER define */
|
/* need this for the SDL_BYTEORDER define */
|
||||||
#include <SDL_byteorder.h>
|
#include <SDL_byteorder.h>
|
||||||
|
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
#define SCUMM_LITTLE_ENDIAN
|
#define SCUMM_LITTLE_ENDIAN
|
||||||
#elif SDL_BYTEORDER == SDL_BIG_ENDIAN
|
#elif SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
#define SCUMM_BIG_ENDIAN
|
#define SCUMM_BIG_ENDIAN
|
||||||
#define SCUMM_NEED_ALIGNMENT
|
#define SCUMM_NEED_ALIGNMENT
|
||||||
#else
|
#else
|
||||||
#error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set.
|
#error Neither SDL_BIG_ENDIAN nor SDL_LITTLE_ENDIAN is set.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
#define FORCEINLINE inline
|
||||||
#define CDECL
|
#define CDECL
|
||||||
|
|
||||||
typedef unsigned char byte;
|
#ifndef CONFIG_H
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char byte;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned char uint8;
|
||||||
typedef unsigned int uint;
|
typedef unsigned short uint16;
|
||||||
typedef signed char int8;
|
typedef unsigned int uint;
|
||||||
typedef signed short int16;
|
typedef unsigned int uint32;
|
||||||
|
typedef signed char int8;
|
||||||
# if defined(__DECCXX) // Assume alpha architecture
|
typedef signed short int16;
|
||||||
|
typedef signed int int32;
|
||||||
# define INVERSE_MKID
|
#endif
|
||||||
# define SCUMM_NEED_ALIGNMENT
|
|
||||||
|
|
||||||
typedef unsigned int uint32;
|
|
||||||
typedef signed int int32;
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
typedef signed long int32;
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
# if defined(__DECCXX) // Assume alpha architecture
|
||||||
#define START_PACK_STRUCTS
|
# define INVERSE_MKID
|
||||||
#define END_PACK_STRUCTS
|
# define SCUMM_NEED_ALIGNMENT
|
||||||
#define GCC_PACK __attribute__((packed))
|
# endif
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
|
||||||
#else
|
|
||||||
#define START_PACK_STRUCTS pack (1)
|
|
||||||
#define END_PACK_STRUCTS pack ()
|
|
||||||
#define GCC_PACK
|
|
||||||
#define NORETURN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(macintosh)
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "macos.h"
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
#define scumm_stricmp strcmp
|
|
||||||
|
|
||||||
#define CHECK_HEAP
|
|
||||||
#define SCUMM_BIG_ENDIAN
|
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
|
||||||
#define CDECL
|
|
||||||
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
typedef unsigned short uint16;
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef signed char int8;
|
|
||||||
typedef signed short int16;
|
|
||||||
typedef signed long int32;
|
|
||||||
|
|
||||||
#define START_PACK_STRUCTS pack (1)
|
|
||||||
#define END_PACK_STRUCTS pack ()
|
|
||||||
#define GCC_PACK
|
|
||||||
#define NORETURN
|
|
||||||
#define USE_QTMUSIC
|
|
||||||
#define NEED_STRDUP
|
|
||||||
|
|
||||||
#elif defined(__MORPHOS__)
|
|
||||||
#define scumm_stricmp stricmp
|
|
||||||
#define CHECK_HEAP
|
|
||||||
|
|
||||||
#define SCUMM_BIG_ENDIAN
|
|
||||||
#define SCUMM_NEED_ALIGNMENT
|
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
|
||||||
#define CDECL
|
|
||||||
|
|
||||||
typedef unsigned char byte;
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
typedef unsigned short uint16;
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef signed char int8;
|
|
||||||
typedef signed short int16;
|
|
||||||
typedef signed long int32;
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#define START_PACK_STRUCTS
|
#define START_PACK_STRUCTS
|
||||||
#define END_PACK_STRUCTS
|
#define END_PACK_STRUCTS
|
||||||
#define GCC_PACK __attribute__((packed))
|
#define GCC_PACK __attribute__((packed))
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
#else
|
#else
|
||||||
#define START_PACK_STRUCTS pack (1)
|
#define START_PACK_STRUCTS pack (1)
|
||||||
#define END_PACK_STRUCTS pack ()
|
#define END_PACK_STRUCTS pack ()
|
||||||
#define GCC_PACK
|
#define GCC_PACK
|
||||||
#define NORETURN
|
#define NORETURN
|
||||||
#endif
|
#endif
|
||||||
#define main morphos_main
|
|
||||||
|
#elif defined(macintosh)
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "macos.h"
|
||||||
|
|
||||||
|
#define scumm_stricmp strcmp// FIXME - this is definitly wrong. Try strcasecmp?
|
||||||
|
|
||||||
|
#define CHECK_HEAP
|
||||||
|
#define SCUMM_BIG_ENDIAN
|
||||||
|
|
||||||
|
#define FORCEINLINE inline
|
||||||
|
#define CDECL
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
typedef unsigned char uint8;
|
||||||
|
typedef unsigned short uint16;
|
||||||
|
typedef unsigned long uint32;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
typedef signed char int8;
|
||||||
|
typedef signed short int16;
|
||||||
|
typedef signed long int32;
|
||||||
|
|
||||||
|
#define START_PACK_STRUCTS pack (1)
|
||||||
|
#define END_PACK_STRUCTS pack ()
|
||||||
|
#define GCC_PACK
|
||||||
|
#define NORETURN
|
||||||
|
#define USE_QTMUSIC
|
||||||
|
#define NEED_STRDUP
|
||||||
|
|
||||||
|
#elif defined(__MORPHOS__)
|
||||||
|
#define scumm_stricmp stricmp
|
||||||
|
#define CHECK_HEAP
|
||||||
|
|
||||||
|
#define SCUMM_BIG_ENDIAN
|
||||||
|
#define SCUMM_NEED_ALIGNMENT
|
||||||
|
|
||||||
|
#define FORCEINLINE inline
|
||||||
|
#define CDECL
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
typedef unsigned char uint8;
|
||||||
|
typedef unsigned short uint16;
|
||||||
|
typedef unsigned long uint32;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
typedef signed char int8;
|
||||||
|
typedef signed short int16;
|
||||||
|
typedef signed long int32;
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define START_PACK_STRUCTS
|
||||||
|
#define END_PACK_STRUCTS
|
||||||
|
#define GCC_PACK __attribute__((packed))
|
||||||
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define START_PACK_STRUCTS pack (1)
|
||||||
|
#define END_PACK_STRUCTS pack ()
|
||||||
|
#define GCC_PACK
|
||||||
|
#define NORETURN
|
||||||
|
#endif
|
||||||
|
#define main morphos_main
|
||||||
|
|
||||||
#elif defined(__DC__)
|
#elif defined(__DC__)
|
||||||
|
|
||||||
#define scumm_stricmp strcasecmp
|
#define scumm_stricmp strcasecmp
|
||||||
#define CHECK_HEAP
|
#define CHECK_HEAP
|
||||||
#define SCUMM_LITTLE_ENDIAN
|
#define SCUMM_LITTLE_ENDIAN
|
||||||
#define SCUMM_NEED_ALIGNMENT
|
#define SCUMM_NEED_ALIGNMENT
|
||||||
|
|
||||||
#define FORCEINLINE inline
|
#define FORCEINLINE inline
|
||||||
#define NORETURN __attribute__((__noreturn__))
|
#define NORETURN __attribute__((__noreturn__))
|
||||||
#define GCC_PACK __attribute__((packed))
|
#define GCC_PACK __attribute__((packed))
|
||||||
#define CDECL
|
#define CDECL
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned short uint16;
|
||||||
typedef unsigned long uint32;
|
typedef unsigned long uint32;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef signed char int8;
|
typedef signed char int8;
|
||||||
typedef signed short int16;
|
typedef signed short int16;
|
||||||
typedef signed long int32;
|
typedef signed long int32;
|
||||||
|
|
||||||
#define START_PACK_STRUCTS pack (push,1)
|
#define START_PACK_STRUCTS pack (push,1)
|
||||||
#define END_PACK_STRUCTS pack(pop)
|
#define END_PACK_STRUCTS pack(pop)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error No system type defined
|
#error No system type defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,130 +240,122 @@ typedef signed long int32;
|
||||||
|
|
||||||
#if defined(SCUMM_LITTLE_ENDIAN)
|
#if defined(SCUMM_LITTLE_ENDIAN)
|
||||||
|
|
||||||
//#if defined(SCUMM_NEED_ALIGNMENT)
|
#define PROTO_MKID(a) SWAP_BYTES(a)
|
||||||
//#error Little endian processors that need alignment is not implemented
|
#define PROTO_MKID_BE(a) (a & 0xffffffff)
|
||||||
//#endif
|
|
||||||
|
#if defined(INVERSE_MKID)
|
||||||
|
# define MKID(a) PROTO_MKID_BE(a)
|
||||||
|
# define MKID_BE(a) PROTO_MKID(a)
|
||||||
|
#else
|
||||||
|
# define MKID(a) PROTO_MKID(a)
|
||||||
|
# define MKID_BE(a) PROTO_MKID_BE(a)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define PROTO_MKID(a) SWAP_BYTES(a)
|
#if defined(SCUMM_NEED_ALIGNMENT)
|
||||||
#define PROTO_MKID_BE(a) (a & 0xffffffff)
|
|
||||||
|
|
||||||
#if defined(INVERSE_MKID)
|
|
||||||
# define MKID(a) PROTO_MKID_BE(a)
|
|
||||||
# define MKID_BE(a) PROTO_MKID(a)
|
|
||||||
#else
|
|
||||||
# define MKID(a) PROTO_MKID(a)
|
|
||||||
# define MKID_BE(a) PROTO_MKID_BE(a)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(SCUMM_NEED_ALIGNMENT)
|
|
||||||
FORCEINLINE uint READ_LE_UINT16(void *ptr) {
|
FORCEINLINE uint READ_LE_UINT16(void *ptr) {
|
||||||
return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0];
|
return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0];
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
FORCEINLINE uint READ_LE_UINT16(void *ptr) {
|
FORCEINLINE uint READ_LE_UINT16(void *ptr) {
|
||||||
return *(uint16*)(ptr);
|
return *(uint16*)(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FORCEINLINE uint READ_BE_UINT16(void *ptr) {
|
FORCEINLINE uint READ_BE_UINT16(void *ptr) {
|
||||||
return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
|
return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SCUMM_NEED_ALIGNMENT)
|
#if defined(SCUMM_NEED_ALIGNMENT)
|
||||||
FORCEINLINE uint32 READ_LE_UINT32(void *ptr) {
|
FORCEINLINE uint32 READ_LE_UINT32(void *ptr) {
|
||||||
byte *b = (byte*)ptr;
|
byte *b = (byte*)ptr;
|
||||||
return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
|
return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
FORCEINLINE uint32 READ_LE_UINT32(void *ptr) {
|
FORCEINLINE uint32 READ_LE_UINT32(void *ptr) {
|
||||||
return *(uint32*)(ptr);
|
return *(uint32*)(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FORCEINLINE uint32 READ_BE_UINT32(void *ptr) {
|
FORCEINLINE uint32 READ_BE_UINT32(void *ptr) {
|
||||||
byte *b = (byte*)ptr;
|
byte *b = (byte*)ptr;
|
||||||
return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
|
return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_BE_UINT32_UNALIGNED READ_BE_UINT32
|
#define READ_BE_UINT32_UNALIGNED READ_BE_UINT32
|
||||||
#define READ_BE_UINT16_UNALIGNED READ_BE_UINT16
|
#define READ_BE_UINT16_UNALIGNED READ_BE_UINT16
|
||||||
|
|
||||||
#define READ_UINT32_UNALIGNED(a) READ_LE_UINT32(a)
|
#define READ_UINT32_UNALIGNED(a) READ_LE_UINT32(a)
|
||||||
|
|
||||||
#define FROM_LE_32(__a__) __a__
|
#define FROM_LE_32(__a__) __a__
|
||||||
#define FROM_LE_16(__a__) __a__
|
#define FROM_LE_16(__a__) __a__
|
||||||
|
|
||||||
#define TO_LE_32(__a__) __a__
|
#define TO_LE_32(__a__) __a__
|
||||||
#define TO_LE_16(__a__) __a__
|
#define TO_LE_16(__a__) __a__
|
||||||
|
|
||||||
#define TO_BE_32(a) SWAP_BYTES(a)
|
#define TO_BE_32(a) SWAP_BYTES(a)
|
||||||
|
|
||||||
uint16 FORCEINLINE TO_BE_16(uint16 a) { return (a>>8) | (a<<8); }
|
uint16 FORCEINLINE TO_BE_16(uint16 a) { return (a>>8) | (a<<8); }
|
||||||
|
|
||||||
#elif defined(SCUMM_BIG_ENDIAN)
|
#elif defined(SCUMM_BIG_ENDIAN)
|
||||||
|
|
||||||
#define MKID(a) (a)
|
#define MKID(a) (a)
|
||||||
#define MKID_BE(a) (a)
|
#define MKID_BE(a) (a)
|
||||||
//#define MKID_BE(a) SWAP_BYTES(a)
|
//#define MKID_BE(a) SWAP_BYTES(a)
|
||||||
|
|
||||||
uint32 FORCEINLINE FROM_LE_32(uint32 a) {
|
uint32 FORCEINLINE FROM_LE_32(uint32 a) {
|
||||||
return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);
|
return ((a>>24)&0xFF) + ((a>>8)&0xFF00) + ((a<<8)&0xFF0000) + ((a<<24)&0xFF000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 FORCEINLINE FROM_LE_16(uint16 a) {
|
uint16 FORCEINLINE FROM_LE_16(uint16 a) {
|
||||||
return ((a>>8)&0xFF) + ((a<<8)&0xFF00);
|
return ((a>>8)&0xFF) + ((a<<8)&0xFF00);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TO_LE_32 FROM_LE_32
|
#define TO_LE_32 FROM_LE_32
|
||||||
#define TO_LE_16 FROM_LE_16
|
#define TO_LE_16 FROM_LE_16
|
||||||
|
|
||||||
uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
|
uint32 FORCEINLINE READ_LE_UINT32(void *ptr) {
|
||||||
byte *b = (byte*)ptr;
|
byte *b = (byte*)ptr;
|
||||||
return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
|
return (b[3]<<24)+(b[2]<<16)+(b[1]<<8)+(b[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
|
uint32 FORCEINLINE READ_BE_UINT32(void *ptr) {
|
||||||
return *(uint32*)(ptr);
|
return *(uint32*)(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint FORCEINLINE READ_LE_UINT16(void *ptr) {
|
uint FORCEINLINE READ_LE_UINT16(void *ptr) {
|
||||||
byte *b = (byte*)ptr;
|
byte *b = (byte*)ptr;
|
||||||
return (b[1]<<8) + b[0];
|
return (b[1]<<8) + b[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint FORCEINLINE READ_BE_UINT16(void *ptr) {
|
uint FORCEINLINE READ_BE_UINT16(void *ptr) {
|
||||||
return *(uint16*)(ptr);
|
return *(uint16*)(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) {
|
uint FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) {
|
||||||
return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
|
return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
|
uint32 FORCEINLINE READ_BE_UINT32_UNALIGNED(void *ptr) {
|
||||||
byte *b = (byte*)ptr;
|
byte *b = (byte*)ptr;
|
||||||
return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
|
return (b[0]<<24)+(b[1]<<16)+(b[2]<<8)+(b[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_UINT32_UNALIGNED READ_BE_UINT32_UNALIGNED
|
#define READ_UINT32_UNALIGNED READ_BE_UINT32_UNALIGNED
|
||||||
|
|
||||||
|
#define TO_BE_32(a) (a)
|
||||||
|
#define TO_BE_16(a) (a)
|
||||||
|
|
||||||
#define TO_BE_32(a) (a)
|
|
||||||
#define TO_BE_16(a) (a)
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#error No endianness defined
|
#error No endianness defined
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef NEED_STRDUP
|
|
||||||
char *strdup(const char *s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialized operator new */
|
/* Initialized operator new */
|
||||||
void * operator new(size_t size);
|
void * operator new(size_t size);
|
||||||
|
|
||||||
void operator delete(void *ptr);
|
void operator delete(void *ptr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -159,7 +159,7 @@ void Scumm::readRoomsOffsets()
|
||||||
|
|
||||||
_fileHandle.seek(16, SEEK_SET);
|
_fileHandle.seek(16, SEEK_SET);
|
||||||
} else {
|
} else {
|
||||||
_fileHandle.seek(12, SEEK_SET); // Directlry searching for the room offset block would be more generic...
|
_fileHandle.seek(12, SEEK_SET); // Directly searching for the room offset block would be more generic...
|
||||||
}
|
}
|
||||||
|
|
||||||
num = _fileHandle.readByte();
|
num = _fileHandle.readByte();
|
||||||
|
@ -730,7 +730,7 @@ int Scumm::readSoundResource(int type, int idx)
|
||||||
_fileHandle.read(createResource(type, idx, total_size), total_size - 8);
|
_fileHandle.read(createResource(type, idx, total_size), total_size - 8);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "WARNING: Unrecognized base tag 0x%08lx in sound %d\n", basetag, idx);
|
fprintf(stderr, "WARNING: Unrecognized base tag 0x%08x in sound %d\n", basetag, idx);
|
||||||
}
|
}
|
||||||
res.roomoffs[type][idx] = 0xFFFFFFFF;
|
res.roomoffs[type][idx] = 0xFFFFFFFF;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1483,7 +1483,7 @@ void Scumm::resourceStats()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Total allocated size=%ld, locked=%ld(%ld)\n", _allocatedSize, lockedSize, lockedNum);
|
printf("Total allocated size=%d, locked=%d(%d)\n", _allocatedSize, lockedSize, lockedNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scumm::heapClear(int mode)
|
void Scumm::heapClear(int mode)
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool ScummMixer::addChannel(_Channel * c) {
|
||||||
fprintf(stderr, "_nextIndex == %d\n", _nextIndex);
|
fprintf(stderr, "_nextIndex == %d\n", _nextIndex);
|
||||||
|
|
||||||
for(i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
|
for(i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) {
|
||||||
fprintf(stderr, "channel %d : %p(%ld, %d) %d %d\n", i, _channels[i].chan,
|
fprintf(stderr, "channel %d : %p(%d, %d) %d %d\n", i, _channels[i].chan,
|
||||||
_channels[i].chan ? _channels[i].chan->getTrackIdentifier() : -1,
|
_channels[i].chan ? _channels[i].chan->getTrackIdentifier() : -1,
|
||||||
_channels[i].chan ? _channels[i].chan->isTerminated() : 1,
|
_channels[i].chan ? _channels[i].chan->isTerminated() : 1,
|
||||||
_channels[i].first, _channels[i].mixer_index);
|
_channels[i].first, _channels[i].mixer_index);
|
||||||
|
|
|
@ -253,7 +253,7 @@ void Scumm::CHARSET_1()
|
||||||
if (!(_features & GF_OLD256)) // FIXME
|
if (!(_features & GF_OLD256)) // FIXME
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
|
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
|
||||||
else
|
else
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i];
|
charset._colorMap[i] = _charsetData[charset._curId][i];
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ void Scumm::CHARSET_1()
|
||||||
charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
|
charset._xpos2 -= charset.getStringWidth(0, buffer, 0) >> 1;
|
||||||
}
|
}
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[18];
|
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[30 - 12];
|
||||||
else
|
else
|
||||||
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[30];
|
charset._ypos2 += getResourceAddress(rtCharset, charset._curId)[30];
|
||||||
charset._disableOffsX = 1;
|
charset._disableOffsX = 1;
|
||||||
|
@ -418,7 +418,7 @@ void Scumm::CHARSET_1()
|
||||||
case 14: {
|
case 14: {
|
||||||
int oldy;
|
int oldy;
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
oldy = getResourceAddress(rtCharset, charset._curId)[18];
|
oldy = getResourceAddress(rtCharset, charset._curId)[30 - 12];
|
||||||
else
|
else
|
||||||
oldy = getResourceAddress(rtCharset, charset._curId)[30];
|
oldy = getResourceAddress(rtCharset, charset._curId)[30];
|
||||||
|
|
||||||
|
@ -426,11 +426,11 @@ void Scumm::CHARSET_1()
|
||||||
buffer += 2;
|
buffer += 2;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
|
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
|
||||||
else
|
else
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i];
|
charset._colorMap[i] = _charsetData[charset._curId][i];
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[18] - oldy;
|
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30 - 12] - oldy;
|
||||||
else
|
else
|
||||||
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30] - oldy;
|
charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30] - oldy;
|
||||||
break;
|
break;
|
||||||
|
@ -596,7 +596,7 @@ void Scumm::drawString(int a)
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
|
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
|
||||||
else
|
else
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i];
|
charset._colorMap[i] = _charsetData[charset._curId][i];
|
||||||
|
|
||||||
|
@ -876,7 +876,7 @@ void Scumm::initCharset(int charsetno)
|
||||||
|
|
||||||
for (i = 0; i < 0x10; i++)
|
for (i = 0; i < 0x10; i++)
|
||||||
if (_features & GF_SMALL_HEADER)
|
if (_features & GF_SMALL_HEADER)
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i - 12];
|
charset._colorMap[i] = _charsetData[charset._curId][i - 12]; // FIXME - do we really want to access index -12 to -9 ?
|
||||||
else
|
else
|
||||||
charset._colorMap[i] = _charsetData[charset._curId][i];
|
charset._colorMap[i] = _charsetData[charset._curId][i];
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1159,7 @@ void Scumm::translateText(char * text, char * trans_buff) {
|
||||||
number[2] = *(text + l + 3);
|
number[2] = *(text + l + 3);
|
||||||
number[3] = 0;
|
number[3] = 0;
|
||||||
num = atol(number);
|
num = atol(number);
|
||||||
sprintf(num_s, "%ld", num);
|
sprintf(num_s, "%d", num);
|
||||||
|
|
||||||
char * buf = _languageBuffer;
|
char * buf = _languageBuffer;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
|
@ -4794,7 +4794,7 @@ void SimonState::playSound(uint sound)
|
||||||
|
|
||||||
_effects_file->read(&size, 4);
|
_effects_file->read(&size, 4);
|
||||||
// FIXME - do we really want to read a block of 4 bytes, ignoring endian issues?
|
// FIXME - do we really want to read a block of 4 bytes, ignoring endian issues?
|
||||||
printf("FOO %08lx 7 %ld \n", size, size & 0xffffff);
|
printf("FOO %08x / %d (please report this to Fingolfin)\n", size, size & 0xffffff);
|
||||||
size = size & 0xffffff;
|
size = size & 0xffffff;
|
||||||
_effects_file->seek(-1, SEEK_CUR);
|
_effects_file->seek(-1, SEEK_CUR);
|
||||||
_effects_file->read(&voc_block_hdr, sizeof(voc_block_hdr));
|
_effects_file->read(&voc_block_hdr, sizeof(voc_block_hdr));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue