# springmusk026/android-modmenu-semijni architecture

> Architecture diagram of the GitHub repository springmusk026/android-modmenu-semijni, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/springmusk026/android-modmenu-semijni
- Repository: https://github.com/springmusk026/android-modmenu-semijni

## Overview

1. **What this repository is**
   - An Android mod-menu template for native/IL2CPP games.
   - It is split into a small Java Android shell plus a substantial native C++ layer that does the actual game interaction and menu rendering.

2. **Top-level runtime boundary**
   - The Android app is the packaging and entry point.
   - The real “payload” is a JNI-loaded native library that hooks/patches the target game process and drives the menu state.
   - The target game is an external boundary: this repo does not contain the game, only the overlay and native modding layer that attaches to it.

3. **Android application shell**
   - `MainActivity.java` is the launcher-side entry point and permission gate.
   - It handles the Android-side startup flow, especially overlay permission checks before the menu is shown.
   - `AndroidManifest.xml` is used to declare the app, overlay permission, and service/activity wiring.

4. **Java UI and app state layer**
   - `Menu.java`, `Views.java`, `Preferences.java`, `LGLClickListener.java`, and `Logcat.java` make up the Java-side support layer.
   - This layer holds UI state, view helpers, click handling, saved preferences, and log collection/diagnostics.
   - Java mostly acts as the bridge between Android framework events and native feature toggles.

5. **Native core and JNI boundary**
   - `app/src/main/jni/Main.cpp` is the main native control point.
   - `Jni/Api.h` and `Jni/JniP.h` define the JNI-facing contract between Java and C++.
   - This boundary is where menu events, settings, and lifecycle calls are transferred from Java into the native mod logic.

6. **Menu definition and feature routing**
   - `Menu.h` defines the feature list and menu metadata consumed by the UI.
   - The repo uses a feature-number / feature-string model so UI selections map to specific native actions.
   - This is the main bridge between visible menu items and runtime behavior in the modding layer.

7. **Game interaction layer**
   - `KittyMemory/` provides patching and memory backup/restore utilities.
   - `LGL2Cpp/` contains IL2CPP-related helpers for locating types, fields, and methods in Unity-based targets.
   - This is the subsystem that reads, patches, or hooks the target game’s native code and runtime structures.

8. **Hooking and low-level compatibility**
   - The native layer includes support for function hooks and architecture-specific paths.
   - The codebase is built to handle ARMv7 and ARM64 targets, with x86 present only as legacy support.
   - This architecture awareness matters because the mod logic depends on the target game’s library ABI.

9. **Overlay/menu rendering**
   - `ImGui/` contains Dear ImGui and Android/OpenGL backend code.
   - The floating menu is rendered natively rather than through standard Android widgets.
   - This creates a separate rendering path from the Java UI: Android launches the app, but the actual floating control surface is drawn by native code over the game.

10. **Supporting native utilities**
   - `Includes/` contains logger, macro, utility, and string obfuscation helpers.
   - `Codes/` and `Stuffs/` hold shared structs and math types like vectors and quaternions.
   - These are support libraries used across patching, hooks, geometry/math, and diagnostics.

11. **Build and packaging structure**
   - The project is a standard Gradle Android app under `app/`, with native code compiled as part of the Android build.
   - `app/src/main/jni/CMakeLists.txt` defines the native build, and the workflow file under `.github/workflows/` suggests CI build automation.
   - The output is an Android APK that includes both the Java shell and the native shared library.

12. **Typical data flow at runtime**
   - App launch starts in `MainActivity`.
   - Android permissions and startup logic enable the overlay/menu path.
   - Java state and user actions flow through JNI into `Main.cpp`.
   - Native code updates feature state, applies memory patches/hooks to the game, and renders the overlay via ImGui.

13. **External dependencies that shape the design**
   - Android SDK/NDK are required because the app is both an Android app and a native library project.
   - OpenGL ES is implied by the ImGui Android backend.
   - IL2CPP/Unity-style native game binaries are the intended target domain for the memory and hook utilities.

