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

Crash when calling CPlaceable::GetAtDirection() #159

Open
japajoe opened this issue Jun 11, 2023 · 0 comments
Open

Crash when calling CPlaceable::GetAtDirection() #159

japajoe opened this issue Jun 11, 2023 · 0 comments

Comments

@japajoe
Copy link

japajoe commented Jun 11, 2023

The function call in this method is incorrect and causes my application to crash:

CVector CPlaceable::GetAtDirection()
{
    return ((CVector(__thiscall *)(CPlaceable *, ))0x50E420)(this);
}

Upon inspection I noticed the method takes in a float pointer as parameter, which is then assigned in the actual method. The return type is also incorrect as it still crashes because a CVector is not returned. With the following adjustments I have managed to get it to work:

CVector CPlaceable::GetAtDirection()
{
    CVector result;
    ((void(__thiscall *)(CPlaceable *, float *))0x50E420)(this, &result.x);
    return result;
}

Also, the following 2 methods suffer from the same issue:

CPlaceable::GetRightDirection()
CPlaceable::GetTopDirection()

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

No branches or pull requests

1 participant