ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Oct 22, 2018 1:56 am

All times are UTC




Post new topic  Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Thu Dec 07, 2017 5:00 pm 

Joined: Sun Dec 03, 2017 7:52 am
Posts: 26
Hi after unpacking Jungle Storm data (NNG) I have many TGA and BMP pics, but seems it all unheadered.
So, I can see some "image" opening TGA with hex editor. Also I try paste header to BMP from other image and can see some data with i_wiev bat it not correct.
Is it possible to restore headers or convert images for editing?
Samples and executable here:
https://mega.nz/#!5lNRGDja!VkOkvAH8UCbG ... xjLvSzOkX0
Upd
Also i can see some gfx with texture finder.

_________________
github:
N-Gage stuff
psp/psv tools


Top
   
PostPosted: Thu Dec 07, 2017 9:42 pm 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
if you got texture finder you can work with it. all the files have the sizes in the broken headers. the ai_somethings are a plain 16-bit rgb. most others have 32-bit palettes with a 8-bit index format (256 colors).

Code:
header_tga
{
   int32   dummy;
   int32   width;
   int32   height;
   int32   nr_pal_entries;
   int32   unk0;
   int32   unk1;
}

then palette

then index bitmap


the bmp have this lil header. a 16-bit palette and 8-bit index format (256 colors).

Code:
header_bmp
{
   byte   unk0;
   int32   width;
   int32   height;
}

then palette

then index bitmap


i gotta write bmses? maybe acewell does again. :)


Top
   
PostPosted: Fri Dec 08, 2017 5:07 am 

Joined: Sun Dec 03, 2017 7:52 am
Posts: 26
Thx! bms script will be great!

_________________
github:
N-Gage stuff
psp/psv tools


Top
   
PostPosted: Thu Dec 21, 2017 2:52 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 516
i guess episoder isn't coming back :P
i don't usually deal with palleted images but i figured i'd play around with these for some experience :)
here is a Noesis python script to at least open the tga and bmp samples which i think look ok now. :D
*script updated December 24, 2017*
Attachment:
tex_GhostReconJungleStorm_NGage_tga_bmp.zip [871 Bytes]
Downloaded 34 times


i looked up "Jungle Storm" and got a hit with "Ghost Recon: Jungle Storm" 2004,
so i labeled the script after that game, and i assume the samples are from "N-Gage" judging by your signature. :)

_________________
Quickbms.com link thread
Search bms scripts


Last edited by Acewell on Sat Dec 30, 2017 6:19 pm, edited 2 times in total.

Top
   
PostPosted: Thu Dec 21, 2017 4:53 pm 

Joined: Sun Dec 03, 2017 7:52 am
Posts: 26
Acewell Oh, thanks man, I'm almost lose the hope! Looks like it works fine with many tga from Ghost Recon but bmp...
Also, I found another gameloft game Splinter Cell Chaos Theory. Looks like it uses similar unheadered tga and bmp, but Noesis can't show it :/

Can I upload samples and pm it to you?

_________________
github:
N-Gage stuff
psp/psv tools


Top
   
PostPosted: Thu Dec 21, 2017 10:20 pm 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
ohh. sorry i took detours. i got some behemoth thing i'm trying to do.

nonetheless... i played with those bmps a lil bit just now. it doesn't make a lot of sense. endianness fails. standard palette formats fail. and...

the index map could still be used as a sorta brightness map gimmick. i just... didn't get the obvious thing.

Image

a good morning coffee later :D

nvm: me editing

*snip*

that was code for the rgb4 palette and stuff...


Last edited by episoder on Fri Dec 22, 2017 9:29 am, edited 1 time in total.

Top
   
PostPosted: Fri Dec 22, 2017 2:47 am 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 516
lupus wrote:
Also, I found another gameloft game Splinter Cell Chaos Theory. Looks like it uses similar unheadered tga and bmp, but Noesis can't show it :/
Can I upload samples and pm it to you?

better if you make a new thread for each game and link samples there, but like i already said,
i don't usually deal with paletted textures and i also don't deal with or discuss research in private,
i believe in open research to share with everyone. :)

_________________
Quickbms.com link thread
Search bms scripts


Top
   
PostPosted: Fri Dec 22, 2017 9:37 am 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
Acewell wrote:
i believe in open research to share with everyone. :)

you too? me too. pretty strict 'no private requests' rule.

well... now... it seems to work. reads the bmps as rgbx4 palette with alpha key index. cpt. obvious failure. :mrgreen:

Code:
log MEMORY_FILE1 0 0 ; out
log MEMORY_FILE2 0 0 ; tpal

goto 1 0
get width long 0
get height long 0
get nr_pals short 0
get alphakey byte 0
get shortcut byte 0

