原文/ i# ?& y3 O. ?1 \5 A' A0 z6 q
http://forum.xentax.com/viewtopi ... &p=29933#p29933) G; p# Q7 t( ^& i2 S5 x7 J
- C, s8 f8 f8 {' H, g# }; Z" x
在老外的论坛上发现的这个小工具,以后也许会派上用处。
7 a9 p% N2 x% y: _/ c. {
+ P8 H9 M/ e$ _$ I; K. a3 c A2 V8 x$ T4 [( J
I had to get some time, but here's the low down. 7 z+ K+ z! }. ^) n* m
3 ?5 S+ B; x; P8 Z2 _ [+ ~7 P! F! N
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. r1 v# p. r, F( ?: i2 q; Z' c
u( `0 T8 `" N+ E0 R) p7 LThe 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).
/ S! T" R7 y P+ {: J/ E# f4 P: J1 u/ J" P2 s0 t
% e" ?' P2 `2 I, G5 Y, S8 \1 Z
Code:
$ N# o# F- p" ]9 L! v# W7 O6 a% aByte[4] "TGZ\0". d' N" [6 N" t7 z2 ]
uint32 Original size of bitmap data1 ]. T# Z" `% D8 r
uint32 Width of image
6 e/ h5 ]6 M% j" B, L) j suint32 Heigth of image% y# d8 j8 K+ A
Byte[n] Bitmap data (LZSS compressed)6 x: K3 b2 L8 ?( z7 y
# p4 i1 q; j# R0 B% U
If I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
( C, i/ H( F3 j2 A' S6 Y; l3 O6 Z' _" V% c
Attachment:
% A7 p. Z q1 X' ~% b# b
, f7 n4 u0 C! R/ E: E3.tga.jpg [ 464.92 KB | Viewed 251 times ] ) `! b# b& H9 j3 H
: p4 c1 P1 m! L; F/ |( M
/ f" K1 B* H# m) H4 z" XMissing 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!)% l) D! V I3 I6 _. ^: v, a
2 Z1 M# h) t$ L9 P% \: eSo, I recreated the header and inserted that before my uncompressed bitmap data:
/ k u; v& U( Z/ ?! t" ^ o: O) }& J, C6 \. }0 p$ S% K! Z
/ ^( J, p8 E1 G$ J/ A7 G
Attachment:/ w* u8 t% _, Q" W" u% {, [
* a- Q( |, Q+ K& \3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] . ?+ a; c5 n9 Z% N4 q! y9 \1 @
* e& ?7 ]$ A" S7 @9 W) h$ l
BINGO! 2 j6 {# ~. O9 S# v" f& i
9 U$ D3 J) N4 fNow for coolness, let's rotate it and make it smaller to fit here: |