SHARE
TWEET

FF8 Stage model - TIM texture Height and width resolver

MaKiPL Feb 24th, 2015 (edited) 221 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void StartTexture()
  2.         {
  3.                 Byte[] TIMtexture = { 0x10, 0x00, 0x00, 0x00, 0x09 };
  4.             TIMoffset = ByteSearch(OpenedBytes, TIMtexture, 0);
  5.             textBox1.Text = TIMoffset.ToString("X2");
  6.  
  7.             //GET to clut
  8.             /*
  9.              * [1-4]   - 10 00 00 00: ID Tag for TIM
  10.              * [5-8]   - 09 00 00 00: ID Tag for 8BPP
  11.              * [9-10]  - ?
  12.              * [11-12] - ?
  13.              * [13-14] - Palette Org X
  14.              * [15-16] - Palette Org Y
  15.              * [17-18] - ?
  16.              * [19-20] - Number of CLUTs
  17.              * [??-??] - CLUT Data.  256 Colors per CLUT, 512 bytes per CLUT.
  18.              * [21-22] - ?
  19.              * [23-24] - ?
  20.              * [25-26] - Image Org X
  21.              * [27-28] - Image Org Y
  22.              * [29-30] - Image Width (Multiply by 2 to get actual width)
  23.              * [31-32] - Image Height
  24.              */
  25.  
  26.             int TIMoffsetCLUTetc = TIMoffset + 18;
  27.             Byte[] CLUT = new byte[2];
  28.             Array.Copy(OpenedBytes,TIMoffsetCLUTetc,CLUT,0,2);
  29.             UInt16 CLUTsize = BitConverter.ToUInt16(CLUT, 0);
  30.             //DETERMINE HOW MUCH TO PASS
  31.             TIMoffsetCLUTetc += 2 + (CLUTsize*512) + 8;
  32.             Byte[] szer = new byte[2];
  33.             Byte[] wyso = new byte[2];
  34.             Array.Copy(OpenedBytes, TIMoffsetCLUTetc, szer, 0, 2);
  35.             Array.Copy(OpenedBytes, TIMoffsetCLUTetc + 2, wyso, 0, 2);
  36.             UInt16 szerU = BitConverter.ToUInt16(szer, 0);
  37.             UInt16 wysoU = BitConverter.ToUInt16(wyso, 0);
  38.             textBox2.Text = (szerU * 2).ToString();
  39.             TEX_width = int.Parse(textBox2.Text);
  40.             textBox3.Text = wysoU.ToString();
  41.             TEX_heigh = int.Parse(textBox3.Text);
  42.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top