Tutorial How to Create Zygisk MOD Menu

Tested on android 13 S23 Ultra. A pretty good injector, seems like its only issue is screen zoom when opening the game for some reason. It seems like the phone is auto adjusting opened activities.
 
idk.
I made a branch and reset it to the active repo one. Keep everything as is, except the packageName to inject.
(To be sure there isn't anything completely stupid I did). But can still be the reason why it is not working.

I also can't find anything else in the logs. Tested to install another module it worked :7
I bet I forgot something -.-
ok, now I downgraded to Magisk 26.1 Zygisk enabled:

1698018431762.png
1698018501686.png



1698018560202.png
 
Could be device compatibility issues. Most likely fixable through build.gradle. modify it. But there is a major issue with this injector anyway, I tested it on 2 phones and it seems to be messing with the activity and zooming on the screen for some reason.
 
idk.
I made a branch and reset it to the active repo one. Keep everything as is, except the packageName to inject.
(To be sure there isn't anything completely stupid I did). But can still be the reason why it is not working.

I also can't find anything else in the logs. Tested to install another module it worked :7
I bet I forgot something -.-
ok, now I downgraded to Magisk 26.1 Zygisk enabled:

...

Ok, The first failing tries are compiled with my windows pc. Now used my mac at same codebase and same settings and now it worked :/
Don't know wrong zip? Another logic of cmake?

If I tried to copy the files to my windows, its becomes removed by windows defender. lol Maybe it doesn't like the injection-logic?
 
I have one more question.

When I attempt to locate my game, it doesn't get hooked into the system. Upon starting, I see the following message: 'appDataDir: /data/user/0/com.samsung.android.app.galaxyfinder' instead of the package name. Can games avoid being found in this location?

The app info indicates that the data is stored in /data/user/0/com.mygame, but it does not appear to be the case.
 
I have one more question.

When I attempt to locate my game, it doesn't get hooked into the system. Upon starting, I see the following message: 'appDataDir: /data/user/0/com.samsung.android.app.galaxyfinder' instead of the package name. Can games avoid being found in this location?

The app info indicates that the data is stored in /data/user/0/com.mygame, but it does not appear to be the case.
I couldn't get what you mean. You could go through the logs and see why it's not injecting. It could be many reasons, it could be that the app you're trying to inject into has protection against injections but that's very unlikely. It could be that you're putting in the wrong package name. The package of your app should be: com.samsung.android.app.galaxyfinder.

Check hook.cpp for extra details about how the injection works. You could try adding logs to see what exactly is going wrong.
 
I couldn't get what you mean. You could go through the logs and see why it's not injecting. It could be many reasons, it could be that the app you're trying to inject into has protection against injections but that's very unlikely. It could be that you're putting in the wrong package name. The package of your app should be: com.samsung.android.app.galaxyfinder.

Check hook.cpp for extra details about how the injection works. You could try adding logs to see what exactly is going wrong.

It doesn't try to inject, because it can't find the package.
I am sure that the packageName is correct. I am debugging it with frida and get it out of the deteils of the app itself.

I was wondering, why the inject does not work, so I add some more output to see whats going on.

C++:
int isGame(JNIEnv *env, jstring appDataDir)
{
    if (!appDataDir)
        return 0;

    const char *app_data_dir = env->GetStringUTFChars(appDataDir, nullptr);
    LOGD(OBFUSCATE("appDataDir: %s"),app_data_dir);
    int user = 0;
    static char package_name[256];
    if (sscanf(app_data_dir, "/data/%*[^/]/%d/%s", &user, package_name) != 2) {
        if (sscanf(app_data_dir, "/data/%*[^/]/%s", package_name) != 1) {
            package_name[0] = '\0';
            LOGW(OBFUSCATE("can't parse %s"), app_data_dir);
            return 0;
        }
    }
    if (strcmp(package_name, GamePackageName) == 0) {
        LOGI(OBFUSCATE("detect game: %s"), package_name);
        game_data_dir = new char[strlen(app_data_dir) + 1];
        strcpy(game_data_dir, app_data_dir);
        env->ReleaseStringUTFChars(appDataDir, app_data_dir);
        return 1;
    } else {
        env->ReleaseStringUTFChars(appDataDir, app_data_dir);
        return 0;
    }
}

If I start any app (Photos e.g.) the data folder appears like
Bash:
appDataDir: /data/user/0/com.google.android.apps.photos
.
If I start the game just
Bash:
/data/user/0/com.samsung.android.app.galaxyfinder
appears in the logs.
The game itself does not appear there. What could be the reason for this?
 
Has anyone managed to prevent clicks from going through the ImGui menu to the application? I have tried it with the following code. Unfortunately, this completely prevents the clicks from going to the application. Instead, the ImGui menu snaps to the place where I "swipe".

C++:
HOOKAF(void, Input, void *thiz, void *ex_ab, void *ex_ac) {
    bool wantToCaptureMouse = false;
    auto ctx = ImGui::GetCurrentContext();
    LOGD("Input -> Checking for CTX");
    if (ctx) {
        LOGD("Input -> has CTX");
        auto io = ImGui::GetIO();
        wantToCaptureMouse = io.WantCaptureMouse;
        LOGD("Input -> io.WantCaptureMouse %i", io.WantCaptureMouse);
        ImGui_ImplAndroid_HandleInputEvent((AInputEvent *) thiz);
    }
    if (!wantToCaptureMouse) {
        origInput(thiz, ex_ab, ex_ac);
    }
}
 
my menu causes a change in the game's resolution causing the game to crash

how to fix this

Maybe there is also a resize event you can listen for. Not sure.

Try to move that DisplaySize calculation out of the setupFunction to be sure it scaled correctly all the time.
C++:
    eglQuerySurface(dpy, surface, EGL_WIDTH, &glWidth);
    eglQuerySurface(dpy, surface, EGL_HEIGHT, &glHeight);
    io.DisplaySize = ImVec2((float) glWidth, (float) glHeight);
 
Back
Top Bottom