mirror of https://github.com/mgba-emu/mgba.git
Libretro: Add Game Boy cheat support
This commit is contained in:
parent
ec4e2e80d9
commit
76366ae70a
2
CHANGES
2
CHANGES
|
@ -99,6 +99,8 @@ Misc:
|
|||
- FFmpeg: Support lossless VP9 encoding
|
||||
- mGUI: Add fast forward toggle
|
||||
Changes from beta 1:
|
||||
Features:
|
||||
- Libretro: Add Game Boy cheat support
|
||||
Bugfixes:
|
||||
- PSP2: Fix audio crackling after fast forward
|
||||
- PSP2: Fix audio crackling when buffer is full
|
||||
|
|
|
@ -605,7 +605,9 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) {
|
|||
cheatSet = device->createSet(device, NULL);
|
||||
mCheatAddSet(device, cheatSet);
|
||||
}
|
||||
// Convert the super wonky unportable libretro format to something normal
|
||||
// Convert the super wonky unportable libretro format to something normal
|
||||
#ifdef M_CORE_GBA
|
||||
if (core->platform(core) == PLATFORM_GBA) {
|
||||
char realCode[] = "XXXXXXXX XXXXXXXX";
|
||||
size_t len = strlen(code) + 1; // Include null terminator
|
||||
size_t i, pos;
|
||||
|
@ -623,6 +625,29 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) {
|
|||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
if (core->platform(core) == PLATFORM_GB) {
|
||||
char realCode[] = "XXX-XXX-XXX";
|
||||
size_t len = strlen(code) + 1; // Include null terminator
|
||||
size_t i, pos;
|
||||
for (i = 0, pos = 0; i < len; ++i) {
|
||||
if (isspace((int) code[i]) || code[i] == '+') {
|
||||
realCode[pos] = '\0';
|
||||
} else {
|
||||
realCode[pos] = code[i];
|
||||
}
|
||||
if (pos == 11 || !realCode[pos]) {
|
||||
realCode[pos] = '\0';
|
||||
mCheatAddLine(cheatSet, realCode, 0);
|
||||
pos = 0;
|
||||
continue;
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned retro_get_region(void) {
|
||||
|
|
Loading…
Reference in New Issue