コード例 #1
0
        protected internal override void PostProcess(VoidPtr bresAddress, VoidPtr dataAddress, int dataLength, StringTable stringTable)
        {
            base.PostProcess(bresAddress, dataAddress, dataLength, stringTable);

            PLT0 *header = (PLT0 *)dataAddress;

            header->ResourceStringAddress = stringTable[Name] + 4;
        }
コード例 #2
0
        public static void EncodePalette(VoidPtr destAddr, ColorPalette pal, WiiPaletteFormat format)
        {
            int count = pal.Entries.Length;

            PLT0 *header = (PLT0 *)destAddr;

            *header = new PLT0(count, format);

            switch (format)
            {
            case WiiPaletteFormat.IA8:
            {
                IA8Pixel *dPtr = (IA8Pixel *)header->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    dPtr[i] = (IA8Pixel)pal.Entries[i];
                }
                break;
            }

            case WiiPaletteFormat.RGB565:
            {
                wRGB565Pixel *dPtr = (wRGB565Pixel *)header->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    dPtr[i] = (wRGB565Pixel)pal.Entries[i];
                }
                break;
            }

            case WiiPaletteFormat.RGB5A3:
            {
                wRGB5A3Pixel *dPtr = (wRGB5A3Pixel *)header->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    dPtr[i] = (wRGB5A3Pixel)pal.Entries[i];
                }
                break;
            }
            }
        }
コード例 #3
0
        public static ColorPalette DecodePalette(PLT0 *palette)
        {
            int          count = palette->_numEntries;
            ColorPalette pal   = ColorPaletteExtension.CreatePalette(ColorPaletteFlags.HasAlpha, count);

            switch (palette->PaletteFormat)
            {
            case WiiPaletteFormat.IA8:
            {
                IA8Pixel *sPtr = (IA8Pixel *)palette->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    pal.Entries[i] = (Color)sPtr[i];
                }
                break;
            }

            case WiiPaletteFormat.RGB565:
            {
                wRGB565Pixel *sPtr = (wRGB565Pixel *)palette->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    pal.Entries[i] = (Color)sPtr[i];
                }
                break;
            }

            case WiiPaletteFormat.RGB5A3:
            {
                wRGB5A3Pixel *sPtr = (wRGB5A3Pixel *)palette->PaletteData;
                for (int i = 0; i < count; i++)
                {
                    pal.Entries[i] = (Color)(ARGBPixel)sPtr[i];
                }
                break;
            }
            }
            return(pal);
        }
コード例 #4
0
 public static Bitmap DecodeIndexed(TEX0 *texture, PLT0 *palette, int mipLevel)
 {
     return(Get(texture->PixelFormat).DecodeTextureIndexed(texture, palette, mipLevel));
 }
コード例 #5
0
 public virtual Bitmap DecodeTextureIndexed(TEX0 *texture, PLT0 *palette, int mipLevel)
 {
     return(DecodeTextureIndexed(texture, DecodePalette(palette), mipLevel));
 }