Skip to content

Commit

Permalink
Fix shortcut flickering. Should be handled with care, dnSpy is a bitch.
Browse files Browse the repository at this point in the history
  • Loading branch information
TopazTK committed Feb 27, 2022
1 parent 3fb9774 commit 994d592
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions KH2/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Text;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.InteropServices;

using DiscordRPC;
Expand Down Expand Up @@ -391,21 +392,29 @@ public static void OverrideText()
public static void OverrideShortcuts()
{
var _confirmRead = Hypervisor.Read<byte>(Variables.ConfirmAddress);
var _shortRead = Hypervisor.Read<ushort>(Variables.ShortcutStartAddress);
Hypervisor.UnlockBlock(Variables.ShortcutStartAddress);


if (_confirmRead == 0x00 && _shortRead != 0x02BA)
if (_confirmRead == 0x00)
{
Hypervisor.UnlockBlock(Variables.ShortcutStartAddress);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress, 0x02BA);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress + 0x06, 0x02AB);
var _shortRead = Hypervisor.Read<ushort>(Variables.ShortcutStartAddress);

if (_shortRead != 0x02BA)
{
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress, 0x02BA);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress + 0x06, 0x02AB);
}
}

else if (_confirmRead == 0x01 && _shortRead != 0x02AB)
else if (_confirmRead == 0x01)
{
Hypervisor.UnlockBlock(Variables.ShortcutStartAddress);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress, 0x02AB);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress + 0x06, 0x02BA);
var _shortRead = Hypervisor.Read<ushort>(Variables.ShortcutStartAddress);

if (_shortRead != 0x02AB)
{
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress, 0x02AB);
Hypervisor.Write<ushort>(Variables.ShortcutStartAddress + 0x06, 0x02BA);
}
}
}

Expand Down

0 comments on commit 994d592

Please sign in to comment.