From f1782de2f9881063dacbe97c7fb0f6a708c513bd Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 19 Oct 2008 04:38:39 +0000 Subject: [PATCH] On Linux, use stdint.h for variable size if possible. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@216 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/PS2Etypes.h | 24 +++++++++++++++++++++++- pcsx2/Plugins.c | 2 +- pcsx2/configure.ac | 1 - pcsx2/x86/iR3000A.cpp | 6 +++--- pcsx2/x86/iVUzerorec.cpp | 4 ++-- pcsx2/x86/ix86/ix86.c | 2 +- pcsx2/x86/ix86/ix86.h | 2 +- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/pcsx2/PS2Etypes.h b/pcsx2/PS2Etypes.h index e696b08e59..7be69d8f0c 100644 --- a/pcsx2/PS2Etypes.h +++ b/pcsx2/PS2Etypes.h @@ -53,6 +53,25 @@ typedef unsigned __int64 u64; #else +#ifdef __LINUX__ +#ifdef HAVE_STDINT_H +#include "stdint.h" + +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef uintptr_t uptr; +typedef intptr_t sptr; + +#else + typedef char s8; typedef short s16; typedef int s32; @@ -62,8 +81,9 @@ typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; +#endif + -#ifdef __LINUX__ typedef union _LARGE_INTEGER { long long QuadPart; @@ -85,6 +105,7 @@ typedef union _LARGE_INTEGER #endif // _MSC_VER +#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) #if defined(__x86_64__) typedef u64 uptr; typedef s64 sptr; @@ -92,6 +113,7 @@ typedef s64 sptr; typedef u32 uptr; typedef s32 sptr; #endif +#endif typedef struct { int size; diff --git a/pcsx2/Plugins.c b/pcsx2/Plugins.c index ad276afcba..a558413dc5 100644 --- a/pcsx2/Plugins.c +++ b/pcsx2/Plugins.c @@ -509,7 +509,7 @@ int LoadPlugins() { } uptr pDsp; -static pluginsopened = 0; +static int pluginsopened = 0; extern void spu2DMA4Irq(); extern void spu2DMA7Irq(); extern void spu2Irq(); diff --git a/pcsx2/configure.ac b/pcsx2/configure.ac index 988b39cc3a..9273a04d68 100644 --- a/pcsx2/configure.ac +++ b/pcsx2/configure.ac @@ -16,7 +16,6 @@ CPPFLAGS= CXXFLAGS= CCASFLAGS= - WARNING_FLAGS="-Wall -Wno-format -Wno-unused-value" NORMAL_FLAGS="-O3 -fomit-frame-pointer ${WARNING_FLAGS}" DEBUG_FLAGS=" -g ${WARNING_FLAGS}" diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index bce680e331..66b6989641 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -81,12 +81,12 @@ uptr *psxRecLUT; // R3000A statics int psxreclog = 0; -static char *recMem; // the recompiled blocks will be here +static s8 *recMem; // the recompiled blocks will be here static BASEBLOCK *recRAM; // and the ptr to the blocks here static BASEBLOCK *recROM; // and here static BASEBLOCK *recROM1; // also here static BASEBLOCKEX *recBlocks = NULL; -static char *recPtr; +static s8 *recPtr; u32 psxpc; // recompiler psxpc int psxbranch; // set for branch static EEINST* s_pInstCache = NULL; @@ -535,7 +535,7 @@ static int recInit() { // can't have upper 4 bits nonzero! startaddr = 0x0f000000; while(!(startaddr & 0xf0000000)) { - recMem = (char*)SysMmap(startaddr, RECMEM_SIZE); + recMem = (s8*)SysMmap(startaddr, RECMEM_SIZE); if( (uptr)recMem & 0xf0000000 ) { SysMunmap((uptr)recMem, RECMEM_SIZE); recMem = NULL; startaddr += 0x00100000; diff --git a/pcsx2/x86/iVUzerorec.cpp b/pcsx2/x86/iVUzerorec.cpp index e354ff89e1..7a039e9f3c 100644 --- a/pcsx2/x86/iVUzerorec.cpp +++ b/pcsx2/x86/iVUzerorec.cpp @@ -117,7 +117,7 @@ static const u32 PWaitTimes[] = { 53, 43, 28, 23, 17, 11, 10 }; static u32 s_vuInfo; // info passed into rec insts static const u32 s_MemSize[2] = {VU0_MEMSIZE, VU1_MEMSIZE}; -static char* s_recVUMem = NULL, *s_recVUPtr = NULL; +static s8* s_recVUMem = NULL, *s_recVUPtr = NULL; // tables extern void (*recSVU_UPPER_OPCODE[64])(); @@ -350,7 +350,7 @@ void SuperVUInit(int vuindex) { if( vuindex < 0 ) { // upper 4 bits cannot be nonzero! - s_recVUMem = (char*)SysMmap(0x0c000000, VU_EXESIZE); + s_recVUMem = (s8*)SysMmap(0x0c000000, VU_EXESIZE); if( (uptr)s_recVUMem > 0x80000000 ) SysPrintf("bad SuperVU alloc %x\n", s_recVUMem); memset(s_recVUMem, 0xcd, VU_EXESIZE); diff --git a/pcsx2/x86/ix86/ix86.c b/pcsx2/x86/ix86/ix86.c index f82d767a2a..eb46e3b921 100644 --- a/pcsx2/x86/ix86/ix86.c +++ b/pcsx2/x86/ix86/ix86.c @@ -207,7 +207,7 @@ _inline void CMOV32MtoR( int cc, int to, uptr from ) } //////////////////////////////////////////////////// -_inline void x86SetPtr( char* ptr ) +_inline void x86SetPtr( s8* ptr ) { x86Ptr = ptr; } diff --git a/pcsx2/x86/ix86/ix86.h b/pcsx2/x86/ix86/ix86.h index dfe1766b1c..8945a445ed 100644 --- a/pcsx2/x86/ix86/ix86.h +++ b/pcsx2/x86/ix86/ix86.h @@ -245,7 +245,7 @@ extern void write32( u32 val ); extern void write64( u64 val ); -extern void x86SetPtr( char *ptr ); +extern void x86SetPtr( s8 *ptr ); extern void x86Shutdown( void ); extern void x86SetJ8( u8 *j8 );