原文
, u% d7 a1 l" ?6 f7 Qhttp://forum.xentax.com/viewtopi ... &p=29933#p29933
! Z$ S1 Q0 M* C s9 p- d% l/ X0 y; h: G- V9 s7 I
在老外的论坛上发现的这个小工具,以后也许会派上用处。6 s2 u# W' b! B
* y- H; H u1 Y7 J
. N X: J9 F1 C# @% N8 ~0 ZI had to get some time, but here's the low down.
% ? X) ` _: o* ]3 J* Y# r- [* Q0 t; A0 `6 s# B
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. " L. Y0 H" [+ K. W! ]3 o
# }1 d$ R) g! |
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).
& E' t6 n0 c& S/ _8 L6 _, k/ ^1 ]4 C5 t( L
) d, |2 j. T. D3 i6 p( S
Code:
+ n( A r- m8 x) }/ v6 nByte[4] "TGZ\0"! l; b$ @) s; H8 Q
uint32 Original size of bitmap data
( `& W: [2 ]: e# uuint32 Width of image" u# u! [8 S$ t( v2 m# {8 s
uint32 Heigth of image/ a# `' s) _, }+ V7 f; @
Byte[n] Bitmap data (LZSS compressed)1 L" d+ S& b! j
: \9 B) Y7 s) A, V8 c* V' A* I
If I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
: B4 w4 r4 q! Y3 s) r# m" e; }$ {5 d. [
Attachment:1 e! ?; ]* l$ ^+ p
' j0 F: a8 R' c3 U7 `* y
3.tga.jpg [ 464.92 KB | Viewed 251 times ]
" |' m% H/ |/ l5 R
/ u" q, X- ~! l
# R* X' y$ k a9 }% a4 g7 MMissing 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!)" V7 a$ O$ _3 a) A8 b. a8 _
; x$ x6 _% @3 k5 ^5 ?6 W" TSo, I recreated the header and inserted that before my uncompressed bitmap data:
) t- `, K; M1 E7 R0 Q
. |4 z/ f! I4 ?: [8 }, ^, b- C6 E
Attachment:. l: e/ b% C* H7 N/ e% ]" B
0 k! v; u) k. `& G* T4 f3.tga_final.jpg [ 604.76 KB | Viewed 248 times ]
8 Z# o3 O' M( n u' W& x0 }
" _" L. z: I9 P( MBINGO!
/ F1 M$ h( B. D
" j1 I- r( z9 r: e% i& o+ u) MNow for coolness, let's rotate it and make it smaller to fit here: |