How alez-dev/babylonia-terminal works
Project Type and Purpose
• This project is a launcher for anime games. It handles the downloading and installation of the game and its dependencies.
• There are two main variants:
– A CLI version (contained in the “babylonia-terminal-cli” directory) which manages game launching and patching.
– A GUI version (located under “babylonia_terminal_launcher”), which, in this GTK branch update, should now use GTK for its interface rather than its previous Flutter or other UI paradigms.
• The “babylonia-terminal-sdk” directory holds the core library functions (components, downloaders, patchers, configuration managers, etc.) and ties the CLI and GUI together.
Parts of the File Structure
• Top-level Structure:
– “babylonia-terminal-cli”: Handles command-line interactions, argument parsing (“arguments.rs”), game logic (“game.rs”), reporting states (“reporter.rs”) and utility functions.
– “babylonia-terminal-sdk”: A modular SDK with a components folder (holding individual component downloaders for DXVK, Proton, game-specific patches) and utility modules (like GitHub requests and third-party APIs).
– “babylonia_terminal_launcher”: This directory is dedicated to the graphical launcher, containing a rich set of UI elements (screens, widgets, models, and provider modules). Note the native integration layer under “native/hub” and Linux-specific code under “linux”.
• Notice the “.github/workflows” directory for CI/CD, and build scripts like “build.sh” that indicate deployment/build integration.
• Protocol buffer (proto) files under “messages” indicate a well-structured messaging system for game state and configuration, which is an important aspect in understanding data flows.
Using the README for Additional Context
• The README emphasizes the launcher’s purpose: to download and install anime games with a clear separation between the CLI and GUI versions.
a. Main Components:
• CLI Frontend: The Babylonia Terminal CLI (in “babylonia-terminal-cli”) is responsible for command parsing and initiating game operations.
• Core SDK: The Babylonia Terminal SDK (in “babylonia-terminal-sdk”) provides shared logic, including component management for downloads, patching, game management, state handling, and utility functions interfacing with external APIs (e.g., GitHub, Kuro Prod API).
• Graphical Launcher (GTK Version): Within “babylonia_terminal_launcher”, include both the UI business logic (previously using Flutter/Dart, now aimed for a GTK interface in this branch) and the native hub integration from “native/hub”. Also factor in Linux-specific bindings under the “linux” directory.
• Native Integration Layer: The “native/hub” module and related Linux code compose the low-level integration between the graphical frontend and system-level operations.
• Messaging & Protocol: Represent the messaging layer (protos under “messages”) that standardizes communication among various components (CLI, SDK, Launcher, and Native integrations).
b. Relationships and Interactions:
• The CLI and GUI interact with the same backend functionality provided by the SDK.
• The launcher (now GTK based) communicates with the SDK for core operational tasks (like game downloading, patching, and dependency management).
• The native integration layer acts as a bridge for platform-specific operations (file system updates, executing native code, etc.), and it interfaces with both the launcher and the SDK.
• Protocol messages are exchanged between these layers for consistent state reporting and handling errors.
c. Architectural Patterns and Design Principles:
• Separation of Concerns: The application clearly separates CLI logic, SDK functionality, and GUI components.
• Modular Design: The SDK is organized into self-contained components which can be individually updated or replaced.
• Data Flow via Messaging: The use of proto files illustrates a message-based architecture which is ideal for decoupling systems.
• Cross-Platform Considerations: Given the presence of both CLI and GUI versions, the architecture supports adaptability for different user interfaces, which is crucial for the GTK branch update.
d. Relevant Technologies and Frameworks:
• Rust: Used for the CLI and SDK (Cargo files indicate Rust libraries).
• GTK: For this branch, the graphical launcher will now rely on GTK for building the UI.
• (Previously) Flutter/Dart code was present in “babylonia_terminal_launcher/lib”, but for the GTK branch – you may need to migrate or adapt the UI components to GTK, so highlight this change.
• External libraries like “wincompatlib” are also integrated for compatibility.
Additional Note for the GTK Branch
• Mention any necessary migration or integration steps needed to replace previously used Flutter components with GTK elements if the graphical launcher is in transition.