Fix some stuff, add versions.

This commit is contained in:
Ottermandias 2024-03-16 16:58:02 +01:00
parent c1a9c798ae
commit 7cb50030f9
6 changed files with 45 additions and 20 deletions

View file

@ -22,15 +22,17 @@ public sealed class CrashHandlerService : IDisposable, IService
private readonly ActorManager _actors;
private readonly ResourceLoader _resourceLoader;
private readonly Configuration _config;
private readonly ValidityChecker _validityChecker;
public CrashHandlerService(FilenameService files, CommunicatorService communicator, ActorManager actors, ResourceLoader resourceLoader,
Configuration config)
Configuration config, ValidityChecker validityChecker)
{
_files = files;
_communicator = communicator;
_actors = actors;
_resourceLoader = resourceLoader;
_config = config;
_files = files;
_communicator = communicator;
_actors = actors;
_resourceLoader = resourceLoader;
_config = config;
_validityChecker = validityChecker;
if (!_config.UseCrashHandler)
return;
@ -152,6 +154,8 @@ public sealed class CrashHandlerService : IDisposable, IService
};
info.ArgumentList.Add(_files.LogFileName);
info.ArgumentList.Add(Environment.ProcessId.ToString());
info.ArgumentList.Add($"{_validityChecker.Version} ({_validityChecker.CommitHash})");
info.ArgumentList.Add(_validityChecker.GameVersion);
_child = Process.Start(info);
if (_child == null)
throw new Exception("Child Process could not be created.");
@ -177,7 +181,7 @@ public sealed class CrashHandlerService : IDisposable, IService
JsonObject jObj;
lock (_eventWriter)
{
jObj = reader.Dump("Manual Dump", Environment.ProcessId, 0);
jObj = reader.Dump("Manual Dump", Environment.ProcessId, 0, $"{_validityChecker.Version} ({_validityChecker.CommitHash})", _validityChecker.GameVersion);
}
var logFile = _files.LogFileName;

View file

@ -1,5 +1,6 @@
using Dalamud.Interface.Internal.Notifications;
using Dalamud.Plugin;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using OtterGui.Classes;
using OtterGui.Services;
@ -20,6 +21,7 @@ public class ValidityChecker : IService
public readonly string Version;
public readonly string CommitHash;
public readonly string GameVersion;
public ValidityChecker(DalamudPluginInterface pi)
{
@ -28,14 +30,19 @@ public class ValidityChecker : IService
IsValidSourceRepo = CheckSourceRepo(pi);
var assembly = GetType().Assembly;
Version = assembly.GetName().Version?.ToString() ?? string.Empty;
CommitHash = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
Version = assembly.GetName().Version?.ToString() ?? string.Empty;
CommitHash = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "Unknown";
GameVersion = GetGameVersion();
}
private static unsafe string GetGameVersion()
=> Framework.Instance()->GameVersion[0];
public void LogExceptions()
{
if (ImcExceptions.Count > 0)
Penumbra.Messager.NotificationMessage($"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.", NotificationType.Warning);
Penumbra.Messager.NotificationMessage($"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.",
NotificationType.Warning);
}
// Because remnants of penumbra in devPlugins cause issues, we check for them to warn users to remove them.

View file

@ -13,6 +13,9 @@ public static class CrashDataExtensions
{
ImGui.TextUnformatted(nameof(data.Mode));
ImGui.TextUnformatted(nameof(data.CrashTime));
ImGui.TextUnformatted("Current Age");
ImGui.TextUnformatted(nameof(data.Version));
ImGui.TextUnformatted(nameof(data.GameVersion));
ImGui.TextUnformatted(nameof(data.ExitCode));
ImGui.TextUnformatted(nameof(data.ProcessId));
ImGui.TextUnformatted(nameof(data.TotalModdedFilesLoaded));
@ -25,6 +28,9 @@ public static class CrashDataExtensions
{
ImGui.TextUnformatted(data.Mode);
ImGui.TextUnformatted(data.CrashTime.ToString());
ImGui.TextUnformatted((DateTimeOffset.UtcNow - data.CrashTime).ToString(@"dd\.hh\:mm\:ss"));
ImGui.TextUnformatted(data.Version);
ImGui.TextUnformatted(data.GameVersion);
ImGui.TextUnformatted(data.ExitCode.ToString());
ImGui.TextUnformatted(data.ProcessId.ToString());
ImGui.TextUnformatted(data.TotalModdedFilesLoaded.ToString());