diff options
| author | 2026-02-08 22:34:50 -0500 | |
|---|---|---|
| committer | 2026-02-08 22:34:50 -0500 | |
| commit | 3606d4b9b217a4c600b38898f07dcc01938a7203 (patch) | |
| tree | 66b9cadfde92505dfff9c4adec9848066685fee7 | |
| parent | ae2b2cd782a69010a0241db7b0084b5d171fd4ad (diff) | |
| download | NewCamera-3606d4b9b217a4c600b38898f07dcc01938a7203.tar.gz NewCamera-3606d4b9b217a4c600b38898f07dcc01938a7203.tar.bz2 NewCamera-3606d4b9b217a4c600b38898f07dcc01938a7203.zip | |
Mouse support, lots of WIP stuff
Signed-off-by: Andrew Opalach <andrew@akon.city>
| -rwxr-xr-x | Config.cs | 2 | ||||
| -rwxr-xr-x | Plugin.cs | 316 |
2 files changed, 234 insertions, 84 deletions
@@ -8,7 +8,7 @@ namespace MHWNewCamera internal class Config : IConfig
{
public String Name => "MHWNewCamera";
- public String Version => "4.1";
+ public String Version => "4.0";
public struct Settings
{
@@ -1,7 +1,7 @@ //#define ADDR_ASSERTS
//#define HOOK_ORDER_ASSERTS
//#define LOG_DEBUG_MESSAGES
-#define SIMPLE_KEYBOARD_LAYER
+#define MOUSE_AND_KEYBOARD_LAYER
//#define QUARANTINED_FEATURES
using ImGuiNET;
@@ -45,6 +45,7 @@ using SharpPluginLoader.Core.Configuration; // - Open Poses Menu
// @TODO:
+// - Centralize all bindings to get a better idea of how to structure custom binds.
// - Use GetRef<>.
// - Hide Hunter's Knife/Slinger.
// - General "A/B Graphical Settings" function.
@@ -63,7 +64,7 @@ using SharpPluginLoader.Core.Configuration; // - Adjust SSAO in cutscenes.
// - Read LOD bias setting from in-game setting (Low, Medium or High).
// - Make left stick input a curve like Wilds.
-// - Deadzone? MonsterHunterWorld.exe+5831DB - 0F2F 0D 5692AB04 - comiss xmm1,[MonsterHunterWorld.exe+503C438]
+// - Deadzone? MonsterHunterWorld.exe+5831DB - comiss xmm1,[MonsterHunterWorld.exe+503C438]
// - Ability to lock camera to a the player/a joint.
// - Simplify and document input handling/blocking logic.
// - Find a way to block other inputs while button1 is down (and blocked).
@@ -79,6 +80,11 @@ using SharpPluginLoader.Core.Configuration; // - Option to override in-game viewmode.
// Known Issues:
+// - Broken shadow areas:
+// - Exit of central camp in Horfrost Reach.
+// - Sporepuff area in The Ancient Forest.
+// - Wildspire Waste entrence to enclosed area past the waterfall.
+// - The Rotten Vale jump out of camp (fill out camp name).
// - Camera pitch wrap around while in the tent will sometimes flicker at the point of wrapping.
// - Likely due to the unpredictable position of SetCameraTentHook() in the chain of hooks. Updating
// free camera state within SetCameraTentHook() is not a solution because it comes out laggy.
@@ -172,7 +178,7 @@ namespace MHWNewCamera public bool gBufferJitter; // +0xB440
};
- public enum ZoneState : byte {
+ public enum ZoneState : int {
Unknown = 0,
Hub = 1,
Combat = 2
@@ -230,10 +236,11 @@ namespace MHWNewCamera private bool unlockMovementPause = false;
private bool playerMovementLocked => !(unlockMovementHeld || unlockMovementToggled) || unlockMovementPause;
private bool lockVerticalToggled = false;
+
private bool orbitPlayer = false;
private bool orbitIgnoreCamera = false;
private float orbitMovementRotation = 0.0f;
- private float orbitForward = 350.0f;
+ private float orbitDistance = 350.0f;
private float orbitY = 150.0f;
private bool enableOffsetPerspective = false;
@@ -250,13 +257,6 @@ namespace MHWNewCamera private Button[]? freeCameraCombo = null;
private bool disableComboButton1 = false;
private bool comboButton1Down = false;
-#if SIMPLE_KEYBOARD_LAYER
- private bool keyboardEnabled = false;
- private int keyboardLookValue;
-#endif
-
- private static readonly MtObject sMhMouse = SingletonManager.GetSingleton("sMhMouse")!;
- private static readonly MtObject sMhKeyboard = SingletonManager.GetSingleton("sMhKeyboard")!;
private static readonly MtObject sMhSteamController = SingletonManager.GetSingleton("sMhSteamController")!;
private nint controllerAddr() => sMhSteamController.Instance;
@@ -283,6 +283,15 @@ namespace MHWNewCamera return (lastPadDown & (uint)button) != (uint)button && (prevPadDown & (uint)button) == (uint)button;
}
+#if MOUSE_AND_KEYBOARD_LAYER
+ private static readonly MtObject sMhMouse = SingletonManager.GetSingleton("sMhMouse")!;
+ private static readonly MtObject sMhKeyboard = SingletonManager.GetSingleton("sMhKeyboard")!;
+ private bool keyboardEnabled = false;
+ private int keyboardLookValue;
+ private bool mouseEnabled = true;
+ private float mouseSensitivity = 0.0225f;
+#endif
+
private float plusRight = 0.0f;
private float plusForward = 0.0f;
@@ -571,9 +580,20 @@ namespace MHWNewCamera private Patch jmpOverHotSpringsSteam;
#if QUARANTINED_FEATURES
- private NativeAction<nint, int> setPassiveMode;
+ private ZoneState forceZoneState = ZoneState.Unknown;
+ private ZoneState lastZoneState = ZoneState.Unknown;
+ private NativeAction<nint, int> setZoneState;
private NativeAction<nint> setPlayerController1;
- private NativeAction<nint> setPlayerController2;
+ private NativeAction<nint> setPlayerController5;
+ private delegate void ZoneStateDelegate(nint player, int flags);
+ private Hook<ZoneStateDelegate>? setZoneStateHook;
+ private bool zoneStateManualInvoke = false;
+ private bool forcePassiveInCombatZone = false;
+ private Patch zoneStateForcePassive1;
+ private Patch zoneStateForcePassive2;
+ private bool forceCombatInPassiveZone = false;
+ private Patch zoneStateForceCombat1;
+ private Patch zoneStateForceCombat2;
#endif
private bool enableCrawl = false;
@@ -581,6 +601,10 @@ namespace MHWNewCamera private nint psuedoObject1;
private nint psuedoObject2;
+ private float playerOpacityOverride = 1.0f;
+ private delegate void EntityParamsDelegate(nint entity, nint unknownPtr2);
+ private Hook<EntityParamsDelegate>? refreshEntityParams;
+
private bool applyCharacterWetness = false;
private Patch noopCharacterWetnessUpdate;
private float wholeBodyWetness = 0.0f;
@@ -600,6 +624,7 @@ namespace MHWNewCamera private void debugLog(string message)
{
+ Log.Info(message);
#if LOG_DEBUG_MESSAGES
Log.Debug(message);
#endif
@@ -618,7 +643,7 @@ namespace MHWNewCamera freeCameraCombo = Config.ParseCombo(binds.FreeCameraCombo);
typedCombo = binds.FreeCameraCombo.Replace(",", "+");
disableComboButton1 = binds.DisableComboButton1UnlessButton2Held;
-#if SIMPLE_KEYBOARD_LAYER
+#if MOUSE_AND_KEYBOARD_LAYER
keyboardEnabled = binds.EnableKeyboard;
keyboardLookValue = binds.KeyboardLookSensitivity;
#endif
@@ -664,9 +689,18 @@ namespace MHWNewCamera Config config = loadConfig();
#if QUARANTINED_FEATURES
- setPassiveMode = new NativeAction<nint, int>(0x142035020);
+ // MonsterHunterWorld.exe+20354F7 - call MonsterHunterWorld.exe+1F73850
+ setZoneState = new NativeAction<nint, int>(0x142035020);
setPlayerController1 = new NativeAction<nint>(0x141F73850);
- setPlayerController2 = new NativeAction<nint>(0x14118DDC0);
+ setPlayerController5 = new NativeAction<nint>(0x14118DDC0);
+ setZoneStateHook = Hook.Create<ZoneStateDelegate>(0x142035020, SetZoneStateHook); // nint, int
+ unchecked
+ {
+ zoneStateForcePassive1 = new Patch((nint)0x140256A3F + 0x6, [0x1]);
+ zoneStateForcePassive2 = new Patch((nint)0x141AC2865 + 0x6, [0x1]);
+ zoneStateForceCombat1 = new Patch((nint)0x141AC2938 + 0x6, [0x0]);
+ zoneStateForceCombat2 = new Patch((nint)0x141AC28EC + 0x6, [0x0]);
+ }
#endif
procEnvironmentCollision = new NativeAction<nint, nint>(0x141F737D0);
@@ -693,18 +727,18 @@ namespace MHWNewCamera #endif
calculateCameraHook = Hook.Create<ProcessCameraDelegate>(addr, CalculateCameraHook);
- checkCameraHook = Hook.Create<ProcessCameraDelegate>(0x141FA2130, CheckCameraHook);
+ checkCameraHook = Hook.Create<ProcessCameraDelegate>(0x141FA2130, CheckCameraHook); // nint
- startViewModeHook = Hook.Create<ViewModeDelegate>(0x1405842E0, StartViewModeHook);
+ startViewModeHook = Hook.Create<ViewModeDelegate>(0x1405842E0, StartViewModeHook); // nint
setupGestureMenu = new NativeAction<nint, nint, nint>(0x141E12AF0);
showGestureMenu = new NativeAction<nint>(0x141FB79B0);
/*
unchecked
{
// @TODO: View mode collision check here
- // MonsterHunterWorld.exe+23268DF - E8 2C020000 - call MonsterHunterWorld.exe+2326B10
+ // MonsterHunterWorld.exe+23268DF - call MonsterHunterWorld.exe+2326B10
// can be overridden by the player collision function here
- // MonsterHunterWorld.exe+23268DF - E8 0C010000 - call MonsterHunterWorld.exe+23269F0
+ // MonsterHunterWorld.exe+23268DF - call MonsterHunterWorld.exe+23269F0
// to evaluate differences.
// Other TODOs for View Mode interop.
// - Don't colide with water.
@@ -755,7 +789,7 @@ namespace MHWNewCamera /*
addr = PatternScanner.FindFirst(Pattern.FromString("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 54 41 56 41 57 48 81 EC 90 00 00 00 ?? ?? ?? ?? ?? ?? ?? 48 8B F9"));
#if ADDR_ASSERTS
- Trace.Assert(addr == 0x14228eb60);
+ Trace.Assert(addr == 0X14228EB60); // nint
#endif
calculateViewHook = Hook.Create<CalculateViewDelegate>(addr, CalculateViewHook);
*/
@@ -781,13 +815,13 @@ namespace MHWNewCamera #endif
checkMovementHook = Hook.Create<CheckMovementDelegate>(addr, CheckMovementHook);
- collisionCheckHook = Hook.Create<CollisionCheckDelegate>(0x1411C4E50, CollisionCheckHook);
+ collisionCheckHook = Hook.Create<CollisionCheckDelegate>(0x1411C4E50, CollisionCheckHook); // nint, nint
- motionBlurHook = Hook.Create<MotionBlurDelegate>(0x1424CADF0, MotionBlurHook);
+ motionBlurHook = Hook.Create<MotionBlurDelegate>(0x1424CADF0, MotionBlurHook); // nint, nint
- cameraEffectHook = Hook.Create<CameraEffectDelegate>(0x141AB6AE0, CameraEffectHook);
+ cameraEffectHook = Hook.Create<CameraEffectDelegate>(0x141AB6AE0, CameraEffectHook); // nint, nint, nint
- fxaaHook = Hook.Create<FXAADelegate>(0x1423939D0, FXAAHook);
+ fxaaHook = Hook.Create<FXAADelegate>(0x1423939D0, FXAAHook); // nint, nint
unchecked
{
@@ -869,8 +903,8 @@ namespace MHWNewCamera // The game will crash when trying to switch to the FULL_RES path for SSR. It's likley because
// it tries to access resources (shader, buffer, texture, etc.) that are not loaded.
- // Ex: MonsterHunterWorld.exe+228C4A7 - 48 8B BF 20010000 - mov rdi,[rdi+00000120] # Attempted read.
- // MonsterHunterWorld.exe+259329B - 48 8D 8F 20010000 - lea rcx,[rdi+00000120] # Zero.
+ // Ex: MonsterHunterWorld.exe+228C4A7 - mov rdi,[rdi+00000120] # Attempted read.
+ // MonsterHunterWorld.exe+259329B - lea rcx,[rdi+00000120] # Zero.
// The code that zero's these addresses looks like a shell of where they would be loaded. So my assumption
// is that it's compiled out and that this method of increasing the SSR resolution will not work.
// Though, it may still be possible by finagling the parameters of the half res case.
@@ -950,7 +984,7 @@ namespace MHWNewCamera underwaterCamera3 = new Patch((nint)0x141FA5A7E, [0x90, 0x90]); // Nop check.
underwaterCamera4 = new Patch((nint)0x141FA5BA0, [0x40, 0x84, 0xF6, 0x90, 0x74]); // jae -> je.
underwaterCamera5 = new Patch((nint)0x141FA5A74, [0x0F, 0x57, 0xF6, 0x31, 0xD2, 0x48, 0x8D, 0x4D, 0x80, 0xE8, 0x9E, 0x41, 0x38, 0xFE, 0xC1, 0xE8, 0x14, 0x66, 0x25, 0xD8, 0x03, 0xFF, 0xC8, 0x66, 0x3D, 0x48, 0x00, 0x77]);
- underwaterCheckHook = Hook.Create<UnderwaterCheckDelegate>(0x1412AD500, UnderwaterCheckHook);
+ underwaterCheckHook = Hook.Create<UnderwaterCheckDelegate>(0x1412AD500, UnderwaterCheckHook); // nint
zeroVolumetricDownsample = new Patch((nint)0x1424D09B2, [0x31, 0xDB, 0x90, 0x90, 0x90, 0x90, 0x90]);
/*
@@ -967,6 +1001,8 @@ namespace MHWNewCamera jmpOverHotSpringsSteam = new Patch((nint)0x14203A494, [0xE9, 0x8D, 0x00, 0x00, 0x00, 0x90]);
+ refreshEntityParams = Hook.Create<EntityParamsDelegate>(0x141F605F0, RefreshEntityParamsHook); // nint, nint
+
noopCharacterWetnessUpdate = new Patch((nint)0x14203E893, [0x90, 0x90, 0x90, 0x90, 0x90]);
// Noop collision checks.
@@ -1102,7 +1138,7 @@ namespace MHWNewCamera {
restoreFov = cameraFov;
}
- orbitForward += cameraForward - preset.Forward;
+ orbitDistance += cameraForward - preset.Forward;
cameraForward = preset.Forward;
cameraRight = preset.Right;
cameraXOffset = 0.0f;
@@ -1156,7 +1192,7 @@ namespace MHWNewCamera debugLog($"OnUpdate() @ {frameTick}");
#endif
-#if SIMPLE_KEYBOARD_LAYER
+#if MOUSE_AND_KEYBOARD_LAYER
if (keyboardEnabled)
{
if (Input.IsPressed(Key.NumPad0))
@@ -1444,7 +1480,7 @@ namespace MHWNewCamera {
if (Math.Abs(PadLy) < stickDeadzone) PadLy = 0;
if (Math.Abs(PadLx) < stickDeadzone) PadLx = 0;
-#if SIMPLE_KEYBOARD_LAYER
+#if MOUSE_AND_KEYBOARD_LAYER
if (keyboardEnabled)
{
if (Input.IsDown(Key.Up)) PadLy += Int16.MaxValue;
@@ -1460,10 +1496,10 @@ namespace MHWNewCamera {
if (playerMovementLocked)
{
- orbitForward -= Ly;
- if (orbitForward < 0.01f)
+ orbitDistance -= Ly;
+ if (orbitDistance < 0.01f)
{
- orbitForward = 0.01f;
+ orbitDistance = 0.01f;
}
}
orbitMovementRotation += Lx / 5.0f;
@@ -1539,25 +1575,11 @@ namespace MHWNewCamera {
if (buttonWasDown(Button.Up))
{
- if (orbitPlayer)
- {
- orbitY += adjustedSpeed / 2.0f;
- }
- else
- {
- cameraFrame.Y += adjustedSpeed / 2.0f;
- }
+ cameraFrame.Y += adjustedSpeed / 2.0f;
}
if (buttonWasDown(Button.Down))
{
- if (orbitPlayer)
- {
- orbitY -= adjustedSpeed / 2.0f;
- }
- else
- {
- cameraFrame.Y -= adjustedSpeed / 2.0f;
- }
+ cameraFrame.Y -= adjustedSpeed / 2.0f;
}
if (buttonWasDown(Button.Left))
{
@@ -1570,7 +1592,7 @@ namespace MHWNewCamera }
}
-#if SIMPLE_KEYBOARD_LAYER
+#if MOUSE_AND_KEYBOARD_LAYER
if (keyboardEnabled)
{
if (Input.IsDown(Key.NumPadMinus))
@@ -1581,6 +1603,17 @@ namespace MHWNewCamera {
cameraFov = Math.Clamp(cameraFov + adjustedZoomSpeed(deltaTime), 1.0f, 179.0f);
}
+ if (Input.IsPressed(Key.NumPadEnter))
+ {
+ if (restoreFov != null)
+ {
+ cameraFov = Math.Clamp((float)restoreFov * (previousFov / DEFAULT_FOV), 1.0f, 179.0f);
+ }
+ else
+ {
+ cameraFov = DEFAULT_FOV;
+ }
+ }
if (Input.IsPressed(Key.NumPadStar))
{
cameraRoll = (restoreRoll != null) ? (float)restoreRoll : 0.0f;
@@ -1607,7 +1640,7 @@ namespace MHWNewCamera // Camera look. PadRx/y is read in WritePadInputHook().
if (Math.Abs(PadRx) < stickDeadzone) PadRx = 0;
if (Math.Abs(PadRy) < stickDeadzone) PadRy = 0;
-#if SIMPLE_KEYBOARD_LAYER
+#if MOUSE_AND_KEYBOARD_LAYER
if (keyboardEnabled)
{
if (Input.IsDown(Key.NumPad8)) PadRy += keyboardLookValue;
@@ -1619,6 +1652,15 @@ namespace MHWNewCamera 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);
+ cameraFov = Math.Clamp(cameraFov - scrollY * cameraZoomSpeed, 1.0f, 179.0f);
+ }
+#endif
cameraYaw += Rx;
if (plusRight != 0.0f)
{
@@ -1677,11 +1719,12 @@ namespace MHWNewCamera Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
Quaternion rotation = new Quaternion(player.Rotation.X, player.Rotation.Y, player.Rotation.Z, player.Rotation.W);
up = Vector3.Transform(up, rotation);
+ orbitY += cameraFrame.Y;
cameraTarget = player.Position;
cameraTarget.X += orbitY * up.X;
cameraTarget.Y += orbitY * up.Y;
cameraTarget.Z += orbitY * up.Z;
- float dist = orbitForward;
+ float dist = orbitDistance;
cameraPosition.X = cameraTarget.X - dist * MathF.Cos(Single.DegreesToRadians(cameraPitch)) * MathF.Cos(Single.DegreesToRadians(cameraYaw));
cameraPosition.Y = cameraTarget.Y - dist * MathF.Sin(Single.DegreesToRadians(cameraPitch));
cameraPosition.Z = cameraTarget.Z - dist * MathF.Cos(Single.DegreesToRadians(cameraPitch)) * MathF.Sin(Single.DegreesToRadians(cameraYaw));
@@ -2240,10 +2283,9 @@ namespace MHWNewCamera }
}
- /*
- // https://github.com/HunterPie/HunterPie/blob/fa73f81ed0cdc921a6cf63f96c0fcff3688d88c2/HunterPie.Integrations/Datasources/MonsterHunterWorld/Entity/Game/MHWGame.cs#L74
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)
@@ -2256,7 +2298,6 @@ namespace MHWNewCamera }
return inMenu;
}
- */
// This can undoubtedly be simplified.
private void WritePadInputHook(nint unknownPtr, nint unknownPtr2, nint unknownPtr3)
@@ -2714,6 +2755,46 @@ namespace MHWNewCamera collisionCheckHook!.Original(unknownPtr, unknownPtr2);
}
+ private void SetZoneStateHook(nint player, int flags)
+ {
+ nint zoneStateAddr = MemoryUtil.Read<nint>(0x1451C42B8);
+ ref byte zoneState = ref MemoryUtil.GetRef<byte>(zoneStateAddr + 0xD2EA);
+ if (!zoneStateManualInvoke)
+ {
+ lastZoneState = (zoneState == 0x1) ? ZoneState.Hub : ZoneState.Combat;
+ }
+ else
+ {
+ zoneStateManualInvoke = false;
+ }
+ ZoneState overrideZoneState = forceZoneState;
+ if (overrideZoneState == ZoneState.Unknown)
+ {
+ overrideZoneState = lastZoneState;
+ }
+ if (overrideZoneState != ZoneState.Unknown)
+ {
+ zoneState = byteFlag(overrideZoneState == ZoneState.Hub);
+ }
+ setZoneStateHook!.Original(player, flags);
+ }
+
+ private void RefreshEntityParamsHook(nint entity, nint unknownPtr2)
+ {
+ refreshEntityParams!.Original(entity, unknownPtr2);
+
+ if (disableMod || playerOpacityOverride == 1.0f)
+ {
+ return;
+ }
+
+ Player? player = Player.MainPlayer;
+ if (player != null && entity == player.Instance)
+ {
+ MemoryUtil.GetRef<float>(player.Instance + 0x78E0) = playerOpacityOverride;
+ }
+ }
+
/*
private void SetLODLimitsHook(nint unknownPtr)
{
@@ -2834,9 +2915,10 @@ namespace MHWNewCamera private void FXAAHook(nint unknownPtr, nint unknownPtr2)
{
+ fxaaHook!.Original(unknownPtr, unknownPtr2);
+
if (disableMod)
{
- fxaaHook!.Original(unknownPtr, unknownPtr2);
return;
}
@@ -2845,8 +2927,6 @@ namespace MHWNewCamera #endif
fxaaAddr = unknownPtr;
-
- fxaaHook!.Original(unknownPtr, unknownPtr2);
}
private void drawViewportInfo(int i, float width, Config config, bool debug)
@@ -3658,7 +3738,7 @@ namespace MHWNewCamera {
ImGui.SameLine();
ImGui.SetCursorPosX(alignCursorX);
- ImGui.PushItemWidth(width * 0.125f);
+ ImGui.PushItemWidth(width * 0.12f);
bool altNearClipSet = guessAltNearClipSet(vCamera);
if (ImGui.Checkbox("Alternate Near Clip", ref altNearClipSet))
{
@@ -3804,11 +3884,6 @@ namespace MHWNewCamera }
ImGui.Text("While in Free Camera | ( ) = Toggle");
- if (ImGui.BeginItemTooltip())
- {
- ImGui.Text("Set Camera Mouse Controls to Off in Options -> Camera for a better experience.");
- ImGui.EndTooltip();
- }
if (ImGui.BeginTable("Binds", 2, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Borders))
{
ImGui.TableNextRow();
@@ -3936,10 +4011,17 @@ namespace MHWNewCamera }
ImGui.PopID();
-#if SIMPLE_KEYBOARD_LAYER
- ImGui.PushID("Keyboard");
- if (ImGui.CollapsingHeader("Keyboard"))
+#if MOUSE_AND_KEYBOARD_LAYER
+ ImGui.PushID("Mouse/Keyboard");
+ if (ImGui.CollapsingHeader("Mouse & Keyboard"))
{
+ ImGui.PushItemWidth(width * 0.2f);
+ if (ImGui.Checkbox("Enable Mouse", ref mouseEnabled))
+ {
+ }
+ if (ImGui.DragFloat("Mouse Sensitivity", ref mouseSensitivity, 0.001f, 0.0f, 0.0f, "%.4f"))
+ {
+ }
if (ImGui.Checkbox("Enable Keyboard", ref keyboardEnabled))
{
Config.Settings.Binds binds = config.Binds;
@@ -3947,7 +4029,6 @@ namespace MHWNewCamera config.Binds = binds;
ConfigManager.SaveConfig<Config>(this);
}
- ImGui.PushItemWidth(width * 0.2f);
if (ImGui.DragInt("Keyboard Look Sensitivity", ref keyboardLookValue, 20, 0, Int16.MaxValue))
{
Config.Settings.Binds binds = config.Binds;
@@ -4044,30 +4125,89 @@ namespace MHWNewCamera if (controlsAddr != 0x0 && zoneStateAddr != 0x0)
{
ref byte passiveFlag = ref MemoryUtil.GetRef<byte>(player.Instance + 0x7626);
- bool passive = passiveFlag == 0x1;
+ ref byte passiveFlag2 = ref MemoryUtil.GetRef<byte>(MemoryUtil.Read<nint>(player.Instance + 0x7D20) + 0x9B8);
+ bool passive = passiveFlag == 0x1 && passiveFlag2 == 0x1;
if (ImGui.Checkbox("Passive", ref passive))
{
passiveFlag = byteFlag(passive);
+ passiveFlag2 = byteFlag(passive);
}
if (ImGui.BeginItemTooltip())
{
- ImGui.Text("Passive: Calm camera and your hunter looks neutral/smiles.\nCombat: Intense camera and your hunter looks angry.");
+ ImGui.Text("Passive: Calm camera and your hunter looks neutral/smiles.\nCombat: Intense camera and your hunter looks angry.\nIf you have Passive set and Combat Controls on, or vice versa, expect glitchy behavior.");
ImGui.EndTooltip();
}
bool combatControls = MemoryUtil.Read<byte>(controlsAddr + 0xB18) == 0x80;
zoneState = combatControls ? ZoneState.Combat : ZoneState.Hub;
#if QUARANTINED_FEATURES
- if (ImGui.Button("Change Zone State"))
- {
- MemoryUtil.GetRef<byte>(zoneStateAddr + 0xD2EA) = byteFlag(passive);
- setPassiveMode.Invoke(player.Instance, 0x00010780);
- }
if (ImGui.Checkbox("Combat Controls", ref combatControls))
{
passiveFlag = byteFlag(!combatControls);
+ passiveFlag2 = byteFlag(!combatControls);
setPlayerController1.Invoke(player.Instance);
- setPlayerController2.Invoke(controlsAddr);
- passiveFlag = byteFlag(passive);
+ setPlayerController5.Invoke(controlsAddr);
+ }
+ int zoneStateInt = (int)forceZoneState;
+ Vector2 pos = ImGui.GetCursorPos();
+ pos.Y += 6;
+ ImGui.SetCursorPos(pos);
+ ImGui.Text($"Force Zone State (Current: {((MemoryUtil.GetRef<byte>(zoneStateAddr + 0xD2EA) == 0x1) ? "Hub" : "Combat")})");
+ if (ImGui.BeginItemTooltip())
+ {
+ ImGui.Text("This will apply when moving to a different area.");
+ ImGui.EndTooltip();
+ }
+ ImGui.SameLine();
+ pos = ImGui.GetCursorPos();
+ pos.Y -= 6;
+ ImGui.SetCursorPos(pos);
+ ImGui.RadioButton("Off", ref zoneStateInt, 0);
+ ImGui.SameLine();
+ pos = ImGui.GetCursorPos();
+ pos.Y -= 6;
+ ImGui.SetCursorPos(pos);
+ ImGui.RadioButton("Hub", ref zoneStateInt, 1);
+ ImGui.SameLine();
+ pos = ImGui.GetCursorPos();
+ pos.Y -= 6;
+ ImGui.SetCursorPos(pos);
+ ImGui.RadioButton("Combat", ref zoneStateInt, 2);
+ forceZoneState = (ZoneState)zoneStateInt;
+ if (ImGui.Button("Run Change Zone State"))
+ {
+ zoneStateManualInvoke = true;
+ setZoneState.Invoke(player.Instance, 0x000106C0); // or 0x00010780.
+ }
+ if (ImGui.BeginItemTooltip())
+ {
+ ImGui.Text("You can use this to apply the value of Force Zone State.\nIf you're in a map and Force Zone State is set to Off or Combat, this will send you back to camp.");
+ ImGui.EndTooltip();
+ }
+ if (ImGui.Checkbox("Force Passive in Combat Zones", ref forcePassiveInCombatZone))
+ {
+ if (forcePassiveInCombatZone)
+ {
+ zoneStateForcePassive1.Enable();
+ zoneStateForcePassive2.Enable();
+ }
+ else
+ {
+ zoneStateForcePassive1.Disable();
+ zoneStateForcePassive2.Disable();
+ }
+ }
+ if (ImGui.Checkbox("Force Combat in Passive Zones", ref forceCombatInPassiveZone))
+ {
+ if (forceCombatInPassiveZone)
+ {
+ zoneStateForceCombat1.Enable();
+ zoneStateForceCombat2.Enable();
+ }
+ else
+ {
+ zoneStateForceCombat1.Disable();
+ zoneStateForceCombat2.Disable();
+ }
}
#endif
}
@@ -4130,8 +4270,8 @@ namespace MHWNewCamera }
if (ImGui.Button("Sit in Hot Springs"))
{
- // Run sit in hot springs action:
- // MonsterHunterWorld.exe+17601F0 - 48 89 5C 24 08 - mov [rsp+08],rbx
+ // Function "process sit in hot springs action":
+ // MonsterHunterWorld.exe+17601F0 - mov [rsp+08],rbx
MemoryUtil.WriteBytes(player.ActionController.Instance + 0xC0, [0x65, 0x00, 0x00, 0x00]);
MemoryUtil.WriteBytes(player.ActionController.Instance + 0xBC, [0x01, 0x00, 0x00, 0x00]);
}
@@ -4180,6 +4320,14 @@ namespace MHWNewCamera ImGui.EndTooltip();
}
+ ImGui.PushItemWidth(width * 0.35f);
+ ref float playerOpacity = ref MemoryUtil.GetRef<float>(player.Instance + 0x78E0);
+ if (ImGui.DragFloat("Opacity", ref playerOpacity, 0.01f, 0.0f, Single.MaxValue))
+ {
+ playerOpacityOverride = playerOpacity;
+ }
+ ImGui.PopItemWidth();
+
if (ImGui.CollapsingHeader("Wetness"))
{
nint wetnessAddr = player.Instance + 0x13BD0;
@@ -4740,9 +4888,9 @@ namespace MHWNewCamera ImGui.Separator();
}
- if (ImGui.CollapsingHeader("Monsters"))
+ Monster[] monsters = Monster.GetAllMonsters();
+ if (monsters.Length != 0 && ImGui.CollapsingHeader("Monsters"))
{
- Monster[] monsters = Monster.GetAllMonsters();
for (int i = monsters.Length - 1; i >= 0; i--)
{
Monster monster = monsters[i];
@@ -4873,12 +5021,14 @@ namespace MHWNewCamera ImGui.Separator();
+#if MOUSE_AND_KEYBOARD_LAYER
ImGui.PushID("Mouse/Keyboard");
ImGui.Text("Mouse:");
ImGui.Text($"Address: {sMhMouse.Instance:x}");
ImGui.Text("Keyboard:");
ImGui.Text($"Address: {sMhKeyboard.Instance:x}");
ImGui.PopID();
+#endif
ImGui.PushID("Pad");
ImGui.Text("Pad:");
@@ -4927,7 +5077,7 @@ namespace MHWNewCamera ImGui.PushID("Orbit");
ImGui.Text("Orbital Camera:");
ImGui.PushItemWidth(width * 0.15f);
- ImGui.DragFloat("Forward", ref orbitForward, 1.0f);
+ ImGui.DragFloat("Distance", ref orbitDistance, 1.0f);
ImGui.SameLine();
ImGui.DragFloat("Target Y", ref orbitY, 1.0f);
ImGui.DragFloat("Movement Rotation", ref orbitMovementRotation, 1.0f);
|