diff --git a/Marathon.CLI/Program.cs b/Marathon.CLI/Program.cs index d89b4b3d..4d3020ed 100644 --- a/Marathon.CLI/Program.cs +++ b/Marathon.CLI/Program.cs @@ -2,9 +2,9 @@ using Marathon.Formats.Audio; using Marathon.Formats.Event; using Marathon.Formats.Mesh; +using Marathon.Formats.Object; using Marathon.Formats.Package; using Marathon.Formats.Particle; -using Marathon.Formats.Placement; using Marathon.Formats.Save; using Marathon.Formats.Script; using Marathon.Formats.Script.Lua; @@ -210,12 +210,12 @@ static void Main(string[] args) case ".set": case ".set.json": - ObjectPlacement set = new(arg, true, !args.Contains("--no-index")); + SetData set = new(arg, true, !args.Contains("--no-index")); break; case ".prop": case ".prop.json": - ObjectPropertyDatabase prop = new(arg, true); + PropertyDatabase prop = new(arg, true); break; case string mstEx when mstEx.EndsWith(".mst"): diff --git a/Marathon/Formats/Placement/ObjectPropertyDatabase.cs b/Marathon/Formats/Object/PropertyDatabase.cs similarity index 92% rename from Marathon/Formats/Placement/ObjectPropertyDatabase.cs rename to Marathon/Formats/Object/PropertyDatabase.cs index 96d4917b..b8f40340 100644 --- a/Marathon/Formats/Placement/ObjectPropertyDatabase.cs +++ b/Marathon/Formats/Object/PropertyDatabase.cs @@ -1,14 +1,14 @@ -namespace Marathon.Formats.Placement +namespace Marathon.Formats.Object { /// /// File base for the *.prop format. /// Used in SONIC THE HEDGEHOG for defining object properties. /// - public class ObjectPropertyDatabase : FileBase + public class PropertyDatabase : FileBase { - public ObjectPropertyDatabase() { } + public PropertyDatabase() { } - public ObjectPropertyDatabase(string file, bool serialise = false) + public PropertyDatabase(string file, bool serialise = false) { switch (Path.GetExtension(file)) { @@ -84,7 +84,7 @@ public override void Load(Stream stream) ObjectParameter parameter = new() { Name = new string(reader.ReadChars(0x10)).Trim('\0'), - Type = (ObjectDataType)reader.ReadUInt32() + Type = (SetDataType)reader.ReadUInt32() }; entry.Parameters.Add(parameter); @@ -163,11 +163,11 @@ public class ObjectParameter { public string Name { get; set; } - public ObjectDataType Type { get; set; } + public SetDataType Type { get; set; } public ObjectParameter() { } - public ObjectParameter(string in_name, ObjectDataType in_type) + public ObjectParameter(string in_name, SetDataType in_type) { Name = in_name; Type = in_type; diff --git a/Marathon/Formats/Placement/ObjectPlacement.cs b/Marathon/Formats/Object/SetData.cs similarity index 93% rename from Marathon/Formats/Placement/ObjectPlacement.cs rename to Marathon/Formats/Object/SetData.cs index f142ae24..482461fc 100644 --- a/Marathon/Formats/Placement/ObjectPlacement.cs +++ b/Marathon/Formats/Object/SetData.cs @@ -1,18 +1,17 @@ using Marathon.Exceptions; using Marathon.Helpers; -using Newtonsoft.Json; -namespace Marathon.Formats.Placement +namespace Marathon.Formats.Object { /// /// File base for the *.set format. /// Used in SONIC THE HEDGEHOG for object layouts. /// - public class ObjectPlacement : FileBase + public class SetData : FileBase { - public ObjectPlacement() { } + public SetData() { } - public ObjectPlacement(string file, bool serialise = false, bool displayIndex = true) + public SetData(string file, bool serialise = false, bool displayIndex = true) { switch (Path.GetExtension(file)) { @@ -118,7 +117,7 @@ public override void Load(Stream stream) for (int p = 0; p < parameterCount; p++) { // Read object data type. - ObjectDataType type = (ObjectDataType)reader.ReadUInt32(); + SetDataType type = (SetDataType)reader.ReadUInt32(); // Initialise new parameter with the read type. SetParameter setParameter = new() @@ -128,22 +127,22 @@ public override void Load(Stream stream) switch (type) { - case ObjectDataType.Boolean: + case SetDataType.Boolean: setParameter.Data = reader.ReadBoolean(4); reader.JumpAhead(0x0C); break; - case ObjectDataType.Int32: + case SetDataType.Int32: setParameter.Data = reader.ReadInt32(); reader.JumpAhead(0x0C); break; - case ObjectDataType.Single: + case SetDataType.Single: setParameter.Data = reader.ReadSingle(); reader.JumpAhead(0x0C); break; - case ObjectDataType.String: + case SetDataType.String: { uint stringOffset = reader.ReadUInt32(); @@ -165,12 +164,12 @@ public override void Load(Stream stream) break; } - case ObjectDataType.Vector3: + case SetDataType.Vector3: setParameter.Data = reader.ReadVector3(); reader.JumpAhead(0x04); break; - case ObjectDataType.UInt32: + case SetDataType.UInt32: setParameter.Data = reader.ReadUInt32(); reader.JumpAhead(0x0C); break; @@ -276,29 +275,29 @@ public override void Save(Stream stream) for (int p = 0; p < Data.Objects[o].Parameters.Count; p++) { - ObjectDataType type = Data.Objects[o].Parameters[p].Type; + SetDataType type = Data.Objects[o].Parameters[p].Type; // Write object data type. writer.Write((uint)type); switch (type) { - case ObjectDataType.Boolean: + case SetDataType.Boolean: writer.WriteBoolean32((bool)Data.Objects[o].Parameters[p].Data); writer.WriteNulls(0x0C); break; - case ObjectDataType.Int32: + case SetDataType.Int32: writer.Write(Convert.ToInt32(Data.Objects[o].Parameters[p].Data)); writer.WriteNulls(0x0C); break; - case ObjectDataType.Single: + case SetDataType.Single: writer.Write(Convert.ToSingle(Data.Objects[o].Parameters[p].Data)); writer.WriteNulls(0x0C); break; - case ObjectDataType.String: + case SetDataType.String: { // If the parameter's string is empty, add an offset to a null entry. if (string.IsNullOrEmpty(Data.Objects[o].Parameters[p].Data.ToString())) @@ -317,12 +316,12 @@ public override void Save(Stream stream) break; } - case ObjectDataType.Vector3: + case SetDataType.Vector3: writer.Write(VectorHelper.ParseVector3(Data.Objects[o].Parameters[p].Data)); writer.WriteNulls(0x04); break; - case ObjectDataType.UInt32: + case SetDataType.UInt32: writer.Write(Convert.ToUInt32(Data.Objects[o].Parameters[p].Data)); writer.WriteNulls(0x0C); break; @@ -378,7 +377,7 @@ associated with it (because that can happen apparently) */ for (int p = 0; p < Data.Objects[o].Parameters.Count; p++) { - if (Data.Objects[o].Parameters[p].Type == ObjectDataType.String) + if (Data.Objects[o].Parameters[p].Type == SetDataType.String) { if (string.IsNullOrEmpty(Data.Objects[o].Parameters[p].Data.ToString())) { @@ -469,11 +468,11 @@ public class SetParameter /// /// The data type for . /// - public ObjectDataType Type { get; set; } + public SetDataType Type { get; set; } public SetParameter() { } - public SetParameter(object in_data, ObjectDataType in_type) + public SetParameter(object in_data, SetDataType in_type) { Data = in_data; Type = in_type; diff --git a/Marathon/Formats/Placement/ObjectDataType.cs b/Marathon/Formats/Object/SetDataType.cs similarity index 69% rename from Marathon/Formats/Placement/ObjectDataType.cs rename to Marathon/Formats/Object/SetDataType.cs index 645e443e..ef7bc04b 100644 --- a/Marathon/Formats/Placement/ObjectDataType.cs +++ b/Marathon/Formats/Object/SetDataType.cs @@ -1,7 +1,7 @@ -namespace Marathon.Formats.Placement +namespace Marathon.Formats.Object { [JsonConverter(typeof(StringEnumConverter))] - public enum ObjectDataType + public enum SetDataType { Boolean, Int32, diff --git a/README.md b/README.md index 68c8be34..3633cb54 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- +

Marathon

@@ -13,50 +13,50 @@ # Releases ### GitHub Releases -This is where [stable builds](https://github.com/Big-Endian-32/Marathon/releases) of Marathon are published; if you're looking for the most reliable experience. +This is where [stable builds](https://github.com/hyperbx/Marathon/releases) of Marathon are published; if you're looking for the most reliable experience. ### GitHub Actions -While it can be fun to live on the bleeding edge, [GitHub Actions](https://github.com/Big-Endian-32/Marathon/actions) publishes new builds for each new commit, so changes can be unstable. +While it can be fun to live on the bleeding edge, [GitHub Actions](https://github.com/hyperbx/Marathon/actions) publishes new builds for each new commit, so changes can be unstable. # Building -See the [Building](https://github.com/Big-Endian-32/Marathon/wiki/Building) page on the wiki. +See the [Building](https://github.com/hyperbx/Marathon/wiki/Building) page on the wiki. # Capabilities - Archive - - [U8 Archive (`*.arc`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Archive/U8Archive.cs) reading and writing + - [U8 Archive (`*.arc`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Archive/U8Archive.cs) reading and writing - Audio - - [Sound Bank (`*.sbk`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Audio/SoundBank.cs) reading and writing + - [Sound Bank (`*.sbk`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Audio/SoundBank.cs) reading and writing - Event - - [Event Playbook (`*.epb`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Event/EventPlaybook.cs) reading and writing - - [Time Event (`*.tev`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Event/TimeEvent.cs) reading and writing + - [Event Playbook (`*.epb`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Event/EventPlaybook.cs) reading and writing + - [Time Event (`*.tev`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Event/TimeEvent.cs) reading and writing - Mesh - - [Collision (`collision.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Mesh/Collision.cs) reading and writing - - [Ninja (`*.xna; *.xnd; *.xne; *.xnf; *.xng; *.xni; *.xnm; *.xno; *.xnv`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Mesh/Ninja/NinjaNext.cs) reading and writing - - [Path Spline (`*.path`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Mesh/PathSpline.cs) reading and writing - - [Reflection Zone (`*.rab`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Mesh/ReflectionZone.cs) reading and writing + - [Collision (`collision.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Mesh/Collision.cs) reading and writing + - [Ninja (`*.xna; *.xnd; *.xne; *.xnf; *.xng; *.xni; *.xnm; *.xno; *.xnv`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Mesh/Ninja/NinjaNext.cs) reading and writing + - [Path Spline (`*.path`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Mesh/PathSpline.cs) reading and writing + - [Reflection Zone (`*.rab`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Mesh/ReflectionZone.cs) reading and writing +- Object + - [Set Data (`*.set`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Object/SetData.cs) reading and writing + - [Property Database (`*.prop`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Object/PropertyDatabase.cs) reading and writing - Package - - [Asset Package (`*.pkg`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/AssetPackage.cs) reading and writing - - [Common Package (`Common.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/CommonPackage.cs) reading and writing - - [Explosion Package (`Explosion.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/ExplosionPackage.cs) reading and writing - - [Path Package (`PathObj.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/PathPackage.cs) reading and writing - - [Script Package (`ScriptParameter.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/ScriptPackage.cs) reading and writing - - [Shot Package (`ShotParameter.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Package/ShotPackage.cs) reading and writing + - [Asset Package (`*.pkg`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/AssetPackage.cs) reading and writing + - [Common Package (`Common.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/CommonPackage.cs) reading and writing + - [Explosion Package (`Explosion.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/ExplosionPackage.cs) reading and writing + - [Path Package (`PathObj.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/PathPackage.cs) reading and writing + - [Script Package (`ScriptParameter.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/ScriptPackage.cs) reading and writing + - [Shot Package (`ShotParameter.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Package/ShotPackage.cs) reading and writing - Particle - - [Particle Container (`*.plc`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Particle/ParticleContainer.cs) reading and writing - - [Particle Effect Bank (`*.peb`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Particle/ParticleEffectBank.cs) reading and writing - - [Particle Generation System (`*.pgs`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Particle/ParticleGenerationSystem.cs) reading and writing - - [Particle Texture Bank (`*.ptb`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Particle/ParticleTextureBank.cs) reading and writing -- Placement - - [Object Placement (`*.set`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Placement/ObjectPlacement.cs) reading and writing - - [Object Property Database (`*.prop`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Placement/ObjectPropertyDatabase.cs) reading and writing + - [Particle Container (`*.plc`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Particle/ParticleContainer.cs) reading and writing + - [Particle Effect Bank (`*.peb`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Particle/ParticleEffectBank.cs) reading and writing + - [Particle Generation System (`*.pgs`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Particle/ParticleGenerationSystem.cs) reading and writing + - [Particle Texture Bank (`*.ptb`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Particle/ParticleTextureBank.cs) reading and writing - Save - - [Save Data (`SonicNextSaveData.bin`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Save/SonicNextSaveData.cs) reading and writing + - [Save Data (`SonicNextSaveData.bin`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Save/SonicNextSaveData.cs) reading and writing - Script - - [Lua Binary (`*.lub`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Script/Lua/LuaBinary.cs) reading and writing + - [Lua Binary (`*.lub`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Script/Lua/LuaBinary.cs) reading and writing - Text - - [Message Table (`*.mst`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Text/MessageTable.cs) reading and writing - - [Picture Font (`*.pft`)](https://github.com/Big-Endian-32/Marathon/blob/master/Marathon/Formats/Text/PictureFont.cs) reading and writing + - [Message Table (`*.mst`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Text/MessageTable.cs) reading and writing + - [Picture Font (`*.pft`)](https://github.com/hyperbx/Marathon/blob/master/Marathon/Formats/Text/PictureFont.cs) reading and writing # Unsupported