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

Make it easier for mods to patch the same functions #5

Open
j005u opened this issue May 25, 2022 · 0 comments
Open

Make it easier for mods to patch the same functions #5

j005u opened this issue May 25, 2022 · 0 comments

Comments

@j005u
Copy link
Contributor

j005u commented May 25, 2022

The issue is that mods patching libtp1801_gui.so need to dlopen() the library, because so does dji_gls_wm150 and their lookups are scoped (with the naive method) to only the original library, therefor only the first .so overriding a specific method ever gets called.

In order to solve this we can do the following every time we search for the original function:

timeOut = dlsym (RTLD_NEXT, "_ZN19GlassRacingChnlMenu7timeOutEv");
if (timeOut == 0)
{
    timeOut = dlsym (guiLib, "_ZN19GlassRacingChnlMenu7timeOutEv");
    if (timeOut == 0)
    {
        printf("dlsym: %s\n", dlerror());
        return 0;
    }
}

This is a pain in the ass though, we should provide a convienence method via modloader somehow so that every mod doesn't need to do this manually or re-implement their own loader function. Ideally a mod wouldn't have to deal with dlopening target libraries manually either.

We could inject another .so as the very first one that provides this function, but how do we manage that dependency at build time?

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