ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Aug 21, 2017 8:11 am

All times are UTC




Post new topic  Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu Dec 22, 2016 3:26 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
I can not be loaded.

Fmt_Zuonline_ltb
-----------------------------------------------------------------------------------------------------------------------------
from inc_noesis import *
import noesis
import rapi
import os

def registerNoesisTypes():
'''Register the plugin'''

handle = noesis.register("LithTech", ".ltb")
noesis.setHandlerTypeCheck(handle, noepyCheckType)
noesis.setHandlerLoadModel(handle, noepyLoadModel) #see also noepyLoadModelRPG
return 1

def noepyCheckType(data):
'''Verify that the format is supported by this plugin.'''

if len(data) < 9:
return 0
try:
bs = NoeBitStream(data)
ver1 = bs.readShort()
ver2 = bs.readShort()
if ver1 != 1 or ver2 != 9:
return 0
return 1
except:
return 0

def noepyLoadModel(data, mdlList):
'''Load the model'''

ctx = rapi.rpgCreateContext()
parser = ZuOnline_LTB(data)
parser.parse_file()
mdl = rapi.rpgConstructModel()
mdlList.append(mdl)
mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
mdlList.append(mdl)
return 1

class ZuOnline_LTB(object):

def __init__(self, data):
self.inFile = NoeBitStream(data)
self.animList = []
self.texList = []
self.matList = []
self.boneList = []
self.dirpath = rapi.getDirForFilePath(rapi.getInputName())
self.texpath = self.dirpath + "texture\\"

def basename(self):
'''Returns the filename without extension'''

filename = rapi.getLocalFileName(rapi.getInputName())
basename, ext = os.path.splitext(filename)
return basename

def read_name(self):

string = self.inFile.readBytes(self.inFile.readUShort())
try:
return noeStrFromBytes(string)
except:
return string

def parse_vertices(self, numVerts, meshType):

if meshType == 1:
vertBuff = self.inFile.readBytes(numVerts * 32)
rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
elif meshType == 2:
vertBuff = self.inFile.readBytes(numVerts * 36)
rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 0)
rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 16)
rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 28)
elif meshType == 3:
vertBuff = self.inFile.readBytes(numVerts * 40)
rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 20)
rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 32)
elif meshType == 4:
vertBuff = self.inFile.readBytes(numVerts * 44)
rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 24)
rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 36)
else:
print("unknown meshType: %d" %meshType)

def parse_faces(self, numIdx):

return self.inFile.readBytes(numIdx * 2)

def parse_unk(self):

count = self.inFile.readUInt()
self.inFile.seek(count*12, 1)

def create_material(self, matNum):

matName = "material[%d]" %matNum
if matNum == 1:
texName = self.texpath + self.basename() + ".dtx"
elif matNum == 2:
texName = self.texpath + self.basename() + "_a.dtx"
elif matNum == 3:
texName = self.texpath + self.basename() + "_b.dtx"
elif matNum == 4:
texName = self.texpath + self.basename() + "_c.dtx"
elif matNum == 5:
texName = self.texpath + self.basename() + "_a.dtx"
elif matNum == 6:
texName = self.texpath + self.basename() + "_a.dtx"
else:
print(matNum)
texName = ""

material = NoeMaterial(matName, texName)
self.matList.append(material)
return matName

def parse_submesh(self, numSubmesh):

for i in range(numSubmesh):
self.inFile.readUInt()
matNum = self.inFile.readUInt()
self.inFile.read('4L')
self.inFile.readByte()
unk1 = self.inFile.readUInt()
sectionSize = self.inFile.readUInt()

#sectionSize could be 0
if sectionSize:
start = self.inFile.tell()
numVerts = self.inFile.readUInt()
numIdx = self.inFile.readUInt() * 3
meshType = self.inFile.readUInt()
self.inFile.read('5L')

if unk1 == 4:
self.inFile.readUInt()
elif unk1 == 5:
self.inFile.readUShort()

