-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtex_Orange_JuiceTextures.py
32 lines (28 loc) · 1.03 KB
/
tex_Orange_JuiceTextures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from inc_noesis import *
def registerNoesisTypes():
handle = noesis.register("Orange_Juice Decompressed Textures", ".ojt")
noesis.setHandlerTypeCheck(handle, texCheckType)
noesis.setHandlerLoadRGBA(handle, texLoadARGB)
noesis.logPopup()
return 1
def texCheckType(data):
bs = NoeBitStream(data)
fileMagic = bs.readUInt()
if fileMagic in (0x47414c,0x4d474c):
return 1
else:
print("Fatal Error: Unknown file magic: " + str(hex(fileMagic) + " expected 0x47414c!"))
return 0
def texLoadARGB(data, texList):
bs = NoeBitStream(data)
magic = bs.readUInt()
width = bs.readUInt()
height = bs.readUInt()
if(magic == 0x4d474c):
length = width*height
pix = rapi.imageDecodeDXT(bs.readBytes(length), width, height, noesis.NOESISTEX_DXT5)
else:
length = width*height*8
pix = rapi.imageDecodeRaw(bs.readBytes(length), width, height, "b16g16r16a16")
texList.append(NoeTexture("OJTex", width, height, pix, noesis.NOESISTEX_RGBA32))
return 1