had a quick look at it, the GC file holds the faces, and the vertices, but theres some odd data in there that doesn't line up... so there may be additional data aswell
the CC file is the control file, but I haven't figured out how to parse the damn thing. the face section needs to be seperated, theres LODs and elements combined in the same buffer.
I wrote up a quick import script for 3dsmax to have a look at the faces, so I could break down the proper face counts
here's a progress update;
Code: Select all
clearlistener()
mscale=39.3700787
fsource = GetOpenFileName \
caption:"Saints Row Turd Importer" \
types: "SRIII CC File (*.ccmesh_pc)|*.ccmesh_pc|"
if (fsource!=undefined) AND ((doesFileExist fsource)==true) then(
fpath=getFilenamePath fsource
fname=getFilenameFile fsource
fsize=getFileSize fsource
fsize= getFileSize fsource
gsource=(fpath+fname+".gcmesh_pc")
if (gsource!=undefined) AND ((doesFileExist gsource)==true) then(
f = fopen fsource "rb"
s = fopen gsource "rb"
gsize=getFileSize gsource
count3=0
count4=0
check=true
while check==true do(
if (ftell f)!=fsize AND check==true then(
if (readbyte f #unsigned)==16 do (
if (ftell f+4)<=fsize AND check==true then(
if (readlong f #unsigned)==0 do (
if (ftell f+4)<=fsize AND check==true then(
if (readlong f #unsigned)==33554432 do (
if (ftell f+71)<=fsize AND check==true then(
check=false
fseek f 63 #seek_cur
count3=readlong f #unsigned
count4=readlong f #unsigned
)else(check=false))
)else(check=false))
)else(check=false))
)else(check=false))
vertArray=#()
uvwArray=#()
normArray=#()
faceArray=#()
count5=(gsize-(count3*32+4))/2
StartDirection = -1
f1 = readshort s #unsigned + 1
f2 = readshort s #unsigned + 1
if f1>=count3 do f1=1
if f2>=count3 do f2=1
FaceDirection = StartDirection
IndexCounter = 2
Do (
f3 = readshort s #unsigned
IndexCounter += 1
if f3>=count3 then (
f1 = readshort s #unsigned + 1
f2 = readshort s #unsigned + 1
if f1>=count3 do f1=1
if f2>=count3 do f2=1
FaceDirection = StartDirection
IndexCounter += 2
) else (
f3 += 1
FaceDirection = -FaceDirection
if (f1!=f2)AND(f2!=f3)AND(f3!=f1) then (
if FaceDirection > 0 then append faceArray [f1,f2,f3]
else append faceArray [f1,f3,f2]
)
f1 = f2
f2 = f3
)
)
while IndexCounter !=count5
fseek s (gsize-(count3*32+4)) #seek_set
for i = 1 to count3 do(
p1=readfloat s*mscale
p2=readfloat s*mscale
p3=readfloat s*mscale
p4=readfloat s
p5=readfloat s
p6=readfloat s
p7=readfloat s
p8=readfloat s
append vertArray[p1,-p3,p2]
append uvwArray[0,0,0]
append normArray[0,0,0]
)
msh = mesh vertices:vertArray faces:faceArray
msh.numTVerts = vertArray.count
buildTVFaces msh
msh.displayByLayer = false
msh.backfacecull = on
for j = 1 to vertArray.count do setTVert msh j uvwArray[j]
for j = 1 to vertArray.count do setNormal msh j normArray[j]
for j = 1 to faceArray.count do setTVFace msh j faceArray[j]
convertTo msh PolyMeshObject
fclose f
fclose s
)else(messagebox "ERROR!!\nFile Pair Wasn't Found")
)else(Print "Aborted.")