comparison blastem.c @ 2289:92449b47cce8

Integrate VGM player into main blastem binary
author Michael Pavone <pavone@retrodev.com>
date Sat, 04 Feb 2023 22:44:44 -0800
parents 5d3411f52d00
children 59fd8aa352e2
comparison
equal deleted inserted replaced
2288:efc75ea79164 2289:92449b47cce8
292 system_header *current_system; 292 system_header *current_system;
293 system_header *menu_system; 293 system_header *menu_system;
294 system_header *game_system; 294 system_header *game_system;
295 void persist_save() 295 void persist_save()
296 { 296 {
297 if (!game_system) { 297 if (!game_system || !game_system->persist_save) {
298 return; 298 return;
299 } 299 }
300 game_system->persist_save(game_system); 300 game_system->persist_save(game_system);
301 } 301 }
302 302
341 } 341 }
342 } 342 }
343 343
344 void setup_saves(system_media *media, system_header *context) 344 void setup_saves(system_media *media, system_header *context)
345 { 345 {
346 if (!context->load_save) {
347 // system doesn't support saves
348 return;
349 }
346 static uint8_t persist_save_registered; 350 static uint8_t persist_save_registered;
347 rom_info *info = &context->info; 351 rom_info *info = &context->info;
348 char *save_dir = get_save_dir(info->is_save_lock_on ? media->chain : media); 352 char *save_dir = get_save_dir(info->is_save_lock_on ? media->chain : media);
349 char const *parts[] = {save_dir, PATH_SEP, get_save_fname(info->save_type)}; 353 char const *parts[] = {save_dir, PATH_SEP, get_save_fname(info->save_type)};
350 free(save_filename); 354 free(save_filename);
446 static uint32_t opts = 0; 450 static uint32_t opts = 0;
447 static uint8_t force_region = 0; 451 static uint8_t force_region = 0;
448 void init_system_with_media(const char *path, system_type force_stype) 452 void init_system_with_media(const char *path, system_type force_stype)
449 { 453 {
450 if (game_system) { 454 if (game_system) {
451 game_system->persist_save(game_system); 455 if (game_system->persist_save) {
456 game_system->persist_save(game_system);
457 }
452 //swap to game context arena and mark all allocated pages in it free 458 //swap to game context arena and mark all allocated pages in it free
453 if (current_system == menu_system) { 459 if (current_system == menu_system) {
454 current_system->arena = set_current_arena(game_system->arena); 460 current_system->arena = set_current_arena(game_system->arena);
455 } 461 }
456 mark_all_free(); 462 mark_all_free();
594 stype = force_stype = SYSTEM_SMS; 600 stype = force_stype = SYSTEM_SMS;
595 } else if (!strcmp("gen", argv[i])) { 601 } else if (!strcmp("gen", argv[i])) {
596 stype = force_stype = SYSTEM_GENESIS; 602 stype = force_stype = SYSTEM_GENESIS;
597 } else if (!strcmp("jag", argv[i])) { 603 } else if (!strcmp("jag", argv[i])) {
598 stype = force_stype = SYSTEM_JAGUAR; 604 stype = force_stype = SYSTEM_JAGUAR;
605 } else if (!strcmp("media", argv[i])) {
606 stype = force_stype = SYSTEM_MEDIA_PLAYER;
599 } else { 607 } else {
600 fatal_error("Unrecognized machine type %s\n", argv[i]); 608 fatal_error("Unrecognized machine type %s\n", argv[i]);
601 } 609 }
602 break; 610 break;
603 case 's': 611 case 's':
631 " -h Print this help text\n" 639 " -h Print this help text\n"
632 " -r (J|U|E) Force region to Japan, US or Europe respectively\n" 640 " -r (J|U|E) Force region to Japan, US or Europe respectively\n"
633 " -m MACHINE Force emulated machine type to MACHINE. Valid values are:\n" 641 " -m MACHINE Force emulated machine type to MACHINE. Valid values are:\n"
634 " sms - Sega Master System/Mark III\n" 642 " sms - Sega Master System/Mark III\n"
635 " gen - Sega Genesis/Megadrive\n" 643 " gen - Sega Genesis/Megadrive\n"
636 " jag - Atari Jaguar\n" 644 " media - Media Player\n"
637 " -f Toggles fullscreen mode\n" 645 " -f Toggles fullscreen mode\n"
638 " -g Disable OpenGL rendering\n" 646 " -g Disable OpenGL rendering\n"
639 " -s FILE Load a GST format savestate from FILE\n" 647 " -s FILE Load a GST format savestate from FILE\n"
640 " -o FILE Load FILE as a lock-on cartridge\n" 648 " -o FILE Load FILE as a lock-on cartridge\n"
641 " -d Enter debugger on startup\n" 649 " -d Enter debugger on startup\n"