Added SkinAdjustmentsEditor

-Removed ANIM Editor
-Added SkinAdjustments Editor for Skin ANIM and GAME_FLAGS values
-ANIM and GAME_FLAGS are now edited together across the program
-Box Editor made smaller
-Box Editor and SkinAdjustments Editor added to CustomSkinEditor
-SkinGameFlags class created
-Fixed bug where the first listed box wouldn't save changes in CustomSkinEditor
This commit is contained in:
MayNL
2026-04-09 01:23:44 -04:00
parent dcfc37cc02
commit ad4bece44d
54 changed files with 2978 additions and 4276 deletions
+7 -3
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
@@ -15,6 +16,8 @@ namespace PckStudio.Core.Skin
public SkinANIM Anim { get; set; }
public SkinGameFlags GameFlags { get; set; }
public SkinModel Model { get; set; }
public Image Texture { get; set; }
@@ -36,16 +39,17 @@ namespace PckStudio.Core.Skin
CapeTexture = capeTexture;
}
public Skin(string name, SkinANIM anim, Image texture, IEnumerable<SkinBOX> additionalBoxes, IEnumerable<SkinPartOffset> partOffsets)
public Skin(string name, SkinANIM anim, SkinGameFlags gameFlags, Image texture, IEnumerable<SkinBOX> additionalBoxes, IEnumerable<SkinPartOffset> partOffsets)
: this(name, texture)
{
Model.AdditionalBoxes.AddRange(additionalBoxes);
Model.PartOffsets.AddRange(partOffsets);
Anim = anim;
GameFlags = gameFlags;
}
public Skin(string name, int id, Image texture, SkinANIM anim, IEnumerable<SkinBOX> additionalBoxes, IEnumerable<SkinPartOffset> partOffsets)
: this(name, anim, texture, additionalBoxes, partOffsets)
public Skin(string name, int id, Image texture, SkinANIM anim, SkinGameFlags gameFlags, IEnumerable<SkinBOX> additionalBoxes, IEnumerable<SkinPartOffset> partOffsets)
: this(name, anim, gameFlags, texture, additionalBoxes, partOffsets)
{
Identifier = new(id);
}
+119
View File
@@ -0,0 +1,119 @@
/* Copyright (c) 2022-present miku-666, MayNL
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
using System;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
namespace PckStudio.Core.Skin
{
/// <summary>
/// Represents a Skin GAME_FLAGS value where flags can be set
/// </summary>
public class SkinGameFlags : ICloneable, IEquatable<SkinGameFlags>, IEquatable<SkinGameFlagsMask>
{
public static readonly SkinGameFlags Empty = new SkinGameFlags(0);
public static readonly SkinGameFlags CreatureSkin = new SkinGameFlags(0x16);
public static readonly SkinGameFlags HumanSkin = new SkinGameFlags(0x18);
public static readonly SkinGameFlags FemaleHumanSkin = new SkinGameFlags(0x1a);
public static readonly SkinGameFlags MaleHumanSkin = new SkinGameFlags(0x1c);
public static readonly SkinGameFlags RobotSkin = new SkinGameFlags(0x0e);
private BitVector32 _flags;
private static readonly Regex _validator = new Regex(@"^0x[0-9a-f]{1,2}\b", RegexOptions.IgnoreCase);
public SkinGameFlags(SkinGameFlagsMask mask)
: this((int)mask)
{
}
private SkinGameFlags(int mask)
{
_flags = new BitVector32(mask);
}
public override string ToString() => "0x" + _flags.Data.ToString("x2");
public static bool IsValidGameFlags(string gameFlags)
{
return !string.IsNullOrWhiteSpace(gameFlags) && _validator.IsMatch(gameFlags);
}
public static SkinGameFlags FromString(string value)
=> IsValidGameFlags(value)
? new SkinGameFlags(Convert.ToInt32(value.TrimEnd(' ', '\n', '\r'), 16))
: Empty;
public static SkinGameFlags operator |(SkinGameFlags @this, SkinGameFlags other) => new SkinGameFlags(@this._flags.Data | other._flags.Data);
public static SkinGameFlags operator |(SkinGameFlags @this, SkinGameFlagsMask mask) => new SkinGameFlags(@this._flags.Data | (int)mask);
public static SkinGameFlags operator &(SkinGameFlags @this, SkinGameFlagsMask mask) => new SkinGameFlags(@this._flags.Data & (int)mask);
public static SkinGameFlags FromValue(int value) => new SkinGameFlags(value);
public int ToValue() => _flags.Data;
public static implicit operator SkinGameFlags(SkinGameFlagsMask mask) => new SkinGameFlags(mask);
public static bool operator ==(SkinGameFlags @this, SkinGameFlagsMask mask) => @this.Equals(mask);
public static bool operator !=(SkinGameFlags @this, SkinGameFlagsMask mask) => !@this.Equals(mask);
public static bool operator ==(SkinGameFlags @this, SkinGameFlags other) => @this.Equals(other);
public static bool operator !=(SkinGameFlags @this, SkinGameFlags other) => !@this.Equals(other);
public bool Equals(SkinGameFlags other)
{
return _flags.Data == other._flags.Data;
}
public bool Equals(SkinGameFlagsMask other)
{
return _flags.Data == (int)other;
}
public override bool Equals(object obj) => obj is SkinGameFlags a && Equals(a);
public override int GetHashCode() => _flags.Data;
/// <summary>
/// Sets the desired flag in the bitfield
/// </summary>
/// <param name="flag">GAME_FLAGS Flag to set</param>
/// <param name="state">State of the flag</param>
public SkinGameFlags SetFlag(SkinGameFlagsFlag flag, bool state)
{
if (!Enum.IsDefined(typeof(SkinGameFlagsFlag), flag))
throw new ArgumentOutOfRangeException(nameof(flag));
return new SkinGameFlags(state ? _flags.Data | 1 << (int)flag : _flags.Data & ~(1 << (int)flag));
}
/// <summary>
/// Gets flag state
/// </summary>
/// <param name="flag">Flag to check</param>
/// <returns>True if flag is set, otherwise false</returns>
public bool GetFlag(SkinGameFlagsFlag flag)
{
if (!Enum.IsDefined(typeof(SkinGameFlagsFlag), flag))
throw new ArgumentOutOfRangeException(nameof(flag));
return _flags[1 << (int)flag];
}
public object Clone()
{
return MemberwiseClone();
}
}
}
+33
View File
@@ -0,0 +1,33 @@
/* Copyright (c) 2022-present miku-666, MayNL
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
namespace PckStudio.Core.Skin
{
/// <summary>
/// For usage see <see cref="SkinGameFlags"/>
/// </summary>
public enum SkinGameFlagsFlag : int // this is such a stupid name lol
{
UNFAIR_BATTLE_SKIN = 0, // 0x01
FEMALE_SKIN = 1, // 0x02
MALE_SKIN = 2, // 0x04
HUMAN_SKIN = 3, // 0x08
//
BIOLOGICAL_SKIN = 4, // 0x10
}
}
+33
View File
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PckStudio.Core.Skin
{
[Flags]
public enum SkinGameFlagsMask : int
{
NONE = 0, // 0x00
UNFAIR_BATTLE_SKIN = 1 << 0, // 0x01, Makes the skin unusable in Competitive Battle Mini Games
FEMALE_SKIN = 1 << 1, // 0x02, used on female skins
MALE_SKIN = 1 << 2, // 0x04, used on male skins
HUMAN_SKIN = 1 << 3, // 0x08, used on human skins that can be any gender and some non human IP characters
BIOLOGICAL_SKIN = 1 << 4, // 0x10, This is only ever disabled on Robot/Synthetic skins so this is seemingly implied
// HOW THESE FLAGS ARE USED IN GAME //
// DLC skins in Minecraft Console utilize these flags for what seems to be a cut categorization/sorting feature
// found in the skins menu with unused tabs labled "Mal" "Fem" and "Bea", respectively Male, Female, and likely "Beast"
// with Steve, Alex, and Creeper icon sprites respectively.
// Most, but notably not all, skins use this feature with a GAME_FLAGS. The following are the known used values and their archetypes:
// *Note this does not include variations with the battle flag. Just add 1 to get those values; i.e 0x1a -> 0x1b or 0x18 -> 0x19
// Creature/Fantasy skins - 0x16: Female, Male, and Biological flags enabled.
// Gender neutral human skins - 0x18: Human and Biological flags enabled.
// Female human skins - 0x1a: Female, Human, and Biological flags enabled.
// Male human skins - 0x1c: Male, Human, and Biological flags enabled.
// Robot/Synthetic skins - 0x0e: Male, Female, and Human flags enabled.
}
}