Push the compiler to reserve space for negative commands

Cheevos define a special macro defined to -1 and uses it as one of the
values for enum event_command. Make this value a part of the enum
definition so that this type is not optimized to be unsigned.
This commit is contained in:
pstef 2025-03-20 21:30:23 +00:00
parent a58ac85dbc
commit c3dfc7ec63
3 changed files with 6 additions and 1 deletions

View file

@ -990,7 +990,7 @@ void rcheevos_test(void)
#ifdef HAVE_THREADS
if (rcheevos_locals.queued_command != CMD_EVENT_NONE)
{
if ((int)rcheevos_locals.queued_command == CMD_CHEEVOS_FINALIZE_LOAD)
if (rcheevos_locals.queued_command == CMD_CHEEVOS_FINALIZE_LOAD)
rcheevos_finalize_game_load_on_ui_thread();
else
command_event(rcheevos_locals.queued_command, NULL);

View file

@ -41,6 +41,7 @@ RETRO_BEGIN_DECLS
enum event_command
{
CMD_SPECIAL = -1,
CMD_EVENT_NONE = 0,
/* Resets RetroArch. */
CMD_EVENT_RESET,

View file

@ -5486,6 +5486,10 @@ bool command_event(enum event_command cmd, void *data)
/* Deprecated */
case CMD_EVENT_SEND_DEBUG_INFO:
break;
/* Do nothing about the special negative value */
case CMD_SPECIAL:
break;
}
return true;