Zheneq / Noesis-Plugins

File format plugins for Noesis 3D viewer/converter app.
24 stars 7 forks source link

c4 c8 c14x2 code problems #3

Closed leeao closed 1 year ago

leeao commented 3 years ago

Hi Zheneq!

Thank you for your great work, I have benefited a lot. I encountered a problem while testing indexed images.

I got the error:

Traceback (most recent call last): File "G:\D\noesis\plugins\python\tex_NFS_HotPursuit_Wii_ExientXGSEngine_twi_debug.py", line 59, in noepyLoadRGBA texture = nintex.convert(pixels, width, height, 8, palette, 2) File "G:\D\noesis\plugins\python\lib_zq_nintendo_tex.py", line 325, in convert return decoder(buffer, width, height, palette, pixelFormat) File "G:\D\noesis\plugins\python\lib_zq_nintendo_tex.py", line 205, in c4 return indexed(0x08, dataFormat, buffer, width, height, paletteBuffer, pixelFormat) NameError: global name 'indexed' is not defined

So I changed the code to: return textureParser.indexed(0x08, dataFormat, buffer, width, height, paletteBuffer, pixelFormat)

But still error:

Traceback (most recent call last): File "G:\D\noesis\plugins\python\tex_NFS_HotPursuit_Wii_ExientXGSEngine_twi_debug.py", line 59, in noepyLoadRGBA texture = nintex.convert(pixels, width, height, 8, palette, 2) File "G:\D\noesis\plugins\python\lib_zq_nintendo_tex.py", line 325, in convert return decoder(buffer, width, height, palette, pixelFormat) File "G:\D\noesis\plugins\python\lib_zq_nintendo_tex.py", line 205, in c4 return textureParser.indexed(0x08, dataFormat, buffer, width, height, paletteBuffer, pixelFormat) NameError: global name 'dataFormat' is not defined

Prompt dataFormat is not defined. Then I found that it conflicts with the 0x8 parameter, because 0x8 is dataFormat. So I changed the code to: return textureParser.indexed(0x08, buffer, width, height, paletteBuffer, pixelFormat)

It worked.

This is the code I corrected:

    @staticmethod
    def c4(buffer, width, height, paletteBuffer, pixelFormat):
        return textureParser.indexed(0x08, buffer, width, height, paletteBuffer, pixelFormat)

    @staticmethod
    def c8(buffer, width, height, paletteBuffer, pixelFormat):
        return textureParser.indexed(0x09, buffer, width, height, paletteBuffer, pixelFormat)

    @staticmethod
    def c14x2(buffer, width, height, paletteBuffer, pixelFormat):
        return textureParser.indexed(0x0A, buffer, width, height, paletteBuffer, pixelFormat)

Hope you update the code!