原文
! s) h. e/ Z* r) O2 W- a: |http://forum.xentax.com/viewtopi ... &p=29933#p29933# W( F8 g0 L1 r% i6 N3 k
4 u- j4 e& Y5 j在老外的论坛上发现的这个小工具,以后也许会派上用处。( N8 \; C$ }3 \
6 o. G! a! w2 w* l* G1 N' C# t% r0 U: w$ b1 O
I had to get some time, but here's the low down.
: Q1 ^$ L4 r$ s, F9 C ^4 W% X- f: D) S7 d ]( Z' a
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression.
! E/ [! C2 a- g
+ F& {8 g& W% V6 ?: O, t7 sThe 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).
% e9 ^8 ]$ _. L# }& U) U" p. o. M$ q# z- Q0 }) h: m$ Z/ m) g1 Y
. }) S' o1 }$ @. I8 O3 G6 B
Code:
) l3 [# N7 p0 }' z$ g2 ?5 @* JByte[4] "TGZ\0"
& D$ K$ T3 \+ r7 ?! e( _: Ouint32 Original size of bitmap data8 ?4 d! Q; y: K. @4 Y
uint32 Width of image
& U! }3 K: t8 m4 muint32 Heigth of image
% @/ x, [$ ?- O6 }, w3 y, ^Byte[n] Bitmap data (LZSS compressed)
5 z. ]5 m$ c5 n2 I2 b9 i% H N1 n# a( U& S% h0 P% Z2 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):
8 {2 M3 V2 N1 X
# c8 L1 S/ k. ~$ z5 @Attachment:
* c$ z+ i$ N* H. a0 w' p& \8 S
+ ^9 g* J' Z) |- n, E* z3.tga.jpg [ 464.92 KB | Viewed 251 times ]
' v0 y, R. ^& Y9 g2 l7 }8 o
" ?1 A( h6 X( p0 I3 p
& d4 j: M( G6 _+ M4 {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!)$ H1 k1 Z" p0 F
" I/ F2 d# E5 C# }1 K
So, I recreated the header and inserted that before my uncompressed bitmap data:% C2 s' ?8 l* j D
# e4 W! I# Z* e5 m
0 S8 S+ u' j4 l, L9 L6 a& B
Attachment:
% T; k0 I9 E& g" h+ n p. S# I" ^8 ]9 A( G& B( s
3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] : B; G; q$ r, M, {0 u
5 s% F- Q5 M0 e9 M, }% d+ u" x
BINGO!
% n* P/ Z6 c+ w3 M I; ]* v8 D, g0 B1 p8 `, W. Z
Now for coolness, let's rotate it and make it smaller to fit here: |