Experimental: no longer run in dev/staging dalamud when not Debug/ReleaseValidate

This commit is contained in:
RisaDev
2024-11-18 01:08:25 +03:00
parent 9c0b8b7ab0
commit 344dc52614
11 changed files with 124 additions and 18 deletions

View File

@@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Configurations>Debug;Release</Configurations>
<Configurations>Debug;Release;ReleaseValidate</Configurations>
</PropertyGroup>
<PropertyGroup>
@@ -49,8 +49,12 @@
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<PropertyGroup Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='ReleaseValidate'">
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='ReleaseValidate'">
<DefineConstants>VALIDATE_BUILD</DefineConstants>
</PropertyGroup>
</Project>

View File

@@ -30,6 +30,8 @@ Global
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
ReleaseValidate|Any CPU = ReleaseValidate|Any CPU
ReleaseValidate|x64 = ReleaseValidate|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.Debug|Any CPU.ActiveCfg = Debug|x64
@@ -40,6 +42,10 @@ Global
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.Release|Any CPU.Build.0 = Release|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.Release|x64.ActiveCfg = Release|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.Release|x64.Build.0 = Release|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.ReleaseValidate|Any CPU.ActiveCfg = ReleaseValidate|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.ReleaseValidate|Any CPU.Build.0 = ReleaseValidate|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.ReleaseValidate|x64.ActiveCfg = Release|x64
{5BA385F5-C17E-4CE4-828A-24F7F19C434B}.ReleaseValidate|x64.Build.0 = Release|x64
{0D465539-6133-4088-B4BB-F260FA2A1557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -48,6 +54,10 @@ Global
{0D465539-6133-4088-B4BB-F260FA2A1557}.Release|Any CPU.Build.0 = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.Release|x64.ActiveCfg = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.Release|x64.Build.0 = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.ReleaseValidate|Any CPU.ActiveCfg = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.ReleaseValidate|Any CPU.Build.0 = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.ReleaseValidate|x64.ActiveCfg = Release|Any CPU
{0D465539-6133-4088-B4BB-F260FA2A1557}.ReleaseValidate|x64.Build.0 = Release|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -56,6 +66,10 @@ Global
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Release|Any CPU.Build.0 = Release|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Release|x64.ActiveCfg = Release|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.Release|x64.Build.0 = Release|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.ReleaseValidate|Any CPU.ActiveCfg = ReleaseValidate|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.ReleaseValidate|Any CPU.Build.0 = ReleaseValidate|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.ReleaseValidate|x64.ActiveCfg = Release|Any CPU
{CDB26C94-1200-45AA-AF96-D4526DC76AD5}.ReleaseValidate|x64.Build.0 = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -64,6 +78,10 @@ Global
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Release|Any CPU.Build.0 = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Release|x64.ActiveCfg = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.Release|x64.Build.0 = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.ReleaseValidate|Any CPU.ActiveCfg = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.ReleaseValidate|Any CPU.Build.0 = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.ReleaseValidate|x64.ActiveCfg = Release|Any CPU
{D79C8833-D241-4867-BF6F-8097E0ED8067}.ReleaseValidate|x64.Build.0 = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -72,6 +90,10 @@ Global
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Release|Any CPU.Build.0 = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Release|x64.ActiveCfg = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.Release|x64.Build.0 = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.ReleaseValidate|Any CPU.ActiveCfg = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.ReleaseValidate|Any CPU.Build.0 = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.ReleaseValidate|x64.ActiveCfg = Release|Any CPU
{CC460943-1E07-4FA0-8B8C-67F0EF385290}.ReleaseValidate|x64.Build.0 = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -80,6 +102,10 @@ Global
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Release|Any CPU.Build.0 = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Release|x64.ActiveCfg = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.Release|x64.Build.0 = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.ReleaseValidate|Any CPU.ActiveCfg = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.ReleaseValidate|Any CPU.Build.0 = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.ReleaseValidate|x64.ActiveCfg = Release|Any CPU
{CB1DFB63-22D9-4E90-A8C1-A4F7CFEF7823}.ReleaseValidate|x64.Build.0 = Release|Any CPU
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Debug|Any CPU.ActiveCfg = Debug|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Debug|Any CPU.Build.0 = Debug|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Debug|x64.ActiveCfg = Debug|x64
@@ -88,6 +114,10 @@ Global
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Release|Any CPU.Build.0 = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Release|x64.ActiveCfg = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.Release|x64.Build.0 = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.ReleaseValidate|Any CPU.ActiveCfg = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.ReleaseValidate|Any CPU.Build.0 = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.ReleaseValidate|x64.ActiveCfg = Release|x64
{41F4BB08-FCFD-420F-AD18-ED9D7FB3251C}.ReleaseValidate|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -12,6 +12,8 @@ internal static class VersionHelper
public static bool IsDebug { get; private set; } = false;
public static bool IsValidate { get; private set; } = false;
static VersionHelper()
{
#if DEBUG
@@ -24,7 +26,14 @@ internal static class VersionHelper
if (ThisAssembly.Git.BaseTag.ToLowerInvariant().Contains("testing"))
IsTesting = true;
#if VALIDATE_BUILD
IsValidate = true;
#endif
if (IsTesting)
Version += " [TESTING BUILD]";
if (IsValidate)
Version += " [VALIDATE BUILD]";
}
}

