TalkEd is organized around a single Delphi 7 VCL application with a form-driven UI and one main domain unit for TLK file parsing and persistence.
The architecture is simple by modern standards:
- one project entrypoint,
- one main orchestration form,
- several modal forms for focused operations,
- one TLK file handler that owns file IO and in-memory entries,
- a few utility units for string and grid support.
TLKEdit.dpr performs the following high-level sequence:
- initialize the VCL application,
- create the main form,
- create the search, entry, language, confirm-delete, and pad forms,
- inspect the first command-line argument,
- if that argument exists and ends in
.tlk, callMainForm.LoadFile(...), - run the application message loop.
This means TalkEd supports both normal GUI startup and a file-associated launch flow.
UMainForm.pas is the operational center of the app.
Responsibilities include:
- loading and saving TLK files,
- managing interval-based grid display,
- dispatching search and edit actions,
- prompting before destructive or state-losing actions,
- reflecting current selection into the detail memo,
- controlling auxiliary modal forms.
Important behaviors:
- large files are intentionally displayed by interval to limit memory cost,
- the app tracks unsaved modification state through the TLK handler,
- delete operations reindex following
StrRefvalues, - append and pad workflows can expand the talk table significantly.
UTLKFile.pas holds the core model and serialization logic.
Represents one TLK entry, including:
- entry flags,
- sound resref,
- volume variance,
- pitch variance,
- string offset,
- string size,
- sound length,
- numeric
StrRef, - string text,
- a boolean marking entries created or modified in-session.
Entries are stored in a custom doubly linked list rather than a Delphi container class.
Implications:
- traversal is sequential,
- many workflows scan entries linearly,
- edits preserve the project’s original data structure assumptions,
- delete operations must maintain list integrity and
StrRefreindexing.
Owns:
- TLK header fields,
- string count,
- entry-table offset,
- filename and open-state tracking,
- dirty/modified state,
- add/replace/delete/new/load/save operations.
Notable serialization behavior:
- validates the TLK file signature and version
V3.0, - reads and writes the TLK header and string data table,
- handles long strings by reading and writing in segments rather than assuming a single 4096-byte buffer is enough,
- uses entry text length as the stored string size,
- marks new or modified entries as custom.
Encapsulates search criteria state and input validation.
Supported search modes include:
- exact text,
- substring text,
- whole-word style matching,
- case-sensitive matching,
- negated matching,
- sound-entry filtering,
- non-blank filtering,
- new-entry filtering,
- range-constrained filtering.
Used for both add and edit workflows.
Captures:
- entry text,
- text-present flag,
- sound-present flag,
- sound-length-present flag,
- sound resref,
- volume variance,
- pitch variance,
- sound length.
Small modal form for editing the TLK language id.
Collects a target StrRef and pads the talk table with blank entries up to that point.
Provides a dedicated delete confirmation dialog before reindexing the table.
StoffeUtils.pas: string helpers such as substitution and substring helpers.UStrTok.pas: tokenizer support used by word-search logic.modgrids.pas: grid-related helpers.
The normal editing loop looks like this:
TMainFormasksTTLKFileHandlerto load a file.- The file handler parses the header and populates the linked list.
- The main form renders an interval of entries into the grid.
- Auxiliary forms collect user input for edits, searches, or metadata changes.
- The main form translates those form values into
TTLKStringupdates. - The file handler marks the model modified.
- The main form re-renders the current interval or search results.
- Save writes the linked-list contents back to a new TLK binary.
- Form creation is eager rather than on-demand.
- Units are tightly coupled through globals and shared forms.
- The TLK model is mutable and UI-driven.
- There is no test seam or dependency-injection layer.
- Manual runtime verification remains the realistic validation strategy.
Extra care is required when modifying:
UTLKFile.paslong-string serialization,- delete and append operations that affect
StrRefordering, - any code path that assumes the linked list cursor state,
- save/load behavior for sound resrefs and lengths,
- search behavior where flags interact.