indicate values are hex in config
authornotaz <notasas@gmail.com>
Sun, 10 Dec 2023 21:26:27 +0000 (23:26 +0200)
committernotaz <notasas@gmail.com>
Sun, 10 Dec 2023 21:26:27 +0000 (23:26 +0200)
notaz/pcsx_rearmed#285

frontend/libpicofe
frontend/menu.c

index 740c6f2..be3677f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 740c6f25f8240deeb732a0a999f2a57cc2f6f6d6
+Subproject commit be3677f1867cef839334e7746ea1c8205ec73c8c
index 413f3ca..5371357 100644 (file)
@@ -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",