原文
' y4 V/ i9 s$ ]& s- n/ r$ qhttp://forum.xentax.com/viewtopi ... &p=29933#p29933
: V9 z2 n6 E6 D* ~& G. {6 J9 U4 Q* Z
在老外的论坛上发现的这个小工具,以后也许会派上用处。: M$ g8 e1 L% k! g/ D7 k
& U8 C, _8 ?& g% J. o. x4 `4 B& ~: v, }# Q' R# O- s# R p0 `: H0 T
I had to get some time, but here's the low down. ! r+ [2 a6 G/ K& R/ O& z/ M% K% B
; J: u, Q. O; F9 x1 [I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. " R0 \( _4 y; W$ d
& e2 p6 D# K* c4 s
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).
* I. v) ~. V5 M: W3 C) x% y/ f U ` a* W0 _% N9 [! |
- r; R8 p& X( ~- D) L% m
Code:
& E7 `: x& i5 f6 b' W$ x8 s3 ?; fByte[4] "TGZ\0"5 m+ r3 w" Q% }
uint32 Original size of bitmap data: N! F. X4 }' W1 V9 W9 H/ U
uint32 Width of image
+ T$ h2 m! e9 @) J( buint32 Heigth of image S. F1 @5 U4 Y. w
Byte[n] Bitmap data (LZSS compressed)
I* f4 x6 p/ Q5 l; u7 W0 B8 s0 B C: Z* j& e) J) {" _ d
If I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):+ \; m9 ?, c. i6 K8 W
4 z6 z. y' `2 J; TAttachment:
6 L3 v8 k* H4 F+ z8 d
5 ?; s2 @+ J( g; @3.tga.jpg [ 464.92 KB | Viewed 251 times ]
' z; w; q5 H; r$ q- u R4 m- m* H4 \3 J9 }2 n9 o
j3 n, d- S5 S- U1 j9 I% b1 F
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!) a( i& i5 ^/ @8 V7 y, V1 \
% h8 X) G8 p2 NSo, I recreated the header and inserted that before my uncompressed bitmap data:
! h( x1 u/ [3 ]; V) ]2 T& N; ~5 A4 ?, z: J+ O. `
& [7 F, F; Y1 w+ v" s
Attachment:: P6 K! @4 W* L! h, W) ~
# n4 X g, P+ W! l# G3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] . t9 H& B/ Z0 a O& @2 f. ?5 c
/ _% F- @6 V! _. t! V7 A
BINGO! 6 _/ I$ h" r+ m% R6 g) ?# s
7 V4 o7 S7 A: K" T5 T* BNow for coolness, let's rotate it and make it smaller to fit here: |