原文. W+ m6 A. @. b. ?3 S5 q0 X% u
http://forum.xentax.com/viewtopi ... &p=29933#p29933
$ ?/ Z8 B+ q7 Q3 E |8 a( w, Y" r$ ~: {% r
在老外的论坛上发现的这个小工具,以后也许会派上用处。
* ? \% J* v1 ^9 P3 x $ M: \6 @5 b. y' o8 _
& o) R; w8 @ i! U: R7 Z
I had to get some time, but here's the low down. - R& [/ q Q: b0 V2 Z7 f
; ?, I: Y# p' t0 E5 N
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. * l6 ]* E1 _0 O' v" a7 d; G
5 E) D8 J0 g2 ?1 HThe executable uncompresses the bitmap data and fills in a BITMAPHEADER to show the actual .BMP file (not TGA). So basically, the .TGA files are Art files, with the magic word TGZ (Texture Graphics Zipped or something).
' f2 s. s" w7 ~& O, g! T7 ?
3 @8 x3 m9 _, l0 Z
6 y8 U+ x' n; P: i/ GCode:
4 e0 x2 w% ~* G9 oByte[4] "TGZ\0"
/ [: ~8 f R1 b( g' }! A$ d; L* [) [uint32 Original size of bitmap data
7 O9 N$ C$ ?) ]+ k* e: h/ B1 r/ Xuint32 Width of image
0 S1 W8 h5 P( ]; Luint32 Heigth of image8 N: Z8 \1 V* r6 y& J/ C
Byte[n] Bitmap data (LZSS compressed)
+ Q0 p% X2 n' P' h. ^- c: j& t( f3 F
$ \6 |# O0 v) r$ |& {" ^If I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple): X. G/ |) v% a( R+ O: Q! x
: l3 H2 } U& A
Attachment:9 h% r( t# o8 r) R
. U7 \$ C9 ^" q v8 N
3.tga.jpg [ 464.92 KB | Viewed 251 times ] % I! U5 h8 O- i# C
9 Q+ N+ p$ u. C/ j) w* B+ Y3 r
% r( R) f7 d$ b: I1 h( ~' Z& P
Missing colours, but it show how the executable rotates the image when needed to give the 360 degrees impression in the game. Okay, so I took another look at the executable and noticed that it filled in a .BMP header with standard values for each image, and filling up the colour table in the .BMP with 0 (the bitmap values are also the RGB values! 16 bitcounts!)
" f3 z& d5 E% o: |7 T2 v- J2 Y3 e# P* ?& k; ]; z" Y
So, I recreated the header and inserted that before my uncompressed bitmap data:& D: `9 q( P6 D- t5 t$ G0 x8 }
2 ]! D4 q! o" R/ T( s2 c1 L, o$ j
$ l& @1 d9 H' ~6 e, U/ XAttachment:' i' K7 m0 |! M5 l
0 y* N6 Z0 s) i5 x/ I
3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] + E; p o+ Q$ r/ o" @
. t+ F1 r: R3 J& }2 \8 t6 M3 n' O; {BINGO!
6 b! x# g i7 r4 J& s; ^+ y/ W9 U
Now for coolness, let's rotate it and make it smaller to fit here: |