UnityPy icon indicating copy to clipboard operation
UnityPy copied to clipboard

How to replace texture2d from .splitN file?

Open ablegao opened this issue 3 years ago • 4 comments

How to replace texture2d from .splitN file?

ablegao avatar May 31 '22 06:05 ablegao

see https://github.com/K0lb3/UnityPy/blob/e4d834527ae5dd13d43bbef4d31572f92a4c8afe/UnityPy/environment.py#L49 or https://github.com/nesrak1/UABEA/blob/fe71d7b5ca742388d8529894bf25e8090089e82b/UABEAvalonia/MainWindow.axaml.cs#L694 or https://github.com/SeriousCache/UABE/blob/edc33b430f58acfd5501535731a22edfc7440ec9/AssetsTools/AssetsFileReader.cpp#L908

CCTV-1 avatar Jun 05 '22 09:06 CCTV-1

Sorry for the late reply.

split files are just a normal SerializedFile split into multiple files. So in theory, you can simply save the loaded (split) SerializedFile and replace all the .splitN files with the merged one. I haven't come around to test this myself yet tho.

K0lb3 avatar Jun 07 '22 13:06 K0lb3

Merging into one file is possible, but the merged file will be very large and will exceed the limits of Google Play, so how to split the large file?

ablegao avatar Jun 18 '22 09:06 ablegao

Sorry for the late reply again. I guess that you can also try simply splitting the final file yourself at the same size as the original. So e.g.

split_data = env.file.save()
orig_split_size: int
name: str

for i,offset in enumerate(range(0, len(split_data, orig_split_size)):
    with open(f"{name}.split{i}", "wb") as f:
        f.write(split_data[offset:offset+orig_split_size])

K0lb3 avatar Jul 30 '22 20:07 K0lb3