View File

@@ -5,6 +5,12 @@ namespace CustomizePlus.Core.Services.Dalamud;
public class DalamudBranchService : IService
{
/// <summary>
/// Message used in various places to tell user why the plugin is disabled
/// </summary>
public const string PluginDisabledMessage = "You are running development or testing version of Dalamud.\n" +
"Regular users are not supposed to run Customize+ on non-release versions of Dalamud therefore Customize+ has disabled itself.";
/// <summary>
/// Current Dalamud branch
/// </summary>
@@ -15,6 +21,11 @@ public class DalamudBranchService : IService
/// </summary>
public string CurrentBranchName { get; private set; }
/// <summary>
/// Whether to allow or not Customize+ to actually function
/// </summary>
public bool AllowPluginToRun { get; private set; } = true;
public DalamudBranchService(DalamudConfigService dalamudConfigService, Logger logger)
{
dalamudConfigService.GetDalamudConfig<string>(DalamudConfigService.BetaKindOption, out var betaOption);
@@ -33,7 +44,11 @@ public class DalamudBranchService : IService
break;
}
logger.Information($"Current Dalamud branch is: {CurrentBranchName} ({CurrentBranch})");
#if CHECK_DALAMUD_BRANCH
AllowPluginToRun = CurrentBranch == DalamudBranch.Release;
#endif
logger.Information($"Current Dalamud branch is: {CurrentBranchName} ({CurrentBranch}). Plugin allowed to run: {AllowPluginToRun}");
}
public enum DalamudBranch

View File

