ScanMountGoat / xc3_lib

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

Wilay images used as 'sprite sheets/image maps' don't appear to output correctly #8

Closed KenNZ23 closed 10 months ago

KenNZ23 commented 10 months ago

NB. I'm using Xenoblade Chronicles 2 as my example as this appears to be the easiest to test and handles the problem cleaner. On XC3 the issue may crash the game

The addition of .wilay support to xc3_tex has enabled the successful export and re-import of various images in the 'menu\images' directory (thank you!). Examples include the thumbnails in the events theatre or the blade character images - these successfully show up in game. However, wilay files which contain a single image with multiple icons or images drawn on it fail to display in-game when re-imported. Examples include character portrait image sheet or button icons layout sheet (I've used the buttons as an example image below as the character sheet contains spoilers for some people). button_0

I have tested all of the above with unedited dds images output by xc3_tex - ie. I have tried re-importing the exact image that xc3_tex has outputted without modifying it in anyway. This should rule out any issue that could be created by the user modifying the image and re-saving.

In the example image below, you can see that a modified mythra (fim_bl_002.wilay) is displaying successfully, while character portraits in the top right (mnu_facel.wilay) and button icons in the bottom right (button.wilay) are failing to show: xc2_mmmytha_noicons

ScanMountGoat commented 10 months ago

I'm glad you were able to get some edits working. Based on what you described, it sounds like the files aren't rebuilding properly when saving. xc3_tex tries to read all the values and fully rebuild the file on save since it's more reliable than just replacing the image bytes.

There are currently some issues with some files where not all the data is saved properly even if the values aren't modified. Thankfully, I'm able to detect this in my automated tests. Please still continue to report the game version and file path for files that don't work properly. It helps with figuring out what differences with saving are actually causing issues in game.

ScanMountGoat commented 10 months ago

Fixed on latest commit. You can compile from source or wait for the next release (0.4.0).

KenNZ23 commented 10 months ago

I can confirm this appears to be fixed with regards to Xenoblade Chronicles 2, thanks.

I also tried this with Xenoblade Chronicles 3, using a couple of the button image maps (icon_button.wilay and icon_button_y.wilay) as these are used in the main menu so are very easy to check. Unfortunately, there still appear to be issues getting these to work without freezing or crashing. I am aware that XC3 is more resistant to modding and requires a separate file-loader mod to get any mods working. It's therefore hard for me to tell where the problem lies, though I observe that I can use xc3_tex to change the images in the event theatre without any issues (in that case they are simply jpegs inside the wilay). Could it be possible that XC3 handles these images slightly differently to XC2? I presume xc3_tex doesn't require specifying the json shader files?

ScanMountGoat commented 10 months ago

It's therefore hard for me to tell where the problem lies

There's a known file rebuilding issue detected by automated tests in xc3_test, so this is just something I need to fix on my end. Xenoblade 3 uses a different revision of the same format. I do appreciate you listing specific files to make final in game testing easier later.

I've created a separate issue for the Xenoblade 3 errors at #10. The shader JSON is just used for xc3_viewer and xc3_gltf. You can see what arguments are required by running xc3_tex --help or xc3_tex edit-wilay --help.