-
Notifications
You must be signed in to change notification settings - Fork 2
/
disassemble-ddm.py
executable file
·136 lines (101 loc) · 2.86 KB
/
disassemble-ddm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/env python3
import sys
from common import *
with open(sys.argv[1], "rb") as f:
# Read some header?
unk1 = read32(f)
assert(unk1 == 0x00000001)
file_length = read32(f)
unk3 = read32(f)
print(".header 0x%08X %d 0x%08X" % (unk1, file_length, unk3))
groups = []
for i in range(unk3):
offset = read32(f)
size = read32(f)
#print("%d: size %d # %d" % (offset, unk, size, i))
groups += [(offset, size)]
#f.seek(groups[0])
for offset, size in groups:
print()
print()
print()
print()
print(f.tell(), offset)
assert(f.tell() == offset)
f.seek(offset)
print(f.tell())
for i in range(1):
unk = read32(f)
print("0x%08X # %d" % (unk, i))
# Might be wrong?
checksum = read32(f)
print("Checksum 0x%08X ???" % checksum)
for i in range(5):
unk = read32(f)
print("0x%08X # %d" % (unk, i))
some_name = read_string(f, 64)
print("material-name '%s'" % some_name)
for i in range(7):
unk = read32(f) # Mostly valid floats?
print("0x%08X # %d" % (unk, i))
unk0_count = read32(f)
unk1_count = read32(f)
unk2_count = read32(f)
unk3_count = read32(f)
print(unk1_count, unk2_count, unk3_count)
assert(unk0_count == unk3_count)
for i in range(unk0_count):
print("")
some_name1 = read_string(f, 64)
some_name2 = read_string(f, 64)
print("name-in-dds: '%s'" % some_name1)
print("dds-name: '%s'" % some_name2)
index = read32(f)
unk1 = read32(f)
print("%d, 0x%08X" % (index, unk1)) # Some color?
#assert(unk == 0xFFFFFFFF)
unk2 = read_float(f) # Mostly 0?
unk3 = read_float(f)
unk4 = read_float(f)
print(unk2, unk3, unk4)
unk = read32(f)
print("Unknown: %d" % unk)
unks = [
0x00000000,
0x00000001,
0x00000002,
0x00000003
]
assert(unk in unks)
print(f.tell())
print()
for i in range(unk1_count):
unk = []
unk += [read_float(f)]
unk += [read_float(f)]
unk += [read_float(f)]
# Some of these don't look like floats, but there's 0x3F800000
unk += [read_float(f)]
unk += [read_float(f)]
unk += [read_float(f)]
unk += ["0x%08X" % read32(f)]
unk += [read_float(f)]
unk += [read_float(f)]
print("%d. %s" % (i, unk))
print()
for i in range(unk2_count):
v = read16(f) # Probably an index into previous table
print("%d. 0x%04X" % (i, v))
assert(v < unk1_count)
print()
for i in range(unk3_count):
u1 = read32(f)
u2 = read16(f)
print("0x%08X" % u1, "0x%04X" % u2)
#assert(u1 == 0x00000000)
#if u2 in [0x46, 0xA]:
# f.read(6)
#data = f.read(offset + size - f.tell())
#print(unk3_count, "error", len(data), data.hex())
#assert(len(data) == 0)
print(f.tell())