Mercurial > repos > blastem
comparison blastem.c @ 1955:1c7af12efe8b
Fix awful playback latencin in new netplay implementation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 01 May 2020 21:17:21 -0700 |
parents | 42c12d141f6e |
children | 9c01945b5d20 |
comparison
equal
deleted
inserted
replaced
1954:2fd0a8cb1c80 | 1955:1c7af12efe8b |
---|---|
458 int debug = 0; | 458 int debug = 0; |
459 int loaded = 0; | 459 int loaded = 0; |
460 system_type stype = SYSTEM_UNKNOWN, force_stype = SYSTEM_UNKNOWN; | 460 system_type stype = SYSTEM_UNKNOWN, force_stype = SYSTEM_UNKNOWN; |
461 char * romfname = NULL; | 461 char * romfname = NULL; |
462 char * statefile = NULL; | 462 char * statefile = NULL; |
463 char *reader_addr = NULL, *reader_port = NULL; | |
463 event_reader reader = {0}; | 464 event_reader reader = {0}; |
464 debugger_type dtype = DEBUGGER_NATIVE; | 465 debugger_type dtype = DEBUGGER_NATIVE; |
465 uint8_t start_in_debugger = 0; | 466 uint8_t start_in_debugger = 0; |
466 uint8_t fullscreen = FULLSCREEN_DEFAULT, use_gl = 1; | 467 uint8_t fullscreen = FULLSCREEN_DEFAULT, use_gl = 1; |
467 uint8_t debug_target = 0; | 468 uint8_t debug_target = 0; |
593 return 0; | 594 return 0; |
594 default: | 595 default: |
595 fatal_error("Unrecognized switch %s\n", argv[i]); | 596 fatal_error("Unrecognized switch %s\n", argv[i]); |
596 } | 597 } |
597 } else if (!loaded) { | 598 } else if (!loaded) { |
598 char *port = parse_addr_port(argv[i]); | 599 reader_port = parse_addr_port(argv[i]); |
599 if (port) { | 600 if (reader_port) { |
600 init_event_reader_tcp(&reader, argv[i], port); | 601 //init_event_reader_tcp(&reader, argv[i], port); |
602 reader_addr = argv[i]; | |
601 } else { | 603 } else { |
602 if (!(cart.size = load_rom(argv[i], &cart.buffer, stype == SYSTEM_UNKNOWN ? &stype : NULL))) { | 604 if (!(cart.size = load_rom(argv[i], &cart.buffer, stype == SYSTEM_UNKNOWN ? &stype : NULL))) { |
603 fatal_error("Failed to open %s for reading\n", argv[i]); | 605 fatal_error("Failed to open %s for reading\n", argv[i]); |
604 } | 606 } |
605 cart.dir = path_dirname(argv[i]); | 607 cart.dir = path_dirname(argv[i]); |
681 use_native_states = 0; | 683 use_native_states = 0; |
682 } else if (state_format && strcmp(state_format, "native")) { | 684 } else if (state_format && strcmp(state_format, "native")) { |
683 warning("%s is not a valid value for the ui.state_format setting. Valid values are gst and native\n", state_format); | 685 warning("%s is not a valid value for the ui.state_format setting. Valid values are gst and native\n", state_format); |
684 } | 686 } |
685 | 687 |
686 if (loaded) { | 688 if (loaded && !reader_addr) { |
687 if (stype == SYSTEM_UNKNOWN || reader.socket) { | 689 if (stype == SYSTEM_UNKNOWN) { |
688 if (reader.socket) { | 690 stype = detect_system_type(&cart); |
689 stype = reader_system_type(&reader); | |
690 } else { | |
691 stype = detect_system_type(&cart); | |
692 } | |
693 } | 691 } |
694 if (stype == SYSTEM_UNKNOWN) { | 692 if (stype == SYSTEM_UNKNOWN) { |
695 fatal_error("Failed to detect system type for %s\n", romfname); | 693 fatal_error("Failed to detect system type for %s\n", romfname); |
696 } | 694 } |
697 | 695 |
698 if (reader.socket) { | 696 current_system = alloc_config_system(stype, &cart, menu ? 0 : opts, force_region); |
699 current_system = alloc_config_player(stype, &reader); | |
700 } else { | |
701 current_system = alloc_config_system(stype, &cart, menu ? 0 : opts, force_region); | |
702 } | |
703 if (!current_system) { | 697 if (!current_system) { |
704 fatal_error("Failed to configure emulated machine for %s\n", romfname); | 698 fatal_error("Failed to configure emulated machine for %s\n", romfname); |
705 } | 699 } |
706 | 700 |
707 setup_saves(&cart, current_system); | 701 setup_saves(&cart, current_system); |
718 blastem_nuklear_init(!menu); | 712 blastem_nuklear_init(!menu); |
719 current_system = game_system; | 713 current_system = game_system; |
720 menu = 0; | 714 menu = 0; |
721 } | 715 } |
722 #endif | 716 #endif |
717 | |
718 if (reader_addr) { | |
719 init_event_reader_tcp(&reader, reader_addr, reader_port); | |
720 stype = reader_system_type(&reader); | |
721 if (stype == SYSTEM_UNKNOWN) { | |
722 fatal_error("Failed to detect system type for %s\n", romfname); | |
723 } | |
724 game_system = current_system = alloc_config_player(stype, &reader); | |
725 setup_saves(&cart, current_system); | |
726 update_title(current_system->info.name); | |
727 } | |
723 | 728 |
724 current_system->debugger_type = dtype; | 729 current_system->debugger_type = dtype; |
725 current_system->enter_debugger = start_in_debugger && menu == debug_target; | 730 current_system->enter_debugger = start_in_debugger && menu == debug_target; |
726 current_system->start_context(current_system, menu ? NULL : statefile); | 731 current_system->start_context(current_system, menu ? NULL : statefile); |
727 render_video_loop(); | 732 render_video_loop(); |