# perfare/zygisk-il2cppdumper architecture

> Architecture diagram of the GitHub repository perfare/zygisk-il2cppdumper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/perfare/zygisk-il2cppdumper
- Repository: https://github.com/perfare/zygisk-il2cppdumper

## Overview

Based on our analysis of the file tree and README, this project is a specialized Android module called “Zygisk-Il2CppDumper.” Its purpose is to hook into game processes at runtime—via Magisk’s Zygisk framework—to dump Il2Cpp data (even when that data is protected, encrypted, or obfuscated). The project is built using Gradle (with both Android-specific and C++ native code components) and packages a Magisk module (using the provided template) for installation on rooted Android devices.

##### Main Components
- Android Environment & Magisk Framework: Represent the target device environment where Magisk (v24 or later) and Zygisk are enabled.
- Zygisk Injection Module: This is the Magisk module built from the provided module sources, which integrates with the game process at runtime.
- Native Code Layer (C++): Under module/src/main/cpp, the dumper logic is implemented (including files like hack.cpp, il2cpp_dump.cpp, and the xdl utility functions). This section covers the interaction with the native Android runtime via C/C++.
- Build & Deployment Infrastructure: Show the Gradle build system, including build scripts (build.gradle, module.gradle), CMake files, and the gradle wrapper. Also include the GitHub Actions workflow which provides automated builds.
- Magisk Module Template: (Located in template/magisk_module) defines the schema and metadata (module.prop, updater-script, update-binary) required by Magisk to recognize and install the module.
- Game Process & Dump Output: The final target, where the module interferes with or hooks the game process to dump the il2cpp data (e.g., generating dump.cs in the game’s data directory).

##### Relationships and Interactions
- The Android Environment loads Magisk with the enabled Zygisk feature.
- Upon starting the game, Magisk (via Zygisk) loads the injected module.
- The module’s native code (compiled via C++ build defined by CMakeLists.txt and Gradle tasks) hooks into the game’s process and accesses the Il2Cpp data.
- The extracted runtime data flows from the game process to the module’s dumping logic, eventually generating the dump file (dump.cs) in the game’s file directory.
- The build/deployment pipeline (GitHub Actions or Android Studio) packages the module correctly (using the provided Magisk module template) before deployment.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly differentiate between build configuration (Gradle scripts), UI/Android-level configuration (AndroidManifest.xml), and performance-critical native code (C++ sources).
- Modular Design: The integration of a Magisk module template along with separate “module” source code emphasizes reusability and compartmentalization.
- Hooking/Injection Mechanism: The Zygisk integration leverages dynamic loading/injection, which is pivotal in understanding the data flow – from game process to dump output.

##### Relevant Technologies and Frameworks
- Android Studio/Gradle for build and project management.
- C/C++ for the native code, managed using CMake.
- Magisk and Zygisk for runtime injection/hooking on Android.
- GitHub Actions for Continuous Integration (CI) and building the module package.
- Magisk Module Template components (update-binary, updater-script, etc.) that facilitate module deployment.

##### Elements
- Each major component (Android Environment, Magisk Framework, Zygisk Module, Native Layer, Build Pipeline, and Game Process) should be clearly labeled.

##### Final Advice
- Be very detailed – segregate the project into as many clear components as feasible. For instance, you might separate the Gradle build configuration, native code, and Magisk module packaging sections.
- Verify that the data flow from the game process to the file generation (dump.cs) is clearly represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Deployment Infrastructure Subgraph
    subgraph "Build & Deployment Infrastructure"
        E1("build.gradle"):::build
        E2("module.gradle"):::build
        E3("CMakeLists.txt"):::build
        E4("Gradle Wrapper"):::build
        E5("CI Pipeline"):::build
        E_A("Build Output"):::build
    end

    %% Other major components
    F("Magisk Module Template"):::template
    A("Android Environment & Magisk Framework"):::android
    B("Zygisk Injection Module"):::injection
    C("Native Code Layer (C++ Il2Cpp Dumper Logic)"):::native
    D("Game Process & Dump Output (dump.cs)"):::game

    %% Connections within Build & Deployment Infrastructure
    E1 -->|"contributes"| E_A
    E2 -->|"contributes"| E_A
    E3 -->|"contributes"| E_A
    E4 -->|"contributes"| E_A
    E5 -->|"contributes"| E_A

    %% Build pipeline and module packaging connections
    E_A -->|"packages module"| F
    E_A -->|"builds injection"| B
    E_A -->|"compiles native"| C

    %% Module installation and runtime flow
    F -->|"installs module"| A
    A -->|"loads module_via_Zygisk"| B
    B -->|"initiates_dumper_logic"| C
    C -->|"extracts_Il2Cpp_data"| D

    %% Click Events
    click E1 "https://github.com/perfare/zygisk-il2cppdumper/blob/master/build.gradle"
    click E2 "https://github.com/perfare/zygisk-il2cppdumper/blob/master/module.gradle"
    click E3 "https://github.com/perfare/zygisk-il2cppdumper/blob/master/module/src/main/cpp/CMakeLists.txt"
    click E4 "https://github.com/perfare/zygisk-il2cppdumper/tree/master/gradle/wrapper/"
    click E5 "https://github.com/perfare/zygisk-il2cppdumper/blob/master/.github/workflows/build.yml"
    click F "https://github.com/perfare/zygisk-il2cppdumper/tree/master/template/magisk_module"
    click B "https://github.com/perfare/zygisk-il2cppdumper/blob/master/module/src/main/cpp/zygisk.hpp"
    click C "https://github.com/perfare/zygisk-il2cppdumper/tree/master/module/src/main/cpp"

    %% Styles
    classDef build fill:#ffcc00,stroke:#333,stroke-width:2px
    classDef template fill:#ff9999,stroke:#333,stroke-width:2px
    classDef android fill:#66ccff,stroke:#333,stroke-width:2px
    classDef injection fill:#ccffcc,stroke:#333,stroke-width:2px
    classDef native fill:#ccccff,stroke:#333,stroke-width:2px
    classDef game fill:#ffd699,stroke:#333,stroke-width:2px
```
