# mos9527/sssekai architecture

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

- Interactive diagram: https://gitdiagram.com/mos9527/sssekai
- Repository: https://github.com/mos9527/sssekai

## Overview

##### Component Relationships

a) Command Flow:
- Example: abdecrypt.py → crypto/AssetBundle.py

b) Data Flow:
- How data moves from encrypted assets through the processing pipeline
- Where caching occurs via abcache

##### Specific Components

**[Entry Points]**
- Asset Bundle Tools (abcache, abdecrypt, abserve)
- Decryption Tools (apidecrypt, apphash)
- Asset Extractors (live2dextract, spineextract)
- Format Handlers (rla2json, usmdemux)

**[Core Processing]**
- Crypto Module
- APIManager
- AssetBundle
- Unity Module
- AnimationClip
- AssetBundle
- Constants
- Format Module
- moc3
- motion3
- rla

**[Storage]**
- ABCache
- Filesystem Handler

##### Additional Details

Important elements:
- Version compatibility note (Python >=3.10)
- External dependencies and integrations
- About the MIT license
- Integration point with sssekai_blender_io (external tool)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef entrypoint fill:#a8d1f0,stroke:#000
    classDef processing fill:#90EE90,stroke:#000
    classDef storage fill:#FFE5B4,stroke:#000
    classDef api fill:#FFB6C1,stroke:#000

    %% Legend
    subgraph Legend
        E1[Entry Points]:::entrypoint
        P1[Processing Modules]:::processing
        S1[Storage Components]:::storage
        A1[API Components]:::api
    end

    %% Entry Points Layer
    subgraph Entry
        subgraph AssetBundleTools
            ABCache["ABCache CLI"]:::entrypoint
            ABDecrypt["ABDecrypt CLI"]:::entrypoint
            ABServe["ABServe CLI"]:::entrypoint
        end

        subgraph DecryptionTools
            APIDecrypt["APIDecrypt CLI"]:::entrypoint
            AppHash["AppHash CLI"]:::entrypoint
        end

        subgraph AssetExtractors
            Live2DExtract["Live2D Extractor"]:::entrypoint
            SpineExtract["Spine Extractor"]:::entrypoint
        end

        subgraph FormatHandlers
            RLA2JSON["RLA to JSON"]:::entrypoint
            USMDemux["USM Demuxer"]:::entrypoint
        end
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        subgraph CryptoModule
            APIManager["API Manager"]:::processing
            AssetBundleCrypto["Asset Bundle Crypto"]:::processing
        end

        subgraph UnityModule
            AnimationClip["Animation Clip"]:::processing
            AssetBundleUnity["Asset Bundle Unity"]:::processing
            Constants["Sekai Constants"]:::processing
        end

        subgraph FormatModule
            MOC3["MOC3 Handler"]:::processing
            Motion3["Motion3 Handler"]:::processing
            RLA["RLA Handler"]:::processing
        end
    end

    %% Storage Layer
    subgraph Storage
        FSHandler["Filesystem Handler"]:::storage
        Cache["Asset Bundle Cache"]:::storage
    end

    %% Relationships
    ABCache --> Cache
    ABDecrypt --> AssetBundleCrypto
    ABServe --> AssetBundleUnity
    APIDecrypt --> APIManager
    AppHash --> APIManager
    Live2DExtract --> MOC3
    SpineExtract --> Motion3
    RLA2JSON --> RLA
    
    APIManager --> AssetBundleCrypto
    AssetBundleCrypto --> AssetBundleUnity
    AssetBundleUnity --> AnimationClip
    AssetBundleUnity --> Constants
    
    Cache --> FSHandler

    %% Click Events
    click ABCache "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/abcache.py"
    click ABDecrypt "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/abdecrypt.py"
    click ABServe "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/abserve.py"
    click APIDecrypt "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/apidecrypt.py"
    click AppHash "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/apphash.py"
    click Live2DExtract "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/live2dextract.py"
    click SpineExtract "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/spineextract.py"
    click RLA2JSON "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/rla2json.py"
    click USMDemux "https://github.com/mos9527/sssekai/blob/main/sssekai/entrypoint/usmdemux.py"
    click APIManager "https://github.com/mos9527/sssekai/blob/main/sssekai/crypto/APIManager.py"
    click AssetBundleCrypto "https://github.com/mos9527/sssekai/blob/main/sssekai/crypto/AssetBundle.py"
    click AnimationClip "https://github.com/mos9527/sssekai/blob/main/sssekai/unity/AnimationClip.py"
    click AssetBundleUnity "https://github.com/mos9527/sssekai/blob/main/sssekai/unity/AssetBundle.py"
    click Constants "https://github.com/mos9527/sssekai/blob/main/sssekai/unity/constant/SekaiLive2DPathNames.py"
    click MOC3 "https://github.com/mos9527/sssekai/blob/main/sssekai/fmt/moc3.py"
    click Motion3 "https://github.com/mos9527/sssekai/blob/main/sssekai/fmt/motion3.py"
    click RLA "https://github.com/mos9527/sssekai/blob/main/sssekai/fmt/rla.py"
    click FSHandler "https://github.com/mos9527/sssekai/blob/main/sssekai/abcache/fs.py"
    click Cache "https://github.com/mos9527/sssekai/blob/main/sssekai/abcache/__init__.py"
```
