Skip to content

Conversation

@Haselnussbomber
Copy link

@Haselnussbomber Haselnussbomber commented Apr 18, 2025

Unfortunately, I worked on this aside from knowing nebel is working on #5.
My PR could use some testing though, as I've only tried it out on a couple NPCs.

Main changes:

  • Rewrote the FormatStringDetour:
    • Uses modern ReadOnlySeStringSpan and SeStringBuilder from using Lumina instead of Dalamuds SeString class.
    • Checks payloads and expressions instead of doing byte[] comparisons for more self-explaining code.
    • As a side-effect, this fixes a memory leak caused by the HandleName function.
  • Removes dependency on the local players GameObject by reading data from PlayerState.
  • Removes unnecessary lua function disassembly to get the pointers to PlayerState addresses.

Config window changes:

  • Added a reusable function to draw combo boxes.
  • Selected values in combo boxes are now highlighted.
  • Fixes config saving on every frame when combo boxes were open.

I formatted the whole codebase with VS, so sorry about that. You don't have to merge this if you don't want to! 🙂

Edit: Drafted. I PR’d it too early, the payloads need to be looped over recursively, which makes things a bit more difficult.

@Haselnussbomber Haselnussbomber marked this pull request as draft April 18, 2025 12:12
@Haselnussbomber

This comment was marked as outdated.

@Haselnussbomber
Copy link
Author

Haselnussbomber commented Apr 18, 2025

I just checked the current HandleName function again and it turns out PrefPro never supported replacing names in expressions to begin with. It compares full payloads with the byte[]s.

For example the name in quest/014/GaiUsd017_01412 Row 55 wouldn't be modified:

<if([gnum52>0],<split(<string(gstr1)>, ,1)> of the Scions,<if([gnum53>0],<head(<if([gnum52>0],<sheet(GCRankLimsaMaleText,gnum52,8)>,)><if([gnum53>0],<sheet(GCRankGridaniaMaleText,gnum53,8)>,)><if([gnum54>0],<sheet(GCRankUldahMaleText,gnum54,8)>,)>)> <split(<string(gstr1)>, ,2)>,<split(<string(gstr1)>, ,1)> of the Scions)>)>, glad I am to see you. I assume you have been apprised of the situation regarding the moogle monarch?

@Haselnussbomber Haselnussbomber marked this pull request as ready for review April 18, 2025 16:17
@perchbirdd
Copy link
Owner

Thank you Hassel, I incorporated the compatible changes from your branch with Nebel's adjustments and modular hooks. Thank you!

@perchbirdd perchbirdd closed this Aug 8, 2025
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