mcpelauncher-linux icon indicating copy to clipboard operation
mcpelauncher-linux copied to clipboard

Mod support

Open guppy42 opened this issue 7 years ago • 8 comments

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?

guppy42 avatar Dec 21 '17 21:12 guppy42

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)

MCMrARM avatar Dec 22 '17 13:12 MCMrARM

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 avatar Dec 23 '17 13:12 guppy42

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

guppy42 avatar Dec 23 '17 13:12 guppy42

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

MCMrARM avatar Dec 23 '17 13:12 MCMrARM

I'll need to investigate it later.

MCMrARM avatar Dec 23 '17 13:12 MCMrARM

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

guppy42 avatar Dec 23 '17 13:12 guppy42

Nah, gnustl contains that.

MCMrARM avatar Dec 23 '17 14:12 MCMrARM

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

guppy42 avatar Dec 23 '17 14:12 guppy42