Skip to content

Add managed string and array reads - #147

Open
ero-qt wants to merge 21 commits into
LiveSplit:masterfrom
ero-qt:managed-readers
Open

Add managed string and array reads#147
ero-qt wants to merge 21 commits into
LiveSplit:masterfrom
ero-qt:managed-readers

Conversation

@ero-qt

@ero-qt ero-qt commented Aug 29, 2026

Copy link
Copy Markdown

Depends on #146.
Part of #149.

Adds read_string and read_array to both backends' Module. The crate had no way to read a System.String or a managed array; the raw route is a fixed-size read at a memorized header offset, unchecked against the count and wrong at the other width.

  • read_string reads the character count, then exactly that many UTF-16 characters. Counts past the buffer, negative counts, and null references fail rather than truncate.
  • read_array does the same with the length, judged at pointer width before narrowing so a huge value can't slip through as its low half. Element type is the caller's claim, like Process::read; the docs list the mappings (managed char is u16, Rust char never matches).
  • Both take the address the reference is stored at (a pointer path's end, a static table slot) and dereference at the module's own width, so 32-bit games need no special handling.

ArrayVec shows up in a public signature for the first time; the crate already re-exports arrayvec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant