Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some worlds: some typing in LocalRom #3090

Merged
merged 6 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions worlds/alttp/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import threading
import concurrent.futures
import bsdiff4
from typing import Optional, List
from typing import Collection, Optional, List, SupportsIndex

from BaseClasses import CollectionState, Region, Location, MultiWorld
from Utils import local_path, user_path, int16_as_bytes, int32_as_bytes, snes_to_pc, is_frozen, parse_yaml, read_snes_rom
Expand Down Expand Up @@ -71,13 +71,13 @@ def __init__(self, file, patch=True, vanillaRom=None, name=None, hash=None):
def read_byte(self, address: int) -> int:
return self.buffer[address]

def read_bytes(self, startaddress: int, length: int) -> bytes:
def read_bytes(self, startaddress: int, length: int) -> bytearray:
return self.buffer[startaddress:startaddress + length]

def write_byte(self, address: int, value: int):
self.buffer[address] = value

def write_bytes(self, startaddress: int, values):
def write_bytes(self, startaddress: int, values: Collection[SupportsIndex]) -> None:
self.buffer[startaddress:startaddress + len(values)] = values

def encrypt_range(self, startaddress: int, length: int, key: bytes):
Expand Down
2 changes: 1 addition & 1 deletion worlds/dkc3/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def read_bit(self, address: int, bit_number: int) -> bool:
def read_byte(self, address: int) -> int:
return self.buffer[address]

def read_bytes(self, startaddress: int, length: int) -> bytes:
def read_bytes(self, startaddress: int, length: int) -> bytearray:
return self.buffer[startaddress:startaddress + length]

def write_byte(self, address: int, value: int):
Expand Down
2 changes: 1 addition & 1 deletion worlds/smw/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def read_bit(self, address: int, bit_number: int) -> bool:
def read_byte(self, address: int) -> int:
return self.buffer[address]

def read_bytes(self, startaddress: int, length: int) -> bytes:
def read_bytes(self, startaddress: int, length: int) -> bytearray:
return self.buffer[startaddress:startaddress + length]

def write_byte(self, address: int, value: int):
Expand Down
6 changes: 3 additions & 3 deletions worlds/yoshisisland/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Utils
from worlds.Files import APDeltaPatch
from settings import get_settings
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Collection, SupportsIndex

from .Options import YoshiColors, BowserDoor, PlayerGoal, MinigameChecks

Expand Down Expand Up @@ -413,13 +413,13 @@ def read_bit(self, address: int, bit_number: int) -> bool:
def read_byte(self, address: int) -> int:
return self.buffer[address]

def read_bytes(self, startaddress: int, length: int) -> bytes:
def read_bytes(self, startaddress: int, length: int) -> bytearray:
return self.buffer[startaddress:startaddress + length]

def write_byte(self, address: int, value: int) -> None:
self.buffer[address] = value

def write_bytes(self, startaddress: int, values: bytearray) -> None:
def write_bytes(self, startaddress: int, values: Collection[SupportsIndex]) -> None:
self.buffer[startaddress:startaddress + len(values)] = values

def write_to_file(self, file: str) -> None:
Expand Down
Loading