Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
68363bf
Update README to reflect current project plans
SyntaxNyah Nov 15, 2026
e4e0ae3
assets: a one-frame animated WebP decodes to its frame
SyntaxNyah Nov 15, 2026
6f0d1b8
wardrobe: a setting to wear a character with one click
SyntaxNyah Nov 15, 2026
a52a5cf
courtroom: a held message asks again for what it waits on
SyntaxNyah Nov 15, 2026
7c52206
ui: the theme fit preview shows its drag hint only with a design (#153)
SyntaxNyah Nov 15, 2026
633742b
ui, render: effect dropdown icons keep their shape (#77)
SyntaxNyah Nov 15, 2026
96ec55b
ui, render: the sprite preview uses the character's scaling (#88)
SyntaxNyah Nov 15, 2026
dfd2e8b
ui: the SFX Browser opens in front of the Extras box (#32)
SyntaxNyah Nov 15, 2026
ca655a6
ui: each list's ⋮ menu shows only its own options (#85)
SyntaxNyah Nov 15, 2026
08e2c0e
ui: fold repeated blankposts in the IC log
SyntaxNyah Nov 16, 2026
09d8810
deps: bump aolib to v2.6.5
SyntaxNyah Nov 17, 2026
207a6c8
changelog: v2.1.1-rc.1
SyntaxNyah Nov 18, 2026
53589ad
ui: make server description links clickable where they appear (#134)
SyntaxNyah Nov 14, 2026
006b3d1
ui: draw the log row the bottom edge cuts in half (#116)
SyntaxNyah Nov 14, 2026
9b5340e
assets: archive and export find the player's files in every format
SyntaxNyah Nov 14, 2026
7505b0a
saver: one background file writer for jukebox, notebook and wardrobe
SyntaxNyah Nov 14, 2026
0922248
media: ask the disk cache until its index is scanned
SyntaxNyah Nov 14, 2026
afe956d
media, assets: keep learned formats and winners in learned.json
SyntaxNyah Nov 14, 2026
9f3157a
assets, config, ui: one learned-formats table; remove the format over…
SyntaxNyah Nov 14, 2026
9b0fad8
docs: remove BENCHMARKS.md
SyntaxNyah Nov 14, 2026
5b6f52c
media: compact, gzip'd learned.json; build and parse it off the media…
SyntaxNyah Nov 14, 2026
e9e72e1
courtroom, ui: OOC names coloured by sender; no hanging indent in OOC…
SyntaxNyah Nov 14, 2026
d5472a2
ui: hide the emote page arrows where they can't move (#61)
SyntaxNyah Nov 14, 2026
e80cb6f
media: parse learned.json's byte fields at 8 bits
SyntaxNyah Nov 14, 2026
4622c6b
ci: drop the alloc gate for the removed resolver benchmark
SyntaxNyah Nov 14, 2026
e9cadd9
media: one folder-listing parser, which knows a listing from an index…
SyntaxNyah Nov 15, 2026
63dc7f4
media, assets: map a character's folders so missing files cost no req…
SyntaxNyah Nov 15, 2026
11ec81a
media, assets, render: decoded images reach the pump through TakeResults
SyntaxNyah Nov 15, 2026
781196a
assets: let animated decodes through the gate in arrival order
SyntaxNyah Nov 15, 2026
d9e5457
courtroom, media, assets: the courtroom asks the media system directly
SyntaxNyah Nov 15, 2026
6359ae8
assets: background decodes wait for uploads under a memory limit
SyntaxNyah Nov 15, 2026
b1db06d
assets: exact-size frames, and APNG decodes one frame at a time
SyntaxNyah Nov 15, 2026
ee15c1b
ui, render, assets: screens and audio ask the media system directly
SyntaxNyah Nov 15, 2026
88bc326
network: open a body as it arrives, and read one byte range
SyntaxNyah Nov 15, 2026
bfb07ff
cache: downloads arrive in a partial file and are adopted when complete
SyntaxNyah Nov 15, 2026
083057a
cache: clear a crashed session's downloads before the cache opens
SyntaxNyah Nov 15, 2026
f251e85
assets: give the claim-limit test time for small CI runners
SyntaxNyah Nov 15, 2026
0aa6db7
media, mix, render: music plays while it downloads
SyntaxNyah Nov 15, 2026
0ddc7ce
ui: remove the deprecated Theater mode
SyntaxNyah Nov 15, 2026
a5fa799
media, assets: raw lookups are media requests
SyntaxNyah Nov 15, 2026
a3a4b68
render, assets: a pair never shows a character twice
SyntaxNyah Nov 21, 2026
5c05a88
ui: IC log colours land on the letters that were coloured
SyntaxNyah Nov 21, 2026
ea2e8d9
ui: the Wardrobe is square under the Sharp UI shape
SyntaxNyah Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ linters:
exclusions:
rules:
# mnd applies per package: one joins this list once clean and never leaves it.
- path-except: ^internal[/\\](network|safepath|hwid|metrics|presence|render|theme|helper|protocol|config|courtroom|sdl|ttf|mix|platform|netproxy|media)[/\\]
- path-except: ^internal[/\\](network|safepath|hwid|metrics|presence|render|theme|helper|protocol|config|courtroom|sdl|ttf|mix|platform|netproxy|media|saver)[/\\]
linters:
- mnd
- path: _test\.go
Expand Down
23 changes: 12 additions & 11 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Then set `CGO_ENABLED=1`,

```bash
go test -race -count=1 ./... # full gate
go test -run=NONE -bench=. -benchmem ./... # alloc gates (see docs/BENCHMARKS.md)
go test -run=NONE -bench=. -benchmem ./... # compare against the previous commit, run side by side
gofmt -w . && go vet ./... # before every commit
```

Expand All @@ -142,17 +142,18 @@ heap corruption.
|---|---|---|
| `internal/safepath` | the ONE copy of the zip-slip / symlink / `..` / depth guards (shared by mounts and theme bundles) | no |
| `internal/netproxy` | the socket factory: opens every outbound connection (direct or through an HTTP proxy) by the one configuration | no |
| `internal/saver` | the one background file writer: a change schedules one whole-file replace (temp file + rename) | no |
| `internal/config` | preferences + debounced atomic saver; favorites; local mounts; the Wardrobe's `wardrobe.json` | no |
| `internal/cache` | ByteBudgetLRU (T1/T2) + async disk tier (T3, xxhash full-URL keys) | no |
| `internal/network` | dedup HTTP client (singleflight, 404 TTL, backoff, DNS warm), request priority, master list + tiers + direct connect | no |
| `internal/assets` | AssetType enum, lock-free resolver (learned formats), `Manager` over `internal/media` (the bridge), the player's folders as a media source, decode pool (magic-byte sniffing), WebP/AVIF CGO binding + fallback, Markov prefetcher | no (decoder is SDL-free by rule) |
| `internal/media` | the media system every asset request goes through: `Manager` owns every table on one goroutine, `Get` is safe from any thread, pools run single steps; sources memory → disk cache → `Folders` (the player's folders and .zip packs) → web | no |
| `internal/cache` | ByteBudgetLRU (T1/T2) + async disk tier (T3, xxhash full-URL keys; downloads arrive in `partial/` and are adopted when complete) | no |
| `internal/network` | dedup HTTP client (singleflight, 404 TTL, backoff, DNS warm), master list + tiers + direct connect | no |
| `internal/assets` | AssetType enum, `Manager` over `internal/media` (the bridge; learned formats and winners kept in `learned.json`), the player's folders as a media source, decode pool (magic-byte sniffing), WebP/AVIF CGO binding + fallback, Markov prefetcher | no (decoder is SDL-free by rule) |
| `internal/media` | the media system every asset request goes through: `Manager` owns every table on one goroutine, `Get` is safe from any thread, pools run single steps; sources memory → disk cache → `Folders` (the player's folders and .zip packs) → web; music opens as a `Stream` (downloaded as it plays) instead of bytes | no |
| `internal/protocol` | AO wire (delegated to aolib-go: FantaCode + JSON), MS 2.6/2.8 parse/build, pairing semantics, FeatureSet, WebSocket conn | no |
| `internal/packetutil` | thin bridge over aolib-go: FantaCode primitives, enum maps, typed-parser dispatch, MS both-wire codec | no |
| `internal/courtroom` | session handshake reducer, message lifecycle state machine, typewriter pacing, URL conventions, char.ini | no |
| `internal/theme` | AO2 theme INIs (design/fonts/sounds), asset lookup ladder | no |
| `internal/metrics` | 1 Hz sampler (heap, GC p99, hit rates), cold-load report | no |
| `internal/sdl`, `ttf`, `mix` | our cgo binding to SDL3, SDL3_ttf and SDL3_mixer (Go-style names, Rect/event/display conversion at the boundary) | **yes** |
| `internal/sdl`, `ttf`, `mix` | our cgo binding to SDL3, SDL3_ttf and SDL3_mixer (Go-style names, Rect/event/display conversion at the boundary); `mix.Decoder` reads a Go reader, for music decoded off the main thread | **yes** |
| `internal/render` | TextureStore (T1), viewport compositor, message raster, upload pump, SDL3_mixer audio | **yes** |
| `internal/ui` | immediate-mode kit + screens (lobby/phone book, char select, courtroom, settings, about) | **yes** |
| `internal/ui/wardrobe` | what the Wardrobe window lists: filtering, sorting and grouping saved characters, and parsing the server's `iniswaps.ini` | no |
Expand Down Expand Up @@ -183,7 +184,7 @@ Protocol gotchas already encoded in code/tests — don't "fix" them:
`askchaa` (sent on PN). Only the askchar2 *paging* is legacy — drop the
askchaa reply and every server hangs at "handshaking".
- Sprites have two spellings: `(a)X`/`(b)X` **or** bare `X` (AO2-Client
CharLayer::load_image probes both). `PrefetchWithFallback` owns that
CharLayer::load_image probes both). The alts passed to `media.Get` own that
chain; the prefixed base stays the asset's identity everywhere.
- MS evidence ids are shifted by 1 on the wire (0 = none, legacy); LE
shares SC's lossy double-decode — a literal `&` in evidence text cannot
Expand All @@ -196,14 +197,14 @@ Protocol gotchas already encoded in code/tests — don't "fix" them:
keys are the discovery source. Receive strips a trailing extension from
`4&<name>` (other clients send their dir-scan filename).
- Evidence images are EXACT URLs (`evidence/<file.ext>` — the extension
ships in the LE name): `PrefetchExact`, never the format-probing path.
ships in the LE name): `assets.ExactKey`, never the format-probing path.
- Theme chatbox skin candidates are `chat` → `chatbox` → `chatblank`
(courtroom.cpp:3328) — the stock default theme has NO chatbox.png.
Theme text colors apply only while the theme's own skin drew: they're
designed for that skin (black-on-paper), not our flat dark panel.
- `extensions.json` at the asset origin (webAO convention) is the format
manifest; autodetect (default ON) seeds per-host learned formats from
it. `.webp.static`/`.webp.animated` pseudo-suffixes normalize to .webp.
manifest; it is read on every connect and sets that host's formats and
their order, as written. `.webp.static`/`.webp.animated` pseudo-suffixes normalize to .webp.
- Theme textures live in T1 under `theme://<stem>` keys; the scheme prefix
can't collide with asset URLs. They heal on eviction via themePage.

Expand Down Expand Up @@ -239,7 +240,7 @@ Protocol gotchas already encoded in code/tests — don't "fix" them:
reports, what the code used to do and how it got here belong in commit messages.
Trim by content, never by length: length-based rounds lost the reasons and were
reverted (47e3f7d7).
- Every `Prefetch` call site carries an `// AssetType: X` comment.
- Every `media.Get` call site for an asset carries an `// AssetType: X` comment.
- Tests pin behavior, including performance gates (`testing.AllocsPerRun`).
- Cache keys are full URLs (host included) — per-server separation is
structural. Never key by bare path.
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ asyncao -debug # pprof on localhost:6060
| [BUILDING.md](BUILDING.md) | Step-by-step build guide (Windows/Linux/macOS) |
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Thread model, cache tiers, pipelines |
| [docs/PERFORMANCE.md](docs/PERFORMANCE.md) | Tuning, PGO capture, profiling |
| [docs/BENCHMARKS.md](docs/BENCHMARKS.md) | Recorded numbers for every gate |
| [docs/adr/0001-zero-fallback-by-default.md](docs/adr/0001-zero-fallback-by-default.md) | Why zero fallbacks |
| [docs/PROTOCOL.md](docs/PROTOCOL.md) | The AO2 wire protocol as implemented |
| [docs/DISCORD.md](docs/DISCORD.md) | Discord Rich Presence: setup, privacy, building without it |
Expand All @@ -134,11 +133,8 @@ asyncao -debug # pprof on localhost:6060
Planned, not yet built but future expansions:

- **Eventual mobile support** — native Android / iOS binaries.
- Eventual Legacy AO2 demo file converter to MP4/Video, for Archival. THIS IS MOSTLY DONE. PROBABLY NEEDS SOME IMPROVEMENTS BUT THIS IS A GOOD STATE.
- Dedicated built in theme builder so people can easily make AsyncAO themes by importing images, fonts, colours and exporting them for later. Encourages people to stop relying on QT based themes, while making the proccess streamlined and easy for anyone.
- Lua plugin system so people can add lua plugins and make modifications to the client behaviour or features.
- Migrate to SDL3
-

## Credits

All credit to the original Attorney Online developers — AsyncAO exists because
Expand Down
12 changes: 6 additions & 6 deletions cmd/asyncao-cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"sync/atomic"
"time"

"github.com/SyntaxNyah/AsyncAO/internal/assets"
"github.com/SyntaxNyah/AsyncAO/internal/cache"
"github.com/SyntaxNyah/AsyncAO/internal/helper/value"
"github.com/SyntaxNyah/AsyncAO/internal/media"
"github.com/SyntaxNyah/AsyncAO/internal/netproxy"
"github.com/SyntaxNyah/AsyncAO/internal/platform"
)
Expand Down Expand Up @@ -253,7 +253,7 @@ func cmdWarm(args []string) error {
for _, name := range names {
urls = append(urls, strings.TrimRight(*base, "/")+"/characters/"+name+"/"+charIconStem+ext)
}
fmt.Printf("warming %d char icons as %s (extension via %s)\n", len(urls), ext, assets.ManifestFileName)
fmt.Printf("warming %d char icons as %s (extension via %s)\n", len(urls), ext, media.ManifestFile)
default:
return fmt.Errorf("warm needs -list, or -base with -chars")
}
Expand Down Expand Up @@ -335,15 +335,15 @@ func fetch(client *http.Client, url string) ([]byte, int) { //nolint:forbidigo /
// manifestIconExt reads the extension from extensions.json, defaulting to .png as webAO does.
func manifestIconExt(base string) string {
client := newHTTPClient()
data, status := fetch(client, base+"/"+assets.ManifestFileName)
data, status := fetch(client, base+"/"+media.ManifestFile)
if status != http.StatusOK {
return ".png"
}
m, err := assets.ParseManifest(data)
if err != nil || len(m.CharIcon) == 0 {
lists, err := media.ParseManifest(data)
if err != nil || len(lists[media.ClassCharIcon]) == 0 {
return ".png"
}
return m.CharIcon[0]
return lists[media.ClassCharIcon][0]
}

func readLines(path string) ([]string, error) {
Expand Down
30 changes: 13 additions & 17 deletions cmd/asyncao/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ func run(rt *host.Runtime, serverURL, masterURL string, gpuOpts host.GraphicsOpt
configQuarantine := prefs.Quarantine()
defer prefs.Close()

resolver := assets.NewResolver(prefs)

t2, err := cache.NewByteBudgetLRU[string, []byte](cache.DefaultMaxEntries, cache.DefaultT2BudgetBytes, nil)
if err != nil {
return err
Expand All @@ -143,8 +141,7 @@ func run(rt *host.Runtime, serverURL, masterURL string, gpuOpts host.GraphicsOpt
client := network.NewClientNotFoundTTL(time.Duration(prefs.Load().NotFoundTTLSecVal)*time.Second, sockets)
client.SetAssetOrigin(prefs.Load().AssetOrigin) // power-user Origin/CORS override for asset streaming
client.SetAdaptiveLatencyMultiple(prefs.Load().AdaptiveLatMultipleVal)
decoder := assets.NewDecoderPool(assets.DecodeWorkers())
defer decoder.Close()
decoder := assets.NewDecoder()
decoder.SetAnimatedBudgetMiB(prefs.Load().AnimatedBudgetMiB())
decoder.SetAnimatedDecodeConcurrency(prefs.Load().AnimDecodeConcurrency())

Expand Down Expand Up @@ -253,15 +250,19 @@ func run(rt *host.Runtime, serverURL, masterURL string, gpuOpts host.GraphicsOpt
// --- asset pipeline ---
// Packages beside the executable; the UI appends them after the manual mounts, so an explicit folder wins.
autoMounts := config.DiscoverPackages(config.ExecutableDir())
learnedPath, err := config.LearnedPath()
if err != nil {
log.Printf("learned formats won't be kept: %v", err)
}
manager := assets.NewManager(assets.ManagerDeps{
Resolver: resolver,
Prefs: prefs,
T2: t2,
Disk: disk,
Source: client,
Decoder: decoder,
T1Contains: store.ContainsAnimated,
T1Failed: store.FailedRecently,
Prefs: prefs,
T2: t2,
Disk: disk,
Source: client,
Decoder: decoder,
T1Contains: store.ContainsAnimated,
T1Failed: store.FailedRecently,
LearnedPath: learnedPath,
})
defer manager.CloseMedia()
// 0 = unlimited.
Expand All @@ -286,10 +287,6 @@ func run(rt *host.Runtime, serverURL, masterURL string, gpuOpts host.GraphicsOpt
s := client.Stats()
return s.Requests, s.Cached404s
},
LearnedHits: func() (int64, int64) {
s := resolver.Stats()
return s.LearnedHits, s.LearnedMisses
},
})
profiler.Start()
defer profiler.Stop()
Expand Down Expand Up @@ -317,7 +314,6 @@ func run(rt *host.Runtime, serverURL, masterURL string, gpuOpts host.GraphicsOpt
app := ui.NewApp(uiCtx, ui.Deps{
Profiler: profiler,
Prefs: prefs,
Resolver: resolver,
Manager: manager,
Disk: disk,
Client: client,
Expand Down
8 changes: 4 additions & 4 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Prefetch(base, type, prio) PrefetchWithFallback(base, altBase, ...)
→ Warning{base, formats tried} → UI banner (12 s,
courtroom + char select)
chain already exhausted → warn, submit nothing ← the gate, above the pool
decode pool: sniff magic bytes (never extensions) → RGBA frames (pooled px);
decode pool: sniff magic bytes (never extensions) → RGBA frames;
STILL assets capped at maxDecodedAssetBytes (T1 budget / 4, the
cache.MaxDecodedAssetBytes single source of truth — one landing
page can never evict even half the main tier); ANIMATED assets
Expand Down Expand Up @@ -519,7 +519,7 @@ so a release hit-tests where it actually happened.
server-tab strip (`tabs.go`), and **every screen offsets its content by
it** — no screen may hardcode `menuBarH` or `tabBarH`. Both halves
self-zero (the menu bar in the full-window modes that preempt the
screen dispatch — gif export, replay, scene maker, theater; the strip
screen dispatch — gif export, replay, scene maker; the strip
when there are no sessions or the user has dragged it out of the band),
so a screen never has to ask *which* chrome is showing. The strip has
exactly two draw sites — inside the courtroom pass, beneath a layout
Expand Down Expand Up @@ -598,7 +598,7 @@ The Wardrobe saves characters for the player, across servers:
server's list. The window rebuilds its list only when the store's revision, the query or the server changes, so
painting allocates nothing per frame.
- **The server's list:** `<asset origin>/iniswaps.ini`, AO2's name for it (courtroom.cpp:5349), fetched once per
server through `FetchRaw` (T2 + disk cached, singleflight), at most 4096 names.
server through `assets.Raw` (a media request: memory, disk cache, folders, web), at most 4096 names.
- **Drawing:** rounded shapes and line icons come from `ui/shapes.go`, white masks rasterised once with
`golang.org/x/image/vector` and tinted per draw, so they cost a few copies and no allocation.
- **Character Select's ★** reads a lowercase membership set rebuilt only when the store's revision moves.
Expand Down Expand Up @@ -631,7 +631,7 @@ a solo sprite.
| `hashicorp/golang-lru/v2` (+expirable) | thread-safe LRU; wrapped only for byte accounting |
| `golang.org/x/sync` singleflight | fetch dedup (v0.20.0, matching the Go 1.25 directive) |
| `cespare/xxhash/v2` | fast non-crypto cache keys |
| `kettek/apng` | APNG decode (the draft's pick was a diff library!) |
| `kettek/apng` | test-only: encodes APNG fixtures. The client decodes APNG itself (`internal/assets/apng.go`), one frame at a time through `image/png`, so a frame's pixels exist only until they are composited; the library decodes every frame before returning |
| `golang.org/x/image` | pure-Go WebP fallback + embedded Go font |
| `coder/websocket` | **addition:** AO2 ≥ 2.11 is WebSocket-only; stdlib has no WS client. Zero-dependency, maintained, context-aware. |
| MSYS2 `libavif` (CGO, no Go module) | **addition (user request):** `.avif` as a probe format — native dav1d/aom decode for stills *and* AV1 image sequences, bound exactly like the libwebp CGO shim (~100 lines). The pure-Go alternatives embed a WASM runtime (gen2brain/avif → wazero), the opposite of this project's soul. CGO-less builds degrade to a descriptive decode error; sniffing (`ftyp` + `avif`/`avis` brands) stays pure Go. |
Expand Down
Loading
Loading