Skip to content

Instantly share code, notes, and snippets.

@curiousdannii
curiousdannii / cross release saves.md
Created September 10, 2025 11:47
Cross-release Inform saves

With some assistance from the compiler, Inform games could more easily and reliably enable cross-release saves. This could possibly even be included by default.

The standard way of saving/restoring is to basically create a memory dump. Very simple and efficient, but it requires the storyfile to be identical because there's no way of understanding a memory dump for another release.

Cross-release saves must instead create a structured savefile. Imagine serialising all the data into JSON. (In fact we could use JSON, but probably it would be more efficient to use a binary format. Or we could embed gzip into Glulx so that we don't have to worry about being verbose.)

Start with objects. A structured save would:

  1. Loop through each object
  2. Output an dict using a unique name for each object. Inform already has these, except for anonymous objects, which it would be reasonable to give seqential names to.
This file has been truncated, but you can view the full file.
!% -Cu
!% $ZCODE_LESS_DICT_DATA=1;
!% $OMIT_UNUSED_ROUTINES=1;
!% -s
!% $ALLOC_CHUNK_SIZE=32000
!% $MAX_ARRAYS=10000
!% $MAX_CLASSES=200
!% $MAX_VERBS=255
!% $MAX_LABELS=200000
!% $MAX_ZCODE_SIZE=1000000
This file has been truncated, but you can view the full file.
!% -s
!% $ALLOC_CHUNK_SIZE=32000
!% $MAX_ARRAYS=10000
!% $MAX_CLASSES=200
!% $MAX_VERBS=255
!% $MAX_LABELS=200000
!% $MAX_ZCODE_SIZE=500000
!% $MAX_STATIC_DATA=180000
!% $MAX_PROP_TABLE_SIZE=200000
!% $MAX_INDIV_PROP_TABLE_SIZE=20000
This file has been truncated, but you can view the full file.
# 1 "/home/dannii/if-decompiler/tests/glulxercise2.ulx.disassembled/functions_unsafe.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "/home/dannii/if-decompiler/tests/glulxercise2.ulx.disassembled/functions_unsafe.c"
# 1 "/home/dannii/if-decompiler/upstream/cheapglk/glk.h" 1
# 17 "/home/dannii/if-decompiler/upstream/cheapglk/glk.h"
# 1 "/usr/lib/gcc/x86_64-linux-gnu/10/include/stdint.h" 1 3 4
This file has been truncated, but you can view the full file.
#include "glk.h"
#include "glulxe.h"
#include "glulxtoc.h"
#include <math.h>
void execute_loop(void) {
glui32 temp0, temp1, temp2, temp3, temp4, temp5;
while (1) {
switch (pc) {
// VM Function 60 (Main__)
The print the game checksum rule translates into I6 as "PrintGameChecksum".
The print the game checksum rule is listed in the after printing the banner text rules.
Include (-
[ PrintGameChecksum checksum i temp;
print "Checksum ";
checksum = HDR_CHECKSUM-->0;
for ( i = 28 : i >= 0 : i = i - 4 )
{
@ushiftr checksum i temp;
temp = temp & $0F;
@curiousdannii
curiousdannii / Makefile
Created June 29, 2017 11:39
Emscripten bug 5330
# Emscripten
CC = emcc \
-O3
LINK_OPTS = \
-s EMTERPRETIFY=1 \
-s EMTERPRETIFY_ASYNC=1 \
-s EMTERPRETIFY_FILE='"hello.js.bin"' \
-s EXPORTED_FUNCTIONS='["_main"]' \
-s MODULARIZE=1 \
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ZVM = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var clone = (function() {
'use strict';
var nativeMap;
try {
nativeMap = Map;
} catch(_) {
// maybe a reference error because no `Map`. Give it a dummy value that no
// valu
@curiousdannii
curiousdannii / book-chapter-lengths.json
Last active April 22, 2016 03:54 — forked from openbibleinfo/book-chapter-lengths.txt
Number of verses in chapters of various Bible translations
This file has been truncated, but you can view the full file.
{
"1Chr.11": {
"46": [
"en_dra",
"la_vulgate"
],
"47": [
"ar_erv-ar",
"ar_nav",
"awa_erv-awa",
@curiousdannii
curiousdannii / Flexible Windows.i7x
Last active August 29, 2015 14:14
Cut down Flexible Windows for bug 0001511
Version 1/150127 of Flexible Windows (for Glulx only) by Dannii Willis begins here.
"Exposes the Glk windows system so authors can completely control the creation and use of windows"
[ Flexible Windows was originally by Jon Ingold, with many contributions by Erik Temple. This version has been essentially rewritten from scratch for 6L38 by Dannii Willis. ]
Use authorial modesty.