guard3 Posted August 17, 2017 Share Posted August 17, 2017 Hello! As some of you may know, I try to document GAME.DTZ for Vice City Stories. Info and converted resources can be found here. I'm new to programming. I recently started learning Python 3, but I thought I could share what I've made. Note that I work with decompressed GAME.DTZ PEDSTATS.DAT #made by guard3import structimport binasciidtzpath = input('Enter file path ')with open (dtzpath, 'rb') as f: f.seek(0x8C, 0) offpedstat = f.read(4) offpedstat = struct.unpack('<L', offpedstat) offpedstat = ''.join(map(str, offpedstat)) offpedstat = int(offpedstat) f.seek(offpedstat, 0) x = 0 offset = offpedstat for x in range (0, 42): pedstatline = f.read(4) pedstatline = struct.unpack('<L', pedstatline) pedstatline = ''.join(map(str, pedstatline)) pedstatline = int(pedstatline) offset += 4 f.seek(pedstatline, 0) ID = f.read(4) ID = struct.unpack('<L', ID) ID = ''.join(map(str, ID)) ID = str(ID) B = f.read(4) B = struct.unpack('<f', B) B = ''.join(map(str, B)) C = f.read(4) C = struct.unpack('<f', C) C = ''.join(map(str, C)) H = f.read(4) H = struct.unpack('<f', H) H = ''.join(map(str, H)) I = f.read(4) I = struct.unpack('<f', I) I = ''.join(map(str, I)) J = f.read(1) J = struct.unpack('<B', J) J = ''.join(map(str, J)) J = int(J) f.seek(1, 1) D = f.read(1) D = struct.unpack('<B', D) D = ''.join(map(str, D)) D = int(D) E = f.read(1) E = struct.unpack('<B', E) E = ''.join(map(str, E)) E = int(E) F = f.read(1) F = struct.unpack('<B', F) F = ''.join(map(str, F)) F = int(F) G = f.read(1) G = struct.unpack('<B', G) G = ''.join(map(str, G)) G = int(G) A = f.read(26) A = ''.join(map(chr, A)) print(A, B, C, D, E, F, G, H, I, J, '#', ID) x += 1 f.seek(offset, 0) CULL.IPL #made by guard3import structdtzpath = input('Enter file path ')with open (dtzpath, 'rb') as f: f.seek(0x98, 0) numcull = f.read(4) numcull = struct.unpack('<L', numcull) numcull = ''.join(map(str, numcull)) numcull = int(numcull) f.seek(0x9C, 0) offcull = f.read(4) offcull = struct.unpack('<L', offcull) offcull = ''.join(map(str, offcull)) offcull = int(offcull) f.seek(offcull, 0) x = 0 print('cull') for x in range (0, numcull): f.seek(0, 1) LowX = f.read(2) LowX = struct.unpack('<h', LowX) LowX = ''.join(map(str, LowX)) LowX = int(LowX) TopX = f.read(2) TopX = struct.unpack('<h', TopX) TopX = ''.join(map(str, TopX)) TopX = int(TopX) LowY = f.read(2) LowY = struct.unpack('<h', LowY) LowY = ''.join(map(str, LowY)) LowY = int(LowY) TopY = f.read(2) TopY = struct.unpack('<h', TopY) TopY = ''.join(map(str, TopY)) TopY = int(TopY) LowZ = f.read(2) LowZ = struct.unpack('<h', LowZ) LowZ = ''.join(map(str, LowZ)) LowZ = int(LowZ) TopZ = f.read(2) TopZ = struct.unpack('<h', TopZ) TopZ = ''.join(map(str, TopZ)) TopZ = int(TopZ) flag1 = f.read(2) flag1 = struct.unpack('<H', flag1) flag1 = ''.join(map(str, flag1)) flag2 = f.read(2) flag2 = struct.unpack('<H', flag2) flag2 = ''.join(map(str, flag2)) centerX = (LowX + TopX)/2 centerY = (LowY + TopY)/2 centerZ = (LowZ + TopZ)/2 print(centerX, centerY, centerZ, LowX, LowY, LowZ, TopX, TopY, TopZ, flag1, flag2) x += 1 print('end') Color Data #made by guard3import structdtzpath = input('Enter file path ')with open (dtzpath, 'rb') as f: f.seek(0x90, 0) offcarcols = f.read(4) offcarcols = struct.unpack('<L', offcarcols) offcarcols = ''.join(map(str, offcarcols)) offcarcols = int(offcarcols) f.seek(offcarcols, 0) x = 0 for x in range (0, 230): f.seek(0, 1) R = f.read(1) R = struct.unpack('<B', R) R = ''.join(map(str, R)) R = int® G = f.read(1) G = struct.unpack('<B', G) G = ''.join(map(str, G)) G = int(G) B = f.read(1) B = struct.unpack('<B', B) B = ''.join(map(str, B)) B = int(B) print(R,',',G,',',B, '#',x) x += 1 2DFX #made by guard3import structdtzpath = input('Enter file path ')with open (dtzpath, 'rb') as f: f.seek(0x54, 0) num2dfx = f.read(4) num2dfx = struct.unpack('<L', num2dfx) num2dfx = ''.join(map(str, num2dfx)) num2dfx = int(num2dfx) f.seek(0x58, 0) off2dfx = f.read(4) off2dfx = struct.unpack('<L', off2dfx) off2dfx = ''.join(map(str, off2dfx)) off2dfx = int(off2dfx) f.seek(off2dfx, 0) x = 0 print("2dfx") for x in range (0, num2dfx): f.seek(0, 1) B = f.read(4) B = struct.unpack('<f', B) B = ''.join(map(str, B)) C = f.read(4) C = struct.unpack('<f', C) C = ''.join(map(str, C)) D = f.read(4) D = struct.unpack('<f', D) D = ''.join(map(str, D)) f.seek(4, 1) E = f.read(1) E = struct.unpack('<B', E) E = ''.join(map(str, E)) F = f.read(1) F = struct.unpack('<B', F) F = ''.join(map(str, F)) G = f.read(1) G = struct.unpack('<B', G) G = ''.join(map(str, G)) H = f.read(1) H = struct.unpack('<B', H) H = ''.join(map(str, H)) I = f.read(4) I = struct.unpack('<L', I) I = ''.join(map(str, I)) I = int(I) if I == 0: L = f.read(4) L = struct.unpack('<f', L) L = ''.join(map(str, L)) M = f.read(4) M = struct.unpack('<f', M) M = ''.join(map(str, M)) N = f.read(4) N = struct.unpack('<f', N) N = ''.join(map(str, N)) O = f.read(4) O = struct.unpack('<f', O) O = ''.join(map(str, O)) Q = f.read(1) Q = struct.unpack('<B', Q) Q = ''.join(map(str, Q)) R = f.read(1) R = struct.unpack('<B', R) R = ''.join(map(str, R)) S = f.read(1) S = struct.unpack('<B', S) S = ''.join(map(str, S)) P = f.read(1) P = struct.unpack('<B', P) P = ''.join(map(str, P)) T = f.read(4) T = struct.unpack('<L', T) T = ''.join(map(str, T)) J = f.read(4) J = struct.unpack('<L', J) J = ''.join(map(str, J)) J = int(J) if J == 505552: J = '"coronastar"' K = f.read(4) K = struct.unpack('<L', K) K = ''.join(map(str, K)) K = int(K) if K == 639680: K = '"shad_exp"' f.seek(8, 1) print(x, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) elif I == 1: J = f.read(4) J = struct.unpack('<L', J) J = ''.join(map(str, J)) K = f.read(4) K = struct.unpack('<f', K) K = ''.join(map(str, K)) L = f.read(4) L = struct.unpack('<f', L) L = ''.join(map(str, L)) M = f.read(4) M = struct.unpack('<f', M) M = ''.join(map(str, M)) N = f.read(4) N = struct.unpack('<f', N) N = ''.join(map(str, N)) f.seek(20, 1) print(x, B, C, D, E, F, G, H, I, J, K, L, M, N) elif I == 3: K = f.read(4) K = struct.unpack('<f', K) K = ''.join(map(str, K)) L = f.read(4) L = struct.unpack('<f', L) L = ''.join(map(str, L)) M = f.read(4) M = struct.unpack('<f', M) M = ''.join(map(str, M)) N = f.read(4) N = struct.unpack('<f', N) N = ''.join(map(str, N)) O = f.read(4) O = struct.unpack('<f', O) O = ''.join(map(str, O)) P = f.read(4) P = struct.unpack('<f', P) P = ''.join(map(str, P)) J = f.read(4) J = struct.unpack('<L', J) J = ''.join(map(str, J)) f.seek(12, 1) print(x, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) else: f.seek(40, 1) print(x, "Hello") x += 1 print("end") SaH4PoK, Vadim M., _𝓐𝓖 and 7 others 10 Link to comment Share on other sites More sharing options...
guard3 Posted November 24, 2017 Author Share Posted November 24, 2017 Hello again! http://www.mediafire.com/file/sm4k5mpvsw422c9/ipl.py I'm rewriting my scripts cause they're horrible and... they lack writing to file! Now that I got that right, I thought of uploading IPL for the time being, the rest is in the works. Note that you need Python 3.6 to run this thing. Enter the path of decompressed GAME.DTZ (drag n' drop works too), then the path of the folder you want the ipl files to be generated in (it must be something like C:/blah/blah/ don't forget the slash at the end) This is intended for VCS, but I thing the way I've written it allows for LCS IPL too. Igor Bogdanoff, dkluin, Alexander and 1 other 4 Link to comment Share on other sites More sharing options...
Igor Bogdanoff Posted April 27, 2018 Share Posted April 27, 2018 Locked on request Link to comment Share on other sites More sharing options...
Recommended Posts