2024-02-14 00:05:07 +01:00
|
|
|
|
using Dalamud.Configuration;
|
|
|
|
|
using Dalamud.Plugin;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace CustomResolution;
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class Configuration : IPluginConfiguration
|
|
|
|
|
{
|
|
|
|
|
public int Version { get; set; } = 0;
|
|
|
|
|
|
2024-02-18 22:48:02 +01:00
|
|
|
|
public bool IsEnabled = true;
|
2024-02-14 00:05:07 +01:00
|
|
|
|
public bool IsScale = true;
|
|
|
|
|
public float Scale = 1f;
|
|
|
|
|
public uint Width = 1024;
|
|
|
|
|
public uint Height = 1024;
|
|
|
|
|
|
2024-03-16 21:29:16 +01:00
|
|
|
|
public DXVKDWMHackMode DXVKDWMHackMode = DXVKDWMHackMode.Off;
|
2024-03-16 15:24:19 +01:00
|
|
|
|
|
2024-02-14 00:05:07 +01:00
|
|
|
|
[NonSerialized]
|
2024-07-01 01:33:11 +02:00
|
|
|
|
private IDalamudPluginInterface? pluginInterface;
|
2024-02-14 00:05:07 +01:00
|
|
|
|
|
2024-07-01 01:33:11 +02:00
|
|
|
|
internal void Initialize(IDalamudPluginInterface pluginInterface)
|
2024-02-14 00:05:07 +01:00
|
|
|
|
{
|
|
|
|
|
this.pluginInterface = pluginInterface;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
{
|
|
|
|
|
pluginInterface!.SavePluginConfig(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-16 21:29:16 +01:00
|
|
|
|
|
|
|
|
|
// Must explicitly map to integer values, blame Newtonsoft.JSON
|
|
|
|
|
public enum DXVKDWMHackMode
|
|
|
|
|
{
|
|
|
|
|
Off = 0,
|
|
|
|
|
UnsetPopup = 1,
|
2024-03-16 21:57:27 +01:00
|
|
|
|
SetClientEdgeResize = 3,
|
|
|
|
|
SetClientEdgeBorder = 2,
|
2024-03-16 21:29:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class DXVKDWMHackModeExt
|
|
|
|
|
{
|
|
|
|
|
public static string ToHumanNameString(this DXVKDWMHackMode mode) => mode switch
|
|
|
|
|
{
|
|
|
|
|
DXVKDWMHackMode.Off => "Off",
|
2024-03-16 21:37:50 +01:00
|
|
|
|
DXVKDWMHackMode.UnsetPopup => "Best: -WS_POPUP",
|
2024-03-16 21:57:27 +01:00
|
|
|
|
DXVKDWMHackMode.SetClientEdgeResize => "+WS_EX_CLIENTEDGE (resize)",
|
|
|
|
|
DXVKDWMHackMode.SetClientEdgeBorder => "+WS_EX_CLIENTEDGE (border)",
|
2024-03-16 21:29:16 +01:00
|
|
|
|
_ => mode.ToString(),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static string? ToHumanInfoString(this DXVKDWMHackMode mode) => mode switch
|
|
|
|
|
{
|
2024-03-16 21:57:27 +01:00
|
|
|
|
DXVKDWMHackMode.UnsetPopup => "Least intrusive option, try this first.\nWorks best with NVIDIA GPUs.",
|
|
|
|
|
DXVKDWMHackMode.SetClientEdgeResize => "Extends the game window 1 pixel to the bottom.\nDon't use if it makes text look blurry!",
|
|
|
|
|
DXVKDWMHackMode.SetClientEdgeBorder => "Adds a 1 pixel border around the game.",
|
2024-03-16 21:29:16 +01:00
|
|
|
|
_ => null
|
|
|
|
|
};
|
2024-03-16 21:57:27 +01:00
|
|
|
|
|
|
|
|
|
public static bool IsUnsetPopup(this DXVKDWMHackMode mode) => mode == DXVKDWMHackMode.UnsetPopup;
|
|
|
|
|
|
|
|
|
|
public static bool IsSetClientEdge(this DXVKDWMHackMode mode) => mode switch
|
|
|
|
|
{
|
|
|
|
|
DXVKDWMHackMode.SetClientEdgeResize => true,
|
|
|
|
|
DXVKDWMHackMode.SetClientEdgeBorder => true,
|
|
|
|
|
_ => false
|
|
|
|
|
};
|
2024-03-16 21:29:16 +01:00
|
|
|
|
}
|