From 60693a92fbeeba0afec0b34c7628499881e25cfb Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 10 Dec 2023 23:26:27 +0200 Subject: [PATCH] indicate values are hex in config notaz/pcsx_rearmed#285 --- frontend/libpicofe | 2 +- frontend/menu.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/libpicofe b/frontend/libpicofe index 740c6f25..be3677f1 160000 --- a/frontend/libpicofe +++ b/frontend/libpicofe @@ -1 +1 @@ -Subproject commit 740c6f25f8240deeb732a0a999f2a57cc2f6f6d6 +Subproject commit be3677f1867cef839334e7746ea1c8205ec73c8c diff --git a/frontend/menu.c b/frontend/menu.c index 413f3caf..53713570 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -499,6 +499,13 @@ static void make_cfg_fname(char *buf, size_t size, int is_game) static void keys_write_all(FILE *f); static char *mystrip(char *str); +static void write_u32_value(FILE *f, u32 v) +{ + if (v > 7) + fprintf(f, "0x"); + fprintf(f, "%x\n", v); +} + static int menu_write_config(int is_game) { char cfgfile[MAXPATHLEN]; @@ -521,13 +528,13 @@ static int menu_write_config(int is_game) fprintf(f, "%s\n", (char *)config_data[i].val); break; case 1: - fprintf(f, "%x\n", *(u8 *)config_data[i].val); + write_u32_value(f, *(u8 *)config_data[i].val); break; case 2: - fprintf(f, "%x\n", *(u16 *)config_data[i].val); + write_u32_value(f, *(u16 *)config_data[i].val); break; case 4: - fprintf(f, "%x\n", *(u32 *)config_data[i].val); + write_u32_value(f, *(u32 *)config_data[i].val); break; default: printf("menu_write_config: unhandled len %d for %s\n", -- 2.39.5