From 7e3fcb766c660269695344bc3d1a80087101dd25 Mon Sep 17 00:00:00 2001 From: Ray Koopa Date: Sat, 27 Jun 2020 16:58:34 +0200 Subject: [PATCH] Fix saving TeamContainer instances and add local test files for them. --- src/library/Syroot.Worms.Armageddon/Team.cs | 58 ++++--------- .../Syroot.Worms.Armageddon/TeamContainer.cs | 77 +++++------------- src/library/Syroot.Worms.WorldParty/Team.cs | 8 +- .../Syroot.Worms/Core/IO/StreamExtensions.cs | 67 ++++++++++++--- .../Files/Teams/custom.wgt | Bin 0 -> 26011 bytes .../Files/Teams/default.wgt | Bin 0 -> 11 bytes .../Files/Teams/default.wwp | Bin 0 -> 18728 bytes .../TeamContainerTests.cs | 4 +- src/test/Syroot.Worms.Test/Core/FileTester.cs | 7 +- 9 files changed, 100 insertions(+), 121 deletions(-) create mode 100644 src/test/Syroot.Worms.Armageddon.Test/Files/Teams/custom.wgt create mode 100644 src/test/Syroot.Worms.Armageddon.Test/Files/Teams/default.wgt create mode 100644 src/test/Syroot.Worms.Armageddon.Test/Files/Teams/default.wwp diff --git a/src/library/Syroot.Worms.Armageddon/Team.cs b/src/library/Syroot.Worms.Armageddon/Team.cs index c7184d5..5160f31 100644 --- a/src/library/Syroot.Worms.Armageddon/Team.cs +++ b/src/library/Syroot.Worms.Armageddon/Team.cs @@ -211,7 +211,7 @@ namespace Syroot.Worms.Armageddon { BitsPerPixel = 8, Size = new Size(24, 32), - Palette = reader.ReadStructs(256), + Palette = reader.ReadColors(256), Data = reader.ReadBytes(24 * 32) }; } @@ -234,7 +234,7 @@ namespace Syroot.Worms.Armageddon { BitsPerPixel = 8, Size = new Size(20, 17), - Palette = reader.ReadStructs(256), + Palette = reader.ReadColors(256), Data = reader.ReadBytes(20 * 17) }; @@ -264,7 +264,7 @@ namespace Syroot.Worms.Armageddon if (GraveSprite < 0) { writer.WriteString(GraveFileName, 0x20); - writer.WriteStructs(Grave.Palette); + writer.WriteColors(Grave.Palette); writer.Write(Grave.Data); } @@ -282,7 +282,7 @@ namespace Syroot.Worms.Armageddon writer.WriteStructs(MissionStatuses); writer.WriteString(FlagFileName, 0x20); - writer.WriteStructs(Flag.Palette); + writer.WriteColors(Flag.Palette); writer.Write(Flag.Data); writer.Write(DeathmatchRank); @@ -301,14 +301,11 @@ namespace Syroot.Worms.Armageddon [DebuggerDisplay("TeamMissionStatus Attemps={Attempts} Medal={Medal}")] public struct TeamMissionStatus { - /// - /// The number of attempts the team required to solve the mission. - /// - public int Attempts; + // ---- FIELDS ------------------------------------------------------------------------------------------------- - /// - /// The medal the team got to solve the mission. - /// + /// The number of attempts the team required to solve the mission. + public int Attempts; + /// The medal the team got to solve the mission. public int Medal; } @@ -317,44 +314,21 @@ namespace Syroot.Worms.Armageddon /// public enum TeamWeapon : byte { - /// - /// The Flame Thrower weapon. - /// + /// The Flame Thrower weapon. Flamethrower, - - /// - /// The Mole Bomb weapon. - /// + /// The Mole Bomb weapon. MoleBomb, - - /// - /// The Old Woman weapon. - /// + /// The Old Woman weapon. OldWoman, - - /// - /// The Homing Pigeon weapon. - /// + /// The Homing Pigeon weapon. HomingPigeon, - - /// - /// The Sheep Launcher weapon. - /// + /// The Sheep Launcher weapon. SheepLauncher, - - /// - /// The Mad Cow weapon. - /// + /// The Mad Cow weapon. MadCow, - - /// - /// The Holy Hand Grenade weapon. - /// + /// The Holy Hand Grenade weapon. HolyHandGrenade, - - /// - /// The Super Sheep or Aqua Sheep weapon. - /// + /// The Super Sheep or Aqua Sheep weapon. SuperSheep } } diff --git a/src/library/Syroot.Worms.Armageddon/TeamContainer.cs b/src/library/Syroot.Worms.Armageddon/TeamContainer.cs index 6b54529..a2e4cd5 100644 --- a/src/library/Syroot.Worms.Armageddon/TeamContainer.cs +++ b/src/library/Syroot.Worms.Armageddon/TeamContainer.cs @@ -57,7 +57,7 @@ namespace Syroot.Worms.Armageddon /// /// Gets or sets the list of instances stored. /// - public List Teams { get; set; } + public IList Teams { get; set; } // ---- METHODS (PUBLIC) --------------------------------------------------------------------------------------- @@ -90,7 +90,7 @@ namespace Syroot.Worms.Armageddon /// public void Save(Stream stream) { - using BinaryStream writer = new BinaryStream(stream, encoding: Encoding.ASCII); + using BinaryStream writer = new BinaryStream(stream, encoding: Encoding.ASCII, leaveOpen: true); // Write the header. writer.Write(_signature, StringCoding.ZeroTerminated); @@ -119,75 +119,36 @@ namespace Syroot.Worms.Armageddon /// [Flags] public enum UnlockedFeatures : int - { - /// - /// The utility weapon Laser Sight can be configured. - /// + { + /// No features have been unlocked yet. + None, + /// The utility weapon Laser Sight can be configured. UtilityLaserSight = 1 << 0, - - /// - /// The utility weapon Fast Walk can be configured. - /// + /// The utility weapon Fast Walk can be configured. UtilityFastWalk = 1 << 1, - - /// - /// The utility weapon Invisibility can be configured. - /// + /// The utility weapon Invisibility can be configured. UtilityInvisibility = 1 << 2, - - /// - /// The utility weapon Low Gravity can be configured. - /// + /// The utility weapon Low Gravity can be configured. UtilityLowGravity = 1 << 3, - - /// - /// The utility weapon Jetpack can be configured. - /// + /// The utility weapon Jetpack can be configured. UtilityJetpack = 1 << 4, - - /// - /// The Grenade upgrade can be enabled. - /// + /// The Grenade upgrade can be enabled. UpgradedGrenade = 1 << 8, - - /// - /// The Shotgun upgrade can be enabled. - /// + /// The Shotgun upgrade can be enabled. UpgradedShotgun = 1 << 9, - - /// - /// The cluster upgrade can be enabled. - /// + /// The cluster upgrade can be enabled. UpgradedClusters = 1 << 10, - - /// - /// The Longbow upgrade can be enabled. - /// + /// The Longbow upgrade can be enabled. UpgradedLongbow = 1 << 11, - - /// - /// The upgrade of Super Sheeps to become Aqua Sheeps can be enabled. - /// + /// The upgrade of Super Sheeps to become Aqua Sheeps can be enabled. AquaSheep = 1 << 12, - - /// - /// Worms can have infinite health and are killable only by drowning them. - /// + /// Worms can have infinite health and are killable only by drowning them. GodWorms = 1 << 16, - - /// - /// Blood effects when hitting worms can be enabled. - /// + /// Blood effects when hitting worms can be enabled. BloodFx = 1 << 17, - - /// - /// Every crate explodes with a sheep. - /// + /// Every crate explodes with a sheep. SheepHeaven = 1 << 18, - - /// - /// Map terrain can be indestructible and Full Wormage scheme is accessible. - /// + /// Map terrain can be indestructible and Full Wormage scheme is accessible. IndestructibleAndFullWormage = 1 << 24 } } diff --git a/src/library/Syroot.Worms.WorldParty/Team.cs b/src/library/Syroot.Worms.WorldParty/Team.cs index 716c44f..9c029cb 100644 --- a/src/library/Syroot.Worms.WorldParty/Team.cs +++ b/src/library/Syroot.Worms.WorldParty/Team.cs @@ -210,7 +210,7 @@ namespace Syroot.Worms.WorldParty { BitsPerPixel = 8, Size = new Size(24, 32), - Palette = reader.ReadStructs(256), + Palette = reader.ReadColors(256), Data = reader.ReadBytes(24 * 32) }; } @@ -233,7 +233,7 @@ namespace Syroot.Worms.WorldParty { BitsPerPixel = 8, Size = new Size(20, 17), - Palette = reader.ReadStructs(256), + Palette = reader.ReadColors(256), Data = reader.ReadBytes(20 * 17) }; @@ -262,7 +262,7 @@ namespace Syroot.Worms.WorldParty if (GraveSprite < 0) { writer.WriteString(GraveFileName, 0x20); - writer.WriteStructs(Grave.Palette); + writer.WriteColors(Grave.Palette); writer.Write(Grave.Data); } @@ -280,7 +280,7 @@ namespace Syroot.Worms.WorldParty writer.WriteStructs(MissionStatuses); writer.WriteString(FlagFileName, 0x20); - writer.WriteStructs(Flag.Palette); + writer.WriteColors(Flag.Palette); writer.Write(Flag.Data); writer.Write(Unknown1); diff --git a/src/library/Syroot.Worms/Core/IO/StreamExtensions.cs b/src/library/Syroot.Worms/Core/IO/StreamExtensions.cs index 928de1b..78ad865 100644 --- a/src/library/Syroot.Worms/Core/IO/StreamExtensions.cs +++ b/src/library/Syroot.Worms/Core/IO/StreamExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -22,7 +23,7 @@ namespace Syroot.Worms.Core.IO /// Reads an instance from the current stream. /// /// The type of the class to instantiate. - /// The extended . + /// The extended instance. /// The instance. public static T Load(this BinaryStream self) where T : ILoadable, new() { @@ -35,7 +36,7 @@ namespace Syroot.Worms.Core.IO /// Reads instances from the current stream. /// /// The type of the class to instantiate. - /// The extended . + /// The extended instance. /// The number of instances to read. /// The instances. public static T[] Load(this BinaryStream self, int count) where T : ILoadable, new() @@ -46,10 +47,31 @@ namespace Syroot.Worms.Core.IO return instances; } + /// + /// Reads an RGBA 32-bit color. + /// + /// The extended instance. + /// The read color. + public static Color ReadColor(this BinaryStream self) => Color.FromArgb(self.ReadInt32()); + + /// + /// Reads RGBA 32-bit colors. + /// + /// The extended instance. + /// The number of values to read. + /// The read colors. + public static Color[] ReadColors(this BinaryStream self, int count) + { + Color[] values = new Color[count]; + for (int i = 0; i < count; i++) + values[i] = Color.FromArgb(self.ReadInt32()); + return values; + } + /// /// Reads a 0-terminated string which is stored in a fixed-size block of bytes. /// - /// The extended . + /// The extended instance. /// The number of bytes the fixed-size blocks takes. /// The read string. public static string ReadString(this BinaryStream self, int length) @@ -65,10 +87,10 @@ namespace Syroot.Worms.Core.IO /// Reads 0-terminated strings which are stored in a fixed-size block of /// bytes. /// - /// The extended . + /// The extended instance. /// The number of values to read. /// The number of bytes the fixed-size blocks takes. - /// The read string. + /// The read strings. public static string[] ReadStrings(this BinaryStream self, int count, int length) { string[] strings = new string[count]; @@ -83,7 +105,7 @@ namespace Syroot.Worms.Core.IO /// The type of the structure to read. /// The extended instance. /// The structure of type . - public static T ReadStruct(this BinaryStream self) where T : struct + public static T ReadStruct(this BinaryStream self) where T : unmanaged { // Read the raw bytes of the structure. #if NETSTANDARD2_0 @@ -106,7 +128,7 @@ namespace Syroot.Worms.Core.IO /// The extended instance. /// The number of values to read. /// The structures of type . - public static T[] ReadStructs(this BinaryStream self, int count) where T : struct + public static T[] ReadStructs(this BinaryStream self, int count) where T : unmanaged { // Read the raw bytes of the structures. #if NETSTANDARD2_0 @@ -141,7 +163,7 @@ namespace Syroot.Worms.Core.IO /// Writes the given instance into the current stream. /// /// The type of the class to write. - /// The extended . + /// The extended instance. /// The instance to write into the current stream. public static void Save(this BinaryStream self, T value) where T : ISaveable { @@ -152,7 +174,7 @@ namespace Syroot.Worms.Core.IO /// Writes the given instances into the current stream. /// /// The type of the class to write. - /// The extended . + /// The extended instance. /// The instances to write into the current stream. public static void Save(this BinaryStream self, IList values) where T : ISaveable { @@ -166,6 +188,25 @@ namespace Syroot.Worms.Core.IO self.WriteInt32(value); } + /// + /// Writes the given color. + /// + /// The extended instance. + /// The color to write. + public static void WriteColor(this BinaryStream self, Color color) + => self.Write(color.R << 24 | color.G << 16 | color.B << 8 | color.A); + + /// + /// Writes the given colors. + /// + /// The extended instance. + /// The colors to write. + public static void WriteColors(this BinaryStream self, IEnumerable colors) + { + foreach (Color color in colors) + WriteColor(self, color); + } + /// /// Writes the given string into a fixed-size block of bytes and 0-terminates it. /// @@ -187,7 +228,7 @@ namespace Syroot.Worms.Core.IO /// The extended instance. /// The strings to write. /// The number of bytes a fixed-size block takes. - public static void WriteStrings(this BinaryStream self, IList values, int length) + public static void WriteStrings(this BinaryStream self, IEnumerable values, int length) { foreach (string value in values) WriteString(self, value, length); @@ -199,7 +240,7 @@ namespace Syroot.Worms.Core.IO /// The type of the structure to read. /// The extended instance. /// The structure to write. - public static void WriteStruct(this BinaryStream self, T value) where T : struct + public static void WriteStruct(this BinaryStream self, T value) where T : unmanaged { ReadOnlySpan bytes; unsafe { bytes = new ReadOnlySpan(Unsafe.AsPointer(ref value), Unsafe.SizeOf()); } @@ -216,10 +257,10 @@ namespace Syroot.Worms.Core.IO /// The type of the structure to read. /// The extended instance. /// The structures to write. - public static void WriteStructs(this BinaryStream self, IEnumerable values) where T : struct + public static void WriteStructs(this BinaryStream self, IEnumerable values) where T : unmanaged { foreach (T value in values) - self.WriteStruct(value); + WriteStruct(self, value); } } } diff --git a/src/test/Syroot.Worms.Armageddon.Test/Files/Teams/custom.wgt b/src/test/Syroot.Worms.Armageddon.Test/Files/Teams/custom.wgt new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!yK0%nUeF@2o(BRAw zeqtgA%2{i##%g0bPO~Z;xn3D?N|$v(_H)$PntYSQ@|V)BB?Q^J3ND(m zIrR(a1TSc-d%G~Q42jCJj7?-{*G028fUFiy*TtHRM?xMGtyiLIhSUV!1{Ss;ZA0oL z78VX74-i5*u#JTv%0ZNaC`XV-2;b&`5tK(z9_eHuhCD|2ZlwK4 z2U(DCt|6`=rtR(k4RHb32&}LXDb|LM9g%Y6w zSeQP5GysdJUo85Nx?r)i842a-eMmj9SPsMDOcE&rOC=9d2T~U-O(RGB68bNdeXul( z@@y0-iF5&$<}br?xdWDG2z4PHfMv8BB1kN5H2``SDn7Eg`ncbd`4yQ%Z})7!l*_|+taWm`A4wzPOZ@t7|(=G)};HlkBY z$DVB)+S)dK`swb0&h48wwlp;~d%M1U^ob`PZ})vOI@-PKvs*vuY4WsvPCT)5$M)@C z7|CZ}IPlEQty{fb?~~6R`qIuFz8?8*CwY7h}|IoAhckPON|Bc_LPQ4KP zYG>!B&kP?v{f%e8{KXf4@WymDcIuSu-}~58O8CrR|DoQYOZj~EoRqzI@?iVdCX}($ z$A^y#xpU{_OY-?ke4Oih^{q)Y@!iZ1C&tIm{_N$6pN?psKlbx?O5c0w$G?617gL1` zZ@u}uH`71*%C~;`-qqjy - /// Loads all files found in any game directories. + /// Tests all files found in the test directory. /// [TestMethod] - public void LoadTeamContainers() => FileTester.Run(Game.Armageddon, "*.wgt"); + public void LoadTeamContainers() => FileTester.Run(Game.Test, "*.wgt"); } } diff --git a/src/test/Syroot.Worms.Test/Core/FileTester.cs b/src/test/Syroot.Worms.Test/Core/FileTester.cs index 0ea2f08..276e22b 100644 --- a/src/test/Syroot.Worms.Test/Core/FileTester.cs +++ b/src/test/Syroot.Worms.Test/Core/FileTester.cs @@ -62,8 +62,11 @@ namespace Syroot.Worms.Test.Core T newInstance = new T(); newInstance.Load(stream); - Debug.Write($" compare"); - Assert.IsTrue(newInstance.Equals(instance)); + if (instance is IEquatable equatable) + { + Debug.Write($" compare"); + Assert.IsTrue(((IEquatable)newInstance).Equals(equatable)); + } } Debug.WriteLine($" OK"); }