1
0
mirror of synced 2025-01-24 15:12:19 +01:00

Remove seek arguments from read/write struct funcs

This commit is contained in:
Viv 2023-07-31 09:28:17 -04:00
parent 15cbb9e62a
commit dd86df83aa
2 changed files with 2 additions and 8 deletions

View File

@ -480,8 +480,7 @@ def parse_fumen(fumen_file: str,
def read_struct(file: BinaryIO,
order: str,
format_string: str,
seek: int = 0) -> tuple[Any, ...]:
format_string: str) -> tuple[Any, ...]:
"""
Interpret bytes as packed binary data.
@ -497,8 +496,6 @@ def read_struct(file: BinaryIO,
- interpreted_string: A string containing interpreted byte values,
based on the specified 'fmt' format characters.
"""
if seek:
file.seek(seek)
expected_size = struct.calcsize(order + format_string)
byte_string = file.read(expected_size)
# One "official" fumen (AC11\deo\deo_n.bin) runs out of data early

View File

@ -55,10 +55,7 @@ def write_fumen(path_out: str, song: FumenCourse) -> None:
def write_struct(file: BinaryIO,
order: str,
format_string: str,
value_list: list[Any],
seek: int = 0) -> None:
value_list: list[Any]) -> None:
"""Pack (int, float, etc.) values into a string of bytes, then write."""
if seek:
file.seek(seek)
packed_bytes = struct.pack(order + format_string, *value_list)
file.write(packed_bytes)