@@ -25,7 +25,7 @@ public class HookingService : IDisposable
private readonly ProfileManager _profileManager;
private readonly ArmatureManager _armatureManager;
private readonly GameStateService _gameStateService;
//private readonly DalamudBranchService _dalamudBranchService;
private readonly DalamudBranchService _dalamudBranchService;
private readonly Logger _logger;
private Hook<RenderDelegate>? _renderManagerHook;
@@ -46,7 +46,7 @@ public class HookingService : IDisposable
ProfileManager profileManager,
ArmatureManager armatureManager,
GameStateService gameStateService,
//DalamudBranchService dalamudBranchService,
DalamudBranchService dalamudBranchService,
Logger logger)
{
_configuration = configuration;
@@ -55,7 +55,7 @@ public class HookingService : IDisposable
_profileManager = profileManager;
_armatureManager = armatureManager;
_gameStateService = gameStateService;
//_dalamudBranchService = dalamudBranchService;
_dalamudBranchService = dalamudBranchService;
_logger = logger;
ReloadHooks();
@@ -75,8 +75,11 @@ public class HookingService : IDisposable
RenderHookFailed = false;
MovementHookFailed = false;
/*if(_dalamudBranchService.CurrentBranch != DalamudBranchService.DalamudBranch.Release)
return;*/
if(!_dalamudBranchService.AllowPluginToRun)
{
_logger.Error("Not reloading hooks because the plugin is not allowed to run. (Branch Service)");
return;
}
try
{

View File

@@ -2,7 +2,9 @@
using CustomizePlus.Core.Helpers;
using CustomizePlus.Core.Services.Dalamud;
using CustomizePlus.Game.Services;
using CustomizePlus.UI.Windows;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.UI;
namespace CustomizePlus.Core.Services;
@@ -11,17 +13,20 @@ public class UserNotifierService : IDisposable
private readonly IClientState _clientState;
private readonly ChatService _chatService;
private readonly DalamudBranchService _dalamudBranchService;
private readonly PopupSystem _popupSystem;
public UserNotifierService(
IClientState clientState,
ChatService chatService,
DalamudBranchService dalamudBranchService)
DalamudBranchService dalamudBranchService,
PopupSystem popupSystem)
{
_clientState = clientState;
_chatService = chatService;
_dalamudBranchService = dalamudBranchService;
_popupSystem = popupSystem;
OnLogin();
NotifyUser(true);
_clientState.Login += OnLogin;
}
@@ -32,13 +37,26 @@ public class UserNotifierService : IDisposable
}
private void OnLogin()
{
NotifyUser(true);
}
private void NotifyUser(bool displayOptionalMessages = false)
{
if (VersionHelper.IsTesting)
_chatService.PrintInChat($"You are running testing version of Customize+! Some features like integration with other plugins might not function correctly.",
ChatService.ChatMessageColor.Warning);
if (_dalamudBranchService.CurrentBranch != DalamudBranchService.DalamudBranch.Release)
_chatService.PrintInChat($"You are running development or testing version of Dalamud. This is not supported and might be actively prevented in the future.",
if (!_dalamudBranchService.AllowPluginToRun)
{
_chatService.PrintInChat(DalamudBranchService.PluginDisabledMessage,
ChatService.ChatMessageColor.Error);
if (displayOptionalMessages)
{
UIGlobals.PlayChatSoundEffect(11);
_popupSystem.ShowPopup(PopupSystem.Messages.PluginDisabledNonReleaseDalamud);
}
}
}
}

View File

@@ -9,7 +9,7 @@
<Copyright></Copyright>
<PackageProjectUrl>https://github.com/Aether-Tools/CustomizePlus</PackageProjectUrl>
<UseWindowsForms>true</UseWindowsForms>
<Configurations>Debug;Release</Configurations>
<Configurations>Debug;Release;ReleaseValidate</Configurations>
</PropertyGroup>
<PropertyGroup>
@@ -90,10 +90,18 @@
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<PropertyGroup Condition="'$(Configuration)'=='Release' Or '$(Configuration)'=='ReleaseValidate'">
<DefineConstants>INCOGNIFY_STRINGS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>CHECK_DALAMUD_BRANCH</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='ReleaseValidate'">
<DefineConstants>VALIDATE_BUILD</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<GitVersion>false</GitVersion>
</PropertyGroup>

View File

@@ -25,6 +25,7 @@ public class CPlusChangeLog
Add2_0_6_0(Changelog);
Add2_0_6_3(Changelog);
Add2_0_7_0(Changelog);
Add2_0_7_2(Changelog);
}
private (int, ChangeLogDisplayType) ConfigData()
@@ -37,6 +38,15 @@ public class CPlusChangeLog
_config.Save();
}
private static void Add2_0_7_2(Changelog log)
=> log.NextVersion("Version 2.0.7.2")
.RegisterHighlight("Support for 7.1 and Dalamud API 11.")
.RegisterImportant("As an experiment Customize+ will no longer run if you are running testing or development version of Dalamud. Please leave your feedback about this change in support Discord.")
.RegisterEntry("Developers can prevent this from triggering by manually compiling \"Debug\" or \"ReleaseValidate\" builds of Customize+.", 1)
.RegisterHighlight("Fixed an issue which prevented owned characters (such as Carbuncles and Trust NPCs) from being detected. (2.0.7.1)")
.RegisterEntry("Source code maintenance - external libraries update.");
private static void Add2_0_7_0(Changelog log)
=> log.NextVersion("Version 2.0.7.0")
.RegisterImportant("Some parts of Customize+ have been considerably rewritten in this update. If you encounter any issues please report them.")

View File

@@ -79,11 +79,11 @@ public class PluginStateBlock
severity = PluginStateSeverity.Error;
message = "Detected failure in IPC. Integrations with other plugins will not function.";
}
else if (_dalamudBranchService.CurrentBranch != DalamudBranchService.DalamudBranch.Release)
else if (!_dalamudBranchService.AllowPluginToRun)
{
severity = PluginStateSeverity.Error;
message = "You are running unsupported version of Dalamud, hover for more information.";
hoverInfo = "Regular users are not supposed to run Customize+ on development or testing versions of Dalamud.\nThis is not supported and might be actively prevented in the future.";
hoverInfo = "Regular users are not supposed to run Customize+ on development or testing versions of Dalamud.\nThis is not supported and therefore Customize+ has disabled itself.";
}
else if(VersionHelper.IsTesting)
{

View File

@@ -20,6 +20,7 @@ using CustomizePlus.Templates.Events;
using CustomizePlus.Templates.Data;
using ECommonsLite.Schedulers;
using CustomizePlus.Core.Helpers;
using CustomizePlus.Core.Services.Dalamud;
namespace CustomizePlus.UI.Windows.MainWindow;
@@ -37,6 +38,7 @@ public class MainWindow : Window, IDisposable
private readonly TemplateEditorManager _templateEditorManager;
private readonly PluginConfiguration _configuration;
private readonly HookingService _hookingService;
private readonly DalamudBranchService _dalamudBranchService;
private readonly TemplateEditorEvent _templateEditorEvent;
@@ -59,6 +61,7 @@ public class MainWindow : Window, IDisposable
TemplateEditorManager templateEditorManager,
PluginConfiguration configuration,
HookingService hookingService,
DalamudBranchService dalamudBranchService,
TemplateEditorEvent templateEditorEvent
) : base($"Customize+ {VersionHelper.Version}###CPlusMainWindow")
{
@@ -74,6 +77,7 @@ public class MainWindow : Window, IDisposable
_templateEditorManager = templateEditorManager;
_configuration = configuration;
_hookingService = hookingService;
_dalamudBranchService = dalamudBranchService;
_templateEditorEvent = templateEditorEvent;
@@ -97,7 +101,7 @@ public class MainWindow : Window, IDisposable
{
var yPos = ImGui.GetCursorPosY();
using (var disabled = ImRaii.Disabled(_hookingService.RenderHookFailed || _hookingService.MovementHookFailed))
using (var disabled = ImRaii.Disabled(_hookingService.RenderHookFailed || _hookingService.MovementHookFailed || !_dalamudBranchService.AllowPluginToRun))
{
LockWindowClosureIfNeeded();
ImGuiEx.EzTabBar("##tabs", null, _switchToTab, [

View File

@@ -1,4 +1,5 @@
using System.Numerics;
using CustomizePlus.Core.Services.Dalamud;
using System.Numerics;
namespace CustomizePlus.UI.Windows;
@@ -23,6 +24,8 @@ public partial class PopupSystem
public const string ClipboardDataUnsupported = "clipboard_data_unsupported_version";
public const string ClipboardDataNotLongTerm = "clipboard_data_not_longterm";
public const string PluginDisabledNonReleaseDalamud = "non_release_dalamud";
}
private void RegisterMessages()
@@ -44,5 +47,7 @@ public partial class PopupSystem
RegisterPopup(Messages.ClipboardDataUnsupported, "Clipboard data you are trying to use cannot be used in this version of Customize+.");
RegisterPopup(Messages.ClipboardDataNotLongTerm, "Warning: clipboard data is not designed to be used as long-term way of storing your templates.\nCompatibility of copied data between different Customize+ versions is not guaranteed.", true, new Vector2(5, 10));
RegisterPopup(Messages.PluginDisabledNonReleaseDalamud, DalamudBranchService.PluginDisabledMessage, false, new Vector2(5, 8));
}
}