原文1 H, z+ v9 }0 B% H
http://forum.xentax.com/viewtopi ... &p=29933#p29933
1 v! p0 i, B/ ~8 ]& h' \! u n
2 O+ x; w- c) {3 I在老外的论坛上发现的这个小工具,以后也许会派上用处。' j* n' H5 f2 `6 y- R2 }! N
, o, U: j7 O8 e2 W$ G% n R8 x; y D/ T
I had to get some time, but here's the low down. $ \8 V+ N8 ~, \3 W$ m, V
$ \! n" c- q. ?' F# X
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression.
B# S$ B* {9 R! c! y# b6 b6 I% k
, |; O+ ^3 G% A) i) ^8 I8 t" ~ F2 VThe 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). 7 [ D6 g1 i: Y! s& [( X
4 l' F: a4 r/ H% D+ K3 { O( q1 |9 g: d. a# ?* L& l" M
Code:
+ e+ ?( Z& I9 zByte[4] "TGZ\0" W- J# e$ z1 \; F+ c& M" q( ?" |
uint32 Original size of bitmap data
- E8 u1 K" J0 B) zuint32 Width of image& W7 A. I2 ^& v! Z0 O7 L; q. \
uint32 Heigth of image
; N$ g+ f: p9 N. [' |% AByte[n] Bitmap data (LZSS compressed)
4 ?& Q( P( g0 V' |8 k& u3 W
6 G9 _4 Z2 l- \ K" bIf I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
+ v% l& C3 `% I4 P* z5 O( ]9 V ?) J5 @# A7 J5 F8 @
Attachment:: b; D- B3 K( z( e' _- t* }
% u. g3 v4 [+ z: o1 r8 t3.tga.jpg [ 464.92 KB | Viewed 251 times ]
/ [: N F, ]5 S9 [: a! e8 ?
- K) Y1 z) x5 Y6 P* Y9 A8 Z
' |' U' P7 H6 H) A! gMissing 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!)) C& f& N( e5 ? Y
2 k; V3 K- y3 u
So, I recreated the header and inserted that before my uncompressed bitmap data:
( h- w7 J; S( V( M; t! K9 V( a6 U& g0 q5 ^8 j# n/ k0 I0 b* G4 f, S/ l
" p0 U" J5 n. e2 S. ZAttachment:9 f+ k, c; y7 x- Q; T; j7 ?2 D
& V0 L9 M7 ?: n' `" F. T% e
3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] w5 i8 e/ t, A, R" \
2 Z' w7 ^* u/ ]; j/ MBINGO!
$ r6 V6 }3 l$ @1 m) y, }. J& Q$ d: K* h2 i" _
Now for coolness, let's rotate it and make it smaller to fit here: |