Remove seek
arguments from read/write struct funcs
This commit is contained in:
parent
15cbb9e62a
commit
dd86df83aa
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user