コード例 #1
0
def apply_patches(game_root: Path, patches_data: EchoesDolPatchesData):
    dol_file = DolFile(_get_dol_path(game_root))

    version = typing.cast(
        EchoesDolVersion,
        find_version_for_dol(dol_file, echoes_dol_versions.ALL_VERSIONS))

    dol_file.set_editable(True)
    with dol_file:
        all_prime_dol_patches.apply_remote_execution_patch(
            version.string_display, dol_file)
        all_prime_dol_patches.apply_energy_tank_capacity_patch(
            version.health_capacity, patches_data.energy_per_tank, dol_file)
        all_prime_dol_patches.apply_reverse_energy_tank_heal_patch(
            version.sda2_base, version.dangerous_energy_tank,
            patches_data.dangerous_energy_tank, version.game, dol_file)

        echoes_dol_patches.apply_fixes(version, dol_file)
        echoes_dol_patches.apply_unvisited_room_names(
            version, dol_file, patches_data.unvisited_room_names)
        echoes_dol_patches.apply_teleporter_sounds(
            version, dol_file, patches_data.teleporter_sounds)

        echoes_dol_patches.apply_game_options_patch(
            version.game_options_constructor_address,
            patches_data.user_preferences, dol_file)
        echoes_dol_patches.apply_beam_cost_patch(
            version.beam_cost_addresses, patches_data.beam_configuration,
            dol_file)
        echoes_dol_patches.apply_safe_zone_heal_patch(
            version.safe_zone, version.sda2_base,
            patches_data.safe_zone_heal_per_second, dol_file)
        echoes_dol_patches.apply_starting_visor_patch(
            version.starting_beam_visor, patches_data.default_items, dol_file)
コード例 #2
0
def apply_patches(game_root: Path, game_specific: EchoesGameSpecific,
                  user_preferences: EchoesUserPreferences,
                  default_items: dict):
    dol_file = DolFile(_get_dol_path(game_root))

    version = find_version_for_dol(dol_file, ALL_VERSIONS_PATCHES)
    if not isinstance(version, BasePrimeDolVersion):
        return

    dol_file.set_editable(True)
    with dol_file:
        all_prime_dol_patches.apply_remote_execution_patch(
            version.string_display, dol_file)
        all_prime_dol_patches.apply_energy_tank_capacity_patch(
            version.health_capacity, game_specific, dol_file)
        all_prime_dol_patches.apply_reverse_energy_tank_heal_patch(
            version.sda2_base, version.dangerous_energy_tank,
            game_specific.dangerous_energy_tank, version.game, dol_file)

        if isinstance(version, EchoesDolVersion):
            echoes_dol_patches.apply_game_options_patch(
                version.game_options_constructor_address, user_preferences,
                dol_file)
            echoes_dol_patches.apply_beam_cost_patch(
                version.beam_cost_addresses, game_specific, dol_file)
            echoes_dol_patches.apply_safe_zone_heal_patch(
                version.safe_zone, version.sda2_base, game_specific, dol_file)
            echoes_dol_patches.apply_starting_visor_patch(
                version.starting_beam_visor, default_items, dol_file)
コード例 #3
0
def test_read_binary_version(version):
    dol_file = MagicMock()
    dol_file.read.return_value = version.build_string

    # Run
    result = dol_version.find_version_for_dol(dol_file, test_versions)

    # Assert
    dol_file.set_editable.assert_called_once_with(False)
    assert result == version