From 4d6f7762e664cac218a3221cbdfeb5057d6e4d63 Mon Sep 17 00:00:00 2001 From: goat Date: Tue, 31 Mar 2020 23:43:15 +0900 Subject: [PATCH 1/6] fix: create all .disabled files for previous versions, just to be safe --- Dalamud/Plugin/PluginRepository.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Dalamud/Plugin/PluginRepository.cs b/Dalamud/Plugin/PluginRepository.cs index 0f386b1d1..af8ff3326 100644 --- a/Dalamud/Plugin/PluginRepository.cs +++ b/Dalamud/Plugin/PluginRepository.cs @@ -142,11 +142,6 @@ namespace Dalamud.Plugin // DisablePlugin() below immediately creates a .disabled file anyway, but will fail // with an exception if we try to do it twice in row like this - // TODO: not sure if doing this for all versions is really necessary, since the - // others really needed to be disabled before anyway - //foreach (var sortedVersion in sortedVersions) { - // File.Create(Path.Combine(sortedVersion.FullName, ".disabled")); - //} if (!dryRun) { @@ -161,6 +156,18 @@ namespace Dalamud.Plugin hasError = true; } + try { + // Just to be safe + foreach (var sortedVersion in sortedVersions) + { + var disabledFile = new FileInfo(Path.Combine(sortedVersion.FullName, ".disabled")); + if (!disabledFile.Exists) + disabledFile.Create(); + } + } catch (Exception ex) { + Log.Error(ex, "Plugin disable failed"); + } + var installSuccess = InstallPlugin(remoteInfo); if (installSuccess) From e02bca714ff2eb4ddb403c06d0b7f36c1eedd61a Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Apr 2020 01:53:02 +0900 Subject: [PATCH 2/6] fix: some kind of mitigation for actortable crashes --- Dalamud/Game/ClientState/Actors/ActorTable.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Dalamud/Game/ClientState/Actors/ActorTable.cs b/Dalamud/Game/ClientState/Actors/ActorTable.cs index 81cf2a31f..18205fb15 100644 --- a/Dalamud/Game/ClientState/Actors/ActorTable.cs +++ b/Dalamud/Game/ClientState/Actors/ActorTable.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; +using System.Security; using System.Windows.Forms; using Dalamud.Game.ClientState.Actors.Types; using Dalamud.Game.ClientState.Actors.Types.NonPlayer; @@ -56,30 +58,35 @@ namespace Dalamud.Game.ClientState.Actors { /// /// Spawn index. /// at the specified spawn index. - public Actor this[int index] { - get { + public Actor this[int index] => At(index); + + [HandleProcessCorruptedStateExceptions] + [SecurityCritical] + private Actor At(int index) { + try { if (!this.isReady) return null; - if (this.someActorTableAccessHook != null) { + if (this.someActorTableAccessHook != null) + { this.someActorTableAccessHook.Dispose(); this.someActorTableAccessHook = null; } if (index > Length) return null; - - //Log.Information("Trying to get actor at {0}", index); + var tblIndex = this.realActorTablePtr + 8 + index * 8; var offset = Marshal.ReadIntPtr(tblIndex); - //Log.Information("Actor at {0}", offset.ToString()); + Log.Information("Actor at {0} for {1}", offset.ToInt64().ToString("X"), index); if (offset == IntPtr.Zero) return null; - try { + try + { var actorStruct = Marshal.PtrToStructure(offset); //Log.Debug("ActorTable[{0}]: {1} - {2} - {3}", index, tblIndex.ToString("X"), offset.ToString("X"), @@ -91,9 +98,14 @@ namespace Dalamud.Game.ClientState.Actors { case ObjectKind.BattleNpc: return new BattleNpc(actorStruct, this.dalamud); default: return new Actor(actorStruct, this.dalamud); } - } catch (AccessViolationException) { + } + catch (AccessViolationException) + { return null; } + } catch (Exception e) { + Log.Error(e, "Could not get Actor."); + return null; } } From 0dd46c50aeb496b88934c7541c17fec15d05a465 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Apr 2020 01:53:22 +0900 Subject: [PATCH 3/6] feat: show if plugins are installed in header --- Dalamud/Plugin/PluginInstallerWindow.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dalamud/Plugin/PluginInstallerWindow.cs b/Dalamud/Plugin/PluginInstallerWindow.cs index 7931345ee..0c4d7474e 100644 --- a/Dalamud/Plugin/PluginInstallerWindow.cs +++ b/Dalamud/Plugin/PluginInstallerWindow.cs @@ -77,7 +77,10 @@ namespace Dalamud.Plugin ImGui.PushID(pluginDefinition.InternalName + pluginDefinition.AssemblyVersion); - if (ImGui.CollapsingHeader(pluginDefinition.Name)) { + var isInstalled = this.manager.Plugins.Where(x => x.Definition != null).Any( + x => x.Definition.InternalName == pluginDefinition.InternalName); + + if (ImGui.CollapsingHeader(pluginDefinition.Name + (isInstalled ? " (installed)" : string.Empty))) { ImGui.Indent(); ImGui.Text(pluginDefinition.Name); @@ -86,9 +89,6 @@ namespace Dalamud.Plugin ImGui.Text(pluginDefinition.Description); - var isInstalled = this.manager.Plugins.Where(x => x.Definition != null).Any( - x => x.Definition.InternalName == pluginDefinition.InternalName); - if (!isInstalled) { if (this.installStatus == PluginInstallStatus.InProgress) { ImGui.Button("Install in progress..."); From 5927692494918a62743bb6b75f28b142194d0c54 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Apr 2020 01:54:52 +0900 Subject: [PATCH 4/6] build: v4.8.0.0 --- Dalamud.Injector/Dalamud.Injector.csproj | 6 +++--- Dalamud/Dalamud.csproj | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dalamud.Injector/Dalamud.Injector.csproj b/Dalamud.Injector/Dalamud.Injector.csproj index 514b9681d..40a9f6d19 100644 --- a/Dalamud.Injector/Dalamud.Injector.csproj +++ b/Dalamud.Injector/Dalamud.Injector.csproj @@ -14,10 +14,10 @@ true - 4.7.22.0 - 4.7.22.0 + 4.8.0.0 + 4.8.0.0 XIVLauncher addon injection - 4.7.22.0 + 4.8.0.0 diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index e4466d4d5..376b8a8d3 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -14,9 +14,9 @@ true - 4.7.22.0 - 4.7.22.0 - 4.7.22.0 + 4.8.0.0 + 4.8.0 + 4.8.0.0 From 0282d4127e7902d4d45496b53607a5be351f2460 Mon Sep 17 00:00:00 2001 From: karashiiro <49822414+karashiiro@users.noreply.github.com> Date: Tue, 31 Mar 2020 12:46:07 -0700 Subject: [PATCH 5/6] chore: set log level of actor index message to verbose --- Dalamud/Game/ClientState/Actors/ActorTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dalamud/Game/ClientState/Actors/ActorTable.cs b/Dalamud/Game/ClientState/Actors/ActorTable.cs index 18205fb15..407ce7132 100644 --- a/Dalamud/Game/ClientState/Actors/ActorTable.cs +++ b/Dalamud/Game/ClientState/Actors/ActorTable.cs @@ -80,7 +80,7 @@ namespace Dalamud.Game.ClientState.Actors { var offset = Marshal.ReadIntPtr(tblIndex); - Log.Information("Actor at {0} for {1}", offset.ToInt64().ToString("X"), index); + Log.Verbose("Actor at {0} for {1}", offset.ToInt64().ToString("X"), index); if (offset == IntPtr.Zero) return null; From c45492ae8da71e8f3fa72e2cebcd475e06538b0c Mon Sep 17 00:00:00 2001 From: goaaats <16760685+goaaats@users.noreply.github.com> Date: Wed, 1 Apr 2020 05:51:58 +0900 Subject: [PATCH 6/6] ci: build on pr --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f36c27185..3a24e747e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ name: Build Dalamud -on: [push] +on: [push, pull_request] jobs: build: