mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Fix visor service with umbrella on.
This commit is contained in:
parent
7091fdd808
commit
10e508b4e7
1 changed files with 8 additions and 7 deletions
|
|
@ -43,21 +43,22 @@ public class VisorService : IDisposable
|
|||
return true;
|
||||
}
|
||||
|
||||
private delegate void UpdateVisorDelegateInternal(nint humanPtr, ushort modelId, bool on);
|
||||
private delegate void UpdateVisorDelegateInternal(nint humanPtr, ushort modelId, byte on);
|
||||
|
||||
private readonly Hook<UpdateVisorDelegateInternal> _setupVisorHook;
|
||||
|
||||
private void SetupVisorDetour(nint human, ushort modelId, bool on)
|
||||
private void SetupVisorDetour(nint human, ushort modelId, byte value)
|
||||
{
|
||||
var originalOn = on;
|
||||
var originalOn = value != 0;
|
||||
var on = originalOn;
|
||||
// Invoke an event that can change the requested value
|
||||
// and also control whether the function should be called at all.
|
||||
Event.Invoke(human, false, ref on);
|
||||
|
||||
Glamourer.Log.Excessive(
|
||||
$"[SetVisorState] Invoked from game on 0x{human:X} switching to {on} (original {originalOn}).");
|
||||
Glamourer.Log.Verbose(
|
||||
$"[SetVisorState] Invoked from game on 0x{human:X} switching to {on} (original {originalOn} from {value} with {modelId}).");
|
||||
|
||||
SetupVisorDetour((Model)human, modelId, on);
|
||||
SetupVisorDetour(human, modelId, on);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,6 +70,6 @@ public class VisorService : IDisposable
|
|||
private unsafe void SetupVisorDetour(Model human, ushort modelId, bool on)
|
||||
{
|
||||
human.AsCharacterBase->VisorToggled = on;
|
||||
_setupVisorHook.Original(human.Address, modelId, on);
|
||||
_setupVisorHook.Original(human.Address, modelId, on ? (byte)1 : (byte)0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue