[EDIT: Sorry to get ahead of myself, let me thank you all for the help you've volunteered so far first. Thanks, it is appreciated. Also if there's a better forum for this, despite the code being specific to Noesis, let me know and I'll move it there.]
Ok so obviously I've done a bit more on this...
1: I figured out a more reliable check for file type... grouped files almost never have more than 6 individual files, which is the first byte, and single files are almost always referencing 0x40 in the first byte, so I used a check for that byte to differentiate... potential for error... low to moderate I think.
2: I've tested this and it certainly does...something... but not what I need, so, I can't say what's going wrong, but I have a guess.
My guess is that rapi.imageDecodeRaw() works the way I'm trying to use it.
I solved my issues with explicit data types by reading the inc_noesis.py file, in case anyone needs more info on the Noepy functions, you can find a few of them there.
Problem is, I didn't see the rapi functions, likely due to them not being part of noepy (duh)
Also, I have no idea how the image functions work, so I'm sort of bashing my head at them and hoping. (which so far hasn't worked) I'm thinking, since my image is obviously not "RGBA32" the other image functions won't work either, not that I understand how they work...
Anyway, this is the current state of my code... I could really use some help at this point...
Code: Select all
from inc_noesis import *
def registerNoesisTypes():
handle = noesis.register("Star Ocean sprite", ".unslz")
noesis.setHandlerTypeCheck(handle, noeCheckGeneric)
noesis.setHandlerLoadRGBA(handle, sosiLoadBGRA)
return 1
def sosiLoadBGRA(data, texList):
bs = NoeBitStream(data)
check=bs.readInt()
if (check >= 0x40):
groupedFile = False
else:
groupedFile = True
bs.seek(0,0)
if groupedFile:
numFiles = bs.readInt()
for h in range(0, numFiles):
fileHeaderOffset = []
spriteHeaderOffset = []
paletteOffset = []
imgDataOffset = []
spriteMode = []
numSprites = []
fileHeaderOffset.append(bs.readInt())
bs.seek(fileHeaderOffset[h]+0x1C,0)
spriteHeaderOffset.append(bs.readInt())
bs.seek(spriteHeaderOffset[h]-0x20,1)
paletteOffset.append(bs.readInt())
imgDataOffset.append(bs.readInt())
spriteMode.append(int(bs.readUShort()))
numSprites.append(int(bs.readUShort()))
imgPal = []
imgWidth = []
imgHeight = []
imgPix = []
for i in range(0, numSprites[
if spriteMode[h] == 2:
bs.readBytes(
imgPal.append(int(bs.readByte()))
imgWidth.append(int(bs.readByte()))
imgHeight.append(int(bs.readByte()))
bs.readBytes(5)
elif spriteMode[h] == 4:
bs.readBytes(4)
imgPal.append(int(bs.readUShort()))
imgWidth.append(int(bs.readUShort()))
imgHeight.append(int(bs.readUShort()))
bs.readBytes(
#for i in palettes do: palette[i] read palettes...? dunno how to do
#imgPal = rapi.imageGetPalette(imgPix, imgWidth, imgHeight, 256, 0, 1)
for i in range(0, numSprites[h]-1):
imgPix = rapi.imageDecodeRaw(imgPix, imgWidth[i], imgHeight[i], "a1b5g5r5") #I think this is wrong for this application
texList.append(NoeTexture("soetex"+"."+h+"."+i, imgWidth[i], imgHeight[i], pix32, noesis.NOESISTEX_RGBA32)) #No idea how this works