nineteendo / pyvz2

PyVZ2 is a command line utility to modify PvZ2
GNU General Public License v3.0
44 stars 7 forks source link

Decoding & encoding all files #10

Open nineteendo opened 2 years ago

nineteendo commented 2 years ago
YingFengTingYu commented 2 years ago

PTX is a binary texture data file without the width, height and format. The width, height and format can be found in rsb. There'are some texture formats of PTX: 0-ARGB8888(Simple ptx)/ABGR8888(PVZ2 Android ptx)/ABGR8888_Padding(Just for Xbox360 and it's in Big Endian) 1-RGBA4444 2-RGB565 3-RGBA5551 5-DXT5 21-RGBA4444_Block(divide the picture as many 3232 block and save each of the block by RGBA4444) 22-RGB565_Block(divide the picture as many 3232 block and save each of the block by RGB565) 23-RGBA5551_Block(divide the picture as many 32*32 block and save each of the block by RGBA5551) 30-PVRTCI_4bpp_RGBA 147-ETC1_A8(Save each pixel's alpha value after all the ETC1 data. Each of the alpha is 8 bits.)/ETC1_A_Palette(Save each pixel's alpha value after all the ETC1 data. First save the number of colors in palette, and then save the palette. At last, save all the alpha value by using the index in the palette)

nineteendo commented 2 years ago

Ehm, I'm going to try to make sense of your code if you don't mind. Because this is not complete.

YingFengTingYu commented 2 years ago

嗯,如果你不介意的话,我会试着理解你的代码。因为这还不完整。

OK.

nineteendo commented 2 years ago

Also is it possible that texture format 3 is RGB556? In pvzfree for Android.

YingFengTingYu commented 2 years ago

另外,纹理格式 3 是否有可能是 RGB556?在 pvzfree for Android 中。

In which file? I only found ptx03 files using RGBA5551.

nineteendo commented 2 years ago

Rsb PTX from rsb (1580x640)

YingFengTingYu commented 2 years ago

Rsb PTX from rsb (1580x640)

I got a strange image when I used rgb565. This is not the original image. I think it should be rgba5551 rgb565 rgba5551 .

nineteendo commented 2 years ago

Hmm, you're right. I thought it was RGB556 (so 6 bits for blue). But now fixed, thanks.