14. **How to diagram it**
   - Draw three main zones: Android app shell, native mod engine, and external target game.
   - Inside the app shell, show activity/service/UI/preferences/logging.
   - Inside the native zone, show JNI bridge, feature menu, memory patching/hooking, IL2CPP helpers, and ImGui rendering.
   - Show arrows from Android UI actions into JNI, then from native code into the target game process/libraries, plus a separate rendering path for the floating overlay.

Main entry points: [`app/src/main/jni/Main.cpp`](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Main.cpp) (Main C++), [`app/src/main/java/com/android/support/MainActivity.java`](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/MainActivity.java) (Main Activity), [`app/src/main/java/com/android/support/Menu.java`](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Menu.java) (Menu UI), [`app/src/main/java/com/android/support/LGLClickListener.java`](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/LGLClickListener.java) (Click Listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android_shell["Android shell"]
  node_android_manifest["Manifest<br/>android config"]
  node_main_activity["Main Activity<br/>launcher activity<br/>[MainActivity.java]"]
  node_menu_java["Menu UI<br/>java menu<br/>[Menu.java]"]
  node_views_java["Views<br/>ui helpers<br/>[Views.java]"]
  node_prefs_java["Preferences<br/>state store<br/>[Preferences.java]"]
  node_click_java["Click Listener<br/>event bridge"]
  node_logcat_java["Logcat<br/>diagnostics<br/>[Logcat.java]"]
end

subgraph group_native_mod_engine["Native mod engine"]
  node_jni_api["JNI API<br/>jni contract<br/>[Api.h]"]
  node_jni_p["JNI Privates<br/>jni internals<br/>[JniP.h]"]
  node_main_cpp["Main C++<br/>native control<br/>[Main.cpp]"]
  node_menu_native["Feature Menu<br/>feature routing<br/>[Menu.h]"]
  node_kitty_memory["KittyMemory<br/>memory patching<br/>[KittyMemory.cpp]"]
  node_il2cpp_helpers["IL2CPP Helpers<br/>runtime introspection<br/>[Il2Cpp.cpp]"]
  node_imgui_backends["ImGui Backend<br/>overlay backend"]
  node_imgui_core["ImGui Core<br/>ui rendering<br/>[imgui.cpp]"]
  node_native_utils["Native Utils<br/>shared helpers<br/>[Utils.h]"]
  node_math_structs["Math Types<br/>shared structs<br/>[Vector3.hpp]"]
end

subgraph group_external_target["Target game"]
  node_target_game[("Game Process<br/>external target")]
end

subgraph group_build_ci["Build and CI"]
  node_build_gradle["Gradle Build<br/>android build<br/>[build.gradle]"]
  node_app_build_gradle["App Build<br/>module build<br/>[build.gradle]"]
  node_cmake_build["CMake Build<br/>native build<br/>[CMakeLists.txt]"]
  node_workflow["CI Workflow<br/>automation<br/>[gradle.yml]"]
end

node_android_manifest -->|"launches"| node_main_activity
node_main_activity -->|"opens"| node_menu_java
node_main_activity -->|"loads"| node_prefs_java
node_main_activity -->|"routes"| node_click_java
node_menu_java -->|"builds"| node_views_java
node_click_java -->|"updates"| node_menu_java
node_logcat_java -.->|"diagnoses"| node_main_activity
node_menu_java -->|"bridges"| node_jni_api
node_jni_api -->|"enters"| node_main_cpp
node_jni_p -->|"supports"| node_main_cpp
node_main_cpp -->|"dispatches"| node_menu_native
node_main_cpp -->|"patches"| node_kitty_memory
node_main_cpp -->|"resolves"| node_il2cpp_helpers
node_main_cpp -->|"renders via"| node_imgui_backends
node_imgui_backends -->|"drives"| node_imgui_core
node_imgui_core -->|"draws"| node_main_cpp
node_kitty_memory -->|"modifies"| node_target_game
node_il2cpp_helpers -->|"inspects"| node_target_game
node_main_cpp -->|"uses"| node_native_utils
node_main_cpp -->|"shares"| node_math_structs
node_app_build_gradle -->|"includes"| node_cmake_build
node_build_gradle -->|"configures"| node_app_build_gradle
node_workflow -.->|"runs"| node_build_gradle

click node_android_manifest "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/AndroidManifest.xml"
click node_main_activity "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/MainActivity.java"
click node_menu_java "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Menu.java"
click node_views_java "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Views.java"
click node_prefs_java "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Preferences.java"
click node_click_java "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/LGLClickListener.java"
click node_logcat_java "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Logcat.java"
click node_jni_api "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Jni/Api.h"
click node_jni_p "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Jni/JniP.h"
click node_main_cpp "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Main.cpp"
click node_menu_native "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Menu.h"
click node_kitty_memory "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/KittyMemory/KittyMemory.cpp"
click node_il2cpp_helpers "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/LGL2Cpp/Il2Cpp.cpp"
click node_imgui_backends "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/ImGui/backends/imgui_impl_android.cpp"
click node_imgui_core "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/ImGui/imgui.cpp"
click node_native_utils "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Includes/Utils.h"
click node_math_structs "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Stuffs/Vector3.hpp"
click node_build_gradle "https://github.com/springmusk026/android-modmenu-semijni/blob/main/build.gradle"
click node_app_build_gradle "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/build.gradle"
click node_cmake_build "https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/CMakeLists.txt"
click node_workflow "https://github.com/springmusk026/android-modmenu-semijni/blob/main/.github/workflows/gradle.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_android_manifest,node_main_activity,node_menu_java,node_views_java,node_prefs_java,node_click_java,node_logcat_java toneBlue
class node_jni_api,node_jni_p,node_main_cpp,node_menu_native,node_kitty_memory,node_il2cpp_helpers,node_imgui_backends,node_imgui_core,node_native_utils,node_math_structs toneAmber
class node_target_game toneMint
class node_build_gradle,node_app_build_gradle,node_cmake_build,node_workflow toneRose
```

## Components

### Android shell

Launcher app, UI state, and permission flow on the Android side.

- [Manifest](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/AndroidManifest.xml): android config · Declares the app, activities, overlay permissions, and component wiring. · `app/src/main/AndroidManifest.xml`
- [Main Activity](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/MainActivity.java): launcher activity · Entry point and permission gate for starting the overlay/menu flow. · `app/src/main/java/com/android/support/MainActivity.java`
- [Menu UI](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Menu.java): java menu · Java-side menu state and feature presentation bridge. · `app/src/main/java/com/android/support/Menu.java`
- [Views](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Views.java): ui helpers · View helpers and Android UI construction support. · `app/src/main/java/com/android/support/Views.java`
- [Preferences](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Preferences.java): state store · Persistent settings and saved menu state. · `app/src/main/java/com/android/support/Preferences.java`
- [Click Listener](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/LGLClickListener.java): event bridge · Handles UI events and forwards actions into the app flow. · `app/src/main/java/com/android/support/LGLClickListener.java`
- [Logcat](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/java/com/android/support/Logcat.java): diagnostics · Java-side logging and log collection support. · `app/src/main/java/com/android/support/Logcat.java`

### Native mod engine

JNI boundary, menu routing, game memory patching, hooks, rendering, and shared native utilities.

- [JNI API](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Jni/Api.h): jni contract · Java-to-native entry declarations and callable interface. · `app/src/main/jni/Jni/Api.h`
- [JNI Privates](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Jni/JniP.h): jni internals · Private JNI helpers and internal glue for the native bridge. · `app/src/main/jni/Jni/JniP.h`
- [Main C++](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Main.cpp): native control · Primary native control point for lifecycle, hooks, and feature dispatch. · `app/src/main/jni/Main.cpp`
- [Feature Menu](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Menu.h): feature routing · Feature-number and feature-string mapping used by the native runtime. · `app/src/main/jni/Menu.h`
- [KittyMemory](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/KittyMemory/KittyMemory.cpp): memory patching · Memory backup, patch, and restore utilities for target process modification. · `app/src/main/jni/KittyMemory/KittyMemory.cpp`
- [IL2CPP Helpers](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/LGL2Cpp/Il2Cpp.cpp): runtime introspection · Helpers for locating Unity/IL2CPP types, fields, and methods. · `app/src/main/jni/LGL2Cpp/Il2Cpp.cpp`
- [ImGui Backend](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/ImGui/backends/imgui_impl_android.cpp): overlay backend · Android and OpenGL backend code for native overlay rendering. · `app/src/main/jni/ImGui/backends/imgui_impl_android.cpp`
- [ImGui Core](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/ImGui/imgui.cpp): ui rendering · Dear ImGui core used to draw the floating menu overlay. · `app/src/main/jni/ImGui/imgui.cpp`
- [Native Utils](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Includes/Utils.h): shared helpers · Logging, macros, utility helpers, and string obfuscation support. · `app/src/main/jni/Includes/Utils.h`
- [Math Types](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/Stuffs/Vector3.hpp): shared structs · Vector and quaternion types shared across native subsystems. · `app/src/main/jni/Stuffs/Vector3.hpp`

### Target game

External game process and libraries this template attaches to at runtime.

- **Game Process**: external target · External native game binary and runtime state modified by the mod menu.

### Build and CI

Android/Gradle build definition and workflow automation.

- [Gradle Build](https://github.com/springmusk026/android-modmenu-semijni/blob/main/build.gradle): android build · Top-level Gradle build configuration for the Android app. · `build.gradle`
- [App Build](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/build.gradle): module build · App module configuration and native build integration. · `app/build.gradle`
- [CMake Build](https://github.com/springmusk026/android-modmenu-semijni/blob/main/app/src/main/jni/CMakeLists.txt): native build · Native library build definition for the JNI layer. · `app/src/main/jni/CMakeLists.txt`
- [CI Workflow](https://github.com/springmusk026/android-modmenu-semijni/blob/main/.github/workflows/gradle.yml): automation · GitHub Actions workflow for automated Gradle builds. · `.github/workflows/gradle.yml`

## Connections

- Manifest → Main Activity: launches · Declares the launcher entry point and app wiring.
- Main Activity → Menu UI: opens · Starts the menu flow after Android-side checks.
- Main Activity → Preferences: loads · Restores saved app and menu state.
- Main Activity → Click Listener: routes · Sends UI events into the app interaction layer.
- Menu UI → Views: builds · Uses view helpers to present menu controls.
- Click Listener → Menu UI: updates · Applies user actions to menu state.
- Logcat → Main Activity: diagnoses · Supports Android-side diagnostics and troubleshooting.
- Menu UI → JNI API: bridges · Exposes menu selections to native code through JNI.
- JNI API → Main C++: enters · Transfers lifecycle and feature calls into native control flow.
- JNI Privates → Main C++: supports · Provides private native-side JNI glue.
- Main C++ → Feature Menu: dispatches · Maps feature selections to runtime behavior.
- Main C++ → KittyMemory: patches · Applies memory edits and restores backups.
- Main C++ → IL2CPP Helpers: resolves · Finds IL2CPP types, fields, and methods in the target game.
- Main C++ → ImGui Backend: renders via · Uses backend bindings for the native overlay path.
- ImGui Backend → ImGui Core: drives · Backend feeds input and frame setup into Dear ImGui.
- ImGui Core → Main C++: draws · Menu rendering is orchestrated by the native control loop.
- KittyMemory → Game Process: modifies · Patches the external game process and libraries.
- IL2CPP Helpers → Game Process: inspects · Reads game runtime metadata and IL2CPP structures.
- Main C++ → Native Utils: uses · Relies on shared native logging and utility code.
- Main C++ → Math Types: shares · Uses shared vector and quaternion types.
- App Build → CMake Build: includes · Connects the Android module build to the native library build.
- Gradle Build → App Build: configures · Top-level Gradle setup drives the app module.
- CI Workflow → Gradle Build: runs · Automates project builds through Gradle.
