mengxingchen Posted 17 hours ago Share Posted 17 hours ago The Python script used by Heroes&Generals for Noesis is no longer valid. Can anyone improve it mesh.7z fmt_HeroesandGenerals_hgdata.py Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted 14 hours ago Engineer Share Posted 14 hours ago Without a working sample for the script no one will waste his time to patch, I guess. Link to comment Share on other sites More sharing options...
Engineer shak-otay Posted 3 hours ago Engineer Share Posted 3 hours ago Patched the given script for FVFsize=24 (NOT tested with 20 and 40, will fail): from inc_noesis import * import noesis import rapi import os def registerNoesisTypes(): handle = noesis.register("Heroes and Generals", ".hgdata") noesis.setHandlerTypeCheck(handle, noepyCheckType) noesis.setHandlerLoadModel(handle, noepyLoadModel) #noesis.logPopup() return 1 def noepyCheckType(data): return 1 def noepyLoadModel(data, mdlList): ctx = rapi.rpgCreateContext() bs = NoeBitStream(data) bs.seek(len(data) - 0x80, NOESEEK_ABS) TMP = bs.tell() print(hex(bs.tell()), "here1") string = bs.readBytes(0x80) #set range of bytes to search index = string.find(b"\x02\x00") #search for 0x02 0x00 print(hex(bs.tell()), index, "index") bs.seek(TMP + index - 2, NOESEEK_ABS) print(hex(bs.tell()), "here3") checkVBytes = bs.readInt() print(hex(checkVBytes), hex(bs.tell()), "here4") if checkVBytes == 0x20018: VBytes = 24 elif checkVBytes == 0x20014: VBytes = 20 elif checkVBytes == 0x20028: VBytes = 40 bs.seek(0x16, NOESEEK_ABS) print(hex(bs.tell()), "here5") print(VBytes, "vbytes") check = 0 end = len(data) meshName = 0 while check != end: meshName += 1 rapi.rpgSetName(str(meshName)) VCount = bs.readInt() // VBytes print(hex(bs.tell()-4), VCount, "vcount") FCount = bs.readInt() // 2 print(hex(bs.tell()-4), FCount, "fcount") bs.seek(4, NOESEEK_REL) print(hex(bs.tell()), "VBuf") VBuf = bs.readBytes(VCount * VBytes) print(hex(bs.tell()), "IBuf") IBuf = bs.readBytes(FCount*2) #print(IBuf) rapi.rpgBindPositionBufferOfs(VBuf, noesis.RPGEODATA_FLOAT, VBytes, 0) #position of vertices rapi.rpgBindUV1BufferOfs(VBuf, noesis.RPGEODATA_HALFFLOAT, VBytes, 20) #UVs rapi.rpgCommitTriangles(IBuf, noesis.RPGEODATA_USHORT, FCount, noesis.RPGEO_TRIANGLE, 0) #SHORT for word indices TMP2 = bs.tell() checkint = bs.readInt(); print("Test sig at ", hex(TMP2), hex(checkint)) if checkint != checkVBytes: TMP2 = bs.tell() print("error ") check = end bs.seek(0x3a, NOESEEK_REL) #if checkint == 0: # bs.seek(TMP2, NOESEEK_ABS) # skip = bs.readBytes(0x3e) check = bs.tell(); if check + 1 > end: check = end mdl = rapi.rpgConstructModel() mdlList.append(mdl) rapi.rpgClearBufferBinds() return 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now