原文* `3 d; j9 x$ t0 U3 }- ~
http://forum.xentax.com/viewtopi ... &p=29933#p29933% w3 P5 ? H, c! Q0 r" R# B
" A2 V0 ~; U+ A4 r在老外的论坛上发现的这个小工具,以后也许会派上用处。' G! H p8 }* g* o" C! w* \
4 A0 H/ s; ^+ L, R1 }2 q: ^; S7 ~, J
" h! r0 S, F+ m2 C" KI had to get some time, but here's the low down.
7 o9 K! a; |. ? B& l: ?; m4 g' p8 s& U- i
I took a look at the assembly code and found the decompress routine. I then realized that it was standard LZSS compression. / ~8 ]$ u5 W; o, |" e6 F# Z0 p
7 _8 M1 Z- R/ c3 P- x" EThe 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).
8 t" h9 P) K# W+ m8 e; {3 e% _ H9 e9 {
& B' _9 s. q% ~4 U2 d
Code:$ m/ n" C8 l: }7 E0 j5 o. J( D4 ?
Byte[4] "TGZ\0"
R, s, ]8 B* R6 |- C9 Xuint32 Original size of bitmap data, A! l, d5 R8 z( b9 z
uint32 Width of image5 l2 t( i X6 n0 x2 T) E4 u0 S/ s
uint32 Heigth of image% g$ ~$ Q2 v8 L) l* r- n8 C
Byte[n] Bitmap data (LZSS compressed)
& F8 {! L! w# Z/ M4 ~0 I- W6 z4 G1 b( a/ N
If I take the bitmap data and show it this is what you get for the first screen of the game (near the Temple):
w1 F; f: s% o% C7 N
5 ~2 y& X9 k7 ]6 VAttachment:
: z3 p0 D' d" W+ r+ M/ U
1 t8 h$ w; E" Y k5 {4 d3.tga.jpg [ 464.92 KB | Viewed 251 times ] # S/ @$ v @$ q5 K: D- f) F
# ]! Y! r8 n4 l
: X6 s9 K$ g( p$ s1 bMissing 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!); `8 k, q# z* i9 Z v
q8 a. m/ L" DSo, I recreated the header and inserted that before my uncompressed bitmap data:
8 O1 {( P3 |0 }, o) R5 t7 v) {6 A" `
7 }, D$ K: K8 ~. c+ o: M3 g0 K1 xAttachment:% F' U4 q8 o$ R
9 q* g Y- e) ?, q4 ?8 z# G3 |3.tga_final.jpg [ 604.76 KB | Viewed 248 times ] ) p1 B1 S5 M6 z3 f. i' m
& I% U! t/ r4 w; U- q1 h% S3 P# M+ k
BINGO! ( R9 b D. W3 c0 Z# e
0 G8 M: x4 H/ }$ r* J- i
Now for coolness, let's rotate it and make it smaller to fit here: |