Header include cleanups - avoid errno among other things

This commit is contained in:
libretroadmin 2022-12-14 19:05:40 +01:00
parent 02303bd592
commit 66f2d6c4ce
10 changed files with 8 additions and 37 deletions

View File

@ -448,7 +448,6 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir) export LIB := $(LIB);$(WindowsSDKUCRTLibDir);$(WindowsSDKUMLibDir)
TARGET := $(TARGET_NAME)_libretro.dll TARGET := $(TARGET_NAME)_libretro.dll
TARGET_TMP := $(TARGET_NAME)_libretro.lib $(TARGET_NAME)_libretro.pdb $(TARGET_NAME)_libretro.exp TARGET_TMP := $(TARGET_NAME)_libretro.lib $(TARGET_NAME)_libretro.pdb $(TARGET_NAME)_libretro.exp
PSS_STYLE :=2
LDFLAGS += -DLL LDFLAGS += -DLL
# Windows # Windows
@ -542,12 +541,9 @@ FLAGS += $(fpic) $(NEW_GCC_FLAGS)
FLAGS += $(INCFLAGS) FLAGS += $(INCFLAGS)
FLAGS += $(ENDIANNESS_DEFINES) \ FLAGS += $(ENDIANNESS_DEFINES) \
-DSIZEOF_DOUBLE=8 \
$(WARNINGS) \ $(WARNINGS) \
-DMEDNAFEN_VERSION=\"0.9.38.6\" \ -DMEDNAFEN_VERSION=\"0.9.38.6\" \
-DPACKAGE=\"mednafen\" \
-DMEDNAFEN_VERSION_NUMERIC=9386 \ -DMEDNAFEN_VERSION_NUMERIC=9386 \
-DPSS_STYLE=1 \
-DMPC_FIXED_POINT \ -DMPC_FIXED_POINT \
$(CORE_DEFINE) \ $(CORE_DEFINE) \
-DSTDC_HEADERS \ -DSTDC_HEADERS \

View File

@ -63,7 +63,7 @@ ifeq ($(HAVE_HW),1)
-I$(CORE_DIR)/parallel-psx/volk -I$(CORE_DIR)/parallel-psx/volk
endif endif
COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DMEDNAFEN_VERSION_NUMERIC=926 -DPSS_STYLE=1 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS) COREFLAGS := -funroll-loops $(INCFLAGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DMEDNAFEN_VERSION_NUMERIC=926 -D__LIBRETRO__ -D_LOW_ACCURACY_ -DINLINE="inline" $(FLAGS)
COREFLAGS += -DWANT_PSX_EMU $(GLFLAGS) COREFLAGS += -DWANT_PSX_EMU $(GLFLAGS)
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"

View File

@ -6,9 +6,6 @@
// TODO?: BufferedStream, no virtual functions, yes inline functions, constructor takes a Stream* argument. // TODO?: BufferedStream, no virtual functions, yes inline functions, constructor takes a Stream* argument.
#include "mednafen.h" #include "mednafen.h"
#include <errno.h>
#include <stdio.h> // For SEEK_* defines, which we will use in Stream out of FORCE OF HABIT.
#define MODE_READ 0 #define MODE_READ 0
#define MODE_WRITE 1 #define MODE_WRITE 1

View File

@ -39,7 +39,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <time.h> #include <time.h>
#include "../general.h" #include "../general.h"

View File

@ -23,7 +23,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <time.h> #include <time.h>
#include "../general.h" #include "../general.h"

View File

@ -27,7 +27,6 @@
#include "../tremor/ivorbisfile.h" #include "../tremor/ivorbisfile.h"
#include <string.h> #include <string.h>
#include <errno.h>
#include <time.h> #include <time.h>
#include "../general.h" #include "../general.h"
@ -46,7 +45,7 @@ AudioReader::~AudioReader()
int64_t AudioReader::Read_(int16_t *buffer, int64_t frames) int64_t AudioReader::Read_(int16_t *buffer, int64_t frames)
{ {
abort(); abort();
return(false); return 0;
} }
bool AudioReader::Seek_(int64_t frame_offset) bool AudioReader::Seek_(int64_t frame_offset)
@ -58,7 +57,7 @@ bool AudioReader::Seek_(int64_t frame_offset)
int64_t AudioReader::FrameCount(void) int64_t AudioReader::FrameCount(void)
{ {
abort(); abort();
return(0); return 0;
} }
class OggVorbisReader : public AudioReader class OggVorbisReader : public AudioReader
@ -81,7 +80,7 @@ static size_t iov_read_func(void *ptr, size_t size, size_t nmemb, void *user_dat
Stream *fw = (Stream*)user_data; Stream *fw = (Stream*)user_data;
if(!size || !fw) if(!size || !fw)
return(0); return 0;
return fw->read(ptr, size * nmemb) / size; return fw->read(ptr, size * nmemb) / size;
} }
@ -92,7 +91,7 @@ static int iov_seek_func(void *user_data, int64_t offset, int whence)
if (fw) if (fw)
fw->seek(offset, whence); fw->seek(offset, whence);
return(0); return 0;
} }
static int iov_close_func(void *user_data) static int iov_close_func(void *user_data)
@ -101,7 +100,7 @@ static int iov_close_func(void *user_data)
if (fw) if (fw)
fw->close(); fw->close();
return(0); return 0;
} }
static long iov_tell_func(void *user_data) static long iov_tell_func(void *user_data)

