Anonymous

Changes

From Final Fantasy Inside

FF8/WorldMap charaone

3,302 bytes added, 18:38, 16 February 2019
section 12 (arg4 == 0x12)
| Bone[boneID].RotY
|}
 
= source =
Example C# source of file parsing as in OpenVIII (commit from 16/02/1019):
https://github.com/MaKiPL/OpenVIII/blob/db46297fbc7961852e89427927df2e40623266a5/FF8/module_world_debug.cs#L202
 
private static void ReadCharaOne(byte[] charaOneB)
{
using (MemoryStream ms = new MemoryStream(charaOneB))
using (BinaryReader br = new BinaryReader(ms))
{
uint eof = br.ReadUInt32();
TIM2 tim;
while (ms.CanRead)
if (BitConverter.ToUInt16(charaOneB, (int)ms.Position) == 0)
ms.Seek(2, SeekOrigin.Current);
else if (br.ReadUInt64() == 0x0000000800000010)
{
ms.Seek(-8, SeekOrigin.Current);
tim = new TIM2(charaOneB, (uint)ms.Position);
ms.Seek(tim.GetHeight * tim.GetWidth / 2 + 64, SeekOrigin.Current); //i.e. 64*20=1280/2=640 + 64= 704 + eof
if (charaOneTextures == null)
charaOneTextures = new List<Texture2D[]>();
charaOneTextures.Add(new Texture2D[1] { new Texture2D(Memory.graphics.GraphicsDevice, tim.GetWidth, tim.GetHeight, false, SurfaceFormat.Color) });
charaOneTextures.Last()[0].SetData(tim.CreateImageBuffer(tim.GetClutColors(0), true));
}
else //is geometry structure
{
ms.Seek(-8, SeekOrigin.Current);
uint esi10h = BitConverter.ToUInt32(charaOneB, (int)ms.Position + 0x10);
uint esi14h = BitConverter.ToUInt32(charaOneB, (int)ms.Position + 0x14);
uint u45 = BitConverter.ToUInt32(charaOneB, (int)ms.Position + 56); //+2?
uint v29 = BitConverter.ToUInt32(charaOneB, (int)ms.Position) << 6; //bone section?
uint d250516c = BitConverter.ToUInt32(charaOneB, (int)ms.Position + 4) * 8; //unk?
uint v25 = BitConverter.ToUInt32(charaOneB, (int)ms.Position + 8); //unk size?
ms.Seek(u45, SeekOrigin.Current);
if (ms.Position > ms.Length)
break;
ushort countIs = br.ReadUInt16();
ushort cEntries = 0;
while (countIs != 0/*(cEntries = br.ReadUInt16()) != 0*/)
{
cEntries = br.ReadUInt16();
ushort cBones = br.ReadUInt16();
while (cEntries != 0)
{
Bone testBone = new Bone() { X = br.ReadInt16(), Y = br.ReadInt16(), Z = br.ReadInt16() };
Vector3[] myVec = new Vector3[cBones];
for (int i = 0; i < cBones; i++)
myVec[i] = new Vector3() { X = br.ReadInt16(), Y = br.ReadUInt16(), Z = br.ReadUInt16() };
cEntries--;
}
countIs--;
}
}
return;
}
}
Anonymous user