Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddonLifecycle Performance Enhancement #1834

Merged
merged 4 commits into from
Jun 21, 2024
Merged

AddonLifecycle Performance Enhancement #1834

merged 4 commits into from
Jun 21, 2024

Conversation

MidoriKami
Copy link
Contributor

Per Aers' somewhat obvious question in hindsight... ("Why do you need to hook it before its requested?"), I have tweaked it slightly to instead store the address of the ReceiveEvent function, and now only hooks it when it is requested by someone.

@MidoriKami MidoriKami requested a review from a team as a code owner June 11, 2024 04:39
@MidoriKami MidoriKami marked this pull request as draft June 11, 2024 04:41
@MidoriKami
Copy link
Contributor Author

Marked as draft for now, as FFXIV is currently down for All Worlds Maintenance.

@MidoriKami MidoriKami marked this pull request as ready for review June 12, 2024 00:29
@MidoriKami
Copy link
Contributor Author

Ready for merge, tested and verified working.

ffxiv_dx11_ycd10wbrXL.mp4

This should also help mitigate an issue reported on Linux with reloaded causing noticeable game lag, as hooks will only be generated when requested by a plugin.

Comment on lines 67 to 68
this.AddonOnRefresh = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 41 8B F8 48 8B DA");
this.AtkEventListener = sig.GetStaticAddressFromSig("4C 8D 3D ?? ?? ?? ?? 49 8D 8E");
this.AtkUnitBase = (AtkUnitBase*)sig.GetStaticAddressFromSig("48 8D 05 ?? ?? ?? ?? 48 89 01 48 8D 05 ?? ?? ?? ?? 4C 89 41 28");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these sigs be moved to CS proper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The callsite sigs can not, as those are for very specific code points.

AddonOnRequestedUpdate is likely already in clientstructs. It's one of the virtual functions for AtkUnitManager.

AtkUnitBase's vtable might already be in clientstructs now that I think about it.

Copy link
Contributor Author

@MidoriKami MidoriKami Jun 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem that clientstructs has a address for AtkUnitBase's vtable from what I can tell. I'll see about switching requestedupdate, but I think that's the most I can do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was only able to remove AtkUnitBase, the only other one we can remove is OnRefresh, but currently ClientStructs has the wrong function signature, and that will cause issues, so it's on hold for now.

@MidoriKami
Copy link
Contributor Author

MidoriKami commented Jun 17, 2024

aers/FFXIVClientStructs#926 has been merged into ClientStructs

When this updated ClientStructs is merged into Dalamud, I can remove the AddonOnRefresh sig

@KazWolfe KazWolfe merged commit 69d5b1f into goatcorp:apiX Jun 21, 2024
2 of 3 checks passed
@MidoriKami MidoriKami deleted the AddonLifecycle_PerformanceEnhancement branch June 21, 2024 22:34
KazWolfe added a commit that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants