原文/ {2 Z) Y+ B( W8 ?- H' h7 r
http://forum.xentax.com/viewtopi ... &p=29933#p299331 z$ z, V9 b L# G! ?
: p2 a! u& z {% O) R! G在老外的论坛上发现的这个小工具,以后也许会派上用处。& d K3 ]6 }' z: o8 \* t* [3 Z( b
3 \/ e$ L9 M8 E L _
! X4 I" g6 h1 G3 w& c& j
I had to get some time, but here's the low down. . ]' \# N/ Z' G2 h6 Y
: p/ e; g& ~3 o' |I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression.
8 |3 d U& T4 u0 _7 s0 Y
. F O7 I6 Y; r5 A+ j7 G& A B5 @The 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). , {/ G4 O# T3 A% S
, W3 w0 U) v3 `0 a
/ ?5 [- {, K+ I5 y
Code: N$ i0 N" y, {: f& p! w4 `7 b
Byte[4] "TGZ\0"
0 a& | ^1 _; l* L0 W! _/ z9 j zuint32 Original size of bitmap data0 d% P. c; E u3 [) T9 ~
uint32 Width of image
+ X; b0 X; g; R/ D2 F% _uint32 Heigth of image. p% {% e: _5 E% T1 D6 n
Byte[n] Bitmap data (LZSS compressed)) i9 S6 {! T% y, M
7 L7 G# d" g* z* i9 mIf I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):! j- T5 z0 ?! t4 D7 y7 a# T
1 V8 G3 [: N& |5 s$ N3 O) h) T) j
Attachment:0 Q" J5 K. ~/ R8 I
1 C9 I2 K3 O/ u
3.tga.jpg [ 464.92 KB | Viewed 251 times ] & u1 c& f4 p( j2 \
& v3 j1 U0 p* }5 m$ L/ {
8 O W% q" S- g7 QMissing 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!), ?4 L+ J" ~9 k% N) ^' j7 P
1 Q* q' D& e5 X- [. O6 V' I7 vSo, I recreated the header and inserted that before my uncompressed bitmap data:$ M' r6 L7 _9 t( Z* L6 u8 [+ L8 {
( q' d: K* S6 m$ _" t7 _5 D D
5 C# }+ o( U% | q; o
Attachment:
& ~; R7 ]+ r& \+ y& C. o
1 F7 B. ?7 }$ Q) {0 w7 D" \4 K% F! a, x3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] : n d2 X' x! F
( `5 X1 h0 C6 R4 [& U
BINGO! . u1 l% g& I* u. p9 ~* `% o$ s0 L
" Z+ m8 o0 M/ n$ h" r, t- ]5 _6 ZNow for coolness, let's rotate it and make it smaller to fit here: |