Skip to content

Commit

Permalink
Disable NativeBridge hooking in Riru module
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimjio committed Aug 11, 2022
1 parent d11f87c commit f343086
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions module/src/main/cpp/main_riru.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <riru.h>
#include <config.hpp>

string moduleApi = "riru";

static void specializeAppProcessPre(
JNIEnv *env, jclass clazz, jint *uid, jint *gid, jintArray *gids, jint *runtimeFlags,
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
Expand Down Expand Up @@ -72,7 +74,7 @@ RiruVersionedModuleInfo *init(Riru *riru) {
}
}

[[gnu::visibility("default")]] [[gnu::used]]
/*[[gnu::visibility("default")]] [[gnu::used]]
static void hook() __attribute__((constructor));
void hook() {
Expand All @@ -95,4 +97,4 @@ void hook() {
LOGE("can't create thread: %s\n", strerror(ret));
}
}
}
}*/
2 changes: 2 additions & 0 deletions module/src/main/cpp/main_zygisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using zygisk::ServerSpecializeArgs;

using namespace std;

string moduleApi = "zygisk";

class Module : public zygisk::ModuleBase {
public:
void onLoad(Api *api, JNIEnv *env) override {
Expand Down
7 changes: 7 additions & 0 deletions module/src/main/cpp/stdinclude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ struct ReplaceAsset {

using namespace std;

extern string moduleApi;

extern bool g_enable_logger;
extern int g_max_fps;
extern float g_ui_animation_scale;
Expand Down Expand Up @@ -77,6 +79,7 @@ extern int g_graphics_quality;
extern int g_anti_aliasing;
extern bool g_force_landscape;
extern float g_force_landscape_ui_scale;
extern bool g_ui_loading_show_orientation_guide;
extern std::unordered_map<std::string, ReplaceAsset> g_replace_assets;

namespace {
Expand All @@ -96,6 +99,10 @@ namespace {
}

bool IsABIRequiredNativeBridge() {
if (moduleApi == "riru"s) {
// Riru is a NativeBridge, so you can`t use other NativeBridge (ex. houdini).
return false;
}
return ABI == "x86"s || ABI == "x86_64"s;
}

Expand Down

0 comments on commit f343086

Please sign in to comment.