ScanMountGoat / xc3_lib

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

xc3_tex bad magic error for xc2 LAPS wilay #9

Closed KenNZ23 closed 7 months ago

KenNZ23 commented 10 months ago

Wilay images located in 'menu\layout' fail to process with the following error:

thread 'main' panicked at xc3_tex\src\main.rs:79:76:
called `Result::unwrap()` on an `Err` value: bad magic at 0x0: [76, 65, 80, 83]

Ideally adding support for whatever is different about these files would be nice, though if this is not a short term fix then perhaps a cleaner error message could be helpful so people understand that these files are different and as yet unsupported, even though they share the same file extension.

ScanMountGoat commented 10 months ago

Xenoblade 2 has some wilay files with LAPS magic that aren't supported yet. I don't believe they contain any images, but I haven't looked into it much yet.

KenNZ23 commented 10 months ago

It may be that these files contain nothing worthwhile in them from a modding perspective - I'm not sure - but even should this be the case (and maybe especially if this is the case) a clearer explanation provided by xc3_tex regarding why the programme does not process the file is likely to be helpful, rather than the current output (eg. LAPS type wilay file detected. Only LAHD type wilay files are supported.) - but perhaps this is best determined when the situation regarding what they contain becomes clearer.

I don't want to spam your issue tracker with requests, so I'll just mention here as a follow on that I think adding additional explanations to your programmes in various ways could be useful. As an example, the xc3_tex could list the files it successfully outputs along with their dds format/compression (it appears to vary from file to file) rather than its current status where it literally says nothing. I appreciate there is probably a balance to be struck between saying too little and saying too much for some people. And I strongly suspect you have higher priorities for the xc3_lib and its associated programmes at this this stage than adding pretty output messages (though knowing the dds format/compression each file uses would be kind of useful).

ScanMountGoat commented 10 months ago

In the future, please make a separate issue if you have any additional unrelated requests or bug reports. This makes it easier to track what was actually added or fixed.

LAPS type wilay file detected. Only LAHD type wilay files are supported

Adding output like this seems reasonable, but I'll need to look into the file data some more.

As an example, the xc3_tex could list the files it successfully outputs along with their dds format/compression (it appears to vary from file to file) rather than its current status where it literally says nothing.

Is there a particular use case where you need to know the compression? Most DDS files are just going to use BC7Unorm (BC7 Linear) because it has the best quality. One of the benefits of fully rebuilding the files is that you can change the resolution and format of the images and still generate a valid file.

KenNZ23 commented 10 months ago

Is there a particular use case where you need to know the compression? Most DDS files are just going to use BC7Unorm (BC7 Linear) because it has the best quality. One of the benefits of fully rebuilding the files is that you can change the resolution and format of the images and still generate a valid file.

No particular case that I can think of - I was just assuming that the differences in DDS compression on the files output by xc3_tex was significant and should be matched when editing. If this is not the case, then I will ignore it and will generally run with BC7Unorm when saving modified files.