(args: argparse.Namespace)
| 646 | |
| 647 | |
| 648 | def cmd_write(args: argparse.Namespace) -> int: |
| 649 | path = Path(args.file) if args.file else default_save_path() |
| 650 | |
| 651 | if args.from_existing and path.exists(): |
| 652 | data = read_save(path) or fresh_default() |
| 653 | else: |
| 654 | data = fresh_default() |
| 655 | |
| 656 | if args.reset: |
| 657 | data = fresh_default() |
| 658 | |
| 659 | if args.all: |
| 660 | args.unlock_chars = True |
| 661 | args.unlock_stages = True |
| 662 | args.item_switch = True |
| 663 | args.sound_test = True |
| 664 | args.complete_1p = True |
| 665 | args.perfect_btt = True |
| 666 | args.perfect_btp = True |
| 667 | args.vs_fill = True |
| 668 | # ground_mask records unique VS stages played; max it so the save |
| 669 | # also reflects "every stage has been played at least once." |
| 670 | if args.ground_mask is None: |
| 671 | data.ground_mask = GROUND_MASK_ALL |
| 672 | |
| 673 | if args.unlock_chars: |
| 674 | apply_unlock_chars(data) |
| 675 | if args.unlock_stages: |
| 676 | apply_unlock_inishie(data) |
| 677 | if args.sound_test: |
| 678 | apply_unlock_soundtest(data) |
| 679 | if args.item_switch: |
| 680 | apply_unlock_itemswitch(data) |
| 681 | if args.complete_1p: |
| 682 | apply_complete_1p(data, difficulty=args.completion_difficulty, |
| 683 | hiscore=args.completion_hiscore) |
| 684 | if args.perfect_btt: |
| 685 | apply_perfect_btt(data, time_ticks=args.perfect_time_ticks) |
| 686 | if args.perfect_btp: |
| 687 | apply_perfect_btp(data, time_ticks=args.perfect_time_ticks) |
| 688 | if args.vs_fill: |
| 689 | apply_vs_fill( |
| 690 | data, |
| 691 | ko_each=args.vs_ko_each, |
| 692 | time_seconds=args.vs_time_seconds, |
| 693 | damage_given=args.vs_damage_given, |
| 694 | damage_taken=args.vs_damage_taken, |
| 695 | selfdestructs=args.vs_selfdestructs, |
| 696 | games_played=args.vs_games_played, |
| 697 | avg_player_count=args.vs_avg_players, |
| 698 | ) |
| 699 | |
| 700 | if args.unlock_mask is not None: |
| 701 | data.unlock_mask = parse_int(args.unlock_mask) & 0xFF |
| 702 | if args.fighter_mask is not None: |
| 703 | data.fighter_mask = parse_int(args.fighter_mask) & 0xFFFF |
| 704 | if args.ground_mask is not None: |
| 705 | data.ground_mask = parse_int(args.ground_mask) & 0xFFFF |
nothing calls this directly
no test coverage detected