示例#1
0
        private void UpdateTexture(object sender = null, EventArgs e = null)
        {
            N64TexFormat fmt     = (N64TexFormat)comboBoxTexFmt.SelectedIndex;
            int          w       = (int)valueW.Value;
            int          h       = (int)valueH.Value;
            int          texSize = N64Texture.GetTexSize(w * h, fmt);

            if (!uint.TryParse(textBoxTexAddr.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint texAddr))
            {
                return;
            }


            byte[] tlut = null;
            if ((fmt == N64TexFormat.CI4 || fmt == N64TexFormat.CI8) && uint.TryParse(textBoxTlutAddr.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint tlutAddr))
            {
                try
                {
                    if (fmt == N64TexFormat.CI4)
                    {
                        tlut = ReadBytes(tlutAddr, 64);
                    }
                    else if (fmt == N64TexFormat.CI8)
                    {
                        tlut = ReadBytes(tlutAddr, 256);
                    }
                }
                catch (Exception)
                {
                    return;
                }
            }

            try
            {
                byte[] tex = ReadBytes(texAddr, texSize);
                textureBox1.Image = N64Texture.DecodeBitmap(w, h, fmt, tex, tlut);
            }
            catch (Exception)
            {
                return;
            }
        }
示例#2
0
 public Bitmap GetBitmap()
 {
     return(N64Texture.DecodeBitmap(Width, Height, Format, Texture, Tlut?.Texture));
 }