MCMrARM / mcpelauncher-linux

Please note this is a legacy repository, please go to: https://github.com/minecraft-linux/mcpelauncher-manifest/wiki
GNU General Public License v3.0
310 stars 44 forks source link

Mod support #266

Open guppy42 opened 6 years ago

guppy42 commented 6 years ago

Have the support for mods been removed ?

mcpelauncher_mod.so was removed in 383daf4 along with libstdc++.so and a few others.

I repopulating libs/ i can successfully build the mod_example with ndk-build

but running it gives;

[...]
loaded MCPE (at 3921498112)
loading mods
loading: libmcpelauncher_testmod.so
linker/home/guppy42/source/mcpelauncher-linux/hybris/src/jb/linker.c:1961| ERROR:     0 could not load needed library 'libstdc++.so' for 'libmcpelauncher_testmod.so' (load_library[1112]: Library 'libstdc++.so' not found)
linker/home/guppy42/source/mcpelauncher-linux/hybris/src/jb/linker.c:2038| ERROR: failed to link libmcpelauncher_testmod.so
failed to load mod: /home/guppy42/.local/share/mcpelauncher/mods/libmcpelauncher_testmod.so
loaded 0 mods
[...]

It seems that b9845f2 stoped loading libstdc++.so

I've tried with an old libmcpelauncher_mod.so from git and creating one my self with mcpelauncher-linux/libs/mod_stub_lib/ both yield the same result

Does this mean that mod support have been removed or is there some other way it needs to be done now?

MCMrARM commented 6 years ago

I guess you'd need to figure out how to get rid of the libstdc++ dependency from the mod or add libstdc++ itself as a mod (however note that the loading order currently is random, something I'd like to improve)

guppy42 commented 6 years ago

This seems to solve the issue rather neatly;

diff --git a/src/main.cpp b/src/main.cpp
index 4029219..ef68252 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -444,6 +444,8 @@ int main(int argc, char *argv[]) {
         return -1;
     if (!load_empty_library("libmcpelauncher_mod.so"))
         return -1;
+    if (!load_empty_library("libstdc++.so"))
+        return -1;
     std::cout << "loading MCPE\n";
     std::string mcpePath = PathHelper::findDataFile("libs/libminecraftpe.so");
     void* handle = hybris_dlopen(mcpePath.c_str(), RTLD_LAZY);

Any reason not to do it ?

guppy42 commented 6 years ago

When is getGameVersionString from the mod example supposed to fire ? mod_init works fine but it seems the hijacked function is never fired

MCMrARM commented 6 years ago

Hmm, I don't know what does libstdc++ contain, but if this works I might add this patch.

MCMrARM commented 6 years ago

I'll need to investigate it later.

guppy42 commented 6 years ago

it contains everything in the "std::" namespace - such as std::string

MCMrARM commented 6 years ago

Nah, gnustl contains that.

guppy42 commented 6 years ago

shrug at any rate, the mod example you've included apparently requires it and all it uses is <iostream>

The copy I'm working on doesn't have the old libstdc++.so that used to be in this repo I guess that means it a hybris wrapper that gets loaded if that makes a difference