(PS4) Gintama Rumble .tmd Noesis Python Script | COMPLETED
Posted: Fri Feb 28, 2020 2:04 am
Final version of the BMS and Noesis scripts for Gintama Rumble viewtopic.php?f=16&t=21817#p160618
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hello guys, I'm trying to create a python script to extract the Gintama Rumble models from the PS4 version.
I'm using hex2obj as guide, trying to pars the values I found to a Noesis py script using chrrox's Noesis rapi tutorial, the problem is that in hex2obj the UVs are in WORDUV and the UV POS is 40 with a vertex size of 44.
My question is how to re-write this line from the tutorial using this information?
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, 88, 48)
Cause I tried using
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_USHORT, 44, 40)
But the UVs came out so tiny.
This is my script.
Here is the sample file.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hello guys, I'm trying to create a python script to extract the Gintama Rumble models from the PS4 version.
I'm using hex2obj as guide, trying to pars the values I found to a Noesis py script using chrrox's Noesis rapi tutorial, the problem is that in hex2obj the UVs are in WORDUV and the UV POS is 40 with a vertex size of 44.
My question is how to re-write this line from the tutorial using this information?
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, 88, 48)
Cause I tried using
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_USHORT, 44, 40)
But the UVs came out so tiny.
This is my script.
Code: Select all
from inc_noesis import *
import noesis
import rapi
def registerNoesisTypes():
handle = noesis.register("Gintama Rumble PS4",".tmd")
noesis.setHandlerTypeCheck(handle, noepyCheckType)
noesis.setHandlerLoadModel(handle, noepyLoadModel)
return 1
NOEPY_HEADER = "tmd0"
def noepyCheckType(data):
bs = NoeBitStream(data)
if len(data) < 4:
return 0
if bs.readBytes(4).decode("ASCII") != NOEPY_HEADER:
return 0
return 1
def noepyLoadModel(data, mdlList):
ctx = rapi.rpgCreateContext()
bs = NoeBitStream(data)
bs.seek(0xcc, NOESEEK_ABS)
FCount = bs.read("i")
bs.seek(0xc, NOESEEK_REL)
VCount = bs.read("i")
bs.seek(0x70, NOESEEK_ABS)
FAddress = bs.readUInt()
bs.seek(0x1c, NOESEEK_REL)
VAddress = bs.readUInt()
#print("{} {} {} {}".format(FCount[0]*3, VCount[0], hex(FAddress), hex(VAddress)))
bs.seek(VAddress, NOESEEK_ABS)
VertBuff = bs.readBytes(VCount[0] * 0x2c)
#print("\n{}".format(VertBuff))
rapi.rpgBindPositionBufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_USHORT, 44, 40)
bs.seek(FAddress, NOESEEK_ABS)
FaceBuff = bs.readBytes(FCount[0] * 6)
rapi.rpgCommitTriangles(FaceBuff, noesis.RPGEODATA_USHORT, FCount[0]*3, noesis.RPGEO_TRIANGLE, 1)
mdl = rapi.rpgConstructModel()
mdlList.append(mdl)
rapi.rpgClearBufferBinds()
return 1