simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Apr 2 21:19:06 BST 2023


TL;DR:
  8d3a93c js: load games using FileReader.readAsArrayBuffer()

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2023-04-02 21:19:06

commit 8d3a93ce47237114a88d8bed81ab175994eb9a6b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8d3a93ce47237114a88d8bed81ab175994eb9a6b;hp=2499eb47fa4e0c86bc1b6100b4922026670b2ad8
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Sun Apr 2 20:58:30 2023 +0100

    js: load games using FileReader.readAsArrayBuffer()
    
    Using .readAsText() meant that trying to load a non-text file (for
    instance something that's not a save file at all) would generate an
    "RuntimeError: index out of bounds".  This would then leave the
    Emscripten runtime in a broken state.
    
    It might even be possible for a real save file not to be valid UTF-8,
    for instance if it came from a platform that used a different character
    encoding for random seeds.
    
    There's still a problem with opening very large files, apparently
    because Emscripten tries to stuff the entire file onto the C stack.
    That will probably have to be fixed by properly exposing the incremental
    file-loading API to JavaScript.

 emccpre.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)



More information about the tartarus-commits mailing list