mirror of https://github.com/snes9xgit/snes9x.git
Fix libretro cheats.
This commit is contained in:
parent
4fde5d5120
commit
46d8f7bb80
|
@ -6,6 +6,7 @@ SOURCES_CXX := $(CORE_DIR)/apu/apu.cpp \
|
||||||
$(CORE_DIR)/apu/bapu/dsp/SPC_DSP.cpp \
|
$(CORE_DIR)/apu/bapu/dsp/SPC_DSP.cpp \
|
||||||
$(CORE_DIR)/apu/bapu/smp/smp.cpp \
|
$(CORE_DIR)/apu/bapu/smp/smp.cpp \
|
||||||
$(CORE_DIR)/apu/bapu/smp/smp_state.cpp \
|
$(CORE_DIR)/apu/bapu/smp/smp_state.cpp \
|
||||||
|
$(CORE_DIR)/bml.cpp \
|
||||||
$(CORE_DIR)/bsx.cpp \
|
$(CORE_DIR)/bsx.cpp \
|
||||||
$(CORE_DIR)/c4.cpp \
|
$(CORE_DIR)/c4.cpp \
|
||||||
$(CORE_DIR)/c4emu.cpp \
|
$(CORE_DIR)/c4emu.cpp \
|
||||||
|
|
|
@ -395,16 +395,10 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||||
void retro_cheat_reset()
|
void retro_cheat_reset()
|
||||||
{
|
{
|
||||||
S9xDeleteCheats();
|
S9xDeleteCheats();
|
||||||
S9xApplyCheats();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_cheat_set(unsigned index, bool enabled, const char *codeline)
|
void retro_cheat_set(unsigned index, bool enabled, const char *codeline)
|
||||||
{
|
{
|
||||||
uint32 address;
|
|
||||||
uint8 val;
|
|
||||||
|
|
||||||
bool8 sram;
|
|
||||||
uint8 bytes[3];//used only by GoldFinger, ignored for now
|
|
||||||
char codeCopy[256];
|
char codeCopy[256];
|
||||||
char* code;
|
char* code;
|
||||||
|
|
||||||
|
@ -421,36 +415,21 @@ void retro_cheat_set(unsigned index, bool enabled, const char *codeline)
|
||||||
code[8]='\0';
|
code[8]='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S9xGameGenieToRaw(code, address, val)==NULL ||
|
/* Goldfinger was broken and nobody noticed. Removed */
|
||||||
S9xProActionReplayToRaw(code, address, val)==NULL)
|
if (S9xAddCheatGroup ("retro", code) >= 0)
|
||||||
{
|
{
|
||||||
Cheat.c[Cheat.num_cheats].address = address;
|
if (enabled)
|
||||||
Cheat.c[Cheat.num_cheats].byte = val;
|
S9xEnableCheatGroup (Cheat.g.size () - 1);
|
||||||
Cheat.c[Cheat.num_cheats].enabled = enabled;
|
|
||||||
Cheat.c[Cheat.num_cheats].saved = FALSE; // it'll be saved next time cheats run anyways
|
|
||||||
Cheat.num_cheats++;
|
|
||||||
}
|
|
||||||
else if (S9xGoldFingerToRaw(code, address, sram, val, bytes)==NULL)
|
|
||||||
{
|
|
||||||
if (!sram)
|
|
||||||
{
|
|
||||||
for (int i=0;i<val;i++){
|
|
||||||
Cheat.c[Cheat.num_cheats].address = address;
|
|
||||||
Cheat.c[Cheat.num_cheats].byte = bytes[i];
|
|
||||||
Cheat.c[Cheat.num_cheats].enabled = enabled;
|
|
||||||
Cheat.c[Cheat.num_cheats].saved = FALSE; // it'll be saved next time cheats run anyways
|
|
||||||
Cheat.num_cheats++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("CHEAT: Failed to recognize %s\n",code);
|
printf("CHEAT: Failed to recognize %s\n",code);
|
||||||
}
|
}
|
||||||
|
|
||||||
code=strtok(NULL,"+,.; "); // bad code, ignore
|
code=strtok(NULL,"+,.; "); // bad code, ignore
|
||||||
}
|
}
|
||||||
Settings.ApplyCheats=true;
|
|
||||||
S9xApplyCheats();
|
S9xCheatsEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_descriptors(void)
|
static void init_descriptors(void)
|
||||||
|
|
Loading…
Reference in New Issue