Skip to content

Commit

Permalink
Remove unecessary parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Oct 22, 2024
1 parent 1c058fc commit 6a5dbc9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/open_samus_returns_rando/patcher_editor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import copy
import typing
from pathlib import Path

from construct import Container # type: ignore[import-untyped]
from mercury_engine_data_structures.base_resource import BaseResource
Expand All @@ -22,8 +21,8 @@ def path_for_level(level_name: str) -> str:
class PatcherEditor(FileTreeEditor):
memory_files: dict[str, BaseResource]

def __init__(self, root: Path, parsed_rom: Rom3DS):
super().__init__(PackagedRomFs(root, parsed_rom), Game.SAMUS_RETURNS)
def __init__(self, parsed_rom: Rom3DS):
super().__init__(PackagedRomFs(parsed_rom), Game.SAMUS_RETURNS)
self.memory_files = {}

def get_file(self, path: str, type_hint: type[T] = BaseResource) -> T: # type: ignore
Expand Down
8 changes: 1 addition & 7 deletions src/open_samus_returns_rando/romfs/packaged_romfs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import io
from collections.abc import Iterator
from contextlib import contextmanager
from pathlib import Path

import construct # type: ignore
from mercury_engine_data_structures.romfs import RomFs
Expand All @@ -10,14 +9,9 @@


class PackagedRomFs(RomFs):
def __init__(self, root: Path, parsed_rom: Rom3DS):
self.root = root
self._file_stream = self.root.open("rb")
def __init__(self, parsed_rom: Rom3DS):
self.parsed_rom = parsed_rom

def __del__(self) -> None:
self._file_stream.close()

@contextmanager
def get_pkg_stream(self, file_path: str) -> Iterator[io.BytesIO]:
file_stream = io.BytesIO(self.parsed_rom.get_file_binary(file_path))
Expand Down
2 changes: 1 addition & 1 deletion src/open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def patch_extracted(input_path: Path, output_path: Path, configuration: dict) ->

validate(configuration)

editor = PatcherEditor(input_path, parsed_rom)
editor = PatcherEditor(parsed_rom)
lua_scripts = LuaEditor()

# Add all custom files from RomFS
Expand Down

0 comments on commit 6a5dbc9

Please sign in to comment.