Changes

Jump to navigation Jump to search

FF8/FileFormat X

1,569 bytes added, 11:26, 6 March 2015
Added Textures info + algorithms
Contains one [[PSX/TIM_format|TIMs]] with various size 512x256, 673x256, 768x256 (8BPP).
 
=== UV calculation algorithm ===
 
Float U = (float)U_Byte / (float)(TIM_Texture_Width * 2) + ((float)Texture_Page/(TIM_Texture_Width * 2));
 
=== Texture page calculation ===
 
string StrByte = InputBytes[TexturePage_index].ToString("X2"); //Gets TPage byte as HEX text
StrByte = "0" + StrByte.Substring(1); // Deletes the first char/ 6 bits
Byte TPage = Byte.Parse(StrByte); // Parses result as new byte
int TPageINT = TPage * 128; //For 8 bit TIM's, the texture page is 128 sized
 
Example:
0xB2 byte is:
2*128 = 256
 
=== TIM Texture width/height resolving ===
 
Byte[] OPN = File.ReadAllBytes(@"PATH TO .X stage file"); //Change this
Byte[] TIMtexture = { 0x10, 0x00, 0x00, 0x00, 0x09 };
int TIMoffset = ByteSearch(OPN, TIMtexture, 0); //Byte search is special search for byte array custom function
int TIMoffsetCLUTetc = TIMoffset + 18;
Byte[] CLUT = new byte[2];
Array.Copy(OPN, TIMoffsetCLUTetc, CLUT, 0, 2);
UInt16 CLUTsize = BitConverter.ToUInt16(CLUT, 0);
//DETERMINE HOW MUCH TO PASS
TIMoffsetCLUTetc += 2 + (CLUTsize * 512) + 8;
Byte[] szer = new byte[2];
Byte[] wyso = new byte[2];
Array.Copy(OPN, TIMoffsetCLUTetc, szer, 0, 2);
Array.Copy(OPN, TIMoffsetCLUTetc + 2, wyso, 0, 2);
UInt16 szerU = BitConverter.ToUInt16(szer, 0);
UInt16 wysoU = BitConverter.ToUInt16(wyso, 0);
int newSzerU = szerU * 2;
Anonymous user

Navigation menu