This commit is contained in:
libretroadmin 2022-12-14 18:36:15 +01:00
parent 617a8ddbab
commit d3df335083
4 changed files with 3 additions and 27 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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 <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <vector>
#include "mednafen.h"
@ -49,19 +47,14 @@ typedef struct __CHEATF
} CHEATF;
static std::vector<CHEATF> cheats;
static int savecheats;
static uint32 resultsbytelen = 1;
static bool resultsbigendian = 0;
static bool CheatsActive = true;
bool SubCheatsOn = 0;
std::vector<SUBCHEAT> SubCheats[8];
static void RebuildSubCheats(void)
{
std::vector<CHEATF>::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);

View File

@ -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);