原文
9 e8 _8 v9 V6 `7 p/ {: P# Xhttp://forum.xentax.com/viewtopi ... &p=29933#p29933
3 z+ W; W4 p% i" X0 g. M
, C( a1 U3 S! E! t在老外的论坛上发现的这个小工具,以后也许会派上用处。
4 l/ H& o7 t: H- b3 u! v
" L7 G. B# Y2 } J9 p% ^0 D' F; X2 Z) q( \) f( R
I had to get some time, but here's the low down. % x( f2 @# d8 L. d) P. r5 f
; r8 I9 S4 D' e2 HI took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression.
$ t% R, ^+ w; k y9 X6 w& R* `( [- F% L
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). 4 e, p! z. _0 q
8 M1 F3 m+ ^5 W% i O4 O! D5 Y/ _4 c% g& x; w8 ]7 b
Code:
7 z+ j* g8 [0 ?3 |Byte[4] "TGZ\0"
: E1 M9 r/ S N! K. e) d, Juint32 Original size of bitmap data5 H' P; s, b3 `- I
uint32 Width of image
% o, S- i) \. o. r4 b3 T5 e" O) Luint32 Heigth of image/ @% U. V/ e! L, n" B) X( H. K
Byte[n] Bitmap data (LZSS compressed)
, p e. C5 M+ i
7 k! m, u: N$ _2 SIf I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
" ]$ J+ n) v+ D! }2 \% R3 v6 j) u. _+ X! ?+ S( T% O
Attachment:+ Q5 o) m7 \* |! V
+ Z) F# X- L0 L; ?6 h# c& n
3.tga.jpg [ 464.92 KB | Viewed 251 times ]
8 U' I# c0 P& r) w1 D2 r7 Q7 g) Q. \9 Z; l6 G4 ^
" V1 `+ q9 _/ n& Y6 U
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!)
V1 i# {' W7 q6 ^4 Q( o7 A! _+ H6 ?7 c5 O- e
So, I recreated the header and inserted that before my uncompressed bitmap data:* l! p# ~$ y+ P. O
: _6 r) ?0 C9 E) V: @( T; N! N; z7 K' O8 P# t$ m: z
Attachment:8 w$ s5 V9 j. ~, l! ? a4 s
+ k5 n. b+ R1 j! N7 K; P9 ^5 L* B1 S3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] 4 }+ n( S( N1 S6 j; b
5 a. }7 d/ S/ a6 y
BINGO! , O' y1 @$ ? b; H& V$ K
; g' U% c. I5 r! ?7 ~; ~9 o
Now for coolness, let's rotate it and make it smaller to fit here: |