# zfitness/nx2androidx architecture

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

- Interactive diagram: https://gitdiagram.com/zfitness/nx2androidx
- Repository: https://github.com/zfitness/nx2androidx

## Overview

nx2Arm is an on-device Switch-game porting and native-play platform for Android and ARM Linux. The main flow is: the player selects game files and keys, starts a port, and receives a game data pack that can be launched from the library. The graph also preserves the built-in agent, environment setup, save sharing, driver management, and the Linux launcher. Some internal porting and native-runtime links are documented only at product level; those are dashed where implementation-level wiring was not shown.

Main entry points: [`android/app/src/main/java/com/nx/android/PortService.kt`](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/PortService.kt) (Port service), [`android/app/src/main/java/com/nx/android/appstate/LibraryState.kt`](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/appstate/LibraryState.kt) (Game library), [`porter/pipeline.py`](https://github.com/zfitness/nx2androidx/blob/arm/porter/pipeline.py) (Port pipeline), [`launcher/ui/app.py`](https://github.com/zfitness/nx2androidx/blob/arm/launcher/ui/app.py) (Desktop launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android_app["Android app"]
  node_android_ui["App screens<br/>[MainActivity.kt]"]
  node_build_ui["Builds page"]
  node_library["Game library<br/>[LibraryState.kt]"]
  node_library_repository[("Library storage")]
  node_saves["Save sharing"]
  node_drivers["Driver management"]
  node_storage["Storage usage<br/>[StorageUsage.kt]"]
end

subgraph group_porting["Porting workflow"]
  node_port_service["Port service<br/>[PortService.kt]"]
  node_port_state["Port progress<br/>[PortState.kt]"]
  node_port_pipeline["Port pipeline<br/>[pipeline.py]"]
  node_game_inputs["Game files and keys"]
  node_environment["Linux environment"]
  node_game_pack["Game data pack"]
end

subgraph group_runtime["Game runtime"]
  node_game_activity["Game activity<br/>[GameActivity.kt]"]
  node_native_host["Native host<br/>[main.c]"]
  node_android_native["Android native layer<br/>[front_android.c]"]
  node_vulkan_graphics["Vulkan graphics<br/>[gfx_vk_core.c]"]
end

subgraph group_agent["Built-in agent"]
  node_agent_ui["Agent interface<br/>[AgentScreen.kt]"]
  node_agent_runtime["Agent runtime<br/>[AgentSetup.kt]"]
  node_agent_store[("Agent data")]
end

subgraph group_linux["ARM Linux"]
  node_linux_launcher["Desktop launcher<br/>[app.py]"]
  node_linux_runner["Linux game runner<br/>[runner.py]"]
  node_linux_pipeline["Linux port pipeline<br/>[pipeline.py]"]
end

node_player(("Player"))

node_player -->|"selects game"| node_build_ui
node_build_ui -.->|"starts port"| node_port_service
node_port_service -->|"reports progress"| node_port_state
node_port_service -->|"uses environment"| node_environment
node_port_service -.->|"runs port"| node_port_pipeline
node_game_inputs -->|"provides inputs"| node_port_pipeline
node_environment -.->|"hosts tools"| node_port_pipeline
node_port_pipeline -->|"produces pack"| node_game_pack
node_port_state -.->|"refreshes library"| node_library
node_library -->|"reads games"| node_library_repository
node_game_pack -->|"makes playable"| node_library
node_library -.->|"launches game"| node_game_activity
node_game_activity -.->|"starts host"| node_native_host
node_native_host -.->|"uses platform layer"| node_android_native
node_android_native -.->|"renders graphics"| node_vulkan_graphics
node_player -->|"shares saves"| node_saves
node_player -->|"manages drivers"| node_drivers
node_android_ui -.->|"shows usage"| node_storage
node_player -->|"uses assistant"| node_agent_ui
node_agent_ui -.->|"uses agent"| node_agent_runtime
node_agent_runtime -->|"stores agent data"| node_agent_store
node_player -->|"opens launcher"| node_linux_launcher
node_linux_launcher -.->|"launches games"| node_linux_runner
node_linux_launcher -.->|"starts port"| node_linux_pipeline

click node_android_ui "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/MainActivity.kt"
click node_build_ui "https://github.com/zfitness/nx2androidx/tree/arm/android/app/src/main/java/com/nx/android/feature/builds"
click node_port_service "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/PortService.kt"
click node_port_state "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/appstate/PortState.kt"
click node_port_pipeline "https://github.com/zfitness/nx2androidx/blob/arm/porter/pipeline.py"
click node_environment "https://github.com/zfitness/nx2androidx/tree/arm/android/app/src/main/java/com/nx/android/domain/environment"
click node_library "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/appstate/LibraryState.kt"
click node_library_repository "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/domain/library/GameLibraryRepository.kt"
click node_game_activity "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/game/GameActivity.kt"
click node_native_host "https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/host/main.c"
click node_android_native "https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/android/front_android.c"
click node_vulkan_graphics "https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/android/gfx_vk_core.c"
click node_saves "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/data/saves/SaveRepositoryImpl.kt"
click node_drivers "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/data/drivers/DriverRepositoryImpl.kt"
click node_storage "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/domain/StorageUsage.kt"
click node_agent_ui "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/ui/AgentScreen.kt"
click node_agent_runtime "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/runtime/AgentSetup.kt"
click node_agent_store "https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/runtime/AgentEngineStore.kt"
click node_linux_launcher "https://github.com/zfitness/nx2androidx/blob/arm/launcher/ui/app.py"
click node_linux_runner "https://github.com/zfitness/nx2androidx/blob/arm/launcher/runner.py"
click node_linux_pipeline "https://github.com/zfitness/nx2androidx/blob/arm/porter/pipeline.py"

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_ui,node_build_ui,node_library,node_library_repository,node_saves,node_drivers,node_storage toneBlue
class node_port_service,node_port_state,node_port_pipeline,node_game_inputs,node_environment,node_game_pack toneAmber
class node_game_activity,node_native_host,node_android_native,node_vulkan_graphics toneMint
class node_agent_ui,node_agent_runtime,node_agent_store toneRose
class node_linux_launcher,node_linux_runner,node_linux_pipeline,node_player toneIndigo
```

## Components

### Android app

- [App screens](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/MainActivity.kt): `android/app/src/main/java/com/nx/android/MainActivity.kt`
- [Builds page](https://github.com/zfitness/nx2androidx/tree/arm/android/app/src/main/java/com/nx/android/feature/builds): `android/app/src/main/java/com/nx/android/feature/builds`
- [Game library](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/appstate/LibraryState.kt): `android/app/src/main/java/com/nx/android/appstate/LibraryState.kt`
- [Library storage](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/domain/library/GameLibraryRepository.kt): `android/app/src/main/java/com/nx/android/domain/library/GameLibraryRepository.kt`
- [Save sharing](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/data/saves/SaveRepositoryImpl.kt): `android/app/src/main/java/com/nx/android/data/saves/SaveRepositoryImpl.kt`
- [Driver management](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/data/drivers/DriverRepositoryImpl.kt): `android/app/src/main/java/com/nx/android/data/drivers/DriverRepositoryImpl.kt`
- [Storage usage](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/domain/StorageUsage.kt): `android/app/src/main/java/com/nx/android/domain/StorageUsage.kt`

### Porting workflow

- [Port service](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/PortService.kt): `android/app/src/main/java/com/nx/android/PortService.kt`
- [Port progress](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/appstate/PortState.kt): `android/app/src/main/java/com/nx/android/appstate/PortState.kt`
- [Port pipeline](https://github.com/zfitness/nx2androidx/blob/arm/porter/pipeline.py): `porter/pipeline.py`
- **Game files and keys**
- [Linux environment](https://github.com/zfitness/nx2androidx/tree/arm/android/app/src/main/java/com/nx/android/domain/environment): `android/app/src/main/java/com/nx/android/domain/environment`
- **Game data pack**

### Game runtime

- [Game activity](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/game/GameActivity.kt): `android/app/src/main/java/com/nx/android/game/GameActivity.kt`
- [Native host](https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/host/main.c): `nxnative/dm/host/main.c`
- [Android native layer](https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/android/front_android.c): `nxnative/dm/android/front_android.c`
- [Vulkan graphics](https://github.com/zfitness/nx2androidx/blob/arm/nxnative/dm/android/gfx_vk_core.c): `nxnative/dm/android/gfx_vk_core.c`

### Built-in agent

- [Agent interface](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/ui/AgentScreen.kt): `android/app/src/main/java/com/nx/android/agent/ui/AgentScreen.kt`
- [Agent runtime](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/runtime/AgentSetup.kt): `android/app/src/main/java/com/nx/android/agent/runtime/AgentSetup.kt`
- [Agent data](https://github.com/zfitness/nx2androidx/blob/arm/android/app/src/main/java/com/nx/android/agent/runtime/AgentEngineStore.kt): `android/app/src/main/java/com/nx/android/agent/runtime/AgentEngineStore.kt`

### ARM Linux

- [Desktop launcher](https://github.com/zfitness/nx2androidx/blob/arm/launcher/ui/app.py): `launcher/ui/app.py`
- [Linux game runner](https://github.com/zfitness/nx2androidx/blob/arm/launcher/runner.py): `launcher/runner.py`
- [Linux port pipeline](https://github.com/zfitness/nx2androidx/blob/arm/porter/pipeline.py): `porter/pipeline.py`

### Other components

- **Player**

## Connections

- Player → Builds page: selects game (evidence: `README.md`)
- Builds page → Port service: starts port
- Port service → Port progress: reports progress (evidence: `android/app/src/main/java/com/nx/android/PortService.kt`)
- Port service → Linux environment: uses environment (evidence: `android/app/src/main/java/com/nx/android/PortService.kt`)
- Port service → Port pipeline: runs port
- Game files and keys → Port pipeline: provides inputs (evidence: `porter/pipeline.py`)
- Linux environment → Port pipeline: hosts tools
- Port pipeline → Game data pack: produces pack (evidence: `README.md`)
- Port progress → Game library: refreshes library (evidence: `android/app/src/main/java/com/nx/android/appstate/LibraryState.kt`)
- Game library → Library storage: reads games (evidence: `android/app/src/main/java/com/nx/android/appstate/LibraryState.kt`)
- Game data pack → Game library: makes playable (evidence: `README.md`)
- Game library → Game activity: launches game
- Game activity → Native host: starts host
- Native host → Android native layer: uses platform layer
- Android native layer → Vulkan graphics: renders graphics
- Player → Save sharing: shares saves (evidence: `README.md`)
- Player → Driver management: manages drivers (evidence: `README.md`)
- App screens → Storage usage: shows usage
- Player → Agent interface: uses assistant (evidence: `README.md`)
- Agent interface → Agent runtime: uses agent
- Agent runtime → Agent data: stores agent data (evidence: `android/app/src/main/java/com/nx/android/agent/runtime/AgentEngineStore.kt`)
- Player → Desktop launcher: opens launcher (evidence: `README.md`)
- Desktop launcher → Linux game runner: launches games (evidence: `launcher/ui/app.py`)
- Desktop launcher → Linux port pipeline: starts port
