How modinmobilests/slaytheamethystmodded works
1. Repository shape
- This is a multi-module Android launcher ecosystem for modded Slay the Spire.
- The central product is app/, surrounded by a Java bridge jar (boot-bridge/), runtime compatibility patches (patches/gdx-patch/), native/JNI code, several auxiliary backend services, and a few standalone tooling modules.
2. Primary runtime boundary: Android launcher vs game runtime
- app/ is the Android UI and orchestration layer.
- It does not run the game logic itself; instead it prepares a JavaSE runtime, native libraries, patched game jars, and then launches the Slay the Spire desktop runtime inside an Android process model.
- The key architectural boundary is between Android-managed launcher state and the embedded Java/LibGDX game runtime.
3. Launch pipeline
- The launcher flow starts in LauncherActivity / StsGameActivity, then moves through launch-preparation coordinators under backend/launch/.
- These classes install components, resolve native library paths, warm up caches, validate the game jar, apply patch caches, and decide how the game should return to the launcher after exit.
- boot-bridge/ participates here as the Java-side bootstrap layer loaded into the game runtime.
4. Game session and surface management
- GameSessionCoordinator, RenderSurfaceHost, RenderSurfaceManager, GameSessionConfig, and the render-related backend classes coordinate the actual game window/surface lifecycle.
- Rendering policy is abstracted from the UI: the app chooses a renderer backend, display refresh strategy, virtual resolution policy, and surface backend before game start.
- This is the boundary where Android display constraints, GPU behavior, and the game’s desktop rendering expectations are reconciled.
5. Native and JVM compatibility layer
- The repo includes extensive JNI/C code under app/src/main/jni/, plus Java compatibility stubs under app/src/main/java/com/oracle, dalvik, and net/kdt/pojavlaunch.
- These pieces emulate or bridge desktop behaviors needed by the JavaSE runtime on Android: AWT, GLFW/input, EGL/OSMesa, native hooks, process exit handling, and workshop Zstd support.
- patches/gdx-patch/ adds bytecode/source-level compatibility fixes for LibGDX and game classes, while boot-bridge/ adds runtime probes and patch-cache/bootstrap logic.
6. Mod ecosystem handling
- backend/mods/ is a major subsystem for validating, patching, importing, and managing mod jars.
- It handles mod manifest parsing, classpath jar building, compatibility patching, duplicate ZIP normalization, optional mod storage, jar integrity checks, and runtime patch generation.
- There is a separate import pipeline under backend/mods/importing/ with modular patch modules for specific mod families, indicating that mod ingestion is intentionally data-driven and extensible.
7. Workshop and Steam content flow
- backend/workshop/ is the launcher-side workshop domain: browsing, metadata storage, download orchestration, preview caching, interrupted-download recovery, and auto-import into the mod system.
- steam-protocol/ and workshop-core/ are lower-level network/client libraries used to talk to Steam content services and process workshop downloads.
- This creates a clean separation: app-level UX and policies in app/, transport/protocol logic in shared libraries, and file installation/patching back in the launcher.
8. Steam Cloud synchronization
- backend/steamcloud/ is a full sync engine for save-state mirroring, diff planning, path mapping, auth, local snapshots, manifest handling, and process services.
- It is designed as a long-running subsystem with explicit mutex/operation coordination and user warnings for conflict/risk cases.
- The launcher also exposes settings screens for cloud behavior, blacklist configuration, and login, so cloud sync is both a backend service and a user-visible feature.
9. Feedback, diagnostics, and crash recovery
- backend/feedback/ and backend/diag/ form the observability and support path.
- Diagnostics collect logcat, memory snapshots, process exit data, crash dumps, and archive them for submission or local inspection.
- Feedback submission is integrated with issue models, inbox coordination, and conversation handling, so the launcher can gather structured reports after failures or user reports.
10. Update and resource distribution
- backend/update/ manages launcher updates and component updates, including mirror selection and versioning policy.
- backend/resources/ and backend/runtime/ manage runtime resource packs and external resource packs, which are required to assemble the launcher’s embedded game environment.
- The repo explicitly relies on external artifacts such as the Steam desktop jar, runtime pack, and native library market assets.
11. UI architecture
- The UI layer is Jetpack Compose-based and organized by domain: main launcher, workshop, feedback, settings, quickstart, compatibility, and mod import.
- Screens are backed by view models and stores/coordinators rather than direct imperative logic, which keeps UI state separate from the game/runtime orchestration.
- The UI also includes overlays and controls for in-game touch/mouse keyboard, boot overlays, performance overlays, and mobile-specific gestures.
12. Configuration and persistence
- config/ contains the launcher’s persistent policy and user preference model: render backend, touchscreen mode, Steam Cloud mode, theme/icon policies, runtime paths, and legacy migration.
- Many subsystems keep their own local stores for search history, mod associations, favorites, highlights, workshop metadata, and diagnostics artifacts.
- This implies a mostly local-first architecture with explicit per-domain storage rather than one centralized app database.
13. Ancillary services in the repo
- cloud-function/ is a Node.js backend for submission/feedback/cloud-control style APIs and notifications.
- presence-service/ and cloudflare-presence-worker/ implement a separate presence-tracking service, with a server/API layer plus Cloudflare Worker deployment and SQL migrations.
- These are not part of the Android launcher runtime, but they are architectural peers supporting community/telemetry/social features.
14. Automation, testing, and release chain
- scripts/tools/ and scripts/build/ provide harnesses for repeatable device testing, smoke runs, autoplay runs, and crash/performance workflows.
- macrobenchmark/ and the Android instrumentation tests cover UI and launcher behavior, while boot-bridge/, app/, and patches/gdx-patch/ each have focused unit tests.
- GitHub Actions workflows and docs under docs/release-automation/ and docs/debug-automation/ show that release packaging and debugging are treated as part of the architecture, not as afterthoughts.
Main entry points: app Launcher app · launch Launch core · mods Mod manager · workshop Workshop domain
Components 21
Android launcher
Android app, UI, launch orchestration, and in-process runtime boundary.
- Launcher app · Compose-based launcher UI plus orchestration for game startup, settings, mod management, workshop, cloud sync, feedback, and diagnostics.
app - Launch core · Prepares runtime assets, native library paths, caches, patch state, and game return policy before starting the desktop game runtime.
app/src/main/java/io/stamethyst/backend/launch - Render core · Chooses renderer backend, virtual resolution, refresh policy, and surface lifecycle for the embedded game window.
app/src/main/java/io/stamethyst/backend/render - Game session · Coordinates activity entry, render surface hosting, session config, and in-game overlays around the running game process.
app/src/main/java/io/stamethyst
Runtime compat
Java bridge, bytecode patches, native shims, and bundled compatibility mods.
- Boot bridge · Game-runtime-side bootstrap layer that probes game state, caches patch metadata, and forwards startup/runtime signals.
boot-bridge - GDX patch · Bytecode/source compatibility fixes for LibGDX, Steam, and selected game classes used by the desktop runtime.
patches/gdx-patch - Compat mods · Bundled ModTheSpire mods that adapt desktop/game behavior for Android, including touch, autoplay, rescue, and RAM-saving patches.
mods - Native layer · C/JNI and Java compatibility stubs for AWT, GLFW/input, EGL/OSMesa, process hooks, and workshop zstd support.
app/src/main/jni
Content backend
Workshop, mods, resources, updates, feedback, diagnostics, and cloud sync subsystems.
- Mod manager · Validates, patches, imports, classpath-builds, and stores mods; also drives mod suggestions and compatibility handling.
app/src/main/java/io/stamethyst/backend/mods - Workshop domain · Browses Steam Workshop content, downloads packages, caches previews, recovers interrupted downloads, and auto-imports into mods.
app/src/main/java/io/stamethyst/backend/workshop - Steam Cloud · Long-running save mirroring engine with auth, path mapping, diff planning, snapshots, blacklists, and conflict warnings.
app/src/main/java/io/stamethyst/backend/steamcloud - Diagnostics · Collects logcat, memory snapshots, process exit data, and crash artifacts into shareable diagnostics archives.
app/src/main/java/io/stamethyst/backend/diag - Feedback · Manages feedback inbox, issue models, conversation flow, submission, and log-assisted triage.
app/src/main/java/io/stamethyst/backend/feedback - Updates · Handles launcher and component update checks, mirror selection, version policy, and update UI reduction.
app/src/main/java/io/stamethyst/backend/update - Resources · Installs external resource packs and runtime packs required to assemble the launcher’s embedded environment.
app/src/main/java/io/stamethyst/backend/resources
Services and tools
External services, shared protocol libraries, and automation tooling.
- Steam protocol · Low-level Steam authentication/content protocol client used by workshop download flows and related services.
steam-protocol - Workshop core · Shared downloader and integrity engine for Steam workshop and depot content.
workshop-core - Cloud function · Serverless backend for submission, feedback, notifications, and cloud-control style APIs.
cloud-function - Presence service · Standalone presence tracking API and client UI with SQL-backed storage.
presence-service - Presence worker · Cloudflare Worker deployment and migrations for presence snapshot handling.
cloudflare-presence-worker - Automation tools · Device harnesses, smoke/perf runners, release prep scripts, and support utilities for debugging and automation.
scripts
Connections 23
- Launcher app → Launch core: launches · UI entry points hand off to launch preparation and startup coordination.
- Launcher app → Render core: configures · Launcher settings determine renderer, refresh, and resolution policy.
- Launcher app → Game session: hosts · Activities and overlays manage the active game session and surface lifecycle.
- Launcher app → Mod manager: manages · The launcher’s main content loop is mod validation, import, and patching.
- Launcher app → Workshop domain: syncs · Workshop browsing and downloads feed the local mod system.
- Launcher app → Steam Cloud: synchronizes · Save-state mirroring is controlled from launcher settings and services.
- Launcher app → Diagnostics: collects · Crash and support flows build diagnostics archives from launcher/runtime data.
- Launcher app → Feedback: submits · Feedback screens and stores route issue reports to backend services.
- Launcher app → Updates: updates · Launcher and component updates are checked and applied from the app.
- Launcher app → Resources: installs · Runtime packs and external assets are staged by the launcher.
- Launch core → Boot bridge: boots · Launch prep depends on the bridge layer loaded into the game runtime.
- Launch core → Native layer: loads · Native library resolution and preload are part of startup.
- Launch core → GDX patch: depends on · Startup assumes patched desktop/LibGDX classes are available.
- Game session → Render core: uses · Session setup selects and applies render surface policy.
- Mod manager → GDX patch: targets · Mod compatibility relies on patched runtime classes and behavior.
- Mod manager → Compat mods: coordinates · Imported and bundled mods become part of the runtime patch set.
- Workshop domain → Steam protocol: uses · Workshop browsing and metadata flows use the Steam protocol client.
- Workshop domain → Workshop core: downloads · Content retrieval and integrity checks delegate to the shared downloader engine.
- Steam Cloud → Cloud function: syncs via · Support/control APIs and notifications are backed by the cloud function service.
- Feedback → Cloud function: reports to · Submission and issue workflows connect to the server-side feedback API.
- Presence service → Presence worker: deploys · The worker is the edge deployment companion for the presence service.
- Automation tools → Launcher app: drives · Automation harnesses exercise launcher flows on real devices and test setups.
- Automation tools → Boot bridge: probes · Crash, autoplay, and observation tools connect through the bridge protocol.