mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 12:06:54 +01:00
Improve settings handling
This commit is contained in:
parent
3e1dc34369
commit
abcff3feaf
@ -44,12 +44,13 @@ void settings_load_from_file (settings_t *settings) {
|
|||||||
assertf(!fclose(fp), "Couldn't close toml config file"); // TODO: work out why and handle appropriately.
|
assertf(!fclose(fp), "Couldn't close toml config file"); // TODO: work out why and handle appropriately.
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
||||||
|
// Handle last_rom
|
||||||
toml_table_t *last_rom = toml_table_in(conf, "last_rom");
|
toml_table_t *last_rom = toml_table_in(conf, "last_rom");
|
||||||
if (!last_rom) {
|
if (!last_rom) {
|
||||||
printf("Missing '[last_rom]' header in config\n");
|
printf("Missing '[last_rom]' header in config\n");
|
||||||
wait_ms(10000);
|
wait_ms(10000);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
toml_datum_t rom_path = toml_string_in(last_rom, "rom_path");
|
toml_datum_t rom_path = toml_string_in(last_rom, "rom_path");
|
||||||
if (!rom_path.ok) {
|
if (!rom_path.ok) {
|
||||||
printf("Couldn't read 'rom_path' value in config\n");
|
printf("Couldn't read 'rom_path' value in config\n");
|
||||||
@ -80,13 +81,16 @@ void settings_load_from_file (settings_t *settings) {
|
|||||||
printf("Found save type: %d\n", (int)tmp_save_type.u.i );
|
printf("Found save type: %d\n", (int)tmp_save_type.u.i );
|
||||||
settings->last_rom.save_type = (int)tmp_save_type.u.i;
|
settings->last_rom.save_type = (int)tmp_save_type.u.i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Handle last_state
|
||||||
toml_table_t* last_state = toml_table_in(conf, "last_state");
|
toml_table_t* last_state = toml_table_in(conf, "last_state");
|
||||||
if (!last_state) {
|
if (!last_state) {
|
||||||
printf("Missing '[last_state]' header in config\n");
|
printf("Missing '[last_state]' header in config\n");
|
||||||
wait_ms(10000);
|
wait_ms(10000);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// toml_datum_t current_directory = toml_string_in(last_state, "current_directory");
|
// toml_datum_t current_directory = toml_string_in(last_state, "current_directory");
|
||||||
// if (!current_directory.ok) {
|
// if (!current_directory.ok) {
|
||||||
@ -111,6 +115,17 @@ void settings_load_from_file (settings_t *settings) {
|
|||||||
// printf("Found autoload: %s\n", tmp_auto_load_last_rom.u.b ? "true" : "false");
|
// printf("Found autoload: %s\n", tmp_auto_load_last_rom.u.b ? "true" : "false");
|
||||||
// settings->last_state.auto_load_last_rom = tmp_auto_load_last_rom.u.b;
|
// settings->last_state.auto_load_last_rom = tmp_auto_load_last_rom.u.b;
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle boot_params
|
||||||
|
toml_table_t* boot_params = toml_table_in(conf, "boot_params");
|
||||||
|
if (!boot_params) {
|
||||||
|
printf("Missing '[boot_params]' header in config\n");
|
||||||
|
wait_ms(10000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
toml_free(conf);
|
toml_free(conf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user