xdanieldzd / GXTConvert

Somewhat rudimentary PS Vita GXT to PNG converter - UNMAINTAINED
Other
33 stars 6 forks source link

Error when converting GXTs from Danganronpa 1.2 Reload #1

Closed SHSLYakuza closed 8 years ago

SHSLYakuza commented 8 years ago

I don't know if it's an error or not, but when I drag and drop a gxt file to the exe, it gives me a message saying "Exception: Index was outside the bounds of the array.."

xdanieldzd commented 8 years ago

GXTConvert is technically intended to be used from the command line - converting a whole directory of files and saving them in another directory -, as per the instructions on the main page.

However, for one, you have definitely encountered an error I need to fix, as it should not crash under any circumstances. And that aside, yours is certainly a valid use case (i.e. drag and drop of GXT(s) onto the program's executable, expecting to get PNGs out of it), so I'll look into adding support for this.

In the meantime, please try using the program from the command line as per the main page, that should still work.

SHSLYakuza commented 8 years ago

Thanks, I've tried using CMD, it finds the files inside the directory and says the operation is completed, however I do not find any png files.

xdanieldzd commented 8 years ago

Does it still give you the "Index was outside the bounds of the array" error message above "Operation completed"? If so, you probably haven't specified an output directory. If it doesn't, then I might have another bug I need to look into.

SHSLYakuza commented 8 years ago

I have two different outcomes now, the first is if I make the output the same as the input, in this case it gives me this. ss 2016-03-22 at 12 39 12 But if I make it another output entirely, it gives me this. ss 2016-03-22 at 12 40 29

DaZombieKiller commented 8 years ago

Does GXTConvert handle compressed GXTs? Judging by some initial analysis by rr- (author of arc_unpacker), these GXT files appear to be lzss compressed with a very small container added on top, which has the decompressed file size

xdanieldzd commented 8 years ago

Yeah, that second outcome looks like these GXTs are compressed. I've been told on Twitter yesterday that this particular format has been figured out, but I'm somewhat on the fence if decompressing it is in the scope of GXTConvert. If this particular compression format was common to GXTs from multiple different games from different developers, and not just the Danganronpa series, then yes, I'll need to add support for it for sure.

At the same time, I have added support for BUV chunks inside GXTs, which I've so far only seen in one of the Sword Art Online games, so that might be something that game's developers have cooked up, too...

I suppose I'll look into writing an implementation of a decompressor for these, just for the fun of it at the very least. If that'll make it into GXTConvert, I'm not sure yet.

SHSLYakuza commented 8 years ago

Ah, I see. From the looks of it, it seems to be the case with the Danganronpa games mostly, but I can't be too sure.

xdanieldzd commented 8 years ago

As of commit 9c9b8b34c6b399a976071512dc490ca927489038, I've changed the program's command line argument syntax and behavior. You should now be able to:

  1. Drag and drop directories and files onto the executable, even multiple and both kinds of inputs at the same time.
  2. Optionally use the command line to specify an output directory, using the "--option" or "-o" switch.

Now, if you select, for example, a directory called textures and files called image1.gxt and image2.gxt and drop all three onto the executable, you should then get a directory called textures (converted) and files called image1 (Texture 0).png and image2 (Texture 0).png in the respective input's locations, i.e. if the full path to the directory is C:\temp\textures\ the output will be in C:\temp\textures (converted)\.

There's a new build with these changes available here. It's currently still marked as pre-release as I'd really appreciate feedback, etc. about the new functionality.

I have not tackled compressed GXTs yet, as this seemed like the more important thing to work on for now.

SHSLYakuza commented 8 years ago

The drag and drop works great now, although, in an unrelated note, I still get the unknown magic number error which is of course because those gxt files are compressed.

xdanieldzd commented 8 years ago

Alright, as this new build of GXTConvert appears to work without any problems, I have removed its pre-release status. So I am now treating it as the current release, and thus commit 9c9b8b3 as the solution to this issue's original problem (i.e. the "index out of bounds" exception on drag and drop).

As for the compressed GXTs, I don't think I'll add support for them right now. For the time being, I assume the compression format is specific to the Danganronpa games, and that it is not specifically image- or texture-related and could be used on non-image files as well.

Thus, for these files, I'll direct you to ex. BlackDragonHunt's dr_dec Python script, which can decompress the files, which can then be used by GXTConvert.