View File

@ -42,7 +42,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <math.h> #include <math.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -15,9 +15,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h>
#include <vector> #include <vector>
#ifdef _WIN32 #ifdef _WIN32
@ -61,13 +61,9 @@ typedef struct __CHEATF
#endif #endif
static std::vector<CHEATF> cheats; static std::vector<CHEATF> cheats;
static int savecheats;
static uint32 resultsbytelen = 1;
static bool resultsbigendian = 0;
static bool CheatsActive = true; static bool CheatsActive = true;
bool SubCheatsOn = 0; static std::vector<SUBCHEAT> SubCheats[8];
std::vector<SUBCHEAT> SubCheats[8];
MemoryPatch::MemoryPatch() : addr(0), val(0), compare(0), MemoryPatch::MemoryPatch() : addr(0), val(0), compare(0),
mltpl_count(1), mltpl_addr_inc(0), mltpl_val_inc(0), copy_src_addr(0), copy_src_addr_inc(0), mltpl_count(1), mltpl_addr_inc(0), mltpl_val_inc(0), copy_src_addr(0), copy_src_addr_inc(0),
@ -85,7 +81,6 @@ static void RebuildSubCheats(void)
{ {
std::vector<CHEATF>::iterator chit; std::vector<CHEATF>::iterator chit;
SubCheatsOn = 0;
for(int x = 0; x < 8; x++) for(int x = 0; x < 8; x++)
SubCheats[x].clear(); SubCheats[x].clear();
@ -112,7 +107,6 @@ static void RebuildSubCheats(void)
else else
tmpsub.compare = -1; tmpsub.compare = -1;
SubCheats[(chit->addr + x) & 0x7].push_back(tmpsub); SubCheats[(chit->addr + x) & 0x7].push_back(tmpsub);
SubCheatsOn = 1;
} }
} }
} }
@ -217,8 +211,6 @@ void MDFNI_AddCheat(const MemoryPatch& patch)
{ {
cheats.push_back(patch); cheats.push_back(patch);
savecheats = true;
MDFNMP_RemoveReadPatches(); MDFNMP_RemoveReadPatches();
RebuildSubCheats(); RebuildSubCheats();
MDFNMP_InstallReadPatches(); MDFNMP_InstallReadPatches();
@ -228,8 +220,6 @@ int MDFNI_DelCheat(uint32 which)
{ {
cheats.erase(cheats.begin() + which); cheats.erase(cheats.begin() + which);
savecheats=1;
MDFNMP_RemoveReadPatches(); MDFNMP_RemoveReadPatches();
RebuildSubCheats(); RebuildSubCheats();
MDFNMP_InstallReadPatches(); MDFNMP_InstallReadPatches();
@ -611,8 +601,6 @@ void MDFNI_SetCheat(uint32 which, const MemoryPatch& patch)
{ {
cheats[which] = patch; cheats[which] = patch;
savecheats = true;
MDFNMP_RemoveReadPatches(); MDFNMP_RemoveReadPatches();
RebuildSubCheats(); RebuildSubCheats();
MDFNMP_InstallReadPatches(); MDFNMP_InstallReadPatches();
@ -622,7 +610,6 @@ void MDFNI_SetCheat(uint32 which, const MemoryPatch& patch)
int MDFNI_ToggleCheat(uint32 which) int MDFNI_ToggleCheat(uint32 which)
{ {
cheats[which].status = !cheats[which].status; cheats[which].status = !cheats[which].status;
savecheats = 1;
RebuildSubCheats(); RebuildSubCheats();
return(cheats[which].status); return(cheats[which].status);

View File

@ -11,14 +11,10 @@ typedef struct __SUBCHEAT
int compare; // < 0 on no compare int compare; // < 0 on no compare
} SUBCHEAT; } SUBCHEAT;
extern std::vector<SUBCHEAT> SubCheats[8];
extern bool SubCheatsOn;
bool MDFNMP_Init(uint32 ps, uint32 numpages); bool MDFNMP_Init(uint32 ps, uint32 numpages);
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
void MDFNMP_Kill(void); void MDFNMP_Kill(void);
void MDFNMP_InstallReadPatches(void); void MDFNMP_InstallReadPatches(void);
void MDFNMP_RemoveReadPatches(void); void MDFNMP_RemoveReadPatches(void);

View File

@ -17,7 +17,6 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <libretro.h> #include <libretro.h>