wattostudios Posted August 24 Share Posted August 24 Hi experts, wondering if someone with more experience could assist here. The game International Volleyball 2009 contains a number of standalone *.IVT image files, which appear to be single images with (I assume) an 8-byte header. Some images use 3 bytes per pixel, others are 4 bytes per pixel. I'm not able to pull out anything useful from the 8-byte header, but I'm assuming it contains encoded width/heights and maybe the bytes-per-pixel. Image dimensions are pretty easy to figure out, for the most part - 256 or 512 squares seem to be common. When I try to run it through some image formats, I'm able to confirm that they are images, however I can't quite get the format - they appear a little grainy, contains artifacts around lines, etc. I guess I'm wondering if it's just a format I'm not aware of, or if there's something simple being applied to the images, like an XOR mask over the top of the bytes? Would be grateful for any assistance trying to understand these files. Thanks. textures.zip 1 Link to comment Share on other sites More sharing options...
piken Posted August 26 Share Posted August 26 (edited) On 8/24/2024 at 6:35 AM, wattostudios said: something simple being applied to the images, like an XOR mask over the top of the bytes Yeah, applying an xor pattern (evident from the black parts of the image) yields a much clearer image: image0.ivt: 512x512, @0x8, r8g8b8 (or maybe BGR, but can't tell because monochrome image), xor byte pattern[] = {0xBA,0x8C,0xAB,0x9E,0x99} frame2.ivt: 512x512, @0x8, b8g8r8as8 (straight alpha in last byte), xor byte pattern[] = {0xB0,0x8F,0xBE,0x6C,0x9A,0x8D,0xB2,0x4F,0x8F,0xBE,0x93,0x65,0x8D,0xB2,0xB0,0x70,0xBE,0x93,0x9A,0x72,0xB2,0xB0,0x8F,0x41,0x93,0x9A,0x8D,0x4D} sponsors.ivt: 256x512, @0x8, r8g8b8 (or maybe BGR, but can't tell), xor byte pattern[] = {0xB0,0x8F,0xBE,0x93,0x9A,0x8D,0xB2}. I'm unsure if the xor pattern is applied to only the pixels or to the file as a whole (I just applied it directly to the pixels below), but applying it to image0.ivt's header too (AB,9E,99,BA,8C - rolled accordingly to offset 0) didn't reveal anything more to me 🤷. Edited August 26 by piken 2 Link to comment Share on other sites More sharing options...
Engineer Solution Rabatini Posted August 26 Engineer Solution Share Posted August 26 (edited) try this: # script for QuickBMS http://quickbms.aluigi.org get NAME basename get EXT extension string NAME + "_decrypt." string NAME + EXT get EXT extension if EXT == "INI" || EXT == "PVS" get TYPE byte callfunction SET_KEY 1 savepos OFFSET else get FLAGS byte #xmath FLAG1 "FLAGS & 7" # usually 6 #xmath FLAG2 "((FLAGS >> 6) & 3) + 1" # usually 3 get TYPE byte callfunction SET_KEY 1 savepos OFFSET # the following is just a simple xor with the first 6 bytes additionally xored with KEY2 # but this is something not easy to do with quickbms, so let's do it by hand. # the alternative is skipping everything and then cutting the first 6 bytes from the resulted file. # xor KEY2 with KEY and decrypt the first 6 bytes that are ever zeroes, so not important strlen KEYSZ KEY set KEY2 binary "IvbPcW" strlen KEY2SZ KEY2 math x = 0 for x2 = 0 < KEY2SZ if x >= KEYSZ math x = 0 endif getvarchr TMP KEY x math x + 1 getvarchr TMP2 KEY2 x2 math TMP2 ^ TMP putvarchr KEY2 x2 TMP2 next x2 encryption xor KEY2 "" 0 KEY2SZ # xor the first 6 bytes log MEMORY_FILE OFFSET KEY2SZ math OFFSET + KEY2SZ # this is just to keep the index of KEY or encryption will be wrong (it starts from index 0) for z = 0 < x getvarchr TMP KEY z putvarchr KEY KEYSZ TMP math KEYSZ + 1 next z string KEY << z endif encryption xor KEY get SIZE asize math SIZE - OFFSET log NAME OFFSET SIZE startfunction SET_KEY if TYPE > 3 math TYPE - 4 endif if TYPE == 0 set KEY binary "\x66\xBB\x78\x66\xBB\x78\x66\xBB\x78" elif TYPE == 1 set KEY binary "fEsTafEsTa" elif TYPE == 2 set KEY binary "pAlerMOpAlerMO" elif TYPE == 3 set KEY binary "KISTAbieda\xe8" endif endfunction Edited August 26 by Rabatini 2 Link to comment Share on other sites More sharing options...
wattostudios Posted August 26 Author Share Posted August 26 Thanks both of you for your help, that was wonderful, and it works perfectly for the files I tested on. I know I haven't been looking at images for very long, but was nice to see I wasn't completely off with the whole XOR thing 🙂 Truly appreciate your help, thanks so much! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now