for p = 1 to nr_pals
get pal short
set r pal
math r >> 4
math r & 0xF0
set g pal
math g >> 0
math g & 0xF0
set b pal
math b << 4
math b & 0xF0
put b byte MEMORY_FILE2
put g byte MEMORY_FILE2
put r byte MEMORY_FILE2
put 0xFF byte MEMORY_FILE2 ; alpha is not present but always opaque
next p

xmath ofs_pal "alphakey * 4 + 3"
goto ofs_pal MEMORY_FILE2
put 0 byte MEMORY_FILE2 ; not opaque

put 0 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 2 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 0 byte MEMORY_FILE1
put 0 short MEMORY_FILE1
put 0 short MEMORY_FILE1
put width short MEMORY_FILE1
put height short MEMORY_FILE1
put 32 byte MEMORY_FILE1
put 0x20 byte MEMORY_FILE1

for y = 1 to height
for x = 1 to width
get px byte 0

math ofs_pal = px
math ofs_pal *= 4
goto ofs_pal MEMORY_FILE2
get rgba long MEMORY_FILE2
put rgba long MEMORY_FILE1

next x
next y

get buffer ASIZE MEMORY_FILE1
get name FILENAME 0
string name -= 4
string name += .tga
log name 0 buffer MEMORY_FILE1


edit: redone. should be easier portable to noesis, if you get to set the alpha 0 in that only palette entry.


Top
   
PostPosted: Mon Dec 25, 2017 4:45 am 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 516
awesome :D thanks to your script i was able to translate the meat and potatoes to my Noesis python script. :D
so i updated the previous script here to open open those tga and bmp samples :)
viewtopic.php?p=30945#p30945

_________________
Quickbms.com link thread
Search bms scripts


Top
   
PostPosted: Mon Dec 25, 2017 1:46 pm 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
interesting. doesn't wanna download. 0 byte file. and i thought i could learn some noesis stuff. not then.

bug hunt: does the forums break updated file attachements with identical names?


Top
   
PostPosted: Mon Dec 25, 2017 4:05 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 516
hmm thats strange, i just downloaded the attachment 3 times in a row and they all worked, maybe try again. :)

i am beginning to take some interest in paletted textures now that i have a better understanding
of them thanks to the scripts you share. :D

_________________
Quickbms.com link thread
Search bms scripts


Top
   
PostPosted: Sat Dec 30, 2017 4:45 pm 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
Acewell wrote:
i am beginning to take some interest in paletted textures now that i have a better understanding
of them thanks to the scripts you share. :D


yeh. this stuff is neato to puzzle. this alpha key or (color-key) is an old rendering trick. gif files use that too for semi-transparent gifs. how'd you do this script tho? i still can't download the script. could you post the bunch of code lines how you read the bmps palette or the whole file?!?

and... going back in 2017, i've been doing some weird things indeed. this oldschool and console stuff. the resident evil - dead aim (and gits-sac, cavia too) files were probably the sickest to crack with low level assembly. buffer shuffle madness. :D


Top
   
PostPosted: Sat Dec 30, 2017 5:57 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 516
episoder wrote:
i still can't download the script. could you post the bunch of code lines how you read the bmps palette or the whole file?!?

maybe browser cache issue? anyway here is the bmp reading section of the script :)
Code:
    #bmp 
    elif check == 0x8:
        imgWidth = bs.readUInt()
        imgHeight = bs.readUInt()
        num_pals = bs.readUShort()
        alpha_flag = bs.readUByte()
        bs.readByte()
        palette = []
        for i in range(num_pals):
            pal = bs.readUShort()
            red = (pal >> 4) & 0xf0
            green = (pal >> 0) & 0xf0
            blue = (pal << 4) & 0xf0
            palette.append(blue)
            palette.append(green)
            palette.append(red)
            if i != alpha_flag:
                palette.append(0xff)
            else:
                palette.append(0x00)
        palette = bytearray(palette)
        datasize = imgWidth * imgHeight
        bs.seek(len(data) - datasize, NOESEEK_ABS)
        data = bs.readBytes(datasize)
        data = rapi.imageDecodeRawPal(data, palette, imgWidth, imgHeight, 8, "b8 g8 r8 a8")
        texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, noesis.NOESISTEX_RGBA32))



edit
i uploaded the script again, check if it works for you now.

_________________
Quickbms.com link thread
Search bms scripts


Top
   
PostPosted: Sat Dec 30, 2017 8:58 pm 

Joined: Fri Oct 27, 2017 7:36 pm
Posts: 98
nope. not a cache issue. got it now. i wasn't just sure how'd you modify the palette read. i got noesis syntax issues.

Code:
palette = bs.readBytes(num_pals * 2)
for i in range(num_pals):
    short palette[i] |= 0xF000
palette[alpha_flag] &= 0x0FFF
data = rapi.imageDecodeRawPal(data, palette, imgWidth, imgHeight, 8, "b4 g4 r4 a4")

would not work, right? i don't bother trying. lacks the array and short type cast perhaps anyway.

you did it manually too. so... this is clear now. :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 14 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited