From: notaz Date: Fri, 4 Oct 2024 23:07:42 +0000 (+0300) Subject: detect bad SysMessage format X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5612f82e351eac6c7ba9eb011e16f3fbb8637b3c;p=pcsx_rearmed.git detect bad SysMessage format --- diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index aafe5221..d4c886f4 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -585,7 +585,7 @@ int Load(const char *ExePath) { case 0: /* End of file */ break; default: - SysPrintf(_("Unknown CPE opcode %02x at position %08x.\n"), opcode, ftell(tmpFile) - 1); + SysPrintf(_("Unknown CPE opcode %02x at position %08zx.\n"), opcode, ftell(tmpFile) - 1); retval = -1; break; } diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index ad472592..e08bd895 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -101,7 +101,7 @@ void *psxMap(unsigned long addr, size_t size, int is_fixed, return MAP_FAILED; if (addr != 0 && ret != (void *)(uintptr_t)addr) { - SysMessage("psxMap: tried to map @%08x, got %p\n", + SysMessage("psxMap: tried to map @%08lx, got %p\n", addr, ret); if (is_fixed) { psxUnmap(ret, size, tag); diff --git a/libpcsxcore/system.h b/libpcsxcore/system.h index fe4ab404..4e65911a 100644 --- a/libpcsxcore/system.h +++ b/libpcsxcore/system.h @@ -26,8 +26,16 @@ extern "C" { int SysInit(); // Init mem and plugins void SysReset(); // Resets mem -void SysPrintf(const char *fmt, ...); // Printf used by bios syscalls -void SysMessage(const char *fmt, ...); // Message used to print msg to users +void SysPrintf(const char *fmt, ...) +#if defined(__GNUC__) && defined(__x86_64__) // some platforms have int32_t as long + __attribute__((format(printf, 1, 2))) +#endif + ; +void SysMessage(const char *fmt, ...) // Message used to print msg to users +#if defined(__GNUC__) && defined(__x86_64__) + __attribute__((format(printf, 1, 2))) +#endif + ; void *SysLoadLibrary(const char *lib); // Loads Library void *SysLoadSym(void *lib, const char *sym); // Loads Symbol from Library const char *SysLibError(); // Gets previous error loading sysbols