Skip to content

Commit

Permalink
Migrate to oead for Yaz0
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Jan 5, 2021
1 parent ec0288b commit a261518
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sarc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import typing

from . import sarc
import syaz0
import oead

def sarc_extract(args) -> None:
target_dir: typing.Optional[str] = args.directory
Expand Down Expand Up @@ -46,7 +46,7 @@ def _write_sarc(writer: sarc.SARCWriter, dest_file: str, dest_stream: typing.Bin
# with arg->alignment or max(yaz0_header->alignment, 0x20) if no specific alignment
# was requested by the calling code.
# So we need to make sure that the alignment value is kept.
dest_stream.write(syaz0.compress(buf.getbuffer(), data_alignment=(alignment if alignment > 0x20 else 0)))
dest_stream.write(oead.yaz0.compress(buf.getbuffer(), data_alignment=(alignment if alignment > 0x20 else 0)))
else:
shutil.copyfileobj(buf, dest_stream)

Expand Down
6 changes: 3 additions & 3 deletions sarc/sarc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import typing

import rstb
import syaz0
import oead

def _get_unpack_endian_character(big_endian: bool):
return '>' if big_endian else '<'
Expand Down Expand Up @@ -265,7 +265,7 @@ def _get_file_alignment_for_sarc(self, file: File) -> int:
if len(data) <= 0x4:
return 0
if data[0:4] == b'Yaz0' and data[0x11:0x15] == b'SARC':
data = memoryview(syaz0.decompress(data))
data = memoryview(oead.yaz0.decompress(data))
if data[0:4] != b'SARC':
return 0
# In some archives (SMO for example), Nintendo seems to use a somewhat arbitrary
Expand Down Expand Up @@ -430,7 +430,7 @@ def read_file_and_make_sarc(f: typing.BinaryIO) -> typing.Optional[SARC]:
f.seek(0)
if first_data_group_fourcc != b"SARC":
return None
data = syaz0.decompress(f.read())
data = oead.yaz0.decompress(f.read())
elif magic == b"SARC":
f.seek(0)
data = f.read()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"Topic :: Software Development :: Libraries",
],
python_requires='>=3.6',
install_requires=['rstb~=1.0', 'syaz0~=1.0'],
install_requires=['rstb~=1.0', 'oead~=1.0'],
entry_points = {
'console_scripts': [
'sarc = sarc.__main__:main',
Expand Down

0 comments on commit a261518

Please sign in to comment.