mengxingchen Posted December 22, 2024 Share Posted December 22, 2024 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 December 22, 2024 Engineer Share Posted December 22, 2024 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 December 23, 2024 Engineer Share Posted December 23, 2024 (edited) edit: renamed .hgdata to .hg-bin (originally it's .bin, so .hg-bin to separate it from the dozens of .bin formats) 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", ".hg-bin") 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 Edited December 29, 2024 by shak-otay .hgdata -> .hg-bin (instead of .bin) 2 Link to comment Share on other sites More sharing options...
mengxingchen Posted December 23, 2024 Author Share Posted December 23, 2024 5 hours ago, shak-otay said: 修补了 FVFsize=24 的给定脚本(未使用 20 和 40 进行测试,将失败): 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 Thank you Link to comment Share on other sites More sharing options...
Karpati Posted December 28, 2024 Share Posted December 28, 2024 On 12/22/2024 at 8:49 PM, mengxingchen said: The Python script used by Heroes&Generals for Noesis is no longer valid. Can anyone improve it mesh.7z 3.86 MB · 3 downloads fmt_HeroesandGenerals_hgdata.py 2.54 kB · 13 downloads I have downloaded and installed the "Heroes & Generals GC 14.12.17" to get .hgdata files. I did find hundreds of .bin files only. Can you tell me how did you get .hgdata files? Link to comment Share on other sites More sharing options...
mengxingchen Posted December 29, 2024 Author Share Posted December 29, 2024 On 12/28/2024 at 5:55 PM, Karpati said: 我已经下载并安装了“英雄与将军GC 14.12.17”以获取.hgdata文件。 我确实只找到了数百个 .bin 文件。 您能告诉我您是如何获得 .hgdata 文件的吗? *:\Program Files (x86)\Steam\steamapps\common\Heroes & Generals\_packed\_objects\ZPrimMesh This path contains a 3D model, but there was a conflict when I used the noesis script, so *. hgdata is my modified name Heroes and Generals.zip 1 Link to comment Share on other sites More sharing options...
Karpati Posted December 30, 2024 Share Posted December 30, 2024 17 hours ago, mengxingchen said: *:\Program Files (x86)\Steam\steamapps\common\Heroes & Generals\_packed\_objects\ZPrimMesh This path contains a 3D model, but there was a conflict when I used the noesis script, so *. hgdata is my modified name Heroes and Generals.zip 352 B · 1 download Thank you for your very useful information and the unpacker script. 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