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

No support for Tales of Graces F Remastered #26

Open
nekkk opened this issue Jan 31, 2025 · 12 comments
Open

No support for Tales of Graces F Remastered #26

nekkk opened this issue Jan 31, 2025 · 12 comments

Comments

@nekkk
Copy link

nekkk commented Jan 31, 2025

The game presents somehow a new .zarc compression that seems similar to TLZC but not quite the same. Would it be possible to add support to decompress/compress this archive, both for PC and NX?

I'm trying to find the game's dialogues for translation purpose.

@AdmiralCurtiss
Copy link
Owner

This is a really weird archive format and I'm not entirely sure what to do with it. I've pushed some attempt at unpacking this but this is definitely wrong for some files. If you can figure out wtf some of those header fields mean I'd be very happy to improve this.

https://github.com/AdmiralCurtiss/HyoutaTools/blob/master/HyoutaToolsLib/Tales/Graces/ZARC/ZARC.cs

@nekkk
Copy link
Author

nekkk commented Feb 5, 2025

This is a really weird archive format and I'm not entirely sure what to do with it. I've pushed some attempt at unpacking this but this is definitely wrong for some files. If you can figure out wtf some of those header fields mean I'd be very happy to improve this.

https://github.com/AdmiralCurtiss/HyoutaTools/blob/master/HyoutaToolsLib/Tales/Graces/ZARC/ZARC.cs

Hey. Thank you very much for your efforts. I'll try to help too, I have more than 1 .zarc sample to compare, if that helps.

@nekkk
Copy link
Author

nekkk commented Feb 10, 2025

Quick info that may be helpful of some sort: nx eur zarc and nx jp zarc are slightly different.

@nekkk nekkk closed this as completed Feb 10, 2025
@nekkk nekkk reopened this Feb 10, 2025
@Digote
Copy link

Digote commented Feb 11, 2025

I’m trying to see if I can help with something, but I don’t have a deep understanding of programming.

I made a change to the script so it doesn’t decompress the files. Looking at file 13185, it seems like there’s an issue with the file splitting logic, as the same file has LZMA compression applied twice and then TLZC.

Image

This repeated value of hexadecimal EE 72 times is not from the LZMA file; it seems to be related to some file splitting, but I’m not sure.

@Sora3100
Copy link

Sora3100 commented Feb 11, 2025

I figured out that Unknown1 in FileInfo is the file's hash
togf_usrdir/btl/acf/pcc003.acf -> 0xF08E949CB6CBDE2A
(pcc003 is Asbel's Honorary Knight costume)

I have also made code in lua to generate this hash

hash_gen_zarc.txt

@Sora3100
Copy link

I have figured out more

Unknown4 is multiplied by 2, then added to 0xC4BE8 (this is the start of data after the SingleFileInfo headers)
The result of this is the address of data containing the file length (2 bytes). The amount is based on BlockCount + 1, and they are in order. If the data is 0 here, you refer to the original FileLength.

@AdmiralCurtiss
Copy link
Owner

Thank you, that helped a lot. I think all the files should extract correctly now, though you need to manually do the tlzc decompression (HyoutaToolsCLI tlzc -d filename) after the unpacking for those files.

@AdmiralCurtiss
Copy link
Owner

I've also added an option where you can provide a list of filenames and it will match the hashes against that and extract as the correct filename. Maybe we can figure out a complete list somehow.

@nekkk
Copy link
Author

nekkk commented Feb 17, 2025

I've also added an option where you can provide a list of filenames and it will match the hashes against that and extract as the correct filename. Maybe we can figure out a complete list somehow.

I was looking for the filenames and the only reference I've found so far is inside the GameNative.dll (PC) or GameNative.nro (NX) file. Couldn't figure it out entirely, though.

Image

@DaZombieKiller
Copy link

This format is a doozy, I just finished adding extraction support for it in TLTool, you can view the code here.
I also have an ImHex pattern file for the format available here. Feel free to use or reference any of the code!

@Digote
Copy link

Digote commented Feb 17, 2025

I tested it after the latest changes, and the files seem to be properly divided. I also tried a simple repack, and that worked too.

Image

@Sora3100
Copy link

Here is a text file containing the names of files in the ZARC file.
You can use this in combination with HyoutaTools or TLTool

Currently, 7271 names are still missing out of 33576.
cleaned_up_graces_names.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants