Revert "refactor(Dalamud): switch to file-scoped namespaces"

This reverts commit b5f34c3199.
This commit is contained in:
goat 2021-11-18 15:23:40 +01:00
parent d473826247
commit 1561fbac00
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5
325 changed files with 45549 additions and 45209 deletions

View file

@ -1,54 +1,57 @@
using System;
using System.Runtime.InteropServices;
namespace Dalamud.Game;
using Dalamud.Game.Internal;
/// <summary>
/// The address resolver for the <see cref="Framework"/> class.
/// </summary>
public sealed class FrameworkAddressResolver : BaseAddressResolver
namespace Dalamud.Game
{
/// <summary>
/// Gets the base address native Framework class.
/// The address resolver for the <see cref="Framework"/> class.
/// </summary>
public IntPtr BaseAddress { get; private set; }
/// <summary>
/// Gets the address for the native GuiManager class.
/// </summary>
public IntPtr GuiManager { get; private set; }
/// <summary>
/// Gets the address for the native ScriptManager class.
/// </summary>
public IntPtr ScriptManager { get; private set; }
/// <inheritdoc/>
protected override void Setup64Bit(SigScanner sig)
public sealed class FrameworkAddressResolver : BaseAddressResolver
{
this.SetupFramework(sig);
/// <summary>
/// Gets the base address native Framework class.
/// </summary>
public IntPtr BaseAddress { get; private set; }
// Xiv__Framework__GetGuiManager+8 000 mov rax, [rcx+2C00h]
// Xiv__Framework__GetGuiManager+F 000 retn
this.GuiManager = Marshal.ReadIntPtr(this.BaseAddress, 0x2C08);
/// <summary>
/// Gets the address for the native GuiManager class.
/// </summary>
public IntPtr GuiManager { get; private set; }
// Called from Framework::Init
this.ScriptManager = this.BaseAddress + 0x2C68; // note that no deref here
}
/// <summary>
/// Gets the address for the native ScriptManager class.
/// </summary>
public IntPtr ScriptManager { get; private set; }
private void SetupFramework(SigScanner scanner)
{
// Dissasembly of part of the .dtor
// 00007FF701AD665A | 48 C7 05 ?? ?? ?? ?? 00 00 00 00 | MOV QWORD PTR DS:[g_mainFramework],0
// 00007FF701AD6665 | E8 ?? ?? ?? ?? | CALL ffxiv_dx11.7FF701E27130
// 00007FF701AD666A | 48 8D ?? ?? ?? 00 00 | LEA RCX,QWORD PTR DS:[RBX + 2C38]
// 00007FF701AD6671 | E8 ?? ?? ?? ?? | CALL ffxiv_dx11.7FF701E2A7D0
// 00007FF701AD6676 | 48 8D ?? ?? ?? ?? ?? | LEA RAX,QWORD PTR DS:[7FF702C31F80
var fwDtor = scanner.ScanText("48 C7 05 ?? ?? ?? ?? 00 00 00 00 E8 ?? ?? ?? ?? 48 8D ?? ?? ?? 00 00 E8 ?? ?? ?? ?? 48 8D");
var fwOffset = Marshal.ReadInt32(fwDtor + 3);
var pFramework = scanner.ResolveRelativeAddress(fwDtor + 11, fwOffset);
/// <inheritdoc/>
protected override void Setup64Bit(SigScanner sig)
{
this.SetupFramework(sig);
// Framework does not change once initialized in startup so don't bother to deref again and again.
this.BaseAddress = Marshal.ReadIntPtr(pFramework);
// Xiv__Framework__GetGuiManager+8 000 mov rax, [rcx+2C00h]
// Xiv__Framework__GetGuiManager+F 000 retn
this.GuiManager = Marshal.ReadIntPtr(this.BaseAddress, 0x2C08);
// Called from Framework::Init
this.ScriptManager = this.BaseAddress + 0x2C68; // note that no deref here
}
private void SetupFramework(SigScanner scanner)
{
// Dissasembly of part of the .dtor
// 00007FF701AD665A | 48 C7 05 ?? ?? ?? ?? 00 00 00 00 | MOV QWORD PTR DS:[g_mainFramework],0
// 00007FF701AD6665 | E8 ?? ?? ?? ?? | CALL ffxiv_dx11.7FF701E27130
// 00007FF701AD666A | 48 8D ?? ?? ?? 00 00 | LEA RCX,QWORD PTR DS:[RBX + 2C38]
// 00007FF701AD6671 | E8 ?? ?? ?? ?? | CALL ffxiv_dx11.7FF701E2A7D0
// 00007FF701AD6676 | 48 8D ?? ?? ?? ?? ?? | LEA RAX,QWORD PTR DS:[7FF702C31F80
var fwDtor = scanner.ScanText("48 C7 05 ?? ?? ?? ?? 00 00 00 00 E8 ?? ?? ?? ?? 48 8D ?? ?? ?? 00 00 E8 ?? ?? ?? ?? 48 8D");
var fwOffset = Marshal.ReadInt32(fwDtor + 3);
var pFramework = scanner.ResolveRelativeAddress(fwDtor + 11, fwOffset);
// Framework does not change once initialized in startup so don't bother to deref again and again.
this.BaseAddress = Marshal.ReadIntPtr(pFramework);
}
}
}