# osutitanic/hook architecture

> Architecture diagram of the GitHub repository osutitanic/hook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/osutitanic/hook
- Repository: https://github.com/osutitanic/hook

## Overview

Titanic! Hook launches an existing osu! client under a loader, then patches its runtime so older stable clients can connect to private servers and avoid compatibility issues. The main flow runs launch checks, loads the client, installs early hooks, and initializes the broader hook set at client startup. The graph preserves documented connection redirection, compatibility fixes, and plugin support. Some hook wiring is represented at directory level because those implementations were not sampled.

Main entry points: [`TitanicHook.Core/EntryPoint.cs`](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/EntryPoint.cs) (Hook entry point), [`TitanicHook.Loader/Program.cs`](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/Program.cs) (Loader), [`TitanicHook.Loader/OsuStartHook.cs`](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/OsuStartHook.cs) (Client start hook), [`TitanicHook.Core/Framework/PatchManager.cs`](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Framework/PatchManager.cs) (Patch manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Client launch"]
  node_loader["Loader<br/>[Program.cs]"]
  node_checks["Launch checks<br/>[PreLaunchChecks.cs]"]
  node_updater["Update handling<br/>[Updater.cs]"]
end

subgraph group_runtime["Hook runtime"]
  node_config["Configuration<br/>[Configuration.cs]"]
  node_earlyhooks["Early load hooks<br/>[Loading]"]
  node_startpatch["Client start hook<br/>[OsuStartHook.cs]"]
  node_entry["Hook entry point<br/>[EntryPoint.cs]"]
  node_patchmanager["Patch manager<br/>[PatchManager.cs]"]
  node_patchbase["Patch definitions<br/>[TitanicPatch.cs]"]
  node_scan["Version-agnostic scanning<br/>[SigScanning.cs]"]
  node_version["Client version detection<br/>[OsuVersion.cs]"]
end

subgraph group_network["Network redirection"]
  node_dns["DNS redirection"]
  node_tcp["TCP redirection<br/>[TcpClientHook.cs]"]
  node_http["HTTP connection hooks<br/>[Connection]"]
end

subgraph group_features["Fixes and extensions"]
  node_misc["Client behavior patches<br/>[Misc]"]
  node_fixes["Compatibility fixes<br/>[Fixes]"]
  node_pluginloader["Plugin loader<br/>[PluginLoader.cs]"]
  node_plugin["Plugin API<br/>[IPlugin.cs]"]
end

node_user(("Player"))
node_osu["osu! client"]
node_server(("Private server"))

node_user -->|"starts"| node_loader
node_loader -.->|"checks updates"| node_updater
node_loader -->|"loads"| node_config
node_loader -->|"runs"| node_checks
node_loader -->|"loads assembly"| node_osu
node_loader -->|"installs"| node_earlyhooks
node_loader -->|"hooks entry"| node_startpatch
node_startpatch -->|"initializes hooks"| node_entry
node_entry -->|"reads and saves"| node_config
node_entry -->|"detects version"| node_version
node_entry -->|"applies patches"| node_patchmanager
node_patchmanager -->|"patches"| node_patchbase
node_version -->|"uses IL scanning"| node_scan
node_entry -->|"applies"| node_dns
node_entry -->|"conditionally applies"| node_tcp
node_entry -->|"applies supported hooks"| node_http
node_tcp -->|"resolves Bancho IP"| node_server
node_dns -->|"redirects lookups"| node_server
node_http -->|"redirects requests"| node_server
node_entry -->|"applies"| node_misc
node_entry -->|"conditionally applies"| node_fixes
node_entry -.->|"loads optionally"| node_pluginloader
node_pluginloader -->|"loads implementations"| node_plugin

click node_loader "https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/Program.cs"
click node_checks "https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/PreLaunchChecks.cs"
click node_updater "https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/Updater.cs"
click node_config "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Configuration.cs"
click node_earlyhooks "https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Loading"
click node_startpatch "https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/OsuStartHook.cs"
click node_entry "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/EntryPoint.cs"
click node_patchmanager "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Framework/PatchManager.cs"
click node_patchbase "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Framework/TitanicPatch.cs"
click node_scan "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Helpers/SigScanning.cs"
click node_version "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/OsuInterop/OsuVersion.cs"
click node_dns "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Hooks/Connection/DnsHostByNameHook.cs"
click node_tcp "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Hooks/Connection/TcpClientHook.cs"
click node_http "https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Connection"
click node_misc "https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Misc"
click node_fixes "https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Fixes"
click node_pluginloader "https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/PluginApi/PluginLoader.cs"
click node_plugin "https://github.com/osutitanic/hook/blob/master/TitanicHook.PluginBase/IPlugin.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loader,node_checks,node_updater,node_osu toneBlue
class node_config,node_earlyhooks,node_startpatch,node_entry,node_patchmanager,node_patchbase,node_scan,node_version toneAmber
class node_dns,node_tcp,node_http,node_server toneMint
class node_misc,node_fixes,node_pluginloader,node_plugin toneRose
class node_user toneIndigo
```

## Components

### Client launch

- [Loader](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/Program.cs): `TitanicHook.Loader/Program.cs`
- [Launch checks](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/PreLaunchChecks.cs): `TitanicHook.Loader/PreLaunchChecks.cs`
- [Update handling](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/Updater.cs): `TitanicHook.Loader/Updater.cs`

### Hook runtime

- [Configuration](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Configuration.cs): `TitanicHook.Core/Configuration.cs`
- [Early load hooks](https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Loading): `TitanicHook.Core/Hooks/Loading`
- [Client start hook](https://github.com/osutitanic/hook/blob/master/TitanicHook.Loader/OsuStartHook.cs): `TitanicHook.Loader/OsuStartHook.cs`
- [Hook entry point](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/EntryPoint.cs): `TitanicHook.Core/EntryPoint.cs`
- [Patch manager](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Framework/PatchManager.cs): `TitanicHook.Core/Framework/PatchManager.cs`
- [Patch definitions](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Framework/TitanicPatch.cs): `TitanicHook.Core/Framework/TitanicPatch.cs`
- [Version-agnostic scanning](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Helpers/SigScanning.cs): `TitanicHook.Core/Helpers/SigScanning.cs`
- [Client version detection](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/OsuInterop/OsuVersion.cs): `TitanicHook.Core/OsuInterop/OsuVersion.cs`

### Network redirection

- [DNS redirection](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Hooks/Connection/DnsHostByNameHook.cs): `TitanicHook.Core/Hooks/Connection/DnsHostByNameHook.cs`
- [TCP redirection](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/Hooks/Connection/TcpClientHook.cs): `TitanicHook.Core/Hooks/Connection/TcpClientHook.cs`
- [HTTP connection hooks](https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Connection): `TitanicHook.Core/Hooks/Connection`

### Fixes and extensions

- [Client behavior patches](https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Misc): `TitanicHook.Core/Hooks/Misc`
- [Compatibility fixes](https://github.com/osutitanic/hook/tree/master/TitanicHook.Core/Hooks/Fixes): `TitanicHook.Core/Hooks/Fixes`
- [Plugin loader](https://github.com/osutitanic/hook/blob/master/TitanicHook.Core/PluginApi/PluginLoader.cs): `TitanicHook.Core/PluginApi/PluginLoader.cs`
- [Plugin API](https://github.com/osutitanic/hook/blob/master/TitanicHook.PluginBase/IPlugin.cs): `TitanicHook.PluginBase/IPlugin.cs`

### Other components

- **Player**
- **osu! client**
- **Private server**

## Connections

- Player → Loader: starts
- Loader → Update handling: checks updates
- Loader → Configuration: loads
- Loader → Launch checks: runs
- Loader → osu! client: loads assembly
- Loader → Early load hooks: installs
- Loader → Client start hook: hooks entry
- Client start hook → Hook entry point: initializes hooks
- Hook entry point → Configuration: reads and saves
- Hook entry point → Client version detection: detects version
- Hook entry point → Patch manager: applies patches
- Patch manager → Patch definitions: patches
- Client version detection → Version-agnostic scanning: uses IL scanning
- Hook entry point → DNS redirection: applies
- Hook entry point → TCP redirection: conditionally applies
- Hook entry point → HTTP connection hooks: applies supported hooks
- TCP redirection → Private server: resolves Bancho IP
- DNS redirection → Private server: redirects lookups
- HTTP connection hooks → Private server: redirects requests
- Hook entry point → Client behavior patches: applies
- Hook entry point → Compatibility fixes: conditionally applies
- Hook entry point → Plugin loader: loads optionally
- Plugin loader → Plugin API: loads implementations
