# ifbars/s1-loader architecture

> Architecture diagram of the GitHub repository ifbars/s1-loader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ifbars/s1-loader
- Repository: https://github.com/ifbars/s1-loader

## Overview

##### Project Type & Purpose
- This is a small, standalone CLI tool (a Windows batch script) whose sole responsibility is to manage dual “Schedule I” installs (IL2CPP vs Mono) under Steam.
- It uses directory junctions (`mklink /J`) and Steam manifest file swapping to switch branches atomically, preserving Steam’s update and cloud features.

##### File-Structure Analysis
- Top level:
- `s1-loader.bat` – the entire tool (batch script)
- `README.md`, `LICENSE`, `.gitignore` – ancillary documentation/config
- No frontend/backend split, no libraries—just one script interacting with:
- Windows OS (file system, junctions)
- Steam (game folder + manifest files)
- Developer workflows (MSBuild/Visual Studio integration points)

##### Key Components
a. **s1-loader.bat (Core Processor)**
- Initial-setup wizard
- Branch-switch logic (junction creation/removal, manifest backup/restore)
- Error handling & recovery
b. **Windows OS / File System**
- Underlying NTFS junction support
- Directory operations (create, delete, copy)
c. **Steam**
- Steam Library root
- Active manifest `appmanifest_<ID>.acf`
- Backup manifests (`_public`, `_alternate`)
d. **Branch Folders**
- `Schedule I_public` (IL2CPP files)
- `Schedule I_alternate` (Mono files)
- Junction link `Schedule I` pointing to the “active” folder
e. **Developer Integration (Optional)**
- MSBuild property groups
- Visual Studio build configurations
- Post-build copy to the appropriate `Mods` folder

##### Relationships & Data Flow
- User invokes the batch script → the script reads/writes directories and manifest files
- The script uses `mklink /J` to repoint `Schedule I` to either the IL2CPP or Mono branch folder
- It atomically swaps Steam’s `appmanifest_*.acf` to keep Steam continuously aware of the “active” branch
- Optionally, after compilation, mods are auto-deployed to the branch folder (via MSBuild hooks)

##### Architectural Patterns & Principles
- Single-responsibility: one script, one job
- Transactional/swappable components: atomic manifest swaps and junction changes
- Extensibility points: hooks for dev workflows (conditional MSBuild tasks)

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "User Layer"
    U["User<br/>(runs s1-loader.bat)"]:::user
  end

  subgraph "Script Layer"
    S["Batch Script Engine<br/>s1-loader.bat"]:::script
    R["README.md"]:::script
    L["LICENSE"]:::script
    G[".gitignore"]:::script
    S -->|invokes| F["File System Operations"]:::os
    S -->|manages| M["Manifest Swaps"]:::data
    S -->|creates| J["Junction Links"]:::data
  end

  subgraph "External Systems"
    OS["Windows NTFS File System"]:::os
    Steam["Steam Library<br/>appmanifest files"]:::external
  end

  subgraph "Data Stores"
    P["Schedule I_public"]:::branch
    A["Schedule I_alternate"]:::branch
    Active["Schedule I Junction (active)"]:::branch
  end

  U --> S
  S --> OS
  S --> Steam
  F --> OS
  M --> Steam
  J --> OS
  J --> P
  J --> A
  J --> Active

  click S "https://github.com/ifbars/s1-loader/blob/master/s1-loader.bat"
  click R "https://github.com/ifbars/s1-loader/blob/master/README.md"
  click L "https://github.com/ifbars/s1-loader/tree/master/LICENSE"
  click G "https://github.com/ifbars/s1-loader/blob/master/.gitignore"

  classDef user fill:#ffe599,stroke:#d39e00;
  classDef script fill:#f9cb9c,stroke:#b55a00;
  classDef os fill:#cfe2f3,stroke:#2a5f8d;
  classDef external fill:#d9ead3,stroke:#38761d;
  classDef data fill:#ead1dc,stroke:#741b47;
  classDef branch fill:#f4cccc,stroke:#a61c00;
```
