DumpDVD/DumpDVD/Gui/DvdSpin/compile_spin_shader_to_h.py

16 lines
491 B
Python

def getShdrVarient(fname):
dbytes = []
sl = bytearray(open(fname, "rb").read())
for i in range(0, len(sl)):
dbytes.append(f"0x{sl[i]:02X}")
dbytes.append("0x00")
return "static char spinShaderSrc["+hex(len(dbytes))+"] {"+", ".join(dbytes)+"};\n"
hdr = "#ifndef _LI_SPINSHADER_H\n"
hdr += "#define _LI_SPINSHADER_H 1\n"
hdr += "#include <stdint.h>\n"
hdr += "#ifdef _WIN32\n"
hdr += getShdrVarient("SpinShader.hlsl")
hdr += "#endif\n"
hdr += "#endif\n"
print(hdr)