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

unable to repack properly #234

Open
nijinekoyo opened this issue Apr 3, 2023 · 15 comments
Open

unable to repack properly #234

nijinekoyo opened this issue Apr 3, 2023 · 15 comments
Labels
duplicate This issue or pull request already exists feature New feature or request

Comments

@nijinekoyo
Copy link

nijinekoyo commented Apr 3, 2023

When I tried to repackage a data.unity3d file, I found that even if I didn’t modify anything, the file he packed still couldn’t run normally, and no matter whether I used L4Z or LZAM, he couldn’t make him pack the same file as before.
File link: https://1drv.ms/u/s!Ah0MLfDa4AHqajuahlRKrWL2O7Q?e=h2iChD

@nijinekoyo
Copy link
Author

Running with the repackaged resources gives the following error
81%1)6Y_J{ QPPEKSYU(XAP

@nesrak1
Copy link
Owner

nesrak1 commented Apr 3, 2023

If this is one of these packed web files, UABEA can't handle it out of the box. We already had this conversation in a different issue, but some web files start with the standard bundle header so they look like just a bundle, but in reality there are many other files also packed after it as well. Whenever UABEA saves, it strips the rest of the data since it's not part of the bundle. I don't have an answer for how to handle it but I'm sure there's a separate listing file that shows which part of the packed file extracts to other files.

@nijinekoyo
Copy link
Author

This is indeed one of the web package files. It comes from the ba2.data file. Is there any other way to modify it?

@nesrak1
Copy link
Owner

nesrak1 commented Apr 3, 2023

The last time this was asked was issue #223. I don't have a solution right now.

@nesrak1 nesrak1 added duplicate This issue or pull request already exists feature New feature or request labels Apr 3, 2023
@nijinekoyo
Copy link
Author

nijinekoyo commented Apr 3, 2023

Are you still interested in solving this, I can provide more details

@nijinekoyo
Copy link
Author

I have successfully modified global-metadata.dat and encapsulated it back to achieve string replacement

@nesrak1
Copy link
Owner

nesrak1 commented Apr 3, 2023

Did you do that by overwriting the original file in a hex editor? Or something else? What would be best is to find a way to automate how to extract and repack the files.

@nijinekoyo
Copy link
Author

Almost, I achieved it by replacing the binary

@nijinekoyo
Copy link
Author

nijinekoyo commented Apr 4, 2023

https://1drv.ms/u/s!Ah0MLfDa4AHqebRTCXYTIhzbE2o?e=NfRTEW
This is the complete game file, which can be run through Nginx

@nijinekoyo
Copy link
Author

The millennium_quest\static_prod2\Build\ba2.data.br file is the data file of the game, don't care about the br suffix, it has been decompressed

@nijinekoyo
Copy link
Author

nijinekoyo commented Apr 4, 2023

The millennium_quest\static_prod2\Build\ba2.wasm.br file is the WASM of the game. It passed the Il2CppDumper test, and its function should be similar to libil2cpp.so

@nijinekoyo
Copy link
Author

nijinekoyo commented Apr 4, 2023

image
The ba2.data.br file header contains the file type and packaged file path

@nijinekoyo
Copy link
Author

The global-metadata.dat contained in the ba2.data.br file can be replaced by binary replacement, and it can run normally after testing

@nijinekoyo
Copy link
Author

A simple binary replacement script

with open('./ba2.data', 'rb') as f:
    data = f.read()

with open('./global-metadata.dat', 'rb') as f:
    metadata = f.read()

with open('./global-metadata_new.dat', 'rb') as f:
    new_metadata = f.read()

# 替换二进制
new_data = data.replace(metadata, new_metadata)

with open('./ba2_new.data', 'wb') as f:
    f.write(new_data)

@nijinekoyo
Copy link
Author

nijinekoyo commented Apr 4, 2023

Everything was going fine until I tried to replace the data.unity3d repackaged by UABEA and I got an error no matter if I modified the file or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants