just-ero / asl-help

Helper library for LiveSplit's auto splitting language with special features for certain game engines.
GNU General Public License v3.0
5 stars 7 forks source link

[Bug]: Unreal helper reading FName names incorrectly #7

Open samontenegro opened 2 years ago

samontenegro commented 2 years ago

What helper class does this issue occur on?

Unreal

Description

The following issue was discovered when attempting to use the Unreal helper with Scorn. @just-ero and I recently observed that when trying to read FName names from the FName pool, the strings being read appear to be offset by 6 bytes which causes an over-read, resulting in mangled names which, in turn, cannot be converted into valid identifiers.

While the objects are (apparently) identified correctly, given that addresses do show up under ue.UObjects, not having proper names makes them unreachable through Make<T>.

Reproduction Steps

state("Scorn-Win64-Shipping") {}

startup
{
    Assembly.Load(File.ReadAllBytes(@"Components/asl-help")).CreateInstance("Unreal");
}

init
{

    vars.Helper.TryLoad = (Func<dynamic, bool>)(ue =>
    {   
        int counter = 0;
        foreach (var obj in ue.UObjects) {
            if (counter > 40) break;
            vars.Log(obj.Address);
            vars.Log(obj.ToString() == null);
            counter++;
        }

        return true;
    });
}

Error Messages

None

Regression?

See potential causes and fixes

Potential Causes and Fixes

While this could potentially be a knock-on from a recent change to fix an AOB scan error (GUObjectArray signature could not be resolved), we don't have confirmation yet.

In addition, this could also be caused by some struct alignment problems.