From 330f075bc97cfdd0d185a5ad1a95d2e920a442a5 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Mon, 10 Aug 2026 21:23:06 -0400 Subject: More proper joint mapping Signed-off-by: Andrew Opalach --- Plugin.cs | 209 +++++++++++++++++++++++++++----------------------------------- 1 file changed, 92 insertions(+), 117 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index 88ec14a..c1d7baf 100755 --- a/Plugin.cs +++ b/Plugin.cs @@ -424,96 +424,96 @@ namespace NewCamera private static class Joint { - public const byte Root = 0; - public const byte Root2 = 1; // Animations use this root. - public const byte LowerBack = 2; - public const byte UpperBack = 3; - public const byte LowerNeck = 4; - public const byte LowerNeckNull = 5; - public const byte UpperNeck = 6; - public const byte LeftCollarbone = 7; - public const byte LeftShoulderNull = 8; - public const byte LeftShoulder = 9; - public const byte LeftElbow = 10; - public const byte LeftWrist = 11; - public const byte LeftWristNull = 12; - public const byte LeftThumbLow = 13; - public const byte LeftThumbMid = 14; - public const byte LeftThumbHigh = 15; - public const byte LeftIndexLow = 16; - public const byte LeftIndexMid = 17; - public const byte LeftIndexHigh = 18; - public const byte LeftMiddleLow = 19; - public const byte LeftMiddleMid = 20; - public const byte LeftMiddleHigh = 21; - public const byte LeftPalm = 22; - public const byte LeftRingLow = 23; - public const byte LeftRingMid = 24; - public const byte LeftRingHigh = 25; - public const byte LeftPinkyLow = 26; - public const byte LeftPinkyMid = 27; - public const byte LeftPinkyHigh = 28; - public const byte LeftArmUnk1 = 29; - public const byte LeftArmUnk2 = 30; - public const byte LeftArmUnk3 = 31; - public const byte LeftArmUnk4 = 32; - public const byte LeftArmUnk5 = 33; - public const byte LeftArmUnk6 = 34; - public const byte LeftArmUnk7 = 35; - public const byte RightCollarbone = 36; - public const byte RightShoulder = 37; - public const byte RightElbow = 38; - public const byte RightWrist = 39; - public const byte RightWristNull = 40; - public const byte RightThumbLow = 41; - public const byte RightThumbMid = 42; - public const byte RightThumbHigh = 43; - public const byte RightIndexLow = 44; - public const byte RightIndexMid = 45; - public const byte RightIndexHigh = 46; - public const byte RightMiddleLow = 47; - public const byte RightMiddleMid = 48; - public const byte RightMiddleHigh = 49; - public const byte RightPalm = 50; - public const byte RightRingLow = 51; - public const byte RightRingMid = 52; - public const byte RightRingHigh = 53; - public const byte RightPinkyLow = 54; - public const byte RightPinkyMid = 55; - public const byte RightPinkyHigh = 56; - public const byte RightArmUnk1 = 57; - public const byte RightArmUnk2 = 58; - public const byte RightArmUnk3 = 59; - public const byte RightArmUnk4 = 60; - public const byte Unknown1 = 61; - public const byte Unknown2 = 62; - public const byte LeftHip = 63; - public const byte LeftKnee = 64; - public const byte LeftAnkle = 65; - public const byte LeftToes = 66; - public const byte LeftAnkleNull = 67; - public const byte LeftKneeNull = 68; - public const byte LeftHipNull = 69; - public const byte Unknown3 = 70; - public const byte Unknown4 = 71; - public const byte RightHip = 72; - public const byte RightKnee = 73; - public const byte RightAnkle = 74; - public const byte RightToes = 75; - public const byte RightAnkleNull = 76; - public const byte RightKneeNull = 77; - public const byte RightHipNull = 78; - public const byte Unknown5 = 79; - public const byte Unknown6 = 80; - public const byte Unknown7 = 81; - public const byte Unknown8 = 82; - public const byte Unknown9 = 83; - public const byte Unknown10 = 84; - public const byte Unknown11 = 85; + public const byte Root = 0x0; + public const byte Root2 = 0xD; + public const byte LowerBack = 0x1; + public const byte UpperBack = 0x2; + public const byte LowerNeck = 0x3; + public const byte LowerNeckNull = 0xFE; + public const byte UpperNeck = 0x4; + public const byte LeftCollarbone = 0x5; + public const byte LeftShoulderNull = 0x46; + public const byte LeftShoulder = 0x6; + public const byte LeftElbow = 0x7; + public const byte LeftWrist = 0x8; + public const byte LeftWristNull = 0x1E; + public const byte LeftThumbLow = 0x1F; + public const byte LeftThumbMid = 0x20; + public const byte LeftThumbHigh = 0x21; + public const byte LeftIndexLow = 0x22; + public const byte LeftIndexMid = 0x23; + public const byte LeftIndexHigh = 0x24; + public const byte LeftMiddleLow = 0x25; + public const byte LeftMiddleMid = 0x26; + public const byte LeftMiddleHigh = 0x27; + public const byte LeftPalm = 0x28; + public const byte LeftRingLow = 0x29; + public const byte LeftRingMid = 0x2A; + public const byte LeftRingHigh = 0x2B; + public const byte LeftPinkyLow = 0x2C; + public const byte LeftPinkyMid = 0x2D; + public const byte LeftPinkyHigh = 0x2E; + public const byte LeftArmUnk1 = 0x51; + public const byte LeftArmUnk2 = 0x65; + public const byte LeftArmUnk3 = 0x66; + public const byte LeftArmUnk4 = 0x67; + public const byte LeftArmUnk5 = 0x68; + public const byte LeftArmUnk6 = 0x47; + public const byte LeftArmUnk7 = 0x50; + public const byte RightCollarbone = 0x9; + public const byte RightShoulder = 0xA; + public const byte RightElbow = 0xB; + public const byte RightWrist = 0xC; + public const byte RightWristNull = 0x2F; + public const byte RightThumbLow = 0x30; + public const byte RightThumbMid = 0x31; + public const byte RightThumbHigh = 0x32; + public const byte RightIndexLow = 0x33; + public const byte RightIndexMid = 0x34; + public const byte RightIndexHigh = 0x35; + public const byte RightMiddleLow = 0x36; + public const byte RightMiddleMid = 0x37; + public const byte RightMiddleHigh = 0x38; + public const byte RightPalm = 0x39; + public const byte RightRingLow = 0x3A; + public const byte RightRingMid = 0x3B; + public const byte RightRingHigh = 0x3C; + public const byte RightPinkyLow = 0x3D; + public const byte RightPinkyMid = 0x3E; + public const byte RightPinkyHigh = 0x3F; + public const byte RightArmUnk1 = 0x53; + public const byte RightArmUnk2 = 0x49; + public const byte RightArmUnk3 = 0x52; + public const byte RightArmUnk4 = 0x48; + public const byte Unknown1 = 0xF7; + public const byte Unknown2 = 0xF8; + public const byte LeftHip = 0xE; + public const byte LeftKnee = 0xF; + public const byte LeftAnkle = 0x10; + public const byte LeftToes = 0x11; + public const byte LeftAnkleNull = 0x54; + public const byte LeftKneeNull = 0x4B; + public const byte LeftHipNull = 0x4A; + public const byte Unknown3 = 0x40; + public const byte Unknown4 = 0x42; + public const byte RightHip = 0x12; + public const byte RightKnee = 0x13; + public const byte RightAnkle = 0x14; + public const byte RightToes = 0x15; + public const byte RightAnkleNull = 0x55; + public const byte RightKneeNull = 0x4D; + public const byte RightHipNull = 0x4C; + public const byte Unknown5 = 0x43; + public const byte Unknown6 = 0x45; + public const byte Unknown7 = 0xF9; + public const byte Unknown8 = 0xFA; + public const byte Unknown9 = 0xFB; + public const byte Unknown10 = 0xFC; + public const byte Unknown11 = 0xFD; } private nint[] playerArmor = new nint[10]; - private nint[] playerJoints = new nint[86]; + private nint[] playerJoints = new nint[0xFF]; private delegate void UpdateJoints(nint obj); private Hook? updateJointsHook; @@ -2712,40 +2712,16 @@ namespace NewCamera } if (part == Armor.Body) { - int extraBonesOffset = 0; - int skipExtraBones = 0; for (int i = 0; i < bodyJoints.Count; i++) { jointAddr = bodyJoints[i]; if (ignoredJoints.Contains(jointAddr)) { - extraBonesOffset++; continue; } - byte treeLevel = MemoryUtil.Read(jointAddr + 0x14); - if (skipExtraBones > 0) - { - if (treeLevel != skipExtraBones) - { - extraBonesOffset++; - continue; - } - skipExtraBones = 0; - } - int adjustedIndex = i - extraBonesOffset; - if (adjustedIndex >= playerJoints.Length) - { - break; - } - if (adjustedIndex == Joint.LeftArmUnk7) - { - skipExtraBones = 4; - } - else if (adjustedIndex == Joint.Unknown2) - { - skipExtraBones = 2; - } - playerJoints[i - extraBonesOffset] = jointAddr; + byte id = MemoryUtil.Read(jointAddr + 0xA0); + Assert(playerJoints[id] == 0x0); + playerJoints[id] = jointAddr; } foreach (nint joint in bodyOffsets.Where(e => !bodyJoints.Contains(e.Key)).Select(e => e.Key).ToList()) { @@ -2846,10 +2822,9 @@ namespace NewCamera { if (i >= joints.Count) return; nint jointAddr = joints[i]; - byte treeLevel = MemoryUtil.Read(jointAddr + 0x14); - //byte id = MemoryUtil.Read(jointAddr + 0xA5); + byte id = MemoryUtil.Read(jointAddr + 0xA0); ImGui.PushID(jointAddr); - if (ImGui.CollapsingHeader($"Joint #{i} (0x{jointAddr:X}, tree_level: 0x{treeLevel:X})")) + if (ImGui.CollapsingHeader($"Joint #{i} (0x{jointAddr:X}, id: 0x{id:X})")) { drawJoint(jointAddr, offsets); } -- cgit v1.2.3-101-g0448