Pokemon Emerald: Convert to procedure patch (#2995)

* Pokemon Emerald: Convert to procedure patch

* Pokemon Emerald: Remove assertion for vanilla rom's existence

* Pokemon Emerald: Add APPP implication to changelog

* Pokemon Emerald: Move procedure patch changelog line to new version

* Pokemon Emerald: Modify changelog versions

* Pokemon Emerald: Fix patch file download not appearing

---------

Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
Bryce Wilson
2024-05-04 23:08:24 -06:00
committed by GitHub
parent 7603b4a88f
commit 7e61211365
5 changed files with 335 additions and 215 deletions

View File

@@ -5,6 +5,7 @@ from collections import Counter
import copy
import logging
import os
import pkgutil
from typing import Any, Set, List, Dict, Optional, Tuple, ClassVar, TextIO, Union
from BaseClasses import ItemClassification, MultiWorld, Tutorial, LocationProgressType
@@ -25,7 +26,7 @@ from .options import (Goal, DarkCavesRequireFlash, HmRequirements, ItemPoolType,
from .pokemon import (get_random_move, get_species_id_by_label, randomize_abilities, randomize_learnsets,
randomize_legendary_encounters, randomize_misc_pokemon, randomize_starters,
randomize_tm_hm_compatibility,randomize_types, randomize_wild_encounters)
from .rom import PokemonEmeraldDeltaPatch, create_patch
from .rom import PokemonEmeraldProcedurePatch, write_tokens
class PokemonEmeraldWebWorld(WebWorld):
@@ -60,7 +61,7 @@ class PokemonEmeraldSettings(settings.Group):
"""File name of your English Pokemon Emerald ROM"""
description = "Pokemon Emerald ROM File"
copy_to = "Pokemon - Emerald Version (USA, Europe).gba"
md5s = [PokemonEmeraldDeltaPatch.hash]
md5s = [PokemonEmeraldProcedurePatch.hash]
rom_file: PokemonEmeraldRomFile = PokemonEmeraldRomFile(PokemonEmeraldRomFile.copy_to)
@@ -126,9 +127,6 @@ class PokemonEmeraldWorld(World):
def stage_assert_generate(cls, multiworld: MultiWorld) -> None:
from .sanity_check import validate_regions
if not os.path.exists(cls.settings.rom_file):
raise FileNotFoundError(cls.settings.rom_file)
assert validate_regions()
def get_filler_item_name(self) -> str:
@@ -591,7 +589,9 @@ class PokemonEmeraldWorld(World):
randomize_opponent_parties(self)
randomize_starters(self)
create_patch(self, output_directory)
patch = PokemonEmeraldProcedurePatch(player=self.player, player_name=self.multiworld.player_name[self.player])
patch.write_file("base_patch.bsdiff4", pkgutil.get_data(__name__, "data/base_patch.bsdiff4"))
write_tokens(self, patch)
del self.modified_trainers
del self.modified_tmhm_moves
@@ -600,6 +600,10 @@ class PokemonEmeraldWorld(World):
del self.modified_starters
del self.modified_species
# Write Output
out_file_name = self.multiworld.get_out_file_name_base(self.player)
patch.write(os.path.join(output_directory, f"{out_file_name}{patch.patch_file_ending}"))
def write_spoiler(self, spoiler_handle: TextIO):
if self.options.dexsanity:
from collections import defaultdict