Knowledge reference persistence in original14.9.1
Research only. Parent owns WASM OPFS/filesystem integration and UI tests. All owned REA sessions were exported and closed. Complete DDR/OR/OOR/BR Evidence and matching snapshots are retained beside this ledger.
Ownership and character file path
DDR KnowledgeViewModule is UI; the persistent list belongs to or.dll RefMan_t. Original DDR imports RefMan GetInstance, Load, AddCharRef, AddItemRef and DeleteRef through IAT100b6134..100b614c.
OOR Preferences::OpenGamePrefs10001c40 forms character directory
Prefs\\%s\\Char%d, creates it, then constructs RefMan(characterPath,20).
The string argument comes from Preferences+0xc4, numeric ID from+0x2c.
GetCharacterPath10001e90 returns Preferences+0x30. OR RefMan ctor100016e0
stores max-load-count at+0, map pointer+4, next-ID1 at+8, and formats
%s\\References.bin at+0xc. Thus path is
Prefs/<login-pref-name>/Char<character-id>/References.bin after host path
normalization. This scope does not trace the source of the login-pref-name.
Evidence OOR open
ev_a2355870dc9bb6114c65ceb2325f1e36f5dee39d7cb484045e47f429d1f1d4bd,
character path
ev_f51b525623297a13f928723e77ce297bfae9b2e8431c18e4b66bf49435dd68d3,
path literal
ev_17451466e118029168de8bcdd080adcef48c3a3359fb79e6160bc4c1c6c85c76,
OR ctor
ev_66b3df9c1aebfed3d10d2c88a8c7ebcae7755daf60dec8356894b8e7f0f49cff,
References.bin literal
ev_1bb56a873347c626ac6ee3d182b81beed39d4733c2268a3f6361f762533a9cf9.
Load trigger and file schema
DDR Knowledge InitialiseMessage10045590 constructs KnowledgeView via10045cb0.
That constructor calls RefMan::Load, then builds its grid. Module shutdown
100455f0 destroys the UI view and clears its pointer; it is not the RefMan
shutdown/save owner.
Evidence initialise
ev_971ba6c08f890b514208d1eb6deaa54d0ae202f2136f847504d7878d29ae5433,
view constructor/load
ev_ec47bc5dfcd85455b0337e3069b6b34e03f557b6f6b1d2016474cd0ac5bea628,
UI shutdown
ev_67d0425c152b54bbc249a635c5e193abd948447f9c3103edffcb13f7b8733cce.
OR Save10002580 writes these fields in order. Every integer is big-endian u32: Save uses File::WriteU32(value,byteOrder0), whose BR10002f30 implementation explicitly emits most-significant byte first. BR100028b0 reads byteOrder0 in the same order. Text is raw byte string without a terminating NUL.
| Field | Format |
|---|---|
| Header version | u32 1003 (0x3eb) |
| Record count | u32 map size |
| Each record | u32 reference subtype, then subtype body below |
| Subtype0 character | u32 source identity type, u32 source identity ID, u32 text byte length, text bytes |
| Subtype1 item | u32 AddItemRef argument1, u32 argument2, u32 argument3 |
| Subtype2 NPC | u32 source identity type, u32 source identity ID, u32 extra1, u32 extra2, u32 text byte length, text bytes |
Subtype1 bodies correspond to Reference members+20,+24,+14 respectively; subtype0 source identity+0xc/+0x10 and text object+0x1c; subtype2 uses extra members+14/+18. The item API's exact endpoint/QL semantics were not independently renamed in this audit. No reference-local ID is serialized; records are emitted by ascending integer map key and rebuilt with next-ID1 through Add*Ref on load. String constructors cap retained text at1024 bytes.
Evidence Save/schema
ev_05da246fb30360ac4a197744626f25a9d6a6d6068cae384188182ec8bf607500,
big-endian writer
ev_2e7f6854a4a200a2ed2cd9f61d940d35ca547d2979b90409e256af817bb6c1ef,
reader
ev_08716034b667d2f8b9878c66005686f21e1d87f1482571966bdbc16299db5392,
character constructor/text cap
ev_5d2775aee09da69821bd6c8fbff1c1b17d4f7e1edc5a8afa6dd3652f6ed3f4fd,
NPC constructor
ev_f0cc2de3f1ea3583720f28b05bb607c635148df6973c32d405caf793abdbea8e.
Load10002150 checks file exists, opens mode1 (rb), requires at least4 bytes
and version1003, reads count, then clamps it to RefMan+0 (20 in this client).
It reads at most that many records and calls Add*Ref with save=false. New
additions in a running session are not capped by this load-only count check.
Thus a file with more than20 records loads only its first20; Save writes the
current full map count. No migration or alternate version branch was found.
Oversized text length>1024 or read error stops the loop; already loaded prefix
remains. The loader adds a temporary NUL for its C-string construction; an
embedded NUL therefore shortens retained text. It does not clear the map at
entry. Unknown subtype skips its body, then advances the record counter.
Evidence ev_f6e79992365c578d18b68d654563b467b1c227fa2b357217a72bda6b3896d0d0.
Save triggers and edge cases
New AddItemRef100018f0, AddCharRef10001a80 and AddNpcRef10001d80 call Save if their last bool is true, after insertion and before next-ID increment. DDR CreateRef10045840 passes true for normal item and completed player refs. Adding an already-present item reference returns its existing local ID without writing; AddItemRef rejects any zero argument. AddCharRef rejects source0:0.
Existing character identity is a separate case: AddCharRef replaces its text (truncated to1024) then returns the old ID before reaching the bool/Save call. So repeat player-reference creation updates memory but does not immediately write References.bin. A later new add, successful delete or RefMan shutdown will serialize the replacement. This is original behavior, not proof that browser persistence already handles it.
Both DeleteRef overloads (integer local ID10002730 and reference identity 100027b0) Save immediately after successful deletion; missing target returns false without a write. DDR DeleteRefMessage10045a60 invokes the identity overload, then refreshes the grid only on success.
RefMan destructor100017c0 calls Save before freeing map entries. OOR Preferences::CloseGamePrefs10001ea0 invokes that destructor when a character is active, then frees RefMan. This is the meaningful logout/game-prefs-close save trigger; merely hiding or destroying Knowledge UI is not this operation. No periodic save timer or dirty flag appeared in RefMan's resolved Save callers. Native Save-call inventory lists only destructor, three Add*Ref methods, and both DeleteRef overloads. Unresolved external calls remain a static-analysis limitation.
Evidence new item
ev_96bb0a4407d721c0c5b2393ab3b26518144e06c7b7d7d27ad5263d35dd933c55,
new/existing character behavior
ev_3e63e9cd73d08343bcd2924ebcbf9ec6161d9769ac47621b6b72be41046b82a5,
NPC add/save flag
ev_2d500f5fb6d1bb4595eb0554fb50b0fd514ddc99f3d5c371ce3117b4bc3a65f5,
DDR create flags
ev_645f68bf2e0d320519efda9e3a3362e8b91149be672b4ff8240cefe463346be8,
delete by local ID
ev_700352944034ee151f6c5884fdb0530881680439cea974e90f6dceaab4059869,
delete by ref identity
ev_a99becb043f267810a4d719cbd684df7ae95c2b5a377ac53cbaef2db4fa08deb,
DDR delete
ev_2f9f821863227bed3565db37f074897d83b99fd5723f4e881c205bd77a75b01a,
RefMan destructor
ev_1234e3e15eed19c99e9bc8540923adc127ef4b51b58f8d6b3208bff7dcb8cf2d,
prefs close
ev_9862caacf7331c416e30185c3b9d97945ba57a079b2a95ffdc0874e4d02031cb,
Save caller inventory
ev_61ffe16319f84a1534d516b42583637717cdbca18d229649c5cb4257f5753b4c.
File write boundary and ABI
Save first requests permissions0x180 (0600), constructs File(path), temporarily
disables the global IO error handler, and opens mode2 (wb/truncate). On open
success it restores the prior handler, writes header+records, then destroys
File (closing the stream). There is no atomic rename or journaling protocol
in this routine, and no write-result checks at the RefMan layer. An open
failure silently skips writing under its disabled handler. The old global
handler is not restored on that failure branch in this original routine.
BR File::Open10002310 maps mode1 to rb and mode2 to wb; exact original literals
are retained in native-ranges.json.
Evidence ev_741913e3c022b33a93d82702860d9dabe74fb3febbcc19487f54ef65ddd87f49.
Native methods are thiscall, ECX=RefMan; guest cleanup including return: Load/Save/destructor4, AddCharRef(identity-ref,string-ref,bool)16, AddItemRef(int,int,int,bool)20, DeleteRef(identity-ref or int)8. OR Add APIs return integer local reference ID; Delete returns AL bool. BR WriteU32(value,ByteOrder) and ReadU32(out-ref,ByteOrder) are thiscall, guest cleanup12, returning IOError enum (zero success). This is local disk serialization, independent of the game network packet byte order.
Verification limits
This audit establishes original disk path/schema and native triggers, not the WASM mounted filesystem location, OPFS flush timing, browser reload/logout delivery, cross-character isolation or actual restored Knowledge UI. Parent owns those runtime observations. No production sources or database changed.
Parent follow-up: empty bootstrap and update fixture
An existing zero-byte file is safe against an uninitialized header read: Load10002150 only enters the header parser when native File size>3. Empty file reaches File destruction/return. The loader's global error-handler restoration is narrower than its initial disabling; this ledger does not claim every early-return branch restores that global state.
For a WASM-only immediate-save correction to existing character replacements, the original bool means save-now, matching Add*Ref's new-record behavior and Load's false. Preserve the original bool before the duplicate branch reuses its stack DWORD for text length: entry guestESP+12, equivalently EBP+0x10. Do not infer the bool afterward from that overwritten slot. The recommended scope does not make save=false imports write during Load.
Highest public native test points, all client/game/or.dll/lifted-0000.c: constructor3F0016E0:1210, destructor3F0017C0:1323, AddItem3F0018F0:1555, AddChar3F001A80:1827, Load3F002150:2972, Save3F002580:5760, Delete(local ID)3F002730:6492, Delete(identity)3F0027B0:6588. An asserted in-memory File_t import boundary can preserve real RefMan map, string and serialization logic while checking emptyLoad/add/reload/update/ delete behavior without launching the game. File imports in OR are at 406c ctor,4070 permissions,4074 IO handler,4078 Write,407c WriteU32, 4080 destructor,4084 Open,4088 Exists,408c ReadU32,4090 Read (all original VA1000xxxx). Parent owns the production/test changes.