self.parse_vertices(numVerts, meshType)
idxBuff = self.parse_faces(numIdx)

#just seeking past unknowns rather than parse the unknown
curr = self.inFile.tell() - start
remain = sectionSize - curr
self.inFile.seek(remain, 1)

unk2 = self.inFile.readByte()
self.inFile.seek(unk2, 1)

matName = self.create_material(matNum)
rapi.rpgSetMaterial(matName)
rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)

def parse_mesh(self, numMesh):

for i in range(numMesh):
meshName = self.read_name()
numSubmesh = self.inFile.readUInt()
for j in range(numSubmesh):
self.inFile.readFloat()
self.inFile.read('2L')
self.parse_submesh(numSubmesh)

def parse_file(self):

self.inFile.read('2H')
self.inFile.read('4L')
version = self.inFile.readUInt()
self.inFile.read('2L')
numBones = self.inFile.readUInt()
self.inFile.read('10L')
self.inFile.read('2H') #large number
self.inFile.readUInt()
self.read_name()
self.inFile.readFloat()
self.inFile.readUInt()
numMesh = self.inFile.readUInt()
self.parse_mesh(numMesh)
-----------------------------------------------------------------------------------------------------------------------------


Attachments:
error.jpg [66.01 KiB]
Not downloaded yet
Top
   
PostPosted: Thu Dec 22, 2016 3:57 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 303
here same script but modified for Sudden Attack :D
viewtopic.php?p=15345#p15345


Top
   
PostPosted: Thu Dec 22, 2016 4:08 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
Thank you very much.
I would come up with the help of you.
Good job.

I have an additional question.
Other ltb not operated when you run a file.


Attachments:
error 2.jpg [24.67 KiB]
Not downloaded yet
Top
   
PostPosted: Thu Dec 22, 2016 4:35 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 303
as long as it is from the same game, you will have to upload the not-working samples for examination :)


Top
   
PostPosted: Thu Dec 22, 2016 4:41 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
A file upload your files into troubleshooting the errors, but other ltb can not be loaded.
Do you need to file ltb?


Top
   
PostPosted: Thu Dec 22, 2016 4:57 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 303
yes i need your not-working Sudden Attack ltb samples :)


Top
   
PostPosted: Thu Dec 22, 2016 5:03 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
http://cfs.tistory.com/custom/blog/172/ ... _woman.ltb

The link file ltb
I really, really for you Thank you.
I'm South Korea, you and I want to stay close.


Top
   
PostPosted: Sat Dec 24, 2016 9:17 pm 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 303
i thought this was going to be an easy adjustment to the script and it very well might be,
but the way the script was written to call different functions and jump all around makes it
difficult for me to follow it while parsing the model, it is confusing to me and i'll need to
insert all kinds of print statements to see what is happening and where. :(
might be better to ask finale00 to fix his script because he knows exactly what to look for.


Top
   
PostPosted: Tue Apr 25, 2017 4:38 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
Who is finale00?
Could you ask me if you can, if possible?


Top
   
PostPosted: Tue Apr 25, 2017 5:24 pm 

Joined: Thu Dec 22, 2016 3:05 pm
Posts: 7
I can't load it.
If there is a way to give me a way. please
Two files cannot be loaded.

First file : http://tistory3.daumcdn.net/tistory/172 ... _woman.ltb
First file(image error) : http://tistory2.daumcdn.net/tistory/172 ... _woman.jpg

Second file : http://tistory3.daumcdn.net/tistory/172 ... a_blue.ltb
Second file(image error) : http://tistory1.daumcdn.net/tistory/172 ... a_blue.jpg

Ask him to answer me by contacting someone who has a chance to correct the loading error.
please


Top
   
PostPosted: Sat Apr 29, 2017 2:42 am 
User avatar

Joined: Fri Aug 08, 2014 1:06 am
Posts: 303
i guess you can PM him here or Xentax :)
his ZuOnline script does open your yukata_blue.ltb sample by the way.

_________________
Quickbms.com link thread
Search bms scripts


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 11 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited