Compare commits
No commits in common. "2ff090f4a4a9a6c186fe39cb92c7ec7f4b6def7a" and "b9082628426cd0b8fbc24584f538fff0fd440720" have entirely different histories.
2ff090f4a4
...
b908262842
12 changed files with 67 additions and 253 deletions
|
@ -1,4 +1,6 @@
|
|||
using System.Globalization;
|
||||
using static FFXIVClientStructs.FFXIV.Client.UI.AddonRelicNoteBook;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System;
|
||||
|
||||
namespace CustomResolution.Cmds;
|
||||
|
@ -64,28 +66,18 @@ public sealed class MainCmd : Cmd
|
|||
return;
|
||||
|
||||
case "debugon":
|
||||
Service.DebugConfig.IsDebug = true;
|
||||
Service.Plugin.IsDebug = true;
|
||||
Service.PrintChat("Enabled cres debug.");
|
||||
return;
|
||||
|
||||
case "debugoff":
|
||||
Service.DebugConfig.IsDebug = false;
|
||||
Service.Plugin.IsDebug = false;
|
||||
Service.PrintChat("Disabled cres debug.");
|
||||
return;
|
||||
|
||||
case "debug":
|
||||
Service.DebugConfig.IsDebug = !Service.DebugConfig.IsDebug;
|
||||
Service.PrintChat($"{(Service.DebugConfig.IsDebug ? "Enabled" : "Disabled")} cres debug.");
|
||||
return;
|
||||
|
||||
case "debugsizeold":
|
||||
Service.DebugConfig.SetSizeMode = SetSizeMode.LegacyHookSetWindowPos;
|
||||
Service.PrintChat("Switched to legacy size mode. Please report your use case / any bugs with the new mode to 0x0ade.");
|
||||
return;
|
||||
|
||||
case "debugsizenew":
|
||||
Service.DebugConfig.SetSizeMode = SetSizeMode.InterceptSystemConfig;
|
||||
Service.PrintChat("Switched back to new size mode.");
|
||||
Service.Plugin.IsDebug = !Service.Plugin.IsDebug;
|
||||
Service.PrintChat($"{(Service.Plugin.IsDebug ? "Enabled" : "Disabled")} cres debug.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ public class Configuration : IPluginConfiguration
|
|||
|
||||
public DXVKDWMHackMode DXVKDWMHackMode = DXVKDWMHackMode.Off;
|
||||
|
||||
public MinSizeMode MinSizeMode = MinSizeMode.Unchanged;
|
||||
|
||||
[NonSerialized]
|
||||
private IDalamudPluginInterface? pluginInterface;
|
||||
|
||||
|
@ -125,26 +123,3 @@ public static class ModifierKeyExt
|
|||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
public enum MinSizeMode
|
||||
{
|
||||
Unchanged = 0,
|
||||
Unlocked = 1
|
||||
}
|
||||
|
||||
public static class MinSizeModeExt
|
||||
{
|
||||
public static string ToHumanNameString(this MinSizeMode mode) => mode switch
|
||||
{
|
||||
MinSizeMode.Unchanged => "Unchanged (1024x768)",
|
||||
MinSizeMode.Unlocked => "Unlocked",
|
||||
_ => mode.ToString(),
|
||||
};
|
||||
|
||||
public static string? ToHumanInfoString(this MinSizeMode mode) => mode switch
|
||||
{
|
||||
MinSizeMode.Unchanged => "The game normally doesn't allow resizing to smaller than 1024x768.",
|
||||
MinSizeMode.Unlocked => "Allow resizing the game in windowed mode to smaller than 1024x768. Works best with scaling over 100%.",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
<RootNamespace>CustomResolution</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
using System;
|
||||
namespace CustomResolution;
|
||||
|
||||
/// <summary>
|
||||
/// Flags for internal testing.
|
||||
/// </summary>
|
||||
public class DebugConfiguration
|
||||
{
|
||||
public bool IsDebug { get; set; } = false;
|
||||
|
||||
public SetSizeMode SetSizeMode { get; set; } = SetSizeMode.InterceptSystemConfig;
|
||||
}
|
||||
|
||||
public enum SetSizeMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Intercept the system config width / height and scale it, but don't intercept window size sets.
|
||||
/// Has got a mild risk of growing / shrinking windows if any codepath tries to get->set the window size,
|
||||
/// most notably with other plugins trying to change the window size. You shouldn't mix and match those anyway tho...
|
||||
/// ... and even then, I'm probably the only one who's going to read this and care about this. -jade
|
||||
/// </summary>
|
||||
InterceptSystemConfig = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Legacy mode, went through more testing, works well except for the game getting confused about windowed mode size.
|
||||
/// Might revert or remove depending on how InterceptSystemConfig testing / fixups proceed.
|
||||
/// </summary>
|
||||
LegacyHookSetWindowPos = 1
|
||||
}
|
|
@ -1,8 +1,13 @@
|
|||
using Dalamud.Hooking;
|
||||
using CustomResolution.WndProcHookManagerProxyApi;
|
||||
using Dalamud.Hooking;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
|
||||
namespace CustomResolution.Hooks;
|
||||
|
||||
// THIS. IS. UGLY.
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
using Dalamud.Hooking;
|
||||
using CustomResolution.WndProcHookManagerProxyApi;
|
||||
using Dalamud.Hooking;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
|
||||
namespace CustomResolution.Hooks;
|
||||
|
||||
// THIS. IS. UGLY.
|
||||
|
@ -29,7 +34,6 @@ public sealed unsafe class WindowRectHooks : IDisposable
|
|||
public void Dispose()
|
||||
{
|
||||
_getClientRectHook.Dispose();
|
||||
_setWindowPosHook.Dispose();
|
||||
}
|
||||
|
||||
public bool GetClientRectOrig(HWND hWnd, RECT* lpRect)
|
||||
|
@ -65,10 +69,7 @@ public sealed unsafe class WindowRectHooks : IDisposable
|
|||
Service.PluginLog.Debug($"SetWindowPosDetour A @ {X} {Y} {cx} {cy}");
|
||||
#endif
|
||||
|
||||
if (Service.DebugConfig.SetSizeMode == SetSizeMode.LegacyHookSetWindowPos)
|
||||
{
|
||||
Service.Plugin.ConvertCoordsGameToWin(ref cx, ref cy);
|
||||
}
|
||||
Service.Plugin.ConvertCoordsGameToWin(ref cx, ref cy);
|
||||
|
||||
#if false
|
||||
Service.PluginLog.Debug($"SetWindowPosDetour B @ {X} {Y} {cx} {cy}");
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
using CustomResolution.WndProcHookManagerProxyApi;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using TerraFX.Interop.Windows;
|
||||
using static TerraFX.Interop.Windows.Windows;
|
||||
|
||||
|
||||
namespace CustomResolution.Hooks;
|
||||
|
||||
// THIS. IS. UGLY.
|
||||
|
@ -16,10 +17,8 @@ public sealed unsafe class WndProcHook : IDisposable
|
|||
private readonly WndProcHookManager _manager;
|
||||
|
||||
private bool _applied = false;
|
||||
private DynamicMethod? _genMethodPre;
|
||||
private Delegate? _genDelegatePre;
|
||||
private DynamicMethod? _genMethodPost;
|
||||
private Delegate? _genDelegatePost;
|
||||
private DynamicMethod? _genMethod;
|
||||
private Delegate? _genDelegate;
|
||||
|
||||
public WndProcHook()
|
||||
{
|
||||
|
@ -37,40 +36,23 @@ public sealed unsafe class WndProcHook : IDisposable
|
|||
return;
|
||||
}
|
||||
|
||||
if (_manager.PreWndProc is { } preWndProcProp)
|
||||
{
|
||||
preWndProcProp.RemoveEventHandler(_manager.ProxiedValue, _genDelegatePre);
|
||||
}
|
||||
else
|
||||
if (_manager.PreWndProc is not { } preWndProcProp)
|
||||
{
|
||||
Service.PluginLog.Information("CustomResolution couldn't obtain the PreWndProc event.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_manager.PostWndProc is { } postWndProcProp)
|
||||
{
|
||||
postWndProcProp.RemoveEventHandler(_manager.ProxiedValue, _genDelegatePost);
|
||||
}
|
||||
else
|
||||
{
|
||||
Service.PluginLog.Information("CustomResolution couldn't obtain the PostWndProc event.");
|
||||
}
|
||||
preWndProcProp.RemoveEventHandler(_manager.ProxiedValue, _genDelegate);
|
||||
|
||||
_applied = false;
|
||||
}
|
||||
|
||||
public static void InvokeStaticPre(object args)
|
||||
public static void InvokeStatic(object args)
|
||||
{
|
||||
if (_instance is { } instance)
|
||||
{
|
||||
instance.InvokePre(new WndProcEventArgs(instance._manager, args));
|
||||
}
|
||||
}
|
||||
|
||||
public static void InvokeStaticPost(object args)
|
||||
{
|
||||
if (_instance is { } instance)
|
||||
{
|
||||
instance.InvokePost(new WndProcEventArgs(instance._manager, args));
|
||||
instance.Invoke(new WndProcEventArgs(instance._manager, args));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,19 +86,13 @@ public sealed unsafe class WndProcHook : IDisposable
|
|||
return value;
|
||||
}
|
||||
|
||||
private void InvokePre(WndProcEventArgs args)
|
||||
private void Invoke(WndProcEventArgs args)
|
||||
{
|
||||
if (Service.Plugin is not { } plugin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Message == WM.WM_WINDOWPOSCHANGING &&
|
||||
Service.Config.MinSizeMode == MinSizeMode.Unlocked)
|
||||
{
|
||||
args.SuppressCall = true;
|
||||
}
|
||||
|
||||
if (args.Message == WM.WM_SIZE)
|
||||
{
|
||||
ParamToCoords(args.LParam, out int x, out int y);
|
||||
|
@ -177,14 +153,6 @@ public sealed unsafe class WndProcHook : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private void InvokePost(WndProcEventArgs args)
|
||||
{
|
||||
if (Service.Plugin is not { } plugin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply()
|
||||
{
|
||||
if (!_manager.Refresh())
|
||||
|
@ -197,56 +165,34 @@ public sealed unsafe class WndProcHook : IDisposable
|
|||
Dispose();
|
||||
}
|
||||
|
||||
if (_manager.PreWndProc is not { } preWndProcProp ||
|
||||
_manager.PostWndProc is not { } postWndProcProp)
|
||||
if (_manager.PreWndProc is not { } preWndProcProp)
|
||||
{
|
||||
Service.PluginLog.Information("CustomResolution couldn't obtain the PreWndProc / PostWndProc events.");
|
||||
Service.PluginLog.Information("CustomResolution couldn't obtain the PreWndProc event.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_genDelegatePre is null)
|
||||
if (_genDelegate is null)
|
||||
{
|
||||
var delegateType = preWndProcProp.EventHandlerType!;
|
||||
var delegateInvoke = delegateType.GetMethod("Invoke")!;
|
||||
|
||||
_genMethodPre = new DynamicMethod(
|
||||
_genMethod = new DynamicMethod(
|
||||
"CustomResolution_PreWndProc",
|
||||
delegateInvoke.ReturnType,
|
||||
delegateInvoke.GetParameters().Select(p => p.ParameterType).ToArray()
|
||||
);
|
||||
|
||||
var il = _genMethodPre.GetILGenerator();
|
||||
var il = _genMethod.GetILGenerator();
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Call, typeof(WndProcHook).GetMethod(nameof(InvokeStaticPre))!);
|
||||
il.Emit(OpCodes.Call, typeof(WndProcHook).GetMethod("InvokeStatic")!);
|
||||
il.Emit(OpCodes.Ret);
|
||||
|
||||
_genDelegatePre = _genMethodPre.CreateDelegate(delegateType);
|
||||
_genDelegate = _genMethod.CreateDelegate(delegateType);
|
||||
}
|
||||
|
||||
if (_genDelegatePost is null)
|
||||
{
|
||||
var delegateType = preWndProcProp.EventHandlerType!;
|
||||
var delegateInvoke = delegateType.GetMethod("Invoke")!;
|
||||
|
||||
_genMethodPost = new DynamicMethod(
|
||||
"CustomResolution_PostWndProc",
|
||||
delegateInvoke.ReturnType,
|
||||
delegateInvoke.GetParameters().Select(p => p.ParameterType).ToArray()
|
||||
);
|
||||
|
||||
var il = _genMethodPost.GetILGenerator();
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
il.Emit(OpCodes.Call, typeof(WndProcHook).GetMethod(nameof(InvokeStaticPost))!);
|
||||
il.Emit(OpCodes.Ret);
|
||||
|
||||
_genDelegatePost = _genMethodPost.CreateDelegate(delegateType);
|
||||
}
|
||||
|
||||
preWndProcProp.AddEventHandler(_manager.ProxiedValue, _genDelegatePre);
|
||||
postWndProcProp.AddEventHandler(_manager.ProxiedValue, _genDelegatePost);
|
||||
preWndProcProp.AddEventHandler(_manager.ProxiedValue, _genDelegate);
|
||||
|
||||
_applied = true;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Game.Config;
|
||||
using CustomResolution.Hooks;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Common.Lua;
|
||||
using FFXIVClientStructs.Interop;
|
||||
using ImGuiNET;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TerraFX.Interop.Windows;
|
||||
using static Dalamud.Interface.Utility.Raii.ImRaii;
|
||||
using static TerraFX.Interop.Windows.Windows;
|
||||
|
||||
namespace CustomResolution;
|
||||
|
@ -26,7 +30,6 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
private HWND _currentHwnd;
|
||||
private RECT _currentClientRect;
|
||||
private DXVKDWMHackMode _currentDXVKDWMHackMode = DXVKDWMHackMode.Off;
|
||||
private bool _ignoreConfigChanges = false;
|
||||
|
||||
public Plugin(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
|
@ -36,8 +39,6 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
|
||||
Service.Plugin = this;
|
||||
|
||||
Service.DebugConfig = new DebugConfiguration();
|
||||
|
||||
Service.Config = Service.PluginInterface.GetPluginConfig() as Configuration ?? new();
|
||||
Service.Config.Initialize(Service.PluginInterface);
|
||||
|
||||
|
@ -58,7 +59,6 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
}
|
||||
|
||||
Service.Framework.Update += OnFrameworkUpdate;
|
||||
Service.GameConfig.SystemChanged += OnSystemConfigChanged;
|
||||
}
|
||||
|
||||
public string Name => "CustomResolution";
|
||||
|
@ -72,6 +72,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
|
||||
public bool CurrentBorderlessFullscreen { get; private set; }
|
||||
|
||||
public bool IsDebug { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_unloading = true;
|
||||
|
@ -79,7 +81,6 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
lock (_disposeLock)
|
||||
{
|
||||
Service.Framework.Update -= OnFrameworkUpdate;
|
||||
Service.GameConfig.SystemChanged -= OnSystemConfigChanged;
|
||||
|
||||
Service.Framework.RunOnFrameworkThread(Update);
|
||||
}
|
||||
|
@ -105,8 +106,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
return;
|
||||
}
|
||||
|
||||
var scaleX = CurrentWidth / (float) CurrentWindowWidth;
|
||||
var scaleY = CurrentHeight / (float) CurrentWindowHeight;
|
||||
float scaleX = CurrentWidth / (float) CurrentWindowWidth;
|
||||
float scaleY = CurrentHeight / (float) CurrentWindowHeight;
|
||||
|
||||
x = (int) Math.Round(x * scaleX);
|
||||
y = (int) Math.Round(y * scaleY);
|
||||
|
@ -119,8 +120,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
return;
|
||||
}
|
||||
|
||||
var scaleX = CurrentWindowWidth / (float) CurrentWidth;
|
||||
var scaleY = CurrentWindowHeight / (float) CurrentHeight;
|
||||
float scaleX = CurrentWindowWidth / (float) CurrentWidth;
|
||||
float scaleY = CurrentWindowHeight / (float) CurrentHeight;
|
||||
|
||||
x = (int) Math.Round(x * scaleX);
|
||||
y = (int) Math.Round(y * scaleY);
|
||||
|
@ -133,8 +134,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
return;
|
||||
}
|
||||
|
||||
var scaleX = CurrentWidth / (float) CurrentWindowWidth;
|
||||
var scaleY = CurrentHeight / (float) CurrentWindowHeight;
|
||||
float scaleX = CurrentWidth / (float) CurrentWindowWidth;
|
||||
float scaleY = CurrentHeight / (float) CurrentWindowHeight;
|
||||
|
||||
var p = new POINT(x, y);
|
||||
|
||||
|
@ -156,8 +157,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
return;
|
||||
}
|
||||
|
||||
var scaleX = CurrentWindowWidth / (float) CurrentWidth;
|
||||
var scaleY = CurrentWindowHeight / (float) CurrentHeight;
|
||||
float scaleX = CurrentWindowWidth / (float) CurrentWidth;
|
||||
float scaleY = CurrentWindowHeight / (float) CurrentHeight;
|
||||
|
||||
var p = new POINT(x, y);
|
||||
|
||||
|
@ -185,8 +186,8 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
Service.WindowRectHooks.GetClientRectOrig(_currentHwnd, currentClientRectPtr);
|
||||
}
|
||||
|
||||
var rectWidth = _currentClientRect.right - _currentClientRect.left;
|
||||
var rectHeight = _currentClientRect.bottom - _currentClientRect.top;
|
||||
int rectWidth = _currentClientRect.right - _currentClientRect.left;
|
||||
int rectHeight = _currentClientRect.bottom - _currentClientRect.top;
|
||||
|
||||
if ((rectWidth <= 0 || rectHeight <= 0) && !_unloading)
|
||||
{
|
||||
|
@ -195,7 +196,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
|
||||
uint width, height;
|
||||
|
||||
var enabled = !_unloading && Service.Config.IsEnabled;
|
||||
bool enabled = !_unloading && Service.Config.IsEnabled;
|
||||
if (_wasEnabled != enabled)
|
||||
{
|
||||
Service.PluginLog.Info($"Changing state to: {enabled}");
|
||||
|
@ -265,15 +266,15 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
* Default windowed style / exstyle is 0x14CF0000 / 0.
|
||||
* WS.WS_VISIBLE | WS.WS_CLIPSIBLINGS | WS.WS_CAPTION | WS.WS_SYSMENU | WS.WS_THICKFRAME | WS.WS_MINIMIZEBOX | WS.WS_MAXIMIZEBOX
|
||||
*/
|
||||
var styleOrig = (uint) GetWindowLong(_currentHwnd, GWL.GWL_STYLE);
|
||||
var exstyleOrig = (uint) GetWindowLong(_currentHwnd, GWL.GWL_EXSTYLE);
|
||||
uint styleOrig = (uint) GetWindowLong(_currentHwnd, GWL.GWL_STYLE);
|
||||
uint exstyleOrig = (uint) GetWindowLong(_currentHwnd, GWL.GWL_EXSTYLE);
|
||||
|
||||
var style = styleOrig;
|
||||
var exstyle = exstyleOrig;
|
||||
uint style = styleOrig;
|
||||
uint exstyle = exstyleOrig;
|
||||
|
||||
var fullscreen = (style & WS.WS_SYSMENU) == 0;
|
||||
bool fullscreen = (style & WS.WS_SYSMENU) == 0;
|
||||
|
||||
if (Service.DebugConfig.IsDebug)
|
||||
if (IsDebug)
|
||||
{
|
||||
Service.PluginLog.Info("--------");
|
||||
Service.PluginLog.Info($"STYLE: 0x{style:X8}");
|
||||
|
@ -311,7 +312,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
exstyle &= ~(uint) WS.WS_EX_COMPOSITED;
|
||||
}
|
||||
|
||||
if (Service.DebugConfig.IsDebug)
|
||||
if (IsDebug)
|
||||
{
|
||||
Service.PluginLog.Info($"NEWSTYLE: 0x{style:X8}");
|
||||
Service.PluginLog.Info($"NEWEXSTYLE: 0x{exstyle:X8}");
|
||||
|
@ -319,7 +320,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
|
||||
if (style != styleOrig || exstyle != exstyleOrig || _currentDXVKDWMHackMode != mode)
|
||||
{
|
||||
if (Service.DebugConfig.IsDebug)
|
||||
if (IsDebug)
|
||||
{
|
||||
Service.PluginLog.Info("UPDATE");
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
SetWindowPos(_currentHwnd, HWND.NULL, 0, 0, 0, 0, SWP.SWP_NOZORDER | SWP.SWP_NOMOVE | SWP.SWP_NOSIZE | SWP.SWP_NOACTIVATE | SWP.SWP_DRAWFRAME);
|
||||
ShowWindow(_currentHwnd, SW.SW_SHOW);
|
||||
}
|
||||
else if (Service.DebugConfig.IsDebug)
|
||||
else if (IsDebug)
|
||||
{
|
||||
Service.PluginLog.Info("SAME");
|
||||
}
|
||||
|
@ -362,45 +363,4 @@ public sealed unsafe class Plugin : IDalamudPlugin
|
|||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSystemConfigChanged(object? sender, ConfigChangeEvent raw)
|
||||
{
|
||||
if (_ignoreConfigChanges)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (raw is not ConfigChangeEvent<SystemConfigOption> { } e)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.ConfigOption)
|
||||
{
|
||||
case SystemConfigOption.ScreenWidth:
|
||||
case SystemConfigOption.ScreenHeight:
|
||||
if (Service.DebugConfig.SetSizeMode == SetSizeMode.InterceptSystemConfig)
|
||||
{
|
||||
var name = e.ConfigOption.ToString();
|
||||
var valueOrig = Service.GameConfig.System.GetUInt(name);
|
||||
|
||||
var isW = e.ConfigOption == SystemConfigOption.ScreenWidth;
|
||||
var scale = (isW ? CurrentWindowWidth : CurrentWindowHeight) / (float) (isW ? CurrentWidth : CurrentHeight);
|
||||
var valueNew = (uint) Math.Round(valueOrig * scale);
|
||||
|
||||
Service.PluginLog.Info($"Intercepting config value change for {name}: {valueOrig} -> {valueNew}");
|
||||
try
|
||||
{
|
||||
_ignoreConfigChanges = true;
|
||||
Service.GameConfig.System.Set(name, valueNew);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ignoreConfigChanges = false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ public sealed class Service
|
|||
|
||||
public static Configuration Config { get; internal set; } = null!;
|
||||
|
||||
public static DebugConfiguration DebugConfig { get; internal set; } = null!;
|
||||
|
||||
public static PluginUI PluginUI { get; internal set; } = null!;
|
||||
|
||||
public static WndProcHook WndProcHook { get; internal set; } = null!;
|
||||
|
@ -44,9 +42,6 @@ public sealed class Service
|
|||
[PluginService]
|
||||
public static IKeyState KeyState { get; private set; } = null!;
|
||||
|
||||
[PluginService]
|
||||
public static IGameConfig GameConfig { get; private set; } = null!;
|
||||
|
||||
public static void PrintChat(string msg)
|
||||
{
|
||||
ChatGui.Print(new XivChatEntry
|
||||
|
|
|
@ -21,7 +21,6 @@ public class ConfigWindow : Window, IDisposable
|
|||
private float _configScale;
|
||||
private int[] _configWH = new int[2];
|
||||
private DXVKDWMHackMode _configDXVKDWMHackMode;
|
||||
private MinSizeMode _configMinSizeMode;
|
||||
|
||||
public ConfigWindow() : base(
|
||||
"CustomResolution",
|
||||
|
@ -46,7 +45,6 @@ public class ConfigWindow : Window, IDisposable
|
|||
_configWH[0] = (int) config.Width;
|
||||
_configWH[1] = (int) config.Height;
|
||||
_configDXVKDWMHackMode = config.DXVKDWMHackMode;
|
||||
_configMinSizeMode = config.MinSizeMode;
|
||||
}
|
||||
|
||||
public void UpdateToConfig()
|
||||
|
@ -61,7 +59,6 @@ public class ConfigWindow : Window, IDisposable
|
|||
config.Width = (uint) _configWH[0];
|
||||
config.Height = (uint) _configWH[1];
|
||||
config.DXVKDWMHackMode = _configDXVKDWMHackMode;
|
||||
config.MinSizeMode = _configMinSizeMode;
|
||||
|
||||
config.Save();
|
||||
}
|
||||
|
@ -185,24 +182,6 @@ Works even with the scaling above disabled.
|
|||
Not intended to be used with proper fullscreen.");
|
||||
}
|
||||
|
||||
if (ImGui.BeginCombo("Minimum window size", _configMinSizeMode.ToHumanNameString()))
|
||||
{
|
||||
foreach (var mode in Enum.GetValues<MinSizeMode>())
|
||||
{
|
||||
if (ImGui.Selectable(mode.ToHumanNameString(), _configMinSizeMode == mode, ImGuiSelectableFlags.None))
|
||||
{
|
||||
_configMinSizeMode = mode;
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered() && mode.ToHumanInfoString() is { } info)
|
||||
{
|
||||
ImGui.SetTooltip(info);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
if (ImGui.Button("Save and apply"))
|
||||
{
|
||||
save = true;
|
||||
|
|
|
@ -32,10 +32,4 @@ public readonly record struct WndProcEventArgs(WndProcHookManager WndProcHookMan
|
|||
get => (bool) WndProcHookManager.GetValue(ProxiedValue, nameof(SuppressCall))!;
|
||||
set => WndProcHookManager.SetValue(ProxiedValue, nameof(SuppressCall), value);
|
||||
}
|
||||
|
||||
public LRESULT ReturnValue
|
||||
{
|
||||
get => (LRESULT) WndProcHookManager.GetValue(ProxiedValue, nameof(ReturnValue))!;
|
||||
set => WndProcHookManager.SetValue(ProxiedValue, nameof(ReturnValue), value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ public class WndProcHookManager
|
|||
public object? ProxiedValue => _realManager;
|
||||
|
||||
public EventInfo? PreWndProc { get; private set; }
|
||||
public EventInfo? PostWndProc { get; private set; }
|
||||
|
||||
public bool Refresh()
|
||||
{
|
||||
|
@ -96,7 +95,6 @@ public class WndProcHookManager
|
|||
}
|
||||
|
||||
PreWndProc = _realManagerType.GetEvent("PreWndProc");
|
||||
PostWndProc = _realManagerType.GetEvent("PostWndProc");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -278,7 +276,6 @@ public class WndProcHookManager
|
|||
_realManagerType = default;
|
||||
|
||||
PreWndProc = default;
|
||||
PostWndProc = default;
|
||||
|
||||
ClearCache();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue