mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[tools] Show major file offsets in mdl dumper
Handy for debugging the alias model loader.
This commit is contained in:
parent
be635804d1
commit
8b425a2740
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@ from pprint import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
model = open(sys.argv[1],"rb").read()
|
model = open(sys.argv[1],"rb").read()
|
||||||
|
file_bytes = len(model)
|
||||||
m = unpack ("4s i 3f 3f f 3f i i i i i i i", model[:76])
|
m = unpack ("4s i 3f 3f f 3f i i i i i i i", model[:76])
|
||||||
model = model[76:]
|
model = model[76:]
|
||||||
m = m[0:2] + (m[2:5],) + (m[5:8],) + m[8:9] + (m[9:12],) + m[12:20]
|
m = m[0:2] + (m[2:5],) + (m[5:8],) + m[8:9] + (m[9:12],) + m[12:20]
|
||||||
|
@ -11,6 +12,7 @@ if m[1] == 6:
|
||||||
model = model[8:]
|
model = model[8:]
|
||||||
pprint (m)
|
pprint (m)
|
||||||
|
|
||||||
|
print(f"skins @ {file_bytes - len(model)}")
|
||||||
skins = []
|
skins = []
|
||||||
s = m[7] * m[8]
|
s = m[7] * m[8]
|
||||||
for i in range(m[6]):
|
for i in range(m[6]):
|
||||||
|
@ -31,6 +33,7 @@ for i in range(m[6]):
|
||||||
skins.append (k)
|
skins.append (k)
|
||||||
#pprint (skins)
|
#pprint (skins)
|
||||||
|
|
||||||
|
print(f"stverts @ {file_bytes - len(model)}")
|
||||||
stverts = []
|
stverts = []
|
||||||
for i in range(m[9]):
|
for i in range(m[9]):
|
||||||
x = unpack ("i i i", model[:12])
|
x = unpack ("i i i", model[:12])
|
||||||
|
@ -38,6 +41,7 @@ for i in range(m[9]):
|
||||||
model = model [12:]
|
model = model [12:]
|
||||||
pprint (stverts)
|
pprint (stverts)
|
||||||
|
|
||||||
|
print(f"tris @ {file_bytes - len(model)}")
|
||||||
tris = []
|
tris = []
|
||||||
for i in range(m[10]):
|
for i in range(m[10]):
|
||||||
tris.append (unpack ("i i i i", model[:16]))
|
tris.append (unpack ("i i i i", model[:16]))
|
||||||
|
@ -45,6 +49,7 @@ for i in range(m[10]):
|
||||||
model = model [16:]
|
model = model [16:]
|
||||||
pprint (tris)
|
pprint (tris)
|
||||||
|
|
||||||
|
print(f"frames @ {file_bytes - len(model)}")
|
||||||
frames = []
|
frames = []
|
||||||
for i in range (m[11]):
|
for i in range (m[11]):
|
||||||
t = unpack ("i", model[:4])[0]
|
t = unpack ("i", model[:4])[0]
|
||||||
|
|
Loading…
Reference in a new issue