refactor: remove some remnants from ReadProcessMemory workaround

This commit is contained in:
goat 2020-07-19 21:40:07 +02:00
parent 5f402950d8
commit 680715a2a2

View file

@ -30,25 +30,9 @@ namespace Dalamud.Game.ClientState.Actors {
internal void ResetCache() => actorsCache = null; internal void ResetCache() => actorsCache = null;
#endregion #endregion
#region temporary imports for crash workaround
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
IntPtr lpBuffer,
int dwSize,
out IntPtr lpNumberOfBytesRead);
#endregion
private ClientStateAddressResolver Address { get; } private ClientStateAddressResolver Address { get; }
private Dalamud dalamud; private Dalamud dalamud;
private static int actorMemSize = Marshal.SizeOf(typeof(Structs.Actor));
private IntPtr actorMem { get; set; } = Marshal.AllocHGlobal(actorMemSize);
/// <summary> /// <summary>
/// Set up the actor table collection. /// Set up the actor table collection.
/// </summary> /// </summary>
@ -147,7 +131,6 @@ namespace Dalamud.Game.ClientState.Actors {
{ {
if (disposed) return; if (disposed) return;
this.dalamud.Framework.OnUpdateEvent -= Framework_OnUpdateEvent; this.dalamud.Framework.OnUpdateEvent -= Framework_OnUpdateEvent;
Marshal.FreeHGlobal(actorMem);
disposed = true; disposed = true;
} }