From d3df3350831b70220f1e0cae695d974c427cd1b7 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Wed, 14 Dec 2022 18:36:15 +0100 Subject: [PATCH] Cleanups --- libretro.cpp | 6 +++--- mednafen/mednafen.h | 7 ------- mednafen/mempatcher.cpp | 14 -------------- mednafen/mempatcher.h | 3 --- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/libretro.cpp b/libretro.cpp index 235eb04..005e2c4 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -1143,7 +1143,7 @@ static int HuCLoadCD(const char *bios_path) memset(ROMSpace, 0xFF, 262144); - memcpy(ROMSpace, GET_FDATA_PTR(fp) + (GET_FSIZE_PTR(fp) & 512), ((GET_FSIZE_PTR(fp) & ~512) > 262144) ? 262144 : (GET_FSIZE_PTR(fp) &~ 512) ); + memcpy(ROMSpace, fp->data + (fp->size & 512), ((fp->size & ~512) > 262144) ? 262144 : (fp->size &~ 512) ); if (fp) file_close(fp); @@ -1509,8 +1509,8 @@ static bool MDFNI_LoadGame(const char *path, const char *ext, if(!GameFile) goto error; - content_data = GET_FDATA_PTR(GameFile); - content_size = GET_FSIZE_PTR(GameFile); + content_data = GameFile->data; + content_size = GameFile->size; } if(Load(content_data, content_size) <= 0) diff --git a/mednafen/mednafen.h b/mednafen/mednafen.h index 01a6a04..c43a6e4 100644 --- a/mednafen/mednafen.h +++ b/mednafen/mednafen.h @@ -12,13 +12,6 @@ #define strcasecmp _stricmp #endif -#define GET_FDATA(fp) (fp.f_data) -#define GET_FSIZE(fp) (fp.f_size) -#define GET_FEXTS(fp) (fp.f_ext) -#define GET_FDATA_PTR(fp) (fp->data) -#define GET_FSIZE_PTR(fp) (fp->size) -#define GET_FEXTS_PTR(fp) (fp->ext) - void MDFN_LoadGameCheats(void *override); void MDFN_FlushGameCheats(int nosave); diff --git a/mednafen/mempatcher.cpp b/mednafen/mempatcher.cpp index 14675d3..5776709 100644 --- a/mednafen/mempatcher.cpp +++ b/mednafen/mempatcher.cpp @@ -14,10 +14,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include -#include #include #include "mednafen.h" @@ -49,19 +47,14 @@ typedef struct __CHEATF } CHEATF; static std::vector cheats; -static int savecheats; -static uint32 resultsbytelen = 1; -static bool resultsbigendian = 0; static bool CheatsActive = true; -bool SubCheatsOn = 0; std::vector SubCheats[8]; static void RebuildSubCheats(void) { std::vector::iterator chit; - SubCheatsOn = 0; for(int x = 0; x < 8; x++) SubCheats[x].clear(); @@ -88,7 +81,6 @@ static void RebuildSubCheats(void) else tmpsub.compare = -1; SubCheats[(chit->addr + x) & 0x7].push_back(tmpsub); - SubCheatsOn = 1; } } } @@ -196,8 +188,6 @@ int MDFNI_AddCheat(const char *name, uint32 addr, uint64 val, uint64 compare, ch return(0); } - savecheats = 1; - MDFNMP_RemoveReadPatches(); RebuildSubCheats(); MDFNMP_InstallReadPatches(); @@ -210,8 +200,6 @@ int MDFNI_DelCheat(uint32 which) free(cheats[which].name); cheats.erase(cheats.begin() + which); - savecheats=1; - MDFNMP_RemoveReadPatches(); RebuildSubCheats(); MDFNMP_InstallReadPatches(); @@ -615,7 +603,6 @@ int MDFNI_SetCheat(uint32 which, const char *name, uint32 a, uint64 v, uint64 co next->bigendian = bigendian; RebuildSubCheats(); - savecheats=1; return(1); } @@ -624,7 +611,6 @@ int MDFNI_SetCheat(uint32 which, const char *name, uint32 a, uint64 v, uint64 co int MDFNI_ToggleCheat(uint32 which) { cheats[which].status = !cheats[which].status; - savecheats = 1; RebuildSubCheats(); return(cheats[which].status); diff --git a/mednafen/mempatcher.h b/mednafen/mempatcher.h index ddcaf0c..2359d3f 100644 --- a/mednafen/mempatcher.h +++ b/mednafen/mempatcher.h @@ -10,13 +10,10 @@ typedef struct __SUBCHEAT int compare; // < 0 on no compare } SUBCHEAT; -extern bool SubCheatsOn; - bool MDFNMP_Init(uint32 ps, uint32 numpages); void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM); void MDFNMP_Kill(void); - void MDFNMP_InstallReadPatches(void); void MDFNMP_RemoveReadPatches(void);