thx, kovalevich007. I added some lines to your script if you don't mind:
Code: Select all
#sample class
from inc_noesis import *
indOffArr = [0x1C00, 0x5100, 0x10100, 0x1B280, 0x26800, 0x31B00, 0x3CE80, 0x42280, 0x4DC00]# 4 addresses to be added
matName = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]
def registerNoesisTypes():
handle = noesis.register("Playstation All Stars", ".cskn")
noesis.setHandlerTypeCheck(handle, binModCheckType)
noesis.setHandlerLoadModel(handle, binModLoadModel)
#noesis.logPopup()
return 1
def binModCheckType(data):
td = NoeBitStream(data)
return 1
class binFile:
def __init__(self, bs):
self.bs = bs
rapi.rpgSetOption(noesis.RPGOPT_BIGENDIAN, 1)
self.texList = []
self.matList = []
self.boneList = []
self.boneMap = []
self.offsetList = []
self.meshOffsets = []
self.materials = []
def loadAll(self, bs):
dataTableOffs = 0x1546
for j in range(0, 9):
self.materials.append(j)
indexOffset = indOffArr[j]
bs.seek(dataTableOffs, NOESEEK_ABS)
bs.seek(2, NOESEEK_REL)
vertCount = bs.readUShort()
indexCount = bs.readUShort()
#print("indCnt: %d vertCnt: %d" %(indexCount, vertCount))
bs.seek(8, NOESEEK_REL)
#indexCount = 0x8A0
#indexSize = 0x370
indexSize = bs.readUShort()
bs.seek(indexOffset, NOESEEK_ABS)
edgeData = bs.readBytes(indexSize)
edgeDecomp = rapi.decompressEdgeIndices(edgeData, indexCount)
for i in range(0, indexCount):
t = edgeDecomp[i*2]
edgeDecomp[i*2] = edgeDecomp[i*2 + 1]
edgeDecomp[i*2 + 1] = t
#vertexOffset = 0x1F70
vertexOffset = indexOffset + indexSize
print("indexOff: 0x%x, cnt: %d, size: 0x%x, vertOff: 0x%x, cnt: %d" %(indexOffset, indexCount, indexSize, vertexOffset, vertCount))
bs.seek(vertexOffset, NOESEEK_ABS)
#vertCount = 0x1A2
vSize = 0x10
vertBuff = bs.readBytes(vSize * vertCount)
#UVBuff = bs.readBytes(vertCount * 6)
#rapi.rpgBindUV1BufferOfs(UVBuff, noesis.RPGEODATA_SHORT, 6, 0)
rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, vSize, 0)
#rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, vertCount, noesis.RPGEO_POINTS, 1)
rapi.rpgSetMaterial(matName[j])
rapi.rpgCommitTriangles(edgeDecomp, noesis.RPGEODATA_USHORT, indexCount, noesis.RPGEO_TRIANGLE, 1)
dataTableOffs += 128
def binModLoadModel(data, mdlList):
ctx = rapi.rpgCreateContext()
bin = binFile(NoeBitStream(data, NOE_BIGENDIAN))
bin.loadAll(bin.bs)
try:
mdl = rapi.rpgConstructModel()
except:
mdl = NoeModel()
mdl.setModelMaterials(NoeModelMaterials(bin.texList, bin.matList))
mdlList.append(mdl); mdl.setBones(bin.boneList)
return 1
now you'll get 9 submeshes from the radec_suit02.
I'm pretty sure there are 4 more submeshes but I got lost when trying to find the last 4 offsets for the
IndOffsArr I introduced.
The max range of for i in range(0, 9) must be set to 13 (or size of IndOffsArr)
or other value for other models.
dataTableOffs = 0x1546 also to be changed for different models.
radec_suit02.jpg
(Maybe someone else will find a method to get the submesh count and the indexOffsets automatically?)
For this suit search for FFFFFFFF22. You'll find it 13 times (== 13 submeshes?).
You do not have the required permissions to view the files attached to this post.