diff options
| author | 2026-05-19 20:34:38 -0400 | |
|---|---|---|
| committer | 2026-05-19 20:35:25 -0400 | |
| commit | ab4637241f0ae3d219643f256c5cdfd98c5c189d (patch) | |
| tree | 52d9aefa48ab4adb3abf32356c2a9a51270b9a6b | |
| parent | 2b3c28619a83e0c25332cd1e579da15fa80509c8 (diff) | |
| download | NewCamera-ab4637241f0ae3d219643f256c5cdfd98c5c189d.tar.gz NewCamera-ab4637241f0ae3d219643f256c5cdfd98c5c189d.tar.bz2 NewCamera-ab4637241f0ae3d219643f256c5cdfd98c5c189d.zip | |
Super wip joint stuff
Signed-off-by: Andrew Opalach <andrew@akon.city>
| -rwxr-xr-x | Config.cs | 2 | ||||
| -rwxr-xr-x | NewCamera.csproj | 3 | ||||
| -rwxr-xr-x | NewCamera.sln | 5 | ||||
| -rwxr-xr-x | Plugin.cs | 580 | ||||
| -rwxr-xr-x | Scripts/zip_from_gamedir.sh | 4 |
5 files changed, 426 insertions, 168 deletions
@@ -138,7 +138,7 @@ namespace NewCamera }
public bool DisableMod { get; set; } = false;
-
+ public bool TuningToolInterop { get; set; } = true;
public bool OverrideViewMode { get; set; } = false;
public Settings Camera { get; set; } = new Settings();
diff --git a/NewCamera.csproj b/NewCamera.csproj index bde04c5..25b5795 100755 --- a/NewCamera.csproj +++ b/NewCamera.csproj @@ -21,6 +21,9 @@ <Reference Include="SharpPluginLoader.InternalCallGenerator">
<HintPath>..\SharpPluginLoader-fork\SharpPluginLoader.InternalCallGenerator\bin\Release\netstandard2.0\SharpPluginLoader.InternalCallGenerator.dll</HintPath>
</Reference>
+ <Reference Include="WorldTuningTool">
+ <HintPath>..\WorldTuningTool\bin\Release\net8.0\WorldTuningTool.dll</HintPath>
+ </Reference>
</ItemGroup>
</Project>
diff --git a/NewCamera.sln b/NewCamera.sln index ba20378..a92bff1 100755 --- a/NewCamera.sln +++ b/NewCamera.sln @@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
-VisualStudioVersion = 17.12.35514.174 d17.12
+VisualStudioVersion = 17.12.35514.174
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewCamera", "NewCamera.csproj", "{E9DE1105-BC7A-4753-9181-E7DA03727E54}"
EndProject
@@ -19,4 +19,7 @@ Global GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A6DC9F7B-1C9F-4735-8A84-F54C2A9EF023}
+ EndGlobalSection
EndGlobal
@@ -20,6 +20,7 @@ using SharpPluginLoader.Core.Memory; using SharpPluginLoader.Core.Actions;
using SharpPluginLoader.Core.Components;
using SharpPluginLoader.Core.Configuration;
+using WorldTuningTool;
// Tentative List of Actions:
// - Toggle Free Camera
@@ -154,7 +155,7 @@ namespace NewCamera private bool disableMod = false;
- private dynamic? tuningTool = null;
+ private WorldTuningTool.Interop tuningTool = new WorldTuningTool.Interop();
private static readonly MtObject sMain = SingletonManager.GetSingleton("sMhMain")!;
private bool freezeGame = false;
@@ -363,6 +364,22 @@ namespace NewCamera private bool hideKnife = false;
private bool hideSlinger = false;
+ private bool attachToChest = false;
+ private bool swapChestSides = false;
+ private float chestMoveScale = 0.25f;
+ private nint chestBone1 = 0x0;
+ private nint chestBone2 = 0x0;
+
+ private bool overrideFacePose;
+ private Patch noopFacePose;
+ private Patch noopFacePoseUpdate;
+
+ private delegate void CheckJointRotation(nint entity, nint joint);
+ private Hook<CheckJointRotation>? checkJointRotationHook;
+
+ private Dictionary<nint, List<Vector3>> jointOffsets = new Dictionary<nint, List<Vector3>>();
+ private bool didJointOffset = false;
+
private delegate void ChangeEquipment(nint unknownPtr, int unknownInt);
private Hook<ChangeEquipment>? changeEquipmentHook;
private NativeFunction<nint, int, nint> newEquipmentPointer;
@@ -712,6 +729,11 @@ namespace NewCamera getSaveSlotGuiAddr = new NativeFunction<nint, nint>(0x141AC0B60);
getPlayerSettingsAddr = new NativeFunction<nint, nint>(0x141B8DBB0);
+ noopFacePose = new Patch(new IntPtr(0x14237B093), [0x90, 0x90, 0x90, 0x90, 0x90]);
+ noopFacePoseUpdate = new Patch(new IntPtr(0x14223BAAB), [0x90, 0x90, 0x90, 0x90, 0x90]);
+
+ checkJointRotationHook = Hook.Create<CheckJointRotation>(0x1422395C0, CheckJointRotationHook);
+
changeEquipmentHook = Hook.Create<ChangeEquipment>(0x141DDEF80, ChangeEquipmentHook); // nint, int
newEquipmentPointer = new NativeFunction<nint, int, nint>(0x141DE56A0);
@@ -853,7 +875,17 @@ namespace NewCamera {
setPerspectivePreset(config.Presets[config.Selected]);
}
- tuningTool = IPlugin.GetInstance("World Tuning Tool");
+ if (config.TuningToolInterop)
+ {
+ if (tuningTool.InitFromLoadedInstance())
+ {
+ Log.Info($"Successfully loaded '{WorldTuningTool.Interop.PluginName}' instance");
+ }
+ else
+ {
+ Log.Warn($"Couldn't find loaded '{WorldTuningTool.Interop.PluginName}' instance, features will be missing");
+ }
+ }
}
private void toggleUi()
@@ -970,6 +1002,34 @@ namespace NewCamera }
}
+ private void checkCameraAnimState()
+ {
+ if (pCamera != null)
+ {
+ previousCameraAnimState = MemoryUtil.Read<int>(pCamera.Instance + 0x240);
+ if (previousCameraAnimState == 5)
+ {
+ ActionInfo currentActionInfo = lastPlayer!.ActionController.CurrentAction;
+ // 1:314 = Wingdrake landing on area enter.
+ // 1:319 = Disoriented wingdrake landing next to monster.
+ if (currentActionInfo.ActionSet == 1 && (currentActionInfo.ActionId == 314 || currentActionInfo.ActionId == 319))
+ {
+ // Temporarily disable evaluation of cameraAnimState != 5.
+ ignoreAnimState = true;
+ }
+ }
+ else if (ignoreAnimState)
+ {
+ // Once cameraAnimState is no longer 5, resume default logic.
+ ignoreAnimState = false;
+ }
+ }
+ else
+ {
+ previousCameraAnimState = 0;
+ }
+ }
+
private void resetStatePerFrame()
{
primaryPad = 0x0;
@@ -979,6 +1039,8 @@ namespace NewCamera PadRx = 0; PadRy = 0;
cameraOffset = Vector3.Zero;
+
+ didJointOffset = false;
}
public void OnUpdate(float deltaTime)
@@ -1059,6 +1121,7 @@ namespace NewCamera {
player = getPlayerFromSaveSlot();
}
+
if (player != null)
{
if (hideWeapon)
@@ -1277,20 +1340,46 @@ namespace NewCamera bool lockVerticalAndModifySpeed = buttonWasDown(Button.L2) || lockVerticalToggled;
float adjustedSpeed = cameraSpeed * deltaTime * (lockVerticalAndModifySpeed ? cameraSpeedModifier : 1.0f);
+ bool lockCameraLook = false;
+
+ if (Math.Abs(PadLy) < stickDeadzone) PadLy = 0;
+ if (Math.Abs(PadLx) < stickDeadzone) PadLx = 0;
+ if (Math.Abs(PadRx) < stickDeadzone) PadRx = 0;
+ if (Math.Abs(PadRy) < stickDeadzone) PadRy = 0;
cameraFrame = Vector3.Zero;
+ Player? player = lastPlayer;
+ if (player == null)
+ {
+ player = getPlayerFromSaveSlot();
+ }
+
// PadLx/y is read in WritePadInputHook().
if (buttonWasDown(Button.L2) && buttonWasDown(Button.R2)) // Left stick zoom.
{
- if (Math.Abs(PadLy) < stickDeadzone) PadLy = 0;
- float Ly = PadLy / (Int16.MaxValue / adjustedZoomSpeed(deltaTime));
- cameraFov = Math.Clamp(cameraFov - Ly, 1.0f, 179.0f);
+ if (player != null && attachToChest && chestBone1 != 0x0 && chestBone2 != 0x0)
+ {
+ Quaternion rotation = new Quaternion(player.Rotation.X, player.Rotation.Y, player.Rotation.Z, player.Rotation.W);
+ Vector3 up = Vector3.Transform(new Vector3(0.0f, 1.0f, 0.0f), rotation);
+ Vector3 right = Vector3.Transform(new Vector3(1.0f, 0.0f, 0.0f), rotation);
+ ref Vector3 jiggle1 = ref MemoryUtil.GetRef<Vector3>((swapChestSides ? chestBone2 : chestBone1) + 0xD0);
+ ref Vector3 jiggle2 = ref MemoryUtil.GetRef<Vector3>((swapChestSides ? chestBone1 : chestBone2) + 0xD0);
+ float scale = (Int16.MaxValue / adjustedSpeed / chestMoveScale);
+ jiggle1 -= right * (PadLx / scale);
+ jiggle1 -= up * (PadLy / scale);
+ jiggle2 -= right * (PadRx / scale);
+ jiggle2 -= up * (PadRy / scale);
+ lockCameraLook = true;
+ }
+ else
+ {
+ float Ly = PadLy / (Int16.MaxValue / adjustedZoomSpeed(deltaTime));
+ cameraFov = Math.Clamp(cameraFov - Ly, 1.0f, 179.0f);
+ }
}
else if (playerMovementLocked || orbitPlayer) // Move camera.
{
- if (Math.Abs(PadLy) < stickDeadzone) PadLy = 0;
- if (Math.Abs(PadLx) < stickDeadzone) PadLx = 0;
#if MOUSE_AND_KEYBOARD_LAYER
if (keyboardEnabled)
{
@@ -1460,44 +1549,46 @@ namespace NewCamera #endif
// Camera look. PadRx/y is read in WritePadInputHook().
- if (Math.Abs(PadRx) < stickDeadzone) PadRx = 0;
- if (Math.Abs(PadRy) < stickDeadzone) PadRy = 0;
-#if MOUSE_AND_KEYBOARD_LAYER
- if (keyboardEnabled)
+ if (!lockCameraLook)
{
- if (Input.IsDown(Key.NumPad8)) PadRy += keyboardLookValue;
- if (Input.IsDown(Key.NumPad2)) PadRy -= keyboardLookValue;
- if (Input.IsDown(Key.NumPad4)) PadRx -= keyboardLookValue;
- if (Input.IsDown(Key.NumPad6)) PadRx += keyboardLookValue;
- }
+#if MOUSE_AND_KEYBOARD_LAYER
+ if (keyboardEnabled)
+ {
+ if (Input.IsDown(Key.NumPad8)) PadRy += keyboardLookValue;
+ if (Input.IsDown(Key.NumPad2)) PadRy -= keyboardLookValue;
+ if (Input.IsDown(Key.NumPad4)) PadRx -= keyboardLookValue;
+ if (Input.IsDown(Key.NumPad6)) PadRx += keyboardLookValue;
+ }
#endif
- float adjustedSensitivity = cameraSensitivity * deltaTime * cameraFov;
- float Rx = PadRx / (Int16.MaxValue / adjustedSensitivity);
- float Ry = PadRy / (Int16.MaxValue / adjustedSensitivity);
+ float adjustedSensitivity = cameraSensitivity * deltaTime * cameraFov;
+ float Rx = PadRx / (Int16.MaxValue / adjustedSensitivity);
+ float Ry = PadRy / (Int16.MaxValue / adjustedSensitivity);
#if MOUSE_AND_KEYBOARD_LAYER
- if (mouseEnabled && !playerInMenu())
- {
- Rx += MemoryUtil.GetRef<int>(sMhMouse.Instance + 0xFC) * mouseSensitivity;
- Ry -= MemoryUtil.GetRef<int>(sMhMouse.Instance + 0x100) * mouseSensitivity;
- ref int scrollY = ref MemoryUtil.GetRef<int>(sMhMouse.Instance + 0x17C);
- if (orbitPlayer)
+ if (mouseEnabled && !playerInMenu())
{
- orbitDistance -= scrollY * cameraZoomSpeed * 2.0f;
- if (orbitDistance < 0.01f)
+ Rx += MemoryUtil.GetRef<int>(sMhMouse.Instance + 0xFC) * mouseSensitivity;
+ Ry -= MemoryUtil.GetRef<int>(sMhMouse.Instance + 0x100) * mouseSensitivity;
+ ref int scrollY = ref MemoryUtil.GetRef<int>(sMhMouse.Instance + 0x17C);
+ if (orbitPlayer)
{
- orbitDistance = 0.01f;
+ orbitDistance -= scrollY * cameraZoomSpeed * 2.0f;
+ if (orbitDistance < 0.01f)
+ {
+ orbitDistance = 0.01f;
+ }
+ }
+ else
+ {
+ cameraFov = Math.Clamp(cameraFov - scrollY * cameraZoomSpeed, 1.0f, 179.0f);
}
}
- else
+#endif
+ cameraYaw += Rx;
+ if (plusRight != 0.0f)
{
- cameraFov = Math.Clamp(cameraFov - scrollY * cameraZoomSpeed, 1.0f, 179.0f);
+ cameraYaw += plusRight * deltaTime;
}
- }
-#endif
- cameraYaw += Rx;
- if (plusRight != 0.0f)
- {
- cameraYaw += plusRight * deltaTime;
+ cameraPitch += Ry;
}
if (cameraYaw >= 180.0f)
{
@@ -1509,11 +1600,10 @@ namespace NewCamera }
if (cameraPitchLimit >= 0.0f)
{
- cameraPitch = Math.Clamp(cameraPitch + Ry, -cameraPitchLimit, cameraPitchLimit);
+ cameraPitch = Math.Clamp(cameraPitch, -cameraPitchLimit, cameraPitchLimit);
}
else
{
- cameraPitch += Ry;
if (cameraPitch >= 90.0f && cameraWrapState == 0)
{
cameraRoll += 180.0f;
@@ -1546,7 +1636,6 @@ namespace NewCamera cameraRoll -= 360.0f;
}
- Player? player = Player.MainPlayer;
if (orbitPlayer && player != null)
{
Quaternion rotation = new Quaternion(player.Rotation.X, player.Rotation.Y, player.Rotation.Z, player.Rotation.W);
@@ -1578,35 +1667,6 @@ namespace NewCamera camera.FieldOfView = cameraFov;
}
- private void checkCameraAnimState()
- {
- if (pCamera != null)
- {
- previousCameraAnimState = MemoryUtil.Read<int>(pCamera.Instance + 0x240);
- if (previousCameraAnimState == 5)
- {
- Player player = Player.MainPlayer!;
- ActionInfo currentActionInfo = player.ActionController.CurrentAction;
- // 1:314 = Wingdrake landing on area enter.
- // 1:319 = Disoriented wingdrake landing next to monster.
- if (currentActionInfo.ActionSet == 1 && (currentActionInfo.ActionId == 314 || currentActionInfo.ActionId == 319))
- {
- // Temporarily disable evaluation of cameraAnimState != 5.
- ignoreAnimState = true;
- }
- }
- else if (ignoreAnimState)
- {
- // Once cameraAnimState is no longer 5, resume default logic.
- ignoreAnimState = false;
- }
- }
- else
- {
- previousCameraAnimState = 0;
- }
- }
-
private void SetCameraHook(nint cameraPointer)
{
if (disableMod)
@@ -1728,7 +1788,7 @@ namespace NewCamera setupFreeCamera(vCamera, vCameraViewportIndex);
}
}
- // No else if because we want to updateFreeCamera() if freeCamera was enabled above.
+ // No else because we want to updateFreeCamera() if freeCamera was enabled above.
if (freeCamera)
{
updateFreeCamera(vCamera);
@@ -1889,18 +1949,7 @@ namespace NewCamera private bool playerInMenu()
{
- // https://github.com/HunterPie/HunterPie/blob/fa73f81ed0cdc921a6cf63f96c0fcff3688d88c2/HunterPie.Integrations/Datasources/MonsterHunterWorld/Entity/Game/MHWGame.cs#L74
- bool inMenu = false;
- nint baseAddr = MemoryUtil.Read<nint>(0x1451C4640);
- if (baseAddr != 0x0)
- {
- baseAddr = MemoryUtil.Read<nint>(baseAddr + 0x13FD0);
- if (baseAddr != 0x0)
- {
- inMenu = MemoryUtil.Read<int>(baseAddr + 0xB734) == 1;
- }
- }
- return inMenu;
+ return MemoryUtil.GetRef<byte>(Gui.SingletonInstance.Instance + 0x147A8) == 0x1;
}
// This can undoubtedly be simplified.
@@ -2189,22 +2238,25 @@ namespace NewCamera }
}
}
-
if (!unlockInputForMenu && buttonWasPressed(Button.Triangle))
{
- nint baseAddr = MemoryUtil.Read<nint>(0x1451C4640);
- // MonsterHunterWorld.exe+1ADA26A - 48 8B 83 18400100 - mov rax,[rbx+00014018]
- nint gesturesAddr = MemoryUtil.Read<nint>(baseAddr + 0x14018);
- if (buttonWasDown(Button.Share)) // MonsterHunterWorld.exe+1EC8000
- {
- setupGestureMenu.Invoke(gesturesAddr, 0x0, 0x1); // Poses.
- }
- else // MonsterHunterWorld.exe+1EC7D10
+ Player? player = Player.MainPlayer;
+ if (player != null)
{
- setupGestureMenu.Invoke(gesturesAddr, 0x0, 0x0); // Gestures.
+ nint baseAddr = MemoryUtil.Read<nint>(0x1451C4640);
+ // MonsterHunterWorld.exe+1ADA26A - 48 8B 83 18400100 - mov rax,[rbx+00014018]
+ nint gesturesAddr = MemoryUtil.Read<nint>(baseAddr + 0x14018);
+ if (buttonWasDown(Button.Share)) // MonsterHunterWorld.exe+1EC8000
+ {
+ setupGestureMenu.Invoke(gesturesAddr, 0x0, 0x1); // Poses.
+ }
+ else // MonsterHunterWorld.exe+1EC7D10
+ {
+ setupGestureMenu.Invoke(gesturesAddr, 0x0, 0x0); // Gestures.
+ }
+ showGestureMenu.Invoke(gesturesAddr);
+ unlockInputForMenu = true;
}
- showGestureMenu.Invoke(gesturesAddr);
- unlockInputForMenu = true;
}
}
}
@@ -2252,8 +2304,8 @@ namespace NewCamera debugLog($"CollisionCheckHook({unknownPtr:X}, {unknownPtr2:X}) @ {frameTick}");
#endif
- Player? player = Player.MainPlayer;
- if (enableCrawl && player != null)
+ Player? player = null;
+ if (enableCrawl && (player = Player.MainPlayer) != null)
{
nint controlsAddr = MemoryUtil.Read<nint>(player.Instance + 0x12608);
bool combatControls = false;
@@ -2337,13 +2389,37 @@ namespace NewCamera }
Player? player = Player.MainPlayer;
- bool entityIsPlayer = player != null && entity == player.Instance;
- if (entityIsPlayer && playerOpacityOverride != 1.0f)
+ if (player == null)
+ {
+ player = getPlayerFromSaveSlot();
+ }
+ if (player != null && entity == player && playerOpacityOverride != 1.0f)
{
MemoryUtil.GetRef<float>(player.Instance + 0x78E0) = playerOpacityOverride;
}
}
+ private void CheckJointRotationHook(nint entity, nint joint)
+ {
+ if (!didJointOffset)
+ {
+ Player? player = Player.MainPlayer;
+ if (player == null)
+ {
+ player = getPlayerFromSaveSlot();
+ }
+ if (player != null && entity == player.Instance)
+ {
+ foreach ((nint addr, List<Vector3> offsets) in jointOffsets)
+ {
+ MemoryUtil.GetRef<Quaternion>(addr + 0x70) *= Quaternion.CreateFromYawPitchRoll(offsets[0].X, offsets[0].Y, offsets[0].Z);
+ }
+ didJointOffset = true;
+ }
+ }
+ checkJointRotationHook!.Original(entity, joint);
+ }
+
private void ChangeEquipmentHook(nint unknownPtr, int unknownInt)
{
nint rax = MemoryUtil.Read<nint>(unknownPtr + 0x2968);
@@ -2837,6 +2913,186 @@ namespace NewCamera }
}
+ void drawArmorParts(nint baseAddr, nint addr)
+ {
+ ImGui.PushID(addr);
+ string fullString = Marshal.PtrToStringAnsi(addr + 0xC)!;
+ string partName = "";
+ if (fullString.StartsWith("pl\\f_equip"))
+ {
+ partName = fullString.Split('\\')[3];
+ }
+ else if (fullString.StartsWith("pl\\hair"))
+ {
+ partName = fullString.Split('\\')[1];
+ }
+ else if (fullString.StartsWith("pl\\f_face"))
+ {
+ partName = fullString.Split('\\')[2];
+ }
+ else if (fullString.StartsWith("wp\\slg"))
+ {
+ partName = "slinger";
+ }
+ else if (fullString.StartsWith("accessory\\acc"))
+ {
+ partName = fullString.Split('\\')[1];
+ }
+ else if (fullString.StartsWith("npc\\npc"))
+ {
+ partName = "npc";
+ }
+ if (partName == "body")
+ {
+ chestBone1 = 0x0;
+ chestBone2 = 0x0;
+ }
+ ImGui.Text($"{partName} ({fullString} @ {addr:X}):");
+ int parts = MemoryUtil.Read<int>(addr + 0x54C);
+ nint baseInner = MemoryUtil.Read<nint>(addr + 0xC8);
+ nint offset = MemoryUtil.Read<nint>(addr + 0x408);
+ bool toggleAll = ImGui.Button("Toggle All");
+ for (int i = 0; i < parts; i++)
+ {
+ nint baseOffset = offset + (i * 0x4) + (parts * 0x4);
+ ref byte bIndex = ref MemoryUtil.GetRef<byte>(baseOffset);
+ baseOffset = baseInner + ((bIndex + (bIndex * 4)) << 4);
+ ref byte bEnabled = ref MemoryUtil.GetRef<byte>(baseOffset);
+ ref byte bSub = ref MemoryUtil.GetRef<byte>(baseOffset + 0xB);
+ if (toggleAll)
+ {
+ (bEnabled, bSub) = (bSub, bEnabled);
+ }
+ bool isVisible = bEnabled != 0x0;
+ if (ImGui.Checkbox($"##Part #{i}", ref isVisible))
+ {
+ (bEnabled, bSub) = (bSub, bEnabled);
+ }
+ if (ImGui.BeginItemTooltip())
+ {
+ ImGui.Text($"Part #{i}");
+ ImGui.EndTooltip();
+ }
+ if (i % 8 != 7 && i != parts - 1)
+ {
+ ImGui.SameLine();
+ }
+ }
+ if (ImGui.CollapsingHeader("Joints"))
+ {
+ if (partName == "body")
+ {
+ ImGui.Checkbox("Attach to Chest", ref attachToChest);
+ ImGui.Checkbox("Swap Sides", ref swapChestSides);
+ ImGui.DragFloat("Scale", ref chestMoveScale);
+ }
+ else if (partName == "face000")
+ {
+ if (ImGui.Checkbox("Override Pose", ref overrideFacePose))
+ {
+ if (overrideFacePose)
+ {
+ noopFacePose.Enable();
+ noopFacePoseUpdate.Enable();
+ }
+ else
+ {
+ noopFacePose.Disable();
+ noopFacePoseUpdate.Disable();
+ }
+ }
+ }
+ int jointCount = MemoryUtil.Read<int>(baseAddr + 0x4A0);
+ nint jointsAddr = MemoryUtil.Read<nint>(baseAddr + 0x4A8);
+ ImGui.Text($"Count: {jointCount}");
+ List<nint> seenJiggleBones = new List<nint>();
+ for (int i = 0; i < jointCount; i++)
+ {
+ ImGui.PushID(i);
+ if (ImGui.CollapsingHeader($"Joint #{i} ({jointsAddr:X})"))
+ {
+ ImGui.DragFloat4("Rotation", ref MemoryUtil.GetRef<Vector4>(jointsAddr + 0x70), 0.005f);
+ if (partName != "face000")
+ {
+ if (!jointOffsets.ContainsKey(jointsAddr))
+ {
+ jointOffsets.Add(jointsAddr, new List<Vector3>()
+ {
+ new Vector3()
+ });
+ }
+ Vector3 v = jointOffsets[jointsAddr][0];
+ ImGui.DragFloat3($"Rotation Offset", ref v, 0.005f);
+ jointOffsets[jointsAddr][0] = v;
+ }
+ }
+ /*
+ // MonsterHunterWorld.exe+223B9C3 - test byte ptr [rbx+000000A8],20
+ if (MemoryUtil.Read<byte>(jointsAddr + 0xA8) == 0x20)
+ {
+ jointsAddr += 0xC0;
+ continue;
+ }
+ */
+ nint childAddr = MemoryUtil.Read<nint>(jointsAddr + 0x8);
+ if (childAddr != 0x0 && MemoryUtil.Read<nint>(childAddr) == 0x142F21A90)
+ {
+ childAddr = MemoryUtil.Read<nint>(childAddr + 0x8);
+ if (childAddr != 0x0 && MemoryUtil.Read<nint>(childAddr) == 0x143524BD8)
+ {
+ childAddr = MemoryUtil.Read<nint>(childAddr + 0x188);
+ if (childAddr != 0x0)
+ {
+ nint childVtable = MemoryUtil.Read<nint>(childAddr);
+ if (childVtable == 0x143519530)
+ {
+ nint jiggleData = MemoryUtil.Read<nint>(MemoryUtil.Read<nint>(childAddr + 0xA0));
+ if (!seenJiggleBones.Contains(jiggleData) && MemoryUtil.Read<nint>(jiggleData) == 0x143519508)
+ {
+ seenJiggleBones.Add(jiggleData);
+ if (partName == "body")
+ {
+ if (chestBone1 == 0x0)
+ {
+ chestBone1 = jiggleData;
+ }
+ else
+ {
+ if (chestBone2 != 0x0)
+ {
+ chestBone2 = chestBone1;
+ chestBone1 = jiggleData;
+ }
+ else
+ {
+ chestBone2 = jiggleData;
+ }
+ }
+ }
+ if (ImGui.CollapsingHeader($"Jiggle Bones ({jiggleData:X})"))
+ {
+ ImGui.DragFloat4("Position", ref MemoryUtil.GetRef<Vector4>(jiggleData + 0xD0));
+ }
+ }
+ }
+ /*
+ else
+ {
+ if (ImGui.CollapsingHeader($"Unknown Child {childAddr:X}"))
+ {
+ }
+ }
+ */
+ }
+ }
+ }
+ ImGui.PopID();
+ jointsAddr += 0xC0;
+ }
+ }
+ ImGui.PopID();
+ }
+
private void drawPlayerInfo(Player player, float width)
{
nint playerSettings = getPlayerSettings();
@@ -2856,6 +3112,7 @@ namespace NewCamera ImGui.Text($"Slinger: {MemoryUtil.Read<int>(player.Instance + 0x13D8C):X}_{MemoryUtil.Read<int>(player.Instance + 0x13D90):X}");
ImGui.Text($"Last Equipped: {lastEquipedId:X}");
+ //MemoryUtil.GetRef<byte>(next + 0x2D0) = hideKnife ? (byte)0xFD : (byte)0xFF;
ref byte showHeadArmor = ref MemoryUtil.GetRef<byte>(playerSettings + 0x1403E1);
int showHeadArmorInt = showHeadArmor;
if (ImGui.RadioButton("Show", ref showHeadArmorInt, 0))
@@ -2875,16 +3132,51 @@ namespace NewCamera if (ImGui.CollapsingHeader("Armor Parts"))
{
- /*
+ nint bodyArmor = MemoryUtil.Read<nint>(player.Instance + 0x2A0);
+ if (bodyArmor != 0x0)
+ {
+ drawArmorParts(player.Instance, bodyArmor);
+ }
+ // MonsterHunterWorld.exe+203E8A2 - mov rax,[rbx+000126C8]
+ nint combineArmorList = MemoryUtil.Read<nint>(player.Instance + 0x126C8);
+ if (combineArmorList != 0x0)
+ {
+ combineArmorList = MemoryUtil.Read<nint>(combineArmorList + 0x70);
+ }
+ nint next = combineArmorList;
+ while (next != 0x0)
{
- nint combineArmorList = MemoryUtil.Read<nint>(player.Instance + 0x7690);
- nint next = MemoryUtil.Read<nint>(combineArmorList + 0x20);
- while (next != 0x0)
+ ImGui.PushID(next);
+ nint vtable = MemoryUtil.Read<nint>(next);
+ if ((vtable == 0x1434A7560) // uPlCombineArmor
+ //(vtable == 0x1434D2400) || // uWeaponParts
+ //(vtable == 0x1434D1D58) // uWeaponEmblem
+ )
{
- next = MemoryUtil.Read<nint>(next + 0x20);
+ ImGui.Separator();
+ nint partAddr = MemoryUtil.Read<nint>(next + 0x2A0);
+ if (partAddr != 0x0)
+ {
+ drawArmorParts(next, partAddr);
+ }
+ nint childAddr = MemoryUtil.Read<nint>(next + 0x548);
+ if (childAddr != 0x0)
+ {
+ nint childVtable = MemoryUtil.Read<nint>(childAddr);
+ if (childVtable == 0x143451520)
+ {
+ partAddr = MemoryUtil.Read<nint>(childAddr + 0x2A0);
+ if (partAddr != 0x0)
+ {
+ drawArmorParts(childAddr, partAddr);
+ }
+ }
+ }
}
+ ImGui.PopID();
+ next = MemoryUtil.Read<nint>(next + 0x30);
}
- */
+ /*
nint bodyArmor = MemoryUtil.Read<nint>(player.Instance + 0x2A0);
if (bodyArmor != 0x0)
{
@@ -2894,68 +3186,11 @@ namespace NewCamera for (;next != 0x0;)
{
ImGui.PushID(next);
- nint vtable = MemoryUtil.Read<nint>(next + 0x40);
- // Player + 0x1373C = armor, Player + 0x13D8C = slinger
+ nint partAddr = next + 0x40;
+ nint vtable = MemoryUtil.Read<nint>(partAddr);
if (vtable == 0x143507A18)
{
- string partName = "";
- bool armorPart = false;
- string fullString = Marshal.PtrToStringAnsi(next + 0x4C)!;
- if (fullString.StartsWith("pl\\f_equip"))
- {
- partName = fullString.Split('\\')[3];
- armorPart = true;
- }
- else if (fullString.StartsWith("wp\\slg"))
- {
- partName = "slinger";
- armorPart = true;
- }
- else if (fullString.StartsWith("accessory\\acc"))
- {
- partName = fullString.Split('\\')[1];
- armorPart = true;
- }
- else if (fullString.StartsWith("npc\\npc"))
- {
- partName = "npc";
- armorPart = true;
- }
- if (armorPart)
- {
- ImGui.Text($"{partName} ({fullString} @ {next:X}):");
- bool toggleAll = ImGui.Button("Toggle All");
- int parts = MemoryUtil.Read<int>(next + 0x58C);
- nint baseInner = MemoryUtil.Read<nint>(next + 0x108);
- nint offset = MemoryUtil.Read<nint>(next + 0x448);
- for (int i = 0; i < parts; i++)
- {
- nint baseOffset = offset + (i * 0x4) + (parts * 0x4);
- ref byte bIndex = ref MemoryUtil.GetRef<byte>(baseOffset);
- baseOffset = baseInner + ((bIndex + (bIndex * 4)) << 4);
- ref byte bEnabled = ref MemoryUtil.GetRef<byte>(baseOffset);
- ref byte bSub = ref MemoryUtil.GetRef<byte>(baseOffset + 0xB);
- if (toggleAll)
- {
- (bEnabled, bSub) = (bSub, bEnabled);
- }
- bool isVisible = bEnabled != 0x0;
- if (ImGui.Checkbox($"##Part #{i}", ref isVisible))
- {
- (bEnabled, bSub) = (bSub, bEnabled);
- }
- if (ImGui.BeginItemTooltip())
- {
- ImGui.Text($"Part #{i}");
- ImGui.EndTooltip();
- }
- if (i % 8 != 7 && i != parts - 1)
- {
- ImGui.SameLine();
- }
- }
- ImGui.Separator();
- }
+ drawArmorParts(partAddr);
}
ImGui.PopID();
if (head == prev)
@@ -2973,6 +3208,7 @@ namespace NewCamera }
}
}
+ */
}
nint controlsAddr = MemoryUtil.Read<nint>(player.Instance + 0x12608);
@@ -3602,21 +3838,37 @@ namespace NewCamera ImGui.Text("The scoutfly marker on menus will still be visible.");
ImGui.EndTooltip();
}
+ ImGui.SameLine();
if (!freeCamera || freeCameraFallback)
{
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
}
- ImGui.SameLine();
ImGui.Checkbox("Unlock Input", ref unlockInputToggled);
ImGui.Checkbox("Unlock Player Movement", ref unlockMovementToggled);
ImGui.Checkbox("Lock Vertical Movement and Apply Speed Modifier", ref lockVerticalToggled);
+ if (!freeCamera || freeCameraFallback)
+ {
+ ImGui.PopStyleVar();
+ }
+ if (!freeCamera)
+ {
+ ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
+ }
ImGui.Checkbox("Orbit Player", ref orbitPlayer);
if (ImGui.BeginItemTooltip())
{
ImGui.Text("Use left stick up/down to move the camera forward/back and d-pad up/down to set the Y target.");
ImGui.EndTooltip();
}
+ if (!freeCamera)
+ {
+ ImGui.PopStyleVar();
+ }
ImGui.SameLine();
+ if (!freeCamera || freeCameraFallback)
+ {
+ ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);
+ }
ImGui.Checkbox("Ignore Camera Direction", ref orbitIgnoreCamera);
if (ImGui.BeginItemTooltip())
{
diff --git a/Scripts/zip_from_gamedir.sh b/Scripts/zip_from_gamedir.sh index ca37151..1eb943a 100755 --- a/Scripts/zip_from_gamedir.sh +++ b/Scripts/zip_from_gamedir.sh @@ -1,7 +1,7 @@ #! /usr/bin/env sh 7z a -tzip "NewCamera_$1_incl_spl_linux.zip" \ - msvcrt.dll \ + ucrtbase.dll \ nativePC/plugins/CSharp/Loader/Default.bin \ nativePC/plugins/CSharp/Loader/SharpPluginLoader.Bootstrapper.dll \ nativePC/plugins/CSharp/Loader/SharpPluginLoader.Core.dll \ @@ -13,7 +13,7 @@ nativePC/plugins/CSharp/Shaders/face.shdr \ nativePC/plugins/CSharp/Shaders/fxaa_max_quality.hlsl \ nativePC/plugins/CSharp/Shaders/sslr.shdr \ - nativePC/plugins/CSharp/Shaders/volume_upsample.shdr \ + nativePC/plugins/CSharp/Shaders/volume_upsample1.shdr \ nativePC/plugins/CSharp/Shaders/volume_upsample2.shdr \ nativePC/plugins/CSharp/WorldTuningTool.dll \ nativePC/plugins/CSharp/WorldTuningTool.json |