mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Merge branch 'master' of https://github.com/goaaats/Dalamud
This commit is contained in:
commit
2980b9f9dc
9 changed files with 49 additions and 17 deletions
|
|
@ -14,10 +14,10 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Feature">
|
<PropertyGroup Label="Feature">
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>4.7.9.0</AssemblyVersion>
|
<AssemblyVersion>4.7.10.0</AssemblyVersion>
|
||||||
<FileVersion>4.7.9.0</FileVersion>
|
<FileVersion>4.7.10.0</FileVersion>
|
||||||
<Description>XIVLauncher addon injection</Description>
|
<Description>XIVLauncher addon injection</Description>
|
||||||
<Version>4.7.9.0</Version>
|
<Version>4.7.10.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile></DocumentationFile>
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Feature">
|
<PropertyGroup Label="Feature">
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>4.7.9.0</AssemblyVersion>
|
<AssemblyVersion>4.7.10.0</AssemblyVersion>
|
||||||
<Version>4.7.9.0</Version>
|
<Version>4.7.10.0</Version>
|
||||||
<FileVersion>4.7.9.0</FileVersion>
|
<FileVersion>4.7.10.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="Resources">
|
<ItemGroup Label="Resources">
|
||||||
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
|
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@ using System;
|
||||||
namespace Dalamud.Game.Internal.DXGI {
|
namespace Dalamud.Game.Internal.DXGI {
|
||||||
public interface ISwapChainAddressResolver {
|
public interface ISwapChainAddressResolver {
|
||||||
IntPtr Present { get; set; }
|
IntPtr Present { get; set; }
|
||||||
|
IntPtr ResizeBuffers { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace Dalamud.Game.Internal.DXGI
|
||||||
public sealed class SwapChainSigResolver : BaseAddressResolver, ISwapChainAddressResolver
|
public sealed class SwapChainSigResolver : BaseAddressResolver, ISwapChainAddressResolver
|
||||||
{
|
{
|
||||||
public IntPtr Present { get; set; }
|
public IntPtr Present { get; set; }
|
||||||
//public IntPtr ResizeBuffers { get; private set; }
|
public IntPtr ResizeBuffers { get; set; }
|
||||||
|
|
||||||
protected override void Setup64Bit(SigScanner sig)
|
protected override void Setup64Bit(SigScanner sig)
|
||||||
{
|
{
|
||||||
|
|
@ -24,9 +24,7 @@ namespace Dalamud.Game.Internal.DXGI
|
||||||
// This(code after the function head - offset of it) was picked to avoid running into issues with other hooks being installed into this function.
|
// This(code after the function head - offset of it) was picked to avoid running into issues with other hooks being installed into this function.
|
||||||
Present = scanner.ScanModule("41 8B F0 8B FA 89 54 24 ?? 48 8B D9 48 89 4D ?? C6 44 24 ?? 00") - 0x37;
|
Present = scanner.ScanModule("41 8B F0 8B FA 89 54 24 ?? 48 8B D9 48 89 4D ?? C6 44 24 ?? 00") - 0x37;
|
||||||
|
|
||||||
|
ResizeBuffers = scanner.ScanModule("48 8B C4 55 41 54 41 55 41 56 41 57 48 8D 68 ?? 48 81 EC C0 00 00 00");
|
||||||
// seems unnecessary for now, but we may need to handle it
|
|
||||||
//ResizeBuffers = scanner.ScanModule("48 8B C4 55 41 54 41 55 41 56 41 57 48 8D 68 ?? 48 81 EC C0 00 00 00");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ namespace Dalamud.Game.Internal.DXGI
|
||||||
#region Addresses
|
#region Addresses
|
||||||
|
|
||||||
public IntPtr Present { get; set; }
|
public IntPtr Present { get; set; }
|
||||||
|
public IntPtr ResizeBuffers { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -93,6 +94,7 @@ namespace Dalamud.Game.Internal.DXGI
|
||||||
}
|
}
|
||||||
|
|
||||||
Present = this.dxgiSwapChainVTblAddresses[8];
|
Present = this.dxgiSwapChainVTblAddresses[8];
|
||||||
|
ResizeBuffers = this.dxgiSwapChainVTblAddresses[13];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Dalamud.Game.Network {
|
||||||
var notifyType = data[16];
|
var notifyType = data[16];
|
||||||
var contentFinderConditionId = BitConverter.ToUInt16(data, 36);
|
var contentFinderConditionId = BitConverter.ToUInt16(data, 36);
|
||||||
|
|
||||||
if (notifyType != 3 || contentFinderConditionId == 0)
|
if (notifyType != 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var contentFinderCondition = this.dalamud.Data.GetExcelSheet<ContentFinderCondition>().GetRow(contentFinderConditionId);
|
var contentFinderCondition = this.dalamud.Data.GetExcelSheet<ContentFinderCondition>().GetRow(contentFinderConditionId);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,11 @@ namespace Dalamud.Interface
|
||||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||||
private delegate IntPtr PresentDelegate(IntPtr swapChain, uint syncInterval, uint presentFlags);
|
private delegate IntPtr PresentDelegate(IntPtr swapChain, uint syncInterval, uint presentFlags);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||||
|
private delegate IntPtr ResizeBuffersDelegate(IntPtr swapChain, uint bufferCount, uint width, uint height, uint newFormat, uint swapChainFlags);
|
||||||
|
|
||||||
private readonly Hook<PresentDelegate> presentHook;
|
private readonly Hook<PresentDelegate> presentHook;
|
||||||
|
private readonly Hook<ResizeBuffersDelegate> resizeBuffersHook;
|
||||||
|
|
||||||
private readonly Hook<SetCursorDelegate> setCursorHook;
|
private readonly Hook<SetCursorDelegate> setCursorHook;
|
||||||
|
|
||||||
|
|
@ -73,6 +77,7 @@ namespace Dalamud.Interface
|
||||||
Log.Verbose("===== S W A P C H A I N =====");
|
Log.Verbose("===== S W A P C H A I N =====");
|
||||||
Log.Verbose("SetCursor address {SetCursor}", setCursorAddr);
|
Log.Verbose("SetCursor address {SetCursor}", setCursorAddr);
|
||||||
Log.Verbose("Present address {Present}", Address.Present);
|
Log.Verbose("Present address {Present}", Address.Present);
|
||||||
|
Log.Verbose("ResizeBuffers address {ResizeBuffers}", Address.ResizeBuffers);
|
||||||
|
|
||||||
this.setCursorHook = new Hook<SetCursorDelegate>(setCursorAddr, new SetCursorDelegate(SetCursorDetour), this);
|
this.setCursorHook = new Hook<SetCursorDelegate>(setCursorAddr, new SetCursorDelegate(SetCursorDetour), this);
|
||||||
|
|
||||||
|
|
@ -80,18 +85,25 @@ namespace Dalamud.Interface
|
||||||
new Hook<PresentDelegate>(Address.Present,
|
new Hook<PresentDelegate>(Address.Present,
|
||||||
new PresentDelegate(PresentDetour),
|
new PresentDelegate(PresentDetour),
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
this.resizeBuffersHook =
|
||||||
|
new Hook<ResizeBuffersDelegate>(Address.ResizeBuffers,
|
||||||
|
new ResizeBuffersDelegate(ResizeBuffersDetour),
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Enable()
|
public void Enable()
|
||||||
{
|
{
|
||||||
this.setCursorHook.Enable();
|
this.setCursorHook.Enable();
|
||||||
this.presentHook.Enable();
|
this.presentHook.Enable();
|
||||||
|
this.resizeBuffersHook.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Disable()
|
private void Disable()
|
||||||
{
|
{
|
||||||
this.setCursorHook.Disable();
|
this.setCursorHook.Disable();
|
||||||
this.presentHook.Disable();
|
this.presentHook.Disable();
|
||||||
|
this.resizeBuffersHook.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -107,6 +119,7 @@ namespace Dalamud.Interface
|
||||||
|
|
||||||
this.scene.Dispose();
|
this.scene.Dispose();
|
||||||
this.presentHook.Dispose();
|
this.presentHook.Dispose();
|
||||||
|
this.resizeBuffersHook.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureWrap LoadImage(string filePath)
|
public TextureWrap LoadImage(string filePath)
|
||||||
|
|
@ -182,6 +195,23 @@ namespace Dalamud.Interface
|
||||||
return this.presentHook.Original(swapChain, syncInterval, presentFlags);
|
return this.presentHook.Original(swapChain, syncInterval, presentFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IntPtr ResizeBuffersDetour(IntPtr swapChain, uint bufferCount, uint width, uint height, uint newFormat, uint swapChainFlags)
|
||||||
|
{
|
||||||
|
Log.Verbose($"Calling resizebuffers {bufferCount} {width} {height} {newFormat} {swapChainFlags}");
|
||||||
|
|
||||||
|
this.scene?.OnPreResize();
|
||||||
|
|
||||||
|
var ret = this.resizeBuffersHook.Original(swapChain, bufferCount, width, height, newFormat, swapChainFlags);
|
||||||
|
if (ret.ToInt64() == 0x887A0001)
|
||||||
|
{
|
||||||
|
Log.Error("invalid call to resizeBuffers");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.scene?.OnPostResize((int)width, (int)height);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// can't access imgui IO before first present call
|
// can't access imgui IO before first present call
|
||||||
private bool lastWantCapture = false;
|
private bool lastWantCapture = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,15 @@ namespace Dalamud.Plugin
|
||||||
if (this.dalamud.Configuration.PluginConfigurations == null)
|
if (this.dalamud.Configuration.PluginConfigurations == null)
|
||||||
this.dalamud.Configuration.PluginConfigurations = new Dictionary<string, object>();
|
this.dalamud.Configuration.PluginConfigurations = new Dictionary<string, object>();
|
||||||
|
|
||||||
if (this.dalamud.Configuration.PluginConfigurations.ContainsKey(this.pluginName)) {
|
|
||||||
this.dalamud.Configuration.PluginConfigurations[this.pluginName] = currentConfig;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentConfig == null)
|
if (currentConfig == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.dalamud.Configuration.PluginConfigurations.ContainsKey(this.pluginName)) {
|
||||||
|
this.dalamud.Configuration.PluginConfigurations[this.pluginName] = currentConfig;
|
||||||
|
this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.dalamud.Configuration.PluginConfigurations.Add(this.pluginName, currentConfig);
|
this.dalamud.Configuration.PluginConfigurations.Add(this.pluginName, currentConfig);
|
||||||
this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath);
|
this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit cd24a6108c05e52b0dde80e85ff1f9fa812f631b
|
Subproject commit 9687dbf41f89aa5cff5b2b179fc9e238260c9509
|
||||||
Loading…
Add table
Add a link
Reference in a new issue