Habs schon gefunden :
Struktur
Code:
enum ObjectType
{
End = -1,
Object = 0,
CommonControl = 2,
Item = 4,
Mover = 5,
Ship = 6
}
enum AIType
{
Monster = 2,
ClockWorks = 4,
Pet = 5,
BigMuscle = 6,
Krrr = 7,
Bear = 8,
Monster2 = 100,
Meteonyker = 10
}
struct Vector3
{
float X;
float Y;
float Z;
};
struct DYO
{
while (true)
{
ObjectType[int] Type;
if (Type == ObjectType.End)
return;
switch (Type)
{
case ObjectType.Object:
case ObjectType.Item:
case ObjectType.Ship:
Object Object;
break;
case ObjectType.CommonControl:
CommonControl Object;
break;
case ObjectType.Mover:
Mover Object;
break;
}
}
};
struct Object
{
float Angle;
Vector3 AxisRotation;
Vector3 Position;
Vector3 Scale;
int SetAI; // == 5
int ObjectID;
int Unknown;
AIType[int] AI;
int Unknown;
};
struct CommonControl
{
Object Base;
uint UnknownConidition;
if (UnknownConidition == 0x80000000)
byte Unknown1[432];
else if (UnknownConidition == 0x90000000)
{
byte Unknown1[88];
byte Unknown2[280];
}
else
byte Unknown2[392];
};
struct Mover
{
Object Base;
byte Unknown1[64];
byte Unknown2[32];
byte Name[32];
int Unknown3;
int Unknown4;
}; Beispiel
Code:
using System;
using System.IO;
using System.Text;
namespace DYO_Reader
{
/// <summary>
/// Reads and outputs the information from a DYO file
/// </summary>
class Program
{
/// <summary>
/// Type of object to read
/// </summary>
enum ObjectType
{
End = -1,
Object = 0,
CommonControl = 2,
Item = 4,
Mover = 5,
Ship = 6
}
/// <summary>
/// AI type
/// </summary>
enum AIType
{
Monster = 2,
ClockWorks = 4,
Pet = 5,
BigMuscle = 6,
Krrr = 7,
Bear = 8,
Monster2 = 100,
Meteonyker = 10
}
/// <summary>
/// File name to load
/// </summary>
const string FILE_NAME = @"C:\Program Files (x86)\Gpotato\Flyff\World\WdMadrigal\WdMadrigal.dyo";
/// <summary>
/// Loads the specified DYO file and outputs the information
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
BinaryReader fh = new BinaryReader(File.OpenRead(FILE_NAME));
while (true)
{
ObjectType objectType = (ObjectType)fh.ReadInt32();
if(objectType == ObjectType.End)
break;
Console.WriteLine("Type: {0}", objectType);
switch (objectType)
{
case ObjectType.Object:
case ObjectType.Item:
case ObjectType.Ship:
ReadObject(fh);
break;
case ObjectType.CommonControl:
{
ReadObject(fh);
uint unknownCondition = fh.ReadUInt32();
switch (unknownCondition)
{
case 0x80000000:
fh.ReadBytes(432);
break;
case 0x90000000:
{
fh.ReadBytes(88);
fh.ReadBytes(280);
}
break;
default:
fh.ReadBytes(392);
break;
}
}
break;
case ObjectType.Mover:
{
ReadObject(fh);
fh.ReadBytes(64);
fh.ReadBytes(32);
string moverName = Encoding.Default.GetString(fh.ReadBytes(32));
moverName = moverName.Substring(0, moverName.IndexOf('\0'));
Console.WriteLine("Name: {0}", moverName);
Console.WriteLine("Unknown 10: {0}", fh.ReadInt32());
Console.WriteLine("Unknown 11: {0}", fh.ReadInt32());
}
break;
default:
{
Console.WriteLine("Invalid Type");
goto exit;
}
}
Console.WriteLine("--------------------");
}
exit:
fh.Close();
Console.Read();
}
/// <summary>
/// Reads an object
/// Used by all object types
/// </summary>
/// <param name="fh">File Handler</param>
static void ReadObject(BinaryReader fh)
{
Console.WriteLine("Y Rotation: {0}", fh.ReadSingle());
Console.WriteLine("Axis Rotation: X: {0}; Y: {1}; Z: {2}", fh.ReadSingle(), fh.ReadSingle(), fh.ReadSingle());
Console.WriteLine("Position: X: {0}; Y: {1}; Z: {2}", fh.ReadSingle(), fh.ReadSingle(), fh.ReadSingle());
Console.WriteLine("Scale: X: {0}; Y: {1}; Z: {2}", fh.ReadSingle(), fh.ReadSingle(), fh.ReadSingle());
Console.WriteLine("Set AI: {0}", fh.ReadInt32() == 5);
Console.WriteLine("Object ID: {0}", fh.ReadInt32());
Console.WriteLine("Unknown: {0}", fh.ReadInt32());
Console.WriteLine("AI Type: {0}", (AIType)fh.ReadInt32());
Console.WriteLine("Unknown: {0}", fh.ReadInt32());
}
}
} Naja wo ist da die Eigenleistung?
Lesezeichen