mirror of
https://github.com/libretro/snes9x2010.git
synced 2024-12-11 18:26:11 +00:00
Don't depend on obscure endian rules
This commit is contained in:
parent
b480abce0d
commit
76aca1f909
@ -61,7 +61,7 @@ else ifeq ($(platform), osx)
|
||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||
fpic := -fPIC
|
||||
ifeq ($(arch),ppc)
|
||||
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -D__ppc__ -DMSB_FIRST
|
||||
endif
|
||||
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
||||
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
||||
@ -116,7 +116,7 @@ else ifeq ($(platform), ps3)
|
||||
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
||||
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
||||
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -D__ppc__ -DMSB_FIRST
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# sncps3
|
||||
@ -124,7 +124,7 @@ else ifeq ($(platform), sncps3)
|
||||
TARGET := $(TARGET_NAME)_libretro_ps3.a
|
||||
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
|
||||
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -D__ppc__ -DMSB_FIRST
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# Lightweight PS3 Homebrew SDK
|
||||
@ -132,7 +132,7 @@ else ifeq ($(platform), psl1ght)
|
||||
TARGET := $(TARGET_NAME)_libretro_psl1ght.a
|
||||
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
|
||||
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
|
||||
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -D__ppc__ -DMSB_FIRST
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# PSP
|
||||
@ -156,7 +156,7 @@ else ifeq ($(platform), ngc)
|
||||
TARGET := $(TARGET_NAME)_libretro_ngc.a
|
||||
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
||||
CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -D__ppc__ -DMSB_FIRST
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# Nintendo Wii
|
||||
@ -164,7 +164,7 @@ else ifeq ($(platform), wii)
|
||||
TARGET := $(TARGET_NAME)_libretro_wii.a
|
||||
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
||||
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DMSB_FIRST
|
||||
CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -D__ppc__ -DMSB_FIRST
|
||||
STATIC_LINKING = 1
|
||||
|
||||
# ARM
|
||||
|
@ -127,7 +127,7 @@
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;_LIB;__LIBRETRO__;INLINE=_inline;__POWERPC__;__ppc__;CORRECT_VRAM_READS;BLARGG_BIG_ENDIAN=1;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;_LIB;__LIBRETRO__;INLINE=_inline;__POWERPC__;__ppc__;CORRECT_VRAM_READS;MSB_FIRST;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\libsnes;$(SolutionDir)\..\src;$(SolutionDir)\..\utils\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
@ -215,7 +215,7 @@
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;_LIB;__LIBRETRO__;INLINE=_inline;WORDS_BIGENDIAN;__POWERPC__;__ppc__;CORRECT_VRAM_READS;BLARGG_BIG_ENDIAN=1;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;_LIB;__LIBRETRO__;INLINE=_inline;MSB_FIRST;__POWERPC__;__ppc__;CORRECT_VRAM_READS;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\libsnes;$(SolutionDir)\..\src;$(SolutionDir)\..\utils\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -237,7 +237,7 @@
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;_LIB;__LIBRETRO__;INLINE=_inline;WORDS_BIGENDIAN;__POWERPC__;__ppc__;CORRECT_VRAM_READS;BLARGG_BIG_ENDIAN=1;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;_LIB;__LIBRETRO__;INLINE=_inline;MSB_FIRST;__POWERPC__;__ppc__;CORRECT_VRAM_READS;RIGHTSHIFT_IS_SAR;%(PreprocessorDefinitions);EXPORT=;_XBOX360;FRONTEND_SUPPORTS_RGB565</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\libsnes;$(SolutionDir)\..\src;$(SolutionDir)\..\utils\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -65,49 +65,8 @@
|
||||
#define BLARGG_CPU_RISC 1
|
||||
#endif
|
||||
|
||||
/* BLARGG_BIG_ENDIAN, BLARGG_LITTLE_ENDIAN: Determined automatically, otherwise only */
|
||||
/* one may be #defined to 1. Only needed if something actually depends on byte order. */
|
||||
#if !defined (BLARGG_BIG_ENDIAN) && !defined (BLARGG_LITTLE_ENDIAN)
|
||||
#ifdef __GLIBC__
|
||||
/* GCC handles this for us */
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define BLARGG_BIG_ENDIAN 1
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if defined (LSB_FIRST) || defined (__LITTLE_ENDIAN__) || BLARGG_CPU_X86 || \
|
||||
defined(ANDROID_X86) || defined(ANDROID_MIPS) || \
|
||||
defined(__BLACKBERRY_QNX__) || (defined (LITTLE_ENDIAN) && LITTLE_ENDIAN+0 != 1234)
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
|
||||
#if defined (MSB_FIRST) || defined (__BIG_ENDIAN__) || defined (WORDS_BIGENDIAN) || \
|
||||
defined (__sparc__) || BLARGG_CPU_POWERPC || \
|
||||
(defined (BIG_ENDIAN) && BIG_ENDIAN+0 != 4321)
|
||||
#define BLARGG_BIG_ENDIAN 1
|
||||
#elif !defined(__mips__) || !defined(ANDROID_MIPS)
|
||||
/* No endian specified; assume little-endian, since it's most common */
|
||||
#define BLARGG_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BLARGG_LITTLE_ENDIAN && BLARGG_BIG_ENDIAN
|
||||
#undef BLARGG_LITTLE_ENDIAN
|
||||
#undef BLARGG_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#if BLARGG_NONPORTABLE
|
||||
/* Optimized implementation if byte order is known */
|
||||
#if BLARGG_LITTLE_ENDIAN
|
||||
#define GET_LE16( addr ) (*(uint16_t*) (addr))
|
||||
#define GET_LE32( addr ) (*(uint32_t*) (addr))
|
||||
#define SET_LE16( addr, data ) (void) (*(uint16_t*) (addr) = (data))
|
||||
#define SET_LE32( addr, data ) (void) (*(uint32_t*) (addr) = (data))
|
||||
#elif BLARGG_BIG_ENDIAN
|
||||
#ifdef MSB_FIRST
|
||||
#if BLARGG_CPU_POWERPC
|
||||
/* PowerPC has special byte-reversed instructions */
|
||||
#if defined (__SNC__)
|
||||
@ -133,33 +92,39 @@
|
||||
#define SET_LE32( addr, in ) ({asm( "stwbrx %0,0,%1" : : "r" (in), "r" (addr) );})
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
/* Optimized implementation if byte order is known */
|
||||
#define GET_LE16( addr ) (*(uint16_t*) (addr))
|
||||
#define GET_LE32( addr ) (*(uint32_t*) (addr))
|
||||
#define SET_LE16( addr, data ) (void) (*(uint16_t*) (addr) = (data))
|
||||
#define SET_LE32( addr, data ) (void) (*(uint32_t*) (addr) = (data))
|
||||
#endif
|
||||
#else
|
||||
static INLINE unsigned get_le16( void const* p )
|
||||
{
|
||||
return (unsigned) ((unsigned char const*) p) [1] << 8 | (unsigned) ((unsigned char const*) p) [0];
|
||||
return (unsigned) ((unsigned char const*) p) [1] << 8 | (unsigned) ((unsigned char const*) p) [0];
|
||||
}
|
||||
|
||||
static INLINE blargg_ulong get_le32( void const* p )
|
||||
{
|
||||
return (blargg_ulong) ((unsigned char const*) p) [3] << 24 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [2] << 16 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [1] << 8 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [0];
|
||||
return (blargg_ulong) ((unsigned char const*) p) [3] << 24 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [2] << 16 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [1] << 8 |
|
||||
(blargg_ulong) ((unsigned char const*) p) [0];
|
||||
}
|
||||
|
||||
static INLINE void set_le16( void* p, unsigned n )
|
||||
{
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
}
|
||||
|
||||
static INLINE void set_le32( void* p, blargg_ulong n )
|
||||
{
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [2] = (unsigned char) (n >> 16);
|
||||
((unsigned char*) p) [3] = (unsigned char) (n >> 24);
|
||||
((unsigned char*) p) [0] = (unsigned char) n;
|
||||
((unsigned char*) p) [1] = (unsigned char) (n >> 8);
|
||||
((unsigned char*) p) [2] = (unsigned char) (n >> 16);
|
||||
((unsigned char*) p) [3] = (unsigned char) (n >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -276,7 +276,6 @@ void _makepath (char * path, const char * a, const char * dir, const char * fnam
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) || defined(_XBOX1) || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(ANDROID)) || defined(PSP) || defined(__BLACKBERRY_QNX__) || defined(IOS) || defined(ARM)
|
||||
#define LSB_FIRST
|
||||
#ifndef EMSCRIPTEN
|
||||
#define FAST_LSB_WORD_ACCESS
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user