initial work on procedure patch

This commit is contained in:
Silvris
2023-07-16 02:29:33 -05:00
parent 21228f9c63
commit 3fbbb4f361
2 changed files with 122 additions and 4 deletions

View File

@@ -2,13 +2,13 @@ from __future__ import annotations
import os
import sys
from typing import Tuple, Optional, TypedDict
from typing import Tuple, Optional, TypedDict, Union
if __name__ == "__main__":
import ModuleUpdate
ModuleUpdate.update()
from worlds.Files import AutoPatchRegister, APDeltaPatch
from worlds.Files import AutoPatchRegister, APDeltaPatch, APProcedurePatch
class RomMeta(TypedDict):
@@ -20,7 +20,7 @@ class RomMeta(TypedDict):
def create_rom_file(patch_file: str) -> Tuple[RomMeta, str]:
auto_handler = AutoPatchRegister.get_handler(patch_file)
if auto_handler:
handler: APDeltaPatch = auto_handler(patch_file)
handler: Union[APDeltaPatch, APProcedurePatch] = auto_handler(patch_file)
target = os.path.splitext(patch_file)[0]+handler.result_file_ending
handler.patch(target)
return {"server": handler.server,