AshitaXI / Ashita

Issue tracker and wiki for the Ashita project.
https://ashitaxi.com/
7 stars 1 forks source link

[BUG] Resource Parser For Action Messages Yields Bad Strings #21

Closed atom0s closed 2 years ago

atom0s commented 2 years ago

Ashita Version (Type /ashita in-game to get this.)

FFXI Version (Type /version in-game to get this.)

Windows Version (ie. Start > About Your PC)

Describe The Bug

Requesting action.messages strings from the ResourceManager yields bad results. The string lengths are being incorrectly handled if the string contains a mid-string null terminator which can happen on some tokenized entries.

Steps To Reproduce

Request string '1' from action.messages

Screenshots

Additional Information

This issue will potentially spill over to any other string DAT being parsed that contains tokenized entries with a 00 value in the token(s). Easy fix though, will get to it soon.

atom0s commented 2 years ago

This is now fixed and will be in the next beta update.

Some notes on this, the internal cache is still going to return the same pointers for the strings as before. (via IResourceManager::GetString) These strings can be early-null-terminated based on custom tokenization that the client uses. Two new methods have been added to account for this: IResourceManager::GetStringLength which will let you query for a strings true length. You can then use the returned string pointer and this length to do any real processing on the string pointer as needed.

Addons has also been adjusted/updated to account for this change. When using GetString from an addon, the plugin will now return a raw string literal instead of a general string. This will now include the full string and not just up to the first null terminator. GetStringLength is now also exposed to addons.