git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 5b883465370bc7ad5a3576d26e7cee2ec553d3a0
parent 20e5e181223b31fc2464a12351da6526af9bfbdc
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun,  3 Aug 2025 16:54:04 +0300

Work around an MSVCRT limitation, fixes cheat import on SDL Windows, fixes #716

Diffstat:
MCore/cheats.c12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/Core/cheats.c b/Core/cheats.c @@ -155,8 +155,15 @@ const GB_cheat_t *GB_import_cheat(GB_gameboy_t *gb, const char *cheat, const cha uint8_t dummy; /* GameShark */ if (strlen(cheat) == 8) { +#ifdef _WIN32 + // The hh modifier is not supported on old MSVCRT, it's completely ignored + uint32_t bank = 0; + uint32_t value = 0; +#pragma GCC diagnostic ignored "-Wformat" +#else uint8_t bank; uint8_t value; +#endif uint16_t address; if (sscanf(cheat, "%02hhx%02hhx%04hx%c", &bank, &value, &address, &dummy) == 3) { address = __builtin_bswap16(address); @@ -178,8 +185,13 @@ const GB_cheat_t *GB_import_cheat(GB_gameboy_t *gb, const char *cheat, const cha stripped_cheat[7] = stripped_cheat[8]; stripped_cheat[8] = 0; +#ifdef _WIN32 + uint32_t old_value = 0; + uint32_t value = 0; +#else uint8_t old_value; uint8_t value; +#endif uint16_t address; if (strlen(stripped_cheat) != 8 && strlen(stripped_cheat) != 6) { return NULL;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.