Add call-on-services-ready attribute for service methods, and fix scene nullability (#900)

This commit is contained in:
kizer 2022-06-27 01:49:34 +09:00 committed by GitHub
parent 5809accf5d
commit 3369f569fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 274 additions and 273 deletions

View file

@ -9,7 +9,7 @@ namespace Dalamud.Game.Internal
/// This class disables anti-debug functionality in the game client.
/// </summary>
[ServiceManager.EarlyLoadedService]
internal sealed partial class AntiDebug
internal sealed partial class AntiDebug : IServiceType
{
private readonly byte[] nop = new byte[] { 0x31, 0xC0, 0x90, 0x90, 0x90, 0x90 };
private byte[] original;

View file

@ -24,7 +24,7 @@ namespace Dalamud.Game.Internal
/// This class implements in-game Dalamud options in the in-game System menu.
/// </summary>
[ServiceManager.EarlyLoadedService]
internal sealed unsafe partial class DalamudAtkTweaks
internal sealed unsafe partial class DalamudAtkTweaks : IServiceType
{
private readonly AtkValueChangeType atkValueChangeType;
private readonly AtkValueSetString atkValueSetString;
@ -39,7 +39,7 @@ namespace Dalamud.Game.Internal
private readonly string locDalamudSettings;
[ServiceManager.ServiceConstructor]
private DalamudAtkTweaks(SigScanner sigScanner)
private DalamudAtkTweaks(SigScanner sigScanner, ContextMenu contextMenu)
{
var openSystemMenuAddress = sigScanner.ScanText("E8 ?? ?? ?? ?? 32 C0 4C 8B AC 24 ?? ?? ?? ?? 48 8B 8D ?? ?? ?? ??");
@ -60,10 +60,7 @@ namespace Dalamud.Game.Internal
this.locDalamudPlugins = Loc.Localize("SystemMenuPlugins", "Dalamud Plugins");
this.locDalamudSettings = Loc.Localize("SystemMenuSettings", "Dalamud Settings");
var contextMenu = Service<ContextMenu>.Get();
contextMenu.ContextMenuOpened += this.ContextMenuOnContextMenuOpened;
this.Enable();
}
private delegate void AgentHudOpenSystemMenuPrototype(void* thisPtr, AtkValue* atkValueArgs, uint menuSize);
@ -76,10 +73,8 @@ namespace Dalamud.Game.Internal
private delegate IntPtr AtkUnitBaseReceiveGlobalEvent(AtkUnitBase* thisPtr, ushort cmd, uint a3, IntPtr a4, uint* a5);
/// <summary>
/// Enables the <see cref="DalamudAtkTweaks"/>.
/// </summary>
public void Enable()
[ServiceManager.CallWhenServicesReady]
private void ContinueConstruction(DalamudInterface dalamudInterface)
{
this.hookAgentHudOpenSystemMenu.Enable();
this.hookUiModuleRequestMainCommand.Enable();