Don't rely on LSB_FIRST
This commit is contained in:
@@ -66,10 +66,10 @@ int read32le(uint32 *Bufo, FILE *fp)
|
||||
uint32 buf;
|
||||
if (fread(&buf, 1, 4, fp) < 4)
|
||||
return 0;
|
||||
#ifdef LSB_FIRST
|
||||
*(uint32*)Bufo = buf;
|
||||
#else
|
||||
#ifdef MSB_FIRST
|
||||
*(uint32*)Bufo = ((buf & 0xFF) << 24) | ((buf & 0xFF00) << 8) | ((buf & 0xFF0000) >> 8) | ((buf & 0xFF000000) >> 24);
|
||||
#else
|
||||
*(uint32*)Bufo = buf;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -89,23 +89,23 @@ int read32le_mem(uint32 *Bufo, memstream_t *mem)
|
||||
uint32 buf;
|
||||
if(memstream_read(mem, &buf, 4)<4)
|
||||
return 0;
|
||||
#ifdef LSB_FIRST
|
||||
*(uint32*)Bufo=buf;
|
||||
#else
|
||||
#ifdef MSB_FIRST
|
||||
*(uint32*)Bufo=((buf&0xFF)<<24)|((buf&0xFF00)<<8)|((buf&0xFF0000)>>8)|((buf&0xFF000000)>>24);
|
||||
#else
|
||||
*(uint32*)Bufo=buf;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int read16le(char *d, FILE *fp)
|
||||
{
|
||||
#ifdef LSB_FIRST
|
||||
return((fread(d, 1, 2, fp) < 2) ? 0 : 2);
|
||||
#else
|
||||
#ifdef MSB_FIRST
|
||||
int ret;
|
||||
ret = fread(d + 1, 1, 1, fp);
|
||||
ret += fread(d, 1, 1, fp);
|
||||
return ret < 2 ? 0 : 2;
|
||||
#else
|
||||
return((fread(d, 1, 2, fp) < 2) ? 0 : 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -106,14 +106,14 @@ static int SubWrite(memstream_t *mem, SFORMAT *sf)
|
||||
memstream_write(mem, sf->desc, 4);
|
||||
write32le_mem(sf->s&(~RLSB), mem);
|
||||
|
||||
#ifndef LSB_FIRST
|
||||
#ifdef MSB_FIRST
|
||||
if(sf->s&RLSB)
|
||||
FlipByteOrder(sf->v,sf->s&(~RLSB));
|
||||
#endif
|
||||
|
||||
memstream_write(mem, (uint8 *)sf->v, sf->s&(~RLSB));
|
||||
/* Now restore the original byte order. */
|
||||
#ifndef LSB_FIRST
|
||||
#ifdef MSB_FIRST
|
||||
if(sf->s&RLSB)
|
||||
FlipByteOrder(sf->v,sf->s&(~RLSB));
|
||||
#endif
|
||||
@@ -180,7 +180,7 @@ static int ReadStateChunk(memstream_t *mem, SFORMAT *sf, int size)
|
||||
{
|
||||
memstream_read(mem, (uint8 *)tmp->v, tmp->s&(~RLSB));
|
||||
|
||||
#ifndef LSB_FIRST
|
||||
#ifdef MSB_FIRST
|
||||
if(tmp->s&RLSB)
|
||||
FlipByteOrder(tmp->v,tmp->s&(~RLSB));
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@ include ../../../../Makefile.common
|
||||
|
||||
LOCAL_SRC_FILES = $(SOURCES_C)
|
||||
|
||||
LOCAL_CFLAGS += -DWANT_GRIFFIN -DINLINE=inline -DSOUND_QUALITY=0 -DPSS_STYLE=1 -DLSB_FIRST -D__LIBRETRO__ -DHAVE_ASPRINTF -DFCEU_VERSION_NUMERIC=9813 -DFRONTEND_SUPPORTS_RGB565
|
||||
LOCAL_CFLAGS += -DWANT_GRIFFIN -DINLINE=inline -DSOUND_QUALITY=0 -DPSS_STYLE=1 -D__LIBRETRO__ -DHAVE_ASPRINTF -DFCEU_VERSION_NUMERIC=9813 -DFRONTEND_SUPPORTS_RGB565
|
||||
LOCAL_C_INCLUDES = $(LOCAL_PATH)/$(CORE_DIR)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\";"$(SolutionDir)\..\..\..\""
|
||||
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB;__LIBRETRO__;LSB_FIRST;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB;__LIBRETRO__;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -56,7 +56,7 @@
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\";"$(SolutionDir)\..\..\..\""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB;__LIBRETRO__;LSB_FIRST;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB;__LIBRETRO__;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
@@ -91,7 +91,7 @@
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\";"$(SolutionDir)\..\..\..\""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;__LIBRETRO__;LSB_FIRST;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;__LIBRETRO__;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
@@ -127,7 +127,7 @@
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\";"$(SolutionDir)\..\..\..\""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB;__LIBRETRO__;LSB_FIRST;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB;__LIBRETRO__;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
@@ -163,7 +163,7 @@
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\";"$(SolutionDir)\..\..\..\""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB;__LIBRETRO__;LSB_FIRST;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB;__LIBRETRO__;LOCAL_LE;INLINE=_inline;SOUND_QUALITY=0;PSS_STYLE=2;ZLIB;PATH_MAX=1024;_XBOX1;FCEU_VERSION_NUMERIC=9813;FRONTEND_SUPPORTS_RGB565;WANT_GRIFFIN;HAVE_EXTERNAL_ZLIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
|
||||
Reference in New Issue
Block a user