Hi guys, I have not been here for a long time, there was a problem with my hardware iMac ))
I tried to write a script on Noesis, and I have some success, but the script contains a lot of mistakes ...
This script works with InitialD Extreme Stage/ InitialD Arcade Stage 6AA / InitialD Arcade Stage 7AAX and InitialD Arcade Stage 8 Infinity with *.efo containers that contain meshes and textures.
At the moment the script does not work correctly, it reads not the hex offset in the files but it looks for the content labels
I could not fully understand the structure. * .efo, who knows how to handle hex, I will be glad to any help and advice in search of the necessary displacements and decoding of the structure.
Currently, the script reads only files containing single models (not group models)
Code: Select all
from inc_noesis import *
import noesis
import rapi
def registerNoesisTypes():
handle = noesis.register("InitialD", ".efo")
noesis.setHandlerTypeCheck(handle, noepyCheckType)
noesis.setHandlerLoadModel(handle, noepyLoadModel)
#noesis.logPopup()
return 1
NOEPY_HEADER = "YABX"
def noepyCheckType(data):
bs = NoeBitStream(data)
if len(data) < 4:
return 0
if bs.readBytes(4).decode("ASCII").rstrip("\0") != NOEPY_HEADER:
return 0
return 1
def noepyLoadModel(data, mdlList):
ctx = rapi.rpgCreateContext()
bs = NoeBitStream(data)
fileName = rapi.getLocalFileName(rapi.getInputName()).rstrip(".efo")
print("File Name: " + str(fileName))
#Texture Name
#bs.seek(0x3573, NOESEEK_ABS)
#textureNamesize = bs.readUShort()
#textureName = bs.readBytes(textureNamesize).decode("ASCII").rstrip("\0")
#rapi.rpgSetName(textureName)
#print("Texture Name: " + str(textureName))
rapi.rpgSetName("bodyD16") # Texture Name FIX IT
# myString = bs.readBytes(len(data))
# essd = myString.find(b"\x65\x73\x73\x64")
# bs.seek(essd - 0x4, NOESEEK_ABS)
# skipessd = bs.readUInt()
# skip = bs.readBytes(essd)
myString1 = bs.readBytes(len(data))
myIndex1 = myString1.find(b"\x27\x06\x00\x00\x00\x01\x00\x00\x00\x1A\x27\x04") ##FIX IT
myString2 = bs.readBytes(len(data))
myIndex2 = myString2.find(b"\x47\x65\x6F\x6D\x30") ##FIX IT
#Face Counts
bs.seek(myIndex1, NOESEEK_ABS)
skip = bs.readBytes(23)
#bs.seek(9E5, NOESEEK_ABS)
FaceCount = bs.readUInt()
FaceBuffer = bs.readBytes(FaceCount * 2)
print("Face Counts: " + str(FaceCount))
bs.seek(myIndex2, NOESEEK_ABS)
skip = bs.readBytes(24)
#UV Vertex Stride
VertexStride = bs.readUInt()
print("UV Vertex Stride :" + str(VertexStride ))
bs.seek(myIndex2, NOESEEK_ABS)
skip = bs.readBytes(8)
size = bs.readUInt()
skip = bs.readBytes(size)
skip = bs.readBytes(10)
#Vertex Counts
VertexCount = bs.readUInt()
print("Vertex Count :" + str(VertexCount))
VertexBuffer = bs.readBytes(VertexCount * VertexStride)
if VertexStride == 12:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 12, 0) ## FIX IT
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 12, 16)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 12, 20)
elif VertexStride == 16:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 16, 0) ## FIX IT
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 16, 16)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 16, 20)
elif VertexStride == 20:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 20, 0) ## FIX IT
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 20, 16)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 20, 28)
elif VertexStride == 24:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 24, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 24, 8)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 24, 16)
elif VertexStride == 28:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 28, 0) ## FIX IT
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 28, 24)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 28, 36)
elif VertexStride == 32:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 32, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 32, 12)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 32, 24)
elif VertexStride == 36:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 36, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 36, 16)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 36, 28)
elif VertexStride == 40:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 40, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 40, 20)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 40, 32)
elif VertexStride == 44:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 44, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 44, 24)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 44, 36)
elif VertexStride == 56:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 56, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 56, 12)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 56, 24)
elif VertexStride == 60:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 60, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 60, 16)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 60, 28)
elif VertexStride == 64:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 64, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 64, 20)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 64, 32)
elif VertexStride == 68:
rapi.rpgBindPositionBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 68, 0)
rapi.rpgBindNormalBufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 68, 24)
rapi.rpgBindUV1BufferOfs(VertexBuffer, noesis.RPGEODATA_FLOAT, 68, 36)
else:
print("This mesh not yet supported")
rapi.rpgCommitTriangles(FaceBuffer, noesis.RPGEODATA_USHORT, FaceCount, noesis.RPGEO_TRIANGLE_STRIP, 1) #SHORT for word indices
#rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1) #Flip Mesh
mdl = rapi.rpgConstructModel()
mdlList.append(mdl)
rapi.rpgClearBufferBinds()
return 1
I was not able to find the offset at the beginning of the file to these blocks, I can not understand where they can be in * .efo (((