Skip to content

Commit 1b8044b

Browse files
authored
Fix High-Res Screenshots tweak (Caraxi#814)
1 parent f41992c commit 1b8044b

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

SimpleTweaksPlugin.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
<Compile Remove="Tweaks\FixedShadowDistance.cs"/>
3939
<Compile Remove="Tweaks\FurnitureClocksCustomTime.cs"/>
4040
<Compile Remove="Tweaks\GearsetSaveCurrent.cs"/>
41-
<Compile Remove="Tweaks\HighResScreenshots.cs"/>
4241
<Compile Remove="Tweaks\HouseLightCommand.cs"/>
4342
<Compile Remove="Tweaks\JokeTweaks.cs"/>
4443
<Compile Remove="Tweaks\KeyInterrupt.cs"/>

Tweaks/HighResScreenshots.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Dalamud.Interface.Utility;
77
using Dalamud.Memory;
88
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
9-
using FFXIVClientStructs.FFXIV.Client.UI;
109
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
10+
using FFXIVClientStructs.FFXIV.Component.GUI;
1111
using ImGuiNET;
1212
using SimpleTweaksPlugin.Debugging;
1313
using SimpleTweaksPlugin.TweakSystem;
@@ -17,11 +17,10 @@
1717
namespace SimpleTweaksPlugin.Tweaks;
1818

1919
[Changelog("1.9.7.1", "Re-added 'Use ReShade' option")]
20+
[TweakName("Screenshot Improvements")]
21+
[TweakDescription("Allows taking higher resolution screenshots, Hiding Dalamud & Game UIs and removing the copyright notice from screenshots.")]
22+
[TweakAuthor("NotNite")]
2023
public unsafe class HighResScreenshots : Tweak {
21-
public override string Name => "Screenshot Improvements";
22-
public override string Description => "Allows taking higher resolution screenshots, Hiding Dalamud & Game UIs and removing the copyright notice from screenshots.";
23-
protected override string Author => "NotNite";
24-
2524
private nint copyrightShaderAddress;
2625

2726
public class Configs : TweakConfig {
@@ -53,7 +52,7 @@ public class Configs : TweakConfig {
5352

5453
private bool updatingReShadeKeybind = false;
5554

56-
protected override DrawConfigDelegate DrawConfigTree => (ref bool hasChanged) => {
55+
protected void DrawConfig(ref bool hasChanged) {
5756
ImGui.TextWrapped(
5857
"This tweak will increase the resolution of screenshots taken in game. It will NOT increase the scale of your HUD/plugin windows.");
5958
ImGui.TextWrapped("Your HUD will appear smaller while the screenshot is processing.");
@@ -145,9 +144,9 @@ public class Configs : TweakConfig {
145144
ImGui.Unindent();
146145
ImGui.Unindent();
147146
}
148-
};
147+
}
149148

150-
public override void Setup() {
149+
protected override void Setup() {
151150
AddChangelogNewTweak("1.8.2.0");
152151
AddChangelog("1.8.3.0", "Added option to hide dalamud UI for screenshot.");
153152
AddChangelog("1.8.5.0", "Added option to hide game UI for screenshots.");
@@ -160,12 +159,12 @@ public override void Setup() {
160159
protected override void Enable() {
161160
Config = LoadConfig<Configs>() ?? new Configs();
162161

163-
if (!Service.SigScanner.TryScanText("49 8B 57 30 45 33 C9", out copyrightShaderAddress)) {
162+
if (!Service.SigScanner.TryScanText("48 8B 57 ?? 45 33 C9 48 8B 06 45 33 C0 48 8B CE 48 8B 52 ?? FF 50 ?? 48 8B 06 4C 8D 4C 24", out copyrightShaderAddress)) {
164163
copyrightShaderAddress = 0;
165164
}
166-
165+
167166
isInputIDClickedHook ??=
168-
Common.Hook<IsInputIDClickedDelegate>("E9 ?? ?? ?? ?? 83 7F 44 02", IsInputIDClickedDetour);
167+
Common.Hook<IsInputIDClickedDelegate>("E9 ?? ?? ?? ?? 83 7F ?? ?? 0F 8F ?? ?? ?? ?? BA ?? ?? ?? ?? 48 8B CB", IsInputIDClickedDetour);
169168
isInputIDClickedHook?.Enable();
170169

171170
base.Enable();
@@ -176,7 +175,7 @@ protected override void Enable() {
176175
private uint oldHeight;
177176
private bool isRunning;
178177

179-
const int ScreenshotButton = 543;
178+
const int ScreenshotButton = 546;
180179
public bool originalUiVisibility;
181180
byte[] originalCopyrightBytes = null;
182181
// IsInputIDClicked is called from Client::UI::UIInputModule.CheckScreenshotState, which is polled
@@ -212,8 +211,8 @@ private byte IsInputIDClickedDetour(nint a1, int a2) {
212211

213212

214213
if (Config.HideGameUi) {
215-
var raptureAtkModule = Framework.Instance()->GetUiModule()->GetRaptureAtkModule();
216-
originalUiVisibility = !raptureAtkModule->RaptureAtkUnitManager.Flags.HasFlag(RaptureAtkModuleFlags.UiHidden);
214+
var raptureAtkModule = Framework.Instance()->GetUIModule()->GetRaptureAtkModule();
215+
originalUiVisibility = !raptureAtkModule->RaptureAtkUnitManager.Flags.HasFlag(AtkUnitManagerFlags.UiHidden);
217216
if (originalUiVisibility) {
218217
raptureAtkModule->SetUiVisibility(false);
219218
}
@@ -238,8 +237,8 @@ private byte IsInputIDClickedDetour(nint a1, int a2) {
238237
Service.Framework.RunOnTick(() => {
239238
UIDebug.FreeExclusiveDraw();
240239
if (Config.HideGameUi) {
241-
var raptureAtkModule = Framework.Instance()->GetUiModule()->GetRaptureAtkModule();
242-
if (originalUiVisibility && raptureAtkModule->RaptureAtkUnitManager.Flags.HasFlag(RaptureAtkModuleFlags.UiHidden)) {
240+
var raptureAtkModule = Framework.Instance()->GetUIModule()->GetRaptureAtkModule();
241+
if (originalUiVisibility && raptureAtkModule->RaptureAtkUnitManager.Flags.HasFlag(AtkUnitManagerFlags.UiHidden)) {
243242
raptureAtkModule->SetUiVisibility(true);
244243
}
245244
}

0 commit comments

Comments
 (0)