ScanMountGoat / xc3_lib

Xenoblade Chronicles file format and rendering libraries
MIT License
12 stars 3 forks source link

Xenoblade 1 DE LAGP wilay files don't rebuild correctly #45

Closed joshbirnholz closed 5 days ago

joshbirnholz commented 2 weeks ago

I'm trying to replace the controller icons in Xenoblade Definitive Edition with PS5 controller icons. I've replaced many of the texture images successfully. However, I've only gotten it to work for wilay files with only one texture. The game crashes when trying to load a texture from a wilay file that has more than one texture in it. This happens even if I unpack a wilay file from the romfs and rebuild it without changing any of the textures.

joshbirnholz commented 2 weeks ago

Okay, well, I was able to change some textures in a file with multiple textures. But specifically, these files (from romfs/menu/image/) are still not working:

ScanMountGoat commented 2 weeks ago

This happens even if I unpack a wilay file from the romfs and rebuild it without changing any of the textures.

The output after saving with xc3_tex isn't identical with the original for these files. This can cause crashes in game if any important data is missing in the output. The wilay format is pretty complex, so this will take some time to narrow down.

joshbirnholz commented 2 weeks ago

I see. Well, I’m looking forward to an update! I’d love to be able to release this texture pack! Fortunately replacing many of the visible textures for button icons worked just fine.

ScanMountGoat commented 1 week ago

I don't have a way to test those files in game at the moment. You can try building xc3_tex from source using cargo build --release on the latest commit and see if it's fixed by the recent changes. I'll continue to look into the wilay differences after saving for the next release.

joshbirnholz commented 1 week ago

I built from the latest commit and sadly, saw the same result -- crashes in the same places.

Interestingly since opening this issue I continued replacing textures and had no other issues. The only files I had issues with were the ones listed above. (And those are the only ones left to replace to complete my texture pack!)

ScanMountGoat commented 5 days ago

I was able to fix some missing data in those files. This format is hard to debug since alignment isn't consistent and a lot of arrays don't have an explicitly stored length. It's easy for a few elements to get lost when estimating the length.

This may be fixed if you try again on the latest commit.

joshbirnholz commented 5 days ago

I tested it out on the latest commit, and replacing those textures now works perfectly. Now I can release my texture pack :)

Thanks for your work, it's much appreciated!

ScanMountGoat commented 5 days ago

Nice! The remaining file differences seem to be padding or alignment differences, so I'm marking this as resolved for now.