Skip to content

Commit

Permalink
indicate values are hex in config
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Dec 13, 2023
1 parent 963f416 commit fd65dd9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/libpicofe
Submodule libpicofe updated 2 files
+1 −7 input.c
+25 −12 menu.c
13 changes: 10 additions & 3 deletions frontend/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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",
Expand Down

0 comments on commit fd65dd9

Please sign in to comment.