原文# g7 | Z2 K2 M/ }! M9 @
http://forum.xentax.com/viewtopi ... &p=29933#p299339 }! r( S# F) A0 y7 @0 _- z) w
6 y3 S H! h! Z: n
在老外的论坛上发现的这个小工具,以后也许会派上用处。
5 i2 ^( R# f* q
/ ^/ ]5 t+ F9 _
/ v: \ p4 p! y+ WI had to get some time, but here's the low down. c/ o# y1 G [0 I8 @" x, x
: d+ Y! ?9 g2 j) f3 wI took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression.
9 _1 W' Q$ Z# X9 N# w
' i0 d2 K# f d7 Z0 @. A& c4 {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).
/ R! v |; k+ U) |) B6 v
! }+ O9 w$ T; M4 q" @% D
$ V* W# L# Y# H4 V3 A( S7 a5 I, hCode:7 Z1 L( R0 U8 J
Byte[4] "TGZ\0"$ v7 ~( Y$ V/ \# _
uint32 Original size of bitmap data
$ v9 [1 G7 r3 b p; Zuint32 Width of image
: S. l6 f* K$ vuint32 Heigth of image
/ Q# B9 B% O Y, O, R: ~Byte[n] Bitmap data (LZSS compressed)
. x1 G% x1 z9 j. c5 H1 k: V5 k. n
- l3 n6 l! v$ \- eIf I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):/ K) r* w2 h, Z
3 |) ~* p- x3 g( a- Z8 X: {" k$ K, H
Attachment:+ k* D1 o- I% j1 a# H( p$ `
) \* l# s0 f8 w4 Q: b
3.tga.jpg [ 464.92 KB | Viewed 251 times ]
3 a! E2 l' V j3 c1 c
) S' m& b& d- w1 j" p4 k2 Y+ s: U4 K- [3 @, |
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!) t3 e7 W. r# I0 L
; E9 o/ d) I! Z4 E3 F
So, I recreated the header and inserted that before my uncompressed bitmap data:
" Z |: t Y6 e; A) i
* }" u4 T2 R/ z8 D% a4 [" j; ~& p4 f3 a& B
Attachment:
1 [6 n, U/ d* z J6 g/ d3 o
c5 w# J7 E W2 `9 Q' k2 h" F1 n3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] 9 u8 r4 z2 Q- p
0 e. e3 y, }# \" Q3 f0 z
BINGO! 8 K& K" T/ m. r0 I( _% P7 D) m
" x" @. R. \2 h; Q
Now for coolness, let's rotate it and make it smaller to fit here: |