comparison menu.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 4e5797b3935a
children c886c54d8cf1
comparison
equal deleted inserted replaced
1427:4e5797b3935a 1428:2540c05520f2
427 } else { 427 } else {
428 numslotname[5] = '0' + dst; 428 numslotname[5] = '0' + dst;
429 slotname = numslotname; 429 slotname = numslotname;
430 } 430 }
431 char const *parts[] = {gen->header.next_context->save_dir, PATH_SEP, slotname}; 431 char const *parts[] = {gen->header.next_context->save_dir, PATH_SEP, slotname};
432 char *gstpath = alloc_concat_m(3, parts); 432 char *statepath = alloc_concat_m(3, parts);
433 genesis_context *next = (genesis_context *)gen->header.next_context; 433 genesis_context *next = (genesis_context *)gen->header.next_context;
434 434 deserialize_buffer state;
435 uint32_t pc = load_gst(next, gstpath); 435 uint32_t pc = 0;
436 free(gstpath); 436 if (load_from_file(&state, statepath)) {
437 genesis_deserialize(&state, next);
438 free(state.data);
439 //HACK
440 pc = next->m68k->last_prefetch_address;
441 } else {
442 strcpy(statepath + strlen(statepath)-strlen("state"), "gst");
443 pc = load_gst(next, statepath);
444 }
445 free(statepath);
437 if (!pc) { 446 if (!pc) {
438 break; 447 break;
439 } 448 }
440 next->m68k->resume_pc = get_native_address_trans(next->m68k, pc); 449 next->m68k->resume_pc = get_native_address_trans(next->m68k, pc);
441 } 450 }