原文
+ N" U- R! g0 s6 ]! ^, A+ |+ fhttp://forum.xentax.com/viewtopi ... &p=29933#p29933
2 g. f* V8 E5 N1 T4 d+ {# q& f; E5 R! g9 } Z/ c% r2 i" m' Q8 k
在老外的论坛上发现的这个小工具,以后也许会派上用处。, z& ^/ n+ C' B, M" T9 M& i! h% j! ]
5 D7 E+ w0 W/ R& M4 u3 T% N8 Y! S, l. E- p3 q
I had to get some time, but here's the low down. ' h& }& Q# U; }8 ~+ v F: q
% _+ i$ d# X1 [) z# }& B
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. d$ \5 M: E; f- l: R, Q! O
+ g# p- _ g* e* L% O- \6 T2 P; v
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). % V7 O% \7 u) ^* c8 W. E) N
+ K) V F: |2 O( N5 z0 U+ o! O" ~# ~9 x, V" F/ b+ q% ?& L
Code:
5 U! F! Z9 c/ F# HByte[4] "TGZ\0"- r, a: |; p4 I7 E8 E) F
uint32 Original size of bitmap data2 @0 G1 O# W) e# w3 L
uint32 Width of image9 D2 M! b% H1 P. w
uint32 Heigth of image
9 S2 l+ c# Y) F; h: v8 q5 PByte[n] Bitmap data (LZSS compressed)' `# w& [/ m$ `( R a. u
C* G' U, d! D+ n+ w. s/ Z: I# b; tIf I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
) x5 r/ H7 N; q, G' Z# O; O, B! f. D& N; i
Attachment:
4 W( H( e3 Z' ], n+ i. L. r# {9 _6 [
9 E+ H9 J: G2 o1 f8 ?- d3.tga.jpg [ 464.92 KB | Viewed 251 times ]
. Q2 B0 f" x8 y! ~3 R& B! G2 q3 P5 E4 o* K z, C) s
4 R. Q7 ]. P" p" a7 VMissing 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!)
# j# O2 F& ^9 I$ W
" F% s6 G7 w5 H7 p& B4 }+ x' lSo, I recreated the header and inserted that before my uncompressed bitmap data:
: |3 [2 F* k. j* L3 a6 z& X5 P) T" o
- p& Q- h" I8 ZAttachment:5 f, |; K7 e0 n L% h s
6 Q* b9 h) b% x# p0 I$ \3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] * ]9 i4 s. P; ^: a4 X" r+ b5 t% b3 G
1 T7 V) j% n$ O7 _' h5 E. WBINGO!
* q8 X# G: {$ \& G# O5 B
. d$ g1 M5 X' A. H. Z( hNow for coolness, let's rotate it and make it smaller to fit here: |