48 lines
2.4 KiB
Markdown
48 lines
2.4 KiB
Markdown
# Vendored: love2talk
|
|||
|
|
|
||
|
|
Source: `d:\code\love2talk` (by Piotr, MIT — see `LICENSE`).
|
||
|
|
Vendored 2026-08-01 for the Sulphur Memories accessibility mod.
|
||
|
|
|
||
|
|
## What was copied
|
||
|
|
|
||
|
|
`Love2talk.lua`, `tolk.lua`, `encoding.lua`, `macspeech.lua`, `LICENSE`.
|
||
|
|
|
||
|
|
## What was dropped
|
||
|
|
|
||
|
|
- `objc/` — Mac-only submodule, ~4 files. Re-add if a macOS build is ever wanted;
|
||
|
|
`macspeech.lua` is kept so that only the submodule is missing.
|
||
|
|
- `main.lua` — upstream's standalone demo, would collide with the game's own `main.lua`.
|
||
|
|
- `readme.md`, `.gitmodules`, `.gitignore` — not needed here.
|
||
|
|
|
||
|
|
## Local modifications
|
||
|
|
|
||
|
|
| File | Change | Why |
|
||
|
|
|---|---|---|
|
||
|
|
| `Love2talk.lua` | `require "Tolk"` → `require "accessibility.vendor.love2talk.tolk"` | Upstream assumes it sits at the project root. Also fixes a latent case bug: it required `"Tolk"` but the file is `tolk.lua` — works on case-insensitive Windows, would fail elsewhere. |
|
||
|
|
| `Love2talk.lua` | `backend` made `local` | Upstream leaked it as a global. The game's `.luacheckrc` uses a strict globals list, and a stray global risks colliding with game code. |
|
||
|
|
| `Love2talk.lua` | `say`/`isSpeaking` guard on `backend == nil` | On an unsupported OS upstream sets no backend, then dereferences it. Now degrades to silence. |
|
||
|
|
| `Love2talk.lua` | added `silence()` passthrough | `tolk.lua` already exposes `Tolk_Silence`; we need it to cut speech on interrupt. |
|
||
|
|
| `tolk.lua` | `require "encoding"` → `require "accessibility.vendor.love2talk.encoding"` | Same path reason. |
|
||
|
|
|
||
|
|
Nothing else was touched. `encoding.lua` and `macspeech.lua` are byte-identical to upstream.
|
||
|
|
|
||
|
|
## Runtime requirement — DLLs
|
||
|
|
|
||
|
|
`tolk.lua` does `ffi.load("Tolk")`, which goes through the **Windows loader**, not LÖVE's
|
||
|
|
virtual filesystem. The DLLs therefore **cannot live inside a `.love` archive or in this
|
||
|
|
folder** — they must sit next to the executable (`love.exe`) or on `PATH`.
|
||
|
|
|
||
|
|
Required next to `love.exe`:
|
||
|
|
|
||
|
|
- `Tolk.dll`
|
||
|
|
- `nvdaControllerClient64.dll` (NVDA — our target screen reader)
|
||
|
|
- `SAAPI64.dll` (System Access)
|
||
|
|
- plus any other screen-reader clients Tolk should support
|
||
|
|
|
||
|
|
`Love2talk.lua` calls `trySAPI(true)`, so with no screen reader running it falls back to
|
||
|
|
SAPI 5 and still speaks.
|
||
|
|
|
||
|
|
Also note `tolk.lua` calls `Tolk_Load()` **at require time** with no error handling — a
|
||
|
|
missing DLL raises immediately. Always `pcall` the require; `accessibility/speech.lua`
|
||
|
|
does this and degrades to a silent no-op.
|