# tsukihimates/tsukihime-translation architecture

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

- Interactive diagram: https://gitdiagram.com/tsukihimates/tsukihime-translation
- Repository: https://github.com/tsukihimates/tsukihime-translation

## Overview

This project is an open‐source translation and patch repository for “Tsukihime – A Piece of Blue Glass Moon,” a game originally created by Type‐Moon. Its purpose is to provide translated game content by reading, processing, and then repackaging original assets into a patch that users can apply to their copy of the game. The system is not a full-stack web application but rather a file‐system–based, modular patch project that integrates extraction tools, data processing scripts, and mod packaging.

##### Main Components
- Resources & Original Data:
– “images”, “videos”, “script”, “system_strings” directories hold the game’s assets (graphics, user interface assets, game CG, video files, and text/dialogue lines).
– “Ryujinx_mods”, “allscr”, and accompanying subdirectories provide the translated mod data and processed script text.
- Tools and Patch Generation:
– The “tools” directory (and its subdirectories such as “patcher”, “layeredfs”, “add_font_effects.py”) contains scripts and tools for processing the data files. These are used to extract, transform, and inject the new translations into the game’s file formats.
- Workflow & Build/Validation:
– Files in “.github/workflows” (like “script_lint.yml”) and configuration files like “.gitignore” indicate CI/CD or automated checking steps.
- Documentation and Guidelines:
– The “README.md” and “Editing_Guidelines.md” offer contextual and usage documentation to guide users and developers.

- Data Processing Flow:
– Start with original resource files (assets and scripts) stored in “script”, “images”, “videos”, etc.
– Extraction tools (e.g., deepLuna, QuickBMS, Mangetsu, and those in “tools/patcher”) process these files.
– The processed data is then stored in intermediary directories such as “allscr/retimed” or directly in mod folders like “Ryujinx_mods.”
– Translation text files (from the “script” folder) and system strings (from “system_strings”) are integrated via the patcher tools.
- Mod Packaging:
– The output of the transformation is organized under mod directories, ready to be applied in emulators (e.g., Ryujinx) or the game’s engine.
- CI/CD or Script Linting:
– The GitHub Actions workflows add an extra layer of validation or automation through tasks such as linting scripts.

##### Architectural Patterns and Design Principles
- Modularity:
– Each asset type (scripts, images, videos) is maintained in its own directory, allowing independent processing.
- File-based Processing Pipeline:
– The project works as a series of scripted steps (extraction, modification, repackaging) that mirror a pipeline architecture.
- Separation of Concerns:
– Tooling (in “tools”) is kept separate from asset data (in “images”, “script”, “videos”) and from build automation (in “.github/workflows”), ensuring clarity and maintainability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Resources
    subgraph "Input Resources"
        RG1["Game Graphics"] 
        RG2["Videos"]
        RG3["Script Assets"]
        RG4["System Strings"]
    end

    %% Intermediate Processed Data
    subgraph "Intermediate Data"
        INT["Processed Script Data"]
    end

    %% Processing Tools
    subgraph "Processing Tools"
        PT1["Patcher Tools"]
        PT2["LayeredFS Utilities"]
        PT3["Font Effects Script"]
        EXT["Third-Party Tools"]
    end

    %% Mod Packaging Output
    subgraph "Mod Packaging"
        MP["Translated Mod Outputs"]
    end

    %% CI/CD & Validation
    subgraph "CI/CD/Validation"
        CI1["GitHub Workflows"]
        CI2["Git Ignore"]
    end

    %% Documentation
    subgraph "Documentation"
        DOC1["README"]
        DOC2["Editing Guidelines"]
    end

    %% Data Flow Connections
    RG3 -->|"toIntermediate"| INT
    RG3 -->|"toPatcher"| PT1
    RG4 -->|"toPatcher"| PT1
    RG1 -->|"toPatcher"| PT1
    RG2 -->|"toPatcher"| PT1
    INT -->|"toPatcher"| PT1

    PT2 -->|"supports"| PT1
    EXT -->|"integrates"| PT1
    PT1 -->|"generates"| MP
    PT3 -->|"enhances"| MP

    %% CI/CD arrow from raw assets for linting check
    RG3 -->|"linting"| CI1

    %% Styling Classes
    class RG1,RG2,RG3,RG4 raw
    class INT intermediate
    class PT1,PT2,PT3 processing
    class MP output
    class CI1,CI2 cicd
    class DOC1,DOC2 doc
    class EXT external

    %% Class Definitions
    classDef raw fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef intermediate fill:#D5F5E3,stroke:#196F3D,stroke-width:2px;
    classDef processing fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef output fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef cicd fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef doc fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef external fill:#D6DBDF,stroke:#566573,stroke-width:2px;

    %% Click Events
    click RG1 "https://github.com/tsukihimates/tsukihime-translation/tree/main/images"
    click RG2 "https://github.com/tsukihimates/tsukihime-translation/tree/main/videos/en_videos"
    click RG3 "https://github.com/tsukihimates/tsukihime-translation/tree/main/script"
    click RG4 "https://github.com/tsukihimates/tsukihime-translation/tree/main/system_strings"
    click INT "https://github.com/tsukihimates/tsukihime-translation/tree/main/allscr"
    click PT1 "https://github.com/tsukihimates/tsukihime-translation/tree/main/tools/patcher"
    click PT2 "https://github.com/tsukihimates/tsukihime-translation/tree/main/tools/layeredfs"
    click PT3 "https://github.com/tsukihimates/tsukihime-translation/blob/main/tools/add_font_effects.py"
    click EXT "https://github.com/tsukihimates/tsukihime-translation/tree/main/tools"
    click MP "https://github.com/tsukihimates/tsukihime-translation/tree/main/Ryujinx_mods"
    click CI1 "https://github.com/tsukihimates/tsukihime-translation/blob/main/.github/workflows/script_lint.yml"
    click CI2 "https://github.com/tsukihimates/tsukihime-translation/blob/main/.gitignore"
    click DOC1 "https://github.com/tsukihimates/tsukihime-translation/blob/main/README.md"
    click DOC2 "https://github.com/tsukihimates/tsukihime-translation/blob/main/Editing_Guidelines.md"
```
