Check for ROMs at beginning of generation (#475)
This commit is contained in:
@@ -171,6 +171,12 @@ class World(metaclass=AutoWorldRegister):
|
||||
# can also be implemented as a classmethod and called "stage_<original_name>",
|
||||
# in that case the MultiWorld object is passed as an argument and it gets called once for the entire multiworld.
|
||||
# An example of this can be found in alttp as stage_pre_fill
|
||||
@classmethod
|
||||
def assert_generate(cls) -> None:
|
||||
"""Checks that a game is capable of generating, usually checks for some base file like a ROM.
|
||||
Not run for unittests since they don't produce output"""
|
||||
pass
|
||||
|
||||
def generate_early(self) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@@ -56,6 +56,12 @@ class ALTTPWorld(World):
|
||||
self.has_progressive_bows = False
|
||||
super(ALTTPWorld, self).__init__(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def stage_assert_generate(cls, world):
|
||||
rom_file = get_base_rom_path()
|
||||
if not os.path.exists(rom_file):
|
||||
raise FileNotFoundError(rom_file)
|
||||
|
||||
def generate_early(self):
|
||||
player = self.player
|
||||
world = self.world
|
||||
|
||||
@@ -89,6 +89,10 @@ class OOTWorld(World):
|
||||
self.hint_data_available = threading.Event()
|
||||
super(OOTWorld, self).__init__(world, player)
|
||||
|
||||
@classmethod
|
||||
def stage_assert_generate(cls, world: MultiWorld):
|
||||
rom = Rom(file=get_options()['oot_options']['rom_file'])
|
||||
|
||||
def generate_early(self):
|
||||
# Player name MUST be at most 16 bytes ascii-encoded, otherwise won't write to ROM correctly
|
||||
if len(bytes(self.world.get_player_name(self.player), 'ascii')) > 16:
|
||||
|
||||
@@ -83,6 +83,12 @@ class SMWorld(World):
|
||||
self.rom_name_available_event = threading.Event()
|
||||
super().__init__(world, player)
|
||||
|
||||
@classmethod
|
||||
def stage_assert_generate(cls, world):
|
||||
rom_file = get_base_rom_path()
|
||||
if not os.path.exists(rom_file):
|
||||
raise FileNotFoundError(rom_file)
|
||||
|
||||
def generate_early(self):
|
||||
Logic.factory('vanilla')
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ class SMZ3World(World):
|
||||
self.unreachable = []
|
||||
super().__init__(world, player)
|
||||
|
||||
@classmethod
|
||||
def stage_assert_generate(cls, world):
|
||||
base_combined_rom = get_base_rom_bytes()
|
||||
|
||||
def generate_early(self):
|
||||
config = Config({})
|
||||
config.GameMode = GameMode.Multiworld
|
||||
|
||||
@@ -175,6 +175,12 @@ class SoEWorld(World):
|
||||
res.trap = item.type == pyevermizer.CHECK_TRAP
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def stage_assert_generate(cls, world):
|
||||
rom_file = get_base_rom_path()
|
||||
if not os.path.exists(rom_file):
|
||||
raise FileNotFoundError(rom_file)
|
||||
|
||||
def create_regions(self):
|
||||
# TODO: generate *some* regions from locations' requirements?
|
||||
r = Region('Menu', RegionType.Generic, 'Menu', self.player, self.world)
|
||||
|
||||
Reference in New Issue
Block a user