diff --git a/Source/Sonic Frontiers/Libraries/GOComponents.hmm b/Source/Sonic Frontiers/Libraries/GOComponents.hmm index 906179c7..330d8834 100644 --- a/Source/Sonic Frontiers/Libraries/GOComponents.hmm +++ b/Source/Sonic Frontiers/Libraries/GOComponents.hmm @@ -12,6 +12,7 @@ Library "GOComponents" by "Hyper" #import "Cameras" #import "Collections" + #import "PlayerVisuals" #import "Plugins" #import "Postures" #import "States" @@ -472,7 +473,27 @@ Library "GOComponents" by "Hyper" [StructLayout(LayoutKind.Explicit, Size = 0x180)] public struct GOCPlayerVisual { - [FieldOffset(0)] public GOComponent Base; + [FieldOffset(0x000)] public GOComponent Base; + + /// + /// A pointer to an instance of `app::player::PlayerVisual`. + /// + [FieldOffset(0x108)] public PlayerVisual* pPlayerVisual; + + /// + /// Retrieves the contained , given that its name matches . + /// + /// The name of the visual to retrieve. + /// A pointer to the if the names match; otherwise, null. + public PlayerVisual* GetVisual(string in_visualName) + { + if (pPlayerVisual->GetNameHash()() == StringMapOperation.ComputeHash(in_visualName)) + return pPlayerVisual; + else + return null; + } + + MAKE_GENERIC_API(GetVisual) } /// diff --git a/Source/Sonic Frontiers/Libraries/PlayerVisuals.hmm b/Source/Sonic Frontiers/Libraries/PlayerVisuals.hmm new file mode 100644 index 00000000..c3c5a628 --- /dev/null +++ b/Source/Sonic Frontiers/Libraries/PlayerVisuals.hmm @@ -0,0 +1,26 @@ +Library "PlayerVisuals" by "Hyper & NM" +{ + #include "Helpers" noemit + + using System.Runtime.InteropServices; + + /// + /// A struct representation of `app::player::PlayerVisual`. + /// + [StructLayout(LayoutKind.Explicit, Size = 0x40)] + public struct PlayerVisual + { + VFUNCTION_PTR(PlayerVisual, 1, uint, GetNameHash) + } + + /// + /// A struct representation of `app::player::VisualSuperSonic`. + /// + [StructLayout(LayoutKind.Explicit, Size = 0x130)] + public struct VisualSuperSonic + { + [FieldOffset(0x000)] public PlayerVisual Base; + + [FieldOffset(0x118)] public bool IsSuperSonic2; + } +} \ No newline at end of file