FanTranslatorsInternational / Kuriimu2

Kuriimu is a general purpose game translation project manager and toolkit for authors of fan translations and game mods.
GNU General Public License v3.0
311 stars 56 forks source link

PC Support - SOR4 #159

Closed AyanamiRei1 closed 3 years ago

AyanamiRei1 commented 3 years ago

Streets of Rage 4 Steam No extension Image

textures: 8B F0 73 2A 67 65 98 CA C0 C0 C0 A8 EF 9B 99 5C 94 5F 9C 9F 56 A2 17 91 97 A8 E7 56 94 98 9B 5A 9E 5F 94 AD E7 9C 9F 57 92 9A 57 A2 17 92 5A 51

texture_table: 0A 62 00 6C 00 61 00 6E 00 6B 00 00 00 00 00 00 00 00 00 4C 00 00 00 6E 61 00 6E 00 69 00 6D 00 61 00 74 00 65 00 64 00 73 00 70 00 72 00 69 00

SOR4Explorer has issues with importing images and it's honestly making the program unusable it's shifting imported images over by 1 pixel to the right and trying to use the plugin that was made for the Switch version just gives me this error.

image

The PC version also uses a textures and texture_table file like the Switch version.

Samples: https://drive.google.com/drive/folders/1JoTAB2BsdfPVycpSb_QlKiupjANv_Rjm?usp=sharing

AyanamiRei1 commented 3 years ago

I'd like to add some of the XNB's found in the PC version work with the XNB plugin but all of the SOR4 content does not and the game also uses two textures and texture_table files they're named textures02 and texture_table02 image

onepiecefreak3 commented 3 years ago

It seems that the given texture_table is not complete. It cuts off at exactly 0x2000 bytes, with 2 bytes remaining unused. Those 2 bytes however, look like the beginning of a new entry name. And the game has no other way of telling when the table ends, then readings its content into memory and evaluating it, so it has to be valid by itself. This leads me to believe that texture_table02 may be the continuation of texture_table and contains the remaining entries. Maybe this applies to textures02 as well, but I cannot confirm that just yet.

I need you to provide the 02 files as well before I can continue my research.

onepiecefreak3 commented 3 years ago

I'm also not sure which issues are now related to SOR4Explorer, what is part of your rant, and what are actual information usable to fix this issue. Please summarize all information for the issue at hand, in relation to Kuriimu2 and to which of the two versions of the game they apply.

AyanamiRei1 commented 3 years ago

I actually found the issue the other day for some unknown reason SOR4Explorer is adding 4 extra bytes to the beginning of the image causing it do this

image

As for why is this happening I don't have a clue.

onepiecefreak3 commented 3 years ago

There is platform-specific difference in the architecture of "textures". While the switch aligns all its files to 16 bytes and precedes the compressed file with its uncompressed size, the PC version does none of the two. The PC version does not care for the decompressed size of the file, nor does it care for alignment. There are multiple explanations as to why such a difference was made, but it's not an arbitrary decision, I can tell you that.

In this specific case, the preceded decompressed size, which is written as an integer (4 bytes in size), may be interpreted as a 32bit (also 4 bytes) color. This leads to a bit of data being interpreted as part of the image data, where it shouldn't. This causes an additional pixel to be rendered, and this, of course, moves the whole image by one pixel.

I added code to the SOR4 plugin of Kuriimu2, that can determine the platform from a given "texture_list" file, and parse the data accordingly, in the newest dev build.

onepiecefreak3 commented 3 years ago

This, however, doesn't resolve the issue of the "texture_list02" file I explained above.

onepiecefreak3 commented 3 years ago

This requires you to answer me here btw.

AyanamiRei1 commented 3 years ago

I can provide a simple if you wish. Textures_list02 and textures02 has content from the new DLC inside it.

https://drive.google.com/drive/folders/1x39YdnIcEd_Jjq8F0vWTYHerF7kFW5ct?usp=sharing

onepiecefreak3 commented 3 years ago

I don't know what went wrong in your first sample link, but this time the texture table is complete and without errors. This now enables me to look through all the textures in the PC version of the "textures" file.

AyanamiRei1 commented 3 years ago

The same may have been modified if I had to guess

onepiecefreak3 commented 3 years ago

I don't know what that means.

AyanamiRei1 commented 3 years ago

Sample* My bad

AyanamiRei1 commented 3 years ago

I want to say thank you for pointing me in the right direction in order to fix SOR4Explorer it was the uncompressed integer causing the issue like you said. You can close this issue if you wish

onepiecefreak3 commented 3 years ago

Yes, now that the texture_tables were all properly tested for Switch and PC, and the plugin supports both, there is no reason keeping this issue open. If you find explicit problems with our XNB support (you seemed to have mentioned that in your second message) please create a new issue for that, if you want it fixed in Kuriimu2.