Added Color Table Hook from MemShield, currently Experimental and default on as a test.

This commit is contained in:
2025-09-02 19:51:36 +01:00
parent 5cac38f446
commit 4853afd1eb
5 changed files with 131 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ using Dalamud.Utility;
using MareSynchronos.API.Data;
using MareSynchronos.API.Data.Comparer;
using MareSynchronos.FileCache;
using MareSynchronos.Interop;
using MareSynchronos.Interop.Ipc;
using MareSynchronos.MareConfiguration;
using MareSynchronos.MareConfiguration.Models;
@@ -25,6 +26,7 @@ using System.Collections.Concurrent;
using System.Diagnostics;
using System.Globalization;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text.Json;
namespace MareSynchronos.UI;
@@ -50,6 +52,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
private readonly PlayerPerformanceService _playerPerformanceService;
private readonly AccountRegistrationService _registerService;
private readonly ServerConfigurationManager _serverConfigurationManager;
private readonly ColorTableHook _colorTableHook;
private readonly UiSharedService _uiShared;
private bool _deleteAccountPopupModalShown = false;
private string _lastTab = string.Empty;
@@ -77,11 +80,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
FileCacheManager fileCacheManager,
FileCompactor fileCompactor, ApiController apiController,
IpcManager ipcManager, IpcProvider ipcProvider, CacheMonitor cacheMonitor,
DalamudUtilService dalamudUtilService, AccountRegistrationService registerService) : base(logger, mediator, "Club Penguin Sync Settings", performanceCollector)
DalamudUtilService dalamudUtilService, AccountRegistrationService registerService, ColorTableHook colorTableHook) : base(logger, mediator, "Club Penguin Sync Settings", performanceCollector)
{
_configService = configService;
_pairManager = pairManager;
_chatService = chatService;
_colorTableHook = colorTableHook;
_guiHookService = guiHookService;
_serverConfigurationManager = serverConfigurationManager;
_playerPerformanceConfigService = playerPerformanceConfigService;
@@ -640,6 +644,22 @@ public class SettingsUi : WindowMediatorSubscriberBase
_configService.Save();
}
bool attemptColorTableProtection = _configService.Current.AttemptColorTableProtection;
if (ImGui.Checkbox("[EXPERIMENTAL] Attempt to fix potential ColorTable crashes.", ref attemptColorTableProtection))
{
if (attemptColorTableProtection)
{
_colorTableHook.EnableHooks();
}
else
{
_colorTableHook.DisableHooks();
}
//this shouldnt need the mediator as this is the ONLY source of truth.
_configService.Current.AttemptColorTableProtection = attemptColorTableProtection;
_configService.Save();
}
bool serializedApplications = _configService.Current.SerialApplication;
if (ImGui.Checkbox("Serialized player applications", ref serializedApplications))
{