From 484603e17be363f469d8f55ffee8a00bebcb117e Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Tue, 13 Apr 2021 09:13:35 -0400 Subject: [PATCH] fix: catch exceptions in ACS hook --- Globetrotter/Globetrotter.csproj | 10 +++++----- Globetrotter/TreasureMaps.cs | 15 +++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Globetrotter/Globetrotter.csproj b/Globetrotter/Globetrotter.csproj index 15ee0b4..f8f2753 100755 --- a/Globetrotter/Globetrotter.csproj +++ b/Globetrotter/Globetrotter.csproj @@ -6,23 +6,23 @@ latest - + $(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll False - + $(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll False - + $(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll False - + $(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll False - + $(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll False diff --git a/Globetrotter/TreasureMaps.cs b/Globetrotter/TreasureMaps.cs index 21346d4..c6cdcea 100644 --- a/Globetrotter/TreasureMaps.cs +++ b/Globetrotter/TreasureMaps.cs @@ -78,19 +78,26 @@ namespace Globetrotter { } private char OnACS(long a1, long a2, IntPtr dataPtr) { + try { + this.OnACSInner(dataPtr); + } catch (Exception ex) { + PluginLog.LogError(ex, "Exception on ACS"); + } + + return this._acsHook.Original(a1, a2, dataPtr); + } + + private void OnACSInner(IntPtr dataPtr) { var packet = ParsePacket(dataPtr); if (packet == null) { - return this._acsHook.Original(a1, a2, dataPtr); + return; } this._lastMap = packet; if (this.Config.ShowOnOpen && packet.JustOpened) { - // this does not work because the offset in memory is not yet updated with the thing this.OpenMapLocation(); } - - return this._acsHook.Original(a1, a2, dataPtr); } public void OpenMapLocation() {