Mercurial > repos > blastem
comparison blastem.c @ 1428:2540c05520f2
New savestates are working. New config file option for selecting format states will be saved in. Mostly complete, needs a little more work before release
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 09 Aug 2017 23:26:51 -0700 |
parents | 9a3e003bdcb3 |
children | e2bd03ed3190 |
comparison
equal
deleted
inserted
replaced
1427:4e5797b3935a | 1428:2540c05520f2 |
---|---|
35 | 35 |
36 int headless = 0; | 36 int headless = 0; |
37 int exit_after = 0; | 37 int exit_after = 0; |
38 int z80_enabled = 1; | 38 int z80_enabled = 1; |
39 int frame_limit = 0; | 39 int frame_limit = 0; |
40 uint8_t use_native_states = 1; | |
40 | 41 |
41 tern_node * config; | 42 tern_node * config; |
42 | 43 |
43 #ifndef MIN | 44 #ifndef MIN |
44 #define MIN(a,b) ((a) < (b) ? (a) : (b)) | 45 #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
167 //initial save dir was calculated based on lock-on cartridge because that's where the save device is | 168 //initial save dir was calculated based on lock-on cartridge because that's where the save device is |
168 //save directory used for save states should still be located in the normal place | 169 //save directory used for save states should still be located in the normal place |
169 free(save_dir); | 170 free(save_dir); |
170 save_dir = get_save_dir(media); | 171 save_dir = get_save_dir(media); |
171 } | 172 } |
172 //TODO: make quick save filename dependent on system type | 173 if (use_native_states || context->type != SYSTEM_GENESIS) { |
173 parts[2] = "quicksave.gst"; | 174 parts[2] = "quicksave.state"; |
175 } else { | |
176 parts[2] = "quicksave.gst"; | |
177 } | |
174 free(save_state_path); | 178 free(save_state_path); |
175 save_state_path = alloc_concat_m(3, parts); | 179 save_state_path = alloc_concat_m(3, parts); |
176 context->save_dir = save_dir; | 180 context->save_dir = save_dir; |
177 if (info->save_type != SAVE_NONE) { | 181 if (info->save_type != SAVE_NONE) { |
178 context->load_save(context); | 182 context->load_save(context); |
415 rom_info info; | 419 rom_info info; |
416 current_system = alloc_config_system(stype, &cart, menu ? 0 : opts, force_region, &info); | 420 current_system = alloc_config_system(stype, &cart, menu ? 0 : opts, force_region, &info); |
417 if (!current_system) { | 421 if (!current_system) { |
418 fatal_error("Failed to configure emulated machine for %s\n", romfname); | 422 fatal_error("Failed to configure emulated machine for %s\n", romfname); |
419 } | 423 } |
424 char *state_format = tern_find_path(config, "ui\0state_format\0", TVAL_PTR).ptrval; | |
425 if (state_format && !strcmp(state_format, "gst")) { | |
426 use_native_states = 0; | |
427 } else if (state_format && strcmp(state_format, "native")) { | |
428 warning("%s is not a valid value for the ui.state_format setting. Valid values are gst and native\n", state_format); | |
429 } | |
420 setup_saves(&cart, &info, current_system); | 430 setup_saves(&cart, &info, current_system); |
421 update_title(info.name); | 431 update_title(info.name); |
422 if (menu) { | 432 if (menu) { |
423 menu_system = current_system; | 433 menu_system = current_system; |
424 } else { | 434 } else { |