Assorted PS3 texture export/conversion fixes - #17
Conversation
|
I don't completely remember why I added endian swap in the first place, but it must've been a good reason Namely I believed that the pixel components in the pixel buffers are in big-endian according to PPC in the first place, regardless of remap If you can, I would make sure that it works correctly across the majority of textures, namely i'd check GTHD, GT5P/5 and track textures |
|
Edit: outdated, see PR body for latest changes.
|
CELL_GCM_TEXTURE_A8R8G8B8 outputs’ reversed channels|
@Nenkai 11 months later and finally some updates ready for review |

I finally found the time to wrap this and some other issues that cropped up along the way.
Reversed channels
In the ‘Swap channels for DDS’ block, each pixel’s bytes were first reversed (
[A, R, G, B]→[B, G, R, A]), before the individual channels were extracted using theInR/InG/InB/InAremap offsets. The remapping offsets describe the pixel’s original, un-reversed byte layout, so applying them after the reversal incorrectly read each channel.BCED00393/projects/gt5p/arcade/JP/image/gt5p/common/hot.ddsLinear row pitch
Uncompressed linear layout textures can have their rows padded to a hardware aligned pitch (assuming 1024 bytes), wider than the actual texture, eg
GTHD_Logo_H.dds(420×120) has a pitch of 2048 bytes per row, but only 1680 bytes of actual pixel data.NPUA80019/project-ps3/image/gthd/GTHD_Logo_H.ddsDDS mip-count
Previosuly when extracting
BCED00393/character/ma__0051(5 textures, each with up to 10 mips) it’d fault withOffset and length were out of bounds....Now all 5 textures convert but only the base level (0), as mip export isn’t a feature.
Does this need to be flipped vertically?
BufferIdreferencePGLUCellTextureInfo.Read()never setsBufferId(unlike the PS4/PSP readers) and stays as0.TextureSet3resolved each texture’s buffer viaBuffers[(int)textureInfo.BufferId], so with a multi-buffer container any texture after the first would still read the first (0) and fault.BCED00393/crs/race.txs(6 textures) used to throw (Specified argument was out of the range of valid values.).Is this supposed to be noise?
Testing
I picked samples from GTHD and GT5P which have a combo of features to validate these changes against.
2D
NPUA80019/project-ps3/image/component/dialog_head2.pngNPUA80019/project-ps3/image/component/numberinput_up.pngNPUA80019/project-ps3/image/arcade/common/popup_item_button.pngBCED00393/projects/gt5p/race/GB/image/race_display/ps3/GT4_meter_texture_point.pngBCED00393/projects/component/image/component/scr2_2.pngSmallest dimensions (12px square)
NPUA80019/project-ps3/image/gthd/GTHD_Logo_H.ddsChannel and pitch bugs
BCED00393/projects/gt5p/arcade/JP/image/gt5p/common/hot.ddsChannel bug
NPUA80019/project-ps3/image/guide/notice/JP/notice_0_480.ddsNPUA80019/project-ps3/image/option/white.ddsNPUA80019/project-ps3/image/component/ps3/btn_sys1_1.ddsNPUA80019/project-ps3/image/gthd/manual/HD_Ctl_Menu.ddsNPUA80019/project-ps3/image/component/ps3/dot.ddsNPUA80019/project-ps3/image/quick/line_dot_q.ddsNPUA80019/project-ps3/image/gthd/icon_ranking.ddsNPUA80019/project-ps3/image/gthd/panel_nomal.ddsNPUA80019/project-ps3/image/guide/direction/JP/direction_07_1080.ddsBCED00393/character/ma__0051Mip-chain example
BCED00393/crs/race.txsOnly D8R8G8B8 example (textures 1–3)
Cubemap
BCED00393/scene/texset/tx0001NPUA80019/projects-ps3/trial/US/image/gthd/colorchipenv.ddsCubemap with mip levels and exhibited the DDS mip-count bug