mirror of https://github.com/mgba-emu/mgba.git
Libretro: Cheat code support
This commit is contained in:
parent
d5284f0f31
commit
51e9042f62
1
CHANGES
1
CHANGES
|
@ -4,6 +4,7 @@ Features:
|
||||||
- I/O viewer
|
- I/O viewer
|
||||||
- Booting of multiboot images
|
- Booting of multiboot images
|
||||||
- Customization of GIF recording
|
- Customization of GIF recording
|
||||||
|
- Libretro: Cheat code support
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- Util: Fix PowerPC PNG read/write pixel order
|
- Util: Fix PowerPC PNG read/write pixel order
|
||||||
- Qt: Use safer isLoaded check in GameController
|
- Qt: Use safer isLoaded check in GameController
|
||||||
|
|
|
@ -212,7 +212,6 @@ bool GBACheatAddProActionReplay(struct GBACheatSet*, uint32_t op1, uint32_t op2)
|
||||||
bool GBACheatAddProActionReplayLine(struct GBACheatSet*, const char* line);
|
bool GBACheatAddProActionReplayLine(struct GBACheatSet*, const char* line);
|
||||||
|
|
||||||
bool GBACheatAddAutodetect(struct GBACheatSet*, uint32_t op1, uint32_t op2);
|
bool GBACheatAddAutodetect(struct GBACheatSet*, uint32_t op1, uint32_t op2);
|
||||||
bool GBACheatAddAutodetectLine(struct GBACheatSet*, const char* line);
|
|
||||||
|
|
||||||
bool GBACheatParseFile(struct GBACheatDevice*, struct VFile*);
|
bool GBACheatParseFile(struct GBACheatDevice*, struct VFile*);
|
||||||
bool GBACheatSaveFile(struct GBACheatDevice*, struct VFile*);
|
bool GBACheatSaveFile(struct GBACheatDevice*, struct VFile*);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "util/common.h"
|
#include "util/common.h"
|
||||||
|
|
||||||
|
#include "gba/cheats.h"
|
||||||
#include "gba/renderers/video-software.h"
|
#include "gba/renderers/video-software.h"
|
||||||
#include "gba/serialize.h"
|
#include "gba/serialize.h"
|
||||||
#include "gba/context/context.h"
|
#include "gba/context/context.h"
|
||||||
|
@ -45,6 +46,8 @@ static struct CircleBuffer rumbleHistory;
|
||||||
static struct GBARumble rumble;
|
static struct GBARumble rumble;
|
||||||
static struct GBALuminanceSource lux;
|
static struct GBALuminanceSource lux;
|
||||||
static int luxLevel;
|
static int luxLevel;
|
||||||
|
static struct GBACheatDevice cheats;
|
||||||
|
static struct GBACheatSet cheatSet;
|
||||||
|
|
||||||
unsigned retro_api_version(void) {
|
unsigned retro_api_version(void) {
|
||||||
return RETRO_API_VERSION;
|
return RETRO_API_VERSION;
|
||||||
|
@ -190,10 +193,18 @@ void retro_init(void) {
|
||||||
blip_set_rates(context.gba->audio.left, GBA_ARM7TDMI_FREQUENCY, 32768);
|
blip_set_rates(context.gba->audio.left, GBA_ARM7TDMI_FREQUENCY, 32768);
|
||||||
blip_set_rates(context.gba->audio.right, GBA_ARM7TDMI_FREQUENCY, 32768);
|
blip_set_rates(context.gba->audio.right, GBA_ARM7TDMI_FREQUENCY, 32768);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GBACheatDeviceCreate(&cheats);
|
||||||
|
GBACheatSetInit(&cheatSet, "libretro");
|
||||||
|
GBACheatAddSet(&cheats, &cheatSet);
|
||||||
|
GBACheatAttachDevice(context.gba, &cheats);
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_deinit(void) {
|
void retro_deinit(void) {
|
||||||
GBAContextDeinit(&context);
|
GBAContextDeinit(&context);
|
||||||
|
GBACheatRemoveSet(&cheats, &cheatSet);
|
||||||
|
GBACheatDeviceDestroy(&cheats);
|
||||||
|
GBACheatSetDeinit(&cheatSet);
|
||||||
free(renderer.outputBuffer);
|
free(renderer.outputBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,14 +314,14 @@ bool retro_unserialize(const void* data, size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_cheat_reset(void) {
|
void retro_cheat_reset(void) {
|
||||||
// TODO: Cheats
|
GBACheatSetDeinit(&cheatSet);
|
||||||
|
GBACheatSetInit(&cheatSet, "libretro");
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_cheat_set(unsigned index, bool enabled, const char* code) {
|
void retro_cheat_set(unsigned index, bool enabled, const char* code) {
|
||||||
// TODO: Cheats
|
|
||||||
UNUSED(index);
|
UNUSED(index);
|
||||||
UNUSED(enabled);
|
UNUSED(enabled);
|
||||||
UNUSED(code);
|
GBACheatAddLine(&cheatSet, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned retro_get_region(void) {
|
unsigned retro_get_region(void) {
|
||||||
|
|
Loading…
Reference in New Issue