Skip to content

M-Film: film simulation for Canon EOS cameras with Magic Lantern. 72 film stocks (Portra, Velvia, Tri-X, CineStill…), a film-camera interface and an in-camera darkroom that develops your RAWs. 5D Mark III, 6D, 600D, 650D, 700D, EOS M and more.

Build tools: what the build needs checked up front, the fork's patch out of the repository, keep the previous install

Claude0fc79a40ed51
diff --git a/docs/MANUAL.th.md b/docs/MANUAL.th.md
index c49bb81..a710368 100644
--- a/docs/MANUAL.th.md
+++ b/docs/MANUAL.th.md
@@ -41,7 +41,7 @@
### สนับสนุน
System > Support M·FILM แสดง QR code ของลิงก์โดเนท (สูงสุด 2 อัน) ใส่ลิงก์ใน `ml-dev/donate.txt`
-บรรทัดละ `ชื่อ URL` แล้ว build ใหม่ (`tools/genqr.py`, ต้องมี `pip install segno`)
+บรรทัดละ `ชื่อ URL` แล้ว build ใหม่ (`tools/genqr.py`, ต้องมี segno: `setup_wsl.sh` ลง `python3-segno` ให้)
ไม่มีลิงก์ หน้านี้จะขึ้นคำขอบคุณแทน
### ห้องมืด: ล้างฟิล์มในกล้อง
@@ -170,12 +170,17 @@ Brightness (โทนกลาง) และ Conversion (Canon / Rec.709 แบ
- `sim/` ตัวจำลองบนคอม, `preview/` ภาพตัวอย่าง
- `ml-dev/fork/src/filmroll.c` ส่วนเชื่อมกับกล้อง: ม้วนฟิล์ม, log, ตั้งค่ากล้องตามฟิล์ม,
การยึดหน้าจอและปุ่มให้ Film OS, palette
-- `ml-dev/fork/apply_fork.py` และ `fork/film-mode.patch` การแก้ไขบน
+- `ml-dev/fork/apply_fork.py` การแก้ไขบน
[magiclantern_simplified](https://github.com/reticulatedpines/magiclantern_simplified)
- commit `ed3e7c0df` (ตรงกับ build ทางการ 2025-06-20.EOSM.202)
-- `setup_wsl.sh` ตั้งเครื่อง build ใน WSL Ubuntu
+ commit `ed3e7c0df` (ตรงกับ build ทางการ 2025-06-20.EOSM.202) ทุกครั้งที่ build
+ จะได้ diff ทั้งหมดของ fork สำหรับกล้องรุ่นนั้นไว้ดูที่ `ml-dev/out/film-mode-<รุ่น>.patch`
+ (เช่น `film-mode-EOSM.202.patch`, `film-mode-70D.112-module.patch`)
+- `setup_wsl.sh` ตั้งเครื่อง build ใน WSL Ubuntu รวม Python modules ที่ build ใช้ (docutils, numpy, segno)
+ `build_fork.sh` เช็กก่อนเริ่ม build ถ้าขาดตัวไหนจะบอกชื่อ package ที่ต้องลง
- `build_fork.sh` build fork แล้วเก็บไฟล์สำหรับลงการ์ดไว้ที่ `ml-dev/out/fork/`
- `install_fork.ps1` / `restore_official.ps1` ลง fork บนการ์ด / คืน ML ทางการ
+ ทุกครั้งที่ลง `install_fork.ps1` เก็บ build ที่อยู่บนการ์ดก่อนหน้าไว้ที่ `ml-dev/card_backup/previous/`
+ (ยกเว้นบนการ์ดเป็น build เดียวกันอยู่แล้ว) `restore_official.ps1 -Previous` คืน build นั้นกลับไป
- `push_fork.ps1` push branch `film-mode` ของ fork ทั้งชุดขึ้น
[HNGSeries/magiclantern-eosm-film](https://github.com/HNGSeries/magiclantern-eosm-film) (private)
- `filmroll/` โหมดฟิล์มรุ่นแรกที่ทำเป็น ML module (เก็บไว้อ้างอิง ไม่ได้ใช้แล้ว)
@@ -187,6 +192,7 @@ Brightness (โทนกลาง) และ Conversion (Canon / Rec.709 แบ
(ขนาดใหญ่สุดที่เคยเปิดได้) ฟอนต์ของ Film OS จึงอยู่ในไฟล์ `ML/DATA/FOSFONT.BIN` บนการ์ด (`tools/fontblob.c`)
โหลดหลังบูต และตารางของห้องมืดจองหน่วยความจำเฉพาะตอนเปิด Film OS
ถ้ากล้องค้างแบบนั้น: ถอดแบต ถอดการ์ด เปิดกล้องได้ตามปกติ แล้วคืน ML ทางการด้วย `restore_official.ps1`
+หรือคืน build ก่อนหน้าที่เคยใช้ได้ด้วย `restore_official.ps1 -Previous`
### ตัวจำลอง
```
diff --git a/ml-dev/build_fork.sh b/ml-dev/build_fork.sh
index cd82043..93749c0 100644
--- a/ml-dev/build_fork.sh
+++ b/ml-dev/build_fork.sh
@@ -32,6 +32,31 @@ TAG="${NODARK:+-nodark}${MODULE:+-module}"
if [ "$PLAT" = "EOSM.202" ] && [ -z "$TAG" ]; then OUT="$HERE/out/fork"; else OUT="$HERE/out/fork-$PLAT$TAG"; fi
LOG="${LOG:-$HOME/ml/build_fork_$PLAT$TAG.log}"
+# What the build needs besides the compiler, checked here rather than found
+# missing after the long make:
+# rst2html (docutils) the modules' help text (ML's modules/readme2modulestrings.py)
+# distutils imported by that script: from Python 3.12 only setuptools has it
+# numpy the films' colour tables (films/lut.py)
+# segno the donation QR codes (filmos/tools/genqr.py)
+# unzip the card files out of ML's zip
+# setup_wsl.sh installs them with apt: Ubuntu's own python3 has no pip, and pip
+# won't install into it (PEP 668). In a venv, or the Python CI sets up, pip does.
+APT=""
+PIP=""
+need() { APT="$APT $1"; PIP="$PIP${2:+ $2}"; }
+command -v rst2html > /dev/null || command -v rst2html5 > /dev/null || command -v rst2html.py > /dev/null \
+ || command -v rst2html5.py > /dev/null || need python3-docutils docutils
+python3 -c "from distutils.spawn import find_executable" 2> /dev/null || need python3-setuptools setuptools
+python3 -c "import numpy" 2> /dev/null || need python3-numpy numpy
+python3 -c "import segno" 2> /dev/null || need python3-segno segno
+command -v unzip > /dev/null || need unzip
+if [ -n "$APT" ]; then
+ echo "the build needs:$APT"
+ echo " on Ubuntu / WSL: sudo apt-get install$APT (setup_wsl.sh installs them all)"
+ if [ -n "$PIP" ]; then echo " in a venv: python3 -m pip install$PIP"; fi
+ exit 1
+fi
+
cp "$HERE"/fork/src/filmroll.{c,h} "$HERE"/fork/src/filmhook.c "$HERE"/filmos/fos*.{c,h} "$SRC/src/"
sed -i 's/\r$//' "$SRC"/src/filmroll.{c,h} "$SRC"/src/filmhook.c "$SRC"/src/fos*.{c,h}
# M-Film's version, one for the camera and the program (VERSION at the top of the repository)
@@ -143,8 +168,7 @@ mkdir -p "$OUT/ML/data"
F="$HERE/filmos"
python3 "$F/tools/genfilms.py" "$OUT/ML/data/FOSFILMS.BIN"
-# the donation links in donate.txt as QR codes (needs segno: pip install segno)
-python3 -c "import segno" 2>/dev/null || pip install -q segno
+# the donation links in donate.txt as QR codes
python3 "$F/tools/genqr.py" "$HERE/donate.txt" "$OUT/ML/data/FOSQR.BIN"
# every film's colour table, so the darkroom never spends its first
@@ -170,12 +194,16 @@ if [ -n "$NODARK" ]; then
rm -rf "$OUT/ML/DARKROOM"
python3 "$F/tools/genfilms.py" "$OUT/ML/data/FOSFILMS.BIN"
echo "== card files in $OUT (no darkroom) =="
- (cd "$OUT" && find . -maxdepth 3 | sort | head -60)
- exit 0
+else
+ echo "== card files in $OUT =="
fi
-echo "== card files in $OUT =="
(cd "$OUT" && find . -maxdepth 3 | sort | head -60)
-# keep the fork's source changes next to the project
-(cd "$SRC" && git add -A src/filmroll.c src/filmroll.h src/filmhook.c src/fos*.c $(ls src/fos*.h | grep -v fos_version.h) && git diff ed3e7c0df -- src platform > "$HERE/fork/film-mode.patch")
-echo "patch: $HERE/fork/film-mode.patch"
+# The fork's changes to ML as this build made them, to read: the sources in
+# filmos/ and fork/src/ with apply_fork.py are what builds it. Only this
+# camera's platform files are in it (an ML checkout keeps the ones earlier
+# builds applied for other cameras).
+PATCH="$HERE/out/film-mode-$PLAT$TAG.patch"
+(cd "$SRC" && git add -A src/filmroll.c src/filmroll.h src/filmhook.c src/fos*.c $(ls src/fos*.h | grep -v fos_version.h) \
+ && git diff ed3e7c0df -- src "platform/$PLAT" modules/Makefile > "$PATCH")
+echo "patch: $PATCH"
diff --git a/ml-dev/filmos/tools/genqr.py b/ml-dev/filmos/tools/genqr.py
index fca0455..6aa93cc 100644
--- a/ml-dev/filmos/tools/genqr.py
+++ b/ml-dev/filmos/tools/genqr.py
@@ -7,7 +7,7 @@ ignored). With no links, no file: the panel just says thanks.
FOSQR.BIN: "FOSQ", count, then per code: label[48], url[80], its size in
modules, and the modules row by row, 8 to a byte (most significant first).
-Needs segno (pip install segno).
+Needs segno: python3-segno on Ubuntu (setup_wsl.sh installs it), pip install segno in a venv.
"""
import struct
diff --git a/ml-dev/fork/film-mode.patch b/ml-dev/fork/film-mode.patch
deleted file mode 100644
index 5c7d9af..0000000
--- a/ml-dev/fork/film-mode.patch
+++ /dev/null
@@ -1,17706 +0,0 @@
-diff --git a/platform/100D.101/Makefile b/platform/100D.101/Makefile
-index 05832de0d..6aeb6422b 100644
---- a/platform/100D.101/Makefile
-+++ b/platform/100D.101/Makefile
-@@ -15,6 +15,7 @@ PLATFORM_ARCH = armv5te
- RESTARTSTART = 0x44C100
- ML_BOOT_OBJ = boot-d45-am.o
- ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/reloc.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmhook.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/100D.101/features.h b/platform/100D.101/features.h
-index 18fa340fe..cb0f612f5 100644
---- a/platform/100D.101/features.h
-+++ b/platform/100D.101/features.h
-@@ -12,3 +12,9 @@
- /* Not working */
- #undef FEATURE_TRAP_FOCUS
- #undef FEATURE_MAGIC_ZOOM_FULL_SCREEN // https://bitbucket.org/hudson/magic-lantern/issues/2842
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: the film OS is a module (build_fork.sh --module) */
-+#define FEATURE_FILMOS_MODULE
-diff --git a/platform/100D.101/modules.included b/platform/100D.101/modules.included
-index 8428d3c4b..a3be71e80 100644
---- a/platform/100D.101/modules.included
-+++ b/platform/100D.101/modules.included
-@@ -10,7 +10,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/1100D.105/Makefile b/platform/1100D.105/Makefile
-index 474a5bd7b..b28492c1b 100644
---- a/platform/1100D.105/Makefile
-+++ b/platform/1100D.105/Makefile
-@@ -21,6 +21,7 @@ RESTARTSTART = 0xC80100
- ML_BOOT_OBJ = boot-d45-am.o
-
- FIRMWARE_ID_1100D = 0x80000288
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_nodark.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/1100D.105/features.h b/platform/1100D.105/features.h
-index 81cc3db68..21ccd11c0 100644
---- a/platform/1100D.105/features.h
-+++ b/platform/1100D.105/features.h
-@@ -32,3 +32,6 @@
- #undef FEATURE_FLEXINFO
- #undef FEATURE_SHOW_FREE_MEMORY
- #undef CONFIG_TSKMON
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/1100D.105/modules.included b/platform/1100D.105/modules.included
-index 70260051d..eb4ce352c 100644
---- a/platform/1100D.105/modules.included
-+++ b/platform/1100D.105/modules.included
-@@ -8,7 +8,6 @@ dual_iso
- ettr
- file_man
- img_name
--lua
- mlv_play
- mlv_snd
- pic_view
-diff --git a/platform/500D.111/Makefile b/platform/500D.111/Makefile
-index cfd4478d6..37d877707 100644
---- a/platform/500D.111/Makefile
-+++ b/platform/500D.111/Makefile
-@@ -17,6 +17,7 @@ PLATFORM_ARCH = armv5te
- RESTARTSTART = 0x4D000
-
- ML_PICSTYLE_AUTO = n
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/500D.111/features.h b/platform/500D.111/features.h
-index e1f7c07c8..ba9306a96 100644
---- a/platform/500D.111/features.h
-+++ b/platform/500D.111/features.h
-@@ -16,3 +16,6 @@
- #undef FEATURE_MOVIE_RESTART /* https://bitbucket.org/hudson/magic-lantern/issue/1008/500d-movie-restart-function-is-not-working */
-
- #define FEATURE_REC_NOTIFY_BEEP
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/500D.111/modules.included b/platform/500D.111/modules.included
-index edc1dfbba..b8ec816ba 100644
---- a/platform/500D.111/modules.included
-+++ b/platform/500D.111/modules.included
-@@ -9,7 +9,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/50D.109/Makefile b/platform/50D.109/Makefile
-index d94cf18cd..3f8af89a9 100644
---- a/platform/50D.109/Makefile
-+++ b/platform/50D.109/Makefile
-@@ -24,6 +24,7 @@ ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/misc.o $(BUILD_DIR)/afma.o
- # video_hacks.o
- # reloc.o \
- # af_patterns.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/50D.109/features.h b/platform/50D.109/features.h
-index 0ee71ea71..c2484e477 100644
---- a/platform/50D.109/features.h
-+++ b/platform/50D.109/features.h
-@@ -21,3 +21,5 @@
-
- #undef FEATURE_UPSIDE_DOWN // not working, http://www.magiclantern.fm/forum/index.php?topic=4430
-
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/50D.109/modules.included b/platform/50D.109/modules.included
-index 9412f9301..6c9da4f53 100644
---- a/platform/50D.109/modules.included
-+++ b/platform/50D.109/modules.included
-@@ -10,7 +10,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- pic_view
-diff --git a/platform/550D.109/Makefile b/platform/550D.109/Makefile
-index d7b8d6f03..b7479c3a7 100644
---- a/platform/550D.109/Makefile
-+++ b/platform/550D.109/Makefile
-@@ -22,6 +22,7 @@ ML_BOOT_OBJ = boot-d45-am.o
- ML_PICSTYLE_AUTO = n
-
- CONFIG_LVAPP_HACK_RELOC = y
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmhook.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/550D.109/features.h b/platform/550D.109/features.h
-index fd2485377..bfd9a86c8 100644
---- a/platform/550D.109/features.h
-+++ b/platform/550D.109/features.h
-@@ -12,3 +12,9 @@
- #undef FEATURE_LV_BUTTON_RATE_UPDOWN // Canon uses up/down in play mode
-
- #undef FEATURE_BULB_TIMER_SHOW_PREVIOUS_PIC // screen remains black
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: the film OS is a module (build_fork.sh --module) */
-+#define FEATURE_FILMOS_MODULE
-diff --git a/platform/550D.109/modules.included b/platform/550D.109/modules.included
-index edc1dfbba..b8ec816ba 100644
---- a/platform/550D.109/modules.included
-+++ b/platform/550D.109/modules.included
-@@ -9,7 +9,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/5D2.212/Makefile b/platform/5D2.212/Makefile
-index c70b6b12b..2eb976d7c 100644
---- a/platform/5D2.212/Makefile
-+++ b/platform/5D2.212/Makefile
-@@ -20,6 +20,7 @@ RESTARTSTART = 0x4E000
- ML_PICSTYLE_AUTO = n
-
- ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/afma.o $(BUILD_DIR)/asm.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/5D2.212/features.h b/platform/5D2.212/features.h
-index 51957a6ab..5a40c3f0e 100644
---- a/platform/5D2.212/features.h
-+++ b/platform/5D2.212/features.h
-@@ -7,3 +7,27 @@
-
-
- #define FEATURE_LV_FOCUS_BOX_SNAP_TO_X5_RAW
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: lean, to fit at boot */
-+#undef FEATURE_ZEBRA
-+#undef FEATURE_ZEBRA_FAST
-+#undef FEATURE_FOCUS_PEAK
-+#undef FEATURE_GHOST_IMAGE
-+#undef FEATURE_SPOTMETER
-+#undef FEATURE_FALSE_COLOR
-+#undef FEATURE_WAVEFORM
-+#undef FEATURE_RAW_SPOTMETER
-+#undef FEATURE_RAW_ZEBRAS
-+#undef FEATURE_HDR_VIDEO
-+#undef FEATURE_FPS_OVERRIDE
-+#undef FEATURE_FPS_RAMPING
-+#undef FEATURE_MOVIE_LOGGING
-+#undef FEATURE_GRADUAL_EXPOSURE
-+#undef FEATURE_TRAP_FOCUS
-+#undef FEATURE_FOLLOW_FOCUS
-+#undef FEATURE_RACK_FOCUS
-+#undef FEATURE_AUDIO_METERS
-+#undef FEATURE_HDR_BRACKETING
-diff --git a/platform/5D2.212/modules.included b/platform/5D2.212/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/5D2.212/modules.included
-+++ b/platform/5D2.212/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/5D3.113/Makefile b/platform/5D3.113/Makefile
-index ee6ae21d4..3285f3ed1 100644
---- a/platform/5D3.113/Makefile
-+++ b/platform/5D3.113/Makefile
-@@ -19,6 +19,7 @@ ML_BITRATE_OBJ = bitrate-5d3.o
- ML_AF_PATTERNS_OBJ = n
-
- ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/video_hacks.o $(BUILD_DIR)/afma.o $(BUILD_DIR)/asm.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/5D3.113/features.h b/platform/5D3.113/features.h
-index 7f59c54dd..226f49cbf 100644
---- a/platform/5D3.113/features.h
-+++ b/platform/5D3.113/features.h
-@@ -27,3 +27,6 @@
- #define FEATURE_UNMOUNT_SD_CARD
-
- //~ #define FEATURE_JUNKIE_MENU
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/5D3.113/modules.included b/platform/5D3.113/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/5D3.113/modules.included
-+++ b/platform/5D3.113/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/5D3.123/Makefile b/platform/5D3.123/Makefile
-index dd4efea17..f4ebfdd17 100644
---- a/platform/5D3.123/Makefile
-+++ b/platform/5D3.123/Makefile
-@@ -21,6 +21,7 @@ ML_BITRATE_OBJ = bitrate-5d3.o
- ML_AF_PATTERNS_OBJ = n
-
- ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/video_hacks.o $(BUILD_DIR)/afma.o $(BUILD_DIR)/asm.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/5D3.123/features.h b/platform/5D3.123/features.h
-index ed5e98f32..fdc799fd8 100644
---- a/platform/5D3.123/features.h
-+++ b/platform/5D3.123/features.h
-@@ -64,3 +64,6 @@
-
- /* Swap UV works (anybody using it?), extreme chroma doesn't */
- #undef FEATURE_LV_CRAZY_COLORS
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/5D3.123/modules.included b/platform/5D3.123/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/5D3.123/modules.included
-+++ b/platform/5D3.123/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/600D.102/Makefile b/platform/600D.102/Makefile
-index 1cd54b6a0..6ef27076f 100644
---- a/platform/600D.102/Makefile
-+++ b/platform/600D.102/Makefile
-@@ -19,6 +19,7 @@ ML_BOOT_OBJ = boot-d45-ch.o
- ML_AUDIO_OBJ = audio-lapis.o
-
- CONFIG_LVAPP_HACK_RELOC = y
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmhook.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/600D.102/features.h b/platform/600D.102/features.h
-index 7e3229a7b..16a0a2ca4 100644
---- a/platform/600D.102/features.h
-+++ b/platform/600D.102/features.h
-@@ -17,3 +17,9 @@
- #undef FEATURE_SHOW_EDMAC_INFO
-
- #undef CONFIG_TSKMON
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: the film OS is a module (build_fork.sh --module) */
-+#define FEATURE_FILMOS_MODULE
-diff --git a/platform/600D.102/modules.included b/platform/600D.102/modules.included
-index edc1dfbba..b8ec816ba 100644
---- a/platform/600D.102/modules.included
-+++ b/platform/600D.102/modules.included
-@@ -9,7 +9,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/60D.111/Makefile b/platform/60D.111/Makefile
-index aea8e0b83..5eda09999 100644
---- a/platform/60D.111/Makefile
-+++ b/platform/60D.111/Makefile
-@@ -24,6 +24,7 @@ ML_BOOT_OBJ = boot-d45-ch.o
- ML_PICSTYLE_AUTO = n
-
- CONFIG_LVAPP_HACK_RELOC = y
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmhook.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/60D.111/features.h b/platform/60D.111/features.h
-index b2c8b03e8..66dca1353 100644
---- a/platform/60D.111/features.h
-+++ b/platform/60D.111/features.h
-@@ -10,3 +10,9 @@
- #undef FLEXINFO_DEVELOPER_MENU
-
- #undef FEATURE_WIND_FILTER // problems with external mic
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: the film OS is a module (build_fork.sh --module) */
-+#define FEATURE_FILMOS_MODULE
-diff --git a/platform/60D.111/modules.included b/platform/60D.111/modules.included
-index edc1dfbba..b8ec816ba 100644
---- a/platform/60D.111/modules.included
-+++ b/platform/60D.111/modules.included
-@@ -9,7 +9,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/650D.104/Makefile b/platform/650D.104/Makefile
-index 9e9650596..452e67a8d 100644
---- a/platform/650D.104/Makefile
-+++ b/platform/650D.104/Makefile
-@@ -14,6 +14,7 @@ PLATFORM_ARCH = armv5te
- # RESTARTSTART is selected to be just above the end of the bss
- #
- RESTARTSTART = 0x7E100
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_nodark.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/650D.104/features.h b/platform/650D.104/features.h
-index 0c94cb713..abaa2d836 100644
---- a/platform/650D.104/features.h
-+++ b/platform/650D.104/features.h
-@@ -29,3 +29,26 @@
- #define FEATURE_FOCUS_PEAK_DISP_FILTER
-
- #define FEATURE_CROP_MODE_HACK
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: lean, to fit at boot */
-+#undef FEATURE_ZEBRA
-+#undef FEATURE_ZEBRA_FAST
-+#undef FEATURE_FOCUS_PEAK
-+#undef FEATURE_GHOST_IMAGE
-+#undef FEATURE_SPOTMETER
-+#undef FEATURE_FALSE_COLOR
-+#undef FEATURE_WAVEFORM
-+#undef FEATURE_RAW_SPOTMETER
-+#undef FEATURE_RAW_ZEBRAS
-+#undef FEATURE_HDR_VIDEO
-+#undef FEATURE_MOVIE_LOGGING
-+#undef FEATURE_GRADUAL_EXPOSURE
-+#undef FEATURE_TRAP_FOCUS
-+#undef FEATURE_FOLLOW_FOCUS
-+#undef FEATURE_RACK_FOCUS
-+#undef FEATURE_AUDIO_METERS
-+#undef FEATURE_HDR_BRACKETING
-+#undef FEATURE_FOCUS_PEAK_DISP_FILTER
-diff --git a/platform/650D.104/modules.included b/platform/650D.104/modules.included
-index 8428d3c4b..a3be71e80 100644
---- a/platform/650D.104/modules.included
-+++ b/platform/650D.104/modules.included
-@@ -10,7 +10,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/6D.116/Makefile b/platform/6D.116/Makefile
-index 8ba969fae..28964e2e9 100644
---- a/platform/6D.116/Makefile
-+++ b/platform/6D.116/Makefile
-@@ -19,6 +19,7 @@ ML_BITRATE_OBJ = bitrate-5d3.o
- ML_SOUND_CODEC_OBJ = ak4646.o
-
- ML_SRC_EXTRA_OBJS = $(BUILD_DIR)/afma.o $(BUILD_DIR)/reloc.o $(BUILD_DIR)/gps.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmhook.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/6D.116/features.h b/platform/6D.116/features.h
-index c9d1fb870..7136da36f 100644
---- a/platform/6D.116/features.h
-+++ b/platform/6D.116/features.h
-@@ -21,3 +21,9 @@
- #define FEATURE_GPS_TWEAKS
-
- #define FEATURE_AUDIO_REMOTE_SHOT
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: the film OS is a module (build_fork.sh --module) */
-+#define FEATURE_FILMOS_MODULE
-diff --git a/platform/6D.116/modules.included b/platform/6D.116/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/6D.116/modules.included
-+++ b/platform/6D.116/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/700D.115/Makefile b/platform/700D.115/Makefile
-index af9eb604f..0db8c8efa 100644
---- a/platform/700D.115/Makefile
-+++ b/platform/700D.115/Makefile
-@@ -15,6 +15,7 @@ PLATFORM_ARCH = armv5te
- #
- MAIN_FIRMWARE_ADDR = 0xFF0C0000
- RESTARTSTART = 0x7EC00
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_nodark.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/700D.115/features.h b/platform/700D.115/features.h
-index 42be326e4..73db5f8d4 100644
---- a/platform/700D.115/features.h
-+++ b/platform/700D.115/features.h
-@@ -23,3 +23,26 @@
- #define FEATURE_FOCUS_PEAK_DISP_FILTER
- #define FEATURE_CROP_MODE_HACK
- #define FEATURE_EYEFI_TRICKS
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-+
-+/* film-mode fork: lean, to fit at boot */
-+#undef FEATURE_ZEBRA
-+#undef FEATURE_ZEBRA_FAST
-+#undef FEATURE_FOCUS_PEAK
-+#undef FEATURE_GHOST_IMAGE
-+#undef FEATURE_SPOTMETER
-+#undef FEATURE_FALSE_COLOR
-+#undef FEATURE_WAVEFORM
-+#undef FEATURE_RAW_SPOTMETER
-+#undef FEATURE_RAW_ZEBRAS
-+#undef FEATURE_HDR_VIDEO
-+#undef FEATURE_MOVIE_LOGGING
-+#undef FEATURE_GRADUAL_EXPOSURE
-+#undef FEATURE_TRAP_FOCUS
-+#undef FEATURE_FOLLOW_FOCUS
-+#undef FEATURE_RACK_FOCUS
-+#undef FEATURE_AUDIO_METERS
-+#undef FEATURE_HDR_BRACKETING
-+#undef FEATURE_FOCUS_PEAK_DISP_FILTER
-diff --git a/platform/700D.115/modules.included b/platform/700D.115/modules.included
-index 8428d3c4b..a3be71e80 100644
---- a/platform/700D.115/modules.included
-+++ b/platform/700D.115/modules.included
-@@ -10,7 +10,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/70D.112/Makefile b/platform/70D.112/Makefile
-index 508e2c952..46950f467 100644
---- a/platform/70D.112/Makefile
-+++ b/platform/70D.112/Makefile
-@@ -20,6 +20,7 @@ ML_BITRATE_OBJ = bitrate-5d3.o
- # default 0x44C000 - 0xD3C000, patched to 0x4E0000 - 0xD3C000 (592K for us).
- RESTARTSTART = 0x44C100
- ML_BOOT_OBJ = boot-d45-am.o
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_nodark.o
-
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/70D.112/features.h b/platform/70D.112/features.h
-index 5095eea7d..7db47a65b 100644
---- a/platform/70D.112/features.h
-+++ b/platform/70D.112/features.h
-@@ -33,3 +33,6 @@
- /* Audio Features */
- #define FEATURE_AUDIO_METERS
- #define FEATURE_AUDIO_REMOTE_SHOT
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/70D.112/modules.included b/platform/70D.112/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/70D.112/modules.included
-+++ b/platform/70D.112/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/7D.203/Makefile b/platform/7D.203/Makefile
-index 01a525ba4..eb4f9e8e0 100644
---- a/platform/7D.203/Makefile
-+++ b/platform/7D.203/Makefile
-@@ -1,6 +1,7 @@
- #Makefile for 7D
-
- MODEL=7D
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-
- include ../Makefile
-
-diff --git a/platform/7D.203/features.h b/platform/7D.203/features.h
-index 2b37c0834..01b8ecc0b 100644
---- a/platform/7D.203/features.h
-+++ b/platform/7D.203/features.h
-@@ -19,3 +19,6 @@
- #define FEATURE_AUDIO_REMOTE_SHOT
-
- #undef FEATURE_VIGNETTING_CORRECTION // requires master code
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/7D.203/modules.included b/platform/7D.203/modules.included
-index eddc7617e..6bfdee970 100644
---- a/platform/7D.203/modules.included
-+++ b/platform/7D.203/modules.included
-@@ -11,7 +11,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/platform/EOSM.202/Makefile b/platform/EOSM.202/Makefile
-index 7e11d12a2..cc4932423 100644
---- a/platform/EOSM.202/Makefile
-+++ b/platform/EOSM.202/Makefile
-@@ -19,5 +19,7 @@ RESTARTSTART = 0x9E1E0
-
- ML_AF_PATTERNS_OBJ = n
-
-+ML_SRC_EXTRA_OBJS += $(BUILD_DIR)/filmroll.o $(BUILD_DIR)/fos_gfx.o $(BUILD_DIR)/fos_film.o $(BUILD_DIR)/fos_ui.o $(BUILD_DIR)/fos_shelf.o $(BUILD_DIR)/fos_pages.o $(BUILD_DIR)/fos_hud.o $(BUILD_DIR)/fos_print.o $(BUILD_DIR)/fos_dark.o $(BUILD_DIR)/fos_dev.o $(BUILD_DIR)/fos_lab.o $(BUILD_DIR)/fos_looks.o $(BUILD_DIR)/fos_jpeg.o
-+
- include ../Makefile
- .DEFAULT_GOAL := $(BUILD_DIR)/cam_complete
-diff --git a/platform/EOSM.202/features.h b/platform/EOSM.202/features.h
-index dfead95de..3fe30a780 100644
---- a/platform/EOSM.202/features.h
-+++ b/platform/EOSM.202/features.h
-@@ -37,3 +37,6 @@
- #undef FEATURE_MAGIC_ZOOM_FULL_SCREEN // https://bitbucket.org/hudson/magic-lantern/issue/2272/full-screen-magic-zoom-is-garbled-on-700d
-
- #define FEATURE_EYEFI_TRICKS
-+
-+/* film camera mode (src/filmroll.c) */
-+#define FEATURE_FILMROLL
-diff --git a/platform/EOSM.202/modules.included b/platform/EOSM.202/modules.included
-index 8428d3c4b..a3be71e80 100644
---- a/platform/EOSM.202/modules.included
-+++ b/platform/EOSM.202/modules.included
-@@ -10,7 +10,6 @@ edmac
- ettr
- file_man
- img_name
--lua
- mlv_lite
- mlv_play
- mlv_snd
-diff --git a/src/boot-d45-am.c b/src/boot-d45-am.c
-index 2201e76c7..01865665a 100755
---- a/src/boot-d45-am.c
-+++ b/src/boot-d45-am.c
-@@ -124,7 +124,11 @@ init_task_func init_task_patched(void)
- while(1); /* refuse to boot */
- }
-
-- #if defined(CONFIG_6D) || defined(CONFIG_100D) || defined(CONFIG_70D)
-+ #if defined(CONFIG_6D)
-+ /* film-mode fork: R0 0x44C000 -> 0x520000 => reserve 848K for ML (MOV R0, #0x520000) */
-+ addr_AllocMem_end[1] = 0xE3A00852;
-+ ml_reserved_mem = 0x520000 - RESTARTSTART;
-+ #elif defined(CONFIG_100D) || defined(CONFIG_70D)
- /* R0: 0x44C000 (start address, easier to patch, change to 0x4E0000 => reserve 592K for ML) */
- /* R1: 0xD3C000 [6D, 70D] / 0xC3C000 [100D] (end address, unchanged) */
- addr_AllocMem_end[1] = MOV_R0_0x4E0000_INSTR;
-diff --git a/src/filmhook.c b/src/filmhook.c
-new file mode 100644
-index 000000000..808a82ba0
---- /dev/null
-+++ b/src/filmhook.c
-@@ -0,0 +1,78 @@
-+/* The film OS as a module (build_fork.sh --module): all that stays in
-+ * autoexec.bin. The film OS itself (filmroll.c, fos_*.c) is ML/modules/filmos.mo,
-+ * loaded after boot into Canon's memory, so it doesn't count against what the
-+ * camera can spare at power on (MEMORY.md).
-+ *
-+ * These are the three calls ML's core makes into the film OS. Each goes to
-+ * the module once it is loaded; without it (missing, failed to load, or ML
-+ * skipped loading modules after a crash) they answer as if there were no
-+ * film OS, so the camera still has Magic Lantern's own menu. */
-+
-+#include <dryos.h>
-+#include <module.h>
-+#include <fio-ml.h>
-+#include <notify_box.h>
-+#include <tasks.h>
-+#include "filmroll.h"
-+
-+/* defined in the module (filmroll.c); 0 until it is loaded */
-+static int (*filmos_key_used)(struct event *event) = MODULE_FUNCTION(filmos_key_used);
-+static int (*filmos_menu_open)(void) = MODULE_FUNCTION(filmos_menu_open);
-+static int (*filmos_overlays)(void) = MODULE_FUNCTION(filmos_overlays);
-+
-+int handle_filmroll_keys(struct event *event)
-+{
-+ return filmos_key_used(event) ? 0 : 1;
-+}
-+
-+int filmroll_menu_requested()
-+{
-+ return filmos_menu_open();
-+}
-+
-+int filmroll_overlays_active()
-+{
-+ return filmos_overlays();
-+}
-+
-+/* Without the module the camera would just show Magic Lantern's own menu,
-+ * and nothing says why (#46). Once ML has had time to load its modules, say
-+ * so on the screen, and in ML/FILMROLL.LOG. ML's module task (module.c):
-+ * with "Disable all modules" on, it only lists the modules; after a power
-+ * off that wasn't clean (LOADING.LCK left on the card) it skips them, and
-+ * the list stays empty; otherwise it writes LOADING.LCK, which stays until
-+ * a clean shutdown, and loads them. So the lock file can't tell these apart,
-+ * the list can. ML's notify box holds 99 characters. */
-+extern int module_autoload_disabled; /* module.c */
-+
-+static void filmhook_note(const char *why)
-+{
-+ NotifyBox(15000, "M-Film didn't start: %s", why);
-+ FILE *f = FIO_CreateFileOrAppend("ML/FILMROLL.LOG");
-+ if (f)
-+ {
-+ char line[160];
-+ snprintf(line, sizeof(line), "filmhook: the film OS module isn't loaded: %s\n", why);
-+ FIO_WriteFile(f, line, strlen(line));
-+ FIO_CloseFile(f);
-+ }
-+}
-+
-+static void filmhook_task()
-+{
-+ for (int i = 0; i < 30 && filmos_menu_open == (void *) ret_0; i++)
-+ msleep(500); /* ML loads modules a few seconds after start-up */
-+ if (filmos_menu_open != (void *) ret_0) return;
-+ uint32_t size;
-+ if (module_autoload_disabled)
-+ filmhook_note("'Disable all modules' is on: MENU > Debug > Modules debug.");
-+ else if (FIO_GetFileSize(MODULE_PATH "FILMOS.MO", &size) != 0)
-+ filmhook_note("ML/modules/filmos.mo isn't on the card. Copy the zip again.");
-+ else if (module_get_number("filmos") < 0)
-+ filmhook_note("ML skipped its modules (battery pulled?). Switch off, then on.");
-+ else
-+ filmhook_note("its module didn't load. MENU > Modules says why.");
-+}
-+
-+TASK_CREATE("filmhook_task", filmhook_task, 0, 0x1f, 0x1000);
-+
-diff --git a/src/filmroll.c b/src/filmroll.c
-new file mode 100644
-index 000000000..60362f5f5
---- /dev/null
-+++ b/src/filmroll.c
-@@ -0,0 +1,1711 @@
-+/* filmroll: a Canon camera as a film camera (built into this ML fork).
-+ * Made on the EOS M; 100D, 650D, 700D and others build from the same code.
-+ *
-+ * The camera side of the film OS (ml-dev/filmos): rolls, the roll log the
-+ * PC lab reads, film settings, the viewfinder HUD, and the fos_port_*
-+ * functions through which the film OS takes the screen and the buttons.
-+ *
-+ * - the film OS is the camera's own interface: the film shelf at start
-+ * up, home and its settings pages instead of the Magic Lantern menu.
-+ * The ML menu is gone: what used to open it (two-finger tap, long
-+ * press on DOWN, modules) opens home.
-+ * - an SLR-viewfinder HUD in LiveView: aperture scale with meter needle,
-+ * red LED readout that lights on half-shutter, frame counter, wind
-+ * - PLAY opens the prints the camera has developed, never Canon's
-+ * playback of undeveloped frames
-+ * - a finished roll is developed in the camera (fos_dev.c): its RAWs
-+ * become prints in ML/DARKROOM, shown on their own palettes
-+ * - manual lenses: the f-stop is dialled in and logged for the lab
-+ *
-+ * Loading a roll sets picture style, contrast / saturation / colour tone,
-+ * white balance and ISO for that stock, and starts a roll log next to the
-+ * images (DCIM/xxxCANON/ROLL_nnn.TXT) that the PC film lab reads
-+ * (the desktop darkroom, Darkrooms). Film keys must match films/films.py.
-+ *
-+ * Shots are detected by watching the file number, so every frame is
-+ * logged even in burst mode.
-+ */
-+
-+#ifdef MODULE
-+/* ML/modules/filmos.mo is built for one camera (fork/module/Makefile), so it
-+ * takes that camera's definitions, as autoexec.bin does */
-+#include "internals.h"
-+#include "internals-common.h"
-+#include "features.h"
-+#include "consts.h"
-+#include "gui.h" /* ahead of dryos.h's gui-common.h, as in autoexec.bin */
-+#endif
-+#include <dryos.h>
-+#include <module.h>
-+#include <property.h>
-+#include <menu.h>
-+#include <config.h>
-+#include <lens.h>
-+#include <picstyle.h>
-+#include <beep.h>
-+#include <bmp.h>
-+#include <fio-ml.h>
-+#include <fileprefix.h>
-+#include <notify_box.h>
-+#include <zebra.h>
-+#include <propvalues.h>
-+#include <gui-common.h>
-+#include <tasks.h>
-+#include <mem.h>
-+#include <powersave.h>
-+#ifdef MODULE
-+/* built as ML/modules/filmos.mo (build_fork.sh --module): the core keeps
-+ * these three names for its shim (filmhook.c), the module's own go by others */
-+#define handle_filmroll_keys fr_handle_keys
-+#define filmroll_menu_requested fr_menu_requested
-+#define filmroll_overlays_active fr_overlays_active
-+#endif
-+#include "filmroll.h"
-+#include "fos.h"
-+#include "fos_dev.h"
-+
-+#include <stdarg.h>
-+
-+extern int ml_started;
-+extern void CancelDateTimer();
-+
-+/* user settings */
-+static CONFIG_INT("filmroll.film", film_sel, 0);
-+static CONFIG_INT("filmroll.exp", exp_sel, 0);
-+static CONFIG_INT("filmroll.hud", hud_enabled, 1);
-+static CONFIG_INT("filmroll.focus", focus_screen, 1);
-+static CONFIG_INT("filmroll.leds", leds_on_half, 1);
-+static CONFIG_INT("filmroll.wind", wind_mode, 1); /* 0 off, 1 reminder, 2 block shutter */
-+static CONFIG_INT("filmroll.playlock", play_lock, 1);
-+static CONFIG_INT("filmroll.startup", startup_picker, 2); /* 0 off, 1 when no film, 2 always */
-+static CONFIG_INT("filmroll.bootanim", boot_anim, 1);
-+static CONFIG_INT("filmroll.debug", debug_log, 1);
-+static CONFIG_INT("filmroll.mode", film_mode, 0); /* 0 Basic, 1 Realistic (FS_MODE) */
-+static CONFIG_INT("filmroll.lens_wide", lens_widest, 6); /* index into fos_fstops: f/1.8 */
-+static CONFIG_INT("filmroll.fstop", manual_fstop, 6);
-+static CONFIG_INT("filmroll.ap_keys", aperture_keys, 0); /* 0 wheel in Av, 1 up/down, 2 menu only */
-+static CONFIG_INT("filmroll.scr_std", scr_std, 0); /* screen colour: 0 Canon, 1 Rec.709 */
-+static CONFIG_INT("filmroll.scr_sat", scr_sat, 0); /* -6..6 */
-+static CONFIG_INT("filmroll.scr_warm", scr_warm, 0);
-+static CONFIG_INT("filmroll.scr_bright", scr_bright, 0);
-+static CONFIG_INT("filmroll.scr_flip", scr_flip, 0); /* 0 Canon's hinge, 1 normal, 2 upside down, 3 mirrored */
-+
-+/* roll state, kept across power cycles */
-+static CONFIG_INT("filmroll.loaded", roll_loaded, 0);
-+static CONFIG_INT("filmroll.roll", roll_number, 0);
-+static CONFIG_INT("filmroll.roll_film", roll_film, 0);
-+static CONFIG_INT("filmroll.roll_exp", roll_exposures, 36);
-+static CONFIG_INT("filmroll.shot", frames_shot, 0);
-+static CONFIG_INT("filmroll.lastfile", last_file_number, -1);
-+static CONFIG_INT("filmroll.logdir", roll_folder, 0);
-+static CONFIG_INT("filmroll.needwind", need_wind, 0);
-+
-+static char log_path[64];
-+
-+static volatile int leds_until = 0; /* keep LEDs lit until this ms clock */
-+static volatile int hud_dirty = 1;
-+
-+#define ROLL_FINISHED (roll_loaded && frames_shot >= roll_exposures)
-+#define ROLL_IN_PROGRESS (roll_loaded && frames_shot < roll_exposures)
-+
-+static volatile int end_due = 0; /* the roll was just finished: ms when to ask about it */
-+static volatile int dev_busy = 0; /* developing: keep the camera awake */
-+
-+/* the last frames, for the roll page (also read back from the log) */
-+static struct { int no; char time[6]; char fstop[6]; } recent[FOS_RECENT];
-+static int nrecent = 0;
-+static char loaded_at[20];
-+static int recent_valid = 0;
-+static int last_shot_ms = -100000; /* when poll_frames last saw a new frame */
-+static volatile int last_key_ms = 0; /* when a button other than the shutter was last pressed (handle_filmroll_keys) */
-+
-+/* ---------------------------------------------------------------- debug log */
-+
-+/* field-test trace in ML/FILMROLL.LOG; turn off in System once things work */
-+static void dbg(const char *fmt, ...)
-+{
-+ if (!debug_log)
-+ return;
-+
-+ char buf[192];
-+ int n = snprintf(buf, sizeof(buf), "%7d ", get_ms_clock());
-+ va_list ap;
-+ va_start(ap, fmt);
-+ vsnprintf(buf + n, sizeof(buf) - n, fmt, ap);
-+ va_end(ap);
-+
-+ FILE *f = FIO_CreateFileOrAppend("ML/FILMROLL.LOG");
-+ if (!f)
-+ return;
-+ my_fprintf(f, "%s\n", buf);
-+ FIO_CloseFile(f);
-+}
-+
-+/* The camera waiting for a picture, the screen the film OS opens from.
-+ * On the EOS M that is LiveView; a DSLR (100D, 650D, 700D ...) is mostly
-+ * shot through its optical viewfinder, so there it is also Canon's shooting
-+ * screen with LiveView off. */
-+#ifdef CONFIG_EOSM
-+#define FOS_LV_ONLY 1
-+#else
-+#define FOS_LV_ONLY 0
-+#endif
-+static int shooting_screen()
-+{
-+ return (lv || !FOS_LV_ONLY) && display_idle() && !is_movie_mode();
-+}
-+
-+#define DBG_STATE(what) dbg("%s: ml=%d lv=%d idle=%d movie=%d mode=%d gui=%d", what, \
-+ ml_started, lv, display_idle(), is_movie_mode(), shooting_mode, CURRENT_GUI_MODE)
-+
-+/* ---------------------------------------------------------------- log file */
-+
-+static void update_log_path()
-+{
-+ snprintf(log_path, sizeof(log_path), "%s:/DCIM/%03d%s/ROLL_%03d.TXT",
-+ get_shooting_card()->drive_letter, roll_folder, get_dcim_dir_suffix(),
-+ roll_number);
-+}
-+
-+static void log_append(const char *text)
-+{
-+ /* At start-up, filmroll_init runs before the settings are loaded (it logs
-+ * "roll 0 loaded 0"), so the path wasn't set, and frames shot after a
-+ * restart before any film OS page was opened had nowhere to go (#17). */
-+ if (!log_path[0] && roll_loaded)
-+ update_log_path();
-+ FILE *f = FIO_CreateFileOrAppend(log_path);
-+ if (!f)
-+ {
-+ NotifyBox(3000, "filmroll: can't write %s", log_path);
-+ return;
-+ }
-+ my_fprintf(f, "%s", text);
-+ FIO_CloseFile(f);
-+}
-+
-+static void format_now(char *buf, int size)
-+{
-+ struct tm now;
-+ LoadCalendarFromRTC(&now);
-+ snprintf(buf, size, "%04d-%02d-%02d %02d:%02d:%02d",
-+ now.tm_year + 1900, now.tm_mon + 1, now.tm_mday,
-+ now.tm_hour, now.tm_min, now.tm_sec);
-+}
-+
-+static void write_header(const char *note)
-+{
-+ char when[32];
-+ char header[320];
-+ format_now(when, sizeof(when));
-+ snprintf(header, sizeof(header),
-+ "# ML film mode roll log (filmroll module)%s\n"
-+ "roll = %03d\nfilm = %s\nexposures = %d\nloaded = %s\n\n",
-+ note, roll_number, fos_films[COERCE(roll_film, 0, fos_nfilms - 1)].key, roll_exposures, when);
-+ log_append(header);
-+}
-+
-+/* the roll page wants the loading time and the last frames: after a power
-+ * cycle they only exist in the log, so read them back once */
-+static void read_back_log()
-+{
-+ recent_valid = 1;
-+ nrecent = 0;
-+ loaded_at[0] = 0;
-+ int size = 0;
-+ char *buf = (char *) read_entire_file(log_path, &size);
-+ if (!buf)
-+ return;
-+ for (char *line = buf; line && *line; )
-+ {
-+ char *next = strchr(line, '\n');
-+ if (next) *next++ = 0;
-+ if (!strncmp(line, "loaded = ", 9))
-+ fos_copy(loaded_at, sizeof(loaded_at), line + 9, 16);
-+ else if (line[0] >= '0' && line[0] <= '9')
-+ {
-+ /* "12 IMG_0012.CR2 2026-08-08 09:15:15 f/2.8" */
-+ char *tok[5];
-+ int n = 0;
-+ for (char *p = line; *p && n < 5; )
-+ {
-+ while (*p == ' ') p++;
-+ if (!*p) break;
-+ tok[n++] = p;
-+ while (*p && *p != ' ') p++;
-+ if (*p) *p++ = 0;
-+ }
-+ if (n >= 4)
-+ {
-+ /* newest first, keep FOS_RECENT */
-+ for (int i = MIN(nrecent, FOS_RECENT - 1); i > 0; i--)
-+ recent[i] = recent[i - 1];
-+ recent[0].no = atoi(tok[0]);
-+ fos_copy(recent[0].time, sizeof(recent[0].time), tok[3], 5);
-+ snprintf(recent[0].fstop, sizeof(recent[0].fstop), "%s",
-+ n >= 5 && !strncmp(tok[4], "f/", 2) ? tok[4] + 2 : "?");
-+ nrecent = MIN(nrecent + 1, FOS_RECENT);
-+ }
-+ }
-+ line = next;
-+ }
-+ fio_free(buf);
-+}
-+
-+/* ---------------------------------------------------------------- camera settings */
-+
-+static int iso_to_raw(int iso)
-+{
-+ int raw = 72; /* ISO 100 */
-+ for (int i = 100; i < iso; i *= 2)
-+ raw += 8; /* one stop */
-+ return raw;
-+}
-+
-+static void apply_film(int index)
-+{
-+ const struct fos_film *f = &fos_films[COERCE(index, 0, fos_nfilms - 1)];
-+
-+ int ps = f->picstyle;
-+ prop_request_change_wait(PROP_PICTURE_STYLE, &ps, 4, 1000);
-+ msleep(100);
-+
-+ /* these change the current picture style, so it must be selected first */
-+ lens_set_contrast(f->contrast);
-+ msleep(50);
-+ lens_set_sharpness(f->sharpness);
-+ msleep(50);
-+ if (f->picstyle != PS_MONO)
-+ {
-+ lens_set_saturation(f->saturation);
-+ msleep(50);
-+ lens_set_color_tone(f->color_tone);
-+ msleep(50);
-+ }
-+
-+ lens_set_kelvin(f->kelvin);
-+ lens_set_wbs_gm(f->wbs_gm);
-+ lens_set_wbs_ba(f->wbs_ba);
-+ lens_set_rawiso(iso_to_raw(f->iso));
-+}
-+
-+/* each frame is saved with a full-size RAW (RAW, or RAW+JPEG), so the
-+ * darkroom can develop it; a JPEG, mRAW or sRAW alone it can't */
-+static int saves_raw()
-+{
-+ return (pic_quality & 0x60000) && !(pic_quality & 0xF); /* raw bits, raw size 0 */
-+}
-+
-+/* Film is shot blind: the darkroom develops the RAWs, and there is no
-+ * image review to peek at. ML doesn't change these Canon settings itself
-+ * (writing the picture quality property can upset Canon's firmware), so
-+ * it asks for them. RAW+JPEG is fine: the darkroom uses the RAW. */
-+static void film_capture_check()
-+{
-+ if (!roll_loaded) return;
-+ int raw = saves_raw();
-+ int review_off = image_review_time == 0;
-+ if (raw && review_off) return;
-+ dbg("capture: quality %x, review %d", pic_quality, image_review_time);
-+ NotifyBox(6000, "Film: in Canon's menu set %s%s%s", raw ? "" : "Image quality RAW",
-+ !raw && !review_off ? " and " : "", review_off ? "" : "Image review Off");
-+}
-+
-+/* ---------------------------------------------------------------- aperture */
-+
-+/* manual (adapted) lenses report no aperture; the user dials it in instead */
-+static int lens_is_manual()
-+{
-+ return !lens_info.raw_aperture;
-+}
-+
-+/* index into fos_fstops for the aperture in use */
-+static int current_fstop()
-+{
-+ if (lens_is_manual())
-+ return COERCE(manual_fstop, lens_widest, fos_nfstops - 1);
-+
-+ int f100 = lens_info.aperture * 10; /* lens_info.aperture is f x10 */
-+ int best = 0;
-+ for (int i = 1; i < fos_nfstops; i++)
-+ if (ABS(fos_fstops[i] - f100) < ABS(fos_fstops[best] - f100))
-+ best = i;
-+ return best;
-+}
-+
-+static void step_manual_fstop(int dir)
-+{
-+ manual_fstop = COERCE(current_fstop() + dir, lens_widest, fos_nfstops - 1);
-+}
-+
-+/* ---------------------------------------------------------------- rolls */
-+
-+/* start a roll: state and log now, camera settings once the film OS has
-+ * let go of the screen (apply_film blocks for a while) */
-+static void load_roll(int film, int exposures)
-+{
-+ roll_film = COERCE(film, 0, fos_nfilms - 1);
-+ roll_exposures = exposures;
-+ roll_folder = get_shooting_card()->folder_number;
-+
-+ /* next roll number whose log doesn't exist yet, so a reset counter
-+ * (new settings file, card from another camera) never mixes two rolls */
-+ for (int tries = 0; tries < 999; tries++)
-+ {
-+ roll_number = roll_number % 999 + 1;
-+ update_log_path();
-+ if (!is_file(log_path))
-+ break;
-+ }
-+ frames_shot = 0;
-+ need_wind = 0;
-+ last_file_number = get_shooting_card()->file_number;
-+ roll_loaded = 1;
-+ update_log_path();
-+ write_header("");
-+
-+ char when[32];
-+ format_now(when, sizeof(when));
-+ fos_copy(loaded_at, sizeof(loaded_at), when, 16);
-+ nrecent = 0;
-+ recent_valid = 1;
-+
-+ hud_dirty = 1;
-+ dbg("roll %03d loaded: %s, %d exp", roll_number, fos_films[COERCE(roll_film, 0, fos_nfilms - 1)].key, roll_exposures);
-+}
-+
-+static void rewind_roll()
-+{
-+ if (!roll_loaded) return;
-+ char when[32], line[80];
-+ format_now(when, sizeof(when));
-+ snprintf(line, sizeof(line), "\n# rewound %s after %d of %d frames\n", when, frames_shot, roll_exposures);
-+ log_append(line);
-+ roll_loaded = 0;
-+ need_wind = 0;
-+ hud_dirty = 1;
-+ dbg("roll %03d rewound at %d/%d", roll_number, frames_shot, roll_exposures);
-+}
-+
-+static void record_frame(int file_number)
-+{
-+ if (frames_shot >= roll_exposures)
-+ {
-+ beep();
-+ return;
-+ }
-+
-+ frames_shot++;
-+
-+ char when[32];
-+ char aperture[8];
-+ char line[112];
-+ format_now(when, sizeof(when));
-+ fos_format_fstop(aperture, sizeof(aperture), current_fstop());
-+ snprintf(line, sizeof(line), "%d %s%04d.CR2 %s f/%s\n",
-+ frames_shot, get_file_prefix(), file_number, when, aperture);
-+ log_append(line);
-+
-+ /* the warning at loading is easy to miss, and then a whole roll can't
-+ * be developed: say it with each frame */
-+ if (!saves_raw())
-+ {
-+ dbg("frame %d: quality %x, no RAW", frames_shot, pic_quality);
-+ beep();
-+ NotifyBox(5000, "Frame %d is a JPEG: the darkroom can't develop it. Set Image quality RAW", frames_shot);
-+ }
-+
-+ for (int i = MIN(nrecent, FOS_RECENT - 1); i > 0; i--)
-+ recent[i] = recent[i - 1];
-+ recent[0].no = frames_shot;
-+ fos_copy(recent[0].time, sizeof(recent[0].time), when + 11, 5);
-+ snprintf(recent[0].fstop, sizeof(recent[0].fstop), "%s", aperture);
-+ nrecent = MIN(nrecent + 1, FOS_RECENT);
-+
-+ leds_until = get_ms_clock() + 2500;
-+ hud_dirty = 1;
-+
-+ if (frames_shot == roll_exposures)
-+ {
-+ need_wind = 0;
-+ beep_times(2);
-+ end_due = get_ms_clock() + 1500; /* then ask: develop it now? */
-+ return;
-+ }
-+
-+ if (wind_mode)
-+ need_wind = 1;
-+}
-+
-+/* log every new file number since the last poll */
-+static void poll_frames()
-+{
-+ if (!roll_loaded)
-+ return;
-+
-+ int now = get_shooting_card()->file_number;
-+ if (now == last_file_number)
-+ return;
-+
-+ int prev = last_file_number;
-+ last_file_number = now;
-+
-+ int count = now - prev;
-+ if (count < 0)
-+ count += 9999; /* IMG_9999 -> IMG_0001 */
-+ if (prev < 0 || count > 50)
-+ return; /* card swap or counter reset: just resync */
-+
-+ /* Canon started a new folder; start a log there too so each folder
-+ * develops on its own (frame numbers keep counting). It does that when
-+ * the file number goes past 9999, so the files up to IMG_9999 of this
-+ * batch are still in the old folder, and go in its log (#17). */
-+ int folder = get_shooting_card()->folder_number;
-+ int first_new = folder == roll_folder ? count + 1 /* none */
-+ : now < prev ? 9999 - prev + 1 /* the first after IMG_9999 */
-+ : 1;
-+
-+ last_shot_ms = get_ms_clock();
-+ dbg("frames: file %d -> %d, logging %d", prev, now, count);
-+ for (int i = 1; i <= count; i++)
-+ {
-+ if (i == first_new)
-+ {
-+ roll_folder = folder;
-+ update_log_path();
-+ write_header(" - continued from the previous DCIM folder");
-+ }
-+ record_frame((prev + i - 1) % 9999 + 1);
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- the film OS host */
-+
-+static volatile int ui_running = 0; /* the film OS owns the screen and the buttons */
-+static volatile int ui_abort = 0;
-+static int ui_after = 0; /* what to do once it has let go */
-+static int ui_last_mode_poke = 0;
-+static int ui_last_palette = 0;
-+
-+enum { AFTER_APPLY = 1, AFTER_CANON_MENU = 2 };
-+
-+/* buttons, from the GUI task to the film OS task */
-+#define KEYQ 32
-+static volatile int keyq[KEYQ];
-+static volatile int keyq_in = 0, keyq_out = 0;
-+
-+static void keyq_push(int k)
-+{
-+ int next = (keyq_in + 1) % KEYQ;
-+ if (next != keyq_out)
-+ {
-+ keyq[keyq_in] = k;
-+ keyq_in = next;
-+ }
-+}
-+
-+/* Our palette is fos_pal (RGB); the bitmap overlay wants Y, Cb, Cr and
-+ * an opacity code, which we copy from Canon's own white. One entry is
-+ * remembered so we notice when other code puts Canon's palette back. */
-+#define PALETTE_PROBE 200
-+static uint32_t palette_probe = 0;
-+
-+/* a photograph on the screen: its colours in 1..photo_n, at photo_k/256 */
-+static int photo_mode = 0, photo_n = 0, photo_k = 256;
-+static uint8_t photo_pal[FOS_PRINT_COLOURS][3];
-+
-+static void palette_ours()
-+{
-+ if (!DISPLAY_IS_ON) return;
-+ /* Canon's white tells the opacity and where white sits in luma
-+ * (its own conversion puts it at 235, not 255) */
-+ uint32_t white = LCD_Palette[3 * COLOR_WHITE + 2];
-+ uint32_t opaque = white & 0xFF000000;
-+ if ((opaque >> 24) < 2) opaque = 0x03000000;
-+ int white_y = (white >> 16) & 0xFF;
-+ if (white_y < 180) white_y = 235;
-+ for (int i = 1; i < 255; i++)
-+ {
-+ uint32_t entry;
-+ if (!photo_mode)
-+ entry = opaque | fos_screen_yuv(i, white_y, scr_std, scr_sat, scr_warm, scr_bright);
-+ else
-+ {
-+ const uint8_t *c = i <= photo_n ? photo_pal[i - 1] :
-+ i >= FOS_FIXED_BASE && i < FOS_FIXED_BASE + FOS_FIXED_N ? fos_fixed_rgb[i - FOS_FIXED_BASE] : 0;
-+ uint32_t rgb = c ? (uint32_t) (c[0] * photo_k >> 8) << 16 | (uint32_t) (c[1] * photo_k >> 8) << 8 | (uint32_t) (c[2] * photo_k >> 8) : 0;
-+ entry = opaque | fos_screen_yuv_rgb(rgb, white_y, scr_std, scr_sat, scr_warm, scr_bright);
-+ }
-+ if (i == PALETTE_PROBE) palette_probe = entry;
-+ EngDrvOut(LCD_Palette[3 * i], entry);
-+ EngDrvOut(LCD_Palette[3 * i + 0x300], entry);
-+ }
-+}
-+
-+static void palette_canon()
-+{
-+ for (int i = 1; i < 255; i++)
-+ {
-+ EngDrvOut(LCD_Palette[3 * i], LCD_Palette[3 * i + 2]);
-+ EngDrvOut(LCD_Palette[3 * i + 0x300], LCD_Palette[3 * i + 2]);
-+ }
-+}
-+
-+/* Take the display from Canon's GUI the same way the ML menu does:
-+ * switch Canon to the ML menu GUI mode (LiveView stops drawing its
-+ * overlays and stops handling keys), stop Canon from flipping its own
-+ * bitmap buffer, then turn the bitmap layer back on for us. */
-+static void film_ui_open()
-+{
-+ NotifyBoxHide();
-+ if (lv) bmp_off();
-+ SetGUIRequestMode(GUIMODE_ML_MENU);
-+ msleep(200);
-+ canon_gui_disable_front_buffer();
-+ CancelDateTimer();
-+ clrscr();
-+ bmp_on();
-+ ui_last_mode_poke = get_ms_clock();
-+}
-+
-+static void film_ui_close()
-+{
-+ palette_canon();
-+ if (lv) bmp_off();
-+ SetGUIRequestMode(0);
-+ msleep(100);
-+ canon_gui_enable_front_buffer(0);
-+ clrscr();
-+ redraw();
-+ if (lv) bmp_on();
-+}
-+
-+/* frame times are kept while the film OS runs and logged when it closes:
-+ * writing the card in the middle of an animation would stall it */
-+static struct fos_stat stat_all;
-+
-+static void ui_task(int open)
-+{
-+ keyq_in = keyq_out = 0;
-+ ui_abort = 0;
-+ ui_after = 0;
-+ film_ui_open();
-+ DBG_STATE("film os: open");
-+ memset(&stat_all, 0, sizeof(stat_all));
-+
-+ fos_ui_run(open);
-+
-+ film_ui_close();
-+ ui_running = 0;
-+ hud_dirty = 1;
-+ DBG_STATE("film os: closed");
-+ if (stat_all.frames)
-+ {
-+ struct fos_stat *s = &stat_all;
-+ int n = s->frames, total = s->draw_ms + s->present_ms + s->rest_ms;
-+ dbg("film os: %d frames in %d ms = %d/s; per frame %d ms draw (%d canisters) + %d present + %d rest, worst %d, open %d ms, quality %d",
-+ n, total, total ? n * 1000 / total : 0, s->draw_ms / n, s->cans_ms / n, s->present_ms / n, s->rest_ms / n,
-+ s->worst_ms, s->open_ms, fos_can_quality);
-+ }
-+
-+ if (ui_after & AFTER_APPLY)
-+ {
-+ apply_film(roll_film);
-+ beep();
-+ film_capture_check();
-+ }
-+ if (dev_busy)
-+ {
-+ /* left in the middle of developing */
-+ dev_busy = 0;
-+ powersave_permit();
-+ }
-+ if (ui_after & AFTER_CANON_MENU)
-+ fake_simple_button(BGMT_MENU);
-+}
-+
-+static void open_ui(int screen)
-+{
-+ if (ui_running)
-+ return;
-+ if (!fos_fonts_ready())
-+ {
-+ NotifyBox(5000, "Film OS: ML/DATA/" FOS_FONT_FILE " is missing");
-+ return;
-+ }
-+ ui_running = 1;
-+ /* the same priority as ML's own menu redraw: Canon's tasks still come
-+ * first, and the film OS rests between frames */
-+ task_create("film_os", 0x1a, 0x4000, ui_task, (void *) screen);
-+}
-+
-+/* ---- what the film OS asks of the camera (see fos.h) */
-+
-+int fos_port_ms()
-+{
-+ return get_ms_clock();
-+}
-+
-+static void ui_overdrawn_check();
-+
-+void fos_port_sleep(int ms)
-+{
-+ msleep(ms);
-+ int now = get_ms_clock();
-+
-+ /* the Canon dialog under us times out unless poked (CONFIG_MENU_TIMEOUT_FIX) */
-+ if (lv && now - ui_last_mode_poke > 2000)
-+ {
-+ SetGUIRequestMode(GUIMODE_ML_MENU);
-+ ui_last_mode_poke = now;
-+ }
-+ /* other code (ML's powersave, clear overlays) may put Canon's palette
-+ * back: check one entry every frame, rewrite all of them now and then */
-+ static int last_wake = 0;
-+ if (dev_busy && now - last_wake > 5000)
-+ {
-+ idle_wakeup_reset_counters(-10);
-+ last_wake = now;
-+ }
-+ uint32_t probe = shamem_read(LCD_Palette[3 * PALETTE_PROBE]);
-+ if ((probe && probe != palette_probe) || now - ui_last_palette > 1000)
-+ {
-+ palette_ours();
-+ ui_last_palette = now;
-+ }
-+ ui_overdrawn_check();
-+}
-+
-+int fos_port_key()
-+{
-+ if (keyq_out == keyq_in)
-+ return FK_NONE;
-+ int k = keyq[keyq_out];
-+ keyq_out = (keyq_out + 1) % KEYQ;
-+ return k;
-+}
-+
-+int fos_port_abort()
-+{
-+ if (ui_abort || ml_shutdown_requested || !DISPLAY_IS_ON)
-+ return 1;
-+ if (get_halfshutter_pressed())
-+ return 1;
-+ /* a Canon dialog took over (low battery, card door...): give the mode
-+ * request time to land, then let go if Canon keeps something else up */
-+ static int mismatch_since = 0;
-+ int now = get_ms_clock();
-+ if (CURRENT_GUI_MODE == GUIMODE_ML_MENU)
-+ mismatch_since = 0;
-+ else if (!mismatch_since)
-+ mismatch_since = now;
-+ else if (now - mismatch_since > 1500)
-+ {
-+ dbg("film os: Canon GUI mode %d, leaving", CURRENT_GUI_MODE);
-+ mismatch_since = 0;
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+/* Canon drawing over our screen. On some DSLRs Canon keeps drawing its own
-+ * screen straight onto the one we show, with its buffer held or not: over
-+ * the top plate on the 50D and 500D (#43 #44), over the film OS on the 60D
-+ * (its exposure scale, #25 #49) and the 550D (its battery icon, #50). Each
-+ * row we put on the screen leaves a sum of what it holds (the film OS's rows
-+ * as they're presented, the plate's after it is drawn: the two never show at
-+ * once, so they share it). Every 50 ms half the rows are read back; a row
-+ * that no longer matches means Canon drew there, and the screen is painted
-+ * again at once. If it never matches for 2 s (Canon drawing all the time,
-+ * or a camera that doesn't read back what we wrote), the check rests for
-+ * 5 s, then 10, up to a minute, so it can't keep painting without end. */
-+static uint16_t shown_sum[FOS_H]; /* 16 bits a row: 1 KB less at boot, and a 1 in 65,536 miss */
-+
-+static uint16_t row_sum(const uint8_t *row)
-+{
-+ const uint32_t *w = (const uint32_t *) row;
-+ uint32_t a = 0, b = 0;
-+ for (int x = 0; x < FOS_W / 4; x += 2) { a += w[x]; b += a; } /* every other 4 pixels */
-+ uint32_t h = a ^ (b << 1);
-+ return (uint16_t) (h ^ (h >> 16));
-+}
-+
-+struct overdraw_check { const char *what; int half, in_a_row, rest, resting_until, times; };
-+
-+/* 1 if Canon has drawn over vram since its rows' sums were taken */
-+static int overdrawn(struct overdraw_check *o, const uint8_t *vram)
-+{
-+ int now = get_ms_clock();
-+ if (o->resting_until && now - o->resting_until < 0) return 0;
-+ o->resting_until = 0;
-+ o->half ^= 1;
-+ int y = o->half;
-+ for (; y < FOS_H; y += 2)
-+ if (row_sum(vram + y * BMPPITCH) != shown_sum[y])
-+ break;
-+ if (y >= FOS_H)
-+ {
-+ o->in_a_row = 0;
-+ o->rest = 0;
-+ return 0;
-+ }
-+ if (++o->in_a_row > 40)
-+ {
-+ o->in_a_row = 0;
-+ o->rest = o->rest ? MIN(o->rest * 2, 60000) : 5000;
-+ o->resting_until = (now + o->rest) ? now + o->rest : 1;
-+ dbg("%s: drawn over for 2 s on end (row %d), not checking for %d s", o->what, y, o->rest / 1000);
-+ return 0;
-+ }
-+ if (o->times++ % 50 == 0) dbg("%s: Canon drew over it (%d times, row %d)", o->what, o->times, y);
-+ return 1;
-+}
-+
-+static void ui_overdrawn_check()
-+{
-+ static struct overdraw_check check = { .what = "film os" };
-+ static int last = 0;
-+ int now = get_ms_clock();
-+ if (now - last < 50) return;
-+ last = now;
-+ uint8_t *vram = bmp_vram_real();
-+ if (!vram || !DISPLAY_IS_ON) return;
-+ if (overdrawn(&check, vram))
-+ fos_ui_overdrawn();
-+}
-+
-+void fos_port_present(const uint8_t *rows, int pitch, int y0, int y1)
-+{
-+ uint8_t *vram = bmp_vram_real();
-+ if (!vram || !DISPLAY_IS_ON)
-+ return;
-+ y0 = COERCE(y0, 0, FOS_H);
-+ y1 = COERCE(y1, y0, FOS_H);
-+ for (int y = y0; y < y1; y++)
-+ {
-+ memcpy(vram + y * BMPPITCH, rows + (y - y0) * pitch, FOS_W);
-+ shown_sum[y] = row_sum(vram + y * BMPPITCH);
-+ }
-+}
-+
-+void fos_port_palette()
-+{
-+ /* once: Canon's own entries, to check the colour conversion against */
-+ static int logged = 0;
-+ if (!logged && debug_log)
-+ {
-+ logged = 1;
-+ dbg("canon palette 1-7: %08x %08x %08x %08x %08x %08x %08x",
-+ LCD_Palette[3 * 1 + 2], LCD_Palette[3 * 2 + 2], LCD_Palette[3 * 3 + 2], LCD_Palette[3 * 4 + 2],
-+ LCD_Palette[3 * 5 + 2], LCD_Palette[3 * 6 + 2], LCD_Palette[3 * 7 + 2]);
-+ dbg("canon palette 8-15: %08x %08x %08x %08x %08x %08x %08x %08x",
-+ LCD_Palette[3 * 8 + 2], LCD_Palette[3 * 9 + 2], LCD_Palette[3 * 10 + 2], LCD_Palette[3 * 11 + 2],
-+ LCD_Palette[3 * 12 + 2], LCD_Palette[3 * 13 + 2], LCD_Palette[3 * 14 + 2], LCD_Palette[3 * 15 + 2]);
-+ }
-+ photo_mode = 0;
-+ palette_ours();
-+ ui_last_palette = get_ms_clock();
-+}
-+
-+void fos_port_photo(const uint8_t (*pal)[3], int n, int k)
-+{
-+ photo_n = COERCE(n, 0, FOS_PRINT_COLOURS);
-+ memcpy(photo_pal, pal, photo_n * 3);
-+ photo_k = COERCE(k, 0, 256);
-+ photo_mode = 1;
-+ palette_ours();
-+ ui_last_palette = get_ms_clock();
-+}
-+
-+void fos_port_log(const char *msg)
-+{
-+ dbg("%s", msg);
-+}
-+
-+int fos_port_dev_cap()
-+{
-+ return 0;
-+}
-+
-+/* ---- the card */
-+
-+const char *fos_port_card()
-+{
-+ static char root[8];
-+ snprintf(root, sizeof(root), "%s:/", get_shooting_card()->drive_letter);
-+ return root;
-+}
-+
-+void *fos_port_open(const char *path, int write)
-+{
-+ return write ? FIO_CreateFile(path) : FIO_OpenFile(path, O_RDONLY | O_SYNC);
-+}
-+
-+/* Canon reads files by DMA: into memory the CPU caches, it goes through
-+ * an uncached buffer. Taken at start (card_buffer), while there is memory
-+ * for it: on a 5D Mark II, asked for only when the darkroom first read a
-+ * roll's log, it wasn't there, and every read came back empty (#10). */
-+#define BOUNCE (64 * 1024)
-+static uint8_t *bounce = 0;
-+static int bounce_size = 0;
-+
-+static int card_buffer()
-+{
-+ for (int size = BOUNCE; !bounce && size >= 4096; size /= 4)
-+ {
-+ bounce = fio_malloc(size);
-+ if (bounce) bounce_size = size;
-+ else dbg("read: no %d-byte buffer for card reads", size);
-+ }
-+ return bounce != 0;
-+}
-+
-+int fos_port_read(void *f, void *buf, int size)
-+{
-+ if (buf != CACHEABLE(buf))
-+ return FIO_ReadFile(f, buf, size);
-+ if (!card_buffer()) return -1;
-+ int done = 0;
-+ while (done < size)
-+ {
-+ int n = MIN(size - done, bounce_size);
-+ int got = FIO_ReadFile(f, UNCACHEABLE(bounce), n);
-+ if (got <= 0) break;
-+ memcpy((uint8_t *) buf + done, UNCACHEABLE(bounce), got);
-+ done += got;
-+ if (got < n) break;
-+ }
-+ return done;
-+}
-+
-+int fos_port_write(void *f, const void *buf, int size)
-+{
-+ return FIO_WriteFile(f, buf, size);
-+}
-+
-+int fos_port_seek(void *f, int offset)
-+{
-+ return FIO_SeekSkipFile(f, offset, SEEK_SET) == offset ? 0 : -1;
-+}
-+
-+void fos_port_close(void *f)
-+{
-+ if (f) FIO_CloseFile(f);
-+}
-+
-+int fos_port_list(const char *dir, int (*fn)(void *ctx, const char *name, int is_dir), void *ctx)
-+{
-+ char path[FIO_MAX_PATH_LENGTH];
-+ int len = snprintf(path, sizeof(path), "%s", dir);
-+ if (len > 0 && len < (int) sizeof(path) - 1 && path[len - 1] != '/') strcat(path, "/");
-+ struct fio_file file;
-+ struct fio_dirent *d = FIO_FindFirstEx(path, &file);
-+ if (IS_ERROR(d)) return -1;
-+ int n = 0;
-+ do
-+ {
-+ if (file.name[0] == '.') continue;
-+ n++;
-+ if (!fn(ctx, file.name, (file.mode & ATTR_DIRECTORY) != 0)) break;
-+ }
-+ while (FIO_FindNextEx(d, &file) == 0);
-+ FIO_FindClose(d);
-+ return n;
-+}
-+
-+int fos_port_mkdir(const char *path)
-+{
-+ if (is_dir(path)) return 0;
-+ FIO_CreateDirectory(path);
-+ return is_dir(path) ? 0 : -1;
-+}
-+
-+void *fos_port_alloc(int size)
-+{
-+ void *p = tmp_malloc(size);
-+ if (!p) dbg("alloc: %d bytes failed", size);
-+ return p;
-+}
-+
-+void fos_port_free(void *p)
-+{
-+ if (p) free(p);
-+}
-+
-+void fos_port_roll(struct fos_roll *r)
-+{
-+ if (roll_loaded && !recent_valid)
-+ {
-+ update_log_path();
-+ read_back_log();
-+ }
-+ memset(r, 0, sizeof(*r));
-+ r->loaded = roll_loaded;
-+ r->number = roll_number;
-+ r->film = COERCE(roll_film, 0, fos_nfilms - 1);
-+ r->exposures = roll_exposures;
-+ r->shot = frames_shot;
-+ r->need_wind = need_wind;
-+ snprintf(r->loaded_at, sizeof(r->loaded_at), "%s", loaded_at);
-+ r->nrecent = nrecent;
-+ for (int i = 0; i < nrecent && i < FOS_RECENT; i++)
-+ {
-+ r->recent[i].no = recent[i].no;
-+ memcpy(r->recent[i].time, recent[i].time, sizeof(r->recent[i].time));
-+ memcpy(r->recent[i].fstop, recent[i].fstop, sizeof(r->recent[i].fstop));
-+ }
-+}
-+
-+/* Screen orientation on the swivel screens (60D, 600D, 650D, 700D, 70D, #49).
-+ * Canon turns the whole screen, its own and ours, by the hinge's switch. A
-+ * broken switch leaves it the wrong way round, and Canon's menu has nothing
-+ * to set it by hand; ML's Display menu does it once, until the switch says
-+ * otherwise. With an orientation set here, Canon's NormalDisplay /
-+ * ReverseDisplay / MirrorDisplay put it back whenever the camera changes it
-+ * (Canon's 0 normal, 1 reverse, 2 mirror, as in ML's display_orientation_toggle).
-+ * Back on Auto, the screen goes back to the way Canon last turned it. */
-+#if defined(CONFIG_VARIANGLE_DISPLAY) && defined(DISPLAY_ORIENTATION)
-+#define CAN_FLIP 1
-+extern void NormalDisplay();
-+extern void ReverseDisplay();
-+extern void MirrorDisplay();
-+
-+static void flip_to(int o)
-+{
-+ if (o == 0) NormalDisplay();
-+ else if (o == 1) ReverseDisplay();
-+ else MirrorDisplay();
-+}
-+
-+static void flip_step(int now_please)
-+{
-+ static int canon_had = -1, we_set = -1, last = 0, times = 0;
-+ if (!DISPLAY_IS_ON) return;
-+ int o = DISPLAY_ORIENTATION;
-+ if (o < 0 || o > 2) return;
-+ if (!scr_flip)
-+ {
-+ /* back to Auto: the way Canon last turned it */
-+ if (canon_had >= 0 && o != canon_had) flip_to(canon_had);
-+ canon_had = we_set = -1;
-+ return;
-+ }
-+ int want = COERCE(scr_flip - 1, 0, 2);
-+ if (o == want) return;
-+ int now = get_ms_clock();
-+ if (!now_please && last && now - last < 300) return; /* give Canon's change time to land */
-+ last = now ? now : 1;
-+ /* not the way we last set it: Canon turned it, and that is the hinge's
-+ * latest word (the first time, its word from before). Auto goes back to that */
-+ if (o != we_set) canon_had = o;
-+ if (times++ < 20) dbg("screen: orientation %d (Canon's %d), set %d", o, canon_had, want);
-+ we_set = want;
-+ flip_to(want);
-+}
-+#else
-+#define CAN_FLIP 0
-+static void flip_step(int now_please) { (void) now_please; }
-+#endif
-+
-+static int *setting_var(int s)
-+{
-+ switch (s)
-+ {
-+ case FS_HUD: return &hud_enabled;
-+ case FS_LEDS: return &leds_on_half;
-+ case FS_FOCUS: return &focus_screen;
-+ case FS_WIND: return &wind_mode;
-+ case FS_APKEYS: return &aperture_keys;
-+ case FS_LENS_WIDE: return &lens_widest;
-+ case FS_FSTOP: return &manual_fstop;
-+ case FS_STARTUP: return &startup_picker;
-+ case FS_PLAYLOCK: return &play_lock;
-+ case FS_BOOTANIM: return &boot_anim;
-+ case FS_DEBUG: return &debug_log;
-+ case FS_MODE: return &film_mode;
-+ case FS_FILM: return &film_sel;
-+ case FS_EXP: return &exp_sel;
-+ case FS_SCR_STD: return &scr_std;
-+ case FS_SCR_SAT: return &scr_sat;
-+ case FS_SCR_WARM: return &scr_warm;
-+ case FS_SCR_BRIGHT: return &scr_bright;
-+ case FS_SCR_FLIP: return &scr_flip;
-+ }
-+ return 0;
-+}
-+
-+int fos_port_get(int s)
-+{
-+ int *v = setting_var(s);
-+ if (s == FS_FSTOP) return current_fstop();
-+ if (s == FS_SCR_FLIP && !CAN_FLIP) return -1;
-+ return v ? *v : 0;
-+}
-+
-+void fos_port_set(int s, int value)
-+{
-+ int *v = setting_var(s);
-+ if (v) *v = value;
-+ hud_dirty = 1;
-+ if (s == FS_SCR_FLIP) flip_step(1);
-+ /* screen colour: the whole film OS changes at once */
-+ if (s == FS_SCR_STD || s == FS_SCR_SAT || s == FS_SCR_WARM || s == FS_SCR_BRIGHT)
-+ {
-+ palette_ours();
-+ ui_last_palette = get_ms_clock();
-+ }
-+}
-+
-+void fos_port_action(int action, int a, int b)
-+{
-+ switch (action)
-+ {
-+ case FA_LOAD:
-+ if (ROLL_IN_PROGRESS) rewind_roll();
-+ load_roll(a, fos_exposure_choices[COERCE(b, 0, FOS_NEXP - 1)]);
-+ ui_after |= AFTER_APPLY;
-+ break;
-+ case FA_REWIND:
-+ rewind_roll();
-+ break;
-+ case FA_BUSY:
-+ if (a && !dev_busy) powersave_prohibit();
-+ if (!a && dev_busy) powersave_permit();
-+ dev_busy = a;
-+ dbg("darkroom: %s", a ? "developing" : "done");
-+ break;
-+ case FA_REAPPLY:
-+ if (roll_loaded) ui_after |= AFTER_APPLY;
-+ break;
-+ case FA_CANON_MENU:
-+ ui_after |= AFTER_CANON_MENU;
-+ break;
-+ }
-+}
-+
-+void fos_port_clock(char *buf, int size)
-+{
-+ /* screens ask every frame; the RTC is read once a second */
-+ static char cached[8];
-+ static int last = -100000;
-+ int now_ms = get_ms_clock();
-+ if (now_ms - last > 1000)
-+ {
-+ struct tm now;
-+ LoadCalendarFromRTC(&now);
-+ snprintf(cached, sizeof(cached), "%02d:%02d", now.tm_hour, now.tm_min);
-+ last = now_ms;
-+ }
-+ snprintf(buf, size, "%s", cached);
-+}
-+
-+int fos_port_lens_manual()
-+{
-+ return lens_is_manual();
-+}
-+
-+const char *fos_port_lens_name()
-+{
-+ return lens_info.name[0] ? lens_info.name : "Lens";
-+}
-+
-+/* M-Film's version (VERSION at the top of the repository; build_fork.sh writes fos_version.h) */
-+#if defined(__has_include)
-+#if __has_include("fos_version.h")
-+#include "fos_version.h"
-+#endif
-+#endif
-+#ifndef MFILM_VERSION
-+#define MFILM_VERSION "dev"
-+#endif
-+
-+const char *fos_port_model()
-+{
-+ /* "Canon EOS 650D": as the camera reports itself */
-+ return camera_model[0] ? camera_model : "Canon camera";
-+}
-+
-+const char *fos_port_version()
-+{
-+ return MFILM_VERSION;
-+}
-+
-+
-+void fos_port_stat(const struct fos_stat *s)
-+{
-+ stat_all.frames += s->frames;
-+ stat_all.draw_ms += s->draw_ms;
-+ stat_all.present_ms += s->present_ms;
-+ stat_all.rest_ms += s->rest_ms;
-+ stat_all.cans_ms += s->cans_ms;
-+ if (s->worst_ms > stat_all.worst_ms) stat_all.worst_ms = s->worst_ms;
-+ if (s->open_ms) stat_all.open_ms = s->open_ms;
-+}
-+
-+/* ---------------------------------------------------------------- viewfinder HUD */
-+
-+static volatile int hud_showing = 0; /* HUD drawn on the LiveView screen */
-+
-+static int hud_visible()
-+{
-+ return hud_enabled && roll_loaded && lv && display_idle() && !is_movie_mode() && !ui_running;
-+}
-+
-+/* a DSLR shooting through the viewfinder: the back screen shows Canon's
-+ * settings display, and the top plate (fos_hud_plate) goes over it */
-+static int plate_visible()
-+{
-+ return !FOS_LV_ONLY && hud_enabled && roll_loaded && !lv && display_is_on() && display_idle()
-+ && !is_movie_mode() && !ui_running;
-+}
-+
-+/* Magic Lantern's own LiveView overlays never draw: the film OS (or
-+ * Canon's clean screen) is all you see */
-+int filmroll_overlays_active()
-+{
-+ return 1;
-+}
-+
-+/* the HUD draws with Canon's palette */
-+static struct fos_hud_palette hud_pal;
-+
-+static void hud_palette_init()
-+{
-+ hud_pal.clear = COLOR_EMPTY;
-+ hud_pal.black = COLOR_BLACK;
-+ hud_pal.white = COLOR_WHITE;
-+ hud_pal.red = COLOR_RED;
-+ hud_pal.dark_red = COLOR_DARK_RED;
-+ for (int i = 0; i <= 100; i++)
-+ hud_pal.gray[i] = COLOR_GRAY(i);
-+}
-+
-+/* the shutter speed as the LEDs show it: 1/125 is 125, slow ones keep the " */
-+static void shutter_led(char *buf, int size)
-+{
-+ if (!lens_info.raw_shutter)
-+ {
-+ snprintf(buf, size, "--");
-+ return;
-+ }
-+ const char *s = lens_format_shutter(lens_info.raw_shutter);
-+ int n = 0;
-+ for (; *s && n < size - 1; s++)
-+ if ((*s >= '0' && *s <= '9') || *s == '.' || *s == '"')
-+ buf[n++] = *s;
-+ buf[n] = 0;
-+}
-+
-+static void hud_draw(int lit, int blink, int plate)
-+{
-+ struct fos_hud h;
-+ memset(&h, 0, sizeof(h));
-+ h.lit = lit;
-+ h.blink = blink;
-+ h.fstop = current_fstop();
-+ h.widest = lens_is_manual() ? lens_widest : 0;
-+ if (lit)
-+ {
-+ int ev8 = get_ae_value(); /* meter reading, 1/8 EV, + = too bright */
-+ h.meter = 1;
-+ h.want = h.fstop + (ev8 * 3 + (ev8 >= 0 ? 4 : -4)) / 8;
-+ }
-+ shutter_led(h.shutter, sizeof(h.shutter));
-+ h.frame = frames_shot + 1;
-+ h.exposures = roll_exposures;
-+ h.finished = ROLL_FINISHED;
-+ h.need_wind = need_wind;
-+ h.focus_screen = focus_screen;
-+ h.film = fos_films[COERCE(roll_film, 0, fos_nfilms - 1)].name;
-+ h.iso = fos_films[COERCE(roll_film, 0, fos_nfilms - 1)].box_iso;
-+ uint8_t *vram = bmp_vram();
-+#if !FOS_LV_ONLY
-+ if (vram && plate) fos_hud_plate(vram, BMPPITCH, &h, &hud_pal);
-+ else
-+#endif
-+ if (vram) fos_hud_draw(vram, BMPPITCH, &h, &hud_pal);
-+}
-+
-+static void hud_clear()
-+{
-+ uint8_t *vram = bmp_vram();
-+ if (vram)
-+ fos_hud_clear(vram, BMPPITCH, &hud_pal);
-+}
-+
-+#if !FOS_LV_ONLY
-+/* The top plate's watchdog (Canon drawing over our screen, above): checked
-+ * every 50 ms while the plate is up, from hud_step and the main loop. */
-+static volatile int plate_on_screen = 0;
-+
-+static void plate_sums()
-+{
-+ uint8_t *vram = bmp_vram();
-+ if (!vram) return;
-+ for (int y = 0; y < FOS_H; y++)
-+ shown_sum[y] = row_sum(vram + y * BMPPITCH);
-+}
-+
-+static int plate_overdrawn()
-+{
-+ static struct overdraw_check check = { .what = "hud: the plate" };
-+ if (!plate_on_screen || hud_dirty) return 0; /* not up, or about to be drawn anyway */
-+ uint8_t *vram = bmp_vram();
-+ if (!vram || !overdrawn(&check, vram)) return 0;
-+ hud_dirty = 1;
-+ return 1;
-+}
-+#endif
-+
-+/* one HUD refresh; called from the main loop */
-+static void hud_step()
-+{
-+ static int last_sig = -1;
-+ static int last_draw = 0;
-+ static int drawn = 0;
-+ static int was_visible = -1;
-+ static int plate_drawn = 0;
-+
-+ int plate = plate_visible();
-+ int visible = hud_visible() || plate;
-+ if (visible * 2 + plate != was_visible)
-+ {
-+ dbg("hud: visible %d plate %d (enabled %d roll %d lv %d movie %d ui %d)",
-+ visible, plate, hud_enabled, roll_loaded, lv, is_movie_mode(), ui_running);
-+ was_visible = visible * 2 + plate;
-+ }
-+ hud_showing = visible;
-+
-+#if !FOS_LV_ONLY
-+ /* On a DSLR Canon keeps drawing its own screen (the settings display, or
-+ * its LiveView overlays) and flipping it over ours: the two flicker in
-+ * turn, and a change of aperture or shutter brings Canon's back. While the
-+ * HUD or the plate is up, stop Canon flipping its buffer, as the ML menu
-+ * does, and wipe what it left. Canon gets the screen back as soon as ours
-+ * goes (a Canon menu, playback, the display off). The film OS's own pages
-+ * take the buffer themselves (film_ui_open). */
-+ /* Canon's screen comes back only once ours has been gone a moment: the
-+ * display isn't idle for a blink while a frame is taken, and giving the
-+ * screen back then (and taking it again) flashed Canon's screen, and its
-+ * picture of the frame, over ours (#17). The film OS's pages take the
-+ * screen at once, and so does anything that isn't a blink. */
-+ static int canon_held = 0, gone_since = 0;
-+ if (visible)
-+ {
-+ gone_since = 0;
-+ if (!canon_held)
-+ {
-+ canon_gui_disable_front_buffer();
-+ clrscr();
-+ canon_held = 1;
-+ hud_dirty = 1;
-+ dbg("hud: Canon's screen held");
-+ }
-+ }
-+ else if (canon_held)
-+ {
-+ int now = get_ms_clock();
-+ if (!gone_since) gone_since = now ? now : 1;
-+ /* and while a frame is being taken and saved (job_state), or just was:
-+ * the screen comes back to ours by itself, so Canon's needn't show for
-+ * the second or so in between (#17) */
-+ int shooting = lens_info.job_state || get_halfshutter_pressed() || now - last_shot_ms < 2500;
-+ /* a button (Q, MENU, INFO, the dial...) pressed as ours went, or since: that's
-+ * Canon's screen being asked for, not a blink, so it gets it at once */
-+ int asked = last_key_ms && last_key_ms - gone_since > -200;
-+ if (ui_running || asked || (now - gone_since > 700 && !shooting) || now - gone_since > 4000)
-+ {
-+ canon_held = 0;
-+ gone_since = 0;
-+ if (!ui_running) canon_gui_enable_front_buffer(1);
-+ dbg("hud: Canon's screen given back%s", ui_running ? " (to the film OS)" : asked ? " (a button)" : "");
-+ }
-+ }
-+#endif
-+
-+ /* the plate off (LiveView on, or a Canon menu over it): hand the screen back */
-+ if (plate_drawn && !plate)
-+ {
-+#if !FOS_LV_ONLY
-+ uint8_t *vram = bmp_vram();
-+ if (vram && display_idle() && !ui_running) fos_hud_plate_clear(vram, BMPPITCH, &hud_pal);
-+#endif
-+ plate_drawn = 0;
-+#if !FOS_LV_ONLY
-+ plate_on_screen = 0;
-+#endif
-+ last_sig = -1;
-+ }
-+
-+ if (!visible)
-+ {
-+ /* HUD switched off or roll rewound: wipe it once we're back on the LiveView screen */
-+ if (drawn && (!hud_enabled || !roll_loaded) && lv && display_idle() && !ui_running)
-+ {
-+ hud_clear();
-+ drawn = 0;
-+ }
-+ last_sig = -1;
-+ return;
-+ }
-+ drawn = 1;
-+#if !FOS_LV_ONLY
-+ plate_overdrawn();
-+#endif
-+
-+ int now = get_ms_clock();
-+ int lit = !leds_on_half || get_halfshutter_pressed() || now < leds_until;
-+ int blink = (now / 400) % 2;
-+ int ev8 = lit ? get_ae_value() : 0;
-+
-+ int sig = lit | blink << 1 | need_wind << 2 | (frames_shot & 0xFF) << 3
-+ | lens_info.raw_shutter << 11 | (ev8 & 0xFF) << 19 | (current_fstop() & 0x1F) << 27;
-+
-+ /* redraw on change, and every second to win over Canon's overlays */
-+ if (sig != last_sig || hud_dirty || now - last_draw > 1000)
-+ {
-+ hud_dirty = 0;
-+ last_sig = sig;
-+ last_draw = now;
-+ hud_draw(lit, blink, plate);
-+ plate_drawn = plate;
-+#if !FOS_LV_ONLY
-+ plate_on_screen = plate;
-+ if (plate) plate_sums();
-+#endif
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- keys */
-+
-+/* while the film OS is up it gets the dial and the buttons; anything it
-+ * doesn't use goes on to Canon, like the ML menu does */
-+static int ui_key(struct event *event, int key)
-+{
-+ int dir = 0;
-+ switch (key)
-+ {
-+ case MODULE_KEY_PRESS_HALFSHUTTER:
-+ case MODULE_KEY_PRESS_FULLSHUTTER:
-+ case MODULE_KEY_REC:
-+ ui_abort = 1; /* back to the camera, ready to shoot */
-+ return 1;
-+ case MODULE_KEY_UNPRESS_HALFSHUTTER:
-+ case MODULE_KEY_UNPRESS_FULLSHUTTER:
-+ return 1; /* Canon must see the shutter let go */
-+
-+ case MODULE_KEY_WHEEL_LEFT: dir = FK_WHEEL_L; break;
-+ case MODULE_KEY_WHEEL_RIGHT: dir = FK_WHEEL_R; break;
-+ case MODULE_KEY_WHEEL_UP: dir = FK_WHEEL_L; break;
-+ case MODULE_KEY_WHEEL_DOWN: dir = FK_WHEEL_R; break;
-+
-+ case MODULE_KEY_PRESS_LEFT: keyq_push(FK_LEFT); return 0;
-+ case MODULE_KEY_PRESS_RIGHT: keyq_push(FK_RIGHT); return 0;
-+ case MODULE_KEY_PRESS_UP: keyq_push(FK_UP); return 0;
-+ case MODULE_KEY_PRESS_DOWN: keyq_push(FK_DOWN); return 0;
-+ case MODULE_KEY_UNPRESS_UDLR:
-+ keyq_push(FK_RELEASE | FK_LEFT);
-+ keyq_push(FK_RELEASE | FK_RIGHT);
-+ keyq_push(FK_RELEASE | FK_UP);
-+ keyq_push(FK_RELEASE | FK_DOWN);
-+ return 0;
-+
-+ case MODULE_KEY_PRESS_SET:
-+ case MODULE_KEY_Q:
-+ case MODULE_KEY_JOY_CENTER: keyq_push(FK_SET); return 0;
-+ case MODULE_KEY_UNPRESS_SET: return 0;
-+ case MODULE_KEY_MENU: keyq_push(FK_MENU); return 0;
-+ case MODULE_KEY_INFO: keyq_push(FK_INFO); return 0;
-+ case MODULE_KEY_PLAY: keyq_push(FK_PLAY); return 0;
-+ case MODULE_KEY_TRASH:
-+ case MODULE_KEY_TOUCH_2_FINGER: keyq_push(FK_HOME); return 0;
-+
-+ case 0:
-+ return 1; /* not a button: Canon's business */
-+ default:
-+ return 0;
-+ }
-+
-+ /* newer firmware may group several wheel clicks into one event */
-+ int count = MAX(1, MIN(event->arg, 8));
-+ for (int i = 0; i < count; i++)
-+ keyq_push(dir);
-+ return 0;
-+}
-+
-+static unsigned int lv_key(unsigned int key)
-+{
-+ /* what used to open the Magic Lantern menu opens home instead */
-+ if (key == MODULE_KEY_TRASH || key == MODULE_KEY_TOUCH_2_FINGER)
-+ {
-+ if (shooting_screen())
-+ {
-+ dbg("key: home");
-+ open_ui(FOS_OPEN_HOME);
-+ }
-+ return 0;
-+ }
-+
-+ /* PLAY: the developed prints, never Canon's playback of what the
-+ * darkroom hasn't seen yet */
-+ if (key == MODULE_KEY_PLAY && play_lock && shooting_screen())
-+ {
-+ dbg("key: PLAY -> prints");
-+ open_ui(FOS_OPEN_PRINTS);
-+ return 0;
-+ }
-+
-+ /* only on the plain LiveView screen: never steal keys from Canon's menus or dialogs */
-+ if (!lv || !roll_loaded || !display_idle())
-+ return 1;
-+
-+ if (key == MODULE_KEY_PRESS_HALFSHUTTER || key == MODULE_KEY_UNPRESS_HALFSHUTTER)
-+ hud_dirty = 1;
-+
-+ /* aperture ring for manual lenses: the wheel in Av mode (where it has
-+ * nothing to adjust without a lens), or up/down if the user prefers */
-+ if (lens_is_manual() && !ROLL_FINISHED)
-+ {
-+ int dir = 0;
-+ if (aperture_keys == 0 && shooting_mode == SHOOTMODE_AV)
-+ dir = (key == MODULE_KEY_WHEEL_RIGHT) ? 1 : (key == MODULE_KEY_WHEEL_LEFT) ? -1 : 0;
-+ else if (aperture_keys == 1)
-+ dir = (key == MODULE_KEY_PRESS_UP) ? 1 : (key == MODULE_KEY_PRESS_DOWN) ? -1 : 0;
-+ if (dir)
-+ {
-+ step_manual_fstop(dir);
-+ leds_until = get_ms_clock() + 2000;
-+ hud_dirty = 1;
-+ return 0;
-+ }
-+ }
-+
-+ if (ROLL_FINISHED)
-+ {
-+ if (key == MODULE_KEY_PRESS_SET)
-+ {
-+ open_ui(FOS_OPEN_END);
-+ return 0;
-+ }
-+ return 1;
-+ }
-+
-+ if (need_wind)
-+ {
-+ if (key == MODULE_KEY_PRESS_SET)
-+ {
-+ need_wind = 0;
-+ leds_until = get_ms_clock() + 1500;
-+ hud_dirty = 1;
-+ return 0;
-+ }
-+ if (wind_mode == 2 && (key == MODULE_KEY_PRESS_HALFSHUTTER || key == MODULE_KEY_PRESS_FULLSHUTTER))
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+int handle_filmroll_keys(struct event *event)
-+{
-+ int key = module_translate_key(event->param, MODULE_KEY_PORTABLE);
-+ if (key && key != MODULE_KEY_PRESS_HALFSHUTTER && key != MODULE_KEY_UNPRESS_HALFSHUTTER &&
-+ key != MODULE_KEY_PRESS_FULLSHUTTER && key != MODULE_KEY_UNPRESS_FULLSHUTTER)
-+ {
-+ int now = get_ms_clock();
-+ last_key_ms = now ? now : 1;
-+ }
-+ if (ui_running)
-+ {
-+#ifdef BGMT_UNPRESS_LEFT
-+ /* the EOS M reports each direction's release on its own, and the
-+ * portable key codes have no name for those */
-+ switch (event->param)
-+ {
-+ case BGMT_UNPRESS_LEFT: keyq_push(FK_RELEASE | FK_LEFT); return 0;
-+ case BGMT_UNPRESS_RIGHT: keyq_push(FK_RELEASE | FK_RIGHT); return 0;
-+ case BGMT_UNPRESS_UP: keyq_push(FK_RELEASE | FK_UP); return 0;
-+ case BGMT_UNPRESS_DOWN: keyq_push(FK_RELEASE | FK_DOWN); return 0;
-+ }
-+#endif
-+ return ui_key(event, key);
-+ }
-+
-+ if (!key)
-+ return 1;
-+
-+ /* newer firmware may group several wheel clicks into one event */
-+ int count = 1;
-+ if (key == MODULE_KEY_WHEEL_LEFT || key == MODULE_KEY_WHEEL_RIGHT)
-+ count = MAX(1, event->arg);
-+
-+ int pass = 1;
-+ for (int i = 0; i < count; i++)
-+ pass = lv_key(key);
-+ return pass;
-+}
-+
-+/* ---------------------------------------------------------------- the ML menu, replaced */
-+
-+#ifdef MODULE
-+int filmroll_menu_requested()
-+{
-+ if (shooting_screen())
-+ open_ui(FOS_OPEN_HOME);
-+ return 1;
-+}
-+#else
-+void filmroll_menu_requested()
-+{
-+ if (shooting_screen())
-+ open_ui(FOS_OPEN_HOME);
-+}
-+#endif
-+
-+static void filmroll_init()
-+{
-+ if (roll_loaded)
-+ update_log_path();
-+ fos_ui_init();
-+ hud_palette_init();
-+ dbg("init: M-Film " MFILM_VERSION ", fork build %s %s, roll %d loaded %d shot %d/%d, startup %d hud %d",
-+ __DATE__, __TIME__, roll_number, roll_loaded, frames_shot, roll_exposures,
-+ startup_picker, hud_enabled);
-+}
-+
-+/* The film OS's fonts are a file on the card (see fos_gfx.h): kept in
-+ * memory taken after boot, not in autoexec.bin */
-+static void load_fonts()
-+{
-+ int size = 0;
-+ uint8_t *raw = read_entire_file("ML/DATA/" FOS_FONT_FILE, &size);
-+ if (!raw)
-+ {
-+ dbg("fonts: ML/DATA/%s not found", FOS_FONT_FILE);
-+ return;
-+ }
-+ uint8_t *blob = malloc(size); /* cached memory, for drawing */
-+ if (blob)
-+ {
-+ memcpy(blob, raw, size);
-+ if (!fos_fonts_load(blob, size))
-+ {
-+ free(blob);
-+ blob = 0;
-+ }
-+ }
-+ fio_free(raw);
-+ dbg("fonts: %d bytes, %s", size, blob ? "loaded" : "not usable");
-+}
-+
-+/* the films beyond the built-in ones, from the card; the file stays in
-+ * memory (the films point into it) */
-+static void load_films()
-+{
-+ int size = 0;
-+ uint8_t *raw = read_entire_file("ML/DATA/" FOS_FILM_FILE, &size);
-+ if (!raw)
-+ {
-+ dbg("films: ML/DATA/%s not found, the built-in ones only", FOS_FILM_FILE);
-+ return;
-+ }
-+ uint8_t *blob = malloc(size);
-+ if (blob)
-+ {
-+ memcpy(blob, raw, size);
-+ if (!fos_films_load(blob, size))
-+ {
-+ free(blob);
-+ blob = 0;
-+ }
-+ }
-+ fio_free(raw);
-+ dbg("films: %d (%d bytes, %s)", fos_nfilms, size, blob ? "loaded" : "not usable");
-+}
-+
-+/* the film OS is the camera's start screen */
-+static void startup_task()
-+{
-+ /* wait (up to ~15 s) for ML to finish booting and LiveView to settle */
-+ for (int i = 0; i < 150; i++)
-+ {
-+ if (ml_started && shooting_screen())
-+ break;
-+ if (i % 10 == 0 && ml_started)
-+ DBG_STATE("startup waiting");
-+ msleep(100);
-+ }
-+ msleep(300);
-+
-+ DBG_STATE("startup check");
-+ if (!ml_started || !shooting_screen())
-+ {
-+ dbg("startup: not on the shooting screen, film OS skipped");
-+ return;
-+ }
-+ int shelf = startup_picker == 2 || (startup_picker == 1 && !ROLL_IN_PROGRESS);
-+ if (boot_anim && startup_picker)
-+ open_ui(shelf ? FOS_OPEN_BOOT : FOS_OPEN_BOOT_LV);
-+ else if (shelf)
-+ open_ui(FOS_OPEN_SHELF);
-+}
-+
-+/* Everything runs from one task that waits for ML to finish booting, so
-+ * nothing touches Canon's GUI state before it exists: start screen first,
-+ * then frame logging and the HUD. */
-+static void filmroll_task()
-+{
-+ while (!ml_started)
-+ msleep(100);
-+ dbg("main: started");
-+
-+ load_fonts();
-+ load_films();
-+ dbg("read: %s", card_buffer() ? "card buffer ready" : "no card buffer: the darkroom can't read the card");
-+ startup_task();
-+ film_capture_check();
-+
-+ int last_alive = 0;
-+ TASK_LOOP
-+ {
-+ poll_frames();
-+
-+ /* the roll has just been finished: once the camera is quiet, ask
-+ * whether to develop it now or load a new one first */
-+ if (end_due && get_ms_clock() > end_due && ROLL_FINISHED)
-+ {
-+ if (!ui_running && shooting_screen() && !get_halfshutter_pressed() && job_state_ready_to_take_pic())
-+ {
-+ end_due = 0;
-+ dbg("roll %03d finished: asking", roll_number);
-+ open_ui(FOS_OPEN_END);
-+ }
-+ }
-+ else if (end_due && !ROLL_FINISHED) end_due = 0;
-+ if (k % 2 == 0)
-+ {
-+ hud_step(); /* every 100 ms */
-+ flip_step(0);
-+ }
-+#if !FOS_LV_ONLY
-+ else if (plate_overdrawn())
-+ hud_step(); /* Canon drew over the plate: at once */
-+#endif
-+
-+ int now = get_ms_clock();
-+ if (now - last_alive > 60000)
-+ {
-+ dbg("main: alive, roll %d loaded %d shot %d/%d file %d",
-+ roll_number, roll_loaded, frames_shot, roll_exposures, last_file_number);
-+ last_alive = now;
-+ }
-+ msleep(50);
-+ }
-+}
-+
-+#ifndef MODULE
-+INIT_FUNC("filmroll", filmroll_init);
-+TASK_CREATE("film_main", filmroll_task, 0, 0x1e, 0x2000);
-+#else
-+#include "filmos_mod.h"
-+#endif
-diff --git a/src/filmroll.h b/src/filmroll.h
-new file mode 100644
-index 000000000..c465a6cd1
---- /dev/null
-+++ b/src/filmroll.h
-@@ -0,0 +1,22 @@
-+#ifndef _filmroll_h_
-+#define _filmroll_h_
-+
-+struct event;
-+
-+/* button hook, called from handle_common_events_by_feature; 0 = handled */
-+int handle_filmroll_keys(struct event *event);
-+
-+/* called instead of opening the Magic Lantern menu (menu.c). With the film OS
-+ * as a module (FEATURE_FILMOS_MODULE): 1 = it took it, 0 = open ML's menu as
-+ * usual (the module isn't loaded) */
-+#if defined(FEATURE_FILMOS_MODULE) || defined(MODULE)
-+int filmroll_menu_requested();
-+#else
-+void filmroll_menu_requested();
-+#endif
-+
-+/* ML's own LiveView overlays stay out of the way of the film OS and the
-+ * viewfinder HUD (always, in this fork) */
-+int filmroll_overlays_active();
-+
-+#endif
-diff --git a/src/fos.h b/src/fos.h
-new file mode 100644
-index 000000000..1df742bc0
---- /dev/null
-+++ b/src/fos.h
-@@ -0,0 +1,243 @@
-+/* fos: the film OS - the EOS M's own user interface on top of Magic Lantern.
-+ *
-+ * Everything the user sees (film shelf, home, settings, roll status,
-+ * transitions) lives in fos_ui.c and draws with fos_gfx. It talks to the
-+ * camera only through the fos_port_* functions below, which filmroll.c
-+ * implements on the camera and sim/sim.c implements on a PC.
-+ */
-+
-+#ifndef _fos_h_
-+#define _fos_h_
-+
-+#include "fos_gfx.h"
-+#include <stdio.h>
-+#include <string.h>
-+
-+#define FOS_NAME "M" T_DOT "FILM"
-+
-+/* the first n characters of src (fewer if it is shorter) into dst: the
-+ * camera's snprintf is Canon's, which doesn't know "%.5s" */
-+static inline char *fos_copy(char *dst, int size, const char *src, int n)
-+{
-+ int i = 0;
-+ for (; i < n && i < size - 1 && src[i]; i++) dst[i] = src[i];
-+ if (size > 0) dst[i] = 0;
-+ return dst;
-+}
-+
-+/* ---------------------------------------------------------------- films */
-+
-+#define PS_STANDARD 0x81 /* raw PROP_PICTURE_STYLE values */
-+#define PS_LANDSCAPE 0x83
-+#define PS_MONO 0x86
-+
-+/* the shelves the films stand on */
-+enum { FOS_GROUP_COLOUR, FOS_GROUP_SLIDE, FOS_GROUP_BW, FOS_GROUP_CINE, FOS_NGROUPS };
-+extern const char *const fos_group_names[FOS_NGROUPS];
-+
-+/* a canister label drawn from parts (the films from ML/DATA/FOSFILMS.BIN;
-+ * the built-in ones have their own painting in fos_film.c). An ink is a
-+ * ramp and a level. */
-+enum { FOS_LABEL_BAND, FOS_LABEL_CAP, FOS_LABEL_STRIPES };
-+struct fos_label
-+{
-+ uint8_t style;
-+ uint8_t leader; /* level of a grey (B&W) leader, 0 = colour film */
-+ uint8_t bg[2], band[2], accent[2], text[2], num[2];
-+ char top[20]; /* small, above the name */
-+ char word[14]; /* the name */
-+ char num_s[8]; /* big: digits and H, P, T */
-+ char sub[18]; /* small, under the number */
-+};
-+
-+struct fos_film
-+{
-+ const char *key; /* must match films/films.py */
-+ const char *brand;
-+ const char *name;
-+ const char *process; /* "C-41", "E-6", "B&W" */
-+ const char *desc;
-+ int box_iso; /* rated speed */
-+ int iso; /* what the camera is set to (EOS M has no ISO 50) */
-+ int picstyle; /* in-camera preview only; the look comes from the lab */
-+ int contrast, saturation, color_tone, sharpness;
-+ int kelvin;
-+ int wbs_gm; /* + green, - magenta (-9..9) */
-+ int wbs_ba; /* + amber, - blue (-9..9) */
-+ uint8_t grain, punch, colour, warmth; /* 1..5, for the shelf */
-+ const char *shortname; /* in folder names: "Portra400" */
-+ int group; /* FOS_GROUP_* */
-+ const struct fos_label *label; /* NULL: painted by hand */
-+};
-+
-+/* the built-in films, then those from ML/DATA/FOSFILMS.BIN once loaded */
-+extern const struct fos_film *fos_films;
-+extern int fos_nfilms;
-+#define FOS_FILM_FILE "FOSFILMS.BIN"
-+/* blob: the file's contents, kept while the films are used; 1 when usable */
-+int fos_films_load(const uint8_t *blob, int size);
-+
-+extern const int fos_exposure_choices[]; /* 36, 24, 12 */
-+#define FOS_NEXP 3
-+
-+/* f-numbers x100 in 1/3 stops; see fos_film.c */
-+extern const int fos_fstops[];
-+extern const int fos_nfstops;
-+void fos_format_fstop(char *buf, int size, int index);
-+
-+/* ---------------------------------------------------------------- keys */
-+
-+enum
-+{
-+ FK_NONE,
-+ FK_LEFT, FK_RIGHT, FK_UP, FK_DOWN, /* the four presses of the rear dial */
-+ FK_WHEEL_L, FK_WHEEL_R, /* turning it */
-+ FK_SET, FK_MENU, FK_INFO, FK_PLAY,
-+ FK_HOME, /* what used to open the ML menu */
-+ FK_RELEASE = 0x100, /* or-ed in: a press above ended */
-+};
-+
-+/* ---------------------------------------------------------------- settings */
-+
-+enum
-+{
-+ FS_HUD, FS_LEDS, FS_FOCUS, FS_WIND,
-+ FS_APKEYS, FS_LENS_WIDE, FS_FSTOP,
-+ FS_STARTUP, FS_PLAYLOCK, FS_BOOTANIM, FS_DEBUG,
-+ FS_MODE, /* film mode: 0 Basic (a finished roll goes straight to the darkroom), 1 Realistic (rewind it first) */
-+ FS_FILM, FS_EXP,
-+ FS_SCR_STD, /* screen colour: 0 Canon's conversion, 1 Rec.709 */
-+ FS_SCR_SAT, FS_SCR_WARM, FS_SCR_BRIGHT, /* -FOS_SCR_STEPS..FOS_SCR_STEPS */
-+ FS_SCR_FLIP, /* swivel screens: 0 as Canon's hinge says, 1 normal, 2 upside down, 3 mirrored;
-+ the port answers -1 on a camera that can't, and the item isn't shown */
-+ FS_COUNT
-+};
-+#define FOS_SCR_STEPS 6
-+
-+enum
-+{
-+ FA_LOAD, /* a = film, b = exposure choice */
-+ FA_REWIND, /* end the roll in the camera */
-+ FA_REAPPLY, /* film settings again (after changing WB by hand) */
-+ FA_CANON_MENU, /* leave and open Canon's menu */
-+ FA_BUSY, /* a = 1: long work (developing) begins, keep the camera awake; 0: done */
-+};
-+
-+#define FOS_RECENT 5
-+struct fos_roll
-+{
-+ int loaded;
-+ int number;
-+ int film;
-+ int exposures;
-+ int shot;
-+ int need_wind;
-+ char loaded_at[20]; /* "2026-08-08 09:10" */
-+ int nrecent; /* newest first */
-+ struct { int no; char time[6]; char fstop[6]; } recent[FOS_RECENT];
-+};
-+
-+/* screens fos_ui_run can open on; BOOT_LV plays the boot animation and
-+ * goes straight back to the camera */
-+enum { FOS_OPEN_SHELF, FOS_OPEN_HOME, FOS_OPEN_BOOT, FOS_OPEN_BOOT_LV,
-+ FOS_OPEN_PRINTS, /* PLAY: the latest prints */
-+ FOS_OPEN_END, /* the roll has just been finished */
-+ FOS_OPEN_DARKROOM };
-+
-+/* ---------------------------------------------------------------- the port */
-+
-+int fos_port_ms();
-+void fos_port_sleep(int ms);
-+int fos_port_key(); /* next key event, FK_NONE if none */
-+int fos_port_abort(); /* leave right away (half-shutter, power off) */
-+void fos_port_present(const uint8_t *rows, int pitch, int y0, int y1); /* rows = row y0 */
-+void fos_port_palette(); /* load fos_pal[1..254] */
-+void *fos_port_alloc(int size); /* big, temporary buffers */
-+void fos_port_free(void *p);
-+/* files on the card, for developing; fos_port_open returns NULL on failure */
-+void *fos_port_open(const char *path, int write);
-+int fos_port_read(void *f, void *buf, int size); /* bytes read */
-+int fos_port_write(void *f, const void *buf, int size); /* bytes written */
-+int fos_port_seek(void *f, int offset); /* from the start; < 0 on failure */
-+void fos_port_close(void *f);
-+const char *fos_port_card(); /* the card's root, ending in '/' */
-+/* every entry of a directory, until fn returns 0; < 0 if it can't be read */
-+int fos_port_list(const char *dir, int (*fn)(void *ctx, const char *name, int is_dir), void *ctx);
-+int fos_port_mkdir(const char *path); /* 0 on success or if it exists */
-+
-+void fos_port_roll(struct fos_roll *r);
-+int fos_port_get(int setting);
-+void fos_port_set(int setting, int value);
-+void fos_port_action(int action, int a, int b);
-+void fos_port_clock(char *buf, int size); /* "14:32" */
-+int fos_port_lens_manual();
-+const char *fos_port_lens_name();
-+const char *fos_port_version();
-+const char *fos_port_model(); /* "Canon EOS M": the camera it runs on */
-+/* photographs: palette entries 1..n become pal's colours at k/256 of
-+ * their brightness, FOS_FIXED_BASE.. the fixed overlay colours (fos_dev.h);
-+ * fos_port_palette() goes back to the film OS's own */
-+void fos_port_photo(const uint8_t (*pal)[3], int n, int k);
-+void fos_port_log(const char *msg); /* the debug log, if it is on */
-+/* developing works in slices until a time budget is spent; the simulator's
-+ * clock stands still meanwhile, so it caps the slices instead (0: no cap) */
-+int fos_port_dev_cap();
-+
-+/* frame times, summed over about a second of animation; open_ms is how
-+ * long the film OS took to show its first frame (first report only) */
-+struct fos_stat { int frames, draw_ms, present_ms, rest_ms, worst_ms, open_ms, cans_ms; }; /* cans_ms: part of draw_ms */
-+void fos_port_stat(const struct fos_stat *s); /* keep it, don't log while animating */
-+
-+/* ---------------------------------------------------------------- the viewfinder HUD */
-+
-+/* what the HUD shows; fos_hud.c draws it with Canon's palette */
-+struct fos_hud
-+{
-+ int lit; /* LEDs on (half-press, or always) */
-+ int blink; /* 0/1, toggles a few times a second */
-+ int meter; /* the meter has a reading */
-+ int fstop, widest, want; /* indices into fos_fstops; want = what the meter asks for */
-+ char shutter[12]; /* "125", "2\"", "0.5\"" */
-+ int frame, exposures, finished, need_wind;
-+ int focus_screen;
-+ const char *film;
-+ int iso; /* the film's speed (the top plate shows it) */
-+};
-+
-+struct fos_hud_palette
-+{
-+ uint8_t clear, black, white, red, dark_red;
-+ uint8_t gray[101]; /* percent -> index */
-+};
-+
-+void fos_hud_draw(uint8_t *vram, int pitch, const struct fos_hud *h, const struct fos_hud_palette *p);
-+void fos_hud_clear(uint8_t *vram, int pitch, const struct fos_hud_palette *p);
-+/* the top plate: a DSLR's back screen while you shoot through the viewfinder */
-+void fos_hud_plate(uint8_t *vram, int pitch, const struct fos_hud *h, const struct fos_hud_palette *p);
-+void fos_hud_plate_clear(uint8_t *vram, int pitch, const struct fos_hud_palette *p);
-+
-+/* ---------------------------------------------------------------- the UI */
-+
-+void fos_ui_init();
-+void fos_ui_run(int screen);
-+void fos_ui_overdrawn(); /* the port saw something else draw on the screen: paint it all again */
-+
-+/* canister art, fos_film.c; quality 2 = everything, 1 = no texture
-+ * filtering, 0 = no reflections either (the UI lowers it on a slow camera) */
-+extern int fos_can_quality;
-+struct fos_can;
-+struct fos_can *fos_can_new(int film, int exposures);
-+void fos_can_free(struct fos_can *c);
-+void fos_can_set_exposures(struct fos_can *c, int exposures);
-+
-+/* draw a canister standing on floor_y, centred on cx (1/256 px);
-+ * scale 256 = full size, rot = turn (0..65535, 0 = label to the front),
-+ * light 0..256 dims it for depth, leader 0 = none, 256 = the usual tongue,
-+ * more = pulled further out, reflect 0..256 = its mirror image in the floor,
-+ * fast = moving too quickly to need the label filtered between texels */
-+struct fos_can_pose { int cx8, floor_y, scale, rot, light, leader, reflect, fast; };
-+void fos_can_draw(struct fos_canvas *cv, struct fos_can *c, const struct fos_can_pose *p);
-+int fos_can_height(int scale);
-+int fos_can_width(int scale);
-+
-+#endif
-diff --git a/src/fos_dark.c b/src/fos_dark.c
-new file mode 100644
-index 000000000..8e447445e
---- /dev/null
-+++ b/src/fos_dark.c
-@@ -0,0 +1,1408 @@
-+/* fos_dark: the darkroom.
-+ *
-+ * Rolls that have been shot and rewound wait here to be developed. The
-+ * camera develops them itself (fos_dev.c), a slice at a time between the
-+ * frames of a darkroom scene under the red safelight: the latent image
-+ * comes up on the paper in the tray, the print darkens to its full depth,
-+ * and goes up on the line to dry. The prints are looked at here as well,
-+ * each on its own palette, and PLAY comes here too: nothing undeveloped is
-+ * ever shown.
-+ */
-+
-+#include "fos_ui.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+
-+#define MAX_ROLLS 48
-+
-+/* The darkroom's lists live in memory taken while the film OS is up, not
-+ * in autoexec.bin: on the EOS M every byte of that is taken from Canon's
-+ * own memory at boot. */
-+static struct dark_mem
-+{
-+ struct fos_lab_roll rolls[MAX_ROLLS];
-+ uint8_t marked[MAX_ROLLS];
-+ int queue[MAX_ROLLS];
-+ struct fos_lab_frame frames[FOS_MAX_FRAMES], meta[FOS_MAX_FRAMES];
-+ char paths[FOS_MAX_FRAMES][64];
-+ struct fos_print print;
-+} *dm;
-+#define rolls (dm->rolls)
-+#define marked (dm->marked)
-+#define queue (dm->queue)
-+#define pv_meta (dm->meta)
-+#define pv_print (dm->print)
-+
-+static int nrolls;
-+
-+static int dark_mem()
-+{
-+ if (!dm && (dm = fos_port_alloc(sizeof(*dm)))) memset(dm, 0, sizeof(*dm));
-+ return dm != 0;
-+}
-+
-+void dark_free()
-+{
-+ fos_port_free(dm);
-+ dm = 0;
-+}
-+
-+static void rescan()
-+{
-+ nrolls = dm ? fos_lab_scan(rolls, MAX_ROLLS) : 0;
-+}
-+
-+static int roll_index(int number)
-+{
-+ for (int i = 0; i < nrolls; i++)
-+ if (rolls[i].number == number) return i;
-+ return -1;
-+}
-+
-+/* developed: every frame has its print and the contact sheet is there;
-+ * waiting: shot, out of the camera, and a print or the sheet missing
-+ * (developing again skips the prints already made) */
-+/* developed: every frame printed, and every print in DCIM as a JPEG */
-+static int is_developed(const struct fos_lab_roll *r) { return r->sheet && r->developed >= r->shot && r->jpegs >= r->developed; }
-+/* Basic mode: a finished roll still in the camera waits too; developing it finishes it (fos_port_action) */
-+static int finished_in_camera(const struct fos_lab_roll *r) { return r->in_camera && !ui_realistic() && r->shot >= r->exposures; }
-+static int is_waiting(const struct fos_lab_roll *r)
-+{
-+ return !is_developed(r) && (!r->in_camera || finished_in_camera(r)) && r->shot > 0;
-+}
-+static int has_prints(const struct fos_lab_roll *r) { return r->sheet || r->developed > 0; }
-+
-+/* about how long a frame takes, measured while developing */
-+static int ms_per_frame = 15000;
-+
-+static void format_eta(char *buf, int size, int frames, int extra_ms)
-+{
-+ int s = (int) (((int64_t) frames * ms_per_frame + extra_ms) / 1000);
-+ if (s < 60) snprintf(buf, size, "under a minute");
-+ else if (s < 90 * 60) snprintf(buf, size, "about %d min", (s + 30) / 60);
-+ else snprintf(buf, size, "about %d h %02d min", s / 3600, (s % 3600 + 30) / 60);
-+}
-+
-+static const char *short_date(const char *when)
-+{
-+ /* "2026-10-22 17:45" -> "22 Oct 2026" */
-+ static const char *const mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-+ static char b[16];
-+ int m = (when[5] - '0') * 10 + (when[6] - '0');
-+ if (strlen(when) < 10 || m < 1 || m > 12) return "";
-+ char year[5];
-+ snprintf(b, sizeof(b), "%c%c %s %s", when[8] == '0' ? ' ' : when[8], when[9], mon[m - 1], fos_copy(year, sizeof(year), when, 4));
-+ return b[0] == ' ' ? b + 1 : b;
-+}
-+
-+/* ================================================================ the list */
-+
-+static int dk_sel;
-+static struct spring dk_hl, dk_scroll;
-+static int dk_hints_for = -1; /* the hints show what SET does on this row */
-+
-+#define DK_X 24
-+#define DK_W 672
-+#define DK_Y 124
-+#define DK_ROW 60
-+#define DK_ROWS 5
-+
-+static int count_waiting(int *frames)
-+{
-+ int n = 0, f = 0;
-+ for (int i = 0; i < nrolls; i++)
-+ if (is_waiting(&rolls[i])) { n++; f += rolls[i].shot - (rolls[i].jpegs < rolls[i].developed ? rolls[i].jpegs : rolls[i].developed); }
-+ if (frames) *frames = f;
-+ return n;
-+}
-+
-+static int count_marked()
-+{
-+ int n = 0;
-+ for (int i = 0; i < nrolls; i++) n += marked[i] && is_waiting(&rolls[i]);
-+ return n;
-+}
-+
-+static void dark_bake()
-+{
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("DARKROOM");
-+ fos_text(cv, &fos_font_lg, DK_X, 82, "Darkroom", C_TEXT, OPAQUE, 0);
-+ char b[96], eta[32];
-+ int frames, waiting = count_waiting(&frames);
-+ if (!nrolls)
-+ snprintf(b, sizeof(b), ui_realistic() ? "No rolls yet " T_MDASH " finish one, rewind it, and it waits here."
-+ : "No rolls yet " T_MDASH " finish one, and it waits here.");
-+ else if (waiting)
-+ {
-+ format_eta(eta, sizeof(eta), frames, 0);
-+ snprintf(b, sizeof(b), "%d roll%s to develop " T_DOT " %d frames " T_DOT " %s", waiting, waiting > 1 ? "s" : "", frames, eta);
-+ }
-+ else
-+ snprintf(b, sizeof(b), "Everything is developed " T_DOT " %d roll%s of prints", nrolls, nrolls > 1 ? "s" : "");
-+ int w = fos_text(cv, &fos_font_sm, DK_X, 106, b, C_TEXT3, OPAQUE, 0);
-+ /* the camera takes its time; a computer doesn't */
-+ if (waiting && w + 260 < DK_W)
-+ fos_text_r(cv, &fos_font_sm, DK_X + DK_W, 106, "Faster: Darkrooms on a computer", C_ACCENT2, OPAQUE, 0);
-+ ui_to_bg(0);
-+}
-+
-+static void dark_hints()
-+{
-+ const struct fos_lab_roll *r = nrolls ? &rolls[dk_sel] : 0;
-+ int nm = count_marked();
-+ char dev[32];
-+ if (nm) snprintf(dev, sizeof(dev), "Develop %d", nm);
-+ else snprintf(dev, sizeof(dev), "Develop all");
-+ struct hint h[4];
-+ int n = 0;
-+ if (r && is_waiting(r)) h[n++] = (struct hint) { "SET", marked[dk_sel] ? "Unmark" : "Mark" };
-+ else if (r && has_prints(r)) h[n++] = (struct hint) { "SET", "Prints" };
-+ if (count_waiting(0)) h[n++] = (struct hint) { "INFO", dev };
-+ h[n++] = (struct hint) { "PLAY", "Prints" };
-+ h[n++] = (struct hint) { "MENU", "Back" };
-+ ui_bg_restore(0, HINTS_Y, FOS_W, FOS_H - HINTS_Y);
-+ ui_hints(h, n);
-+ dk_hints_for = dk_sel * 2 + marked[dk_sel];
-+}
-+
-+void dark_enter(int arg)
-+{
-+ fos_port_roll(&ui_roll);
-+ dark_mem();
-+ rescan();
-+ if (dm) memset(marked, 0, sizeof(marked));
-+ int i = arg ? roll_index(arg) : -1;
-+ if (i < 0)
-+ {
-+ /* the newest roll waiting, else the newest */
-+ i = 0;
-+ for (int k = 0; k < nrolls; k++)
-+ if (is_waiting(&rolls[k])) { i = k; break; }
-+ }
-+ dk_sel = i;
-+ dk_hl.x = (float) dk_sel; dk_hl.v = 0;
-+ dk_scroll.x = (float) fos_clamp(dk_sel - DK_ROWS / 2, 0, nrolls > DK_ROWS ? nrolls - DK_ROWS : 0);
-+ dk_scroll.v = 0;
-+ dk_hints_for = -1;
-+ dark_bake();
-+}
-+
-+void dark_queue_clear();
-+void dark_queue_add(int roll);
-+
-+static void dark_develop()
-+{
-+ /* the marked rolls, or every one waiting; oldest first */
-+ int nm = count_marked();
-+ dark_queue_clear();
-+ for (int i = nrolls - 1; i >= 0; i--)
-+ if (is_waiting(&rolls[i]) && (!nm || marked[i]))
-+ {
-+ if (finished_in_camera(&rolls[i])) fos_port_action(FA_REWIND, 0, 0); /* out of the camera first */
-+ dark_queue_add(rolls[i].number);
-+ }
-+ ui_go(SCR_DEVELOP, 0, GO_FADE);
-+}
-+
-+void dark_key(int k)
-+{
-+ if (!dm)
-+ {
-+ if (k == FK_MENU) ui_go(SCR_HOME, 2, GO_POP);
-+ return;
-+ }
-+ const struct fos_lab_roll *r = nrolls ? &rolls[dk_sel] : 0;
-+ switch (k)
-+ {
-+ case FK_UP: case FK_WHEEL_L:
-+ if (dk_sel > 0) dk_sel--;
-+ break;
-+ case FK_DOWN: case FK_WHEEL_R:
-+ if (dk_sel < nrolls - 1) dk_sel++;
-+ break;
-+ case FK_SET: case FK_RIGHT:
-+ if (!r) break;
-+ if (r->in_camera && !finished_in_camera(r))
-+ ui_toast(ui_realistic() ? "Still in the camera " T_MDASH " rewind it first"
-+ : "Still in the camera " T_MDASH " finish it on the Roll page first");
-+ else if (is_waiting(r) && k == FK_SET) marked[dk_sel] ^= 1;
-+ else if (has_prints(r)) ui_go(SCR_PRINTS, r->number, GO_FADE);
-+ break;
-+ case FK_INFO:
-+ if (count_waiting(0)) dark_develop();
-+ else ui_toast(nrolls ? "Nothing to develop" : "No rolls yet");
-+ break;
-+ case FK_PLAY:
-+ ui_go(SCR_PRINTS, r && has_prints(r) ? r->number : 0, GO_FADE);
-+ break;
-+ case FK_MENU:
-+ ui_go(SCR_HOME, 2, GO_POP);
-+ break;
-+ case FK_HOME:
-+ ui_leave();
-+ break;
-+ }
-+ ui_damage(DK_Y - 4, FOS_H);
-+}
-+
-+int dark_update(int dt)
-+{
-+ int moving = 0;
-+ float top = (float) fos_clamp(dk_sel - DK_ROWS / 2, 0, nrolls > DK_ROWS ? nrolls - DK_ROWS : 0);
-+ moving |= spring_step(&dk_hl, (float) dk_sel, dt, 3.4f, 0.82f);
-+ moving |= spring_step(&dk_scroll, top, dt, 2.6f, 0.9f);
-+ if (moving) ui_damage(DK_Y - 4, DK_Y + DK_ROWS * DK_ROW + 4);
-+ return moving;
-+}
-+
-+/* a round mark: empty, or filled with a tick */
-+static void mark_dot(int cx, int cy, int on)
-+{
-+ if (on)
-+ {
-+ fos_disc(cv, cx * 256, cy * 256, 10 * 256, C_ACCENT, OPAQUE);
-+ fos_line(cv, (cx - 5) * 256, cy * 256, (cx - 1) * 256, (cy + 4) * 256, 2 * 256, FC(RAMP_GRAY, 12), OPAQUE);
-+ fos_line(cv, (cx - 1) * 256, (cy + 4) * 256, (cx + 6) * 256, (cy - 4) * 256, 2 * 256, FC(RAMP_GRAY, 12), OPAQUE);
-+ }
-+ else fos_ring(cv, cx * 256, cy * 256, 10 * 256, 2 * 256, FC(RAMP_GRAY, 90), OPAQUE);
-+}
-+
-+static void dark_row(int i, int y)
-+{
-+ const struct fos_lab_roll *r = &rolls[i];
-+ int sel = i == dk_sel;
-+ int x = DK_X + 20;
-+ if (is_waiting(r)) mark_dot(x + 12, y + DK_ROW / 2, marked[i]);
-+ else ui_icon(r->in_camera ? ICON_FILM : ICON_PRINTS, x + 12, y + DK_ROW / 2, sel ? C_TEXT2 : C_TEXT3, OPAQUE);
-+ char b[96];
-+ fos_text(cv, &fos_font_mdb, x + 42, y + 27, fos_films[r->film].name, sel ? C_TEXT : C_TEXT2, OPAQUE, 0);
-+ const char *when = r->last[0] ? r->last : r->loaded;
-+ snprintf(b, sizeof(b), "Roll %03d " T_DOT " %d frame%s " T_DOT " %s", r->number, r->shot, r->shot == 1 ? "" : "s", short_date(when));
-+ fos_text(cv, &fos_font_sm, x + 42, y + 48, b, C_TEXT3, OPAQUE, 0);
-+ fcol c;
-+ if (r->in_camera && !finished_in_camera(r)) { snprintf(b, sizeof(b), "IN CAMERA"); c = C_TEXT3; }
-+ else if (is_developed(r)) { snprintf(b, sizeof(b), "DEVELOPED"); c = C_TEXT3; }
-+ else if (r->developed) { snprintf(b, sizeof(b), "%d OF %d DEVELOPED", r->developed, r->shot); c = C_ACCENT; }
-+ else { snprintf(b, sizeof(b), "TO DEVELOP"); c = C_ACCENT; }
-+ fos_text_r(cv, &fos_font_xs, DK_X + DK_W - 24, y + 36, b, c, OPAQUE, 48);
-+}
-+
-+void dark_draw()
-+{
-+ if (ui_clobbered)
-+ {
-+ ui_clobbered = 0;
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ ui_damage_all();
-+ dk_hints_for = -1;
-+ }
-+ if (!dm)
-+ {
-+ fos_text_c(cv, &fos_font_md, 360, DK_Y + 120, "Not enough memory for the darkroom.", C_TEXT3, OPAQUE, 0);
-+ return;
-+ }
-+ if (dk_hints_for != dk_sel * 2 + marked[dk_sel]) dark_hints();
-+
-+ int y0 = DK_Y - 4, y1 = DK_Y + DK_ROWS * DK_ROW + 4;
-+ struct fos_canvas save = *cv;
-+ ui_bg_restore(0, y0, FOS_W, y1 - y0);
-+ fos_clip(cv, 0, DK_Y, FOS_W, DK_Y + DK_ROWS * DK_ROW);
-+ if (!nrolls)
-+ {
-+ fos_text_c(cv, &fos_font_md, 360, DK_Y + 120, ui_realistic() ? "Shot rolls appear here once they are rewound." : "Shot rolls appear here once they are finished.", C_TEXT3, OPAQUE, 0);
-+ *cv = save;
-+ return;
-+ }
-+ float top = dk_scroll.x;
-+ int hy = DK_Y + (int) ((dk_hl.x - top) * DK_ROW + 0.5f);
-+ fos_rrect(cv, DK_X, hy, DK_W, DK_ROW, 12, FC(RAMP_GRAY, 27), OPAQUE);
-+ fos_rrect(cv, DK_X, hy + 10, 3, DK_ROW - 20, 1, C_ACCENT, OPAQUE);
-+ for (int i = (int) top; i < nrolls && i <= (int) top + DK_ROWS; i++)
-+ dark_row(i, DK_Y + (int) ((i - top) * DK_ROW + 0.5f));
-+ *cv = save;
-+ /* the list goes on: a hint at the edge */
-+ if (top > 0.05f) fos_tri(cv, DK_X + DK_W - 14, DK_Y - 8, 8, 3, C_TEXT3, OPAQUE);
-+ if (top < nrolls - DK_ROWS - 0.05f) fos_tri(cv, DK_X + DK_W - 14, DK_Y + DK_ROWS * DK_ROW + 6, 8, 1, C_TEXT3, OPAQUE);
-+ ui_damage(y0, y1 + 8);
-+}
-+
-+/* ================================================================ developing */
-+
-+/* the scene, under the safelight */
-+#define SL(level) FC(RAMP_RED, level)
-+#define SL_TEXT SL(222)
-+#define SL_TEXT2 SL(160)
-+#define SL_TEXT3 SL(104)
-+#define SL_ACCENT FC(RAMP_ORANGE, 200)
-+
-+/* the tray, the paper in it and the picture on the paper */
-+#define TRAY_X 24
-+#define TRAY_Y 128
-+#define TRAY_W 400
-+#define TRAY_H 284
-+#define BATH_X (TRAY_X + 12)
-+#define BATH_Y (TRAY_Y + 12)
-+#define BATH_W (TRAY_W - 24)
-+#define BATH_H (TRAY_H - 24)
-+#define PAPER_W 348
-+#define PAPER_H 240
-+#define PAPER_X (TRAY_X + (TRAY_W - PAPER_W) / 2)
-+#define PAPER_Y (TRAY_Y + (TRAY_H - PAPER_H) / 2)
-+#define IMG_W 324
-+#define IMG_H 216
-+#define IMG_X (PAPER_X + (PAPER_W - IMG_W) / 2)
-+#define IMG_Y (PAPER_Y + (PAPER_H - IMG_H) / 2)
-+#define GHOST_W (IMG_W / 2)
-+#define GHOST_H (IMG_H / 2)
-+#define PAPER_LV 124 /* white paper under the safelight */
-+#define BLACK_LV 9
-+
-+/* the line the prints dry on */
-+#define LINE_Y 52
-+#define DRY_W 66
-+#define DRY_H 44
-+#define DRY_STEP 92
-+#define DRY_X0 36
-+#define DRY_N 7
-+
-+/* the panel and its timer */
-+#define PANEL_CX 572
-+#define DIAL_CY2 282
-+#define DIAL_R2 58
-+
-+#define EMERGE_MS 1700
-+#define HOLD_MS 900
-+#define LIFT_MS 450
-+#define SLIDE_MS 450
-+#define STEP_MS 60 /* developing per frame while the scene moves */
-+#define CALM_MS 250 /* and while it is still: the dial's hand ticks */
-+
-+static int nqueue, qi;
-+static char dcim_dir[128]; /* the roll's JPEG folder, or "" */
-+static int nframes, fi, roll_ready;
-+static int cur_roll, cur_film, cur_frame;
-+static struct fos_dev *dev;
-+static int frame_t0;
-+static int total_frames, done_frames, failed_frames, rolls_done;
-+static int jpeg_frames; /* of the failed ones, shot as JPEG */
-+static int finished, asking_stop;
-+static struct spring stop_sheet;
-+static int dv_t;
-+
-+/* the tray: what the paper shows */
-+enum { TRAY_LATENT, TRAY_EMERGE, TRAY_HOLD, TRAY_LIFT, TRAY_IN, TRAY_EMPTY };
-+static int tray, tray_t;
-+static uint8_t *ghost; /* GHOST_W x GHOST_H: the latent image */
-+static uint8_t *img; /* IMG_W x IMG_H: the finished print */
-+static int ghost_t; /* ms since the latent image was read */
-+static int ghost_final; /* read once more when the RAW is through */
-+static int pending_frame; /* a print waiting for the tray, 0 = none */
-+static char pending_path[64];
-+/* the next one, finished while the tray still held the last: on a fast
-+ * camera (50D, #43) it was skipped, and the tray showed the frame after it
-+ * half developed instead */
-+static int queued_frame;
-+static char queued_path[64];
-+static int tray_dirty = 1, line_dirty = 1, panel_dirty = 1;
-+static int last_doing = -1;
-+static char last_error[72]; /* why the last frame that failed did */
-+
-+/* the line: newest first */
-+static uint8_t *dry; /* DRY_N x DRY_W x DRY_H */
-+static int ndry, dry_t = 100000; /* dry_t: ms since the newest went up */
-+
-+void dark_queue_clear() { nqueue = 0; }
-+void dark_queue_add(int roll) { if (dark_mem() && nqueue < MAX_ROLLS) queue[nqueue++] = roll; }
-+
-+static int file_exists(const char *path)
-+{
-+ void *f = fos_port_open(path, 0);
-+ if (f) fos_port_close(f);
-+ return f != 0;
-+}
-+
-+/* the print's picture, small and grey, for the tray */
-+static void load_tray_image(const char *path)
-+{
-+ struct fos_print p;
-+ memset(img, 255, IMG_W * IMG_H);
-+ if (!fos_print_load(path, &p)) return;
-+ uint8_t lum[FOS_PRINT_COLOURS + 1];
-+ lum[0] = 0;
-+ for (int i = 0; i < FOS_PRINT_COLOURS; i++)
-+ lum[i + 1] = (uint8_t) ((p.pal[i][0] * 77 + p.pal[i][1] * 150 + p.pal[i][2] * 29) >> 8);
-+ for (int y = 0; y < IMG_H; y++)
-+ {
-+ int sy = (2 * y + 1) * FOS_PRINT_H / (2 * IMG_H);
-+ for (int x = 0; x < IMG_W; x++)
-+ {
-+ int sx = (2 * x + 1) * FOS_PRINT_W / (2 * IMG_W);
-+ /* the borders of a portrait frame stay white paper */
-+ if (sx < p.x0 || sx >= p.x0 + p.w) continue;
-+ const uint8_t *s = p.px + sy * FOS_PRINT_W + sx;
-+ int k0 = s[0], k1 = s[1], k2 = s[FOS_PRINT_W], k3 = s[FOS_PRINT_W + 1];
-+ img[y * IMG_W + x] = (uint8_t) ((lum[k0 > 240 ? 0 : k0] + lum[k1 > 240 ? 0 : k1] + lum[k2 > 240 ? 0 : k2]
-+ + lum[k3 > 240 ? 0 : k3]) >> 2);
-+ }
-+ }
-+ fos_print_free(&p);
-+}
-+
-+/* a finished frame's thumbnail onto the line; a portrait frame's sides
-+ * are white paper */
-+static void hang(const uint8_t *thumb, int x0, int w)
-+{
-+ if (!dry || !thumb) return;
-+ memmove(dry + DRY_W * DRY_H, dry, (DRY_N - 1) * DRY_W * DRY_H);
-+ for (int y = 0; y < DRY_H; y++)
-+ for (int x = 0; x < DRY_W; x++)
-+ {
-+ int px = (2 * x + 1) * FOS_PRINT_W / (2 * DRY_W);
-+ const uint8_t *s = thumb + 3 * ((y * FOS_THUMB_H / DRY_H) * FOS_THUMB_W + x * FOS_THUMB_W / DRY_W);
-+ dry[y * DRY_W + x] = px < x0 || px >= x0 + w ? 255 : (uint8_t) ((s[0] * 77 + s[1] * 150 + s[2] * 29) >> 8);
-+ }
-+ if (ndry < DRY_N) ndry++;
-+ dry_t = 0;
-+ line_dirty = 1;
-+}
-+
-+/* the next frame to develop, or the next roll's; the contact sheet when a
-+ * roll is through */
-+static void next_job()
-+{
-+ char path[64];
-+ while (qi < nqueue)
-+ {
-+ if (!roll_ready)
-+ {
-+ cur_roll = queue[qi];
-+ int ri = roll_index(cur_roll);
-+ cur_film = ri >= 0 ? rolls[ri].film : 0;
-+ nframes = fos_lab_frames(cur_roll, dm->frames, FOS_MAX_FRAMES);
-+ {
-+ char msg[96];
-+ int raws = 0;
-+ for (int i = 0; i < nframes; i++) raws += !dm->frames[i].missing;
-+ snprintf(msg, sizeof(msg), "darkroom: roll %03d (%s): %d frames, %d RAW files", cur_roll,
-+ fos_films[cur_film].key, nframes, raws);
-+ fos_port_log(msg);
-+ }
-+ fos_lab_prepare(cur_roll);
-+ /* the roll's JPEGs go in DCIM, in a folder named for the day
-+ * its first frame was shot and the film */
-+ const char *first = 0;
-+ for (int i = 0; i < nframes; i++)
-+ if (dm->frames[i].when[0] && (!first || strcmp(dm->frames[i].when, first) < 0)) first = dm->frames[i].when;
-+ if (fos_lab_dcim_dir(dcim_dir, sizeof(dcim_dir), cur_roll, cur_film, first) < 0)
-+ {
-+ dcim_dir[0] = 0;
-+ fos_port_log("darkroom: no folder for the JPEGs in DCIM");
-+ }
-+ else
-+ {
-+ char msg[160];
-+ snprintf(msg, sizeof(msg), "darkroom: JPEGs in %s", dcim_dir);
-+ fos_port_log(msg);
-+ }
-+ fi = 0;
-+ roll_ready = 1;
-+ panel_dirty = 1;
-+ }
-+ while (fi < nframes)
-+ {
-+ const struct fos_lab_frame *f = &dm->frames[fi++];
-+ fos_lab_print_path(path, sizeof(path), cur_roll, f->no);
-+ /* its JPEG in DCIM: IMG_0102.CR2 -> IMG_0102.JPG */
-+ char jpeg[160] = "";
-+ if (dcim_dir[0])
-+ {
-+ const char *base = strrchr(f->cr2, '/');
-+ char name[9];
-+ snprintf(jpeg, sizeof(jpeg), "%s/%s.JPG", dcim_dir, fos_copy(name, sizeof(name), base ? base + 1 : f->cr2, 8));
-+ }
-+ /* developed before (and, by this version, written to DCIM too) */
-+ if (file_exists(path) && (!jpeg[0] || f->missing || file_exists(jpeg))) continue;
-+ if (f->missing)
-+ {
-+ char msg[120];
-+ const char *base = strrchr(f->cr2, '/');
-+ base = base ? base + 1 : f->cr2;
-+ snprintf(msg, sizeof(msg), "darkroom: roll %03d frame %d: %s %s", cur_roll, f->no,
-+ f->jpeg ? "shot as JPEG, no RAW:" : "no RAW file", f->cr2);
-+ fos_port_log(msg);
-+ /* the panel shows it on two lines, split at the dash */
-+ if (f->jpeg)
-+ {
-+ jpeg_frames++;
-+ if (jpeg_frames == 1)
-+ snprintf(last_error, sizeof(last_error), "%.8s was shot as JPEG " T_MDASH " set Image quality to RAW", base);
-+ else
-+ snprintf(last_error, sizeof(last_error), "%d frames were shot as JPEG " T_MDASH " set Image quality to RAW",
-+ jpeg_frames);
-+ }
-+ else if (!jpeg_frames)
-+ {
-+ if (f->cr2[0])
-+ snprintf(last_error, sizeof(last_error), "%s isn't on the card " T_MDASH " was it deleted?", base);
-+ else
-+ snprintf(last_error, sizeof(last_error), "No RAW file " T_MDASH " shoot with Image quality RAW");
-+ }
-+ failed_frames++;
-+ done_frames++;
-+ continue;
-+ }
-+ cur_frame = f->no;
-+ dev = fos_dev_start(f->cr2, path, cur_film, f->no, f->when, f->fstop);
-+ if (dev && jpeg[0]) fos_dev_jpeg(dev, jpeg);
-+ frame_t0 = ui_now;
-+ ghost_t = 100000;
-+ ghost_final = 0;
-+ memset(ghost, 255, GHOST_W * GHOST_H); /* fresh paper */
-+ panel_dirty = 1;
-+ if (dev) return;
-+ snprintf(last_error, sizeof(last_error), "Not enough memory");
-+ failed_frames++;
-+ done_frames++;
-+ }
-+ /* the roll is through: its contact sheet */
-+ const char *pp[FOS_MAX_FRAMES];
-+ for (int i = 0; i < nframes; i++)
-+ {
-+ fos_lab_print_path(dm->paths[i], sizeof(dm->paths[i]), cur_roll, i + 1);
-+ pp[i] = dm->paths[i];
-+ }
-+ fos_lab_print_path(path, sizeof(path), cur_roll, 0);
-+ if (!fos_dev_sheet(path, cur_film, pp, nframes)) fos_port_log("darkroom: can't write the contact sheet");
-+ rolls_done++;
-+ qi++;
-+ roll_ready = 0;
-+ }
-+ finished = 1;
-+ cur_frame = 0;
-+ panel_dirty = 1;
-+ fos_dev_release();
-+ fos_port_action(FA_BUSY, 0, 0);
-+}
-+
-+static void frame_finished(int ok)
-+{
-+ char msg[160];
-+ int took = ui_now - frame_t0;
-+ if (ok)
-+ {
-+ /* a running mean, the first frames counting fully */
-+ ms_per_frame = done_frames - failed_frames < 3 ? took : (ms_per_frame * 3 + took) / 4;
-+ snprintf(msg, sizeof(msg), "darkroom: roll %03d frame %d developed in %d ms", cur_roll, cur_frame, took);
-+ fos_port_log(msg);
-+ if (!pending_frame)
-+ {
-+ pending_frame = cur_frame;
-+ fos_lab_print_path(pending_path, sizeof(pending_path), cur_roll, cur_frame);
-+ }
-+ else
-+ {
-+ queued_frame = cur_frame;
-+ fos_lab_print_path(queued_path, sizeof(queued_path), cur_roll, cur_frame);
-+ }
-+ int x0, w;
-+ fos_dev_picture(dev, &x0, &w);
-+ hang(fos_dev_thumb(dev), x0, w);
-+ }
-+ else
-+ {
-+ const char *why = fos_dev_error(dev) && fos_dev_error(dev)[0] ? fos_dev_error(dev) : "stopped without a reason";
-+ snprintf(msg, sizeof(msg), "darkroom: roll %03d frame %d: %s", cur_roll, cur_frame, why);
-+ fos_port_log(msg);
-+ snprintf(last_error, sizeof(last_error), "Frame %d: %s", cur_frame, why);
-+ failed_frames++;
-+ }
-+ done_frames++;
-+ fos_dev_free(dev);
-+ dev = 0;
-+ panel_dirty = 1;
-+}
-+
-+static void develop_bake()
-+{
-+ ui_to_bg(1);
-+ /* the room: dark, the safelight from above */
-+ fos_vgrad(cv, 0, 0, FOS_W, FOS_H, RAMP_RED, LV12(30), LV12(7));
-+ fos_text(cv, &fos_font_xs, 24, 26, "DARKROOM", SL_TEXT2, OPAQUE, 64);
-+ /* the line */
-+ fos_fill(cv, 12, LINE_Y, FOS_W - 24, 2, SL(70));
-+ /* the tray and the developer in it */
-+ fos_rrect(cv, TRAY_X, TRAY_Y, TRAY_W, TRAY_H, 16, SL(26), OPAQUE);
-+ fos_rrect_line(cv, TRAY_X, TRAY_Y, TRAY_W, TRAY_H, 16, 2, SL(48), OPAQUE);
-+ fos_rrect(cv, BATH_X, BATH_Y, BATH_W, BATH_H, 10, SL(15), OPAQUE);
-+ ui_to_bg(0);
-+}
-+
-+void develop_enter(int arg)
-+{
-+ if (!dark_mem()) nqueue = 0;
-+ rescan();
-+ total_frames = done_frames = failed_frames = rolls_done = 0;
-+ jpeg_frames = 0;
-+ for (int i = 0; i < nqueue; i++)
-+ {
-+ int ri = roll_index(queue[i]);
-+ if (ri >= 0) total_frames += rolls[ri].shot - rolls[ri].developed;
-+ }
-+ qi = 0; roll_ready = 0; dev = 0;
-+ last_error[0] = 0;
-+ finished = nqueue == 0;
-+ asking_stop = 0;
-+ stop_sheet.x = stop_sheet.v = 0;
-+ cur_frame = 0;
-+ dv_t = 0;
-+ tray = TRAY_LATENT; tray_t = 0;
-+ pending_frame = 0;
-+ queued_frame = 0;
-+ ndry = 0; dry_t = 100000;
-+ ghost = fos_port_alloc(GHOST_W * GHOST_H);
-+ img = fos_port_alloc(IMG_W * IMG_H);
-+ dry = fos_port_alloc(DRY_N * DRY_W * DRY_H);
-+ if (ghost) memset(ghost, 255, GHOST_W * GHOST_H);
-+ tray_dirty = line_dirty = panel_dirty = 1;
-+ last_doing = -1;
-+ char dir[64];
-+ fos_lab_cache_dir(dir, sizeof(dir));
-+ fos_dev_cache(dir);
-+ if (!finished) fos_port_action(FA_BUSY, 1, 0);
-+ develop_bake();
-+}
-+
-+void develop_leave()
-+{
-+ if (dev) { fos_dev_free(dev); dev = 0; }
-+ if (!finished) fos_port_action(FA_BUSY, 0, 0);
-+ finished = 1;
-+ fos_dev_release();
-+ fos_port_free(ghost); ghost = 0;
-+ fos_port_free(img); img = 0;
-+ fos_port_free(dry); dry = 0;
-+}
-+
-+void develop_key(int k)
-+{
-+ if (asking_stop)
-+ {
-+ if (k == FK_SET) { asking_stop = 0; ui_go(SCR_DARK, cur_roll, GO_FADE); }
-+ else if (k == FK_MENU) asking_stop = 0;
-+ ui_clobbered = 1;
-+ return;
-+ }
-+ switch (k)
-+ {
-+ case FK_MENU:
-+ if (finished) ui_go(SCR_DARK, cur_roll, GO_FADE);
-+ else asking_stop = 1;
-+ ui_clobbered = 1;
-+ break;
-+ case FK_SET: case FK_PLAY:
-+ if (finished) ui_go(SCR_PRINTS, nqueue ? queue[0] : 0, GO_FADE);
-+ break;
-+ case FK_HOME:
-+ ui_leave();
-+ break;
-+ }
-+}
-+
-+int develop_update(int dt)
-+{
-+ dv_t += dt;
-+ if (!ghost || !img || !dry || !dm)
-+ {
-+ /* no memory for the scene: say so and stop */
-+ if (!finished) { finished = 1; fos_port_action(FA_BUSY, 0, 0); ui_toast("Not enough memory to develop"); }
-+ return 0;
-+ }
-+ /* the work: only once the screen has settled, and not while asking */
-+ if (!finished && !asking_stop && ui_settled())
-+ {
-+ if (!dev) next_job();
-+ if (dev)
-+ {
-+ /* the work takes nearly all of a frame when nothing on the
-+ * screen moves but the dial's hand */
-+ int calm = (tray == TRAY_LATENT || tray == TRAY_EMPTY) && dry_t >= SLIDE_MS + 100
-+ && stop_sheet.x < 0.002f;
-+ int p = fos_dev_step(dev, calm ? CALM_MS : STEP_MS);
-+ if (p >= 0 && p < 1000 && !ghost_final && fos_dev_doing(dev) == FOS_DEV_FIXING)
-+ {
-+ /* the whole latent image, while it can still be read */
-+ ghost_final = 1;
-+ if (fos_dev_preview(dev, ghost, GHOST_W, GHOST_H) && (tray == TRAY_LATENT || tray == TRAY_IN)) tray_dirty = 1;
-+ }
-+ else if (p >= 0 && p < 1000 && ghost_t > 600 && fos_dev_preview(dev, ghost, GHOST_W, GHOST_H))
-+ {
-+ /* the latent image so far; the paper shows it when it is in the bath */
-+ ghost_t = 0;
-+ if (tray == TRAY_LATENT || tray == TRAY_IN) tray_dirty = 1;
-+ }
-+ if (p >= 1000) frame_finished(1);
-+ else if (p < 0) frame_finished(0);
-+ }
-+ }
-+
-+ /* the tray */
-+ tray_t += dt;
-+ ghost_t += dt;
-+ switch (tray)
-+ {
-+ case TRAY_LATENT:
-+ if (pending_frame)
-+ {
-+ load_tray_image(pending_path);
-+ tray = TRAY_EMERGE; tray_t = 0;
-+ tray_dirty = 1;
-+ }
-+ break;
-+ case TRAY_EMERGE:
-+ tray_dirty = 1;
-+ if (tray_t > EMERGE_MS) { tray = TRAY_HOLD; tray_t = 0; }
-+ break;
-+ case TRAY_HOLD:
-+ if (tray_t > HOLD_MS) { tray = TRAY_LIFT; tray_t = 0; }
-+ break;
-+ case TRAY_LIFT:
-+ tray_dirty = 1;
-+ if (tray_t > LIFT_MS)
-+ {
-+ pending_frame = queued_frame;
-+ if (queued_frame) memcpy(pending_path, queued_path, sizeof(pending_path));
-+ queued_frame = 0;
-+ tray = finished && !pending_frame ? TRAY_EMPTY : TRAY_IN;
-+ tray_t = 0;
-+ ghost_t = 100000;
-+ }
-+ break;
-+ case TRAY_IN:
-+ tray_dirty = 1;
-+ if (tray_t > SLIDE_MS) { tray = TRAY_LATENT; tray_t = 0; }
-+ break;
-+ case TRAY_EMPTY:
-+ break;
-+ }
-+ if (finished && tray == TRAY_LATENT && !pending_frame) { tray = TRAY_EMPTY; tray_dirty = 1; }
-+ if (dry_t < SLIDE_MS + 100) { dry_t += dt; line_dirty = 1; }
-+ else dry_t += dt;
-+ int moving = spring_step(&stop_sheet, asking_stop ? 1 : 0, dt, 3.0f, 0.95f);
-+ if (moving) ui_clobbered = 1;
-+ return 1; /* the timer's hand keeps going */
-+}
-+
-+/* grey levels (paper 255 .. black 0) at density k/256 of their own, as
-+ * dithered positions on the red ramp */
-+static void density_table(int16_t *pos, int k)
-+{
-+ for (int l = 0; l < 256; l++)
-+ {
-+ int d = (255 - l) * k >> 8; /* density 0..255 */
-+ int lv = LV12(PAPER_LV) - (LV12(PAPER_LV) - LV12(BLACK_LV)) * d / 255;
-+ pos[l] = (int16_t) fos_ramp_pos(RAMP_RED, lv);
-+ }
-+}
-+
-+/* the paper and what is on it, its top edge dy below where it rests */
-+static void draw_paper(int dy)
-+{
-+ struct fos_canvas save = *cv;
-+ fos_clip(cv, BATH_X, BATH_Y, BATH_X + BATH_W, BATH_Y + BATH_H);
-+ ui_bg_restore(BATH_X, BATH_Y, BATH_W, BATH_H);
-+ int px = PAPER_X, py = PAPER_Y + dy;
-+ /* a soft shadow under it in the bath */
-+ fos_rrect(cv, px + 3, py + 4, PAPER_W, PAPER_H, 3, SL(10), 160);
-+ fos_fill(cv, px, py, PAPER_W, PAPER_H, SL(PAPER_LV));
-+ int16_t pos[256];
-+ const uint8_t *src = 0;
-+ int half = 0;
-+ if (tray == TRAY_LATENT || tray == TRAY_IN)
-+ {
-+ /* the latent image, faint */
-+ density_table(pos, 90);
-+ src = ghost;
-+ half = 1;
-+ }
-+ else
-+ {
-+ /* the darks first, then the rest, to the print's full depth */
-+ float t = tray == TRAY_EMERGE ? clampf((float) tray_t / EMERGE_MS, 0, 1) : 1;
-+ for (int l = 0; l < 256; l++)
-+ {
-+ float dfull = (255 - l) / 255.0f;
-+ float k = t >= 1 ? 1 : ease_out(clampf(t * (0.7f + dfull) * 1.3f, 0, 1));
-+ int d = (int) ((255 - l) * (0.35f + 0.65f * k));
-+ int lv = LV12(PAPER_LV) - (LV12(PAPER_LV) - LV12(BLACK_LV)) * d / 255;
-+ pos[l] = (int16_t) fos_ramp_pos(RAMP_RED, lv);
-+ }
-+ src = img;
-+ }
-+ int y0 = IMG_Y + dy;
-+ int ya = fos_clamp(y0, cv->cy0, cv->cy1), yb = fos_clamp(y0 + IMG_H, cv->cy0, cv->cy1);
-+ const int base = fos_ramp_base[RAMP_RED], last = fos_ramp_last[RAMP_RED];
-+ for (int y = ya; y < yb; y++)
-+ {
-+ int sy = y - y0;
-+ const uint8_t *s = half ? src + (sy >> 1) * GHOST_W : src + sy * IMG_W;
-+ uint8_t *o = &cv->px[y * cv->pitch + IMG_X];
-+ const uint8_t *bay = fos_bayer[y & 3];
-+ for (int x = 0; x < IMG_W; x++)
-+ {
-+ int p = (pos[s[half ? x >> 1 : x]] + bay[x & 3]) >> 4;
-+ o[x] = (uint8_t) (base + (p > last ? last : p));
-+ }
-+ }
-+ *cv = save;
-+ ui_damage(BATH_Y, BATH_Y + BATH_H);
-+}
-+
-+static void draw_tray()
-+{
-+ switch (tray)
-+ {
-+ case TRAY_LIFT:
-+ {
-+ /* lifted out of the bath: up and away */
-+ float t = clampf((float) tray_t / LIFT_MS, 0, 1);
-+ draw_paper(-(int) (t * t * (PAPER_H + 40)));
-+ break;
-+ }
-+ case TRAY_IN:
-+ {
-+ /* fresh paper slides in */
-+ float t = ease_out(clampf((float) tray_t / SLIDE_MS, 0, 1));
-+ draw_paper((int) ((1 - t) * (BATH_H + 10)));
-+ break;
-+ }
-+ case TRAY_EMPTY:
-+ ui_bg_restore(BATH_X, BATH_Y, BATH_W, BATH_H);
-+ ui_damage(BATH_Y, BATH_Y + BATH_H);
-+ break;
-+ default:
-+ draw_paper(0);
-+ }
-+}
-+
-+/* the prints drying, newest on the left; a new one drops in */
-+static void draw_line()
-+{
-+ int y0 = LINE_Y - 8, y1 = LINE_Y + DRY_H + 22;
-+ ui_bg_restore(0, y0, FOS_W, y1 - y0);
-+ int16_t pos[256];
-+ density_table(pos, 256);
-+ const int base = fos_ramp_base[RAMP_RED], last = fos_ramp_last[RAMP_RED];
-+ struct fos_canvas save = *cv;
-+ fos_clip(cv, 0, y0, FOS_W, y1);
-+ for (int i = 0; i < ndry; i++)
-+ {
-+ /* the older ones move along a place, then the new one comes */
-+ float shift = ease_out(clampf((float) dry_t / (SLIDE_MS / 2), 0, 1));
-+ float drop = ease_out(clampf((float) (dry_t - SLIDE_MS / 2) / (SLIDE_MS / 2), 0, 1));
-+ if (i == 0 && drop <= 0) continue;
-+ float slot = i == 0 ? 0 : i - (1 - shift);
-+ int x = DRY_X0 + (int) (slot * DRY_STEP);
-+ int y = LINE_Y + 8 - (i == 0 ? (int) ((1 - drop) * 70) : 0);
-+ if (x > FOS_W) continue;
-+ fos_fill(cv, x - 3, y - 3, DRY_W + 6, DRY_H + 6, SL(PAPER_LV));
-+ int ya = fos_clamp(y, cv->cy0, cv->cy1), yb = fos_clamp(y + DRY_H, cv->cy0, cv->cy1);
-+ const uint8_t *src = dry + i * DRY_W * DRY_H;
-+ for (int yy = ya; yy < yb; yy++)
-+ {
-+ const uint8_t *s = src + (yy - y) * DRY_W;
-+ uint8_t *o = &cv->px[yy * cv->pitch + x];
-+ const uint8_t *bay = fos_bayer[yy & 3];
-+ for (int k = 0; k < DRY_W && x + k < FOS_W; k++)
-+ {
-+ int p = (pos[s[k]] + bay[k & 3]) >> 4;
-+ o[k] = (uint8_t) (base + (p > last ? last : p));
-+ }
-+ }
-+ /* the peg */
-+ fos_rrect(cv, x + DRY_W / 2 - 4, y - 12, 8, 14, 2, FC(RAMP_METAL, 60), OPAQUE);
-+ }
-+ *cv = save;
-+ ui_damage(y0, y1);
-+}
-+
-+/* the darkroom timer: a frame a turn, the roll's frames round its face */
-+static void draw_dial(float frac)
-+{
-+ int cx = PANEL_CX, cy = DIAL_CY2, R = DIAL_R2;
-+ ui_bg_restore(cx - R - 6, cy - R - 6, 2 * R + 12, 2 * R + 12);
-+ fos_disc(cv, cx * 256, cy * 256, (R + 4) * 256, SL(20), OPAQUE);
-+ fos_ring(cv, cx * 256, cy * 256, (R + 4) * 256, 2 * 256, SL(56), OPAQUE);
-+ for (int i = 0; i < 60; i++)
-+ {
-+ int a = i * 65536 / 60 - 16384, r0 = i % 5 ? R - 6 : R - 11;
-+ fos_line(cv, cx * 256 + fos_cos(a) * r0 / 16, cy * 256 + fos_sin(a) * r0 / 16,
-+ cx * 256 + fos_cos(a) * (R - 1) / 16, cy * 256 + fos_sin(a) * (R - 1) / 16, i % 5 ? 200 : 360, SL(i % 5 ? 70 : 120), OPAQUE);
-+ }
-+ /* the roll's frames as dots: developed, this one, to come */
-+ int n = nframes > 0 ? nframes : 1;
-+ for (int i = 0; i < n && nframes; i++)
-+ {
-+ int a = i * 65536 / n - 16384, r = R - 22;
-+ int no = i + 1;
-+ fcol c = finished || no < cur_frame ? SL(190) : no == cur_frame ? SL_ACCENT : SL(64);
-+ fos_disc(cv, cx * 256 + fos_cos(a) * r / 16, cy * 256 + fos_sin(a) * r / 16, n > 24 ? 480 : 640, c, OPAQUE);
-+ }
-+ /* the hand */
-+ int a = (int) (frac * 65536) - 16384;
-+ fos_line(cv, cx * 256 - fos_cos(a) * 12 / 16, cy * 256 - fos_sin(a) * 12 / 16,
-+ cx * 256 + fos_cos(a) * (R - 8) / 16, cy * 256 + fos_sin(a) * (R - 8) / 16, 2 * 256, SL_ACCENT, OPAQUE);
-+ fos_disc(cv, cx * 256, cy * 256, 4 * 256, SL_ACCENT, OPAQUE);
-+ ui_damage(cy - R - 6, cy + R + 6);
-+}
-+
-+static const char *stage_name()
-+{
-+ switch (fos_dev_doing(dev))
-+ {
-+ case FOS_DEV_MIXING: return "Mixing the chemistry";
-+ case FOS_DEV_DEVELOPING: return "Exposing the paper";
-+ case FOS_DEV_FIXING: return "Developer";
-+ case FOS_DEV_DRYING: return "Fixer " T_DOT " wash";
-+ }
-+ return "";
-+}
-+
-+/* s centred at cx, on two lines if it is wider than w: split at its dash
-+ * (" - "), or else at the last space that fits */
-+static void text_lines_c(const struct fos_font *f, int cx, int y, int dy, int w, const char *s, fcol c)
-+{
-+ if (fos_text_w(f, s, 0) <= w)
-+ {
-+ fos_text_c(cv, f, cx, y, s, c, OPAQUE, 0);
-+ return;
-+ }
-+ char a[96], b[96];
-+ const char *dash = strstr(s, " " T_MDASH " ");
-+ int cut = -1, next = -1;
-+ if (dash)
-+ {
-+ cut = (int) (dash - s);
-+ next = cut + (int) strlen(" " T_MDASH " ");
-+ snprintf(a, sizeof(a), "%.*s", cut, s);
-+ if (fos_text_w(f, a, 0) > w) cut = -1;
-+ }
-+ if (cut < 0)
-+ for (int i = (int) strlen(s) - 1; i > 0; i--)
-+ {
-+ if (s[i] != ' ') continue;
-+ snprintf(a, sizeof(a), "%.*s", i, s);
-+ if (fos_text_w(f, a, 0) <= w) { cut = i; next = i + 1; break; }
-+ }
-+ if (cut < 0)
-+ {
-+ fos_text_c(cv, f, cx, y, s, c, OPAQUE, 0);
-+ return;
-+ }
-+ snprintf(a, sizeof(a), "%.*s", cut, s);
-+ snprintf(b, sizeof(b), "%s", s + next);
-+ if (b[0] >= 'a' && b[0] <= 'z') b[0] += 'A' - 'a'; /* a sentence of its own */
-+ fos_text_c(cv, f, cx, y, a, c, OPAQUE, 0);
-+ fos_text_c(cv, f, cx, y + dy, b, c, OPAQUE, 0);
-+}
-+
-+static void draw_panel()
-+{
-+ int x0 = 440, x1 = FOS_W - 12;
-+ char b[96], eta[32];
-+ ui_bg_restore(x0, 120, x1 - x0, 112);
-+ ui_bg_restore(x0, 346, x1 - x0, 72);
-+ if (finished)
-+ {
-+ fos_text_c(cv, &fos_font_xs, PANEL_CX, 150, "DONE", SL_ACCENT, OPAQUE, 64);
-+ snprintf(b, sizeof(b), "%d roll%s", rolls_done, rolls_done == 1 ? "" : "s");
-+ fos_text_c(cv, &fos_font_lg, PANEL_CX, 182, b, SL_TEXT, OPAQUE, 0);
-+ snprintf(b, sizeof(b), "%d print%s", done_frames - failed_frames, done_frames - failed_frames == 1 ? "" : "s");
-+ fos_text_c(cv, &fos_font_sm, PANEL_CX, 206, b, SL_TEXT2, OPAQUE, 0);
-+ if (failed_frames)
-+ {
-+ snprintf(b, sizeof(b), "%d frame%s could not be developed", failed_frames, failed_frames == 1 ? "" : "s");
-+ fos_text_c(cv, &fos_font_sm, PANEL_CX, 372, b, SL_TEXT2, OPAQUE, 0);
-+ text_lines_c(&fos_font_xs, PANEL_CX, 394, 16, FOS_W - 12 - 440, last_error, SL_TEXT3);
-+ }
-+ }
-+ else
-+ {
-+ snprintf(b, sizeof(b), "ROLL %03d", cur_roll);
-+ fos_text_c(cv, &fos_font_xs, PANEL_CX, 150, b, SL_ACCENT, OPAQUE, 64);
-+ fos_text_c(cv, &fos_font_lg, PANEL_CX, 182, fos_films[cur_film].name, SL_TEXT, OPAQUE, 0);
-+ if (cur_frame) snprintf(b, sizeof(b), "Frame %d of %d", cur_frame, nframes);
-+ else b[0] = 0;
-+ fos_text_c(cv, &fos_font_sm, PANEL_CX, 206, b, SL_TEXT2, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_md, PANEL_CX, 376, dev ? stage_name() : "", SL_TEXT, OPAQUE, 0);
-+ int left = total_frames - done_frames;
-+ int spent = dev ? ui_now - frame_t0 : 0;
-+ format_eta(eta, sizeof(eta), left, -(spent < ms_per_frame ? spent : ms_per_frame));
-+ snprintf(b, sizeof(b), "%d to go " T_DOT " %s", left, eta);
-+ fos_text_c(cv, &fos_font_sm, PANEL_CX, 400, b, SL_TEXT3, OPAQUE, 0);
-+ }
-+ ui_damage(120, 232);
-+ ui_damage(346, 418);
-+}
-+
-+static void develop_hints()
-+{
-+ ui_bg_restore(0, HINTS_Y, FOS_W, FOS_H - HINTS_Y);
-+ int base = HINTS_Y + 23, x = 24;
-+ if (finished)
-+ {
-+ x += ui_keycap(x, base, "SET") + 8;
-+ x += fos_text(cv, &fos_font_sm, x, base - 1, "See the prints", SL_TEXT2, OPAQUE, 0) + 22;
-+ x += ui_keycap(x, base, "MENU") + 8;
-+ fos_text(cv, &fos_font_sm, x, base - 1, "Darkroom", SL_TEXT2, OPAQUE, 0);
-+ }
-+ else
-+ {
-+ x += ui_keycap(x, base, "MENU") + 8;
-+ x += fos_text(cv, &fos_font_sm, x, base - 1, "Stop", SL_TEXT2, OPAQUE, 0) + 22;
-+ fos_text_r(cv, &fos_font_sm, FOS_W - 24, base - 1, "Keep the camera on " T_DOT " faster with Darkrooms on a computer", SL_TEXT3, OPAQUE, 0);
-+ }
-+ ui_damage(HINTS_Y, FOS_H);
-+}
-+
-+void develop_draw()
-+{
-+ static int was_finished = -1;
-+ if (ui_clobbered)
-+ {
-+ ui_clobbered = 0;
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ ui_damage_all();
-+ tray_dirty = line_dirty = panel_dirty = 1;
-+ was_finished = -1;
-+ }
-+ if (tray_dirty) { draw_tray(); tray_dirty = 0; }
-+ if (line_dirty) { draw_line(); line_dirty = 0; }
-+ if (panel_dirty) { draw_panel(); panel_dirty = 0; }
-+ if (was_finished != finished) { develop_hints(); was_finished = finished; }
-+ /* the panel's stage name follows the work */
-+ int doing = fos_dev_doing(dev);
-+ if (dev && doing != last_doing) { last_doing = doing; draw_panel(); }
-+ int p = dev ? fos_dev_progress(dev) : 0;
-+ draw_dial(p > 0 ? p / 1000.0f : 0);
-+ if (stop_sheet.x > 0.002f)
-+ ui_sheet(stop_sheet.x, "Stop developing?", "The prints made so far are kept; the rest wait in the darkroom.", "Stop", "Keep going");
-+}
-+
-+/* ================================================================ the prints */
-+
-+/* While a print is up the palette is the print's own: entries 1..240 its
-+ * colours, the overlay drawn with the fixed ones (PX_*). Changing what is
-+ * shown goes through black, so the screen never shows one picture in
-+ * another's colours. */
-+
-+enum { PV_WAIT, PV_IN, PV_SHOW, PV_OUT, PV_NONE };
-+enum { NEXT_LOAD, NEXT_BACK };
-+
-+static int pv_roll; /* index into rolls */
-+static int pv_alone;
-+static int pv_mode; /* 0 the contact sheet, 1 a frame */
-+static int pv_cur; /* the frame (1..), also the sheet's cursor */
-+static int pv_state, pv_t, pv_next;
-+static int pv_info, pv_info_t;
-+static int pv_frames; /* frames on the roll */
-+static int pv_have; /* pv_print holds a picture */
-+static int pv_dirty; /* the picture or the overlay changed */
-+
-+#define FADE_MS 180
-+#define INFO_H 44
-+
-+static int prints_roll_at(int from, int dir)
-+{
-+ for (int i = from; i >= 0 && i < nrolls; i += dir)
-+ if (has_prints(&rolls[i])) return i;
-+ return -1;
-+}
-+
-+static void pv_load()
-+{
-+ char path[64];
-+ if (pv_have) fos_print_free(&pv_print);
-+ pv_have = 0;
-+ if (pv_roll < 0) return;
-+ const struct fos_lab_roll *r = &rolls[pv_roll];
-+ fos_lab_print_path(path, sizeof(path), r->number, pv_mode ? pv_cur : 0);
-+ pv_have = fos_print_load(path, &pv_print);
-+ if (!pv_have)
-+ {
-+ char msg[96];
-+ snprintf(msg, sizeof(msg), "prints: can't load %s", path);
-+ fos_port_log(msg);
-+ }
-+ pv_dirty = 1;
-+}
-+
-+static void pv_palette(int k)
-+{
-+ static const uint8_t black[1][3] = { { 0, 0, 0 } };
-+ if (pv_have) fos_port_photo((const uint8_t (*)[3]) pv_print.pal, FOS_PRINT_COLOURS, k);
-+ else fos_port_photo(black, 1, k);
-+}
-+
-+void prints_enter(int arg)
-+{
-+ pv_alone = (arg & PRINTS_ALONE) != 0;
-+ arg &= ~PRINTS_ALONE;
-+ pv_have = 0;
-+ dark_mem();
-+ rescan();
-+ int i = arg ? roll_index(arg) : -1;
-+ if (i < 0 || !has_prints(&rolls[i])) i = prints_roll_at(0, 1);
-+ pv_roll = i;
-+ pv_mode = 0;
-+ pv_cur = 1;
-+ pv_frames = i >= 0 ? rolls[i].shot : 0;
-+ if (i >= 0) fos_lab_frames(rolls[i].number, pv_meta, FOS_MAX_FRAMES);
-+ pv_have = 0;
-+ pv_state = i >= 0 ? PV_WAIT : PV_NONE;
-+ pv_t = 0;
-+ pv_info = 1;
-+ pv_info_t = 0;
-+ pv_dirty = 1;
-+ if (pv_state == PV_NONE)
-+ {
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("PRINTS");
-+ fos_text_c(cv, &fos_font_lg, 360, 220, "No prints yet", C_TEXT, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_sm, 360, 248, "Develop a roll in the darkroom and its prints show here.", C_TEXT3, OPAQUE, 0);
-+ struct hint h[] = { { "SET", "Darkroom" }, { "MENU", "Back" } };
-+ ui_hints(h, 2);
-+ ui_to_bg(0);
-+ }
-+ else memset(ui_bg, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+}
-+
-+void prints_leave()
-+{
-+ if (pv_have) fos_print_free(&pv_print);
-+ pv_have = 0;
-+ if (pv_state != PV_NONE) fos_port_palette();
-+}
-+
-+static void pv_go(int next)
-+{
-+ if (pv_state == PV_OUT) return;
-+ pv_next = next;
-+ pv_state = PV_OUT;
-+ pv_t = 0;
-+}
-+
-+static void pv_back()
-+{
-+ if (pv_alone) ui_leave();
-+ else if (ui_from() == SCR_DARK || ui_from() == SCR_DEVELOP)
-+ ui_go(SCR_DARK, pv_roll >= 0 ? rolls[pv_roll].number : 0, GO_FADE);
-+ else ui_go(SCR_HOME, 2, GO_FADE);
-+}
-+
-+void prints_key(int k)
-+{
-+ if (pv_state == PV_NONE)
-+ {
-+ if (k == FK_SET) ui_go(SCR_DARK, 0, GO_FADE);
-+ else if (k == FK_MENU || k == FK_PLAY) { if (pv_alone) ui_leave(); else ui_go(SCR_HOME, 2, GO_FADE); }
-+ return;
-+ }
-+ if (pv_state != PV_SHOW) return;
-+ int n = pv_frames;
-+ switch (k)
-+ {
-+ case FK_LEFT: case FK_RIGHT: case FK_UP: case FK_DOWN:
-+ {
-+ int d = k == FK_LEFT ? -1 : k == FK_RIGHT ? 1 : k == FK_UP ? -6 : 6;
-+ if (pv_mode && (k == FK_UP || k == FK_DOWN)) break;
-+ int to = pv_cur + d;
-+ if (to < 1 || to > n) break;
-+ pv_cur = to;
-+ if (pv_mode) pv_go(NEXT_LOAD);
-+ else pv_dirty = 1;
-+ break;
-+ }
-+ case FK_WHEEL_L: case FK_WHEEL_R:
-+ if (pv_mode)
-+ {
-+ int to = pv_cur + (k == FK_WHEEL_L ? -1 : 1);
-+ if (to >= 1 && to <= n) { pv_cur = to; pv_go(NEXT_LOAD); }
-+ }
-+ else
-+ {
-+ /* the other rolls: newer to the left */
-+ int to = prints_roll_at(pv_roll + (k == FK_WHEEL_L ? -1 : 1), k == FK_WHEEL_L ? -1 : 1);
-+ if (to >= 0)
-+ {
-+ pv_roll = to;
-+ pv_frames = rolls[to].shot;
-+ pv_cur = 1;
-+ fos_lab_frames(rolls[to].number, pv_meta, FOS_MAX_FRAMES);
-+ pv_go(NEXT_LOAD);
-+ }
-+ }
-+ break;
-+ case FK_SET:
-+ pv_mode = !pv_mode;
-+ pv_go(NEXT_LOAD);
-+ break;
-+ case FK_INFO:
-+ pv_info = !pv_info;
-+ pv_info_t = 0;
-+ pv_dirty = 1;
-+ break;
-+ case FK_MENU:
-+ if (pv_mode) { pv_mode = 0; pv_go(NEXT_LOAD); }
-+ else pv_go(NEXT_BACK);
-+ break;
-+ case FK_PLAY:
-+ pv_go(NEXT_BACK);
-+ break;
-+ case FK_HOME:
-+ pv_go(NEXT_BACK);
-+ break;
-+ }
-+ if (pv_state == PV_SHOW && (k == FK_SET || k == FK_LEFT || k == FK_RIGHT)) pv_info_t = 0;
-+ if (pv_dirty) ui_damage_all();
-+}
-+
-+int prints_update(int dt)
-+{
-+ if (pv_state == PV_NONE) return 0;
-+ pv_t += dt;
-+ switch (pv_state)
-+ {
-+ case PV_WAIT:
-+ if (!ui_settled()) return 1;
-+ pv_load();
-+ pv_palette(0);
-+ pv_state = PV_IN;
-+ pv_t = 0;
-+ pv_info_t = 0;
-+ return 1;
-+ case PV_IN:
-+ pv_palette(fos_clamp(pv_t * 256 / FADE_MS, 0, 256));
-+ if (pv_t >= FADE_MS) pv_state = PV_SHOW;
-+ return 1;
-+ case PV_OUT:
-+ pv_palette(fos_clamp(256 - pv_t * 256 / FADE_MS, 0, 256));
-+ if (pv_t < FADE_MS) return 1;
-+ if (pv_next == NEXT_LOAD)
-+ {
-+ pv_load();
-+ pv_state = PV_IN;
-+ pv_t = 0;
-+ return 1;
-+ }
-+ /* back to the film OS's colours, on black */
-+ pv_state = PV_NONE;
-+ if (pv_have) fos_print_free(&pv_print);
-+ pv_have = 0;
-+ memset(cv->px, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+ fos_port_present(cv->px, FOS_W, 0, FOS_H);
-+ fos_port_palette();
-+ memset(ui_bg, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+ pv_back();
-+ return 1;
-+ case PV_SHOW:
-+ /* the details go after a while on their own */
-+ if (pv_info && pv_info_t < 3000)
-+ {
-+ pv_info_t += dt;
-+ if (pv_info_t >= 3000) { pv_info = 0; pv_dirty = 1; ui_damage_all(); }
-+ }
-+ return 0;
-+ }
-+ return 0;
-+}
-+
-+static void sheet_cell(int i, int *x, int *y)
-+{
-+ int rows = (pv_frames + 5) / 6;
-+ int y0 = (FOS_PRINT_H - rows * FOS_THUMB_H) / 2;
-+ *x = (i % 6) * FOS_THUMB_W + FOS_SHEET_FX;
-+ *y = y0 + (i / 6) * FOS_THUMB_H + FOS_SHEET_FY;
-+}
-+
-+static void frame_rect(int x, int y, int w, int h, uint8_t ix)
-+{
-+ for (int k = 0; k < 2; k++)
-+ {
-+ memset(&cv->px[(y + k) * cv->pitch + x], ix, w);
-+ memset(&cv->px[(y + h - 1 - k) * cv->pitch + x], ix, w);
-+ }
-+ for (int j = y; j < y + h; j++)
-+ {
-+ cv->px[j * cv->pitch + x] = cv->px[j * cv->pitch + x + 1] = ix;
-+ cv->px[j * cv->pitch + x + w - 1] = cv->px[j * cv->pitch + x + w - 2] = ix;
-+ }
-+}
-+
-+void prints_draw()
-+{
-+ if (pv_state == PV_NONE)
-+ {
-+ if (ui_clobbered) { ui_clobbered = 0; ui_bg_restore(0, 0, FOS_W, FOS_H); ui_damage_all(); }
-+ return;
-+ }
-+ if (pv_state == PV_WAIT)
-+ {
-+ /* black, in the film OS's colours, until the screen has settled */
-+ memset(cv->px, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+ ui_clobbered = 0;
-+ return;
-+ }
-+ if (pv_state == PV_OUT) return; /* what is fading out stays as it was */
-+ if (!pv_dirty && !ui_clobbered) return;
-+ pv_dirty = 0;
-+ ui_clobbered = 0;
-+ /* the picture */
-+ if (pv_have) memcpy(cv->px, pv_print.px, FOS_W * FOS_H);
-+ else
-+ {
-+ memset(cv->px, PX_BLACK, FOS_W * FOS_H);
-+ char b[64];
-+ snprintf(b, sizeof(b), pv_mode ? "Frame %d was not developed" : "No contact sheet", pv_cur);
-+ ui_photo_text(&fos_font_md, 360, 244, b, 0, 1);
-+ /* and why, when the darkroom couldn't */
-+ const struct fos_lab_frame *m = pv_mode && pv_cur >= 1 && pv_cur <= FOS_MAX_FRAMES ? &pv_meta[pv_cur - 1] : 0;
-+ if (m && m->missing)
-+ {
-+ const char *base = strrchr(m->cr2, '/');
-+ base = base ? base + 1 : m->cr2;
-+ if (m->jpeg) snprintf(b, sizeof(b), "%.8s was shot as JPEG: set Image quality to RAW", base);
-+ else if (m->cr2[0]) snprintf(b, sizeof(b), "%s isn't on the card", base);
-+ else snprintf(b, sizeof(b), "No RAW file was logged for it");
-+ ui_photo_text(&fos_font_sm, 360, 274, b, 0, 1);
-+ }
-+ }
-+ const struct fos_lab_roll *r = &rolls[pv_roll];
-+ if (!pv_mode)
-+ {
-+ int x, y;
-+ sheet_cell(pv_cur - 1, &x, &y);
-+ frame_rect(x - 4, y - 4, FOS_SHEET_FW + 8, FOS_SHEET_FH + 8, PX_AMBER);
-+ }
-+ if (pv_info)
-+ {
-+ char b[96], c[64];
-+ int y = FOS_H - INFO_H;
-+ memset(&cv->px[y * cv->pitch], PX_PANEL, FOS_W * INFO_H);
-+ memset(&cv->px[y * cv->pitch], PX_LINE, FOS_W);
-+ const struct fos_lab_frame *m = pv_cur >= 1 && pv_cur <= FOS_MAX_FRAMES ? &pv_meta[pv_cur - 1] : 0;
-+ snprintf(b, sizeof(b), "ROLL %03d", r->number);
-+ int x = 20 + ui_photo_text(&fos_font_xs, 20, y + 28, b, 1, 0);
-+ snprintf(b, sizeof(b), "%s " T_DOT " frame %d of %d", fos_films[r->film].name, pv_cur, pv_frames);
-+ x += 14 + ui_photo_text(&fos_font_sm, x + 14, y + 28, b, 0, 0);
-+ if (m && m->when[0])
-+ {
-+ snprintf(c, sizeof(c), "%s%s%s", m->when, m->fstop[0] ? " f/" : "", m->fstop);
-+ ui_photo_text(&fos_font_sm, x + 14, y + 28, c, 0, 0);
-+ }
-+ ui_photo_text(&fos_font_xs, FOS_W - 20, y + 28, pv_mode ? "SET SHEET INFO HIDE" : "SET OPEN WHEEL ROLLS", 0, 2);
-+ }
-+ ui_damage_all();
-+}
-diff --git a/src/fos_dev.c b/src/fos_dev.c
-new file mode 100644
-index 000000000..fd6efba0a
---- /dev/null
-+++ b/src/fos_dev.c
-@@ -0,0 +1,2121 @@
-+/* fos_dev: developing film in the camera, a frame at a time.
-+ *
-+ * The frame's CR2 is read a chunk at a time and its lossless JPEG decoded;
-+ * every sample is added straight into the print pixel it falls in, so the
-+ * 18 million sample mosaic becomes a 720 x 480 picture without ever being
-+ * held: a box filter and the demosaic in one. The print then gets what
-+ * the desktop darkroom (Darkrooms) does: daylight balance, the camera's colours
-+ * to sRGB, the scanner's exposure, the film's balance, vignette and
-+ * halation, the film's colour (a 3D table built from the same film model),
-+ * and grain. Finally it is reduced to FOS_PRINT_COLOURS colours with error
-+ * diffusion, its own palette, for the 8-bit screen.
-+ *
-+ * Everything runs in steps that stop after a time budget, so the film OS
-+ * keeps animating on the same task: no threads, no locks.
-+ */
-+
-+#include "fos.h"
-+#include "fos_dev.h"
-+#include "fos_jpeg.h"
-+#include <math.h>
-+#include <string.h>
-+
-+#ifdef FOS_DEV_TEST
-+void fos_dev_test_sample(int x, int y, int v);
-+#endif
-+
-+static int u16le(const uint8_t *p) { return p[0] | p[1] << 8; }
-+static unsigned u32le(const uint8_t *p) { return p[0] | p[1] << 8 | p[2] << 16 | (unsigned) p[3] << 24; }
-+static void put32(uint8_t *p, uint32_t v) { p[0] = (uint8_t) v; p[1] = (uint8_t) (v >> 8); p[2] = (uint8_t) (v >> 16); p[3] = (uint8_t) (v >> 24); }
-+
-+/* ---------------------------------------------------------------- the film model */
-+
-+static const float LUMA[3] = { 0.2126f, 0.7152f, 0.0722f };
-+static const float REF[7][3] = { /* red orange yellow green cyan blue magenta */
-+ { 1, 0, 0 }, { 1, 0.5f, 0 }, { 1, 1, 0 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 0, 1 }, { 1, 0, 1 } };
-+#define PI_F 3.14159265f
-+
-+const struct fos_look *fos_look_of(const char *key)
-+{
-+ for (int i = 0; i < fos_nlooks; i++)
-+ if (!strcmp(fos_looks[i].key, key)) return &fos_looks[i];
-+ for (int i = 0; i < fos_nmore_looks; i++)
-+ if (!strcmp(fos_more_looks[i].key, key)) return &fos_more_looks[i];
-+ return &fos_looks[0];
-+}
-+
-+static float dot3(const float a[3], const float b[3])
-+{
-+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
-+}
-+
-+static float hue_angle(int i)
-+{
-+ static float angle[7];
-+ static int ready;
-+ if (!ready)
-+ {
-+ for (int k = 0; k < 7; k++)
-+ {
-+ float y = dot3(REF[k], LUMA);
-+ angle[k] = atan2f((REF[k][0] - y) / 1.5748f, (REF[k][2] - y) / 1.8556f);
-+ }
-+ ready = 1;
-+ }
-+ return angle[i];
-+}
-+
-+static float wrap(float a)
-+{
-+ a = fmodf(a + PI_F, 2 * PI_F);
-+ if (a < 0) a += 2 * PI_F;
-+ return a - PI_F;
-+}
-+
-+/* the characteristic curve: logistic in log2 exposure around mid grey */
-+static float curve(float x, float slope, float pivot, float black, float white)
-+{
-+ float xx = log2f((x > 1e-6f ? x : 1e-6f) / 0.18f) - pivot;
-+ float k = 4 * slope / (white - black);
-+ return black + (white - black) / (1 + expf(-k * xx));
-+}
-+
-+static void shift_hues(const struct fos_look *f, float rgb[3])
-+{
-+ float y = dot3(rgb, LUMA);
-+ float cb = (rgb[2] - y) / 1.8556f, cr = (rgb[0] - y) / 1.5748f;
-+ float h = atan2f(cr, cb), c = sqrtf(cb * cb + cr * cr);
-+ float gate = c / 0.04f > 1 ? 1 : c / 0.04f;
-+ float dh = 0, cm = 1;
-+ const float sigma = 35 * PI_F / 180;
-+ for (int i = 0; i < f->nhues; i++)
-+ {
-+ const struct fos_hue_shift *s = &f->hues[i];
-+ float hs = hue_angle(s->from);
-+ float d = wrap(h - hs) / sigma;
-+ float w = expf(-0.5f * d * d) * gate;
-+ if (s->from != s->to) dh += w * s->amount * wrap(hue_angle(s->to) - hs);
-+ cm *= 1 + w * (s->chroma - 1);
-+ }
-+ h += dh;
-+ c *= cm;
-+ cb = c * cosf(h); cr = c * sinf(h);
-+ rgb[0] = y + 1.5748f * cr;
-+ rgb[2] = y + 1.8556f * cb;
-+ rgb[1] = (y - LUMA[0] * rgb[0] - LUMA[2] * rgb[2]) / LUMA[1];
-+}
-+
-+void fos_film_color(const struct fos_look *f, const float in[3], float out[3])
-+{
-+ if (f->mono)
-+ {
-+ float v = curve(dot3(in, f->mono_mix), f->contrast[0], f->pivot[0], f->black[0], f->white[0]);
-+ out[0] = out[1] = out[2] = v;
-+ return;
-+ }
-+ float y = dot3(in, LUMA), lin[3];
-+ for (int c = 0; c < 3; c++)
-+ {
-+ lin[c] = y + (in[c] - y) * f->sat;
-+ if (lin[c] < 0) lin[c] = 0;
-+ out[c] = curve(lin[c], f->contrast[c], f->pivot[c], f->black[c], f->white[c]);
-+ }
-+ if (f->nhues) shift_hues(f, out);
-+}
-+
-+/* linear sRGB of a blackbody at t kelvin (as cct_to_rgb in the lab) */
-+static void cct_rgb(float t, float out[3])
-+{
-+ float x, y;
-+ if (t <= 4000) x = -0.2661239e9f / (t * t * t) - 0.2343589e6f / (t * t) + 0.8776956e3f / t + 0.179910f;
-+ else x = -3.0258469e9f / (t * t * t) + 2.1070379e6f / (t * t) + 0.2226347e3f / t + 0.240390f;
-+ if (t <= 2222) y = -1.1063814f * x * x * x - 1.34811020f * x * x + 2.18555832f * x - 0.20219683f;
-+ else if (t <= 4000) y = -0.9549476f * x * x * x - 1.37418593f * x * x + 2.09137015f * x - 0.16748867f;
-+ else y = 3.0817580f * x * x * x - 5.87338670f * x * x + 3.75112997f * x - 0.37001483f;
-+ float X = x / y, Y = 1, Z = (1 - x - y) / y;
-+ out[0] = 3.2406f * X - 1.5372f * Y - 0.4986f * Z;
-+ out[1] = -0.9689f * X + 1.8758f * Y + 0.0415f * Z;
-+ out[2] = 0.0557f * X - 0.2040f * Y + 1.0570f * Z;
-+}
-+
-+/* ---------------------------------------------------------------- the film's table */
-+
-+/* The film's colour as a 3D table over Cineon log code (the density of a
-+ * film scan): the same thing `lut.py export` writes, and as close to the
-+ * lab's model. Building it takes the camera a few seconds, so it is kept
-+ * in memory and on the card. */
-+#define GRID 33
-+#define NGRID (GRID * GRID * GRID)
-+#define LOOK_MODEL 1 /* bump when fos_film_color changes */
-+#define CIN_BLACK 0.0108f /* 10^((95 - 685) * 0.002 / 0.6) */
-+
-+static struct
-+{
-+ uint8_t lut[NGRID][3];
-+ /* linear (4096 = 1.0) -> grid position (1/256) of its Cineon code:
-+ * 0..4095 one by one, then up to 65535 in steps of 16 */
-+ uint16_t cin[4096 + 3841];
-+} *tab;
-+static int lut_film = -1, lut_built; /* lut_built: grid points done */
-+static char cache_dir[128];
-+
-+void fos_dev_cache(const char *dir)
-+{
-+ snprintf(cache_dir, sizeof(cache_dir), "%s", dir ? dir : "");
-+}
-+
-+void fos_dev_release()
-+{
-+ fos_port_free(tab);
-+ tab = 0;
-+ lut_film = -1;
-+}
-+
-+static float cineon_decode(float v)
-+{
-+ float x = powf(10, (v * 1023 - 685) / 300);
-+ return (x - CIN_BLACK) / (1 - CIN_BLACK);
-+}
-+
-+static int cineon_encode(float lin)
-+{
-+ float x = (lin > 0 ? lin : 0) * (1 - CIN_BLACK) + CIN_BLACK;
-+ float v = (685 + 300 * log10f(x)) / 1023;
-+ return v < 0 ? 0 : v > 1 ? 65535 : (int) (v * 65535 + 0.5f);
-+}
-+
-+static int tables_ready()
-+{
-+ if (tab) return 1;
-+ tab = fos_port_alloc(sizeof(*tab));
-+ if (!tab) return 0;
-+ for (int i = 0; i < 4096 + 3841; i++)
-+ {
-+ int code = cineon_encode((i < 4096 ? i : 4096 + (i - 4096) * 16) / 4096.0f);
-+ tab->cin[i] = (uint16_t) ((code * ((GRID - 1) * 256)) >> 16);
-+ }
-+ lut_film = -1;
-+ return 1;
-+}
-+
-+/* linear 0..65535 (4096 = 1.0, up to 16) -> grid position in 1/256 */
-+FOS_INLINE int cin_pos(const uint16_t *cin, int lin)
-+{
-+ return cin[lin < 4096 ? lin : lin > 65535 ? 4096 + 3840 : 4096 + ((lin - 4096) >> 4)];
-+}
-+
-+/* the look's numbers, so a table on the card is only used for the same look */
-+/* the look's numbers and its film, so a table on the card is only used
-+ * for the same look (tools/genfilms.py works it out the same way for the
-+ * tables it bakes from LUTs) */
-+static uint32_t look_hash(const struct fos_look *f)
-+{
-+ const uint8_t *p = (const uint8_t *) &f->balance;
-+ const uint8_t *e = (const uint8_t *) f->mono_mix + sizeof(f->mono_mix);
-+ uint32_t h = 2166136261u ^ (GRID * 256 + LOOK_MODEL);
-+ for (const char *k = f->key; *k; k++) h = (h ^ (uint8_t) *k) * 16777619u;
-+ for (; p < e; p++) h = (h ^ *p) * 16777619u;
-+ return h;
-+}
-+
-+static void *lut_file(int film, int write)
-+{
-+ if (!cache_dir[0]) return 0;
-+ char path[160];
-+ snprintf(path, sizeof(path), "%s/LOOK%02d.LUT", cache_dir, film);
-+ return fos_port_open(path, write);
-+}
-+
-+static int lut_load(const struct fos_look *f, int film)
-+{
-+ void *fp = lut_file(film, 0);
-+ if (!fp) return 0;
-+ uint8_t h[8];
-+ int ok = fos_port_read(fp, h, 8) == 8 && !memcmp(h, "FOL1", 4) && u32le(h + 4) == look_hash(f)
-+ && fos_port_read(fp, tab->lut, sizeof(tab->lut)) == (int) sizeof(tab->lut);
-+ fos_port_close(fp);
-+ return ok;
-+}
-+
-+static void lut_save(const struct fos_look *f, int film)
-+{
-+ void *fp = lut_file(film, 1);
-+ if (!fp) return;
-+ uint8_t h[8] = { 'F', 'O', 'L', '1' };
-+ put32(h + 4, look_hash(f));
-+ fos_port_write(fp, h, 8);
-+ fos_port_write(fp, tab->lut, sizeof(tab->lut));
-+ fos_port_close(fp);
-+}
-+
-+/* build up to `count` more grid points; 1 when the table is complete */
-+static __attribute__((noinline)) int lut_build(const struct fos_look *f, int film, int count)
-+{
-+ if (lut_film != film)
-+ {
-+ lut_film = film;
-+ lut_built = lut_load(f, film) ? NGRID : 0;
-+ }
-+ if (lut_built >= NGRID) return 1;
-+ for (; lut_built < NGRID && count-- > 0; lut_built++)
-+ {
-+ int i = lut_built, r = i % GRID, g = (i / GRID) % GRID, b = i / (GRID * GRID);
-+ float lin[3] = { cineon_decode(r / (float) (GRID - 1)), cineon_decode(g / (float) (GRID - 1)),
-+ cineon_decode(b / (float) (GRID - 1)) }, out[3];
-+ fos_film_color(f, lin, out);
-+ for (int c = 0; c < 3; c++)
-+ {
-+ int v = (int) (out[c] * 255 + 0.5f);
-+ tab->lut[i][c] = (uint8_t) (v < 0 ? 0 : v > 255 ? 255 : v);
-+ }
-+ }
-+ if (lut_built < NGRID) return 0;
-+ lut_save(f, film);
-+ return 1;
-+}
-+
-+/* the film's table, into the cache now: the build puts every film's on
-+ * the card, so the camera never has to mix one */
-+int fos_dev_table(int film)
-+{
-+ if (!tables_ready()) return 0;
-+ film = fos_clamp(film, 0, fos_nfilms - 1);
-+ lut_film = -1;
-+ while (!lut_build(fos_look_of(fos_films[film].key), film, NGRID)) {}
-+ return 1;
-+}
-+
-+/* tetrahedral lookup at grid positions in 1/256: the four corners of the
-+ * cell's tetrahedron the point is in, weighted */
-+FOS_INLINE void lut_apply(const uint8_t (*lut)[3], int pr, int pg, int pb, uint8_t out[3])
-+{
-+ int fr = pr & 255, fg = pg & 255, fb = pb & 255;
-+ const uint8_t *p = lut[((pb >> 8) * GRID + (pg >> 8)) * GRID + (pr >> 8)];
-+ const int R = 3, G = 3 * GRID, B = 3 * GRID * GRID;
-+ int o1, o2, w0, w1, w2, w3;
-+ if (fr >= fg)
-+ {
-+ if (fg >= fb) { o1 = R; o2 = R + G; w0 = 256 - fr; w1 = fr - fg; w2 = fg - fb; w3 = fb; }
-+ else if (fr >= fb) { o1 = R; o2 = R + B; w0 = 256 - fr; w1 = fr - fb; w2 = fb - fg; w3 = fg; }
-+ else { o1 = B; o2 = R + B; w0 = 256 - fb; w1 = fb - fr; w2 = fr - fg; w3 = fg; }
-+ }
-+ else
-+ {
-+ if (fb >= fg) { o1 = B; o2 = G + B; w0 = 256 - fb; w1 = fb - fg; w2 = fg - fr; w3 = fr; }
-+ else if (fb >= fr) { o1 = G; o2 = G + B; w0 = 256 - fg; w1 = fg - fb; w2 = fb - fr; w3 = fr; }
-+ else { o1 = G; o2 = R + G; w0 = 256 - fg; w1 = fg - fr; w2 = fr - fb; w3 = fb; }
-+ }
-+ const int o3 = R + G + B;
-+ for (int c = 0; c < 3; c++, p++)
-+ out[c] = (uint8_t) ((w0 * p[0] + w1 * p[o1] + w2 * p[o2] + w3 * p[o3] + 128) >> 8);
-+}
-+
-+/* ---------------------------------------------------------------- the frame */
-+
-+#define CHUNK (192 * 1024) /* read from the card at a time */
-+#define GW (FOS_PRINT_W / 4) /* the halation's grid */
-+#define GH (FOS_PRINT_H / 4)
-+#define FAST_BITS 9
-+#define DIFF_BITS 11
-+#define UNPACK 2688 /* samples decoded at a time: an EOS M slice's row */
-+
-+enum { ST_OPEN, ST_DECODE, ST_KEY, ST_EXPOSE, ST_GLOW, ST_FINISH, ST_JPEG, ST_QUANT, ST_DITHER, ST_WRITE, ST_DONE, ST_FAIL };
-+
-+struct huff
-+{
-+ /* a code and its difference bits together, when they fit in
-+ * DIFF_BITS: difference << 4 | bits used; 0 = the slower way (small,
-+ * so it stays in the camera's data cache) */
-+ int16_t fastd[1 << DIFF_BITS];
-+ uint16_t fast[1 << FAST_BITS]; /* len << 8 | symbol, 0 = longer than FAST_BITS */
-+ int maxcode[18], valptr[17], mincode[17];
-+ uint8_t vals[256];
-+};
-+
-+struct box { int lo[3], hi[3]; long count; };
-+
-+struct fos_dev
-+{
-+ char cr2[128], print[128], when[20], fstop[8];
-+ char jpeg[160]; /* the full-colour frame as a JPEG too, or "" */
-+ int film, frame;
-+ const struct fos_look *look;
-+ int stage, row; /* row: progress through a per-row stage */
-+ const char *err;
-+ char errbuf[48];
-+ void *f;
-+
-+ /* the file, destuffed into whole bytes of entropy data */
-+ uint8_t *buf;
-+ const uint8_t *bp, *be, *safe, *ff; /* the next byte, the end, see fill() */
-+ int file_pos, file_end;
-+ uint32_t bitbuf;
-+ int vbits;
-+
-+ /* the raw */
-+ int raw_w, raw_h, orient;
-+ int rphase; /* 1: the mosaic's red rows are the odd ones, see row_phase() */
-+ int crop_l, crop_t, crop_w, crop_h, ob_l, ob_r;
-+ int slices[3];
-+ int clrs, wide, high, bits, psv;
-+ struct huff *huff[4];
-+ struct huff tables[4];
-+
-+ /* decoding */
-+ int jcol, comp, vpred[4];
-+ uint16_t samples[4 + UNPACK];
-+ int sl, sx, sy, sw, sx0; /* where the next sample goes: slice, column in it, row */
-+ long done, total;
-+
-+ /* the print being built */
-+ int ow, oh, ox0; /* picture size and its left edge on the print */
-+ int32_t *rowoff; /* raw row -> its place in the print's sums, or < 0 */
-+ uint16_t *seg_of, *seg_x0; /* raw column -> its segment; a segment's first column */
-+ int32_t *seg_off; /* segment -> its place in the print's sums */
-+ uint8_t *seg_desc; /* a row's pieces: pairs (<= 4) | 0x40 a last even column | 0x80 an odd first */
-+ int32_t *desc_off; /* a piece's place in the print's sums */
-+ int32_t *seg_piece; /* a segment's first piece */
-+ uint8_t *rowob, *colob; /* optical black */
-+ uint16_t *ne_r, *no_r, *ne_c, *no_c; /* raw rows / columns per print line, even and odd */
-+ int rows_axis_x; /* raw rows run along the print's x (portrait) */
-+ uint32_t *sums; /* 3 per print pixel */
-+ int64_t black_sum;
-+ long black_n;
-+ int black16; /* black level, 1/16 raw units */
-+ int pre[3]; /* daylight balance and white level, raw/16 -> 1/4096, << 14 */
-+ int mat[3][3]; /* camera -> linear sRGB, 1/4096 */
-+ int mul[3]; /* exposure and film balance, 1/4096 */
-+ uint16_t *lin; /* in place of sums: linear sRGB, 4096 = 1.0 */
-+ int32_t *glow; /* halation, a quarter of the print each way */
-+ uint8_t *rgb; /* the finished print, RGB */
-+ uint8_t thumb[FOS_THUMB_W * FOS_THUMB_H * 3];
-+ int16_t vig_x[FOS_PRINT_W], vig_y[FOS_PRINT_H];
-+ uint8_t gx[FOS_PRINT_W], fx[FOS_PRINT_W]; /* glow cell and weight (1/8) per column */
-+ unsigned seed;
-+ uint16_t pos[3 * FOS_PRINT_W]; /* a row's positions on the film's grid */
-+
-+ /* palette */
-+ uint32_t *hist;
-+ uint8_t *inv;
-+ uint8_t pal[FOS_PRINT_COLOURS][3];
-+ int npal;
-+ struct box boxes[FOS_PRINT_COLOURS];
-+ uint8_t by_green[FOS_PRINT_COLOURS]; /* the palette in order of green */
-+ int16_t *err_rows;
-+ uint8_t *idx;
-+};
-+
-+/* Which raw rows are red-green: LibRaw has every Canon here RGGB from the
-+ * top left of the picture, and on these sensors the picture starts on raw
-+ * row 51 (LibRaw's identify.cpp, the canon[] table), so their red rows are
-+ * the odd ones; the others start on an even row (EOS M, 650D, 700D, 100D 52;
-+ * 6D, 70D 38; 5D Mark III 80; 500D 26; 1100D 18). Every left edge is even.
-+ * Read as even ones, a picture's colours came out pink or magenta (5D Mark II
-+ * #18, 60D #25). By the sensor's size, so a CR2 from any camera develops
-+ * right on any build. */
-+static int row_phase(int raw_w, int raw_h)
-+{
-+ static const uint16_t odd[][2] = {
-+ { 5792, 3804 }, /* 5D Mark II */
-+ { 5344, 3516 }, /* 550D, 600D, 60D */
-+ { 5360, 3516 }, /* 7D */
-+ { 4832, 3228 }, /* 50D */
-+ };
-+ for (unsigned i = 0; i < sizeof(odd) / sizeof(odd[0]); i++)
-+ if (raw_w == odd[i][0] && raw_h == odd[i][1]) return 1;
-+ return 0;
-+}
-+
-+/* The sensor's colours, XYZ -> camera, and its white level: LibRaw's
-+ * colordata.cpp (the Adobe matrices), per camera the fork is built for.
-+ * The EOS M's is the default (and the 650D's, 700D's and 100D's: one sensor). */
-+#define M3(a, b, c, d, e, f, g, h, i) { { a / 10000.f, b / 10000.f, c / 10000.f }, { d / 10000.f, e / 10000.f, f / 10000.f }, \
-+ { g / 10000.f, h / 10000.f, i / 10000.f } }
-+#if defined(CONFIG_6D) || defined(CONFIG_70D)
-+static const float XYZ_CAM[3][3] = M3(7034, -804, -1014, -4420, 12564, 2058, -851, 1994, 5758);
-+#elif defined(CONFIG_5D3)
-+static const float XYZ_CAM[3][3] = M3(6722, -635, -963, -4287, 12460, 2028, -908, 2162, 5668);
-+#elif defined(CONFIG_5D2)
-+static const float XYZ_CAM[3][3] = M3(4716, 603, -830, -7798, 15474, 2480, -1496, 1937, 6651);
-+#elif defined(CONFIG_7D)
-+static const float XYZ_CAM[3][3] = M3(6844, -996, -856, -3876, 11761, 2396, -593, 1772, 6198);
-+#elif defined(CONFIG_50D)
-+static const float XYZ_CAM[3][3] = M3(4920, 616, -593, -6493, 13964, 2784, -1774, 3178, 7005);
-+#elif defined(CONFIG_60D)
-+static const float XYZ_CAM[3][3] = M3(6719, -994, -925, -4408, 12426, 2211, -887, 2129, 6051);
-+#elif defined(CONFIG_500D)
-+static const float XYZ_CAM[3][3] = M3(4763, 712, -646, -6821, 14399, 2640, -1921, 3276, 6561);
-+#elif defined(CONFIG_550D)
-+static const float XYZ_CAM[3][3] = M3(6941, -1164, -857, -3825, 11597, 2534, -416, 1540, 6039);
-+#elif defined(CONFIG_600D)
-+static const float XYZ_CAM[3][3] = M3(6461, -907, -882, -4300, 12184, 2378, -819, 1944, 5931);
-+#elif defined(CONFIG_1100D)
-+static const float XYZ_CAM[3][3] = M3(6444, -904, -893, -4563, 12308, 2535, -903, 2016, 6728);
-+#else /* EOS M, 100D, 650D, 700D */
-+static const float XYZ_CAM[3][3] = { { 0.6602f, -0.0841f, -0.0939f }, { -0.4472f, 1.2458f, 0.2247f }, { -0.0975f, 0.2039f, 0.6148f } };
-+#endif
-+static const float RGB_XYZ[3][3] = { { 0.4124564f, 0.3575761f, 0.1804375f }, { 0.2126729f, 0.7151522f, 0.0721750f },
-+ { 0.0193339f, 0.1191920f, 0.9503041f } };
-+/* raw value of a full pixel (LibRaw's maximum); the EOS M's measured 13600 */
-+#if defined(CONFIG_6D)
-+#define WHITE_LEVEL 15490
-+#elif defined(CONFIG_70D)
-+#define WHITE_LEVEL 15303
-+#elif defined(CONFIG_5D3)
-+#define WHITE_LEVEL 15488
-+#elif defined(CONFIG_5D2)
-+#define WHITE_LEVEL 15600
-+#elif defined(CONFIG_7D) || defined(CONFIG_600D) || defined(CONFIG_1100D)
-+#define WHITE_LEVEL 13584
-+#elif defined(CONFIG_50D)
-+#define WHITE_LEVEL 15763
-+#elif defined(CONFIG_60D)
-+#define WHITE_LEVEL 12279
-+#elif defined(CONFIG_500D)
-+#define WHITE_LEVEL 13433
-+#elif defined(CONFIG_550D)
-+#define WHITE_LEVEL 15831
-+#elif defined(CONFIG_700D)
-+#define WHITE_LEVEL 15360
-+#elif defined(CONFIG_100D)
-+#define WHITE_LEVEL 13583
-+#elif defined(CONFIG_650D)
-+#define WHITE_LEVEL 13645
-+#else
-+#define WHITE_LEVEL 13600
-+#endif
-+
-+static int fail(struct fos_dev *d, const char *why)
-+{
-+ d->err = why;
-+ d->stage = ST_FAIL;
-+ return -1;
-+}
-+
-+/* a buffer couldn't be had: which one, for the log */
-+static int fail_mem(struct fos_dev *d, int size)
-+{
-+ snprintf(d->errbuf, sizeof(d->errbuf), "out of memory (%d KB)", (size + 1023) / 1024);
-+ return fail(d, d->errbuf);
-+}
-+
-+/* ---- reading */
-+
-+static int read_at(struct fos_dev *d, int offset, void *buf, int size)
-+{
-+ if (fos_port_seek(d->f, offset) < 0) return 0;
-+ return fos_port_read(d->f, buf, size) == size;
-+}
-+
-+
-+/* the value of TIFF tag `tag` in the IFD at `ifd` (offset for anything
-+ * longer than 4 bytes); -1 when absent */
-+static long tiff_tag(struct fos_dev *d, unsigned ifd, int tag, int *count)
-+{
-+ uint8_t n2[2], e[12];
-+ if (!read_at(d, (int) ifd, n2, 2)) return -1;
-+ int n = u16le(n2);
-+ for (int i = 0; i < n && i < 400; i++)
-+ {
-+ if (!read_at(d, (int) ifd + 2 + 12 * i, e, 12)) return -1;
-+ if (u16le(e) != tag) continue;
-+ int type = u16le(e + 2);
-+ unsigned cnt = u32le(e + 4);
-+ if (count) *count = (int) cnt;
-+ if (type == 3 && cnt <= 2) return u16le(e + 8);
-+ return (long) u32le(e + 8);
-+ }
-+ return -1;
-+}
-+
-+static int parse_tiff(struct fos_dev *d)
-+{
-+ uint8_t h[16];
-+ if (!read_at(d, 0, h, 16)) return fail(d, "can't read the file");
-+ if (h[0] != 'I' || h[1] != 'I' || h[8] != 'C' || h[9] != 'R') return fail(d, "not a CR2 file");
-+ unsigned ifd0 = u32le(h + 4), raw_ifd = u32le(h + 12);
-+ long o = tiff_tag(d, ifd0, 0x0112, 0);
-+ d->orient = o > 0 ? (int) o : 1;
-+
-+ /* the sensor's picture area from the Canon maker note, if it says */
-+ d->crop_l = -1;
-+ long exif = tiff_tag(d, ifd0, 0x8769, 0);
-+ long mn = exif > 0 ? tiff_tag(d, (unsigned) exif, 0x927C, 0) : -1;
-+ int cnt = 0;
-+ long si = mn > 0 ? tiff_tag(d, (unsigned) mn, 0x00E0, &cnt) : -1;
-+ if (si > 0 && cnt >= 13)
-+ {
-+ uint8_t s[26];
-+ if (read_at(d, (int) si, s, 26))
-+ {
-+ d->crop_l = u16le(s + 10); d->crop_t = u16le(s + 12);
-+ d->crop_w = u16le(s + 14) - d->crop_l + 1; d->crop_h = u16le(s + 16) - d->crop_t + 1;
-+ d->ob_l = u16le(s + 18); d->ob_r = u16le(s + 22);
-+ }
-+ }
-+
-+ long off = tiff_tag(d, raw_ifd, 0x0111, 0);
-+ if (off <= 0) return fail(d, "no RAW in this file");
-+ d->file_pos = (int) off;
-+ long len = tiff_tag(d, raw_ifd, 0x0117, 0);
-+ d->file_end = len > 0 ? (int) (off + len) : 0x7fffffff;
-+ d->slices[0] = 0;
-+ long sl = tiff_tag(d, raw_ifd, 0xC640, &cnt);
-+ if (sl > 0 && cnt == 3)
-+ {
-+ uint8_t s[6];
-+ if (read_at(d, (int) sl, s, 6))
-+ {
-+ d->slices[0] = u16le(s); d->slices[1] = u16le(s + 2); d->slices[2] = u16le(s + 4);
-+ }
-+ }
-+ return 1;
-+}
-+
-+static int build_huff(struct huff *h, const uint8_t *counts, const uint8_t *vals, int nvals)
-+{
-+ memset(h, 0, sizeof(*h));
-+ memcpy(h->vals, vals, nvals > 256 ? 256 : nvals);
-+ int code = 0, k = 0;
-+ for (int len = 1; len <= 16; len++)
-+ {
-+ h->valptr[len] = k;
-+ h->mincode[len] = code;
-+ for (int i = 0; i < counts[len - 1]; i++, k++, code++)
-+ if (len <= FAST_BITS)
-+ {
-+ int shift = FAST_BITS - len;
-+ for (int j = 0; j < 1 << shift; j++)
-+ h->fast[(code << shift) | j] = (uint16_t) (len << 8 | vals[k]);
-+ }
-+ h->maxcode[len] = counts[len - 1] ? code - 1 : -1;
-+ code <<= 1;
-+ }
-+ h->maxcode[17] = 0x7fffffff;
-+ /* the common short code and difference in one lookup */
-+ for (int i = 0; i < 1 << DIFF_BITS; i++)
-+ {
-+ int e = h->fast[i >> (DIFF_BITS - FAST_BITS)], len = e >> 8, s = e & 0xFF;
-+ if (!e || s == 16 || len + s > DIFF_BITS) continue;
-+ int diff = 0;
-+ if (s)
-+ {
-+ diff = (i >> (DIFF_BITS - len - s)) & ((1 << s) - 1);
-+ if (!(diff >> (s - 1))) diff -= (1 << s) - 1;
-+ }
-+ h->fastd[i] = (int16_t) (diff * 16 + len + s);
-+ }
-+ return k == nvals;
-+}
-+
-+/* the lossless JPEG's header, up to the scan */
-+static int parse_ljpeg_in(struct fos_dev *d, uint8_t *hdr, int size);
-+
-+static int parse_ljpeg(struct fos_dev *d)
-+{
-+ const int HDR = 2048;
-+ uint8_t *hdr = fos_port_alloc(HDR); /* not on the film OS task's small stack */
-+ if (!hdr) return fail_mem(d, HDR);
-+ int r = parse_ljpeg_in(d, hdr, HDR);
-+ fos_port_free(hdr);
-+ return r;
-+}
-+
-+static int parse_ljpeg_in(struct fos_dev *d, uint8_t *hdr, int size)
-+{
-+ int n = d->file_end - d->file_pos < size ? d->file_end - d->file_pos : size;
-+ if (n < 64 || !read_at(d, d->file_pos, hdr, n)) return fail(d, "can't read the RAW");
-+ if (hdr[0] != 0xFF || hdr[1] != 0xD8) return fail(d, "the RAW is not a lossless JPEG");
-+ int p = 2, have_sof = 0, ntab = 0;
-+ while (p + 4 <= n)
-+ {
-+ if (hdr[p] != 0xFF) return fail(d, "broken RAW header");
-+ int tag = hdr[p + 1], len = hdr[p + 2] << 8 | hdr[p + 3];
-+ const uint8_t *s = hdr + p + 4;
-+ if (p + 2 + len > n) return fail(d, "RAW header too long");
-+ if (tag == 0xC3)
-+ {
-+ d->bits = s[0];
-+ d->high = s[1] << 8 | s[2];
-+ d->wide = s[3] << 8 | s[4];
-+ d->clrs = s[5];
-+ if (((s[7] >> 4) * (s[7] & 15) - 1) & 3) return fail(d, "sRAW / mRAW: shoot full RAW");
-+ have_sof = 1;
-+ }
-+ else if (tag == 0xC4)
-+ {
-+ for (const uint8_t *q = s; q < s + len - 2;)
-+ {
-+ int id = *q++;
-+ if (id & ~3) return fail(d, "unexpected Huffman table");
-+ int total = 0;
-+ for (int i = 0; i < 16; i++) total += q[i];
-+ if (!build_huff(&d->tables[id], q, q + 16, total)) return fail(d, "bad Huffman table");
-+ if (id + 1 > ntab) ntab = id + 1;
-+ q += 16 + total;
-+ }
-+ }
-+ else if (tag == 0xDD && (s[0] | s[1]))
-+ return fail(d, "unsupported RAW: restart markers");
-+ else if (tag == 0xDA)
-+ {
-+ d->psv = s[1 + s[0] * 2];
-+ d->bits -= s[3 + s[0] * 2] & 15;
-+ d->file_pos += p + 2 + len;
-+ if (!have_sof || !ntab) return fail(d, "RAW header incomplete");
-+ /* LibRaw's rule, which Canon follows: component c takes table c,
-+ * or the last one defined */
-+ for (int c = 0; c < 4; c++) d->huff[c] = &d->tables[c < ntab ? c : ntab - 1];
-+ /* the same table twice (the EOS M's): one copy, half the cache */
-+ for (int c = 1; c < 4; c++)
-+ if (d->huff[c] != d->huff[0] && !memcmp(d->huff[c], d->huff[0], sizeof(struct huff))) d->huff[c] = d->huff[0];
-+ if (d->clrs < 1 || d->clrs > 4 || d->bits < 8 || d->bits > 16) return fail(d, "unsupported RAW layout");
-+ if (d->psv != 1) return fail(d, "unsupported RAW predictor");
-+ return 1;
-+ }
-+ p += 2 + len;
-+ }
-+ return fail(d, "RAW header not found");
-+}
-+
-+/* the next chunk of the file after the keep bytes not yet used (at bp);
-+ * past the end, zeros. The JPEG's byte stuffing stays in: the bit reader
-+ * takes it out as it goes, rather than in a pass of its own. Returns the
-+ * buffer's length. */
-+static int refill(struct fos_dev *d, const uint8_t *bp, int keep)
-+{
-+ memmove(d->buf, bp, keep);
-+ int n = d->file_end - d->file_pos;
-+ if (n > CHUNK) n = CHUNK;
-+ if (n > 0 && fos_port_seek(d->f, d->file_pos) >= 0 && (n = fos_port_read(d->f, d->buf + keep, n)) > 0)
-+ d->file_pos += n;
-+ else
-+ {
-+ d->file_pos = d->file_end;
-+ n = 8;
-+ memset(d->buf + keep, 0, 8);
-+ }
-+ return keep + n;
-+}
-+
-+/* ---- the print's geometry: which raw rows and columns land where */
-+
-+static int setup_maps(struct fos_dev *d)
-+{
-+ d->raw_w = d->wide * d->clrs;
-+ d->raw_h = d->high;
-+ if (!(d->clrs & 1) && d->raw_w > 4 * d->raw_h)
-+ {
-+ /* some cameras store the sensor as a frame twice as wide and half
-+ * as high (as dcraw and LibRaw read it): the samples run the same */
-+ d->raw_w /= 2;
-+ d->raw_h *= 2;
-+ }
-+ if (d->slices[0] && d->slices[0] * d->slices[1] + d->slices[2] != d->raw_w)
-+ return fail(d, "RAW slices don't add up");
-+ if (d->crop_l < 0 || d->crop_l + d->crop_w > d->raw_w || d->crop_t + d->crop_h > d->raw_h || d->crop_w < 64)
-+ {
-+ /* no sensor info: the EOS M's picture area, scaled to this sensor */
-+ d->crop_l = d->raw_w * 84 / 5280; d->crop_t = d->raw_h * 64 / 3528;
-+ d->crop_w = d->raw_w - d->crop_l - d->raw_w * 12 / 5280;
-+ d->crop_h = d->raw_h - d->crop_t - d->raw_h * 8 / 3528;
-+ d->ob_l = 0; d->ob_r = d->crop_l - 12;
-+ }
-+ if (d->ob_r - d->ob_l < 16)
-+ {
-+ /* No black mask given (the EOS M gives none): the masked columns
-+ * left of the picture, well clear of it. The picture area Canon
-+ * names starts at 84, but light already reaches column 72. */
-+ d->ob_l = 0; d->ob_r = d->crop_l - 1;
-+ }
-+ if (d->ob_r > d->crop_l - 20) d->ob_r = d->crop_l - 20;
-+ d->rphase = row_phase(d->raw_w, d->raw_h);
-+ int portrait = d->orient == 6 || d->orient == 8;
-+ d->rows_axis_x = portrait;
-+ d->oh = FOS_PRINT_H;
-+ d->ow = portrait ? FOS_PRINT_H * FOS_PRINT_H / FOS_PRINT_W : FOS_PRINT_W;
-+ d->ox0 = (FOS_PRINT_W - d->ow) / 2;
-+
-+ d->rowoff = fos_port_alloc(d->raw_h * 4);
-+ d->seg_of = fos_port_alloc(d->raw_w * 2);
-+ d->seg_x0 = fos_port_alloc((FOS_PRINT_W + 1) * 2);
-+ d->seg_off = fos_port_alloc(FOS_PRINT_W * 4);
-+ d->rowob = fos_port_alloc(d->raw_h);
-+ d->colob = fos_port_alloc(d->raw_w);
-+ d->ne_r = fos_port_alloc(FOS_PRINT_W * 2 * 2);
-+ d->ne_c = fos_port_alloc(FOS_PRINT_W * 2 * 2);
-+ if (!d->rowoff || !d->seg_of || !d->seg_x0 || !d->seg_off || !d->rowob || !d->colob || !d->ne_r || !d->ne_c)
-+ return fail_mem(d, d->raw_w * 10 + d->raw_h * 5);
-+ d->no_r = d->ne_r + FOS_PRINT_W;
-+ d->no_c = d->ne_c + FOS_PRINT_W;
-+ memset(d->ne_r, 0, FOS_PRINT_W * 4);
-+ memset(d->ne_c, 0, FOS_PRINT_W * 4);
-+
-+ /* raw rows: across the picture's height (landscape) or width (portrait) */
-+ int rlen = portrait ? d->ow : d->oh, clen = portrait ? d->oh : d->ow;
-+ int rflip = d->orient == 6 || d->orient == 3, cflip = d->orient == 8 || d->orient == 3;
-+ const int32_t OUT = -1;
-+ for (int y = 0; y < d->raw_h; y++)
-+ {
-+ int a = y - d->crop_t;
-+ d->rowob[y] = a >= 0 && a < d->crop_h;
-+ if (a < 0 || a >= d->crop_h) { d->rowoff[y] = OUT; continue; }
-+ int o = (int) ((long) a * rlen / d->crop_h);
-+ if (rflip) o = rlen - 1 - o;
-+ if ((y ^ d->rphase) & 1) d->no_r[o]++; else d->ne_r[o]++;
-+ d->rowoff[y] = 3 * (portrait ? d->ox0 + o : o * FOS_PRINT_W);
-+ }
-+ /* raw columns: segment k of them (in raw order) makes print line o */
-+ for (int k = 0; k <= clen; k++) d->seg_x0[k] = (uint16_t) d->crop_w;
-+ for (int x = 0; x < d->raw_w; x++)
-+ {
-+ int a = x - d->crop_l;
-+ d->colob[x] = x >= d->ob_l + 4 && x <= d->ob_r - 4;
-+ d->seg_of[x] = 0;
-+ if (a < 0 || a >= d->crop_w) continue;
-+ int k = (int) ((long) a * clen / d->crop_w);
-+ if (d->seg_x0[k] > a) d->seg_x0[k] = (uint16_t) a;
-+ d->seg_of[x] = (uint16_t) k;
-+ int o = cflip ? clen - 1 - k : k;
-+ if (x & 1) d->no_c[o]++; else d->ne_c[o]++;
-+ d->seg_off[k] = 3 * (portrait ? o * FOS_PRINT_W : d->ox0 + o);
-+ }
-+ for (int k = 0; k <= clen; k++) d->seg_x0[k] = (uint16_t) (d->seg_x0[k] + d->crop_l);
-+ /* the segments' shapes, the same on every row, for sum_row: when the
-+ * samples fit word halves four times and every segment has two */
-+ if (d->bits <= 14 && d->crop_w >= 2 * clen && d->crop_w <= 32 * clen)
-+ {
-+ d->seg_desc = fos_port_alloc(4 * clen);
-+ d->desc_off = fos_port_alloc(4 * clen * 4);
-+ d->seg_piece = fos_port_alloc((clen + 1) * 4);
-+ if (!d->seg_desc || !d->desc_off || !d->seg_piece) return fail_mem(d, 24 * clen);
-+ int n = 0;
-+ for (int k = 0; k < clen; k++)
-+ {
-+ d->seg_piece[k] = n;
-+ int s0 = d->seg_x0[k], len = d->seg_x0[k + 1] - s0, odd = s0 & 1, pairs = (len - odd) >> 1;
-+ /* the even column after the pairs: worked out before odd is
-+ * cleared below, or a segment that starts on an odd column and
-+ * takes more than one piece (portrait) gets a column too many,
-+ * and the row's later pieces read one column off (on the camera,
-+ * words not on a word boundary: lines across the picture) */
-+ int tail = (len - odd) & 1;
-+ /* four pairs at most a piece; a longer segment (portrait) in more */
-+ do
-+ {
-+ int p = pairs < 4 ? pairs : 4;
-+ pairs -= p;
-+ d->seg_desc[n] = (uint8_t) (p | (!pairs && tail) << 6 | odd << 7);
-+ d->desc_off[n++] = d->seg_off[k];
-+ odd = 0;
-+ }
-+ while (pairs > 0);
-+ }
-+ d->seg_piece[clen] = n;
-+ }
-+
-+ d->sums = fos_port_alloc(FOS_PRINT_W * FOS_PRINT_H * 3 * 4);
-+ if (!d->sums) return fail_mem(d, FOS_PRINT_W * FOS_PRINT_H * 3 * 4);
-+ memset(d->sums, 0, FOS_PRINT_W * FOS_PRINT_H * 3 * 4);
-+ d->total = (long) d->raw_w * d->raw_h;
-+ d->sl = 0; d->sx = 0; d->sy = 0; d->sx0 = 0;
-+ d->sw = d->slices[0] ? d->slices[1] : d->raw_w;
-+ for (int c = 0; c < 4; c++) d->vpred[c] = 1 << (d->bits - 1);
-+ return 1;
-+}
-+
-+/* ---- decoding */
-+
-+/* a code longer than FAST_BITS, a bit at a time (vbits >= 16):
-+ * len << 8 | symbol, or 0 for a code that doesn't exist */
-+static int slow_symbol(const struct huff *h, uint32_t bitbuf, int vbits)
-+{
-+ int len = FAST_BITS;
-+ int code = (int) ((bitbuf >> (vbits - len)) & ((1 << len) - 1));
-+ while (len < 16 && code > h->maxcode[len])
-+ {
-+ len++;
-+ code = (int) ((bitbuf >> (vbits - len)) & ((1u << len) - 1));
-+ }
-+ if (code > h->maxcode[len]) return 0;
-+ return len << 8 | h->vals[h->valptr[len] + code - h->mincode[len]];
-+}
-+
-+typedef uint32_t __attribute__((may_alias)) word;
-+#ifdef FOS_ARM_UNALIGNED
-+/* devtest -DFOS_ARM_UNALIGNED: a word load the way ARMv5 does one off its
-+ * boundary (the aligned word, rotated), to find reads the PC gets right by luck */
-+static uint32_t arm_load(const word *p)
-+{
-+ uintptr_t a = (uintptr_t) p;
-+ uint32_t v = *(const word *) (a & ~(uintptr_t) 3);
-+ int r = (int) (a & 3) * 8;
-+ return r ? v >> r | v << (32 - r) : v;
-+}
-+#define LOADW(q, i) arm_load((q) + (i))
-+#else
-+#define LOADW(q, i) ((q)[i])
-+#endif
-+
-+/* a byte of w is 0xFF: a zero byte of ~w, (~w - 0x01010101) & w & 0x80808080,
-+ * and ~w - k is ~(w + k) */
-+#define FF_IN(w) ((w) & ~((w) + 0x01010101u))
-+
-+/* the first 0xFF at or after p, or be: the bytes before it are taken
-+ * without looking at each, sixteen at a time here */
-+static __attribute__((noinline)) const uint8_t *next_ff(const uint8_t *p, const uint8_t *be)
-+{
-+ for (; p < be && ((uintptr_t) p & 3); p++)
-+ if (*p == 0xFF) return p;
-+ for (; be - p >= 16; p += 16)
-+ {
-+ const word *q = (const word *) p;
-+ if ((FF_IN(q[0]) | FF_IN(q[1]) | FF_IN(q[2]) | FF_IN(q[3])) & 0x80808080u) break;
-+ }
-+ while (p < be && *p != 0xFF) p++;
-+ return p;
-+}
-+
-+/* The bit reader keeps its state in d between the decoder's calls, and in
-+ * registers in its loop, which hands it over to these for what is rare:
-+ * the buffer's end, the 0xFF bytes, codes longer than the one lookup. */
-+
-+/* at least 25 bits, the careful way: a stuffed 0xFF 0x00 is one 0xFF; any
-+ * other marker ends the data, and zeros follow. Then where the next 0xFF
-+ * is: below safe, the next three bytes are data in the buffer and no 0xFF. */
-+static __attribute__((noinline)) void fill(struct fos_dev *d)
-+{
-+ uint32_t bitbuf = d->bitbuf;
-+ int vbits = d->vbits;
-+ const uint8_t *bp = d->bp, *be = d->be, *ff = d->ff;
-+ while (vbits <= 24)
-+ {
-+ if (be - bp < 2)
-+ {
-+ int len = refill(d, bp, (int) (be - bp));
-+ bp = d->buf; be = bp + len;
-+ ff = 0;
-+ }
-+ uint32_t c = *bp++;
-+ if (c == 0xFF)
-+ {
-+ if (!*bp) bp++;
-+ else { c = 0; bp = be; d->file_pos = d->file_end; }
-+ }
-+ bitbuf = bitbuf << 8 | c;
-+ vbits += 8;
-+ }
-+ d->bitbuf = bitbuf; d->vbits = vbits;
-+ d->bp = bp; d->be = be;
-+ if (!ff || bp > ff)
-+ {
-+ d->ff = next_ff(bp, be);
-+ d->safe = d->ff - 2;
-+ }
-+}
-+
-+/* a difference the one lookup doesn't cover: the code, then its bits */
-+static __attribute__((noinline)) int slow_diff(struct fos_dev *d, const struct huff *h)
-+{
-+ fill(d);
-+ int e = h->fast[(d->bitbuf >> (d->vbits - FAST_BITS)) & ((1 << FAST_BITS) - 1)];
-+ if (!e) e = slow_symbol(h, d->bitbuf, d->vbits);
-+ d->vbits -= e >> 8;
-+ int s = e & 0xFF, diff = 0;
-+ if (s == 16) diff = -32768;
-+ else if (s)
-+ {
-+ if (d->vbits < s) fill(d);
-+ d->vbits -= s;
-+ diff = (int) ((d->bitbuf >> d->vbits) & ((1u << s) - 1));
-+ if (!(diff >> (s - 1))) diff -= (1 << s) - 1;
-+ }
-+ fill(d);
-+ return diff;
-+}
-+
-+#define LOAD() (bitbuf = d->bitbuf, vbits = d->vbits, bp = d->bp, safe = d->safe)
-+#define SAVE() (d->bitbuf = bitbuf, d->vbits = vbits, d->bp = bp)
-+
-+/* at least 24 bits: two short codes' worth */
-+#define FILL() \
-+ do \
-+ { \
-+ if (__builtin_expect(bp < safe, 1)) \
-+ { \
-+ if (vbits <= 16) { bitbuf = bitbuf << 16 | (uint32_t) bp[0] << 8 | bp[1]; bp += 2; vbits += 16; } \
-+ if (vbits <= 24) { bitbuf = bitbuf << 8 | *bp++; vbits += 8; } \
-+ } \
-+ else { SAVE(); fill(d); LOAD(); } \
-+ } while (0)
-+
-+/* a difference from table h (its lookup t, read at the byte offset the
-+ * mask leaves); bitbuf must hold DIFF_BITS + 1:
-+ * the code and its bits in one lookup, as nearly always (99.8 % on the
-+ * EOS M's files) */
-+#define DIFF_OR(t, h, diff, also) \
-+ do \
-+ { \
-+ diff = *(const int16_t *) ((const uint8_t *) (t) + ((bitbuf >> (vbits - DIFF_BITS - 1)) & ((2 << DIFF_BITS) - 2))); \
-+ if (__builtin_expect(diff & 15, 1)) { vbits -= diff & 15; diff >>= 4; } \
-+ else { SAVE(); diff = slow_diff(d, h); LOAD(); also; } \
-+ } while (0)
-+#define DIFF(t, h, diff) DIFF_OR(t, h, diff, (void) 0)
-+
-+/* n pairs of the two components (the EOS M's layout), each from the one
-+ * to its left: on its own, so all it works with stays in registers */
-+static __attribute__((noinline)) void pairs(struct fos_dev *d, uint16_t *out, int n)
-+{
-+ const struct huff *h0 = d->huff[0], *h1 = d->huff[1];
-+ const int16_t *t0 = h0->fastd, *t1 = h1->fastd;
-+ uint32_t bitbuf;
-+ int vbits;
-+ const uint8_t *bp, *safe;
-+ LOAD();
-+ int p0 = out[-2], p1 = out[-1], diff;
-+ uint16_t *stop = out + 2 * n;
-+ while (out < stop)
-+ {
-+ /* a pair takes three bytes at most: as many as safe leaves room
-+ * for, without looking (until a long code, which reads on) */
-+ int room = (int) (safe - bp) >> 2, left = (int) (stop - out) >> 1;
-+ if (room <= 0)
-+ {
-+ FILL();
-+ DIFF(t0, h0, diff); p0 += diff; out[0] = (uint16_t) p0;
-+ DIFF(t1, h1, diff); p1 += diff; out[1] = (uint16_t) p1;
-+ out += 2;
-+ continue;
-+ }
-+ uint16_t *block = out + 2 * (room < left ? room : left);
-+ for (; out < block; out += 2)
-+ {
-+ if (vbits <= 16) { bitbuf = bitbuf << 16 | (uint32_t) bp[0] << 8 | bp[1]; bp += 2; vbits += 16; }
-+ if (vbits <= 24) { bitbuf = bitbuf << 8 | *bp++; vbits += 8; }
-+ DIFF_OR(t0, h0, diff, block = out + 2); p0 += diff; out[0] = (uint16_t) p0;
-+ DIFF_OR(t1, h1, diff, block = out + 2); p1 += diff; out[1] = (uint16_t) p1;
-+ }
-+ }
-+ SAVE();
-+}
-+
-+/* the next count samples of the lossless JPEG into out[0..count-1];
-+ * out[-clrs..-1] hold the ones before */
-+static __attribute__((noinline)) void unpack(struct fos_dev *d, uint16_t *out, int count)
-+{
-+ const int clrs = d->clrs, wide = d->wide;
-+ uint32_t bitbuf;
-+ int vbits;
-+ const uint8_t *bp, *safe;
-+ int comp = d->comp, jcol = d->jcol;
-+ uint16_t *end = out + count;
-+ while (out < end)
-+ {
-+ int diff;
-+ if (jcol && !comp && end - out >= clrs && (clrs == 2 || clrs == 4))
-+ {
-+ /* whole groups of the components, each from the one to its
-+ * left, kept in registers */
-+ int n = wide - jcol;
-+ if (n > (int) (end - out) / clrs) n = (int) (end - out) / clrs;
-+ jcol += n;
-+ if (jcol == wide) jcol = 0;
-+ if (clrs == 2)
-+ {
-+ pairs(d, out, n);
-+ out += 2 * n;
-+ }
-+ else
-+ {
-+ const struct huff *h0 = d->huff[0], *h1 = d->huff[1], *h2 = d->huff[2], *h3 = d->huff[3];
-+ uint16_t *stop = out + 4 * n;
-+ int p0 = out[-4], p1 = out[-3], p2 = out[-2], p3 = out[-1];
-+ LOAD();
-+ for (; out < stop; out += 4)
-+ {
-+ FILL();
-+ DIFF(h0->fastd, h0, diff); p0 += diff; out[0] = (uint16_t) p0;
-+ DIFF(h1->fastd, h1, diff); p1 += diff; out[1] = (uint16_t) p1;
-+ FILL();
-+ DIFF(h2->fastd, h2, diff); p2 += diff; out[2] = (uint16_t) p2;
-+ DIFF(h3->fastd, h3, diff); p3 += diff; out[3] = (uint16_t) p3;
-+ }
-+ SAVE();
-+ }
-+ continue;
-+ }
-+ /* one at a time: a row's first group (predicted from above), odd
-+ * layouts, the ends of the count */
-+ const struct huff *h = d->huff[comp];
-+ LOAD();
-+ FILL();
-+ DIFF(h->fastd, h, diff);
-+ SAVE();
-+ if (jcol) *out = (uint16_t) (out[-clrs] + diff);
-+ else *out = (uint16_t) (d->vpred[comp] += diff);
-+ out++;
-+ if (++comp == clrs)
-+ {
-+ comp = 0;
-+ if (++jcol == wide) jcol = 0;
-+ }
-+ }
-+ d->comp = comp; d->jcol = jcol;
-+}
-+
-+/* a raw row's samples v..vend-1 into its print pixels: segment by segment
-+ * (next: where the next starts, at[] the sample of a column; off: where
-+ * the segment goes in row), its even and odd columns apart */
-+static __attribute__((noinline)) void sum_samples(const uint16_t *at, const uint16_t *v, const uint16_t *vend,
-+ const uint16_t *next, const int32_t *off, uint32_t *row)
-+{
-+ while (v < vend)
-+ {
-+ const uint16_t *ve = at + *next++;
-+ if (ve > vend) ve = vend;
-+ uint32_t a = 0, b = 0;
-+ if ((v - at) & 1) b = *v++;
-+ for (; ve - v >= 2; v += 2) { a += v[0]; b += v[1]; }
-+ if (v < ve) a += *v++;
-+ uint32_t *p = row + *off++;
-+ p[0] += a;
-+ p[1] += b;
-+ }
-+}
-+
-+/* a whole row of the picture the same way, in the pieces seg_desc gives
-+ * (n of them; off: where each goes in row), with the even columns 4-byte
-+ * aligned: a pair of samples as one word, and up to four pairs of 14 bits
-+ * summed in its halves */
-+static __attribute__((noinline)) void sum_row(const uint16_t *v, const uint8_t *desc, int n, const int32_t *off, uint32_t *row)
-+{
-+ for (const uint8_t *e = desc + n; desc < e; desc++, off++)
-+ {
-+ int k = *desc;
-+ uint32_t b = 0;
-+ if (k & 0x80) b = *v++;
-+ const word *q = (const word *) v;
-+ uint32_t w = 0;
-+ switch (k & 7)
-+ {
-+ case 4: w += LOADW(q, 3); /* fall through */
-+ case 3: w += LOADW(q, 2); /* fall through */
-+ case 2: w += LOADW(q, 1); /* fall through */
-+ case 1: w += LOADW(q, 0); /* fall through */
-+ default: break;
-+ }
-+ v += 2 * (k & 7);
-+ uint32_t a = w & 0xFFFF;
-+ if (k & 0x40) a += *v++;
-+ uint32_t *p = row + *off;
-+ p[0] += a;
-+ p[1] += b + (w >> 16);
-+ }
-+}
-+
-+/* count samples to where they fall in the print, slice by slice, top to
-+ * bottom: a print pixel's run of samples along a raw row is summed in
-+ * registers, even and odd columns (two colours of the mosaic) apart, and
-+ * added once. The masked columns left of the picture give the black. */
-+static __attribute__((noinline)) void scatter(struct fos_dev *d, const uint16_t *src, int n)
-+{
-+ uint32_t *sums = d->sums;
-+ const uint16_t *seg_x0 = d->seg_x0, *seg_of = d->seg_of;
-+ const int32_t *seg_off = d->seg_off;
-+ const uint8_t *colob = d->colob;
-+ const int pic0 = d->crop_l, pic1 = d->crop_l + d->crop_w;
-+ const uint8_t *desc = d->seg_desc;
-+ int sx = d->sx, sy = d->sy, sw = d->sw, sx0 = d->sx0;
-+ const int rphase = d->rphase;
-+ int64_t black_sum = d->black_sum;
-+ long black_n = d->black_n;
-+ while (n > 0)
-+ {
-+ int run = sw - sx < n ? sw - sx : n;
-+ n -= run;
-+ const int ro = d->rowoff[sy];
-+#ifdef FOS_DEV_TEST
-+ for (int k = 0; k < run; k++) fos_dev_test_sample(sx0 + sx + k, sy, src[k]);
-+#endif
-+ if (ro >= 0)
-+ {
-+ const int x0 = sx0 + sx, x1 = x0 + run;
-+ const int pa = x0 > pic0 ? x0 : pic0, pb = x1 < pic1 ? x1 : pic1;
-+ for (int x = x0; x < x1 && x < pa; x++)
-+ if (colob[x]) { black_sum += src[x - x0]; black_n++; }
-+ if (pa < pb)
-+ {
-+ /* sample of raw column x at at[x]; RG rows then GB rows
-+ * (row_phase), the even columns' colour then the odd ones' */
-+ const uint16_t *at = src - x0;
-+ uint32_t *row = sums + ro + ((sy ^ rphase) & 1);
-+ /* the segments it touches, and those it has whole (a row
-+ * of the picture is in two of Canon's slices) */
-+ int k0 = seg_of[pa], k1 = seg_of[pb - 1] + 1;
-+ int w0 = seg_x0[k0] < pa ? k0 + 1 : k0, w1 = seg_x0[k1] > pb ? k1 - 1 : k1;
-+ if (!desc || ((uintptr_t) at & 3) || w0 >= w1)
-+ sum_samples(at, at + pa, at + pb, seg_x0 + k0 + 1, seg_off + k0, row);
-+ else
-+ {
-+ if (w0 > k0) sum_samples(at, at + pa, at + seg_x0[w0], seg_x0 + k0 + 1, seg_off + k0, row);
-+ const int i0 = d->seg_piece[w0];
-+ sum_row(at + seg_x0[w0], desc + i0, d->seg_piece[w1] - i0, d->desc_off + i0, row);
-+ if (w1 < k1) sum_samples(at, at + seg_x0[w1], at + pb, seg_x0 + w1 + 1, seg_off + w1, row);
-+ }
-+ }
-+ }
-+ src += run;
-+ sx += run;
-+ if (sx == sw)
-+ {
-+ sx = 0;
-+ if (++sy == d->raw_h)
-+ {
-+ sy = 0;
-+ sx0 += sw;
-+ d->sl++;
-+ sw = d->sl < d->slices[0] ? d->slices[1] : d->slices[2];
-+ }
-+ }
-+ }
-+ d->sx = sx; d->sy = sy; d->sw = sw; d->sx0 = sx0;
-+ d->black_sum = black_sum; d->black_n = black_n;
-+}
-+
-+/* decode about n samples straight into the print's sums */
-+static void decode(struct fos_dev *d, long n)
-+{
-+ uint16_t *s = d->samples + 4;
-+ while (n > 0 && d->done < d->total)
-+ {
-+ /* to the end of a raw row, so scatter has it whole */
-+ int k = d->sw - d->sx;
-+ if (k > UNPACK) k = UNPACK;
-+ if (k > d->total - d->done) k = (int) (d->total - d->done);
-+ unpack(d, s, k);
-+ scatter(d, s, k);
-+ /* the last of each component, for the next ones' prediction */
-+ memmove(s - d->clrs, s + k - d->clrs, d->clrs * 2);
-+ d->done += k;
-+ n -= k;
-+ }
-+}
-+
-+/* ---- finishing */
-+
-+/* 65536 / n for the samples a print pixel's channel got. A portrait print
-+ * pixel takes about 12 x 12 raw samples on a full-frame sensor (5D Mark III,
-+ * 6D, 5D Mark II), so green gets up to 98 of them: with room for only 63
-+ * here green came out black and the print purple. (sums <= 16383 n, and
-+ * 65536 / n of them still fits 32 bits for any n.) */
-+#define NMAX 256
-+static uint32_t recip[NMAX];
-+
-+/* scene-linear sRGB of print pixel i (4096 = 1.0), clipped as the lab's
-+ * RAW converter does, times d->mul; 0 where the picture isn't */
-+FOS_INLINE void pixel_linear(const struct fos_dev *d, int x, int y, int lin[3])
-+{
-+ int i = y * FOS_PRINT_W + x;
-+ int xr, xc; /* print line fed by raw rows / columns */
-+ if (d->rows_axis_x) { xr = x - d->ox0; xc = y; if (xr < 0 || xr >= d->ow) { lin[0] = lin[1] = lin[2] = 0; return; } }
-+ else { xr = y; xc = x; }
-+ int er = d->ne_r[xr], or_ = d->no_r[xr], ec = d->ne_c[xc], oc = d->no_c[xc];
-+ int n[3] = { er * ec, er * oc + or_ * ec, or_ * oc };
-+ int cam[3];
-+ for (int c = 0; c < 3; c++)
-+ {
-+ /* the mean (sums <= 16383 n, so this fits), less black, balanced */
-+ int m = n[c] < NMAX ? (int) (d->sums[3 * i + c] * recip[n[c]] >> 12) - d->black16 : 0;
-+ int v = m > 0 ? (int) (((int64_t) m * d->pre[c]) >> 14) : 0;
-+ cam[c] = v < 0 ? 0 : v > 4096 ? 4096 : v;
-+ }
-+ for (int c = 0; c < 3; c++)
-+ {
-+ int v = (d->mat[c][0] * cam[0] + d->mat[c][1] * cam[1] + d->mat[c][2] * cam[2]) >> 12;
-+ v = v < 0 ? 0 : v > 4096 ? 4096 : v;
-+ v = (v * d->mul[c]) >> 12;
-+ lin[c] = v > 65535 ? 65535 : v;
-+ }
-+}
-+
-+/* camera -> sRGB with daylight balance, and the black and white levels */
-+static void setup_colour(struct fos_dev *d)
-+{
-+ float cam_rgb[3][3], pre[3];
-+ for (int i = 0; i < 3; i++)
-+ {
-+ float sum = 0;
-+ for (int j = 0; j < 3; j++)
-+ {
-+ cam_rgb[i][j] = 0;
-+ for (int k = 0; k < 3; k++) cam_rgb[i][j] += XYZ_CAM[i][k] * RGB_XYZ[k][j];
-+ sum += cam_rgb[i][j];
-+ }
-+ for (int j = 0; j < 3; j++) cam_rgb[i][j] /= sum;
-+ pre[i] = 1 / sum;
-+ }
-+ float green = pre[1];
-+ for (int i = 0; i < 3; i++) pre[i] /= green;
-+ /* rgb_cam = inverse(cam_rgb) */
-+ float (*m)[3] = cam_rgb, inv[3][3];
-+ float det = m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
-+ + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
-+ inv[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / det;
-+ inv[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / det;
-+ inv[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / det;
-+ inv[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / det;
-+ inv[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / det;
-+ inv[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / det;
-+ inv[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / det;
-+ inv[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / det;
-+ inv[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / det;
-+
-+ float black = d->black_n ? (float) d->black_sum / (float) d->black_n : 2048;
-+ if (black < 0 || black > WHITE_LEVEL / 2) black = 2048; /* a damaged file */
-+ d->black16 = (int) (black * 16 + 0.5f);
-+ /* raw/16 above black -> 4096 at the white level, balanced, << 14 */
-+ for (int c = 0; c < 3; c++)
-+ {
-+ d->pre[c] = (int) (pre[c] * 4096 * 16384 / ((WHITE_LEVEL - black) * 16) + 0.5f);
-+ d->mul[c] = 4096;
-+ for (int j = 0; j < 3; j++) d->mat[c][j] = (int) (inv[c][j] * 4096 + (inv[c][j] < 0 ? -0.5f : 0.5f));
-+ }
-+ for (int k = 1; k < NMAX; k++) recip[k] = 65536 / k;
-+}
-+
-+/* small, fast noise */
-+FOS_INLINE int rnd(unsigned *s)
-+{
-+ *s = *s * 1664525u + 1013904223u;
-+ return (int) (*s >> 16 & 0xFFFF) - 32768;
-+}
-+
-+/* ---------------------------------------------------------------- palette */
-+
-+/* median cut over a 5-5-5 histogram (struct box: with struct fos_dev) */
-+
-+static void box_shrink(const uint32_t *hist, struct box *b)
-+{
-+ int lo[3] = { 31, 31, 31 }, hi[3] = { 0, 0, 0 };
-+ long count = 0;
-+ for (int r = b->lo[0]; r <= b->hi[0]; r++)
-+ for (int g = b->lo[1]; g <= b->hi[1]; g++)
-+ for (int bl = b->lo[2]; bl <= b->hi[2]; bl++)
-+ {
-+ uint32_t n = hist[r << 10 | g << 5 | bl];
-+ if (!n) continue;
-+ count += n;
-+ if (r < lo[0]) lo[0] = r;
-+ if (r > hi[0]) hi[0] = r;
-+ if (g < lo[1]) lo[1] = g;
-+ if (g > hi[1]) hi[1] = g;
-+ if (bl < lo[2]) lo[2] = bl;
-+ if (bl > hi[2]) hi[2] = bl;
-+ }
-+ if (count) { memcpy(b->lo, lo, sizeof(lo)); memcpy(b->hi, hi, sizeof(hi)); }
-+ b->count = count;
-+}
-+
-+static void median_cut(struct fos_dev *d)
-+{
-+ struct box *boxes = d->boxes;
-+ int n = 1;
-+ boxes[0].lo[0] = boxes[0].lo[1] = boxes[0].lo[2] = 0;
-+ boxes[0].hi[0] = boxes[0].hi[1] = boxes[0].hi[2] = 31;
-+ box_shrink(d->hist, &boxes[0]);
-+ while (n < FOS_PRINT_COLOURS)
-+ {
-+ /* the box with the most pixels that can still be split, weighted
-+ * by its size so big smooth areas get their share */
-+ int best = -1;
-+ long best_score = 0;
-+ for (int i = 0; i < n; i++)
-+ {
-+ struct box *b = &boxes[i];
-+ int span = 0;
-+ for (int c = 0; c < 3; c++) if (b->hi[c] - b->lo[c] > span) span = b->hi[c] - b->lo[c];
-+ if (!span) continue;
-+ long score = b->count * (span + 1);
-+ if (score > best_score) { best_score = score; best = i; }
-+ }
-+ if (best < 0) break;
-+ struct box *b = &boxes[best];
-+ int axis = 0, span = -1;
-+ for (int c = 0; c < 3; c++) if (b->hi[c] - b->lo[c] > span) { span = b->hi[c] - b->lo[c]; axis = c; }
-+ /* the median along that axis */
-+ long half = b->count / 2, acc = 0;
-+ int cut = b->lo[axis];
-+ for (int v = b->lo[axis]; v < b->hi[axis]; v++)
-+ {
-+ int lo[3] = { b->lo[0], b->lo[1], b->lo[2] }, hi[3] = { b->hi[0], b->hi[1], b->hi[2] };
-+ lo[axis] = hi[axis] = v;
-+ for (int r = lo[0]; r <= hi[0]; r++)
-+ for (int g = lo[1]; g <= hi[1]; g++)
-+ for (int bl = lo[2]; bl <= hi[2]; bl++)
-+ acc += d->hist[r << 10 | g << 5 | bl];
-+ cut = v;
-+ if (acc >= half) break;
-+ }
-+ struct box nb = *b;
-+ b->hi[axis] = cut;
-+ nb.lo[axis] = cut + 1;
-+ box_shrink(d->hist, b);
-+ box_shrink(d->hist, &nb);
-+ boxes[n++] = nb;
-+ }
-+ /* each box's colour: the mean of its pixels */
-+ d->npal = n;
-+ for (int i = 0; i < n; i++)
-+ {
-+ const struct box *b = &boxes[i];
-+ int64_t s[3] = { 0, 0, 0 }, cnt = 0;
-+ for (int r = b->lo[0]; r <= b->hi[0]; r++)
-+ for (int g = b->lo[1]; g <= b->hi[1]; g++)
-+ for (int bl = b->lo[2]; bl <= b->hi[2]; bl++)
-+ {
-+ uint32_t k = d->hist[r << 10 | g << 5 | bl];
-+ s[0] += (int64_t) k * (r * 8 + 4); s[1] += (int64_t) k * (g * 8 + 4); s[2] += (int64_t) k * (bl * 8 + 4);
-+ cnt += k;
-+ }
-+ for (int c = 0; c < 3; c++)
-+ d->pal[i][c] = (uint8_t) (cnt ? (s[c] + cnt / 2) / cnt : 0);
-+ }
-+}
-+
-+/* the palette in order of green, to search outwards from the nearest
-+ * green and stop once green alone is further than the best so far */
-+static void sort_palette(struct fos_dev *d)
-+{
-+ uint8_t *by_green = d->by_green;
-+ for (int i = 0; i < d->npal; i++)
-+ {
-+ int j = i;
-+ for (; j > 0 && d->pal[by_green[j - 1]][1] > d->pal[i][1]; j--) by_green[j] = by_green[j - 1];
-+ by_green[j] = (uint8_t) i;
-+ }
-+}
-+
-+/* the nearest palette entry for a 5-5-5 cell, worked out when first needed */
-+static __attribute__((noinline)) int nearest(struct fos_dev *d, int cell)
-+{
-+ int v = d->inv[cell];
-+ if (v) return v - 1;
-+ int r = (cell >> 10) * 8 + 4, g = (cell >> 5 & 31) * 8 + 4, b = (cell & 31) * 8 + 4;
-+ const uint8_t *by_green = d->by_green;
-+ int lo = 0, hi = d->npal;
-+ while (lo < hi)
-+ {
-+ int mid = (lo + hi) >> 1;
-+ if (d->pal[by_green[mid]][1] < g) lo = mid + 1; else hi = mid;
-+ }
-+ int best = by_green[lo < d->npal ? lo : d->npal - 1], bd = 1 << 30;
-+ for (int up = lo, down = lo - 1; up < d->npal || down >= 0; )
-+ {
-+ int done = 1;
-+ if (up < d->npal)
-+ {
-+ const uint8_t *p = d->pal[by_green[up]];
-+ int dg = p[1] - g;
-+ if (4 * dg * dg < bd)
-+ {
-+ int dr = r - p[0], db = b - p[2], dd = 3 * dr * dr + 4 * dg * dg + 2 * db * db;
-+ if (dd < bd) { bd = dd; best = by_green[up]; }
-+ up++;
-+ done = 0;
-+ }
-+ else up = d->npal;
-+ }
-+ if (down >= 0)
-+ {
-+ const uint8_t *p = d->pal[by_green[down]];
-+ int dg = g - p[1];
-+ if (4 * dg * dg < bd)
-+ {
-+ int dr = r - p[0], db = b - p[2], dd = 3 * dr * dr + 4 * dg * dg + 2 * db * db;
-+ if (dd < bd) { bd = dd; best = by_green[down]; }
-+ down--;
-+ done = 0;
-+ }
-+ else down = -1;
-+ }
-+ if (done) break;
-+ }
-+ d->inv[cell] = (uint8_t) (best + 1);
-+ return best;
-+}
-+
-+/* ---------------------------------------------------------------- files */
-+
-+
-+static int write_print(const char *path, int film, int frame, const char *when, const char *fstop,
-+ const uint8_t pal[][3], int npal, const uint8_t *px, const uint8_t *thumb, int x0, int w)
-+{
-+ static uint8_t h[FOS_BMP_PIXELS];
-+ memset(h, 0, sizeof(h));
-+ h[0] = 'B'; h[1] = 'M';
-+ put32(h + 2, FOS_BMP_SIZE);
-+ put32(h + 10, FOS_BMP_PIXELS);
-+ put32(h + 14, 40);
-+ put32(h + 18, FOS_PRINT_W);
-+ put32(h + 22, (uint32_t) -FOS_PRINT_H); /* top-down */
-+ h[26] = 1; h[28] = 8;
-+ put32(h + 34, FOS_PRINT_W * FOS_PRINT_H);
-+ put32(h + 38, 2835); put32(h + 42, 2835); /* 72 dpi */
-+ put32(h + 46, 256);
-+ for (int i = 0; i < npal && i < FOS_PRINT_COLOURS; i++)
-+ {
-+ uint8_t *q = h + FOS_BMP_PAL + 4 * (i + 1);
-+ q[0] = pal[i][2]; q[1] = pal[i][1]; q[2] = pal[i][0];
-+ }
-+ uint8_t *m = h + FOS_BMP_META;
-+ memcpy(m, "FOP2", 4);
-+ m[4] = (uint8_t) film;
-+ m[6] = (uint8_t) frame; m[7] = (uint8_t) (frame >> 8);
-+ if (when) memcpy(m + 8, when, strlen(when) < 19 ? strlen(when) : 19);
-+ if (fstop) memcpy(m + 28, fstop, strlen(fstop) < 7 ? strlen(fstop) : 7);
-+ m[36] = (uint8_t) x0; m[37] = (uint8_t) (x0 >> 8); /* the picture's columns */
-+ m[38] = (uint8_t) w; m[39] = (uint8_t) (w >> 8);
-+
-+ void *f = fos_port_open(path, 1);
-+ if (!f) return 0;
-+ int ok = fos_port_write(f, h, FOS_BMP_PIXELS) == FOS_BMP_PIXELS
-+ && fos_port_write(f, px, FOS_PRINT_W * FOS_PRINT_H) == FOS_PRINT_W * FOS_PRINT_H
-+ && fos_port_write(f, thumb, FOS_THUMB_SIZE) == FOS_THUMB_SIZE;
-+ fos_port_close(f);
-+ return ok;
-+}
-+
-+/* ---------------------------------------------------------------- quantize an RGB print */
-+
-+/* histogram, palette, error diffusion: rows y0..y1-1 of the dithering per
-+ * call (the histogram and palette when y0 == 0) */
-+static int quant_alloc(struct fos_dev *d)
-+{
-+ d->hist = fos_port_alloc(32768 * 4);
-+ d->inv = fos_port_alloc(32768);
-+ d->err_rows = fos_port_alloc((FOS_PRINT_W + 2) * 3 * 2 * 2);
-+ if (!d->idx) d->idx = fos_port_alloc(FOS_PRINT_W * FOS_PRINT_H);
-+ if (!d->hist || !d->inv || !d->err_rows || !d->idx) return 0;
-+ memset(d->hist, 0, 32768 * 4);
-+ memset(d->inv, 0, 32768);
-+ memset(d->err_rows, 0, (FOS_PRINT_W + 2) * 3 * 2 * 2);
-+ for (int i = 0; i < FOS_PRINT_W * FOS_PRINT_H; i++)
-+ {
-+ const uint8_t *p = d->rgb + 3 * i;
-+ d->hist[(p[0] >> 3) << 10 | (p[1] >> 3) << 5 | p[2] >> 3]++;
-+ }
-+ median_cut(d);
-+ sort_palette(d);
-+ return 1;
-+}
-+
-+static __attribute__((noinline)) void dither_rows(struct fos_dev *d, int y0, int y1)
-+{
-+ const int W = FOS_PRINT_W;
-+ const uint8_t *inv = d->inv;
-+ const uint8_t (*pal)[3] = d->pal;
-+ for (int y = y0; y < y1; y++)
-+ {
-+ /* serpentine: every other row right to left */
-+ const int dir = y & 1 ? -1 : 1, st = 3 * dir;
-+ int16_t *cur = d->err_rows + ((y & 1) ? (W + 2) * 3 : 0);
-+ int16_t *nxt = d->err_rows + ((y & 1) ? 0 : (W + 2) * 3);
-+ memset(nxt, 0, (W + 2) * 3 * 2);
-+ const int x = dir > 0 ? 0 : W - 1;
-+ const uint8_t *p = d->rgb + 3 * (y * W + x);
-+ uint8_t *o = d->idx + y * W + x;
-+ int16_t *c = cur + (x + 1) * 3, *n = nxt + (x + 1) * 3;
-+ for (int k = 0; k < W; k++, p += st, o += dir, c += st, n += st)
-+ {
-+ int r = p[0] + (c[0] >> 4), g = p[1] + (c[1] >> 4), b = p[2] + (c[2] >> 4);
-+ r = r < 0 ? 0 : r > 255 ? 255 : r;
-+ g = g < 0 ? 0 : g > 255 ? 255 : g;
-+ b = b < 0 ? 0 : b > 255 ? 255 : b;
-+ int cell = (r >> 3) << 10 | (g >> 3) << 5 | b >> 3;
-+ int i = inv[cell] ? inv[cell] - 1 : nearest(d, cell);
-+ *o = (uint8_t) (i + 1);
-+ const uint8_t *q = pal[i];
-+ /* Floyd-Steinberg, in 1/16 */
-+ int e = r - q[0];
-+ c[st] = (int16_t) (c[st] + e * 7); n[-st] = (int16_t) (n[-st] + e * 3); n[0] = (int16_t) (n[0] + e * 5); n[st] = (int16_t) (n[st] + e);
-+ e = g - q[1];
-+ c[st + 1] = (int16_t) (c[st + 1] + e * 7); n[1 - st] = (int16_t) (n[1 - st] + e * 3); n[1] = (int16_t) (n[1] + e * 5); n[st + 1] = (int16_t) (n[st + 1] + e);
-+ e = b - q[2];
-+ c[st + 2] = (int16_t) (c[st + 2] + e * 7); n[2 - st] = (int16_t) (n[2 - st] + e * 3); n[2] = (int16_t) (n[2] + e * 5); n[st + 2] = (int16_t) (n[st + 2] + e);
-+ }
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- one frame */
-+
-+struct fos_dev *fos_dev_start(const char *cr2, const char *print, int film, int frame,
-+ const char *when, const char *fstop)
-+{
-+ struct fos_dev *d = fos_port_alloc(sizeof(struct fos_dev));
-+ if (!d) return 0;
-+ memset(d, 0, sizeof(*d));
-+ snprintf(d->cr2, sizeof(d->cr2), "%s", cr2);
-+ snprintf(d->print, sizeof(d->print), "%s", print);
-+ snprintf(d->when, sizeof(d->when), "%s", when ? when : "");
-+ snprintf(d->fstop, sizeof(d->fstop), "%s", fstop ? fstop : "");
-+ d->film = fos_clamp(film, 0, fos_nfilms - 1);
-+ d->frame = frame;
-+ d->look = fos_look_of(fos_films[d->film].key);
-+ d->seed = 12345u + (unsigned) frame * 7919u;
-+ d->stage = ST_OPEN;
-+ return d;
-+}
-+
-+void fos_dev_jpeg(struct fos_dev *d, const char *path)
-+{
-+ if (d) snprintf(d->jpeg, sizeof(d->jpeg), "%s", path ? path : "");
-+}
-+
-+void fos_dev_free(struct fos_dev *d)
-+{
-+ if (!d) return;
-+ if (d->f) fos_port_close(d->f);
-+ fos_port_free(d->buf); fos_port_free(d->rowoff); fos_port_free(d->seg_of);
-+ fos_port_free(d->seg_x0); fos_port_free(d->seg_off); fos_port_free(d->seg_desc); fos_port_free(d->desc_off); fos_port_free(d->seg_piece);
-+ fos_port_free(d->rowob); fos_port_free(d->colob); fos_port_free(d->ne_r); fos_port_free(d->ne_c);
-+ fos_port_free(d->sums); fos_port_free(d->glow); fos_port_free(d->rgb);
-+ fos_port_free(d->hist); fos_port_free(d->inv); fos_port_free(d->err_rows); fos_port_free(d->idx);
-+ fos_port_free(d);
-+}
-+
-+const uint8_t *fos_dev_thumb(const struct fos_dev *d)
-+{
-+ return d && d->stage == ST_DONE ? d->thumb : 0;
-+}
-+
-+const char *fos_dev_error(const struct fos_dev *d)
-+{
-+ return d ? d->err : "out of memory";
-+}
-+
-+int fos_dev_doing(const struct fos_dev *d)
-+{
-+ if (!d) return FOS_DEV_FAILED;
-+ switch (d->stage)
-+ {
-+ case ST_OPEN: return FOS_DEV_MIXING;
-+ case ST_DECODE: return lut_film == d->film && lut_built >= NGRID ? FOS_DEV_DEVELOPING : FOS_DEV_MIXING;
-+ case ST_KEY: case ST_EXPOSE: case ST_GLOW: case ST_FINISH: return FOS_DEV_FIXING;
-+ case ST_JPEG: case ST_QUANT: case ST_DITHER: case ST_WRITE: return FOS_DEV_DRYING;
-+ case ST_DONE: return FOS_DEV_DONE;
-+ }
-+ return FOS_DEV_FAILED;
-+}
-+
-+/* how far along, 0..1000: decoding is most of the work */
-+static int progress(const struct fos_dev *d)
-+{
-+ const int H = FOS_PRINT_H;
-+ switch (d->stage)
-+ {
-+ case ST_OPEN: return 0;
-+ case ST_DECODE: return d->total ? (int) ((int64_t) d->done * 800 / d->total) : 0; /* 64 bits: long is 32 on the camera */
-+ case ST_KEY: return 800;
-+ case ST_EXPOSE: return 805 + d->row * 60 / H;
-+ case ST_GLOW: return 865;
-+ case ST_FINISH: return 870 + d->row * 64 / H;
-+ case ST_JPEG: return 934;
-+ case ST_QUANT: return 940;
-+ case ST_DITHER: return 950 + d->row * 45 / H;
-+ case ST_WRITE: return 995;
-+ case ST_DONE: return 1000;
-+ }
-+ return -1;
-+}
-+
-+void fos_dev_picture(const struct fos_dev *d, int *x0, int *w)
-+{
-+ *x0 = d && d->rows_axis_x ? d->ox0 : 0;
-+ *w = d && d->rows_axis_x ? d->ow : FOS_PRINT_W;
-+}
-+
-+int fos_dev_progress(const struct fos_dev *d)
-+{
-+ return d ? progress(d) : -1;
-+}
-+
-+/* the lab scanner: the log-average luminance to a fixed key (negatives),
-+ * or what was exposed (slides); then the film's balance */
-+static void stage_key(struct fos_dev *d)
-+{
-+ const int W = FOS_PRINT_W, H = FOS_PRINT_H;
-+ float ev = 1.0f;
-+ if (!d->look->slide)
-+ {
-+ /* counted in a histogram so the logs are few */
-+ uint32_t *hist = (uint32_t *) d->rgb; /* free until ST_FINISH */
-+ memset(hist, 0, 4097 * 4);
-+ int n = 0;
-+ for (int y = 0; y < H; y += 4) /* as the lab: every fourth pixel */
-+ for (int x = 0; x < W; x += 4)
-+ {
-+ int lin[3];
-+ if (d->rows_axis_x && (x < d->ox0 || x >= d->ox0 + d->ow)) continue;
-+ pixel_linear(d, x, y, lin);
-+ hist[(871 * lin[0] + 2929 * lin[1] + 296 * lin[2]) >> 12]++;
-+ n++;
-+ }
-+ float acc = 0;
-+ for (int v = 0; v <= 4096; v++)
-+ if (hist[v]) acc += (float) hist[v] * logf(v / 4096.0f + 1e-4f);
-+ float key = n ? expf(acc / (float) n) : 0.11f;
-+ ev = log2f(0.11f / key);
-+ ev = ev < -2 ? -2 : ev > 3.5f ? 3.5f : ev;
-+#ifdef FOS_DEV_TEST
-+ fprintf(stderr, "scanner: key %.4f, %.3f EV; black %d/16, pre %d %d %d\n", (double) key, (double) ev, d->black16, d->pre[0], d->pre[1], d->pre[2]);
-+#endif
-+ }
-+ float k = exp2f(ev + d->look->ev);
-+ float bal[3] = { 1, 1, 1 };
-+ if (d->look->balance != 5500)
-+ {
-+ float a[3], b[3];
-+ cct_rgb(5500, a);
-+ cct_rgb((float) d->look->balance, b);
-+ for (int c = 0; c < 3; c++) bal[c] = a[c] / b[c];
-+ for (int c = 0; c < 3; c++) bal[c] /= a[1] / b[1];
-+ }
-+ for (int c = 0; c < 3; c++) d->mul[c] = (int) (k * bal[c] * 4096 + 0.5f);
-+}
-+
-+/* Exposing a row goes in two passes, each small enough for the
-+ * registers: the camera's colours, then linear sRGB. */
-+
-+/* n pixels' sums to camera colour (4096 = white): the means (of counts
-+ * fixed a, b times along x ra[], rb[]: the even and odd raw rows and
-+ * columns), less black, balanced */
-+static __attribute__((noinline)) void expose_cam(const struct fos_dev *d, const uint32_t *sm, uint16_t *cam, int n,
-+ int a, int b, const uint16_t *ra, const uint16_t *rb)
-+{
-+ const int black = d->black16, p0 = d->pre[0], p1 = d->pre[1], p2 = d->pre[2];
-+ for (const uint16_t *e = ra + n; ra < e; ra++, rb++, sm += 3, cam += 3)
-+ {
-+ int n0 = a * *ra, n1 = a * *rb + b * *ra, n2 = b * *rb;
-+ int c0 = 0, c1 = 0, c2 = 0;
-+ /* (sums <= 16383 n, so this fits) */
-+ if (n0 < NMAX) { int m = (int) (sm[0] * recip[n0] >> 12) - black; if (m > 0) { c0 = (m * p0) >> 14; if (c0 > 4096) c0 = 4096; } }
-+ if (n1 < NMAX) { int m = (int) (sm[1] * recip[n1] >> 12) - black; if (m > 0) { c1 = (m * p1) >> 14; if (c1 > 4096) c1 = 4096; } }
-+ if (n2 < NMAX) { int m = (int) (sm[2] * recip[n2] >> 12) - black; if (m > 0) { c2 = (m * p2) >> 14; if (c2 > 4096) c2 = 4096; } }
-+ cam[0] = (uint16_t) c0; cam[1] = (uint16_t) c1; cam[2] = (uint16_t) c2;
-+ }
-+}
-+
-+/* n pixels' camera colour to linear sRGB (4096 = 1.0) at o, exposed and
-+ * balanced for the film; the highlights into the glow row g from x */
-+static __attribute__((noinline)) void expose_lin(const struct fos_dev *d, const uint16_t *cam, uint16_t *o, int n,
-+ int32_t *g, int x)
-+{
-+ const int m00 = d->mat[0][0], m01 = d->mat[0][1], m02 = d->mat[0][2];
-+ const int m10 = d->mat[1][0], m11 = d->mat[1][1], m12 = d->mat[1][2];
-+ const int m20 = d->mat[2][0], m21 = d->mat[2][1], m22 = d->mat[2][2];
-+ const int u0 = d->mul[0], u1 = d->mul[1], u2 = d->mul[2];
-+ const int thr = (int) (d->look->hal_thr * 4096);
-+ for (const uint16_t *e = cam + 3 * n; cam < e; cam += 3, o += 3, x++)
-+ {
-+ int c0 = cam[0], c1 = cam[1], c2 = cam[2];
-+ int r = (m00 * c0 + m01 * c1 + m02 * c2) >> 12;
-+ int gg = (m10 * c0 + m11 * c1 + m12 * c2) >> 12;
-+ int bb = (m20 * c0 + m21 * c1 + m22 * c2) >> 12;
-+ r = r < 0 ? 0 : r > 4096 ? 4096 : r;
-+ gg = gg < 0 ? 0 : gg > 4096 ? 4096 : gg;
-+ bb = bb < 0 ? 0 : bb > 4096 ? 4096 : bb;
-+ r = (r * u0) >> 12; gg = (gg * u1) >> 12; bb = (bb * u2) >> 12;
-+ if (r > 65535) r = 65535;
-+ if (gg > 65535) gg = 65535;
-+ if (bb > 65535) bb = 65535;
-+ o[0] = (uint16_t) r; o[1] = (uint16_t) gg; o[2] = (uint16_t) bb;
-+ if (g)
-+ {
-+ int l = (871 * r + 2929 * gg + 296 * bb) >> 12;
-+ if (l > thr) g[x >> 2] += l - thr;
-+ }
-+ }
-+}
-+
-+/* rows y0..y1-1 to linear sRGB, in place over the sums (a row's sums are
-+ * read before it is written, and its values only ever overwrite sums
-+ * already read); the highlights go into the halation grid on the way. The
-+ * same sums as pixel_linear, walked along the row. */
-+static __attribute__((noinline)) void stage_expose(struct fos_dev *d, int y0, int y1)
-+{
-+ const int W = FOS_PRINT_W;
-+ uint16_t *lin = (uint16_t *) d->sums;
-+ for (int y = y0; y < y1; y++)
-+ {
-+ int32_t *g = d->glow ? d->glow + (y >> 2) * GW : 0;
-+ int xa = 0, xb = W;
-+ /* the counts of the samples summed: rows fixed and columns along the
-+ * row (landscape), or the other way round (portrait) */
-+ int a, b;
-+ const uint16_t *ra, *rb;
-+ if (d->rows_axis_x)
-+ {
-+ xa = d->ox0; xb = d->ox0 + d->ow;
-+ a = d->ne_c[y]; b = d->no_c[y]; ra = d->ne_r; rb = d->no_r;
-+ }
-+ else { a = d->ne_r[y]; b = d->no_r[y]; ra = d->ne_c; rb = d->no_c; }
-+ expose_cam(d, d->sums + 3 * (y * W + xa), d->pos, xb - xa, a, b, ra, rb);
-+ memset(lin + 3 * y * W, 0, 6 * xa);
-+ memset(lin + 3 * (y * W + xb), 0, 6 * (W - xb));
-+ expose_lin(d, d->pos, lin + 3 * (y * W + xa), xb - xa, g, xa);
-+ }
-+ d->lin = lin;
-+}
-+
-+/* halation: the highlights' glow, spread about as the lab's gaussian
-+ * (0.6 % of the frame) by two [1 2 1] passes each way on the grid */
-+static void stage_glow(struct fos_dev *d)
-+{
-+ int32_t *g = d->glow, tmp[GW > GH ? GW : GH];
-+ for (int i = 0; i < GW * GH; i++) g[i] >>= 4; /* the cell's mean */
-+ for (int pass = 0; pass < 2; pass++)
-+ {
-+ for (int y = 0; y < GH; y++)
-+ {
-+ int32_t *r = g + y * GW;
-+ for (int x = 0; x < GW; x++)
-+ tmp[x] = (r[x > 0 ? x - 1 : 0] + 2 * r[x] + r[x < GW - 1 ? x + 1 : GW - 1]) >> 2;
-+ memcpy(r, tmp, sizeof(int32_t) * GW);
-+ }
-+ for (int x = 0; x < GW; x++)
-+ {
-+ for (int y = 0; y < GH; y++)
-+ tmp[y] = (g[(y > 0 ? y - 1 : 0) * GW + x] + 2 * g[y * GW + x] + g[(y < GH - 1 ? y + 1 : GH - 1) * GW + x]) >> 2;
-+ for (int y = 0; y < GH; y++) g[y * GW + x] = tmp[y];
-+ }
-+ }
-+}
-+
-+/* a cell of the glow grid and the weight of the next, in 1/8, for print
-+ * line p: cell centres sit at 4j + 1.5 */
-+static void glow_pos(int p, int n, uint8_t *cell, uint8_t *frac)
-+{
-+ int t = 2 * p - 3;
-+ if (t < 0) { *cell = 0; *frac = 0; return; }
-+ int j = t >> 3;
-+ if (j >= n - 1) { *cell = (uint8_t) (n - 2); *frac = 8; return; }
-+ *cell = (uint8_t) j;
-+ *frac = (uint8_t) (t & 7);
-+}
-+
-+/* Finishing a row of the print goes in three passes, each small enough
-+ * for the registers: where its pixels fall on the film's table, the
-+ * table, the grain. */
-+
-+/* n pixels from lin: the vignette (vig[x] for pixel x, in 1/4096) and the
-+ * halation (the glow row grow mixed along it by gx, fx; hal: its colour)
-+ * on the linear light, then its place on the grid */
-+static __attribute__((noinline)) void finish_pos(const uint16_t *lin, uint16_t *pos, int n, int vy, const int16_t *vx,
-+ const int32_t *grow, const uint8_t *gx, const uint8_t *fx, const int *hal)
-+{
-+ const uint16_t *cin = tab->cin;
-+ if (!grow)
-+ {
-+ for (const uint16_t *e = lin + 3 * n; lin < e; lin += 3, pos += 3, vx++)
-+ {
-+ int vig = vy - *vx;
-+ pos[0] = cin_pos(cin, (lin[0] * vig) >> 12);
-+ pos[1] = cin_pos(cin, (lin[1] * vig) >> 12);
-+ pos[2] = cin_pos(cin, (lin[2] * vig) >> 12);
-+ }
-+ return;
-+ }
-+ const int h0 = hal[0], h1 = hal[1], h2 = hal[2];
-+ for (const uint16_t *e = lin + 3 * n; lin < e; lin += 3, pos += 3, vx++, gx++, fx++)
-+ {
-+ int vig = vy - *vx;
-+ int a = *gx, f = *fx;
-+ int glow = (grow[a] * (8 - f) + grow[a + 1] * f) >> 6;
-+ pos[0] = cin_pos(cin, ((lin[0] * vig) >> 12) + ((glow * h0) >> 8));
-+ pos[1] = cin_pos(cin, ((lin[1] * vig) >> 12) + ((glow * h1) >> 8));
-+ pos[2] = cin_pos(cin, ((lin[2] * vig) >> 12) + ((glow * h2) >> 8));
-+ }
-+}
-+
-+static __attribute__((noinline)) void finish_lut(const uint16_t *pos, uint8_t *o, int n)
-+{
-+ const uint8_t (*lut)[3] = tab->lut;
-+ for (const uint16_t *e = pos + 3 * n; pos < e; pos += 3, o += 3)
-+ lut_apply(lut, pos[0], pos[1], pos[2], o);
-+}
-+
-+/* grain at screen size: the lab's, softened by the downscale (grain: its
-+ * strength), strongest in the mid tones */
-+static __attribute__((noinline)) unsigned finish_grain(uint8_t *o, int n, unsigned seed, int grain, int mono)
-+{
-+ for (uint8_t *e = o + 3 * n; o < e; o += 3)
-+ {
-+ int l = (o[0] * 54 + o[1] * 183 + o[2] * 19) >> 8;
-+ int wgt = (l * (255 - l)) >> 6;
-+ int shared = rnd(&seed);
-+ for (int c = 0; c < 3; c++)
-+ {
-+ int k = mono ? shared : (shared * 3 + rnd(&seed) * 2) / 4;
-+ int v = o[c] + (int) (((long) k * grain >> 15) * wgt >> 16);
-+ o[c] = (uint8_t) (v < 0 ? 0 : v > 255 ? 255 : v);
-+ }
-+ }
-+ return seed;
-+}
-+
-+/* row y of the print: vignette, halation, the film's table, grain */
-+static __attribute__((noinline)) void stage_finish(struct fos_dev *d, int y)
-+{
-+ const int W = FOS_PRINT_W, H = FOS_PRINT_H;
-+ const struct fos_look *L = d->look;
-+ int pw = d->rows_axis_x ? d->ow : W, px0 = d->rows_axis_x ? d->ox0 : 0;
-+ if (y == 0)
-+ {
-+ /* vignette, as the lab: 1 - 0.12 r^2, r^2 = (x^2 + y^2) / 2 over
-+ * -1..1; the x and y parts, in 1/4096 */
-+ for (int x = 0; x < pw; x++) { float t = 2.0f * x / (pw - 1) - 1; d->vig_x[x] = (int16_t) (0.06f * t * t * 4096); }
-+ for (int k = 0; k < H; k++) { float t = 2.0f * k / (H - 1) - 1; d->vig_y[k] = (int16_t) (0.06f * t * t * 4096); }
-+ for (int x = 0; x < W; x++) glow_pos(x, GW, &d->gx[x], &d->fx[x]);
-+ }
-+ int hal[3];
-+ for (int c = 0; c < 3; c++) hal[c] = d->glow ? (int) (L->halation * L->hal_tint[c] * 256) : 0;
-+ /* the glow between the grid's two rows about this one, in 1/8 */
-+ int32_t grow[GW];
-+ if (d->glow)
-+ {
-+ uint8_t gy, fy;
-+ glow_pos(y, GH, &gy, &fy);
-+ const int32_t *g0 = d->glow + gy * GW, *g1 = g0 + GW;
-+ for (int j = 0; j < GW; j++) grow[j] = g0[j] * (8 - fy) + g1[j] * fy;
-+ }
-+ uint8_t *o = d->rgb + 3 * y * W;
-+ memset(o, 0, 3 * px0);
-+ memset(o + 3 * (px0 + pw), 0, 3 * (W - px0 - pw));
-+ finish_pos(d->lin + 3 * (y * W + px0), d->pos, pw, 4096 - d->vig_y[y], d->vig_x,
-+ d->glow ? grow : 0, d->gx + px0, d->fx + px0, hal);
-+ finish_lut(d->pos, o + 3 * px0, pw);
-+ int grain = (int) (L->grain * 255 * 0.55f * 256);
-+ if (grain) d->seed = finish_grain(o + 3 * px0, pw, d->seed, grain, L->mono);
-+}
-+
-+/* the thumbnail: 6 x 6 boxes, a row of them at a time */
-+static void make_thumb(struct fos_dev *d)
-+{
-+ const int W = FOS_PRINT_W;
-+ int acc[FOS_THUMB_W * 3];
-+ for (int ty = 0; ty < FOS_THUMB_H; ty++)
-+ {
-+ memset(acc, 0, sizeof(acc));
-+ for (int j = 0; j < 6; j++)
-+ {
-+ const uint8_t *p = d->rgb + 3 * (ty * 6 + j) * W;
-+ for (int tx = 0; tx < FOS_THUMB_W; tx++, p += 18)
-+ {
-+ int *a = acc + 3 * tx;
-+ a[0] += p[0] + p[3] + p[6] + p[9] + p[12] + p[15];
-+ a[1] += p[1] + p[4] + p[7] + p[10] + p[13] + p[16];
-+ a[2] += p[2] + p[5] + p[8] + p[11] + p[14] + p[17];
-+ }
-+ }
-+ for (int i = 0; i < FOS_THUMB_W * 3; i++)
-+ d->thumb[3 * ty * FOS_THUMB_W + i] = (uint8_t) ((acc[i] * 455 + 8192) >> 14); /* / 36 */
-+ }
-+}
-+
-+int fos_dev_step(struct fos_dev *d, int budget_ms)
-+{
-+ if (!d) return -1;
-+ int t0 = fos_port_ms(), cap = fos_port_dev_cap(), slices = 0;
-+ const int W = FOS_PRINT_W, H = FOS_PRINT_H, N = W * H;
-+ while ((fos_port_ms() - t0 < budget_ms || d->stage == ST_OPEN) && (!cap || slices++ < cap))
-+ {
-+ switch (d->stage)
-+ {
-+ case ST_OPEN:
-+ if (!tables_ready()) return fail_mem(d, (int) sizeof(*tab));
-+ d->f = fos_port_open(d->cr2, 0);
-+ if (!d->f) return fail(d, "can't open the RAW file");
-+ if (parse_tiff(d) < 0 || parse_ljpeg(d) < 0 || setup_maps(d) < 0) return -1;
-+ {
-+ char msg[320];
-+ const char *name = strrchr(d->cr2, '/');
-+ snprintf(msg, sizeof(msg), "dev: %s raw %dx%d (ljpeg %dx%d, %d comps, %d bits) slices %d x %d + %d, "
-+ "picture %d,%d %dx%d, black cols %d..%d, orientation %d",
-+ name ? name + 1 : d->cr2, d->raw_w, d->raw_h, d->wide, d->high, d->clrs, d->bits,
-+ d->slices[0], d->slices[1], d->slices[2], d->crop_l, d->crop_t, d->crop_w, d->crop_h,
-+ d->ob_l, d->ob_r, d->orient);
-+ fos_port_log(msg);
-+ }
-+ d->buf = fos_port_alloc(CHUNK + 16);
-+ if (!d->buf) return fail_mem(d, CHUNK + 16);
-+ d->bp = d->be = d->buf;
-+ d->safe = d->buf; /* the first read fills it */
-+ d->ff = 0;
-+ d->stage = ST_DECODE;
-+ break;
-+ case ST_DECODE:
-+ /* the film's table first, a little at a time */
-+ if (!lut_build(d->look, d->film, 64)) break;
-+ decode(d, 1 << 14);
-+ if (d->done >= d->total)
-+ {
-+ fos_port_close(d->f);
-+ d->f = 0;
-+ fos_port_free(d->buf); d->buf = 0;
-+ d->rgb = fos_port_alloc(N * 3);
-+ if (!d->rgb) return fail_mem(d, N * 3);
-+ if (d->look->halation > 0)
-+ {
-+ d->glow = fos_port_alloc(GW * GH * 4);
-+ if (d->glow) memset(d->glow, 0, GW * GH * 4);
-+ }
-+ setup_colour(d);
-+ d->stage = ST_KEY;
-+ return progress(d); /* the latent image can be read once more */
-+ }
-+ break;
-+ case ST_KEY:
-+ stage_key(d);
-+ d->stage = ST_EXPOSE;
-+ d->row = 0;
-+ break;
-+ case ST_EXPOSE:
-+ stage_expose(d, d->row, d->row + 8);
-+ d->row += 8;
-+ if (d->row >= H) d->stage = d->glow ? ST_GLOW : ST_FINISH, d->row = 0;
-+ break;
-+ case ST_GLOW:
-+ stage_glow(d);
-+ d->stage = ST_FINISH;
-+ d->row = 0;
-+ break;
-+ case ST_FINISH:
-+ stage_finish(d, d->row);
-+ if (++d->row == H)
-+ {
-+ make_thumb(d);
-+ fos_port_free(d->sums); d->sums = 0; d->lin = 0;
-+ fos_port_free(d->glow); d->glow = 0;
-+ d->stage = d->jpeg[0] ? ST_JPEG : ST_QUANT;
-+ }
-+ break;
-+ case ST_JPEG:
-+ {
-+ /* the picture only: a portrait frame without the print's sides */
-+ int x0 = d->rows_axis_x ? d->ox0 : 0, w = d->rows_axis_x ? d->ow : W;
-+ char desc[48];
-+ snprintf(desc, sizeof(desc), "%s %s", fos_films[d->film].brand, fos_films[d->film].name);
-+ struct fos_jpeg_meta m = { d->when, desc, d->fstop };
-+ if (!fos_jpeg_write(d->jpeg, d->rgb + 3 * x0, 3 * W, w, H, 92, &m))
-+ {
-+ char msg[200];
-+ snprintf(msg, sizeof(msg), "dev: can't write %s", d->jpeg);
-+ fos_port_log(msg);
-+ }
-+ d->stage = ST_QUANT;
-+ break;
-+ }
-+ case ST_QUANT:
-+ if (!quant_alloc(d)) return fail_mem(d, 32768 * 5 + FOS_PRINT_W * FOS_PRINT_H);
-+ d->stage = ST_DITHER;
-+ d->row = 0;
-+ break;
-+ case ST_DITHER:
-+ dither_rows(d, d->row, d->row + 8);
-+ d->row += 8;
-+ if (d->row >= H) d->stage = ST_WRITE;
-+ break;
-+ case ST_WRITE:
-+ if (!write_print(d->print, d->film, d->frame, d->when, d->fstop, d->pal, d->npal, d->idx, d->thumb,
-+ d->rows_axis_x ? d->ox0 : 0, d->rows_axis_x ? d->ow : W))
-+ return fail(d, "can't write the print");
-+ d->stage = ST_DONE;
-+ return 1000;
-+ case ST_DONE:
-+ return 1000;
-+ default:
-+ return -1;
-+ }
-+ }
-+ return progress(d);
-+}
-+
-+/* ---------------------------------------------------------------- the contact sheet */
-+
-+int fos_dev_sheet(const char *sheet, int film, const char *const *prints, int frames)
-+{
-+ struct fos_dev *d = fos_dev_start("", sheet, film, 0, "", "");
-+ if (!d) return 0;
-+ const int W = FOS_PRINT_W, H = FOS_PRINT_H;
-+ d->rgb = fos_port_alloc(W * H * 3);
-+ uint8_t *thumb = fos_port_alloc(FOS_THUMB_W * FOS_THUMB_H * 3);
-+ if (!d->rgb || !thumb) { fos_port_free(thumb); fos_dev_free(d); return 0; }
-+ /* strips of six frames on black, each frame inset by its rebate */
-+ memset(d->rgb, 0, W * H * 3);
-+ int rows = (frames + 5) / 6;
-+ int y0 = (H - rows * FOS_THUMB_H) / 2;
-+ for (int i = 0; i < frames; i++)
-+ {
-+ if (!prints[i] || !fos_print_thumb(prints[i], thumb)) continue;
-+ int cx = (i % 6) * FOS_THUMB_W + FOS_SHEET_FX, cy = y0 + (i / 6) * FOS_THUMB_H + FOS_SHEET_FY;
-+ for (int y = 0; y < FOS_SHEET_FH; y++)
-+ for (int x = 0; x < FOS_SHEET_FW; x++)
-+ {
-+ int sx = x * FOS_THUMB_W / FOS_SHEET_FW, sy = y * FOS_THUMB_H / FOS_SHEET_FH;
-+ memcpy(d->rgb + 3 * ((cy + y) * W + cx + x), thumb + 3 * (sy * FOS_THUMB_W + sx), 3);
-+ }
-+ if (i == 0) memcpy(d->thumb, thumb, sizeof(d->thumb)); /* the roll's own thumbnail */
-+ }
-+ fos_port_free(thumb);
-+ int ok = quant_alloc(d);
-+ if (ok)
-+ {
-+ dither_rows(d, 0, H);
-+ ok = write_print(sheet, film, 0, "", "", d->pal, d->npal, d->idx, d->thumb, 0, W);
-+ }
-+ fos_dev_free(d);
-+ return ok;
-+}
-+
-+/* ---------------------------------------------------------------- the latent image */
-+
-+/* where print pixel (px, py) comes from on the sensor: its middle */
-+static void raw_of(const struct fos_dev *d, int px, int py, int *rx, int *ry)
-+{
-+ int rlen, clen, a, b;
-+ if (d->rows_axis_x) { rlen = d->ow; clen = d->oh; a = px - d->ox0; b = py; }
-+ else { rlen = d->oh; clen = d->ow; a = py; b = px; }
-+ if (d->orient == 6 || d->orient == 3) a = rlen - 1 - a;
-+ if (d->orient == 8 || d->orient == 3) b = clen - 1 - b;
-+ *ry = d->crop_t + (int) ((long) (2 * a + 1) * d->crop_h / (2 * rlen));
-+ *rx = d->crop_l + (int) ((long) (2 * b + 1) * d->crop_w / (2 * clen));
-+}
-+
-+int fos_dev_preview(const struct fos_dev *d, uint8_t *lum, int w, int h)
-+{
-+ if (!d || (d->stage != ST_DECODE && d->stage != ST_KEY) || !d->sums) return 0;
-+ const int W = FOS_PRINT_W, H = FOS_PRINT_H;
-+ for (int ty = 0; ty < h; ty++)
-+ {
-+ int py = (2 * ty + 1) * H / (2 * h);
-+ for (int tx = 0; tx < w; tx++)
-+ {
-+ int px = (2 * tx + 1) * W / (2 * w);
-+ uint8_t *o = &lum[ty * w + tx];
-+ *o = 255; /* blank paper */
-+ if (d->rows_axis_x && (px < d->ox0 || px >= d->ox0 + d->ow)) continue;
-+ int rx, ry;
-+ raw_of(d, px, py, &rx, &ry);
-+ int reached = d->done >= d->total || rx < d->sx0 || (rx < d->sx0 + d->sw && ry < d->sy);
-+ if (!reached) continue;
-+ /* green, roughly exposed: enough to see the picture come */
-+ int xr = d->rows_axis_x ? px - d->ox0 : py, xc = d->rows_axis_x ? py : px;
-+ int n = d->ne_r[xr] * d->no_c[xc] + d->no_r[xr] * d->ne_c[xc];
-+ if (!n) continue;
-+ int g = (int) (d->sums[3 * (py * W + px) + 1] / n) - 2048;
-+ int v = g <= 0 ? 0 : g >= 2900 ? 4096 : g * 4096 / 2900;
-+ *o = (uint8_t) (fos_isqrt((unsigned) v * 16) * 255 / 256);
-+ }
-+ }
-+ return 1;
-+}
-diff --git a/src/fos_dev.h b/src/fos_dev.h
-new file mode 100644
-index 000000000..e1c9b0b58
---- /dev/null
-+++ b/src/fos_dev.h
-@@ -0,0 +1,169 @@
-+/* fos_dev: developing film in the camera.
-+ *
-+ * A frame's CR2 RAW becomes a print for the screen: 720 x 480 in its own
-+ * palette of FOS_PRINT_COLOURS colours. Developing runs in steps of a few
-+ * tens of ms, so the film OS keeps animating on the same task while the
-+ * camera works through a roll.
-+ */
-+
-+#ifndef _fos_dev_h_
-+#define _fos_dev_h_
-+
-+#include <stdint.h>
-+
-+/* ---------------------------------------------------------------- looks */
-+
-+/* a film's look, from films/films.py (see fos_looks.c; Darkrooms on the desktop uses the same) */
-+struct fos_hue_shift { int8_t from, to; float amount, chroma; };
-+struct fos_look
-+{
-+ const char *key; /* matches fos_films[].key */
-+ int balance; /* K the film is balanced for */
-+ int slide; /* reversal film: no scanner exposure */
-+ float ev, sat;
-+ float contrast[3], pivot[3], black[3], white[3];
-+ int nhues;
-+ struct fos_hue_shift hues[4];
-+ float halation, hal_thr, hal_tint[3];
-+ float grain, grain_size;
-+ int mono;
-+ float mono_mix[3];
-+};
-+extern const struct fos_look fos_looks[];
-+extern const int fos_nlooks;
-+/* the looks of the films from ML/DATA/FOSFILMS.BIN (fos_films_load) */
-+extern const struct fos_look *fos_more_looks;
-+extern int fos_nmore_looks;
-+const struct fos_look *fos_look_of(const char *key);
-+
-+/* the film's colour for one scene-linear sRGB value (0.18 = mid grey):
-+ * the print, display sRGB 0..1. Same model as film_color() in the lab. */
-+void fos_film_color(const struct fos_look *f, const float lin[3], float out[3]);
-+
-+/* ---------------------------------------------------------------- prints */
-+
-+/* the camera's screen; the web darkroom builds bigger prints with -D */
-+#ifndef FOS_PRINT_W
-+#define FOS_PRINT_W 720
-+#define FOS_PRINT_H 480
-+#endif
-+#define FOS_PRINT_COLOURS 240 /* palette indices 1..240 */
-+#define FOS_FIXED_BASE 241 /* 241..254: the same in every palette */
-+#define FOS_FIXED_N 14 /* 241..254 */
-+#define FOS_THUMB_W 120
-+#define FOS_THUMB_H 80
-+
-+struct fos_print
-+{
-+ int frame; /* 0 = the roll's contact sheet */
-+ int film; /* index into fos_films */
-+ char when[20]; /* "2026-10-22 17:45" */
-+ char fstop[8];
-+ int x0, w; /* the picture's columns (a portrait frame is narrower) */
-+ uint8_t pal[FOS_PRINT_COLOURS][3];
-+ uint8_t *px; /* FOS_PRINT_W x FOS_PRINT_H */
-+};
-+
-+/* while a photograph is up, the overlay draws with these */
-+enum { PX_BLACK = FOS_FIXED_BASE, PX_PANEL, PX_G1, PX_G2, PX_G3, PX_G4, PX_G5, PX_WHITE,
-+ PX_AMBER, PX_AMBER2, PX_RED, PX_LINE, PX_DIM, PX_SPARE };
-+extern const uint8_t fos_fixed_rgb[FOS_FIXED_N][3];
-+
-+/* A print is an 8-bit BMP, so it also opens on a PC: the file and info
-+ * headers, 256 palette entries (1..240 the print's), our own header with
-+ * the frame's details, the pixels top row first, then the thumbnail. */
-+#define FOS_BMP_PAL (14 + 40)
-+#define FOS_BMP_META (FOS_BMP_PAL + 256 * 4)
-+#define FOS_META_SIZE 64
-+#define FOS_BMP_PIXELS (FOS_BMP_META + FOS_META_SIZE)
-+#define FOS_BMP_THUMB (FOS_BMP_PIXELS + FOS_PRINT_W * FOS_PRINT_H)
-+#define FOS_THUMB_SIZE (FOS_THUMB_W * FOS_THUMB_H * 3)
-+#define FOS_BMP_SIZE (FOS_BMP_THUMB + FOS_THUMB_SIZE)
-+
-+/* in fos_print.c, which every build has (the shelf's samples are prints too) */
-+int fos_print_load(const char *path, struct fos_print *p); /* allocates p->px; 0 on failure */
-+void fos_print_free(struct fos_print *p);
-+int fos_print_thumb(const char *path, uint8_t *thumb); /* FOS_THUMB_W x FOS_THUMB_H RGB */
-+
-+/* ---------------------------------------------------------------- developing */
-+
-+struct fos_dev;
-+
-+/* where the film tables are kept between sessions (NULL: not kept) */
-+void fos_dev_cache(const char *dir);
-+/* build film's table into the cache now (the build makes the card's copies) */
-+int fos_dev_table(int film);
-+/* also write the frame in full colour as a JPEG at path (before the first step) */
-+void fos_dev_jpeg(struct fos_dev *d, const char *path);
-+/* forget the film table (leaving the darkroom) */
-+void fos_dev_release();
-+
-+/* develop one frame: cr2 in, a print file out */
-+struct fos_dev *fos_dev_start(const char *cr2, const char *print, int film, int frame,
-+ const char *when, const char *fstop);
-+/* work for about budget_ms; returns progress 0..1000, 1000 when the print
-+ * is written, or < 0 when the frame can't be developed */
-+int fos_dev_step(struct fos_dev *d, int budget_ms);
-+/* the finished frame, small, RGB: for the contact sheet and the animation */
-+const uint8_t *fos_dev_thumb(const struct fos_dev *d);
-+const char *fos_dev_error(const struct fos_dev *d);
-+/* what it is doing, for the darkroom's animation */
-+enum { FOS_DEV_MIXING, FOS_DEV_DEVELOPING, FOS_DEV_FIXING, FOS_DEV_DRYING, FOS_DEV_DONE, FOS_DEV_FAILED };
-+int fos_dev_doing(const struct fos_dev *d);
-+int fos_dev_progress(const struct fos_dev *d); /* 0..1000, as fos_dev_step returned */
-+void fos_dev_picture(const struct fos_dev *d, int *x0, int *w); /* the picture's columns on the print */
-+void fos_dev_free(struct fos_dev *d);
-+
-+/* the print in progress, w x h, as the latent image coming up: a rough
-+ * luminance, 255 (paper) where nothing has been read yet; 0 if there is
-+ * nothing to show (not reading the RAW) */
-+int fos_dev_preview(const struct fos_dev *d, uint8_t *lum, int w, int h);
-+
-+/* the roll's contact sheet from its frames' prints (NULL: not
-+ * developed); written as a print with frame 0. Frame i sits in cell
-+ * (i % 6, i / 6) of FOS_THUMB_W x FOS_THUMB_H cells, rows centred */
-+#define FOS_SHEET_FX 6
-+#define FOS_SHEET_FY 4
-+#define FOS_SHEET_FW 108
-+#define FOS_SHEET_FH 72
-+int fos_dev_sheet(const char *sheet, int film, const char *const *prints, int frames);
-+
-+/* ---------------------------------------------------------------- the rolls on the card (fos_lab.c) */
-+
-+#define FOS_MAX_FRAMES 40
-+
-+struct fos_lab_roll
-+{
-+ int number;
-+ int film; /* index into fos_films */
-+ int exposures;
-+ int shot; /* frames in its logs */
-+ int developed; /* frames with a print */
-+ int sheet; /* its contact sheet is there */
-+ int jpegs; /* JPEGs in its folder in DCIM */
-+ int in_camera; /* still loaded: rewind it before developing */
-+ char loaded[17]; /* "2026-10-22 17:45" */
-+ char last[17]; /* its last frame */
-+};
-+
-+struct fos_lab_frame
-+{
-+ int no;
-+ char cr2[64];
-+ int missing; /* the file isn't there (deleted, or shot as JPEG) */
-+ int jpeg; /* missing, and shot as JPEG: cr2 names its .JPG */
-+ char when[17];
-+ char fstop[6];
-+};
-+
-+int fos_lab_scan(struct fos_lab_roll *rolls, int max); /* newest first; how many */
-+int fos_lab_frames(int roll, struct fos_lab_frame *frames, int max); /* frame order; how many */
-+void fos_lab_print_path(char *buf, int size, int roll, int frame); /* frame 0: the contact sheet */
-+int fos_lab_prepare(int roll); /* its print folder; 0 = ok */
-+void fos_lab_cache_dir(char *buf, int size); /* where film tables are kept */
-+/* the roll's folder of JPEGs in DCIM, made if need be: "Sep0906 Portra400"
-+ * (month, month number, day of its first frame; when: "2026-09-06 10:15")
-+ * or SEP0906 where the card takes no long names. 0 = ok */
-+int fos_lab_dcim_dir(char *buf, int size, int roll, int film, const char *when);
-+
-+#endif
-diff --git a/src/fos_film.c b/src/fos_film.c
-new file mode 100644
-index 000000000..b95883d66
---- /dev/null
-+++ b/src/fos_film.c
-@@ -0,0 +1,1132 @@
-+/* fos_film: the film stocks, and their 35 mm canisters drawn as small 3D
-+ * objects - a lithographed steel cylinder with crimped caps, the spool end
-+ * on top, the felt light trap and the film leader sticking out of it.
-+ *
-+ * Each stock's label is painted once into a texture that wraps around the
-+ * cylinder, a ramp and a level per texel with the anti-aliased edges
-+ * already blended. Light on a cylinder only scales and lifts levels, so
-+ * each column of the drawing folds its shading into a gain and an offset
-+ * per ramp, and a label pixel costs a lookup, a multiply and a dither.
-+ */
-+
-+#include "fos.h"
-+#include "fos_dev.h"
-+#include <math.h>
-+#include <stddef.h>
-+#include <string.h>
-+
-+/* ---------------------------------------------------------------- the stocks */
-+
-+/* Picture style values are starting points for the in-camera JPEG preview
-+ * only; the real look comes from the lab. Mono stocks leave saturation and
-+ * tone alone because the Monochrome style uses those for filter / toning. */
-+static const struct fos_film builtin[] =
-+{
-+ { "portra400", "KODAK", "Portra 400", "C-41", "Soft warm skin, gentle highlights",
-+ 400, 400, PS_STANDARD, -1, -1, 1, 2, 5500, 0, 1, 2, 2, 2, 4, "Portra400", FOS_GROUP_COLOUR, 0 },
-+ { "cinestill800t", "CINESTILL", "800T", "C-41", "Tungsten cine film, night goes blue",
-+ 800, 800, PS_STANDARD, 1, 1, -1, 2, 3200, 0, 0, 4, 3, 3, 1, "CineStill800T", FOS_GROUP_CINE, 0 },
-+ { "ektar100", "KODAK", "Ektar 100", "C-41", "Punchy colour, ultra fine grain",
-+ 100, 100, PS_LANDSCAPE, 1, 2, 0, 3, 5200, 0, 0, 1, 4, 5, 3, "Ektar100", FOS_GROUP_COLOUR, 0 },
-+ { "gold200", "KODAK", "Gold 200", "C-41", "Golden hour, all day long",
-+ 200, 200, PS_STANDARD, 1, 1, 2, 2, 5600, 0, 2, 3, 3, 4, 5, "Gold200", FOS_GROUP_COLOUR, 0 },
-+ { "superia400", "FUJIFILM", "Superia 400", "C-41", "Green shadows, everyday snaps",
-+ 400, 400, PS_STANDARD, 1, 1, 0, 2, 5200, 1, 0, 3, 3, 3, 2, "Superia400", FOS_GROUP_COLOUR, 0 },
-+ { "velvia50", "FUJIFILM", "Velvia 50", "E-6", "Vivid slide film, hard contrast",
-+ 50, 100, PS_LANDSCAPE, 3, 4, 0, 3, 5200, 0, 0, 1, 5, 5, 3, "Velvia50", FOS_GROUP_SLIDE, 0 },
-+ { "hp5", "ILFORD", "HP5 Plus", "B&W", "Classic B&W, forgiving latitude",
-+ 400, 400, PS_MONO, 1, 0, 0, 2, 5200, 0, 0, 4, 2, 0, 0, "HP5", FOS_GROUP_BW, 0 },
-+ { "trix400", "KODAK", "Tri-X 400", "B&W", "Gritty contrast, street classic",
-+ 400, 400, PS_MONO, 3, 0, 0, 2, 5200, 0, 0, 5, 4, 0, 0, "TriX400", FOS_GROUP_BW, 0 },
-+};
-+#define NBUILTIN ((int) (sizeof(builtin) / sizeof(builtin[0])))
-+
-+const struct fos_film *fos_films = builtin;
-+int fos_nfilms = NBUILTIN;
-+
-+const char *const fos_group_names[FOS_NGROUPS] = { "COLOUR", "SLIDE", "B&W", "CINE" };
-+
-+const struct fos_look *fos_more_looks;
-+int fos_nmore_looks;
-+
-+/* A film in ML/DATA/FOSFILMS.BIN (written by tools/genfilms.py, which
-+ * packs the same layout): after a 12-byte header ("FOSM", version, record
-+ * size, count), one of these each. The look is struct fos_look from its
-+ * balance on, as the camera lays it out. */
-+#define LOOK_FROM offsetof(struct fos_look, balance)
-+#define LOOK_BYTES (offsetof(struct fos_look, mono_mix) + sizeof(((struct fos_look *) 0)->mono_mix) - LOOK_FROM)
-+struct film_rec
-+{
-+ char key[16], brand[16], name[24], process[8], desc[48], shortname[24];
-+ int32_t box_iso, iso, picstyle, contrast, saturation, color_tone, sharpness, kelvin, wbs_gm, wbs_ba;
-+ uint8_t grain, punch, colour, warmth;
-+ int32_t group;
-+ struct fos_label label;
-+ uint8_t look[LOOK_BYTES];
-+};
-+
-+int fos_films_load(const uint8_t *blob, int size)
-+{
-+ if (!blob || size < 12 || memcmp(blob, "FOSM", 4) || blob[4] != 1) return 0;
-+ int rs = blob[6] | blob[7] << 8, n = (int) (blob[8] | blob[9] << 8);
-+ if (rs != (int) sizeof(struct film_rec) || size < 12 + n * rs || n <= 0) return 0;
-+ struct fos_film *all = fos_port_alloc((NBUILTIN + n) * (int) sizeof(*all));
-+ struct fos_look *looks = fos_port_alloc(n * (int) sizeof(*looks));
-+ if (!all || !looks) { fos_port_free(all); fos_port_free(looks); return 0; }
-+ memcpy(all, builtin, sizeof(builtin));
-+ for (int i = 0; i < n; i++)
-+ {
-+ struct film_rec *r = (struct film_rec *) (blob + 12 + i * rs);
-+ r->key[15] = r->brand[15] = r->name[23] = r->process[7] = r->desc[47] = r->shortname[23] = 0;
-+ r->label.top[19] = r->label.word[13] = r->label.num_s[7] = r->label.sub[17] = 0;
-+ struct fos_film *f = &all[NBUILTIN + i];
-+ *f = (struct fos_film) { r->key, r->brand, r->name, r->process, r->desc, r->box_iso, r->iso, r->picstyle,
-+ r->contrast, r->saturation, r->color_tone, r->sharpness, r->kelvin, r->wbs_gm, r->wbs_ba,
-+ r->grain, r->punch, r->colour, r->warmth, r->shortname,
-+ fos_clamp(r->group, 0, FOS_NGROUPS - 1), &r->label };
-+ memset(&looks[i], 0, sizeof(looks[i]));
-+ looks[i].key = r->key;
-+ memcpy((uint8_t *) &looks[i] + LOOK_FROM, r->look, LOOK_BYTES);
-+ looks[i].nhues = fos_clamp(looks[i].nhues, 0, 4);
-+ }
-+ fos_films = all;
-+ fos_nfilms = NBUILTIN + n;
-+ fos_more_looks = looks;
-+ fos_nmore_looks = n;
-+ return 1;
-+}
-+
-+const int fos_exposure_choices[FOS_NEXP] = { 36, 24, 12 };
-+
-+/* f-numbers x100 in 1/3 stops; index i sits (i - 1) thirds above f/1
-+ * (f/0.95 is close enough to f/1 to share the bottom of the scale) */
-+const int fos_fstops[] =
-+{
-+ 95, 100, 110, 120, 140, 160, 180, 200, 220, 250,
-+ 280, 320, 350, 400, 450, 500, 560, 630, 710, 800,
-+ 900, 1000, 1100, 1300, 1400, 1600, 1800, 2000, 2200,
-+};
-+const int fos_nfstops = sizeof(fos_fstops) / sizeof(fos_fstops[0]);
-+
-+void fos_format_fstop(char *buf, int size, int index)
-+{
-+ int v = fos_fstops[fos_clamp(index, 0, fos_nfstops - 1)];
-+ if (v < 100)
-+ snprintf(buf, size, "0.%02d", v);
-+ else if (v % 100 == 0 || v >= 1000)
-+ snprintf(buf, size, "%d", v / 100);
-+ else
-+ snprintf(buf, size, "%d.%d", v / 100, (v / 10) % 10);
-+}
-+
-+/* ---------------------------------------------------------------- geometry */
-+
-+/* full-size canister, px */
-+#define R 50 /* body radius */
-+#define RC 53 /* caps stick out a little */
-+#define RS 19 /* spool end */
-+#define HB 150 /* body (label) height */
-+#define TB 9 /* top crimp band */
-+#define BB 8 /* bottom crimp band */
-+#define HS 12 /* spool end above the cap */
-+#define TILT 56 /* ellipse height / width, 1/256: we look down ~13 degrees */
-+
-+/* label texture: 360 degrees across, body height down */
-+#define TW 320
-+#define TH HB
-+#define U_FRONT (TW / 2) /* texture column facing us at rot 0 */
-+#define U_LIP (U_FRONT + TW * 82 / 360) /* the felt lip, on the right */
-+
-+int fos_can_quality = 2;
-+
-+struct fos_can
-+{
-+ int film;
-+ int exposures;
-+ uint16_t *tex; /* ramp << 12 | 12-bit level, column by column */
-+ int ramps; /* bit mask of the ramps in it */
-+ int gloss; /* 0..256 */
-+ int leader_ramp, leader_lv;
-+};
-+
-+int fos_can_height(int scale)
-+{
-+ int e = RC * TILT / 256;
-+ return (HS + RS * TILT / 256 + e + TB + HB + BB + e) * scale / 256;
-+}
-+
-+int fos_can_width(int scale)
-+{
-+ return 2 * RC * scale / 256;
-+}
-+
-+/* ---------------------------------------------------------------- shading profiles */
-+
-+/* sampled across the cylinder, x / radius from -1 to +1 */
-+#define NPROF 256
-+static int16_t prof_ang[NPROF]; /* surface angle, 1/65536 turn (+ = right) */
-+static int16_t prof_light[NPROF]; /* printed label: diffuse, 0..256 */
-+static int16_t prof_spec[NPROF]; /* printed label: gloss highlight, 0..256 */
-+static int16_t prof_metal[NPROF]; /* steel caps: 12-bit level */
-+static int16_t prof_dark[NPROF]; /* black plastic spool: 12-bit level */
-+static int prof_ready = 0;
-+
-+static float smooth(float a, float b, float x)
-+{
-+ float t = (x - a) / (b - a);
-+ t = t < 0 ? 0 : t > 1 ? 1 : t;
-+ return t * t * (3 - 2 * t);
-+}
-+
-+static float lobe(float th, float centre, float width)
-+{
-+ float d = (th - centre) / width;
-+ return expf(-d * d);
-+}
-+
-+static void build_profiles()
-+{
-+ const float deg = 3.14159265f / 180;
-+ for (int i = 0; i < NPROF; i++)
-+ {
-+ float xn = (i + 0.5f) / NPROF * 2 - 1;
-+ float th = asinf(xn); /* -90..90 degrees */
-+ prof_ang[i] = (int16_t) (th / (2 * 3.14159265f) * 65536);
-+
-+ /* softbox up-left in front, a rim light behind on the right */
-+ float key = cosf(th + 38 * deg);
-+ key = (key + 0.35f) / 1.35f;
-+ key = key < 0 ? 0 : key;
-+ float rim = smooth(55 * deg, 86 * deg, th) * 0.55f;
-+ float edge = 0.62f + 0.38f * sqrtf(cosf(th));
-+ float light = (0.16f + 0.84f * key) * edge + rim;
-+ prof_light[i] = (int16_t) (light * 256);
-+
-+ float sheen = lobe(th, -24 * deg, 16 * deg) * 0.22f + lobe(th, -21 * deg, 3.0f * deg) * 0.55f
-+ + lobe(th, 74 * deg, 6 * deg) * 0.25f;
-+ prof_spec[i] = (int16_t) (sheen * 256);
-+
-+ /* brushed steel: dark body with sharp reflections of the studio */
-+ float m = 0.24f + 0.30f * key
-+ + 0.55f * lobe(th, -22 * deg, 9 * deg)
-+ + 0.30f * lobe(th, -55 * deg, 14 * deg)
-+ + 0.18f * lobe(th, 30 * deg, 18 * deg)
-+ + 0.45f * lobe(th, 80 * deg, 7 * deg);
-+ m *= edge;
-+ prof_metal[i] = (int16_t) fos_clamp((int) (m * LV_MAX), 0, LV_MAX);
-+
-+ float p = 0.06f + 0.10f * key + 0.22f * lobe(th, -25 * deg, 8 * deg) + 0.12f * lobe(th, 78 * deg, 8 * deg);
-+ prof_dark[i] = (int16_t) fos_clamp((int) (p * LV_MAX), 0, LV_MAX);
-+ }
-+ prof_ready = 1;
-+}
-+
-+/* profile index for d (1/256 px from the left edge) with inv = NPROF * 65536 / diameter */
-+#define PROF(d, inv) fos_clamp(((d) * (inv)) >> 16, 0, NPROF - 1)
-+
-+/* ---------------------------------------------------------------- label painting */
-+
-+/* an ink is the texel it paints */
-+static int ink(struct fos_can *c, int ramp, int level)
-+{
-+ c->ramps |= 1 << ramp;
-+ return ramp << 12 | LV12(level);
-+}
-+
-+/* texture column for u, which is never more than a turn out */
-+FOS_INLINE int wrap_u(int u)
-+{
-+ return u < 0 ? u + TW : u >= TW ? u - TW : u;
-+}
-+
-+/* put ink k with coverage cov (0..15) on texel (u, v) */
-+static void tex_put(struct fos_can *c, int u, int v, int k, int cov)
-+{
-+ if (cov <= 0 || v < 0 || v >= TH) return;
-+ uint16_t *t = &c->tex[wrap_u(u) * TH + v];
-+ if (cov >= 15) { *t = k; return; }
-+ int r, lv;
-+ fos_lerp2(*t >> 12, *t & 0xFFF, k >> 12, k & 0xFFF, cov * 17, &r, &lv);
-+ *t = r << 12 | lv;
-+}
-+
-+static void tex_rect(struct fos_can *c, int u, int v, int w, int h, int k)
-+{
-+ if (v < 0) { h += v; v = 0; }
-+ if (v + h > TH) h = TH - v;
-+ for (int i = u; i < u + w && h > 0; i++)
-+ {
-+ uint16_t *t = &c->tex[wrap_u(i) * TH + v];
-+ for (int j = 0; j < h; j++)
-+ t[j] = k;
-+ }
-+}
-+
-+/* glyph coverage straight from the font, optionally turned 90 degrees
-+ * counter-clockwise (text reading upwards) */
-+static void tex_glyph(struct fos_can *c, const struct fos_font *f, const struct fos_glyph *g,
-+ int u, int v, int k, int vertical)
-+{
-+ const uint8_t *p = f->bits + g->off;
-+ int col = 0, row = 0;
-+ while (row < g->h)
-+ {
-+ int b = *p++;
-+ int run, val;
-+ if (b & 0x80) { run = (b & 0x7F) + 1; val = 0; }
-+ else { run = (b >> 4) + 1; val = b & 15; }
-+ while (run--)
-+ {
-+ if (val)
-+ {
-+ int gx = g->ox + col, gy = g->oy + row;
-+ if (vertical) tex_put(c, u + gy, v - gx, k, val);
-+ else tex_put(c, u + gx, v + gy, k, val);
-+ }
-+ if (++col == g->w) { col = 0; row++; }
-+ }
-+ }
-+}
-+
-+/* text along the label; align -1 left, 0 centre, 1 right; returns width */
-+static int tex_text(struct fos_can *c, const struct fos_font *f, int u, int base, const char *s,
-+ int k, int track, int align)
-+{
-+ int w = fos_text_w(f, s, track);
-+ int pen = (u - (align + 1) * w / 2) * 16;
-+ for (const char *q = s; *q; q++)
-+ {
-+ int i = f->lut[(uint8_t) *q];
-+ if (i == 0xFF) continue;
-+ const struct fos_glyph *g = &f->glyphs[i];
-+ tex_glyph(c, f, g, (pen + 8) >> 4, base, k, 0);
-+ pen += g->adv + track;
-+ }
-+ return w;
-+}
-+
-+/* text reading upwards, centred on (u, v); the baseline is at u */
-+static void tex_vtext(struct fos_can *c, const struct fos_font *f, int u, int v, const char *s, int k, int track)
-+{
-+ int w = fos_text_w(f, s, track);
-+ int pen = (v + w / 2) * 16;
-+ for (const char *q = s; *q; q++)
-+ {
-+ int i = f->lut[(uint8_t) *q];
-+ if (i == 0xFF) continue;
-+ const struct fos_glyph *g = &f->glyphs[i];
-+ tex_glyph(c, f, g, u, (pen + 8) >> 4, k, 1);
-+ pen -= g->adv + track;
-+ }
-+}
-+
-+/* DX CAS code: two rows of six cells, bare steel (conducts) or painted.
-+ * The first cell of each row is always bare; the rest come from the box
-+ * speed and the exposure count, like the real thing (close enough). */
-+static void tex_dx(struct fos_can *c, int u, int v, int iso, int exposures, int steel, int paint)
-+{
-+ static const int isos[] = { 25, 50, 64, 100, 125, 160, 200, 400, 800, 1600, 3200 };
-+ int code = 0;
-+ for (int i = 0; i < (int) (sizeof(isos) / sizeof(isos[0])); i++)
-+ if (isos[i] == iso) code = i + 3;
-+ int row1 = 1 | (code << 1);
-+ int row2 = 1 | ((exposures == 36 ? 5 : exposures == 24 ? 3 : 2) << 1) | 0x20;
-+ for (int i = 0; i < 6; i++)
-+ {
-+ tex_rect(c, u + i * 7, v, 6, 8, (row1 >> i) & 1 ? steel : paint);
-+ tex_rect(c, u + i * 7, v + 9, 6, 8, (row2 >> i) & 1 ? steel : paint);
-+ }
-+}
-+
-+/* a UPC-ish barcode, the same for the same stock, about 50 texels wide */
-+static void tex_barcode(struct fos_can *c, int u, int v, int h, const char *seed, int ink_bar)
-+{
-+ unsigned int x = 2166136261u;
-+ for (const char *s = seed; *s; s++) x = (x ^ (uint8_t) *s) * 16777619u;
-+ int pos = u;
-+ for (int i = 0; i < 18; i++)
-+ {
-+ x = x * 1103515245u + 12345u;
-+ int bar = 1 + (x >> 16) % 2, gap = 1 + (x >> 20) % 2;
-+ int hh = (i == 0 || i == 9 || i == 17) ? h + 3 : h;
-+ tex_rect(c, pos, v, bar, hh, ink_bar);
-+ pos += bar + gap;
-+ }
-+}
-+
-+/* the parts every canister shares: the felt lip, and the back with the
-+ * DX code, the barcode and the small print. Going round from the lip:
-+ * DX code and exposures, barcode, then "PROCESS" reading upwards, all
-+ * clear of the front panel (about U_FRONT +- 65). */
-+static void paint_common(struct fos_can *c, int body, int text, const char *process)
-+{
-+ const struct fos_film *f = &fos_films[c->film];
-+ int steel = ink(c, RAMP_METAL, 205);
-+ int black = ink(c, RAMP_GRAY, 16);
-+ int felt = ink(c, RAMP_GRAY, 9);
-+
-+ /* the light trap: a strip of black velvet between two folded edges */
-+ tex_rect(c, U_LIP - 5, 0, 10, TH, felt);
-+ tex_rect(c, U_LIP - 7, 0, 2, TH, steel);
-+ tex_rect(c, U_LIP + 5, 0, 2, TH, steel);
-+
-+ char buf[32];
-+ int u_dx = U_LIP + 22; /* 255 */
-+ tex_rect(c, u_dx - 3, TH / 2 - 12, 48, 24, black);
-+ tex_dx(c, u_dx, TH / 2 - 9, f->box_iso, c->exposures, steel, black);
-+ snprintf(buf, sizeof(buf), "135-%d", c->exposures);
-+ tex_text(c, &fos_font_lsm, u_dx + 21, TH / 2 - 20, buf, text, 16, 0);
-+
-+ tex_barcode(c, U_LIP + 76, TH - 52, 26, f->key, text); /* 309, round the seam */
-+
-+ snprintf(buf, sizeof(buf), "PROCESS %s", process);
-+ tex_vtext(c, &fos_font_lsm, 64, TH / 2, buf, text, 16);
-+ (void) body;
-+}
-+
-+/* text that fits the front of the canister: the widest tracking that does,
-+ * squeezed a little if even none is too wide */
-+static void tex_text_fit(struct fos_can *c, const struct fos_font *f, int u, int base, const char *s, int k, int track)
-+{
-+ const int room = 108;
-+ while (track > -32 && fos_text_w(f, s, track) > room) track -= 4;
-+ tex_text(c, f, u, base, s, k, track, 0);
-+}
-+
-+static int label_ink(struct fos_can *c, const uint8_t ink2[2])
-+{
-+ return ink(c, ink2[0] < RAMP_COUNT ? ink2[0] : RAMP_GRAY, ink2[1]);
-+}
-+
-+/* a label from its parts (struct fos_label): the films from the card */
-+static void paint_parts(struct fos_can *c, const struct fos_film *f)
-+{
-+ const struct fos_label *l = f->label;
-+ const int u = U_FRONT - 4;
-+ int bg = label_ink(c, l->bg), band = label_ink(c, l->band), acc = label_ink(c, l->accent);
-+ int txt = label_ink(c, l->text), num = label_ink(c, l->num);
-+ char bottom[40];
-+ if (l->sub[0]) snprintf(bottom, sizeof(bottom), "%s 135-%d", l->sub, c->exposures);
-+ else snprintf(bottom, sizeof(bottom), "135-%d", c->exposures);
-+ tex_rect(c, 0, 0, TW, TH, bg);
-+ const struct fos_font *word = fos_text_w(&fos_font_lname, l->word, -32) <= 108 ? &fos_font_lname : &fos_font_lsm;
-+ switch (l->style)
-+ {
-+ case FOS_LABEL_CAP: /* a coloured cap over the top (Portra) */
-+ tex_rect(c, 0, 0, TW, 24, band);
-+ tex_rect(c, 0, 24, TW, 4, acc);
-+ tex_text_fit(c, &fos_font_lsm, u, 17, l->top, acc, 24);
-+ tex_text_fit(c, word, u, 58, l->word, txt, 40);
-+ tex_text(c, &fos_font_lbig, u, 112, l->num_s, num, 0, 0);
-+ tex_rect(c, 0, 120, TW, 3, acc);
-+ tex_rect(c, 0, 125, TW, 9, band);
-+ tex_text_fit(c, &fos_font_lsm, u, 147, bottom, txt, 16);
-+ break;
-+ case FOS_LABEL_STRIPES: /* thin stripes top and bottom (Ektar) */
-+ tex_rect(c, 0, 6, TW, 5, acc);
-+ tex_rect(c, 0, TH - 11, TW, 5, acc);
-+ tex_text_fit(c, &fos_font_lsm, u, 30, l->top, acc, 24);
-+ tex_text_fit(c, word, u, 60, l->word, txt, 40);
-+ tex_text(c, &fos_font_lbig, u, 116, l->num_s, num, 0, 0);
-+ tex_text_fit(c, &fos_font_lsm, u, 133, bottom, txt, 16);
-+ break;
-+ default: /* a band the name sits on (Gold) */
-+ tex_rect(c, 0, 36, TW, 34, band);
-+ tex_text_fit(c, &fos_font_lsm, u, 26, l->top, acc, 40);
-+ tex_text_fit(c, word, u, 63, l->word, txt, 48);
-+ tex_text(c, &fos_font_lbig, u, 122, l->num_s, num, 0, 0);
-+ tex_text_fit(c, &fos_font_lsm, u, 140, bottom, num, 16);
-+ break;
-+ }
-+ paint_common(c, bg, txt, f->process);
-+ if (l->leader)
-+ {
-+ c->leader_ramp = RAMP_GRAY;
-+ c->leader_lv = LV12(l->leader);
-+ }
-+}
-+
-+static void paint_label(struct fos_can *c)
-+{
-+ const struct fos_film *f = &fos_films[c->film];
-+ const int u = U_FRONT - 4; /* optical centre of the front panel */
-+ char exp[16];
-+ snprintf(exp, sizeof(exp), "135-%d", c->exposures);
-+ c->ramps = 1 << RAMP_GRAY; /* what an unpainted texel is */
-+ c->gloss = 220;
-+ c->leader_ramp = RAMP_LEADER;
-+ c->leader_lv = LV12(120);
-+
-+ if (f->label)
-+ paint_parts(c, f);
-+ else if (!strcmp(f->key, "portra400"))
-+ {
-+ int cream = ink(c, RAMP_GRAY, 226), yel = ink(c, RAMP_AMBER, 188), org = ink(c, RAMP_ORANGE, 160);
-+ int red = ink(c, RAMP_RED, 150), blk = ink(c, RAMP_GRAY, 22);
-+ tex_rect(c, 0, 0, TW, TH, cream);
-+ tex_rect(c, 0, 0, TW, 24, yel);
-+ tex_rect(c, 0, 24, TW, 4, org);
-+ tex_text(c, &fos_font_lsm, u, 17, "KODAK PROFESSIONAL", red, 24, 0);
-+ tex_text(c, &fos_font_lname, u, 58, "PORTRA", blk, 40, 0);
-+ tex_text(c, &fos_font_lbig, u, 112, "400", blk, 0, 0);
-+ tex_rect(c, 0, 120, TW, 3, org);
-+ tex_rect(c, 0, 125, TW, 9, yel);
-+ tex_text(c, &fos_font_lsm, u, 147, exp, blk, 16, 0);
-+ tex_vtext(c, &fos_font_lname, u - 62, 76, "KODAK", red, 24);
-+ paint_common(c, cream, blk, f->process);
-+ }
-+ else if (!strcmp(f->key, "cinestill800t"))
-+ {
-+ int blk = ink(c, RAMP_GRAY, 20), red = ink(c, RAMP_RED, 150), wht = ink(c, RAMP_GRAY, 238);
-+ tex_rect(c, 0, 0, TW, TH, blk);
-+ tex_rect(c, 0, 10, TW, 3, red);
-+ tex_rect(c, 0, TH - 13, TW, 3, red);
-+ tex_text(c, &fos_font_lname, u, 44, "CINESTILL", wht, 24, 0);
-+ int w = fos_text_w(&fos_font_lbig, "800T", 0);
-+ int x0 = u - w / 2;
-+ int w8 = tex_text(c, &fos_font_lbig, x0, 104, "800", wht, 0, -1);
-+ tex_text(c, &fos_font_lbig, x0 + w8, 104, "T", red, 0, -1);
-+ tex_text(c, &fos_font_lsm, u, 124, "TUNGSTEN 3200K", red, 24, 0);
-+ tex_text(c, &fos_font_lsm, u, 139, exp, wht, 16, 0);
-+ paint_common(c, blk, wht, f->process);
-+ }
-+ else if (!strcmp(f->key, "ektar100"))
-+ {
-+ int crim = ink(c, RAMP_CRIMSON, 128), yel = ink(c, RAMP_AMBER, 188), wht = ink(c, RAMP_GRAY, 240);
-+ tex_rect(c, 0, 0, TW, TH, crim);
-+ tex_rect(c, 0, 6, TW, 5, yel);
-+ tex_rect(c, 0, TH - 11, TW, 5, yel);
-+ tex_text(c, &fos_font_lsm, u, 30, "KODAK PROFESSIONAL", yel, 24, 0);
-+ tex_text(c, &fos_font_lname, u, 60, "EKTAR", wht, 48, 0);
-+ tex_text(c, &fos_font_lbig, u, 116, "100", yel, 0, 0);
-+ tex_text(c, &fos_font_lsm, u, 132, exp, wht, 16, 0);
-+ paint_common(c, crim, wht, f->process);
-+ }
-+ else if (!strcmp(f->key, "gold200"))
-+ {
-+ int yel = ink(c, RAMP_AMBER, 190), red = ink(c, RAMP_RED, 148), blk = ink(c, RAMP_GRAY, 22);
-+ int wht = ink(c, RAMP_GRAY, 240);
-+ tex_rect(c, 0, 0, TW, TH, yel);
-+ tex_rect(c, 0, 36, TW, 32, red);
-+ tex_text(c, &fos_font_lsm, u, 24, "KODAK", red, 48, 0);
-+ tex_text(c, &fos_font_lname, u, 62, "GOLD", wht, 56, 0);
-+ tex_text(c, &fos_font_lbig, u, 122, "200", blk, 0, 0);
-+ tex_text(c, &fos_font_lsm, u, 140, exp, blk, 16, 0);
-+ tex_vtext(c, &fos_font_lsm, u - 60, 96, "COLOR", red, 24);
-+ paint_common(c, yel, blk, f->process);
-+ }
-+ else if (!strcmp(f->key, "superia400"))
-+ {
-+ int grn = ink(c, RAMP_GREEN, 140), wht = ink(c, RAMP_GRAY, 240), red = ink(c, RAMP_RED, 150);
-+ int dk = ink(c, RAMP_GREEN, 70);
-+ tex_rect(c, 0, 0, TW, TH, grn);
-+ tex_rect(c, 0, 72, TW, 52, dk);
-+ tex_rect(c, 0, 124, TW, 3, red);
-+ tex_text(c, &fos_font_lsm, u, 24, "FUJIFILM", wht, 48, 0);
-+ tex_text(c, &fos_font_lname, u, 58, "SUPERIA", wht, 24, 0);
-+ tex_text(c, &fos_font_lbig, u, 118, "400", wht, 0, 0);
-+ tex_text(c, &fos_font_lsm, u, 142, exp, wht, 16, 0);
-+ paint_common(c, grn, wht, f->process);
-+ }
-+ else if (!strcmp(f->key, "velvia50"))
-+ {
-+ int vio = ink(c, RAMP_VIOLET, 118), wht = ink(c, RAMP_GRAY, 240), lil = ink(c, RAMP_VIOLET, 225);
-+ tex_rect(c, 0, 0, TW, TH, vio);
-+ tex_rect(c, 0, 0, TW, 6, lil);
-+ tex_rect(c, 0, TH - 6, TW, 6, lil);
-+ tex_text(c, &fos_font_lsm, u, 28, "FUJICHROME", wht, 32, 0);
-+ tex_text(c, &fos_font_lname, u, 58, "VELVIA", wht, 40, 0);
-+ tex_text(c, &fos_font_lbig, u, 116, "50", lil, 0, 0);
-+ tex_text(c, &fos_font_lsm, u, 134, "RVP 50 " , wht, 24, 0);
-+ paint_common(c, vio, wht, f->process);
-+ c->leader_lv = LV12(70);
-+ }
-+ else if (!strcmp(f->key, "hp5"))
-+ {
-+ int wht = ink(c, RAMP_GRAY, 236), blk = ink(c, RAMP_GRAY, 20), blu = ink(c, RAMP_BLUE, 160);
-+ tex_rect(c, 0, 0, TW, TH, wht);
-+ tex_rect(c, 0, 40, TW, 76, blk);
-+ tex_rect(c, 0, 116, TW, 3, blu);
-+ tex_text(c, &fos_font_lname, u, 32, "ILFORD", blk, 48, 0);
-+ tex_text(c, &fos_font_lbig, u, 92, "HP5", wht, 0, 0);
-+ tex_text(c, &fos_font_lsm, u, 108, "PLUS", blu, 64, 0);
-+ tex_text(c, &fos_font_lname, u - 16, 142, "400", blk, 24, 0);
-+ tex_text(c, &fos_font_lsm, u + 30, 141, exp, blk, 0, 0);
-+ paint_common(c, wht, blk, f->process);
-+ c->leader_ramp = RAMP_GRAY;
-+ c->leader_lv = LV12(52);
-+ }
-+ else if (!strcmp(f->key, "trix400"))
-+ {
-+ int blk = ink(c, RAMP_GRAY, 18), yel = ink(c, RAMP_AMBER, 190), wht = ink(c, RAMP_GRAY, 238);
-+ int red = ink(c, RAMP_RED, 150);
-+ tex_rect(c, 0, 0, TW, TH, blk);
-+ tex_rect(c, 0, 14, TW, 50, yel);
-+ tex_text(c, &fos_font_lsm, u, 30, "KODAK", blk, 48, 0);
-+ tex_text(c, &fos_font_lname, u, 56, "TRI-X", blk, 40, 0);
-+ tex_text(c, &fos_font_lbig, u, 120, "400", wht, 0, 0);
-+ tex_text(c, &fos_font_lsm, u - 30, 138, "TX", red, 16, 0);
-+ tex_text(c, &fos_font_lsm, u + 14, 138, exp, wht, 16, 0);
-+ paint_common(c, blk, wht, f->process);
-+ c->leader_ramp = RAMP_GRAY;
-+ c->leader_lv = LV12(48);
-+ }
-+}
-+
-+struct fos_can *fos_can_new(int film, int exposures)
-+{
-+ if (!prof_ready) build_profiles();
-+ struct fos_can *c = fos_port_alloc(sizeof(struct fos_can));
-+ if (!c) return 0;
-+ memset(c, 0, sizeof(*c));
-+ c->tex = fos_port_alloc(TW * TH * sizeof(uint16_t));
-+ if (!c->tex) { fos_port_free(c); return 0; }
-+ c->film = fos_clamp(film, 0, fos_nfilms - 1);
-+ c->exposures = exposures;
-+ memset(c->tex, 0, TW * TH * sizeof(uint16_t));
-+ paint_label(c);
-+ return c;
-+}
-+
-+void fos_can_free(struct fos_can *c)
-+{
-+ if (!c) return;
-+ fos_port_free(c->tex);
-+ fos_port_free(c);
-+}
-+
-+void fos_can_set_exposures(struct fos_can *c, int exposures)
-+{
-+ if (!c || c->exposures == exposures) return;
-+ c->exposures = exposures;
-+ memset(c->tex, 0, TW * TH * sizeof(uint16_t));
-+ paint_label(c);
-+}
-+
-+
-+/* ---------------------------------------------------------------- drawing */
-+
-+/* ellipse half-height of a circle of radius r8 at offset dx8 (all 1/256 px) */
-+static int arc8(int dx8, int r8)
-+{
-+ int q = r8 * r8 - dx8 * dx8;
-+ if (q <= 0) return 0;
-+ return fos_isqrt((unsigned) q >> 8) * 16 * TILT / 256;
-+}
-+
-+/* one column of the canister, worked out once per frame */
-+struct can_col
-+{
-+ int16_t body; /* column crosses the body (not only the caps) */
-+ int16_t u, uf; /* label texture column and its fraction (0..255) */
-+ int16_t cov; /* silhouette coverage 0..256 */
-+ int16_t metal; /* caps, 12-bit, lit */
-+ int16_t spool; /* spool side, 12-bit, lit; -1 outside it */
-+ int16_t ex, sx; /* x across the cap / the spool, 4096 = edge */
-+ int32_t ex2, sx2; /* ... squared */
-+ int32_t gain, offs; /* the label's light here: lv * gain / 65536 + offs */
-+ int32_t top8; /* y of the top band's upper edge, 1/256 px */
-+ int32_t cap8; /* the highest the cap or the spool reaches */
-+ int32_t sp_top8, sp_bot8; /* spool side, 1/256 px */
-+};
-+
-+#define MAX_COLS 176
-+#define MAX_CAP_ROWS 64
-+static struct can_col cols[MAX_COLS];
-+
-+
-+FOS_INLINE int lit(int lv, int light)
-+{
-+ return (lv * light) >> 8;
-+}
-+
-+FOS_INLINE void put(struct fos_canvas *cv, int x, int y, int ramp, int lv, int cov)
-+{
-+ uint8_t *px = &cv->px[y * cv->pitch + x];
-+ if (cov >= 256) *px = fos_ixd(ramp, fos_ramp_pos(ramp, lv), x, y);
-+ else if (cov > 0) *px = fos_mix(*px, ramp, lv, cov);
-+}
-+
-+#define ABS16(v) ((v) < 0 ? -(v) : (v))
-+
-+/* ramp position (1/16 entries) -> palette index, clamped at the light end */
-+static uint8_t ix_tab[RAMP_COUNT][256];
-+static int ix_tab_ready;
-+
-+static void build_ix_tab()
-+{
-+ for (int r = 0; r < RAMP_COUNT; r++)
-+ for (int q = 0; q < 256; q++)
-+ ix_tab[r][q] = fos_ramp_base[r] + (q > fos_ramp_last[r] ? fos_ramp_last[r] : q);
-+ ix_tab_ready = 1;
-+}
-+
-+/* n rows of the leader fully inside its edges; v (0..4096 across the
-+ * film) steps by dv, holes are the v ranges [h, h + 480) */
-+__attribute__((noinline))
-+static void leader_run(uint8_t *px, int pitch, int n, int v, int dv, int lv_along, int sheen_k, int lmul,
-+ const uint8_t *tab, const uint8_t *bay, int h1, int h2)
-+{
-+ for (int i = 0; i < n; i++, v += dv, px += pitch)
-+ {
-+ if ((unsigned) (v - h1) < 480 || (unsigned) (v - h2) < 480) continue;
-+ /* glossy emulsion: a soft sheen a third of the way down */
-+ int sheen = 4096 - ABS16(v - 1300) * 5;
-+ int lv = lv_along + (sheen > 0 ? (sheen * sheen_k) >> 20 : 0);
-+ int q = (((lv * lmul) >> 16) + bay[i & 3]) >> 4;
-+ *px = tab[q & 255];
-+ }
-+}
-+
-+/* the film leader coming out of the lip: full width at first, then the
-+ * cut-down tongue, perforated along its edges. It leaves the lip heading
-+ * away from us, so it tapers a little and rises with distance. */
-+static void draw_leader(struct fos_canvas *cv, const struct fos_can *c, const struct fos_can_pose *p,
-+ int y_body_top, int s)
-+{
-+ int lip = (U_LIP - U_FRONT) * 65536 / TW - p->rot; /* lip angle on screen */
-+ int sn = fos_sin(lip); /* 4096 = right edge */
-+ if (sn < 900) return;
-+ /* p->leader: 256 = the usual tongue, more = pulled out further */
-+ int len = (70 * s >> 8) * p->leader / 256 * sn / 4096; /* foreshortened as it turns */
-+ int tongue = 50 * s / 256 * sn / 4096;
-+ if (len < 4) return;
-+ int x0 = (p->cx8 >> 8) + (R * s / 256) * sn / 4096 - 3 * s / 256;
-+ int fw8 = 112 * s; /* film width, 1/256 px */
-+ int mid8 = y_body_top * 256 + HB * s / 2;
-+ int full = len - tongue > len * 28 / 100 ? len - tongue : len * 28 / 100; /* full width before the cut */
-+ int curve = 12 * s / 256 + 1;
-+ int perf_w = fos_clamp(8 * s / 256, 2, 20), pitch = fos_clamp(15 * s / 256, 4, 40);
-+ int end_r = 9 * s / 256 + 1;
-+ int ramp = c->leader_ramp;
-+ int lmul = (p->light * fos_ramp_mul[ramp]) >> 8; /* light and ramp position in one */
-+ int inv_len = 65536 / len;
-+ if (!ix_tab_ready) build_ix_tab();
-+ int xa = fos_clamp(x0, cv->cx0, cv->cx1), xb = fos_clamp(x0 + len, cv->cx0, cv->cx1);
-+
-+ for (int x = xa; x < xb; x++)
-+ {
-+ int t = x - x0;
-+ int depth = (t * inv_len) >> 8; /* 0 at the lip, 256 at the tip */
-+ int hw8 = (fw8 / 2) * (256 - depth * 40 / 256) >> 8;
-+ int cy8 = mid8 - depth * s / 64;
-+ int top8 = cy8 - hw8, bot8 = cy8 + hw8;
-+ if (t > full)
-+ {
-+ /* the tongue keeps the lower half; the cut curves down to it */
-+ int k = t - full;
-+ int f = k >= curve ? 4096 : (4096 - fos_cos(k * 32768 / curve)) / 2;
-+ top8 = cy8 - hw8 + ((hw8 * f) >> 12);
-+ int rem = len - t;
-+ if (rem < end_r)
-+ {
-+ int dy = fos_isqrt((unsigned) (end_r * end_r - (end_r - rem) * (end_r - rem))) * 256;
-+ int c8 = (top8 + bot8) / 2;
-+ if (top8 < c8 - dy) top8 = c8 - dy;
-+ if (bot8 > c8 + dy) bot8 = c8 + dy;
-+ }
-+ }
-+ if (bot8 <= top8) continue;
-+ int ph = (t + pitch / 2) % pitch;
-+ int perf_col = ph < perf_w && t > 2;
-+ /* darker where it disappears into the lip and towards the tip */
-+ int along = 3000 + 1100 * fos_sin(depth * 128 + 0x2000) / 4096 - (t < 3 ? 1400 : 0);
-+ int lv_along = lit(c->leader_lv, along * 256 / 4096);
-+ int sheen_k = (LV_MAX - lv_along) * 60;
-+ int ya = fos_clamp(top8 >> 8, cv->cy0, cv->cy1), yb = fos_clamp((bot8 >> 8) + 1, cv->cy0, cv->cy1);
-+ /* position across the film, 0..4096 from its top edge, stepped per row */
-+ int dv = 4096 * 256 / (2 * hw8 > 0 ? 2 * hw8 : 1);
-+ int v = ((ya * 256 + 128 - (cy8 - hw8)) * dv) >> 8;
-+ /* sprocket holes, as ranges of v: the background shows */
-+ int h1 = perf_col && t <= full ? 300 : 1 << 20, h2 = perf_col ? 3316 : 1 << 20;
-+ /* whole rows inside the edges go through the quick loop */
-+ int yf0 = fos_clamp((top8 + 255) >> 8, ya, yb), yf1 = fos_clamp(bot8 >> 8, yf0, yb);
-+ uint8_t *px = &cv->px[ya * cv->pitch + x];
-+ for (int y = ya; y < yb; y++, v += dv, px += cv->pitch)
-+ {
-+ if (y == yf0 && yf1 > yf0)
-+ {
-+ uint8_t bay[4];
-+ for (int j = 0; j < 4; j++) bay[j] = fos_bayer[(y + j) & 3][x & 3];
-+ leader_run(px, cv->pitch, yf1 - yf0, v, dv, lv_along, sheen_k, lmul, &ix_tab[ramp][0], bay, h1, h2);
-+ int n = yf1 - yf0 - 1;
-+ y += n; v += n * dv; px += n * cv->pitch;
-+ continue;
-+ }
-+ int yc = y * 256 + 128;
-+ int cov = fos_clamp(128 + (yc - top8), 0, 256) * fos_clamp(128 + (bot8 - yc), 0, 256) >> 8;
-+ if (cov <= 0) continue;
-+ if ((unsigned) (v - h1) < 480 || (unsigned) (v - h2) < 480) continue;
-+ /* glossy emulsion: a soft sheen a third of the way down */
-+ int sheen = 4096 - ABS16(v - 1300) * 5;
-+ int lv = lv_along + (sheen > 0 ? (sheen * sheen_k) >> 20 : 0);
-+ *px = fos_mix(*px, ramp, lit(lv, p->light), cov);
-+ }
-+ }
-+}
-+
-+/* geometry of one pose, shared by the parts */
-+struct can_geo
-+{
-+ int s, r8, rc8, rs8, cx8;
-+ int e_c, e_s; /* cap / spool ellipse half heights */
-+ int tb8, hb8, bb8, hs8;
-+ int yc8; /* cap ellipse centre */
-+ int xl, xr; /* the canister's columns */
-+ int x0, x1; /* ... those inside the clip */
-+};
-+
-+static int prepare(const struct fos_canvas *cv, const struct fos_can *c, const struct fos_can_pose *p,
-+ struct can_geo *g)
-+{
-+ int s = p->scale;
-+ if (s <= 0) return 0;
-+ g->s = s;
-+ g->r8 = R * s; g->rc8 = RC * s; g->rs8 = RS * s;
-+ g->cx8 = p->cx8;
-+ g->e_c = g->rc8 * TILT / 256;
-+ g->e_s = g->rs8 * TILT / 256;
-+ g->tb8 = TB * s; g->hb8 = HB * s; g->bb8 = BB * s; g->hs8 = HS * s;
-+ g->yc8 = p->floor_y * 256 - (g->e_c + g->tb8 + g->hb8 + g->bb8);
-+ g->xl = (g->cx8 - g->rc8) >> 8;
-+ g->xr = (g->cx8 + g->rc8 + 255) >> 8;
-+ if (g->xr - g->xl > MAX_COLS) return 0;
-+ g->x0 = fos_clamp(g->xl, cv->cx0, cv->cx1);
-+ g->x1 = fos_clamp(g->xr, cv->cx0, cv->cx1);
-+
-+ /* reciprocals instead of divisions in the loop */
-+ int inv_pb = (NPROF << 16) / (2 * g->r8), inv_pc = (NPROF << 16) / (2 * g->rc8);
-+ int inv_ps = (NPROF << 16) / (2 * g->rs8);
-+ int inv_ec = (1 << 28) / g->rc8, inv_es = (1 << 28) / g->rs8;
-+ int fade = p->light;
-+ for (int x = g->x0; x < g->x1; x++)
-+ {
-+ struct can_col *k = &cols[x - g->xl];
-+ int dx8 = x * 256 + 128 - g->cx8;
-+ int adx = dx8 < 0 ? -dx8 : dx8;
-+ k->body = adx < g->r8;
-+ int pi = k->body ? PROF(dx8 + g->r8, inv_pb) : PROF(dx8 + g->rc8, inv_pc);
-+ int u16 = ((prof_ang[pi] + p->rot) & 0xFFFF) * TW + U_FRONT * 65536;
-+ k->u = wrap_u(u16 >> 16);
-+ k->uf = (u16 >> 8) & 0xFF;
-+ k->cov = fos_clamp(128 + (g->rc8 - adx), 0, 256);
-+ k->metal = lit(prof_metal[PROF(dx8 + g->rc8, inv_pc)], fade);
-+ int arc_c = arc8(dx8, g->rc8);
-+ k->top8 = g->yc8 + arc_c;
-+ k->cap8 = g->yc8 - arc_c - 512;
-+ k->ex = fos_clamp((dx8 * inv_ec) >> 16, -8192, 8192);
-+ k->sx = fos_clamp((fos_clamp(dx8, -4 * g->rs8, 4 * g->rs8) * inv_es) >> 16, -16384, 16384);
-+ k->ex2 = k->ex * k->ex;
-+ k->sx2 = k->sx * k->sx;
-+ if (adx < g->rs8)
-+ {
-+ int arc_s = arc8(dx8, g->rs8);
-+ k->spool = lit(prof_dark[PROF(dx8 + g->rs8, inv_ps)], fade);
-+ k->sp_top8 = g->yc8 - g->hs8 + arc_s;
-+ k->sp_bot8 = g->yc8 + arc_s;
-+ if (g->yc8 - g->hs8 - arc_s - 256 < k->cap8) k->cap8 = g->yc8 - g->hs8 - arc_s - 256;
-+ }
-+ else k->spool = -1;
-+ /* diffuse light, then the gloss over it, all faded */
-+ int sp = (prof_spec[pi] * c->gloss) >> 8;
-+ k->gain = ((prof_light[pi] * (256 - sp)) >> 8) * fade;
-+ k->offs = (sp * LV_MAX * fade) >> 16;
-+ }
-+ return 1;
-+}
-+
-+/* the cap seen from above: rolled rim, recessed disc, the spool end */
-+static void draw_cap(struct fos_canvas *cv, const struct can_geo *g, int rot, int fade)
-+{
-+ if (!ix_tab_ready) build_ix_tab();
-+ int ya = fos_clamp(((g->yc8 - g->hs8 - g->e_s) >> 8) - 2, cv->cy0, cv->cy1);
-+ int yb = fos_clamp(((g->yc8 + g->e_c) >> 8) + 2, ya, cv->cy1);
-+ if (yb - ya > MAX_CAP_ROWS) yb = ya + MAX_CAP_ROWS;
-+ /* per row: y across the cap and the spool top (4096 = edge), squared,
-+ * and the rim's and the disc's light falling off towards us */
-+ struct { int ey2, sy, sy2, rim, disc, inv; } rows[MAX_CAP_ROWS];
-+ int ec = g->e_c ? g->e_c : 1, es = g->e_s ? g->e_s : 1;
-+ int inv_e = (1 << 28) / ec, inv_s = (1 << 28) / es;
-+ for (int y = ya; y < yb; y++)
-+ {
-+ int yc = y * 256 + 128, j = y - ya;
-+ int ey = (fos_clamp(yc - g->yc8, -4 * ec, 4 * ec) * inv_e) >> 16;
-+ int sy = (fos_clamp(yc - (g->yc8 - g->hs8), -4 * es, 4 * es) * inv_s) >> 16;
-+ rows[j].ey2 = ey * ey;
-+ rows[j].sy = sy;
-+ rows[j].sy2 = sy * sy;
-+ rows[j].rim = LV12(150) - ey * LV12(60) / 4096;
-+ rows[j].disc = LV12(96) - ey * LV12(22) / 4096;
-+ /* how fast rho2 changes per px going down: the edge is that soft */
-+ int gy = 2 * (ey < 0 ? -ey : ey) * 256 / ec;
-+ rows[j].inv = (1 << 24) / (gy > 64 ? gy : 64);
-+ }
-+ int cs = fos_cos(rot * 2), sn = fos_sin(rot * 2);
-+ for (int x = g->x0; x < g->x1; x++)
-+ {
-+ const struct can_col *k = &cols[x - g->xl];
-+ if (k->cov <= 0) continue;
-+ /* ... and going across: the edge's anti-aliasing follows the steeper */
-+ int gx = 2 * (k->ex < 0 ? -k->ex : k->ex) * 256 / g->rc8;
-+ int inv_x = (1 << 24) / (gx > 64 ? gx : 64);
-+ int y0 = fos_clamp(k->cap8 >> 8, ya, yb);
-+ int rim_x = k->ex * LV12(40) / 4096, disc_x = k->ex * LV12(30) / 4096;
-+ int spool_top = LV12(34) - k->sx * LV12(14) / 4096, slot_x = cs * k->sx;
-+ uint8_t bay[4];
-+ for (int j = 0; j < 4; j++) bay[j] = fos_bayer[j][x & 3];
-+ uint8_t *px = &cv->px[y0 * cv->pitch + x];
-+ for (int y = y0; y < yb; y++, px += cv->pitch)
-+ {
-+ int yc = y * 256 + 128, j = y - ya;
-+ if (yc >= k->top8) break;
-+ int rho2 = (k->ex2 + rows[j].ey2) >> 12; /* 4096 = edge */
-+ if (rho2 > 4096 + 400) continue;
-+ int inv = rows[j].inv < inv_x ? rows[j].inv : inv_x;
-+ int cov = 128 + (((4096 - rho2) * inv) >> 16);
-+ if (cov <= 0) continue;
-+ if (cov > 256) cov = 256;
-+ if (k->cov < 256) cov = cov * k->cov >> 8;
-+ int ramp = RAMP_METAL, lv;
-+ int srho2 = (k->sx2 + rows[j].sy2) >> 12;
-+ if (srho2 <= 4096)
-+ {
-+ /* top of the spool: black plastic with the key slot */
-+ ramp = RAMP_GRAY;
-+ int along = (slot_x + sn * rows[j].sy) >> 12;
-+ int slot = along > -1000 && along < 1000 && srho2 < 3000;
-+ lv = slot ? LV12(8) : srho2 > 3300 ? LV12(48) : spool_top;
-+ }
-+ else if (k->spool >= 0 && yc >= k->sp_top8 && yc < k->sp_bot8)
-+ {
-+ ramp = RAMP_GRAY;
-+ lv = k->spool;
-+ goto out;
-+ }
-+ else if (rho2 > 3250)
-+ {
-+ /* rolled rim: catches the light, brighter at the back */
-+ lv = rows[j].rim - rim_x - (rho2 > 3900 ? LV12(40) : 0);
-+ }
-+ else
-+ {
-+ /* recessed disc: a soft gradient, a ring round the spool */
-+ lv = srho2 < 4096 * 5 / 3 ? LV12(60) : rows[j].disc - disc_x;
-+ }
-+ lv = fos_clamp(lit(lv, fade), 0, LV_MAX);
-+ out:
-+ if (cov >= 256) *px = ix_tab[ramp][((fos_ramp_pos(ramp, lv) + bay[y & 3]) >> 4) & 255];
-+ else if (cov > 0) *px = fos_mix(*px, ramp, lv, cov);
-+ }
-+ }
-+}
-+
-+/* Label pixels down a column (the canvas is FOS_W wide). v8 is the
-+ * texture row in 1/256, stepping by ds. For each ramp gb holds 8 words:
-+ * this column's gain, then its offset with the dither threshold of rows
-+ * 0..3 of the run already added. Kept apart from the rest of the drawing
-+ * so the loop has the registers to itself. */
-+#define LABEL_TEXEL(j) \
-+ { \
-+ int t = *(const uint16_t *) ((const uint8_t *) b0 + ((v8 >> 7) & ~1)); \
-+ int r = t >> 12; \
-+ const int32_t *k = &gb[r * 8]; \
-+ int q = ((((t & 0xFFF) * k[0]) >> 16) + k[1 + (j)]) >> 4; \
-+ *px = tab[r << 8 | (q & 255)]; \
-+ px += FOS_W; v8 += ds; \
-+ }
-+
-+__attribute__((noinline))
-+static void label_run(uint8_t *px, int n, int v8, int ds, const uint16_t *b0, const int32_t *gb)
-+{
-+ const uint8_t *tab = &ix_tab[0][0];
-+ for (; n >= 4; n -= 4)
-+ {
-+ LABEL_TEXEL(0) LABEL_TEXEL(1) LABEL_TEXEL(2) LABEL_TEXEL(3)
-+ }
-+ if (n > 0) LABEL_TEXEL(0)
-+ if (n > 1) LABEL_TEXEL(1)
-+ if (n > 2) LABEL_TEXEL(2)
-+}
-+
-+/* the same between two texture columns, a fraction uf of the way to b1:
-+ * levels of one ramp blend, different inks dither (thr: thresholds) */
-+#define LABEL_TEXEL2(j) \
-+ { \
-+ int o = (v8 >> 7) & ~1; \
-+ int t = *(const uint16_t *) ((const uint8_t *) b0 + o); \
-+ int t1 = *(const uint16_t *) ((const uint8_t *) b1 + o); \
-+ if (t1 != t) \
-+ { \
-+ if ((t ^ t1) >> 12) { if (uf > thr[j]) t = t1; } \
-+ else t += (((t1 & 0xFFF) - (t & 0xFFF)) * uf) >> 8; \
-+ } \
-+ int r = t >> 12; \
-+ const int32_t *k = &gb[r * 8]; \
-+ int q = ((((t & 0xFFF) * k[0]) >> 16) + k[1 + (j)]) >> 4; \
-+ *px = tab[r << 8 | (q & 255)]; \
-+ px += FOS_W; v8 += ds; \
-+ }
-+
-+__attribute__((noinline))
-+static void label_run_filtered(uint8_t *px, int n, int v8, int ds, const uint16_t *b0, const uint16_t *b1,
-+ int uf, const int32_t *gb, const uint8_t *thr)
-+{
-+ const uint8_t *tab = &ix_tab[0][0];
-+ for (; n >= 4; n -= 4)
-+ {
-+ LABEL_TEXEL2(0) LABEL_TEXEL2(1) LABEL_TEXEL2(2) LABEL_TEXEL2(3)
-+ }
-+ if (n > 0) LABEL_TEXEL2(0)
-+ if (n > 1) LABEL_TEXEL2(1)
-+ if (n > 2) LABEL_TEXEL2(2)
-+}
-+
-+/* first row whose centre is at least a below edge8 (1/256 px) */
-+FOS_INLINE int row_at(int edge8, int a)
-+{
-+ return (edge8 + a - 128 + 255) >> 8;
-+}
-+
-+/* the bands and the label, a column at a time: the texture row just steps */
-+static void draw_body(struct fos_canvas *cv, const struct fos_can *c, const struct can_geo *g, int fade, int fast)
-+{
-+ int ds = 65536 / g->s; /* texels per row, 8.8 */
-+ int band_t = g->tb8, body_b = g->tb8 + g->hb8, band_b = body_b + g->bb8;
-+ int step_t = 65536 / (band_t ? band_t : 1), step_b = 65536 / (g->bb8 ? g->bb8 : 1);
-+ int lip_hi = lit(LV12(40), fade), groove = lit(LV12(70), fade), ridge = lit(LV12(30), fade);
-+ int filter = fos_can_quality > 1;
-+ int pitch = cv->pitch;
-+ if (!ix_tab_ready) build_ix_tab();
-+
-+ for (int x = g->x0; x < g->x1; x++)
-+ {
-+ const struct can_col *k = &cols[x - g->xl];
-+ if (k->cov <= 0) continue;
-+ int ya = fos_clamp(row_at(k->top8, 0), cv->cy0, cv->cy1);
-+ int yb = fos_clamp(row_at(k->top8, band_t), cv->cy0, cv->cy1);
-+ int yc_ = fos_clamp(row_at(k->top8, body_b), cv->cy0, cv->cy1);
-+ int yd = fos_clamp(row_at(k->top8, band_b), cv->cy0, cv->cy1);
-+ int y;
-+
-+ /* top crimp: a rolled lip above, a groove below; f = 0..256 down the band */
-+ int f = ((ya * 256 + 128 - k->top8) * step_t) >> 8;
-+ for (y = ya; y < yb; y++, f += step_t)
-+ {
-+ int lv = k->metal + (f < 70 ? lip_hi : 0) - (f > 210 ? groove : 0);
-+ put(cv, x, y, RAMP_METAL, fos_clamp(lv, 0, LV_MAX), k->cov);
-+ }
-+
-+ /* the printed label */
-+ if (k->body && yb < yc_)
-+ {
-+ const uint16_t *b0 = &c->tex[k->u * TH];
-+ const uint16_t *b1 = &c->tex[(k->u + 1 < TW ? k->u + 1 : 0) * TH];
-+ int v8 = ((yb * 256 + 128 - k->top8 - band_t) * ds) >> 8;
-+ /* keep the texture row inside the label */
-+ int ye = yc_;
-+ if (v8 < 0) v8 = 0;
-+ if (((v8 + (ye - yb - 1) * ds) >> 8) >= TH) ye = yb + ((TH * 256 - 1 - v8) / ds) + 1;
-+ uint8_t *px = &cv->px[yb * pitch + x];
-+ if (k->cov >= 256 && ye > yb && pitch == FOS_W)
-+ {
-+ /* this column's light, folded into each ramp's position
-+ * scale, with the dither of the run's rows 0..3 */
-+ int32_t gb[RAMP_COUNT * 8];
-+ uint8_t thr[4];
-+ int g4 = k->gain >> 4;
-+ int bay[4];
-+ for (int j = 0; j < 4; j++)
-+ {
-+ int yy = (yb + j) & 3;
-+ bay[j] = fos_bayer[yy][x & 3];
-+ thr[j] = fos_bayer[(yy + 2) & 3][(x + 1) & 3] * 16 + 8;
-+ }
-+ for (int r = 0; r < RAMP_COUNT; r++)
-+ {
-+ if (!(c->ramps & (1 << r))) continue;
-+ int32_t *e = &gb[r * 8];
-+ int o = (k->offs * fos_ramp_mul[r]) >> 16;
-+ e[0] = (g4 * fos_ramp_mul[r]) >> 12;
-+ e[1] = o + bay[0]; e[2] = o + bay[1]; e[3] = o + bay[2]; e[4] = o + bay[3];
-+ }
-+ if (filter && k->uf && !fast)
-+ label_run_filtered(px, ye - yb, v8, ds, b0, b1, k->uf, gb, thr);
-+ else
-+ label_run(px, ye - yb, v8, ds, b0, gb);
-+ }
-+ else
-+ {
-+ /* the silhouette's edge columns, blended with what is behind */
-+ for (y = yb; y < ye; y++, v8 += ds, px += pitch)
-+ {
-+ int t = b0[v8 >> 8];
-+ int lv = (((t & 0xFFF) * k->gain) >> 16) + k->offs;
-+ *px = fos_mix(*px, t >> 12, lv > LV_MAX ? LV_MAX : lv, k->cov);
-+ }
-+ }
-+ }
-+
-+ /* bottom crimp, its lower edge following the cap ellipse */
-+ int rel = yc_ * 256 + 128 - k->top8;
-+ f = ((rel - body_b) * step_b) >> 8;
-+ for (y = yc_; y < yd; y++, rel += 256, f += step_b)
-+ {
-+ int lv = k->metal - (f < 50 ? groove : 0) + (f > 140 && f < 200 ? ridge : 0);
-+ int cov = k->cov;
-+ int below = rel - (band_b - 256);
-+ if (below > 0) cov = cov * (256 - below) >> 8;
-+ put(cv, x, y, RAMP_METAL, fos_clamp(lv, 0, LV_MAX), cov);
-+ }
-+ }
-+}
-+
-+/* the canister mirrored in the glossy floor, fading out below it: a little
-+ * of each pixel above the bottom edge glazed over the floor below it */
-+static void draw_reflection(struct fos_canvas *cv, const struct fos_can_pose *p, const struct can_geo *g)
-+{
-+ int depth = 38 * g->s / 256;
-+ if (depth <= 0) return;
-+ int y0 = fos_clamp(p->floor_y, cv->cy0, cv->cy1), y1 = fos_clamp(p->floor_y + depth, cv->cy0, cv->cy1);
-+ if (y1 - y0 > 64) y1 = y0 + 64;
-+ int kk[64];
-+ for (int y = y0; y < y1; y++)
-+ {
-+ int k = p->reflect * (depth - (y - p->floor_y)) / depth;
-+ kk[y - y0] = (k * k / 256) * 200 >> 8; /* the print a little darker in the floor */
-+ if (kk[y - y0] < 2) { y1 = y; break; } /* fainter than a level step */
-+ }
-+ int edge_off = g->tb8 + g->hb8 + g->bb8; /* from the band's top edge to the bottom outline */
-+ int pitch = cv->pitch;
-+ for (int x = g->x0; x < g->x1; x++)
-+ {
-+ const struct can_col *col = &cols[x - g->xl];
-+ if (col->cov < 128) continue;
-+ int edge8 = col->top8 + edge_off;
-+ int reach = col->body ? 1 << 30 : g->bb8; /* past the body only the band shows */
-+ for (int y = y0; y < y1; y++)
-+ {
-+ int up = y * 256 + 128 - edge8; /* below the edge = above it in the mirror */
-+ if (up < 0) continue;
-+ if (up >= reach) break;
-+ int sy = (edge8 - up) >> 8;
-+ if (sy < cv->cy0) break;
-+ int k = kk[y - y0];
-+ if (k <= 0) break;
-+ uint8_t *px = &cv->px[y * pitch + x];
-+ *px = fos_glaze(*px, cv->px[sy * pitch + x], k, x, y);
-+ }
-+ }
-+}
-+
-+void fos_can_draw(struct fos_canvas *cv, struct fos_can *c, const struct fos_can_pose *p)
-+{
-+ struct can_geo g;
-+ if (!c || !prepare(cv, c, p, &g)) return;
-+ if (g.xr <= cv->cx0 || g.xl >= cv->cx1) return;
-+ if (p->leader)
-+ draw_leader(cv, c, p, (g.yc8 + g.tb8) >> 8, g.s);
-+ draw_cap(cv, &g, p->rot, p->light);
-+ draw_body(cv, c, &g, p->light, p->fast);
-+ if (p->reflect && fos_can_quality > 0)
-+ draw_reflection(cv, p, &g);
-+}
-diff --git a/src/fos_font.c b/src/fos_font.c
-new file mode 100644
-index 000000000..ba76a9ed0
---- /dev/null
-+++ b/src/fos_font.c
-@@ -0,0 +1,4254 @@
-+/* generated by tools/mkfont.py from Barlow (SIL Open Font License 1.1,
-+ * see fonts/OFL.txt) - do not edit. Not linked into the camera: it goes
-+ * on the card as ML/DATA/FOSFONT.BIN (tools/fontblob.c) */
-+
-+#include "fos_gfx.h"
-+
-+static const uint8_t xs_bits[] = {
-+ 128,8,14,129,8,14,129,8,13,129,7,13,129,7,13,129,6,12,133,2,3,129,9,13,
-+ 128,11,10,6,14,26,6,14,9,8,5,12,151,129,6,15,2,3,15,5,130,8,14,128,
-+ 5,15,2,129,12,95,1,128,4,14,12,5,12,13,5,130,14,8,128,27,130,2,15,8,
-+ 1,13,10,1,128,4,95,9,128,1,8,15,22,15,8,2,129,8,14,128,5,15,3,129,
-+ 130,15,4,130,1,7,15,10,2,129,12,15,13,15,14,2,4,15,4,128,2,14,9,4,
-+ 15,4,129,23,128,11,15,9,3,131,7,13,15,10,1,131,6,15,9,6,15,130,10,11,
-+ 3,15,9,3,4,14,8,128,5,13,15,14,9,1,130,15,5,129,128,6,14,13,5,129,
-+ 13,3,130,14,8,9,13,128,7,10,131,10,31,8,1,14,2,132,3,2,128,9,8,135,
-+ 3,13,1,135,11,6,5,30,4,131,4,12,128,14,6,7,13,131,12,4,128,14,7,8,
-+ 13,130,6,10,129,5,14,13,3,128,128,1,11,15,13,6,131,10,14,7,10,15,2,130,
-+ 10,13,128,5,15,4,130,3,15,10,14,12,131,2,13,15,12,1,130,1,14,12,8,15,
-+ 6,5,10,128,6,15,2,128,7,31,8,128,5,15,10,6,10,31,3,129,8,13,14,12,
-+ 6,11,13,1,27,10,11,25,139,129,10,13,129,2,15,7,129,8,15,2,129,11,14,130,
-+ 14,11,130,15,10,130,15,10,130,14,11,130,12,13,130,8,15,2,129,3,15,7,130,10,
-+ 13,128,128,11,12,130,5,15,4,129,1,15,10,130,12,13,130,10,15,1,129,9,15,2,
-+ 129,9,15,2,129,10,15,1,129,12,13,129,1,15,9,129,5,15,4,129,27,129,2,1,
-+ 13,1,3,5,12,14,12,7,5,12,14,12,6,2,1,13,1,3,152,129,7,12,131,7,
-+ 12,129,17,7,13,17,9,63,14,2,4,9,13,20,129,7,12,135,128,14,5,2,15,1,
-+ 4,12,128,65,9,47,12,2,36,3,142,131,1,15,8,129,3,1,128,130,9,13,131,14,
-+ 8,130,5,15,2,130,11,12,130,1,15,6,130,7,15,1,130,12,11,130,3,15,5,130,
-+ 8,14,131,128,3,12,14,13,7,128,1,14,12,6,9,15,5,4,15,4,129,13,9,4,
-+ 15,3,129,13,10,4,15,3,129,13,10,4,15,3,129,13,10,3,15,4,129,13,9,1,
-+ 14,12,6,9,15,5,128,3,12,14,13,7,128,2,10,15,10,128,5,10,14,10,130,12,
-+ 10,130,12,10,130,12,10,130,12,10,130,12,10,130,12,10,130,12,10,128,128,5,13,15,
-+ 12,5,128,3,15,11,6,11,15,2,6,15,2,128,3,15,5,131,9,15,1,130,5,15,
-+ 7,130,4,15,10,130,3,14,11,130,2,13,14,6,21,3,5,79,8,5,79,18,21,7,
-+ 15,13,1,129,2,29,2,130,13,15,10,2,130,20,28,132,5,15,2,6,15,2,128,6,
-+ 15,18,15,11,6,29,129,5,13,15,12,3,128,129,3,15,6,132,11,13,132,3,15,6,
-+ 132,10,13,128,5,15,2,128,3,15,7,2,6,15,4,128,7,79,14,128,2,36,8,15,
-+ 6,132,5,15,3,132,5,15,2,128,5,79,1,5,15,7,37,128,5,15,3,1,130,5,
-+ 15,12,15,14,6,128,5,15,11,5,11,15,2,1,2,129,3,15,5,3,10,3,128,4,
-+ 15,5,1,14,12,6,12,14,1,128,3,12,15,12,4,128,128,6,13,14,12,5,128,3,
-+ 15,11,6,12,15,1,5,15,3,128,2,6,1,5,15,12,15,14,6,128,5,15,11,5,
-+ 11,15,2,5,15,4,128,4,15,5,4,15,4,128,4,15,5,1,14,12,6,12,14,1,
-+ 128,4,12,15,12,4,128,10,79,2,10,11,21,11,15,1,2,1,129,14,10,131,5,15,
-+ 4,131,10,13,131,1,15,8,131,7,15,2,131,13,11,131,3,15,5,130,128,5,12,14,
-+ 12,4,128,2,15,10,6,11,15,1,3,15,7,2,8,15,2,128,10,47,8,128,1,14,
-+ 11,5,11,14,1,5,15,3,128,4,15,4,6,15,4,128,4,15,4,2,14,12,6,12,
-+ 14,1,128,4,13,15,12,4,128,128,7,13,15,11,3,128,4,15,10,6,12,13,128,7,
-+ 15,1,128,6,15,2,6,15,6,2,10,15,3,128,11,31,13,15,3,129,19,5,15,3,
-+ 4,14,3,128,5,15,3,2,15,12,6,13,14,1,128,5,13,15,12,4,128,133,7,15,
-+ 1,129,1,3,140,7,15,1,129,1,3,129,128,11,12,129,12,14,1,140,9,10,129,11,
-+ 7,129,13,3,128,131,1,7,129,2,9,14,13,3,10,15,12,6,128,9,15,8,130,2,
-+ 9,15,13,7,1,129,1,8,30,131,1,6,8,63,14,1,51,2,8,63,14,1,51,2,
-+ 139,5,3,131,8,15,11,5,130,3,10,15,13,6,130,4,30,128,5,11,15,12,5,8,
-+ 15,10,3,129,4,2,131,128,7,13,14,11,2,128,5,15,9,6,13,12,128,8,14,129,
-+ 8,15,131,2,13,12,130,2,29,3,130,10,14,2,131,23,132,3,2,132,12,11,130,141,
-+ 7,13,31,12,3,131,11,14,8,5,6,11,15,3,129,8,12,1,131,10,11,128,1,14,
-+ 3,2,12,14,13,4,3,14,128,4,12,128,9,8,2,15,3,1,15,128,6,10,128,13,
-+ 2,128,15,1,2,14,128,5,11,128,13,4,5,15,2,8,9,128,2,15,2,6,14,12,
-+ 9,14,11,1,129,9,13,5,18,5,1,131,1,9,47,13,3,133,1,4,2,132,130,13,
-+ 15,4,132,3,15,14,10,132,8,13,7,14,132,13,8,2,15,4,130,3,15,4,128,13,
-+ 9,130,8,14,129,8,14,130,13,79,4,128,3,15,7,35,14,9,128,7,15,1,130,10,
-+ 14,128,1,63,12,4,128,1,15,10,5,6,12,14,17,15,7,129,4,15,3,1,15,7,
-+ 1,2,9,13,17,79,6,128,1,15,9,20,10,15,2,1,15,7,129,3,15,5,1,15,
-+ 10,5,6,11,15,2,1,63,12,5,128,128,2,10,30,10,2,129,29,23,14,13,128,3,
-+ 15,5,129,5,15,3,4,15,4,132,4,15,4,132,4,15,4,130,1,128,3,15,5,129,
-+ 5,15,3,128,29,23,14,13,129,2,11,30,10,2,128,1,63,12,4,128,1,15,10,5,
-+ 6,12,15,2,1,15,7,129,3,15,5,1,15,7,129,2,15,6,1,15,7,129,2,15,
-+ 6,1,15,7,129,2,15,6,1,15,7,129,3,15,5,1,15,10,5,6,12,15,2,1,
-+ 63,12,4,128,1,95,2,1,15,10,53,128,1,15,7,132,1,15,7,33,129,1,63,10,
-+ 129,1,15,9,20,2,129,1,15,7,132,1,15,10,53,128,1,95,2,1,95,17,15,10,
-+ 53,128,1,15,7,132,1,15,7,33,129,1,63,10,129,1,15,9,20,2,129,1,15,7,
-+ 132,1,15,7,132,1,15,7,132,128,2,10,30,10,2,129,13,14,7,6,29,128,3,15,
-+ 5,129,4,13,3,4,15,4,128,33,128,4,15,4,1,47,3,4,15,4,128,4,7,15,
-+ 19,15,5,129,5,15,2,128,13,14,7,6,13,11,129,2,11,30,10,1,128,1,15,7,
-+ 129,1,15,6,1,15,7,129,1,15,6,1,15,7,129,1,15,6,1,15,7,17,2,15,
-+ 6,1,95,6,1,15,9,20,5,15,6,1,15,7,129,1,15,6,1,15,7,129,1,15,
-+ 6,1,15,7,129,1,15,6,1,15,7,1,15,7,1,15,7,1,15,7,1,15,7,1,
-+ 15,7,1,15,7,1,15,7,1,15,7,132,13,9,133,13,9,133,13,9,133,13,9,133,
-+ 13,9,128,9,10,130,13,9,128,10,13,130,14,9,128,6,15,10,6,11,15,4,129,7,
-+ 13,15,13,6,129,1,15,7,129,6,15,4,1,15,7,128,4,15,7,128,1,15,7,3,
-+ 14,10,129,1,15,8,13,12,1,129,1,47,13,1,129,1,15,13,3,14,9,129,1,15,
-+ 7,128,7,15,4,128,1,15,7,129,12,13,17,15,7,129,3,15,8,1,15,7,132,1,
-+ 15,7,132,1,15,7,132,1,15,7,132,1,15,7,132,1,15,7,132,1,15,7,132,1,
-+ 15,10,53,128,1,95,128,1,15,11,130,7,15,5,1,31,6,128,2,31,5,1,15,30,
-+ 2,12,14,15,5,1,15,8,13,14,15,6,15,5,1,15,7,4,15,9,2,15,5,1,
-+ 15,7,128,3,1,2,15,5,1,15,7,130,2,15,5,1,15,7,130,2,15,5,1,15,
-+ 7,130,2,15,5,1,15,10,130,27,128,1,31,4,129,27,128,1,31,13,1,128,27,128,
-+ 1,15,8,14,8,128,27,128,1,15,23,15,2,27,128,1,15,7,128,12,43,128,1,15,
-+ 7,128,3,31,11,128,1,15,7,129,9,15,11,128,1,15,7,129,1,14,11,128,128,2,
-+ 10,30,10,2,129,12,14,23,29,128,3,15,6,129,4,15,20,15,4,129,2,15,5,4,
-+ 15,4,129,2,15,5,4,15,4,129,2,15,5,3,15,5,129,4,15,4,128,12,14,7,
-+ 6,29,129,2,10,30,11,2,128,2,63,13,5,128,2,15,9,5,6,12,15,18,15,6,
-+ 129,3,15,5,2,15,6,1,2,9,15,3,2,79,9,128,2,15,8,20,2,129,2,15,
-+ 6,132,2,15,6,132,2,15,6,132,128,2,11,30,8,130,29,6,8,15,8,128,4,15,
-+ 4,129,9,14,128,6,15,2,129,7,15,128,6,15,2,129,7,15,128,6,15,2,129,7,
-+ 15,128,6,15,2,129,8,15,128,3,15,8,128,1,13,12,129,10,15,30,15,5,130,5,
-+ 15,12,3,132,14,9,130,1,63,13,5,128,1,15,10,21,11,15,2,1,15,7,129,3,
-+ 15,5,1,15,7,17,8,15,3,1,79,9,128,1,15,9,4,28,129,1,15,7,128,4,
-+ 15,4,128,1,15,7,129,12,11,128,1,15,7,129,5,15,4,128,4,12,30,9,1,128,
-+ 2,15,11,6,7,14,11,128,4,15,4,129,7,14,128,1,29,5,132,1,9,30,8,130,
-+ 1,129,6,14,11,128,6,15,1,129,7,15,1,3,15,12,22,29,129,5,12,15,14,10,
-+ 2,128,8,95,1,3,5,6,15,10,21,131,15,7,133,15,7,133,15,7,133,15,7,133,
-+ 15,7,133,15,7,133,15,7,130,2,15,6,129,1,15,6,2,15,6,129,2,15,6,2,
-+ 15,6,129,2,15,6,2,15,6,129,2,15,6,2,15,6,129,2,15,6,2,15,6,129,
-+ 2,15,6,1,15,7,129,3,15,5,128,11,14,7,6,13,14,1,128,1,10,30,11,3,
-+ 128,7,15,2,129,2,15,6,3,15,6,129,6,15,2,128,13,10,129,11,12,129,8,14,
-+ 128,1,15,7,129,4,15,20,15,2,130,14,8,9,13,131,9,29,8,131,4,31,3,132,
-+ 14,13,130,8,15,1,128,3,15,9,129,8,14,128,4,15,4,128,6,15,13,129,12,11,
-+ 128,1,15,8,128,10,14,15,2,1,15,7,129,11,12,128,14,8,15,6,4,15,3,129,
-+ 7,15,3,15,3,12,9,8,14,130,3,15,10,15,128,9,13,12,11,131,14,15,11,128,
-+ 5,31,7,131,10,15,8,128,1,31,3,131,6,15,4,129,13,14,130,5,15,4,129,4,
-+ 15,5,128,11,13,129,13,11,129,2,15,23,15,2,130,8,30,8,131,1,31,1,131,8,
-+ 30,8,130,2,15,23,15,2,129,11,13,129,13,11,128,5,15,4,129,4,15,5,6,15,
-+ 3,129,6,15,3,128,13,11,128,1,14,10,129,5,15,3,7,15,2,130,12,11,14,9,
-+ 131,5,31,2,132,13,10,133,13,10,133,13,10,133,13,10,130,8,79,10,3,37,8,15,
-+ 8,131,28,131,9,14,2,130,4,15,6,130,1,14,10,131,11,13,1,130,6,15,9,37,
-+ 3,8,79,10,49,128,8,31,9,128,8,15,4,2,128,8,14,130,8,14,130,8,14,130,
-+ 8,14,130,8,14,130,8,14,130,8,14,130,8,14,130,8,14,17,128,8,31,9,128,2,
-+ 20,2,128,1,15,6,131,11,12,131,5,15,2,130,1,14,8,131,9,13,131,4,15,4,
-+ 131,13,9,131,8,14,131,2,15,5,129,33,128,6,31,12,128,1,4,28,130,11,12,130,
-+ 11,12,130,11,12,130,11,12,130,11,12,130,11,12,130,11,12,130,11,12,129,1,11,12,
-+ 128,6,31,12,128,1,20,3,129,21,130,1,30,1,129,5,29,5,129,11,24,11,128,1,
-+ 15,3,2,15,1,6,13,129,12,6,151,81,128,11,79,5,3,68,1,17,128,4,14,2,
-+ 128,3,2,148,128,6,13,15,12,3,128,4,15,10,6,29,129,1,128,1,7,15,17,10,
-+ 63,1,7,15,7,4,9,15,1,7,15,23,13,15,17,11,14,13,10,15,1,3,15,5,
-+ 131,3,15,5,131,3,15,10,30,6,128,3,15,14,6,11,15,19,15,7,128,1,15,7,
-+ 3,15,6,129,14,9,3,15,7,128,1,15,7,3,15,14,6,11,15,19,15,10,30,6,
-+ 128,128,3,12,14,12,5,128,1,14,12,6,11,15,3,4,15,4,128,1,8,3,5,15,
-+ 2,131,4,15,4,128,1,7,2,1,14,12,6,11,15,3,128,3,12,15,13,5,128,131,
-+ 1,15,6,131,1,15,7,128,4,12,14,10,15,7,1,14,13,6,12,15,7,4,15,5,
-+ 128,3,15,7,5,15,3,128,2,15,7,3,15,5,128,3,15,7,1,14,13,6,12,15,
-+ 7,128,4,12,14,10,15,6,128,3,12,14,12,4,128,1,14,12,6,11,14,1,4,15,
-+ 5,1,4,15,21,79,7,3,15,7,36,2,128,13,12,6,8,13,2,128,3,11,15,13,
-+ 7,128,128,3,13,15,6,128,8,15,6,2,9,47,6,3,11,14,5,2,128,9,14,130,
-+ 9,14,130,9,14,130,9,14,130,9,14,129,128,4,13,14,11,15,6,1,14,12,6,12,
-+ 15,6,5,15,4,128,3,15,22,15,2,128,2,15,6,5,15,4,128,3,15,6,2,15,
-+ 12,6,12,15,6,128,5,13,14,11,15,6,131,4,15,4,129,4,6,13,14,1,129,13,
-+ 14,11,3,128,3,15,5,131,3,15,5,131,3,15,10,30,6,128,3,15,13,6,12,15,
-+ 2,3,15,5,128,4,15,4,3,15,5,128,3,15,5,3,15,5,128,3,15,5,3,15,
-+ 5,128,3,15,5,3,15,5,128,3,15,5,2,14,7,128,4,1,2,15,6,2,15,6,
-+ 2,15,6,2,15,6,2,15,6,2,15,6,2,15,6,128,2,14,6,129,4,1,128,2,
-+ 15,5,128,2,15,5,128,2,15,5,128,2,15,5,128,2,15,5,128,2,15,5,128,2,
-+ 15,5,128,2,15,5,3,10,15,3,10,14,8,128,3,15,5,131,3,15,5,131,3,15,
-+ 5,1,12,13,1,3,15,5,10,14,3,128,3,15,12,15,9,129,3,31,12,14,1,128,
-+ 3,15,8,2,15,6,128,3,15,5,128,10,13,128,3,15,5,128,4,15,5,3,15,5,
-+ 3,15,5,3,15,5,3,15,5,3,15,5,3,15,5,3,15,5,3,15,5,3,15,5,
-+ 3,15,10,13,14,6,7,14,13,5,128,3,15,12,6,12,15,11,6,29,128,3,15,5,
-+ 128,5,15,3,128,7,15,1,3,15,5,128,5,15,3,128,7,15,1,3,15,5,128,5,
-+ 15,3,128,7,15,1,3,15,5,128,5,15,3,128,7,15,1,3,15,5,128,5,15,2,
-+ 128,7,15,1,3,15,10,30,6,128,3,15,13,6,12,15,2,3,15,5,128,4,15,4,
-+ 3,15,5,128,3,15,5,3,15,5,128,3,15,5,3,15,5,128,3,15,5,3,15,5,
-+ 128,3,15,5,128,3,12,14,13,5,128,1,14,13,6,11,15,2,4,15,4,128,1,15,
-+ 7,5,15,2,129,14,9,4,15,4,128,1,15,7,128,29,6,11,15,2,128,3,11,14,
-+ 13,4,128,2,15,10,30,7,128,2,15,14,6,10,15,4,2,15,8,128,1,15,9,2,
-+ 15,6,129,13,10,2,15,8,128,1,15,9,2,15,14,6,10,15,4,2,15,10,30,7,
-+ 128,2,15,6,131,2,15,6,131,2,15,6,131,128,3,12,14,10,15,6,1,14,13,6,
-+ 12,15,7,3,15,5,128,3,15,7,5,15,3,128,2,15,7,4,15,5,128,3,15,7,
-+ 1,14,13,6,12,15,7,128,4,13,14,10,15,7,131,1,15,7,131,1,15,7,131,1,
-+ 15,6,3,15,10,14,9,3,15,13,6,19,15,6,129,3,15,5,129,3,15,5,129,3,
-+ 15,5,129,3,15,5,129,128,8,14,15,11,2,4,15,8,6,13,11,4,15,7,1,2,
-+ 3,128,6,13,15,11,18,5,128,3,28,5,15,9,6,13,12,128,8,14,15,12,3,128,
-+ 5,6,130,10,12,129,9,47,5,3,12,13,5,2,128,10,12,130,10,12,130,10,12,130,
-+ 9,14,6,1,128,4,13,15,3,4,15,3,128,4,15,3,4,15,4,128,4,15,20,15,
-+ 4,128,4,15,20,15,4,128,4,15,20,15,4,128,5,15,4,2,15,12,6,12,15,4,
-+ 128,6,30,10,15,3,8,15,1,128,8,15,2,4,15,5,128,28,129,14,9,1,15,7,
-+ 129,9,13,5,15,3,129,5,15,12,13,131,14,15,8,131,10,15,4,129,8,14,129,14,
-+ 10,128,1,15,7,4,15,3,2,15,14,128,5,15,3,1,15,7,6,14,15,3,9,13,
-+ 129,11,42,13,7,13,9,129,7,30,6,9,12,15,5,129,3,31,2,5,31,1,130,29,
-+ 128,1,15,11,129,7,15,3,128,8,15,3,128,28,3,15,8,129,3,15,14,13,131,10,
-+ 15,6,130,3,15,14,13,130,12,13,3,14,8,128,7,15,4,128,7,15,3,9,14,129,
-+ 8,14,128,5,15,3,128,12,10,128,1,15,7,1,15,5,129,27,5,15,1,129,6,14,
-+ 9,11,130,1,31,6,131,12,15,2,131,10,12,130,2,7,15,6,130,6,14,10,131,9,
-+ 63,7,3,21,11,15,5,129,4,15,8,129,2,14,11,130,12,13,1,129,8,15,8,21,
-+ 3,10,63,8,130,1,129,5,31,2,128,10,15,5,129,10,13,130,10,13,130,10,12,129,
-+ 5,15,8,129,6,15,7,130,11,12,130,10,13,130,10,13,130,10,14,2,129,7,31,2,
-+ 129,3,4,128,8,15,8,15,8,15,8,15,8,15,8,15,8,15,8,15,8,15,8,15,
-+ 8,15,17,130,8,15,12,129,2,10,15,3,129,4,15,3,129,4,15,3,129,4,15,4,
-+ 129,1,14,13,1,128,1,29,1,128,4,15,4,129,4,15,3,129,4,15,3,128,1,8,
-+ 15,3,128,8,15,14,1,128,2,4,1,129,134,2,13,15,8,2,7,1,4,9,5,12,
-+ 15,13,1,131,3,1,142,130,4,15,4,128,3,134,129,1,129,1,12,15,11,1,9,11,
-+ 5,11,7,10,8,2,10,8,3,14,15,13,2,128,1,3,1,158,128,4,129,4,128,5,
-+ 15,6,10,14,1,128,7,15,14,3,129,10,31,6,128,4,14,3,7,14,1,128,1,129,
-+ 1,134,81,9,63,10,2,52,2,139,113,128,9,111,4,2,100,1,145,5,15,2,9,11,
-+ 128,12,5,146,138,1,15,8,128,6,15,3,128,28,129,3,1,128,1,3,129,18,128,3,
-+ 29,3,8,31,9,2,29,3,135,128,3,15,4,128,12,9,128,4,15,2,129,12,9,129,
-+ 3,15,3,131,128,11,10,130,2,15,4,130,10,11,129,2,15,4,129,11,10,134,
-+};
-+static const struct fos_glyph xs_glyphs[] = {
-+ { 0, 3, 0, 0, 0, 42 }, /* 0x20 */
-+ { 0, 4, 9, 0, -9, 70 }, /* 0x21 */
-+ { 25, 4, 9, 0, -9, 68 }, /* 0x22 */
-+ { 37, 9, 9, 0, -9, 141 }, /* 0x23 */
-+ { 96, 7, 12, 0, -11, 118 }, /* 0x24 */
-+ { 162, 11, 9, 0, -9, 173 }, /* 0x25 */
-+ { 226, 9, 9, 0, -9, 143 }, /* 0x26 */
-+ { 292, 2, 9, 0, -9, 32 }, /* 0x27 */
-+ { 297, 5, 12, -1, -11, 66 }, /* 0x28 */
-+ { 338, 5, 12, 0, -11, 66 }, /* 0x29 */
-+ { 382, 5, 9, 0, -9, 83 }, /* 0x2a */
-+ { 403, 6, 7, 0, -7, 102 }, /* 0x2b */
-+ { 426, 3, 3, 0, -2, 55 }, /* 0x2c */
-+ { 435, 5, 6, 0, -6, 84 }, /* 0x2d */
-+ { 443, 4, 3, 0, -2, 57 }, /* 0x2e */
-+ { 451, 6, 9, 0, -9, 93 }, /* 0x2f */
-+ { 483, 7, 9, 0, -9, 118 }, /* 0x30 */
-+ { 541, 5, 9, 0, -9, 73 }, /* 0x31 */
-+ { 572, 7, 9, 0, -9, 115 }, /* 0x32 */
-+ { 619, 7, 9, 0, -9, 110 }, /* 0x33 */
-+ { 661, 8, 9, 0, -9, 122 }, /* 0x34 */
-+ { 706, 7, 9, 0, -9, 110 }, /* 0x35 */
-+ { 760, 7, 9, 0, -9, 110 }, /* 0x36 */
-+ { 823, 7, 9, 0, -9, 102 }, /* 0x37 */
-+ { 860, 7, 9, 0, -9, 111 }, /* 0x38 */
-+ { 921, 7, 9, 0, -9, 110 }, /* 0x39 */
-+ { 981, 5, 7, 0, -7, 74 }, /* 0x3a */
-+ { 996, 4, 8, 0, -7, 65 }, /* 0x3b */
-+ { 1013, 6, 7, 0, -7, 102 }, /* 0x3c */
-+ { 1044, 6, 6, 0, -6, 102 }, /* 0x3d */
-+ { 1057, 6, 7, 0, -7, 102 }, /* 0x3e */
-+ { 1087, 7, 9, 0, -9, 104 }, /* 0x3f */
-+ { 1127, 11, 12, 0, -10, 171 }, /* 0x40 */
-+ { 1222, 9, 9, 0, -9, 135 }, /* 0x41 */
-+ { 1274, 8, 9, 0, -9, 129 }, /* 0x42 */
-+ { 1331, 8, 9, 0, -9, 126 }, /* 0x43 */
-+ { 1383, 8, 9, 0, -9, 129 }, /* 0x44 */
-+ { 1444, 8, 9, 0, -9, 123 }, /* 0x45 */
-+ { 1483, 8, 9, 0, -9, 117 }, /* 0x46 */
-+ { 1521, 8, 9, 0, -9, 128 }, /* 0x47 */
-+ { 1581, 8, 9, 0, -9, 132 }, /* 0x48 */
-+ { 1640, 3, 9, 0, -9, 54 }, /* 0x49 */
-+ { 1667, 8, 9, 0, -9, 121 }, /* 0x4a */
-+ { 1709, 8, 9, 0, -9, 129 }, /* 0x4b */
-+ { 1771, 8, 9, 0, -9, 119 }, /* 0x4c */
-+ { 1807, 9, 9, 0, -9, 149 }, /* 0x4d */
-+ { 1877, 9, 9, 0, -9, 139 }, /* 0x4e */
-+ { 1942, 8, 9, 0, -9, 129 }, /* 0x4f */
-+ { 2001, 8, 9, 0, -9, 124 }, /* 0x50 */
-+ { 2050, 8, 11, 0, -9, 122 }, /* 0x51 */
-+ { 2119, 8, 9, 0, -9, 128 }, /* 0x52 */
-+ { 2177, 8, 9, 0, -9, 123 }, /* 0x53 */
-+ { 2234, 8, 9, 0, -9, 120 }, /* 0x54 */
-+ { 2265, 8, 9, 0, -9, 132 }, /* 0x55 */
-+ { 2329, 8, 9, 0, -9, 127 }, /* 0x56 */
-+ { 2379, 12, 9, 0, -9, 183 }, /* 0x57 */
-+ { 2467, 8, 9, 0, -9, 128 }, /* 0x58 */
-+ { 2518, 8, 9, 0, -9, 125 }, /* 0x59 */
-+ { 2561, 7, 9, 0, -9, 115 }, /* 0x5a */
-+ { 2596, 5, 14, 0, -11, 84 }, /* 0x5b */
-+ { 2643, 6, 9, 0, -9, 93 }, /* 0x5c */
-+ { 2674, 5, 14, 0, -11, 84 }, /* 0x5d */
-+ { 2720, 6, 10, 0, -10, 97 }, /* 0x5e */
-+ { 2747, 7, 3, 0, -2, 106 }, /* 0x5f */
-+ { 2755, 3, 10, 0, -10, 46 }, /* 0x60 */
-+ { 2764, 7, 7, 0, -7, 109 }, /* 0x61 */
-+ { 2805, 7, 9, 0, -9, 116 }, /* 0x62 */
-+ { 2857, 7, 7, 0, -7, 110 }, /* 0x63 */
-+ { 2903, 7, 9, 0, -9, 116 }, /* 0x64 */
-+ { 2960, 7, 7, 0, -7, 113 }, /* 0x65 */
-+ { 3002, 5, 9, 0, -9, 78 }, /* 0x66 */
-+ { 3036, 7, 10, 0, -7, 114 }, /* 0x67 */
-+ { 3100, 7, 9, 0, -9, 113 }, /* 0x68 */
-+ { 3156, 3, 9, 0, -9, 53 }, /* 0x69 */
-+ { 3183, 4, 12, -1, -9, 52 }, /* 0x6a */
-+ { 3230, 7, 9, 0, -9, 109 }, /* 0x6b */
-+ { 3285, 3, 9, 0, -9, 50 }, /* 0x6c */
-+ { 3312, 11, 7, 0, -7, 172 }, /* 0x6d */
-+ { 3388, 7, 7, 0, -7, 113 }, /* 0x6e */
-+ { 3436, 7, 7, 0, -7, 116 }, /* 0x6f */
-+ { 3483, 7, 10, 0, -7, 117 }, /* 0x70 */
-+ { 3541, 7, 10, 0, -7, 117 }, /* 0x71 */
-+ { 3602, 5, 7, 0, -7, 78 }, /* 0x72 */
-+ { 3631, 6, 7, 0, -7, 103 }, /* 0x73 */
-+ { 3671, 5, 9, 0, -9, 78 }, /* 0x74 */
-+ { 3705, 7, 7, 0, -7, 113 }, /* 0x75 */
-+ { 3750, 7, 7, 0, -7, 105 }, /* 0x76 */
-+ { 3788, 10, 7, 0, -7, 158 }, /* 0x77 */
-+ { 3845, 7, 7, 0, -7, 107 }, /* 0x78 */
-+ { 3885, 7, 10, 0, -7, 102 }, /* 0x79 */
-+ { 3935, 6, 7, 0, -7, 95 }, /* 0x7a */
-+ { 3964, 5, 14, 0, -11, 73 }, /* 0x7b */
-+ { 4012, 2, 11, 0, -10, 40 }, /* 0x7c */
-+ { 4034, 5, 14, 0, -11, 73 }, /* 0x7d */
-+ { 4092, 7, 6, 0, -6, 109 }, /* 0x7e */
-+ { 4111, 3, 5, 0, -5, 47 }, /* 0x80 */
-+ { 4118, 5, 12, 0, -12, 79 }, /* 0x81 */
-+ { 4146, 6, 7, 0, -7, 91 }, /* 0x82 */
-+ { 4178, 6, 5, 0, -5, 97 }, /* 0x83 */
-+ { 4186, 9, 5, 0, -5, 139 }, /* 0x84 */
-+ { 4195, 3, 9, 0, -9, 38 }, /* 0x85 */
-+ { 4204, 11, 3, 0, -2, 173 }, /* 0x86 */
-+ { 4223, 4, 5, 0, -5, 65 }, /* 0x87 */
-+ { 4233, 4, 6, 0, -6, 72 }, /* 0x88 */
-+ { 4252, 5, 6, 0, -6, 77 }, /* 0x89 */
-+};
-+static const uint8_t xs_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern xs_kern[] = {
-+ {39,45,-10},{39,52,-4},{39,65,-16},{39,74,-10},{39,99,-10},{39,100,-10},{39,101,-10},{39,103,-7},
-+ {39,111,-10},{39,113,-7},{39,115,-5},{44,48,-6},{44,84,-12},{44,86,-6},{44,87,-6},{44,89,-12},
-+ {44,118,-8},{44,119,-8},{44,121,-8},{45,39,-5},{45,45,-29},{45,55,-13},{45,84,-7},{45,118,-5},
-+ {45,119,-5},{45,120,-5},{45,121,-5},{45,133,-5},{46,48,-6},{46,84,-12},{46,86,-6},{46,87,-6},
-+ {46,89,-12},{46,118,-8},{46,119,-8},{46,121,-8},{48,49,-4},{52,39,-6},{52,49,-20},{52,55,-12},
-+ {53,49,-4},{55,44,-12},{55,46,-12},{56,49,-4},{57,49,-4},{65,39,-19},{65,67,-4},{65,71,-4},
-+ {65,79,-4},{65,81,-4},{65,83,-9},{65,84,-16},{65,86,-6},{65,87,-6},{65,89,-17},{65,102,-5},
-+ {65,103,-4},{65,113,-4},{65,116,-5},{65,118,-9},{65,119,-9},{65,121,-9},{65,133,-14},{66,65,-7},
-+ {66,86,-5},{66,87,-5},{66,88,-5},{66,89,-7},{67,89,-5},{68,65,-7},{68,86,-5},{68,87,-5},
-+ {68,88,-5},{68,89,-7},{70,44,-17},{70,45,-11},{70,46,-17},{70,65,-14},{70,74,-11},{70,97,-9},
-+ {70,99,-11},{70,100,-11},{70,101,-11},{70,103,-7},{70,109,-5},{70,110,-5},{70,111,-11},{70,112,-5},
-+ {70,113,-7},{70,114,-5},{70,115,-9},{70,117,-6},{70,118,-10},{70,119,-10},{70,120,-9},{70,121,-10},
-+ {70,122,-5},{71,89,-5},{75,45,-6},{75,65,4},{75,67,-5},{75,71,-5},{75,74,-4},{75,79,-5},
-+ {75,81,-5},{75,83,-4},{75,99,-6},{75,100,-6},{75,101,-6},{75,103,-5},{75,111,-6},{75,113,-5},
-+ {75,118,-8},{75,119,-8},{75,121,-8},{76,39,-16},{76,65,5},{76,84,-18},{76,86,-8},{76,87,-8},
-+ {76,89,-9},{76,118,-5},{76,119,-5},{76,121,-5},{76,133,-10},{79,89,-5},{80,44,-5},{80,45,-5},
-+ {80,46,-5},{80,65,-9},{80,74,-5},{80,88,-6},{80,89,-6},{80,99,-5},{80,100,-5},{80,101,-5},
-+ {80,111,-5},{81,65,-5},{81,86,-6},{81,87,-6},{81,88,-6},{81,89,-10},{82,65,5},{82,86,-4},
-+ {82,87,-4},{82,89,-5},{83,88,-7},{83,89,-5},{84,44,-12},{84,45,-16},{84,46,-12},{84,65,-13},
-+ {84,67,-7},{84,71,-7},{84,74,-8},{84,79,-7},{84,81,-7},{84,97,-6},{84,99,-16},{84,100,-16},
-+ {84,101,-16},{84,103,-13},{84,109,-12},{84,110,-12},{84,111,-16},{84,112,-12},{84,113,-13},{84,114,-12},
-+ {84,115,-12},{84,117,-10},{84,118,-10},{84,119,-10},{84,120,-11},{84,121,-10},{86,44,-12},{86,45,-12},
-+ {86,46,-12},{86,65,-20},{86,67,-6},{86,71,-6},{86,74,-8},{86,75,-4},{86,79,-6},{86,81,-6},
-+ {86,83,-4},{86,97,-12},{86,99,-12},{86,100,-12},{86,101,-12},{86,103,-11},{86,111,-12},{86,113,-11},
-+ {86,115,-8},{87,44,-12},{87,45,-12},{87,46,-12},{87,65,-20},{87,67,-6},{87,71,-6},{87,74,-8},
-+ {87,75,-4},{87,79,-6},{87,81,-6},{87,83,-4},{87,97,-12},{87,99,-12},{87,100,-12},{87,101,-12},
-+ {87,103,-11},{87,111,-12},{87,113,-11},{87,115,-8},{88,45,-6},{88,67,-5},{88,71,-5},{88,79,-5},
-+ {88,81,-5},{88,83,-5},{88,99,-6},{88,100,-6},{88,101,-6},{88,103,-7},{88,111,-6},{88,113,-7},
-+ {88,118,-6},{88,119,-6},{88,121,-6},{89,44,-19},{89,45,-15},{89,46,-19},{89,65,-23},{89,67,-7},
-+ {89,71,-7},{89,74,-11},{89,79,-7},{89,81,-7},{89,83,-5},{89,97,-12},{89,99,-15},{89,100,-15},
-+ {89,101,-15},{89,102,-8},{89,103,-17},{89,109,-11},{89,110,-11},{89,111,-15},{89,112,-11},{89,113,-17},
-+ {89,114,-11},{89,115,-9},{89,116,-8},{89,117,-8},{89,118,-7},{89,119,-7},{89,120,-8},{89,121,-7},
-+ {89,122,-5},{97,39,-5},{97,84,-6},{97,89,-7},{97,133,-4},{98,39,-8},{98,118,-4},{98,119,-4},
-+ {98,121,-4},{99,39,-5},{99,44,-5},{99,46,-5},{99,120,-4},{99,133,-4},{101,39,-7},{101,44,-4},
-+ {101,46,-4},{101,118,-5},{101,119,-5},{101,120,-4},{101,121,-5},{101,133,-5},{102,44,-11},{102,45,-7},
-+ {102,46,-11},{102,99,-7},{102,100,-7},{102,101,-7},{102,103,-6},{102,111,-7},{102,113,-6},{104,39,-8},
-+ {104,118,-4},{104,119,-4},{104,121,-4},{107,45,-7},{107,97,-4},{107,99,-7},{107,100,-7},{107,101,-7},
-+ {107,103,-5},{107,111,-7},{107,113,-5},{109,39,-8},{109,118,-4},{109,119,-4},{109,121,-4},{110,39,-8},
-+ {110,118,-4},{110,119,-4},{110,121,-4},{111,39,-5},{111,55,-13},{111,84,-7},{111,118,-5},{111,119,-5},
-+ {111,120,-5},{111,121,-5},{111,133,-5},{112,39,-8},{112,118,-4},{112,119,-4},{112,121,-4},{114,39,5},
-+ {114,44,-8},{114,46,-8},{114,103,-4},{114,113,-4},{114,118,4},{114,119,4},{114,121,4},{114,133,10},
-+ {115,39,-4},{115,118,-7},{115,119,-7},{115,121,-7},{115,133,-5},{118,44,-8},{118,45,-6},{118,46,-8},
-+ {118,97,-5},{118,99,-6},{118,100,-6},{118,101,-6},{118,103,-6},{118,111,-6},{118,113,-6},{118,115,-7},
-+ {118,133,8},{119,44,-8},{119,45,-6},{119,46,-8},{119,97,-5},{119,99,-6},{119,100,-6},{119,101,-6},
-+ {119,103,-6},{119,111,-6},{119,113,-6},{119,115,-7},{119,133,8},{120,45,-6},{120,99,-6},{120,100,-6},
-+ {120,101,-6},{120,103,-5},{120,111,-6},{120,113,-5},{121,44,-8},{121,45,-6},{121,46,-8},{121,97,-5},
-+ {121,99,-6},{121,100,-6},{121,101,-6},{121,103,-6},{121,111,-6},{121,113,-6},{121,115,-7},{121,133,8},
-+ {133,45,-17},{133,65,-14},{133,97,-4},{133,99,-17},{133,100,-17},{133,101,-17},{133,103,-16},{133,111,-17},
-+ {133,113,-16},{133,115,-14},{133,118,-4},{133,119,-4},{133,121,-4},
-+};
-+const struct fos_font fos_font_xs_data = { xs_bits, xs_glyphs, xs_lut, xs_kern, 389, 13, 3 };
-+
-+static const uint8_t sm_bits[] = {
-+ 128,2,15,6,129,1,15,6,129,1,15,5,129,1,15,5,129,1,15,5,130,15,5,130,
-+ 15,4,139,4,14,6,129,4,14,6,128,8,13,1,15,5,8,12,128,15,5,7,11,128,
-+ 14,3,167,130,10,13,129,12,11,132,13,10,129,15,8,130,6,111,10,129,2,7,15,7,
-+ 4,8,15,6,3,130,6,15,3,128,7,15,1,130,1,8,15,2,1,10,14,1,130,127,
-+ 2,129,3,13,12,20,14,10,3,131,14,9,128,1,15,7,131,2,15,6,128,3,15,4,
-+ 130,130,3,13,1,133,6,15,4,131,4,14,47,13,3,129,13,12,2,1,4,29,128,1,
-+ 15,7,130,6,15,1,128,28,2,129,1,2,129,1,11,15,10,4,133,3,10,15,11,2,
-+ 129,1,130,2,11,13,128,3,15,3,130,4,15,3,1,15,10,1,129,9,15,1,128,7,
-+ 31,13,14,15,7,130,3,8,15,9,3,132,2,15,3,130,129,9,14,12,2,129,1,14,
-+ 2,130,7,13,5,9,12,129,9,8,131,10,5,129,14,1,3,13,1,131,8,10,2,5,
-+ 14,128,11,6,132,1,12,31,20,12,135,3,1,128,13,4,137,6,10,128,9,15,14,3,
-+ 132,1,14,2,6,13,5,7,14,132,8,9,128,8,7,129,13,2,130,2,14,1,128,5,
-+ 13,5,8,13,131,10,6,130,8,14,13,3,128,129,5,13,15,13,5,132,3,15,11,5,
-+ 10,15,3,131,6,15,3,128,1,15,7,131,2,15,8,128,7,15,4,132,7,15,11,15,
-+ 8,133,5,31,8,133,7,15,9,11,14,3,128,5,2,128,1,15,9,128,1,11,14,6,
-+ 15,6,128,3,15,5,129,1,13,15,10,129,1,14,13,22,10,31,11,130,3,11,30,12,
-+ 5,3,14,9,128,8,14,8,13,7,12,143,129,6,15,2,129,1,14,10,130,6,15,5,
-+ 130,10,15,1,130,29,131,15,11,131,15,11,131,15,11,131,29,131,10,15,1,130,6,15,
-+ 5,130,1,14,10,131,6,15,2,128,128,7,14,2,129,1,14,10,130,10,15,1,129,6,
-+ 15,5,129,3,15,8,129,1,15,10,130,15,11,129,1,15,10,129,3,15,8,129,6,15,
-+ 5,129,10,15,1,128,1,14,9,129,7,14,2,128,1,128,4,9,128,1,5,13,9,11,
-+ 26,128,4,31,9,128,5,13,9,27,10,1,128,4,9,128,1,163,130,10,9,133,11,9,
-+ 131,17,11,10,17,128,6,95,5,1,20,12,11,20,1,130,11,9,133,10,9,138,128,7,
-+ 13,129,10,9,129,13,5,129,15,1,128,128,65,6,63,12,1,52,3,145,128,9,13,1,
-+ 128,10,13,1,131,13,9,131,4,15,4,131,9,14,132,14,9,131,5,15,3,131,10,13,
-+ 131,1,14,8,131,6,15,3,131,11,12,131,1,15,7,131,6,15,2,131,129,7,13,14,
-+ 13,7,130,7,15,9,5,8,15,8,129,13,10,130,9,14,129,15,8,130,7,15,1,128,
-+ 15,8,130,7,15,1,128,15,8,130,7,15,1,128,15,8,130,7,15,1,128,15,8,130,
-+ 7,15,1,128,13,10,130,9,14,129,7,15,8,5,8,15,8,130,7,13,14,13,7,129,
-+ 128,5,12,15,5,128,3,15,13,15,5,129,2,3,15,5,130,3,15,5,130,3,15,5,
-+ 130,3,15,5,130,3,15,5,130,3,15,5,130,3,15,5,130,3,15,5,130,3,15,5,
-+ 128,128,1,9,30,12,4,130,12,14,7,5,11,15,3,128,2,15,7,129,1,15,8,128,
-+ 1,8,3,129,2,15,7,133,9,15,2,132,6,15,7,132,4,15,10,132,2,14,12,1,
-+ 131,1,29,1,132,12,15,7,52,128,2,95,13,128,2,95,5,128,36,6,14,15,3,130,
-+ 1,12,15,5,130,1,11,15,5,131,5,31,11,3,131,3,2,11,14,1,132,3,15,5,
-+ 2,8,2,129,1,15,7,3,15,6,129,4,15,4,128,11,14,22,29,1,128,1,9,30,
-+ 11,2,128,130,4,15,5,133,11,13,133,3,15,7,133,10,14,1,132,2,15,8,128,3,
-+ 15,4,129,8,15,2,128,3,15,5,128,1,14,11,17,4,15,6,128,5,111,3,1,52,
-+ 6,15,7,1,132,3,15,5,133,3,15,5,128,1,95,3,1,15,9,52,17,15,7,132,
-+ 1,15,7,132,1,15,11,13,15,13,6,128,1,15,14,6,4,10,15,4,128,6,3,129,
-+ 1,15,8,133,14,9,128,14,9,129,1,15,8,128,9,15,7,5,12,15,2,129,8,13,
-+ 14,12,4,128,128,1,9,14,15,12,4,129,11,14,7,5,12,15,2,1,15,8,129,3,
-+ 15,6,1,15,7,132,1,15,10,13,15,14,6,128,1,31,7,5,11,15,3,1,15,9,
-+ 129,1,15,8,1,15,7,130,14,9,128,14,10,129,1,15,8,128,9,15,8,5,11,15,
-+ 2,129,8,13,15,12,4,128,7,95,6,8,13,36,9,15,4,1,2,130,11,14,132,2,
-+ 15,8,132,7,15,2,132,13,12,132,4,15,6,132,9,15,1,131,1,14,10,132,6,15,
-+ 4,132,11,13,131,129,8,30,11,2,129,8,15,8,6,29,1,128,14,10,129,4,15,5,
-+ 128,15,9,129,2,15,6,128,10,14,4,2,10,15,2,128,1,14,47,7,129,11,14,6,
-+ 4,10,15,18,15,7,129,1,15,8,2,15,7,129,1,15,8,128,12,14,7,5,11,15,
-+ 3,128,1,10,14,15,12,5,128,128,1,9,30,11,2,129,11,15,7,6,13,14,1,2,
-+ 15,7,129,4,15,5,4,15,4,129,1,15,7,3,15,6,129,3,15,7,128,29,4,2,
-+ 11,15,7,128,3,14,31,11,15,7,130,3,2,1,15,7,128,13,8,129,2,15,6,128,
-+ 11,14,7,5,12,14,2,128,1,10,30,12,4,128,128,2,14,8,130,2,14,8,148,2,
-+ 14,8,130,2,14,8,129,128,5,14,6,129,7,15,8,130,1,140,2,15,3,129,4,15,
-+ 130,6,12,130,8,9,129,140,4,11,5,130,5,12,15,11,2,1,7,13,15,9,3,129,
-+ 7,15,10,1,131,3,12,15,11,4,132,3,10,15,13,6,1,131,2,9,15,5,133,1,
-+ 2,6,95,5,1,83,1,143,6,95,5,1,83,1,143,135,6,11,4,132,3,12,15,12,
-+ 5,132,3,10,15,13,6,1,131,2,11,15,5,130,5,11,15,11,2,1,7,13,15,10,
-+ 3,129,7,14,8,2,131,2,1,133,128,3,11,30,9,1,128,1,14,12,5,7,14,11,
-+ 128,6,15,3,129,8,15,1,2,6,130,9,14,132,8,15,8,131,9,15,7,131,2,15,
-+ 8,132,2,12,4,140,4,14,5,132,4,14,5,130,144,7,12,31,14,9,2,131,2,29,
-+ 8,5,4,6,12,14,3,129,1,13,9,1,130,1,128,8,12,129,8,11,128,3,13,15,
-+ 10,13,129,14,2,128,13,4,128,12,10,4,27,129,13,4,1,15,128,1,15,1,128,7,
-+ 9,128,1,14,18,15,128,2,15,19,13,10,2,9,13,129,15,2,128,11,31,7,14,15,
-+ 14,3,129,26,129,18,128,1,3,1,130,2,14,11,4,1,2,4,8,133,2,11,47,14,
-+ 8,135,1,19,133,130,1,31,2,133,6,31,7,133,11,12,11,12,132,1,15,23,15,2,
-+ 131,6,15,3,2,15,7,131,11,13,129,28,130,1,15,8,129,8,15,2,129,6,15,4,
-+ 129,3,15,7,129,11,95,12,128,1,15,10,51,9,15,2,5,15,4,131,3,15,6,128,
-+ 10,63,13,7,130,10,13,20,5,10,15,7,129,10,13,131,12,11,129,10,13,131,27,129,
-+ 10,13,33,6,15,4,129,10,79,10,130,10,13,36,8,15,9,129,10,13,131,10,14,129,
-+ 10,13,131,10,13,129,10,13,20,5,8,15,8,129,10,63,13,7,129,129,5,12,30,11,
-+ 3,130,5,15,11,5,6,12,15,3,129,28,130,1,14,10,129,15,8,131,23,129,15,8,
-+ 135,15,8,135,15,8,135,15,8,131,23,129,28,130,1,14,10,129,5,15,11,5,6,12,
-+ 15,3,130,5,12,30,11,3,129,128,10,63,12,6,130,10,13,20,5,9,15,7,129,10,
-+ 13,131,11,13,129,10,13,131,8,15,129,10,13,131,8,15,129,10,13,131,8,15,129,10,
-+ 13,131,8,15,129,10,13,131,8,15,129,10,13,131,11,13,129,10,13,20,5,9,15,7,
-+ 129,10,63,12,6,129,128,10,95,11,129,10,13,68,3,129,10,13,135,10,13,135,10,13,
-+ 49,131,10,63,14,131,10,13,36,3,131,10,13,135,10,13,135,10,13,68,3,129,10,95,
-+ 11,128,128,10,95,11,128,10,13,68,3,128,10,13,134,10,13,134,10,13,49,130,10,63,
-+ 14,130,10,13,36,3,130,10,13,134,10,13,134,10,13,134,10,12,133,129,5,12,30,11,
-+ 4,130,5,15,11,5,6,12,15,4,129,28,130,1,14,10,129,15,9,131,5,6,129,15,
-+ 8,129,49,129,15,8,128,2,47,12,129,15,8,129,3,4,28,129,15,9,131,11,12,129,
-+ 28,130,1,14,9,129,5,15,11,5,6,12,14,3,130,5,12,30,11,3,129,128,10,12,
-+ 131,7,15,1,128,10,13,131,7,15,1,128,10,13,131,7,15,1,128,10,13,131,7,15,
-+ 1,128,10,13,49,8,15,1,128,10,111,1,128,10,13,52,9,15,1,128,10,13,131,7,
-+ 15,1,128,10,13,131,7,15,1,128,10,13,131,7,15,1,128,10,12,131,7,15,1,128,
-+ 10,12,129,10,13,129,10,13,129,10,13,129,10,13,129,10,13,129,10,13,129,10,13,129,
-+ 10,13,129,10,13,129,10,12,128,133,8,14,134,9,14,134,9,14,134,9,14,134,9,14,
-+ 134,9,14,128,5,8,131,9,14,128,9,14,131,9,14,128,7,15,2,130,28,128,2,14,
-+ 13,6,5,10,15,6,129,2,10,30,12,5,129,128,10,12,130,1,12,13,1,128,10,13,
-+ 130,11,14,2,129,10,13,129,9,15,4,130,10,13,128,8,15,6,131,10,13,6,15,9,
-+ 132,10,14,15,14,12,132,10,15,9,4,15,8,131,10,13,129,8,15,3,130,10,13,130,
-+ 29,1,129,10,13,130,3,15,8,129,10,12,131,7,15,4,128,10,12,134,10,13,134,10,
-+ 13,134,10,13,134,10,13,134,10,13,134,10,13,134,10,13,134,10,13,134,10,13,69,3,
-+ 128,10,95,9,128,10,15,3,131,11,15,2,128,10,15,12,130,6,31,2,128,10,31,8,
-+ 128,2,14,31,2,128,10,13,9,15,3,11,14,8,15,2,128,10,13,1,13,14,15,5,
-+ 6,15,2,128,10,13,128,4,15,10,128,6,15,2,128,10,13,129,3,1,128,6,15,2,
-+ 128,10,13,132,6,15,2,128,10,13,132,6,15,2,128,10,13,132,6,15,2,128,10,12,
-+ 132,6,15,2,128,10,14,2,130,1,15,6,129,10,15,11,130,1,15,7,129,10,31,5,
-+ 129,1,15,7,129,10,12,11,13,1,128,1,15,7,129,10,12,2,15,8,128,1,15,7,
-+ 129,10,13,128,8,15,3,1,15,7,129,10,13,129,13,12,1,15,7,129,10,13,129,4,
-+ 15,8,15,7,129,10,13,130,9,31,7,129,10,13,130,1,14,15,7,129,10,12,131,5,
-+ 15,6,128,129,4,11,30,11,3,130,4,15,11,22,12,15,3,129,12,13,130,1,13,11,
-+ 129,14,9,131,10,13,129,15,8,131,9,14,129,15,8,131,9,14,129,15,8,131,9,14,
-+ 129,14,9,131,10,13,129,12,13,130,1,13,11,129,4,15,11,22,12,15,3,130,4,11,
-+ 30,11,3,129,128,12,63,13,8,129,28,20,5,9,15,8,128,12,11,131,11,13,128,12,
-+ 11,131,10,14,128,28,33,5,15,10,128,12,79,11,1,128,28,20,3,2,130,12,11,134,
-+ 12,11,134,12,11,134,12,11,133,129,6,12,15,13,9,1,129,7,15,9,5,7,14,11,
-+ 129,14,10,130,5,15,4,2,15,6,130,1,15,7,3,15,6,130,1,15,7,3,15,6,
-+ 130,1,15,7,3,15,6,130,1,15,7,2,15,6,130,1,15,7,1,15,8,130,3,15,
-+ 5,128,10,14,5,1,3,12,14,1,128,1,11,47,13,3,131,3,15,8,133,1,13,5,
-+ 130,128,10,63,14,8,130,10,13,20,5,8,15,8,129,10,13,131,10,13,129,10,13,131,
-+ 9,14,129,10,13,33,5,14,10,129,10,79,11,1,129,10,13,20,10,14,131,10,13,129,
-+ 2,15,6,130,10,13,130,10,13,130,10,13,130,2,15,6,129,10,12,131,10,13,128,128,
-+ 1,8,13,15,14,10,2,129,10,14,7,5,7,13,14,1,128,15,8,130,3,15,7,128,
-+ 14,10,131,7,4,128,5,15,12,6,1,132,3,10,15,14,9,1,132,1,7,30,18,9,
-+ 2,130,2,15,8,3,15,6,130,1,14,9,128,12,15,8,5,6,11,15,4,128,1,8,
-+ 13,15,14,11,4,128,6,111,9,2,20,7,15,8,20,2,130,4,15,4,133,4,15,4,
-+ 133,4,15,4,133,4,15,4,133,4,15,4,133,4,15,4,133,4,15,4,133,4,15,4,
-+ 133,3,15,4,130,128,12,11,131,7,15,1,128,12,11,131,7,15,1,128,12,11,131,7,
-+ 15,1,128,12,11,131,7,15,1,128,12,11,131,7,15,1,128,12,11,131,7,15,1,128,
-+ 12,11,131,7,15,1,128,12,11,131,8,15,1,128,9,14,1,130,12,13,129,3,14,12,
-+ 6,5,10,15,6,130,3,11,30,12,5,129,5,15,4,131,9,14,128,1,15,8,131,13,
-+ 10,129,11,13,130,3,15,5,129,6,15,2,129,8,15,1,129,1,15,7,129,12,10,131,
-+ 28,128,2,15,5,131,7,15,1,6,15,1,131,2,15,6,27,133,12,11,15,6,133,7,
-+ 31,1,133,2,15,11,131,7,15,2,130,29,130,1,15,8,3,15,6,129,2,31,3,129,
-+ 4,15,4,128,14,10,129,6,31,7,129,8,14,129,10,14,129,10,28,11,129,12,11,129,
-+ 6,15,3,128,14,24,14,128,1,15,7,129,1,15,7,3,15,20,15,4,5,15,2,130,
-+ 12,11,6,15,1,128,15,8,9,13,131,8,14,11,12,129,11,12,13,9,131,4,31,8,
-+ 129,7,31,5,132,14,15,4,129,3,31,1,132,10,15,1,130,14,12,130,3,15,6,131,
-+ 12,13,129,9,14,1,129,6,15,4,129,1,14,10,128,1,14,10,131,6,15,4,9,14,
-+ 2,132,11,13,15,7,133,4,15,14,134,10,14,15,5,132,5,15,5,10,14,1,130,1,
-+ 13,11,128,2,14,9,130,9,14,2,129,6,15,4,128,3,15,7,131,12,13,128,4,15,
-+ 6,130,1,14,9,128,11,13,130,9,15,2,128,3,15,7,128,2,15,8,130,10,14,1,
-+ 10,14,1,130,2,15,10,15,7,132,8,15,13,133,2,15,7,133,1,15,7,133,1,15,
-+ 7,133,1,15,7,133,1,15,6,130,5,111,17,52,5,14,13,133,8,15,4,132,3,15,
-+ 9,133,12,13,1,132,8,15,4,132,3,15,8,133,29,1,132,8,15,3,132,3,15,11,
-+ 68,128,5,111,1,128,33,129,7,47,3,128,7,15,20,1,128,7,15,1,130,7,15,1,
-+ 130,7,15,1,130,7,15,1,130,7,15,1,130,7,15,1,130,7,15,1,130,7,15,1,
-+ 130,7,15,1,130,7,15,1,130,7,15,2,1,129,7,47,3,128,1,36,1,128,128,12,
-+ 11,132,7,15,1,131,2,15,6,132,11,12,132,6,15,2,131,1,15,7,132,11,13,132,
-+ 5,15,3,131,1,14,8,132,10,13,132,4,15,3,129,49,129,14,31,11,129,3,4,13,
-+ 12,131,28,131,28,131,28,131,28,131,28,131,28,131,28,131,28,131,28,131,28,129,17,28,
-+ 129,14,31,12,129,3,20,2,129,3,15,8,131,9,13,14,130,1,14,4,14,5,129,7,
-+ 13,128,8,11,129,13,7,128,2,15,2,4,15,1,129,11,8,162,128,81,128,9,95,8,
-+ 2,84,2,4,14,2,128,9,10,154,128,2,10,30,11,3,129,13,14,6,5,12,14,1,
-+ 128,4,3,128,1,4,15,4,128,4,12,63,5,2,15,12,5,4,6,15,21,15,3,129,
-+ 5,15,5,3,15,10,5,7,14,15,5,128,6,13,14,12,7,15,4,128,13,10,134,13,
-+ 10,134,13,10,134,13,11,10,14,13,7,130,13,15,10,5,10,15,6,129,13,14,130,13,
-+ 12,129,13,11,130,10,14,129,13,11,130,10,14,129,13,14,130,13,11,129,13,15,10,5,
-+ 10,15,5,129,13,11,10,14,13,6,129,129,7,13,15,12,5,129,8,15,8,5,10,15,
-+ 5,128,14,9,130,11,8,1,15,7,132,1,15,7,133,14,10,130,11,7,128,8,15,8,
-+ 5,10,15,5,129,7,13,15,12,5,128,133,12,11,134,12,11,134,12,11,130,8,30,9,
-+ 13,11,129,8,15,9,5,12,15,11,129,14,11,129,2,15,11,128,1,15,8,130,14,11,
-+ 128,1,15,7,130,14,11,129,14,11,129,1,15,11,129,7,15,9,5,12,15,11,130,8,
-+ 30,9,13,11,128,129,8,13,14,13,6,130,8,14,7,5,10,15,4,129,14,9,33,13,
-+ 9,128,1,95,11,128,1,15,9,52,2,129,14,10,130,3,130,7,15,9,5,8,15,6,
-+ 130,7,13,15,13,7,129,129,7,13,15,4,128,1,15,12,5,1,128,3,15,5,129,7,
-+ 63,3,2,7,15,8,4,1,128,3,15,5,130,3,15,5,130,3,15,5,130,3,15,5,
-+ 130,3,15,5,130,3,15,5,129,128,1,9,30,9,13,10,129,10,15,8,5,11,15,10,
-+ 128,1,15,10,129,1,15,10,128,2,15,6,130,13,10,128,2,15,6,130,13,10,128,1,
-+ 15,9,129,1,15,10,129,10,15,8,5,11,15,10,129,1,9,30,9,14,10,133,1,15,
-+ 8,130,1,5,6,12,15,3,130,4,15,13,10,3,129,128,13,10,134,13,10,134,13,10,
-+ 134,13,11,10,14,13,7,130,13,15,9,5,11,15,4,129,13,12,129,1,15,8,129,13,
-+ 10,130,14,9,129,13,10,130,14,9,129,13,10,130,14,9,129,13,10,130,14,9,129,13,
-+ 10,130,14,9,128,128,11,13,129,11,12,133,11,12,129,11,12,129,11,12,129,11,12,129,
-+ 11,12,129,11,12,129,11,12,129,11,12,128,129,13,11,130,12,11,135,12,10,130,12,11,
-+ 130,12,11,130,12,11,130,12,11,130,12,11,130,12,11,130,12,11,130,13,10,128,3,8,
-+ 15,7,128,10,14,9,1,128,128,13,10,133,13,10,133,13,10,133,13,10,129,10,14,2,
-+ 128,13,10,128,9,15,4,129,13,10,8,15,8,130,13,14,15,13,10,130,13,15,6,5,
-+ 15,3,129,13,10,129,13,10,129,13,10,129,7,15,2,128,13,10,129,1,14,9,128,13,
-+ 10,129,13,10,129,13,10,129,13,10,129,13,10,129,13,10,129,13,10,129,13,10,129,13,
-+ 10,129,13,10,129,13,10,128,128,13,11,10,30,7,3,12,15,12,4,129,13,15,8,5,
-+ 12,15,14,7,6,13,14,129,13,11,129,3,15,8,129,6,15,2,128,13,10,129,2,15,
-+ 6,129,5,15,3,128,13,10,129,2,15,6,129,5,15,3,128,13,10,129,2,15,6,129,
-+ 5,15,3,128,13,10,129,2,15,6,129,5,15,3,128,13,10,129,1,15,6,129,4,15,
-+ 3,128,13,11,10,14,13,7,130,13,15,9,5,11,15,4,129,13,12,129,1,15,8,129,
-+ 13,10,130,14,9,129,13,10,130,14,9,129,13,10,130,14,9,129,13,10,130,14,9,129,
-+ 13,10,130,14,9,128,129,7,13,15,12,5,130,7,15,8,5,10,15,5,129,14,10,130,
-+ 28,128,2,15,7,130,9,14,128,2,15,7,130,10,14,129,14,10,130,28,129,7,15,8,
-+ 5,10,15,5,130,7,13,15,12,5,129,128,28,10,14,13,7,130,12,15,11,5,9,15,
-+ 6,129,12,14,1,129,12,13,129,28,130,8,15,129,28,130,9,15,129,12,14,1,129,12,
-+ 13,129,12,15,11,5,10,15,7,129,28,10,14,13,8,130,12,11,134,12,11,134,12,11,
-+ 133,129,8,30,9,13,11,129,7,15,9,5,12,15,11,129,14,11,129,1,15,11,128,1,
-+ 15,7,130,14,11,128,1,15,8,130,14,11,129,14,11,129,2,15,11,129,8,15,9,5,
-+ 12,15,11,130,8,30,9,13,11,134,12,11,134,12,11,134,12,11,128,128,13,11,10,14,
-+ 8,128,13,15,9,5,3,128,13,12,131,13,10,131,13,10,131,13,10,131,13,10,131,13,
-+ 10,130,128,3,11,30,10,2,129,14,12,5,6,13,12,128,2,15,7,129,3,7,129,8,
-+ 15,12,7,2,131,2,7,12,15,8,128,2,8,2,129,8,15,17,14,12,5,6,13,14,
-+ 129,4,11,30,11,3,128,128,4,15,3,130,4,15,3,129,7,63,18,7,15,6,4,129,
-+ 4,15,3,130,4,15,3,130,4,15,3,130,4,15,3,130,3,15,10,4,130,9,14,15,
-+ 1,128,15,8,130,15,7,129,15,8,130,15,7,129,15,8,130,15,7,129,15,8,130,15,
-+ 7,129,15,8,130,15,7,129,14,9,129,2,15,7,129,11,15,7,5,12,15,7,129,2,
-+ 10,30,8,15,7,128,6,15,3,129,6,15,4,1,15,8,129,10,14,129,11,13,129,14,
-+ 9,129,6,15,2,5,15,4,129,1,15,7,9,14,131,11,12,14,9,131,6,31,4,131,
-+ 1,15,14,130,7,15,2,129,14,11,129,3,15,5,2,15,6,128,3,31,129,8,15,1,
-+ 128,13,10,128,7,14,15,4,128,12,11,129,8,14,128,11,9,12,8,1,15,6,129,4,
-+ 15,3,15,5,8,12,5,15,2,130,14,11,15,1,3,15,11,12,131,10,15,11,129,14,
-+ 15,8,131,5,15,7,129,9,15,3,129,5,15,5,129,6,15,5,128,10,14,1,2,14,
-+ 10,129,1,13,10,11,13,1,130,4,31,4,131,3,31,3,130,1,13,12,11,13,1,129,
-+ 9,14,18,14,9,128,5,15,6,129,5,15,5,8,15,2,129,6,15,18,15,6,129,11,
-+ 12,129,12,11,128,1,15,7,129,7,15,1,5,15,2,129,2,15,5,10,11,131,12,10,
-+ 14,6,131,6,31,1,131,1,15,10,132,2,15,5,130,1,4,12,13,131,3,15,12,3,
-+ 131,6,79,10,2,36,10,15,7,130,3,15,10,130,1,13,12,1,130,11,14,2,130,8,
-+ 15,4,130,5,15,10,36,3,8,79,10,130,17,128,1,13,15,11,128,6,15,8,2,128,
-+ 6,15,2,129,6,15,2,129,6,15,2,129,7,15,1,128,4,14,12,129,5,14,9,130,
-+ 8,15,1,129,6,15,2,129,6,15,2,129,6,15,2,129,6,15,5,1,128,2,14,15,
-+ 11,129,1,3,2,5,15,3,5,15,3,5,15,3,5,15,3,5,15,3,5,15,3,5,
-+ 15,3,5,15,3,5,15,3,5,15,3,5,15,3,5,15,3,5,15,3,128,1,130,7,
-+ 15,14,4,128,1,5,15,10,130,13,10,130,13,10,130,13,10,130,13,11,130,8,15,7,
-+ 129,6,15,8,129,28,130,13,10,130,13,10,130,13,10,129,2,15,10,128,7,31,6,128,
-+ 1,3,2,129,135,1,10,15,13,6,2,8,19,11,5,7,14,15,14,2,131,1,3,1,
-+ 152,2,14,8,128,2,14,8,144,134,8,14,15,9,128,5,14,21,13,6,8,7,129,7,
-+ 9,6,12,3,2,12,7,128,10,31,10,130,18,171,2,11,1,128,2,10,17,12,13,4,
-+ 13,11,1,128,1,12,15,12,1,129,2,13,15,13,2,128,2,13,11,2,12,13,17,8,
-+ 1,128,1,7,142,128,81,6,79,12,1,68,3,148,128,113,1,128,6,127,15,4,1,116,
-+ 4,1,160,2,15,6,8,13,128,12,7,152,128,9,13,1,128,4,14,5,128,1,13,9,
-+ 129,10,13,1,128,5,14,5,128,1,14,9,128,128,10,14,10,128,5,47,21,47,5,128,
-+ 10,14,10,138,129,9,13,1,129,6,14,3,129,1,14,8,131,6,14,2,131,9,13,1,
-+ 140,128,4,15,4,131,7,14,2,131,13,10,130,7,14,2,129,4,15,4,141,
-+};
-+static const struct fos_glyph sm_glyphs[] = {
-+ { 0, 3, 0, 0, 0, 51 }, /* 0x20 */
-+ { 0, 5, 11, 0, -11, 84 }, /* 0x21 */
-+ { 35, 5, 11, 0, -11, 76 }, /* 0x22 */
-+ { 51, 11, 10, 0, -10, 171 }, /* 0x23 */
-+ { 121, 9, 14, 0, -13, 144 }, /* 0x24 */
-+ { 208, 13, 11, 0, -11, 215 }, /* 0x25 */
-+ { 301, 11, 11, 0, -11, 173 }, /* 0x26 */
-+ { 389, 2, 11, 0, -11, 37 }, /* 0x27 */
-+ { 396, 6, 13, -1, -11, 74 }, /* 0x28 */
-+ { 442, 5, 13, 0, -11, 74 }, /* 0x29 */
-+ { 494, 6, 11, 0, -11, 102 }, /* 0x2a */
-+ { 522, 8, 8, 0, -8, 127 }, /* 0x2b */
-+ { 550, 4, 4, 0, -3, 68 }, /* 0x2c */
-+ { 563, 6, 6, 0, -6, 102 }, /* 0x2d */
-+ { 572, 4, 2, 0, -2, 70 }, /* 0x2e */
-+ { 580, 7, 11, 0, -11, 109 }, /* 0x2f */
-+ { 620, 9, 11, 0, -11, 145 }, /* 0x30 */
-+ { 696, 6, 11, 0, -11, 90 }, /* 0x31 */
-+ { 745, 9, 11, 0, -11, 139 }, /* 0x32 */
-+ { 806, 8, 11, 0, -11, 134 }, /* 0x33 */
-+ { 867, 9, 11, 0, -11, 146 }, /* 0x34 */
-+ { 925, 8, 11, 0, -11, 134 }, /* 0x35 */
-+ { 988, 8, 11, 0, -11, 134 }, /* 0x36 */
-+ { 1064, 8, 11, 0, -11, 123 }, /* 0x37 */
-+ { 1109, 8, 11, 0, -11, 135 }, /* 0x38 */
-+ { 1185, 8, 11, 0, -11, 134 }, /* 0x39 */
-+ { 1262, 6, 7, 0, -7, 89 }, /* 0x3a */
-+ { 1279, 5, 9, 0, -8, 80 }, /* 0x3b */
-+ { 1303, 8, 9, 0, -9, 127 }, /* 0x3c */
-+ { 1345, 8, 8, 0, -8, 127 }, /* 0x3d */
-+ { 1359, 8, 9, 0, -9, 127 }, /* 0x3e */
-+ { 1402, 8, 11, 0, -11, 123 }, /* 0x3f */
-+ { 1454, 13, 13, 0, -11, 211 }, /* 0x40 */
-+ { 1565, 10, 11, 0, -11, 161 }, /* 0x41 */
-+ { 1631, 10, 11, 0, -11, 160 }, /* 0x42 */
-+ { 1699, 10, 11, 0, -11, 155 }, /* 0x43 */
-+ { 1761, 10, 11, 0, -11, 158 }, /* 0x44 */
-+ { 1830, 10, 11, 0, -11, 153 }, /* 0x45 */
-+ { 1874, 9, 11, 0, -11, 145 }, /* 0x46 */
-+ { 1915, 10, 11, 0, -11, 157 }, /* 0x47 */
-+ { 1989, 10, 11, 0, -11, 165 }, /* 0x48 */
-+ { 2063, 4, 11, 0, -11, 67 }, /* 0x49 */
-+ { 2097, 9, 11, 0, -11, 148 }, /* 0x4a */
-+ { 2149, 10, 11, 0, -11, 158 }, /* 0x4b */
-+ { 2224, 9, 11, 0, -11, 146 }, /* 0x4c */
-+ { 2260, 11, 11, 0, -11, 183 }, /* 0x4d */
-+ { 2356, 11, 11, 0, -11, 172 }, /* 0x4e */
-+ { 2451, 10, 11, 0, -11, 159 }, /* 0x4f */
-+ { 2524, 9, 11, 0, -11, 152 }, /* 0x50 */
-+ { 2577, 9, 13, 0, -11, 149 }, /* 0x51 */
-+ { 2665, 10, 11, 0, -11, 157 }, /* 0x52 */
-+ { 2735, 9, 11, 0, -11, 151 }, /* 0x53 */
-+ { 2814, 9, 11, 0, -11, 147 }, /* 0x54 */
-+ { 2861, 10, 11, 0, -11, 164 }, /* 0x55 */
-+ { 2940, 10, 11, 0, -11, 154 }, /* 0x56 */
-+ { 3007, 14, 11, 0, -11, 225 }, /* 0x57 */
-+ { 3116, 10, 11, 0, -11, 155 }, /* 0x58 */
-+ { 3190, 9, 11, 0, -11, 150 }, /* 0x59 */
-+ { 3250, 9, 11, 0, -11, 141 }, /* 0x5a */
-+ { 3293, 6, 16, 0, -13, 101 }, /* 0x5b */
-+ { 3358, 7, 11, 0, -11, 109 }, /* 0x5c */
-+ { 3398, 6, 16, 0, -13, 101 }, /* 0x5d */
-+ { 3440, 7, 11, 0, -11, 117 }, /* 0x5e */
-+ { 3474, 8, 3, 0, -2, 127 }, /* 0x5f */
-+ { 3483, 3, 11, 0, -11, 54 }, /* 0x60 */
-+ { 3490, 8, 8, 0, -8, 132 }, /* 0x61 */
-+ { 3547, 9, 11, 0, -11, 142 }, /* 0x62 */
-+ { 3611, 8, 8, 0, -8, 135 }, /* 0x63 */
-+ { 3659, 9, 11, 0, -11, 142 }, /* 0x64 */
-+ { 3725, 9, 8, 0, -8, 137 }, /* 0x65 */
-+ { 3775, 6, 11, 0, -11, 94 }, /* 0x66 */
-+ { 3825, 9, 11, 0, -8, 139 }, /* 0x67 */
-+ { 3903, 9, 11, 0, -11, 139 }, /* 0x68 */
-+ { 3965, 4, 11, 0, -11, 65 }, /* 0x69 */
-+ { 3996, 5, 14, -1, -11, 63 }, /* 0x6a */
-+ { 4040, 8, 11, 0, -11, 131 }, /* 0x6b */
-+ { 4102, 4, 11, 0, -11, 60 }, /* 0x6c */
-+ { 4136, 13, 8, 0, -8, 211 }, /* 0x6d */
-+ { 4225, 9, 8, 0, -8, 139 }, /* 0x6e */
-+ { 4278, 9, 8, 0, -8, 142 }, /* 0x6f */
-+ { 4331, 9, 11, 0, -8, 143 }, /* 0x70 */
-+ { 4393, 9, 11, 0, -8, 143 }, /* 0x71 */
-+ { 4459, 6, 8, 0, -8, 95 }, /* 0x72 */
-+ { 4490, 8, 8, 0, -8, 125 }, /* 0x73 */
-+ { 4543, 6, 10, 0, -10, 94 }, /* 0x74 */
-+ { 4585, 9, 8, 0, -8, 138 }, /* 0x75 */
-+ { 4638, 8, 8, 0, -8, 126 }, /* 0x76 */
-+ { 4684, 12, 8, 0, -8, 190 }, /* 0x77 */
-+ { 4763, 8, 8, 0, -8, 128 }, /* 0x78 */
-+ { 4813, 8, 11, 0, -8, 122 }, /* 0x79 */
-+ { 4873, 7, 8, 0, -8, 115 }, /* 0x7a */
-+ { 4907, 5, 16, 0, -13, 84 }, /* 0x7b */
-+ { 4973, 3, 13, 0, -12, 46 }, /* 0x7c */
-+ { 5012, 5, 16, 0, -13, 84 }, /* 0x7d */
-+ { 5068, 8, 7, 0, -7, 131 }, /* 0x7e */
-+ { 5089, 4, 6, 0, -6, 56 }, /* 0x80 */
-+ { 5097, 6, 14, 0, -14, 97 }, /* 0x81 */
-+ { 5126, 7, 8, 0, -8, 110 }, /* 0x82 */
-+ { 5165, 7, 6, 0, -6, 118 }, /* 0x83 */
-+ { 5174, 11, 6, 0, -6, 173 }, /* 0x84 */
-+ { 5187, 3, 11, 0, -11, 42 }, /* 0x85 */
-+ { 5196, 13, 2, 0, -2, 209 }, /* 0x86 */
-+ { 5221, 5, 6, 0, -6, 80 }, /* 0x87 */
-+ { 5236, 6, 7, 0, -7, 90 }, /* 0x88 */
-+ { 5257, 6, 7, 0, -7, 98 }, /* 0x89 */
-+};
-+static const uint8_t sm_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern sm_kern[] = {
-+ {39,45,-13},{39,65,-18},{39,74,-10},{39,99,-13},{39,100,-13},{39,101,-13},{39,103,-9},{39,109,-4},
-+ {39,110,-4},{39,111,-13},{39,112,-4},{39,113,-9},{39,114,-4},{39,115,-7},{44,45,-4},{44,48,-8},
-+ {44,84,-12},{44,86,-6},{44,87,-6},{44,89,-12},{44,99,-4},{44,100,-4},{44,101,-4},{44,103,-4},
-+ {44,111,-4},{44,113,-4},{44,118,-10},{44,119,-10},{44,121,-10},{45,39,-5},{45,45,-32},{45,55,-13},
-+ {45,84,-11},{45,118,-6},{45,119,-6},{45,120,-4},{45,121,-6},{45,133,-6},{46,45,-4},{46,48,-8},
-+ {46,84,-12},{46,86,-6},{46,87,-6},{46,89,-12},{46,99,-4},{46,100,-4},{46,101,-4},{46,103,-4},
-+ {46,111,-4},{46,113,-4},{46,118,-10},{46,119,-10},{46,121,-10},{48,49,-6},{52,39,-6},{52,49,-24},
-+ {52,55,-12},{53,49,-6},{54,49,-4},{55,44,-13},{55,46,-13},{56,49,-6},{57,49,-5},{65,39,-21},
-+ {65,45,-4},{65,67,-4},{65,71,-4},{65,79,-4},{65,81,-4},{65,83,-10},{65,84,-18},{65,86,-10},
-+ {65,87,-10},{65,89,-20},{65,90,4},{65,99,-4},{65,100,-4},{65,101,-4},{65,102,-5},{65,103,-5},
-+ {65,111,-4},{65,113,-5},{65,116,-5},{65,118,-9},{65,119,-9},{65,121,-9},{65,133,-16},{66,65,-7},
-+ {66,86,-6},{66,87,-6},{66,88,-5},{66,89,-6},{66,103,-4},{66,113,-4},{66,115,-4},{67,74,4},
-+ {67,89,-4},{68,65,-7},{68,86,-6},{68,87,-6},{68,88,-5},{68,89,-6},{68,103,-4},{68,113,-4},
-+ {68,115,-4},{70,44,-20},{70,45,-12},{70,46,-20},{70,65,-15},{70,74,-12},{70,97,-10},{70,99,-12},
-+ {70,100,-12},{70,101,-12},{70,103,-7},{70,109,-5},{70,110,-5},{70,111,-12},{70,112,-5},{70,113,-7},
-+ {70,114,-5},{70,115,-9},{70,117,-6},{70,118,-11},{70,119,-11},{70,120,-9},{70,121,-11},{70,122,-5},
-+ {71,74,4},{71,89,-4},{75,45,-6},{75,65,6},{75,67,-5},{75,71,-5},{75,74,-4},{75,79,-5},
-+ {75,81,-5},{75,99,-6},{75,100,-6},{75,101,-6},{75,103,-5},{75,111,-6},{75,113,-5},{75,118,-8},
-+ {75,119,-8},{75,121,-8},{76,39,-16},{76,65,8},{76,84,-23},{76,86,-9},{76,87,-9},{76,89,-8},
-+ {76,102,-4},{76,116,-4},{76,118,-5},{76,119,-5},{76,121,-5},{76,133,-9},{79,74,4},{79,89,-4},
-+ {80,44,-7},{80,45,-6},{80,46,-7},{80,65,-9},{80,74,-5},{80,88,-6},{80,89,-6},{80,99,-6},
-+ {80,100,-6},{80,101,-6},{80,111,-6},{81,65,-4},{81,74,4},{81,86,-6},{81,87,-6},{81,88,-6},
-+ {81,89,-11},{82,65,7},{82,89,-5},{83,84,-4},{83,88,-7},{83,89,-4},{84,44,-12},{84,45,-19},
-+ {84,46,-12},{84,65,-15},{84,67,-10},{84,71,-10},{84,74,-8},{84,79,-10},{84,81,-10},{84,97,-6},
-+ {84,99,-19},{84,100,-19},{84,101,-19},{84,103,-15},{84,109,-14},{84,110,-14},{84,111,-19},{84,112,-14},
-+ {84,113,-15},{84,114,-14},{84,115,-14},{84,117,-11},{84,118,-11},{84,119,-11},{84,120,-13},{84,121,-11},
-+ {86,44,-15},{86,45,-14},{86,46,-15},{86,65,-25},{86,67,-7},{86,71,-7},{86,74,-8},{86,75,-6},
-+ {86,79,-7},{86,81,-7},{86,97,-13},{86,99,-14},{86,100,-14},{86,101,-14},{86,103,-12},{86,111,-14},
-+ {86,113,-12},{86,115,-8},{87,44,-15},{87,45,-14},{87,46,-15},{87,65,-25},{87,67,-7},{87,71,-7},
-+ {87,74,-8},{87,75,-6},{87,79,-7},{87,81,-7},{87,97,-13},{87,99,-14},{87,100,-14},{87,101,-14},
-+ {87,103,-12},{87,111,-14},{87,113,-12},{87,115,-8},{88,45,-6},{88,67,-5},{88,71,-5},{88,79,-5},
-+ {88,81,-5},{88,83,-6},{88,99,-6},{88,100,-6},{88,101,-6},{88,103,-7},{88,111,-6},{88,113,-7},
-+ {88,118,-6},{88,119,-6},{88,121,-6},{89,44,-23},{89,45,-17},{89,46,-23},{89,65,-25},{89,67,-7},
-+ {89,71,-7},{89,74,-11},{89,79,-7},{89,81,-7},{89,83,-5},{89,97,-13},{89,99,-17},{89,100,-17},
-+ {89,101,-17},{89,102,-8},{89,103,-20},{89,109,-13},{89,110,-13},{89,111,-17},{89,112,-13},{89,113,-20},
-+ {89,114,-13},{89,115,-9},{89,116,-8},{89,117,-8},{89,118,-9},{89,119,-9},{89,120,-8},{89,121,-9},
-+ {89,122,-5},{97,39,-7},{97,84,-6},{97,89,-7},{98,39,-8},{98,44,-4},{98,46,-4},{98,118,-4},
-+ {98,119,-4},{98,121,-4},{99,39,-5},{99,44,-7},{99,46,-7},{101,39,-7},{101,44,-5},{101,46,-5},
-+ {101,118,-5},{101,119,-5},{101,120,-5},{101,121,-5},{101,133,-5},{102,44,-13},{102,45,-10},{102,46,-13},
-+ {102,97,-4},{102,99,-10},{102,100,-10},{102,101,-10},{102,103,-9},{102,111,-10},{102,113,-9},{102,115,-4},
-+ {102,133,4},{104,39,-8},{104,44,-4},{104,46,-4},{104,118,-4},{104,119,-4},{104,121,-4},{107,45,-7},
-+ {107,99,-7},{107,100,-7},{107,101,-7},{107,103,-5},{107,111,-7},{107,113,-5},{109,39,-8},{109,44,-4},
-+ {109,46,-4},{109,118,-4},{109,119,-4},{109,121,-4},{110,39,-8},{110,44,-4},{110,46,-4},{110,118,-4},
-+ {110,119,-4},{110,121,-4},{111,39,-5},{111,55,-13},{111,84,-11},{111,118,-6},{111,119,-6},{111,120,-4},
-+ {111,121,-6},{111,133,-6},{112,39,-8},{112,44,-4},{112,46,-4},{112,118,-4},{112,119,-4},{112,121,-4},
-+ {114,39,7},{114,44,-9},{114,46,-9},{114,103,-4},{114,113,-4},{114,118,6},{114,119,6},{114,121,6},
-+ {114,133,13},{115,39,-6},{115,118,-8},{115,119,-8},{115,121,-8},{115,133,-5},{118,44,-10},{118,45,-6},
-+ {118,46,-10},{118,97,-4},{118,99,-6},{118,100,-6},{118,101,-6},{118,103,-7},{118,111,-6},{118,113,-7},
-+ {118,115,-8},{118,133,13},{119,44,-10},{119,45,-6},{119,46,-10},{119,97,-4},{119,99,-6},{119,100,-6},
-+ {119,101,-6},{119,103,-7},{119,111,-6},{119,113,-7},{119,115,-8},{119,133,13},{120,45,-7},{120,99,-7},
-+ {120,100,-7},{120,101,-7},{120,103,-4},{120,111,-7},{120,113,-4},{121,44,-10},{121,45,-6},{121,46,-10},
-+ {121,97,-4},{121,99,-6},{121,100,-6},{121,101,-6},{121,103,-7},{121,111,-6},{121,113,-7},{121,115,-8},
-+ {121,133,13},{133,45,-20},{133,65,-16},{133,97,-6},{133,99,-20},{133,100,-20},{133,101,-20},{133,103,-17},
-+ {133,111,-20},{133,113,-17},{133,115,-16},
-+};
-+const struct fos_font fos_font_sm_data = { sm_bits, sm_glyphs, sm_lut, sm_kern, 427, 16, 4 };
-+
-+static const uint8_t md_bits[] = {
-+ 129,9,15,4,131,9,15,4,131,9,15,3,131,9,15,3,131,9,15,3,131,8,15,2,
-+ 131,8,15,2,131,8,15,2,131,7,15,1,146,1,132,13,15,5,131,11,14,4,129,7,
-+ 15,21,15,23,15,4,5,15,22,15,3,4,15,21,15,2,3,15,4,187,131,5,8,1,
-+ 129,6,7,133,14,15,129,1,15,13,132,2,15,12,129,4,15,10,131,127,31,1,129,9,
-+ 12,15,12,25,13,15,11,9,1,130,9,15,5,129,12,15,2,132,11,15,3,129,14,15,
-+ 1,132,13,15,1,128,1,15,14,131,11,127,15,5,129,6,11,15,13,25,11,15,12,9,
-+ 3,130,5,15,9,129,7,15,6,132,8,15,6,129,10,15,4,132,10,15,4,129,12,15,
-+ 2,130,131,4,15,6,134,1,7,15,9,1,132,8,79,9,1,129,6,15,10,2,1,3,
-+ 10,15,9,129,11,15,1,131,13,15,1,128,12,15,1,131,9,14,2,128,8,15,11,2,
-+ 134,1,12,31,10,4,133,1,7,14,31,12,4,134,5,12,31,6,135,5,31,17,15,11,
-+ 132,9,15,4,128,30,1,131,10,15,2,128,9,15,11,3,17,6,15,12,129,1,10,79,
-+ 12,2,131,2,8,15,11,4,134,3,15,7,131,129,2,11,14,13,4,131,11,10,132,1,
-+ 13,14,10,12,15,3,129,4,15,2,132,4,14,1,129,12,8,129,12,9,133,4,14,1,
-+ 129,12,8,128,6,14,1,133,1,13,14,10,12,15,3,1,13,7,135,2,11,15,13,4,
-+ 128,7,13,141,1,14,5,141,9,12,141,3,15,4,128,1,7,9,5,136,27,128,2,14,
-+ 47,8,134,4,15,2,128,9,12,2,1,7,15,1,133,12,9,129,10,9,129,2,15,3,
-+ 132,6,14,1,129,5,15,11,10,14,12,133,13,7,131,6,13,14,11,2,129,130,6,13,
-+ 15,13,9,1,134,7,15,14,10,12,15,12,134,14,15,2,129,11,15,4,133,14,15,130,
-+ 9,15,5,133,9,15,7,128,3,15,14,1,133,1,13,15,8,14,15,6,135,6,31,14,
-+ 5,135,5,47,13,2,134,5,15,14,5,7,15,12,1,128,22,130,13,15,4,129,8,15,
-+ 11,4,15,12,130,15,14,131,9,31,14,3,130,14,15,2,130,6,31,9,131,8,15,14,
-+ 26,13,15,14,13,15,4,131,6,12,14,15,12,8,1,2,30,2,128,7,15,6,7,15,
-+ 5,6,15,21,15,3,157,129,1,13,14,1,130,7,15,8,131,14,15,2,130,4,15,12,
-+ 131,9,15,8,131,12,15,5,131,14,15,3,131,31,2,130,1,31,2,131,31,2,131,14,
-+ 15,3,131,12,15,5,131,9,15,8,131,5,15,12,132,14,15,2,131,8,15,8,131,1,
-+ 13,14,1,128,128,2,15,11,131,10,15,5,130,5,15,12,131,14,15,2,130,11,15,6,
-+ 130,8,15,9,130,6,15,12,130,5,15,13,130,4,15,13,130,5,15,13,130,6,15,12,
-+ 130,8,15,9,130,11,15,6,129,1,14,15,2,129,5,15,11,130,11,15,5,129,2,15,
-+ 11,129,130,9,8,130,2,8,1,9,8,1,8,1,3,12,14,28,14,12,2,129,9,31,
-+ 8,129,2,11,14,29,14,11,18,8,1,9,8,1,9,2,130,9,8,194,131,13,11,135,
-+ 13,12,135,13,12,131,4,127,3,2,41,30,41,2,131,13,12,135,13,12,135,13,11,151,
-+ 128,1,15,9,129,4,15,5,129,7,15,1,129,9,13,130,12,8,129,2,89,2,4,95,
-+ 4,167,129,2,131,6,15,12,130,5,14,10,129,132,12,15,1,132,3,15,11,133,8,15,
-+ 6,133,13,15,1,132,3,15,11,133,9,15,5,133,14,15,1,132,4,15,10,133,9,15,
-+ 5,133,30,1,132,4,15,10,133,10,15,4,133,30,133,5,15,9,133,129,1,9,13,15,
-+ 14,10,3,130,1,13,15,13,10,12,31,3,129,7,15,10,130,6,15,12,129,11,15,4,
-+ 131,14,15,129,11,15,2,131,13,15,1,128,12,15,2,131,13,15,1,128,12,15,2,131,
-+ 13,15,1,128,12,15,2,131,13,15,1,128,12,15,2,131,13,15,1,128,11,15,2,131,
-+ 13,15,1,128,11,15,4,131,14,15,129,7,15,10,130,6,15,12,129,1,13,15,13,10,
-+ 12,31,3,130,1,9,13,15,14,10,3,129,128,1,7,14,15,6,129,14,47,7,129,9,
-+ 5,8,15,7,131,7,15,7,131,7,15,7,131,7,15,7,131,7,15,7,131,7,15,7,
-+ 131,7,15,7,131,7,15,7,131,7,15,7,131,7,15,7,131,7,15,7,131,7,15,6,
-+ 128,129,3,10,14,15,12,7,131,3,31,11,10,14,15,10,130,11,15,6,129,1,13,15,
-+ 4,129,14,15,131,8,15,7,129,23,131,10,15,5,134,2,15,14,1,134,12,15,7,134,
-+ 9,15,11,134,7,15,13,1,133,5,15,14,3,133,3,14,15,4,133,2,14,15,6,134,
-+ 12,15,14,73,8,129,14,111,13,128,128,14,111,3,128,8,57,12,31,2,132,4,14,15,
-+ 7,132,3,14,15,8,132,2,14,15,9,133,11,31,11,5,132,3,8,7,13,15,7,134,
-+ 1,30,1,134,10,15,4,1,7,6,131,9,15,5,1,15,14,131,11,15,4,128,11,15,
-+ 6,129,3,15,14,129,3,14,15,11,10,14,15,6,130,3,10,30,12,5,129,131,5,15,
-+ 10,135,12,15,4,134,4,15,12,135,11,15,5,134,3,15,13,135,10,15,6,134,2,15,
-+ 13,130,12,15,2,129,9,15,7,130,12,15,2,128,1,31,59,14,15,11,3,2,127,15,
-+ 4,134,12,15,2,135,12,15,2,135,12,15,2,135,11,15,2,128,128,12,111,1,128,13,
-+ 15,10,73,129,13,15,1,134,13,15,1,134,13,15,1,134,13,15,2,6,9,7,3,130,
-+ 13,15,14,63,7,129,13,15,11,2,128,4,14,15,2,128,5,6,1,130,8,15,6,134,
-+ 6,15,8,128,8,11,2,130,7,15,7,128,8,15,9,129,1,13,15,4,128,1,13,15,
-+ 12,10,13,15,10,130,2,9,13,14,13,7,129,129,2,10,13,15,12,7,130,3,31,12,
-+ 10,14,15,9,129,10,15,7,129,2,14,15,2,128,13,15,2,130,10,15,4,128,13,15,
-+ 1,130,17,129,13,15,1,6,9,8,3,130,13,15,13,63,7,129,13,15,12,3,128,5,
-+ 31,2,128,13,15,4,130,8,15,7,128,13,15,1,130,6,15,8,128,12,15,2,130,7,
-+ 15,7,128,8,15,8,129,1,13,15,4,128,1,13,15,12,10,13,15,10,130,2,9,13,
-+ 15,13,8,129,5,127,3,6,15,10,57,14,15,3,4,11,2,130,2,15,13,134,8,15,
-+ 8,134,13,15,2,133,4,15,12,134,10,15,6,133,1,14,15,1,133,6,15,10,134,12,
-+ 15,4,133,2,15,14,134,8,15,8,134,13,15,3,133,4,15,12,132,129,1,9,14,15,
-+ 12,6,131,1,13,15,12,10,14,15,7,130,7,15,9,129,2,30,1,129,11,15,3,130,
-+ 10,15,3,129,10,15,4,130,11,15,3,129,5,15,12,3,1,7,15,13,131,9,63,14,
-+ 2,130,2,13,15,11,10,14,15,8,130,10,15,6,129,1,13,15,3,129,14,15,131,7,
-+ 15,7,129,14,15,131,8,15,7,129,11,15,7,129,1,13,15,3,129,3,31,11,10,14,
-+ 15,10,131,3,10,14,15,13,7,130,129,3,11,30,12,5,131,3,14,15,11,10,14,15,
-+ 6,130,11,15,6,129,2,30,1,129,15,14,131,10,15,4,128,1,15,13,131,9,15,5,
-+ 129,15,14,131,10,15,5,129,11,15,6,129,2,14,15,5,129,4,31,11,10,14,31,5,
-+ 130,4,12,14,13,25,15,5,135,8,15,5,129,9,12,2,130,9,15,5,129,10,15,7,
-+ 129,1,13,15,3,129,3,31,11,10,14,15,10,131,3,11,30,12,7,130,130,2,132,10,
-+ 15,8,131,8,14,7,160,2,132,10,15,8,131,8,14,7,129,129,9,11,2,129,3,31,
-+ 9,129,1,12,14,4,148,10,15,1,130,12,13,131,14,9,130,1,15,6,130,2,15,3,
-+ 129,144,6,13,3,131,1,7,14,15,14,2,129,2,8,14,15,13,7,1,128,1,10,31,
-+ 11,5,131,4,15,14,4,133,2,12,15,14,9,3,133,4,11,31,11,4,133,2,9,31,
-+ 13,2,133,2,8,14,3,135,1,128,3,125,2,4,127,3,147,3,125,2,4,127,3,157,
-+ 137,4,12,5,134,3,31,13,6,1,132,1,8,14,15,14,8,1,133,6,12,31,9,1,
-+ 133,5,31,3,131,3,10,31,11,1,129,5,12,31,10,3,129,3,13,15,14,9,2,131,
-+ 4,14,7,1,133,1,136,129,5,12,30,11,3,130,7,15,14,10,11,31,3,128,1,15,
-+ 14,2,129,6,15,11,128,4,15,10,130,1,15,13,128,1,6,4,130,4,15,12,133,2,
-+ 13,15,6,132,3,14,15,10,132,2,14,15,7,133,7,15,9,134,8,15,7,134,1,3,
-+ 1,135,2,135,10,15,8,134,9,14,6,131,132,3,8,12,30,13,8,2,133,1,9,31,
-+ 12,26,12,31,6,131,1,12,15,7,1,131,2,11,15,4,130,10,14,3,128,2,24,2,
-+ 9,1,128,28,129,3,15,5,128,3,14,31,14,15,1,128,4,15,2,128,9,13,129,11,
-+ 13,2,1,12,14,129,1,15,4,128,12,9,129,14,6,129,8,12,129,1,15,5,128,14,
-+ 7,128,2,15,3,129,26,129,4,15,2,128,13,8,128,3,15,4,128,2,14,11,129,11,
-+ 13,129,27,129,14,13,10,13,14,15,11,12,15,6,129,6,15,4,128,4,12,15,10,1,
-+ 9,14,13,7,131,12,14,5,132,1,134,2,13,15,13,10,9,10,12,15,4,134,1,7,
-+ 12,14,15,13,10,5,132,131,1,31,9,136,6,31,14,136,11,15,13,15,4,134,1,15,
-+ 14,5,15,9,134,5,15,9,1,15,14,134,10,15,4,128,11,15,4,132,1,30,129,6,
-+ 15,9,132,5,15,10,129,2,15,13,132,10,15,5,130,12,15,3,131,14,15,1,130,7,
-+ 15,8,130,4,127,13,130,9,15,10,72,13,15,3,129,14,15,2,132,8,15,8,128,4,
-+ 15,12,133,3,15,12,128,128,5,79,13,11,4,130,5,15,13,41,12,31,5,129,5,15,
-+ 8,131,6,15,13,129,5,15,8,132,14,15,129,5,15,8,132,30,129,5,15,8,131,5,
-+ 15,8,129,5,15,12,41,11,15,8,130,5,111,13,3,129,5,15,8,130,2,9,15,13,
-+ 129,5,15,8,132,13,15,2,128,5,15,8,132,12,15,3,128,5,15,8,131,3,15,14,
-+ 1,128,5,15,12,41,11,31,7,129,5,79,14,11,4,129,130,5,11,30,12,7,1,131,
-+ 9,15,14,11,10,13,15,13,1,129,4,15,13,2,130,10,15,9,129,9,15,5,131,1,
-+ 15,13,129,11,15,3,132,8,9,129,11,15,3,136,11,15,3,136,11,15,3,136,11,15,
-+ 3,136,11,15,3,132,24,129,9,15,5,131,1,15,13,129,4,15,13,2,130,10,15,9,
-+ 130,9,15,14,11,10,13,15,12,1,131,5,11,30,12,7,1,129,128,5,79,14,11,4,
-+ 130,5,15,13,41,11,31,5,129,5,15,8,131,5,15,14,129,5,15,8,132,12,15,3,
-+ 128,5,15,8,132,10,15,4,128,5,15,8,132,10,15,4,128,5,15,8,132,10,15,4,
-+ 128,5,15,8,132,10,15,4,128,5,15,8,132,10,15,4,128,5,15,8,132,10,15,4,
-+ 128,5,15,8,132,12,15,3,128,5,15,8,131,5,15,14,129,5,15,12,41,11,31,5,
-+ 129,5,79,14,11,4,129,128,5,127,14,129,5,15,13,89,8,129,5,15,8,136,5,15,
-+ 8,136,5,15,8,136,5,15,8,136,5,15,12,57,6,131,5,95,11,131,5,15,8,136,
-+ 5,15,8,136,5,15,8,136,5,15,8,136,5,15,12,89,8,129,5,127,14,128,128,5,
-+ 127,14,128,5,15,13,89,8,128,5,15,8,135,5,15,8,135,5,15,8,135,5,15,8,
-+ 135,5,15,12,57,6,130,5,95,10,130,5,15,8,135,5,15,8,135,5,15,8,135,5,
-+ 15,8,135,5,15,8,135,5,15,8,134,130,5,11,30,12,7,132,9,15,14,11,10,14,
-+ 15,12,1,129,4,15,13,2,129,1,11,15,8,129,9,15,5,131,2,15,13,129,11,15,
-+ 3,132,28,129,11,15,3,136,11,15,3,136,11,15,3,129,13,63,129,11,15,3,129,8,
-+ 25,31,129,11,15,3,132,14,15,129,9,15,6,132,15,14,129,4,15,13,2,130,8,15,
-+ 9,130,9,15,14,11,10,13,15,13,2,131,5,11,14,15,13,8,1,129,128,5,15,8,
-+ 132,8,15,5,129,5,15,8,132,9,15,5,129,5,15,8,132,9,15,5,129,5,15,8,
-+ 132,9,15,5,129,5,15,8,132,9,15,5,129,5,15,8,132,9,15,5,129,5,15,12,
-+ 73,13,15,5,129,5,127,15,5,129,5,15,8,132,9,15,5,129,5,15,8,132,9,15,
-+ 5,129,5,15,8,132,9,15,5,129,5,15,8,132,9,15,5,129,5,15,8,132,9,15,
-+ 5,129,5,15,8,132,8,15,5,128,128,5,15,8,129,5,15,8,129,5,15,8,129,5,
-+ 15,8,129,5,15,8,129,5,15,8,129,5,15,8,129,5,15,8,129,5,15,8,129,5,
-+ 15,8,129,5,15,8,129,5,15,8,129,5,15,8,129,5,15,8,128,135,30,137,15,14,
-+ 137,15,14,137,15,14,137,15,14,137,15,14,137,15,14,137,15,14,129,6,13,5,132,15,
-+ 14,129,7,15,6,132,15,14,129,6,15,8,131,2,15,13,129,2,15,14,2,130,10,15,
-+ 8,130,7,31,11,10,13,15,13,1,131,5,11,14,15,13,8,1,130,128,5,15,8,131,
-+ 1,13,15,4,128,5,15,8,130,1,12,15,6,129,5,15,8,130,11,15,9,130,5,15,
-+ 8,129,9,15,11,131,5,15,8,128,7,15,12,1,131,5,15,8,6,15,14,2,132,5,
-+ 15,12,31,14,2,132,5,31,14,10,15,10,132,5,31,4,128,12,15,5,131,5,15,9,
-+ 129,3,15,14,1,130,5,15,8,130,8,15,10,130,5,15,8,131,12,15,5,129,5,15,
-+ 8,131,3,15,14,1,128,5,15,8,132,8,15,9,128,5,15,8,135,5,15,8,135,5,
-+ 15,8,135,5,15,8,135,5,15,8,135,5,15,8,135,5,15,8,135,5,15,8,135,5,
-+ 15,8,135,5,15,8,135,5,15,8,135,5,15,8,135,5,15,13,90,7,128,5,127,11,
-+ 128,5,15,12,133,8,15,10,129,5,31,8,131,3,31,10,129,5,47,3,130,13,31,10,
-+ 129,5,15,14,15,12,129,8,15,13,15,10,129,5,15,8,11,15,8,3,15,14,5,15,
-+ 10,129,5,15,8,2,14,15,13,15,5,4,15,10,129,5,15,8,128,6,31,10,128,4,
-+ 15,10,129,5,15,8,129,10,14,1,128,4,15,10,129,5,15,8,133,4,15,10,129,5,
-+ 15,8,133,4,15,10,129,5,15,8,133,4,15,10,129,5,15,8,133,4,15,10,129,5,
-+ 15,8,133,4,15,10,129,5,15,8,133,4,15,10,128,128,5,15,11,132,2,15,12,129,
-+ 5,31,6,131,2,15,12,129,5,31,14,1,130,2,15,12,129,5,15,14,15,9,130,2,
-+ 15,12,129,5,15,9,12,15,3,129,2,15,12,129,5,15,8,4,15,12,129,2,15,12,
-+ 129,5,15,8,128,9,15,7,128,2,15,12,129,5,15,8,128,1,30,18,15,12,129,5,
-+ 15,8,129,6,15,10,2,15,12,129,5,15,8,130,12,15,6,15,12,129,5,15,8,130,
-+ 3,15,14,15,12,129,5,15,8,131,8,31,12,129,5,15,8,131,1,13,15,12,129,5,
-+ 15,8,132,5,15,12,128,130,5,11,30,13,8,1,131,8,31,11,10,13,15,13,1,129,
-+ 3,15,14,2,130,9,15,9,129,9,15,6,131,1,14,15,129,11,15,3,132,12,15,2,
-+ 128,11,15,3,132,12,15,2,128,11,15,3,132,12,15,2,128,11,15,3,132,12,15,2,
-+ 128,11,15,3,132,12,15,2,128,11,15,3,132,12,15,2,128,9,15,6,131,1,14,15,
-+ 129,3,15,14,2,130,9,15,9,130,8,31,11,10,13,15,13,1,131,5,11,14,15,13,
-+ 8,1,129,128,7,79,14,12,5,130,7,15,12,41,11,31,6,129,7,15,7,131,4,15,
-+ 14,129,7,15,7,132,12,15,2,128,7,15,7,132,12,15,2,128,7,15,7,131,4,15,
-+ 14,129,7,15,12,41,11,31,6,129,7,79,14,11,5,130,7,15,7,136,7,15,7,136,
-+ 7,15,7,136,7,15,7,136,7,15,7,136,7,15,6,135,130,7,12,30,11,4,132,12,
-+ 15,13,10,11,31,7,130,7,15,10,1,129,2,14,15,2,129,12,15,2,131,7,15,7,
-+ 129,14,15,132,5,15,9,129,30,132,5,15,9,129,30,132,5,15,9,129,30,132,5,15,
-+ 9,129,30,132,5,15,9,129,14,15,132,6,15,9,129,12,15,4,131,10,15,7,129,6,
-+ 15,14,5,1,2,8,31,2,130,10,95,5,132,5,10,15,14,8,2,134,2,15,12,136,
-+ 2,15,11,132,128,5,79,14,12,5,130,5,15,13,41,11,31,6,129,5,15,8,131,3,
-+ 15,14,129,5,15,8,132,12,15,3,128,5,15,8,132,12,15,3,128,5,15,8,131,3,
-+ 15,14,129,5,15,12,41,10,31,6,129,5,95,13,5,130,5,15,8,129,3,15,11,131,
-+ 5,15,8,130,10,15,3,130,5,15,8,130,3,15,11,130,5,15,8,131,11,15,3,129,
-+ 5,15,8,131,4,15,11,129,5,15,8,132,11,15,3,129,2,9,13,30,11,6,131,2,
-+ 14,15,12,10,11,14,15,10,130,9,15,7,130,1,12,15,6,129,12,15,2,131,5,15,
-+ 9,129,10,15,6,131,1,7,5,129,3,31,9,3,135,3,12,31,12,6,135,4,10,31,
-+ 13,5,135,1,8,31,4,129,8,6,132,6,15,10,129,15,13,132,3,15,11,129,12,15,
-+ 7,131,9,15,9,129,3,14,15,13,26,13,15,13,1,130,2,9,13,30,12,7,1,129,
-+ 3,127,15,11,2,41,11,15,13,41,6,131,4,15,9,135,4,15,9,135,4,15,9,135,
-+ 4,15,9,135,4,15,9,135,4,15,9,135,4,15,9,135,4,15,9,135,4,15,9,135,
-+ 4,15,9,135,4,15,9,135,4,15,9,131,128,7,15,6,132,9,15,4,129,8,15,6,
-+ 132,9,15,5,129,8,15,6,132,9,15,5,129,8,15,6,132,9,15,5,129,8,15,6,
-+ 132,9,15,5,129,8,15,6,132,9,15,5,129,8,15,6,132,9,15,5,129,8,15,6,
-+ 132,9,15,5,129,8,15,6,132,9,15,5,129,7,15,7,132,9,15,4,129,5,15,9,
-+ 132,12,15,3,129,1,14,15,4,130,6,15,13,131,5,31,12,10,12,15,14,3,132,3,
-+ 10,14,15,13,9,2,130,4,15,12,133,10,15,4,128,14,15,1,131,1,30,129,9,15,
-+ 6,131,4,15,10,129,5,15,10,131,9,15,5,129,1,30,131,13,14,1,130,10,15,4,
-+ 129,3,15,10,131,6,15,9,129,7,15,6,131,1,15,13,129,12,15,1,132,11,15,3,
-+ 1,15,11,133,6,15,7,6,15,6,133,2,15,12,10,15,2,134,12,31,12,135,7,31,
-+ 7,135,2,31,2,131,6,15,9,131,5,15,12,132,30,128,2,15,13,131,9,31,2,130,
-+ 4,15,10,129,13,15,2,130,13,31,6,130,8,15,6,129,9,15,6,129,1,15,14,15,
-+ 9,130,12,15,2,129,5,15,10,129,5,15,7,14,13,129,1,15,13,130,1,15,14,129,
-+ 9,15,3,11,15,2,128,5,15,9,131,11,15,3,128,12,14,128,7,15,6,128,9,15,
-+ 5,131,7,15,7,1,15,11,128,3,15,10,128,13,15,1,131,3,15,11,5,15,7,129,
-+ 30,2,15,12,133,30,9,15,4,129,10,15,9,15,8,133,10,47,130,6,47,4,133,6,
-+ 31,11,130,3,47,1,133,1,31,8,131,14,15,11,135,12,15,4,131,10,15,7,131,2,
-+ 15,14,1,131,1,13,15,3,128,8,15,9,131,8,15,9,130,13,15,3,129,2,15,14,
-+ 1,130,4,15,12,129,11,15,5,132,10,15,6,5,15,11,133,2,30,13,15,2,134,7,
-+ 31,8,135,6,31,7,134,1,46,15,2,133,10,15,6,5,15,11,132,4,15,12,129,11,
-+ 15,5,131,13,15,3,129,2,15,13,1,129,8,15,9,131,8,15,8,128,2,15,14,1,
-+ 131,1,13,15,3,2,15,13,132,3,15,13,129,9,15,6,131,11,15,5,129,2,15,14,
-+ 1,129,4,15,12,131,9,15,7,129,12,15,4,131,1,30,1,5,15,11,133,8,15,8,
-+ 12,15,3,133,1,14,31,10,135,7,31,2,135,2,15,12,136,2,15,12,136,2,15,12,
-+ 136,2,15,12,136,2,15,12,136,2,15,12,132,3,127,15,17,89,10,31,1,134,10,15,
-+ 8,134,5,15,12,134,1,14,15,3,134,10,15,8,134,5,15,13,134,1,14,15,3,134,
-+ 10,15,8,134,4,15,13,1,133,1,13,15,4,134,9,15,9,134,2,31,10,89,1,3,
-+ 127,15,1,3,57,2,129,5,63,4,129,5,15,9,132,5,15,9,132,5,15,9,132,5,
-+ 15,9,132,5,15,9,132,5,15,9,132,5,15,9,132,5,15,9,132,5,15,9,132,5,
-+ 15,9,132,5,15,9,132,5,15,9,132,5,15,9,132,5,15,9,132,5,15,13,25,2,
-+ 129,5,63,4,129,128,8,15,5,133,3,15,10,134,13,15,1,133,8,15,6,133,3,15,
-+ 11,134,13,15,1,133,7,15,6,133,2,15,12,134,12,15,2,133,7,15,7,133,2,15,
-+ 12,134,11,15,2,133,6,15,7,133,1,15,12,128,129,4,57,2,129,6,63,3,132,11,
-+ 15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,
-+ 15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,15,3,132,11,
-+ 15,3,132,11,15,3,129,4,25,13,15,3,129,6,63,3,130,2,8,3,133,10,15,12,
-+ 132,1,15,13,15,3,131,7,15,2,14,9,131,13,11,128,9,14,1,129,4,15,5,128,
-+ 3,15,7,129,11,14,130,12,13,128,2,15,8,130,6,15,4,181,4,121,4,7,127,6,
-+ 2,8,3,129,12,13,129,3,15,6,171,129,4,11,30,12,6,130,6,31,11,10,14,15,
-+ 8,129,10,14,5,129,1,14,15,1,134,12,15,2,128,1,7,12,14,63,2,128,11,15,
-+ 14,10,25,14,15,18,15,13,1,130,12,15,18,15,12,130,3,31,2,128,13,15,12,10,
-+ 11,47,2,128,2,10,14,15,12,5,11,15,2,128,8,15,5,135,9,15,5,135,9,15,
-+ 5,135,9,15,5,135,9,15,7,10,30,10,2,130,9,31,14,10,13,15,13,1,129,9,
-+ 15,14,1,129,11,15,8,129,9,15,8,130,3,15,12,129,9,15,6,130,1,15,14,129,
-+ 9,15,6,130,1,15,14,129,9,15,8,130,3,15,12,129,9,15,14,1,129,10,15,7,
-+ 129,9,31,13,10,12,15,13,1,129,8,15,6,10,15,14,10,2,129,129,1,8,13,15,
-+ 13,8,1,130,1,13,15,12,10,13,15,13,1,129,7,15,9,130,9,15,8,129,12,15,
-+ 3,130,2,8,4,129,13,15,1,135,13,15,1,135,12,15,3,130,2,7,3,129,7,15,
-+ 9,130,10,15,7,129,1,12,15,12,10,13,15,13,1,130,1,8,13,15,13,8,1,129,
-+ 134,4,15,9,135,4,15,10,135,4,15,10,135,4,15,10,130,2,9,13,15,11,6,15,
-+ 10,129,1,13,15,13,10,13,31,10,129,7,15,11,129,1,13,15,10,129,11,15,4,130,
-+ 7,15,10,129,13,15,2,130,5,15,10,129,13,15,2,130,5,15,10,129,11,15,4,130,
-+ 7,15,10,129,6,15,10,129,1,13,15,10,129,1,13,15,12,10,13,31,10,130,1,9,
-+ 30,11,6,15,9,128,129,1,9,13,15,14,9,1,130,1,13,15,12,10,13,15,12,130,
-+ 8,15,8,130,10,15,5,129,12,15,2,130,4,15,9,129,13,111,10,129,13,15,89,6,
-+ 129,11,15,2,135,6,15,9,130,4,11,2,130,12,15,13,10,11,15,14,3,130,1,8,
-+ 13,15,14,9,2,129,130,9,13,15,8,129,7,15,14,10,5,129,10,15,5,131,11,15,
-+ 3,129,5,79,8,3,9,14,15,10,9,5,129,12,15,2,131,12,15,2,131,12,15,2,
-+ 131,12,15,2,131,12,15,2,131,12,15,2,131,12,15,2,131,11,15,2,129,129,2,10,
-+ 30,10,7,15,8,129,2,14,15,12,10,13,31,9,129,9,15,9,129,1,12,15,9,129,
-+ 13,15,2,130,7,15,9,129,14,15,131,5,15,9,129,14,15,131,5,15,9,129,13,15,
-+ 2,130,6,15,9,129,9,15,9,130,12,15,9,129,2,14,15,12,10,13,31,9,130,2,
-+ 10,30,11,8,15,9,135,8,15,7,134,2,14,15,4,131,6,9,11,31,10,132,9,15,
-+ 14,11,6,130,128,9,15,4,135,9,15,5,135,9,15,5,135,9,15,5,135,9,15,7,
-+ 11,30,10,2,130,9,31,13,10,13,15,13,1,129,9,15,11,129,1,12,15,5,129,9,
-+ 15,5,130,7,15,7,129,9,15,5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,
-+ 15,5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,
-+ 15,4,130,6,15,7,128,128,7,14,8,129,8,15,10,130,2,135,6,15,7,129,7,15,
-+ 7,129,7,15,7,129,7,15,7,129,7,15,7,129,7,15,7,129,7,15,7,129,7,15,
-+ 7,129,7,15,7,129,6,15,7,128,129,8,14,6,130,10,15,8,131,2,137,8,15,5,
-+ 130,8,15,6,130,8,15,6,130,8,15,6,130,8,15,6,130,8,15,6,130,8,15,6,
-+ 130,8,15,6,130,8,15,6,130,8,15,6,130,8,15,5,130,12,15,4,128,8,13,15,
-+ 14,129,13,14,10,2,129,128,9,15,4,134,9,15,5,134,9,15,5,134,9,15,5,134,
-+ 9,15,5,129,4,15,14,1,128,9,15,5,128,3,30,3,129,9,15,5,2,14,15,5,
-+ 130,9,15,6,13,15,12,131,9,47,13,15,3,130,9,31,5,4,15,10,130,9,15,7,
-+ 129,12,15,2,129,9,15,5,129,5,15,9,129,9,15,5,130,13,15,2,128,9,15,4,
-+ 130,6,15,8,128,9,15,4,129,9,15,5,129,9,15,5,129,9,15,5,129,9,15,5,
-+ 129,9,15,5,129,9,15,5,129,9,15,5,129,9,15,5,129,9,15,5,129,9,15,5,
-+ 129,9,15,5,129,9,15,5,129,9,15,4,128,128,9,15,6,10,30,10,2,3,11,30,
-+ 10,1,130,9,31,12,10,14,15,13,14,12,10,14,15,11,130,9,15,10,129,1,14,15,
-+ 10,129,1,14,15,2,129,9,15,5,130,10,15,5,130,10,15,4,129,9,15,5,130,10,
-+ 15,4,130,10,15,4,129,9,15,5,130,10,15,4,130,10,15,4,129,9,15,5,130,10,
-+ 15,4,130,10,15,4,129,9,15,5,130,10,15,4,130,10,15,4,129,9,15,5,130,10,
-+ 15,4,130,10,15,4,129,9,15,4,130,9,15,4,130,9,15,4,128,128,9,15,7,11,
-+ 30,10,2,130,9,31,13,10,13,15,13,1,129,9,15,11,129,1,12,15,5,129,9,15,
-+ 5,130,7,15,7,129,9,15,5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,15,
-+ 5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,15,5,130,6,15,8,129,9,15,
-+ 4,130,6,15,7,128,129,1,8,13,15,13,8,1,130,1,12,15,13,10,12,15,12,1,
-+ 129,7,15,10,130,9,15,8,129,12,15,3,130,2,15,12,129,13,15,1,131,15,14,129,
-+ 13,15,1,131,15,14,129,11,15,3,130,2,15,12,129,7,15,10,130,9,15,8,129,1,
-+ 12,15,13,10,12,15,13,1,130,1,8,13,15,13,9,1,129,128,7,15,8,10,30,10,
-+ 2,130,7,31,14,10,11,15,14,2,129,7,15,14,2,129,8,15,9,129,7,15,10,130,
-+ 2,15,13,129,7,15,7,131,14,15,129,7,15,7,131,14,15,129,7,15,10,130,2,15,
-+ 14,129,7,15,14,2,129,10,15,9,129,7,31,14,10,12,15,14,2,129,7,15,8,10,
-+ 30,10,3,130,7,15,7,135,7,15,7,135,7,15,7,135,7,15,6,134,129,1,9,13,
-+ 15,11,6,15,9,129,1,13,15,12,10,13,31,10,129,6,15,10,129,1,13,15,10,129,
-+ 11,15,4,130,7,15,10,129,13,15,2,130,5,15,10,129,13,15,2,130,5,15,10,129,
-+ 11,15,4,130,7,15,10,129,7,15,11,129,1,13,15,10,129,1,13,15,13,10,13,31,
-+ 10,130,2,10,30,11,6,15,10,135,4,15,10,135,4,15,10,135,4,15,10,135,4,15,
-+ 9,128,128,9,15,6,10,14,13,1,128,9,31,13,10,9,129,9,15,11,132,9,15,6,
-+ 132,9,15,5,132,9,15,5,132,9,15,5,132,9,15,5,132,9,15,5,132,9,15,4,
-+ 131,129,7,12,30,11,4,130,9,15,14,26,14,15,5,129,30,1,129,3,15,11,129,12,
-+ 15,5,130,17,129,3,12,15,14,10,5,1,132,5,9,14,15,13,3,129,18,130,6,15,
-+ 11,129,15,14,1,129,3,15,13,129,9,15,14,26,14,15,8,130,7,12,30,12,6,129,
-+ 129,6,7,132,13,15,132,13,15,130,5,79,6,3,9,14,15,25,4,129,13,15,132,13,
-+ 15,132,13,15,132,13,15,132,13,15,132,13,15,2,131,10,15,13,9,3,129,2,11,14,
-+ 15,4,128,11,15,2,130,8,15,5,129,11,15,2,130,8,15,5,129,11,15,2,130,8,
-+ 15,5,129,11,15,2,130,8,15,5,129,11,15,2,130,8,15,5,129,11,15,2,130,8,
-+ 15,5,129,11,15,3,130,9,15,5,129,10,15,8,129,1,13,15,5,129,3,31,12,10,
-+ 14,31,5,130,4,11,30,10,9,15,5,128,5,15,11,131,14,15,2,1,14,15,1,129,
-+ 4,15,12,129,10,15,6,129,8,15,7,129,5,15,10,129,13,15,2,130,30,1,3,15,
-+ 12,131,9,15,5,7,15,7,131,4,15,9,12,15,2,132,30,15,12,133,9,31,7,133,
-+ 4,31,2,130,5,15,9,130,9,15,5,130,11,15,3,1,15,13,130,14,15,10,129,1,
-+ 15,13,129,11,15,2,128,3,31,14,129,5,15,9,129,7,15,6,128,7,15,12,15,3,
-+ 128,9,15,4,129,2,15,10,128,11,14,4,15,7,128,13,14,131,13,14,1,14,10,128,
-+ 14,11,2,15,10,131,8,15,7,15,6,128,9,15,7,15,6,131,4,15,14,15,2,128,
-+ 5,15,14,15,1,132,14,15,12,129,1,31,12,133,10,15,8,130,11,15,7,130,4,15,
-+ 12,130,1,13,15,4,128,9,15,7,129,9,15,8,129,1,13,15,3,4,15,13,131,3,
-+ 15,12,13,15,3,132,8,31,7,133,6,31,6,132,2,30,13,14,2,131,12,15,5,4,
-+ 15,12,130,8,15,9,129,8,15,8,128,4,15,13,1,130,12,15,3,7,15,9,130,1,
-+ 30,128,2,15,13,130,5,15,10,129,12,15,3,129,9,15,4,129,7,15,7,129,13,14,
-+ 130,2,15,12,128,3,15,9,131,11,15,1,7,15,4,131,6,15,6,12,13,132,1,15,
-+ 12,15,8,133,11,31,3,133,6,15,13,134,5,15,8,134,11,15,2,132,8,12,15,10,
-+ 132,1,15,14,9,1,132,4,111,4,2,57,10,31,4,132,11,15,9,132,8,15,11,132,
-+ 5,15,13,1,131,2,14,15,3,131,1,12,15,6,132,10,15,9,132,5,31,73,3,6,
-+ 111,5,129,1,7,9,8,130,11,31,13,130,31,3,131,15,14,132,15,14,132,15,14,132,
-+ 15,14,131,2,15,13,130,3,13,15,8,130,4,31,4,131,5,15,12,131,1,15,13,132,
-+ 15,14,132,15,14,132,15,14,132,15,14,132,14,15,12,8,130,5,13,15,13,128,2,15,
-+ 11,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,
-+ 12,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,12,128,2,15,
-+ 12,128,2,15,12,128,2,15,12,128,2,15,11,128,3,25,5,130,5,47,5,131,9,15,
-+ 8,131,5,15,9,131,5,15,9,131,5,15,9,131,5,15,9,131,4,15,11,131,1,13,
-+ 15,9,131,9,15,13,130,3,15,13,1,130,5,15,9,131,5,15,9,131,5,15,9,131,
-+ 5,15,9,131,6,15,9,129,3,9,14,15,7,129,5,31,11,1,129,128,1,7,9,6,
-+ 1,129,5,128,1,12,47,14,10,13,15,5,1,10,5,1,4,10,30,7,168,128,17,129,
-+ 13,15,5,128,12,14,4,139,129,5,9,8,2,130,9,47,14,4,128,4,15,7,1,2,
-+ 28,128,7,13,130,4,15,1,6,14,2,129,8,14,128,1,13,14,10,11,15,8,129,2,
-+ 11,14,13,7,201,128,8,5,130,9,3,128,1,13,15,5,128,10,15,9,129,2,13,15,
-+ 12,15,9,131,2,31,11,132,10,47,5,130,10,15,9,2,13,15,5,128,1,12,9,129,
-+ 2,13,6,155,2,105,20,111,7,172,2,121,41,7,128,4,127,47,12,198,128,13,14,1,
-+ 3,15,9,128,8,15,3,128,12,11,169,129,2,131,17,131,2,130,6,15,12,129,1,14,
-+ 15,4,129,9,15,9,129,5,14,10,129,1,12,14,3,129,8,14,7,128,128,5,13,14,
-+ 7,128,1,14,47,20,63,7,1,14,47,4,128,5,13,14,7,146,129,1,13,14,1,130,
-+ 9,15,5,130,5,15,9,131,12,15,1,131,5,15,9,132,9,15,5,131,1,13,14,1,
-+ 142,128,1,14,13,1,132,4,15,10,133,8,15,6,132,1,30,132,8,15,6,131,4,15,
-+ 10,131,1,14,13,1,146,
-+};
-+static const struct fos_glyph md_glyphs[] = {
-+ { 0, 4, 0, 0, 0, 64 }, /* 0x20 */
-+ { 0, 7, 14, 0, -14, 105 }, /* 0x21 */
-+ { 47, 6, 14, 0, -14, 95 }, /* 0x22 */
-+ { 68, 13, 13, 0, -13, 214 }, /* 0x23 */
-+ { 170, 11, 17, 0, -15, 180 }, /* 0x24 */
-+ { 277, 17, 14, 0, -14, 268 }, /* 0x25 */
-+ { 405, 14, 14, 0, -14, 216 }, /* 0x26 */
-+ { 523, 3, 14, 0, -14, 46 }, /* 0x27 */
-+ { 535, 7, 17, -1, -15, 93 }, /* 0x28 */
-+ { 604, 6, 17, 0, -15, 93 }, /* 0x29 */
-+ { 674, 8, 15, 0, -15, 127 }, /* 0x2a */
-+ { 716, 10, 10, 0, -10, 158 }, /* 0x2b */
-+ { 744, 5, 5, 0, -3, 84 }, /* 0x2c */
-+ { 763, 8, 7, 0, -7, 128 }, /* 0x2d */
-+ { 770, 6, 3, 0, -2, 88 }, /* 0x2e */
-+ { 781, 9, 14, 0, -14, 136 }, /* 0x2f */
-+ { 835, 11, 14, 0, -14, 181 }, /* 0x30 */
-+ { 948, 7, 14, 0, -14, 113 }, /* 0x31 */
-+ { 1009, 11, 14, 0, -14, 174 }, /* 0x32 */
-+ { 1090, 10, 14, 0, -14, 168 }, /* 0x33 */
-+ { 1173, 11, 14, 0, -14, 182 }, /* 0x34 */
-+ { 1242, 10, 14, 0, -14, 167 }, /* 0x35 */
-+ { 1333, 10, 14, 0, -14, 167 }, /* 0x36 */
-+ { 1444, 10, 14, 0, -14, 154 }, /* 0x37 */
-+ { 1507, 11, 14, 0, -14, 169 }, /* 0x38 */
-+ { 1618, 11, 14, 0, -14, 168 }, /* 0x39 */
-+ { 1724, 7, 10, 0, -9, 111 }, /* 0x3a */
-+ { 1745, 6, 11, 0, -9, 100 }, /* 0x3b */
-+ { 1777, 10, 11, 0, -11, 158 }, /* 0x3c */
-+ { 1834, 10, 9, 0, -9, 158 }, /* 0x3d */
-+ { 1848, 10, 11, 0, -11, 158 }, /* 0x3e */
-+ { 1903, 10, 14, 0, -14, 154 }, /* 0x3f */
-+ { 1980, 16, 14, 0, -12, 263 }, /* 0x40 */
-+ { 2143, 13, 14, 0, -14, 202 }, /* 0x41 */
-+ { 2239, 12, 14, 0, -14, 200 }, /* 0x42 */
-+ { 2344, 12, 14, 0, -14, 194 }, /* 0x43 */
-+ { 2442, 12, 14, 0, -14, 198 }, /* 0x44 */
-+ { 2551, 12, 14, 0, -14, 191 }, /* 0x45 */
-+ { 2614, 11, 14, 0, -14, 181 }, /* 0x46 */
-+ { 2675, 12, 14, 0, -14, 196 }, /* 0x47 */
-+ { 2780, 13, 14, 0, -14, 206 }, /* 0x48 */
-+ { 2890, 5, 14, 0, -14, 83 }, /* 0x49 */
-+ { 2947, 12, 14, 0, -14, 185 }, /* 0x4a */
-+ { 3019, 12, 14, 0, -14, 197 }, /* 0x4b */
-+ { 3134, 11, 14, 0, -14, 182 }, /* 0x4c */
-+ { 3192, 14, 14, 0, -14, 229 }, /* 0x4d */
-+ { 3327, 13, 14, 0, -14, 215 }, /* 0x4e */
-+ { 3463, 12, 14, 0, -14, 199 }, /* 0x4f */
-+ { 3579, 12, 14, 0, -14, 190 }, /* 0x50 */
-+ { 3664, 12, 16, 0, -14, 186 }, /* 0x51 */
-+ { 3772, 12, 14, 0, -14, 196 }, /* 0x52 */
-+ { 3879, 12, 14, 0, -14, 188 }, /* 0x53 */
-+ { 3984, 11, 14, 0, -14, 184 }, /* 0x54 */
-+ { 4044, 13, 14, 0, -14, 205 }, /* 0x55 */
-+ { 4159, 12, 14, 0, -14, 192 }, /* 0x56 */
-+ { 4254, 18, 14, 0, -14, 281 }, /* 0x57 */
-+ { 4415, 12, 14, 0, -14, 193 }, /* 0x58 */
-+ { 4517, 12, 14, 0, -14, 187 }, /* 0x59 */
-+ { 4597, 11, 14, 0, -14, 176 }, /* 0x5a */
-+ { 4659, 8, 18, 0, -16, 126 }, /* 0x5b */
-+ { 4733, 9, 14, 0, -14, 136 }, /* 0x5c */
-+ { 4790, 8, 18, 0, -16, 126 }, /* 0x5d */
-+ { 4864, 9, 14, 0, -14, 147 }, /* 0x5e */
-+ { 4914, 10, 2, 0, -2, 159 }, /* 0x5f */
-+ { 4920, 4, 14, 0, -14, 67 }, /* 0x60 */
-+ { 4931, 10, 10, 0, -10, 165 }, /* 0x61 */
-+ { 5005, 11, 14, 0, -14, 177 }, /* 0x62 */
-+ { 5107, 11, 10, 0, -10, 168 }, /* 0x63 */
-+ { 5184, 11, 14, 0, -14, 177 }, /* 0x64 */
-+ { 5286, 11, 10, 0, -10, 172 }, /* 0x65 */
-+ { 5358, 7, 14, 0, -14, 117 }, /* 0x66 */
-+ { 5421, 11, 14, 0, -10, 174 }, /* 0x67 */
-+ { 5524, 11, 14, 0, -14, 173 }, /* 0x68 */
-+ { 5623, 5, 14, 0, -14, 82 }, /* 0x69 */
-+ { 5674, 6, 18, -1, -14, 79 }, /* 0x6a */
-+ { 5743, 10, 14, 0, -14, 164 }, /* 0x6b */
-+ { 5836, 5, 14, 0, -14, 75 }, /* 0x6c */
-+ { 5893, 17, 10, 0, -10, 264 }, /* 0x6d */
-+ { 6019, 11, 10, 0, -10, 173 }, /* 0x6e */
-+ { 6102, 11, 10, 0, -10, 178 }, /* 0x6f */
-+ { 6185, 11, 14, 0, -10, 179 }, /* 0x70 */
-+ { 6284, 11, 14, 0, -10, 179 }, /* 0x71 */
-+ { 6386, 8, 10, 0, -10, 119 }, /* 0x72 */
-+ { 6433, 10, 10, 0, -10, 156 }, /* 0x73 */
-+ { 6504, 7, 13, 0, -13, 118 }, /* 0x74 */
-+ { 6554, 11, 10, 0, -10, 172 }, /* 0x75 */
-+ { 6636, 10, 10, 0, -10, 157 }, /* 0x76 */
-+ { 6700, 15, 10, 0, -10, 238 }, /* 0x77 */
-+ { 6814, 10, 10, 0, -10, 160 }, /* 0x78 */
-+ { 6883, 10, 14, 0, -10, 152 }, /* 0x79 */
-+ { 6967, 9, 10, 0, -10, 144 }, /* 0x7a */
-+ { 7010, 7, 18, 0, -16, 105 }, /* 0x7b */
-+ { 7078, 4, 16, 0, -14, 57 }, /* 0x7c */
-+ { 7142, 7, 18, 0, -16, 105 }, /* 0x7d */
-+ { 7219, 10, 7, 0, -7, 164 }, /* 0x7e */
-+ { 7245, 4, 6, 0, -6, 70 }, /* 0x80 */
-+ { 7256, 8, 16, 0, -16, 121 }, /* 0x81 */
-+ { 7301, 9, 10, 0, -10, 138 }, /* 0x82 */
-+ { 7348, 9, 7, 0, -7, 147 }, /* 0x83 */
-+ { 7354, 14, 7, 0, -7, 216 }, /* 0x84 */
-+ { 7364, 4, 14, 0, -14, 52 }, /* 0x85 */
-+ { 7379, 16, 3, 0, -2, 261 }, /* 0x86 */
-+ { 7412, 6, 8, 0, -8, 100 }, /* 0x87 */
-+ { 7434, 7, 9, 0, -9, 113 }, /* 0x88 */
-+ { 7465, 8, 9, 0, -9, 123 }, /* 0x89 */
-+};
-+static const uint8_t md_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern md_kern[] = {
-+ {39,45,-16},{39,52,-4},{39,65,-23},{39,74,-13},{39,99,-16},{39,100,-16},{39,101,-16},{39,103,-12},
-+ {39,109,-5},{39,110,-5},{39,111,-16},{39,112,-5},{39,113,-12},{39,114,-5},{39,115,-8},{44,45,-5},
-+ {44,48,-10},{44,84,-14},{44,86,-7},{44,87,-7},{44,89,-14},{44,99,-5},{44,100,-5},{44,101,-5},
-+ {44,102,-4},{44,103,-5},{44,111,-5},{44,113,-5},{44,116,-4},{44,117,-4},{44,118,-13},{44,119,-13},
-+ {44,121,-13},{45,39,-6},{45,44,-4},{45,45,-40},{45,46,-4},{45,55,-16},{45,84,-14},{45,118,-7},
-+ {45,119,-7},{45,120,-5},{45,121,-7},{45,133,-8},{46,45,-5},{46,48,-10},{46,84,-14},{46,86,-7},
-+ {46,87,-7},{46,89,-14},{46,99,-5},{46,100,-5},{46,101,-5},{46,102,-4},{46,103,-5},{46,111,-5},
-+ {46,113,-5},{46,116,-4},{46,117,-4},{46,118,-13},{46,119,-13},{46,121,-13},{48,49,-7},{50,49,-4},
-+ {52,39,-7},{52,49,-30},{52,55,-14},{53,49,-7},{54,49,-4},{55,44,-17},{55,46,-17},{56,49,-7},
-+ {57,49,-6},{65,39,-26},{65,45,-4},{65,67,-5},{65,71,-5},{65,74,4},{65,79,-5},{65,81,-5},
-+ {65,83,-12},{65,84,-23},{65,86,-12},{65,87,-12},{65,89,-25},{65,90,5},{65,99,-4},{65,100,-4},
-+ {65,101,-4},{65,102,-6},{65,103,-7},{65,111,-4},{65,113,-7},{65,116,-6},{65,118,-12},{65,119,-12},
-+ {65,121,-12},{65,133,-20},{66,44,-4},{66,46,-4},{66,65,-9},{66,84,-4},{66,86,-7},{66,87,-7},
-+ {66,88,-6},{66,89,-8},{66,102,-4},{66,103,-5},{66,113,-5},{66,115,-5},{66,116,-4},{66,117,-4},
-+ {67,74,5},{67,89,-5},{68,44,-4},{68,46,-4},{68,65,-9},{68,84,-4},{68,86,-7},{68,87,-7},
-+ {68,88,-6},{68,89,-8},{68,102,-4},{68,103,-5},{68,113,-5},{68,115,-5},{68,116,-4},{68,117,-4},
-+ {69,86,4},{69,87,4},{70,44,-25},{70,45,-15},{70,46,-25},{70,65,-19},{70,74,-15},{70,97,-12},
-+ {70,99,-15},{70,100,-15},{70,101,-15},{70,103,-9},{70,109,-6},{70,110,-6},{70,111,-15},{70,112,-6},
-+ {70,113,-9},{70,114,-6},{70,115,-12},{70,117,-7},{70,118,-13},{70,119,-13},{70,120,-11},{70,121,-13},
-+ {70,122,-6},{71,74,5},{71,89,-5},{74,44,-4},{74,46,-4},{74,65,-4},{74,67,-4},{74,71,-4},
-+ {74,79,-4},{74,81,-4},{75,45,-7},{75,65,7},{75,67,-6},{75,71,-6},{75,74,-4},{75,79,-6},
-+ {75,81,-6},{75,83,-4},{75,88,4},{75,99,-7},{75,100,-7},{75,101,-7},{75,103,-6},{75,111,-7},
-+ {75,113,-6},{75,118,-10},{75,119,-10},{75,121,-10},{76,39,-20},{76,65,11},{76,84,-28},{76,86,-11},
-+ {76,87,-11},{76,89,-10},{76,102,-4},{76,116,-4},{76,118,-6},{76,119,-6},{76,121,-6},{76,133,-12},
-+ {78,66,-4},{78,68,-4},{78,69,-4},{78,70,-4},{78,78,-4},{78,80,-4},{79,74,5},{79,89,-5},
-+ {80,44,-9},{80,45,-7},{80,46,-9},{80,65,-11},{80,74,-6},{80,86,-4},{80,87,-4},{80,88,-7},
-+ {80,89,-7},{80,99,-7},{80,100,-7},{80,101,-7},{80,103,-4},{80,111,-7},{80,113,-4},{80,115,-4},
-+ {81,65,-5},{81,74,5},{81,86,-7},{81,87,-7},{81,88,-7},{81,89,-14},{82,65,9},{82,86,-4},
-+ {82,87,-4},{82,88,4},{82,89,-6},{83,44,-4},{83,46,-4},{83,84,-5},{83,86,-4},{83,87,-4},
-+ {83,88,-9},{83,89,-5},{84,44,-14},{84,45,-24},{84,46,-14},{84,65,-19},{84,67,-13},{84,71,-13},
-+ {84,74,-10},{84,79,-13},{84,81,-13},{84,97,-7},{84,99,-24},{84,100,-24},{84,101,-24},{84,103,-19},
-+ {84,105,-4},{84,109,-17},{84,110,-17},{84,111,-24},{84,112,-17},{84,113,-19},{84,114,-17},{84,115,-17},
-+ {84,117,-14},{84,118,-13},{84,119,-13},{84,120,-16},{84,121,-13},{85,44,-4},{85,46,-4},{85,65,-4},
-+ {85,67,-4},{85,71,-4},{85,79,-4},{85,81,-4},{86,44,-19},{86,45,-17},{86,46,-19},{86,65,-31},
-+ {86,66,-4},{86,67,-8},{86,68,-4},{86,69,-4},{86,70,-4},{86,71,-8},{86,74,-10},{86,75,-7},
-+ {86,78,-4},{86,79,-8},{86,80,-4},{86,81,-8},{86,83,-4},{86,97,-17},{86,99,-17},{86,100,-17},
-+ {86,101,-17},{86,103,-15},{86,109,-4},{86,110,-4},{86,111,-17},{86,112,-4},{86,113,-15},{86,114,-4},
-+ {86,115,-10},{86,117,-4},{86,118,-4},{86,119,-4},{86,121,-4},{87,44,-19},{87,45,-17},{87,46,-19},
-+ {87,65,-31},{87,66,-4},{87,67,-8},{87,68,-4},{87,69,-4},{87,70,-4},{87,71,-8},{87,74,-10},
-+ {87,75,-7},{87,78,-4},{87,79,-8},{87,80,-4},{87,81,-8},{87,83,-4},{87,97,-17},{87,99,-17},
-+ {87,100,-17},{87,101,-17},{87,103,-15},{87,109,-4},{87,110,-4},{87,111,-17},{87,112,-4},{87,113,-15},
-+ {87,114,-4},{87,115,-10},{87,117,-4},{87,118,-4},{87,119,-4},{87,121,-4},{88,45,-8},{88,67,-6},
-+ {88,71,-6},{88,79,-6},{88,81,-6},{88,83,-8},{88,97,-4},{88,99,-8},{88,100,-8},{88,101,-8},
-+ {88,103,-8},{88,111,-8},{88,113,-8},{88,118,-7},{88,119,-7},{88,121,-7},{89,44,-28},{89,45,-22},
-+ {89,46,-28},{89,65,-31},{89,66,-4},{89,67,-9},{89,68,-4},{89,69,-4},{89,70,-4},{89,71,-9},
-+ {89,74,-13},{89,78,-4},{89,79,-9},{89,80,-4},{89,81,-9},{89,83,-6},{89,97,-17},{89,99,-22},
-+ {89,100,-22},{89,101,-22},{89,102,-11},{89,103,-25},{89,109,-16},{89,110,-16},{89,111,-22},{89,112,-16},
-+ {89,113,-25},{89,114,-16},{89,115,-11},{89,116,-11},{89,117,-11},{89,118,-11},{89,119,-11},{89,120,-11},
-+ {89,121,-11},{89,122,-6},{97,39,-8},{97,84,-7},{97,89,-9},{97,133,-4},{98,39,-11},{98,44,-5},
-+ {98,46,-5},{98,118,-4},{98,119,-4},{98,121,-4},{99,39,-6},{99,44,-8},{99,46,-8},{99,120,-4},
-+ {99,133,-4},{101,39,-9},{101,44,-6},{101,46,-6},{101,118,-6},{101,119,-6},{101,120,-6},{101,121,-6},
-+ {101,133,-6},{102,39,4},{102,44,-16},{102,45,-13},{102,46,-16},{102,97,-4},{102,99,-13},{102,100,-13},
-+ {102,101,-13},{102,103,-11},{102,111,-13},{102,113,-11},{102,115,-5},{102,133,5},{103,39,-4},{104,39,-11},
-+ {104,44,-5},{104,46,-5},{104,118,-4},{104,119,-4},{104,121,-4},{107,45,-9},{107,97,-4},{107,99,-9},
-+ {107,100,-9},{107,101,-9},{107,103,-7},{107,111,-9},{107,113,-7},{109,39,-11},{109,44,-5},{109,46,-5},
-+ {109,118,-4},{109,119,-4},{109,121,-4},{110,39,-11},{110,44,-5},{110,46,-5},{110,118,-4},{110,119,-4},
-+ {110,121,-4},{111,39,-6},{111,44,-4},{111,46,-4},{111,55,-16},{111,84,-14},{111,118,-7},{111,119,-7},
-+ {111,120,-5},{111,121,-7},{111,133,-8},{112,39,-11},{112,44,-5},{112,46,-5},{112,118,-4},{112,119,-4},
-+ {112,121,-4},{113,39,-4},{114,39,9},{114,44,-12},{114,46,-12},{114,102,4},{114,103,-5},{114,113,-5},
-+ {114,116,4},{114,118,7},{114,119,7},{114,121,7},{114,133,16},{115,39,-7},{115,115,-4},{115,118,-10},
-+ {115,119,-10},{115,121,-10},{115,133,-6},{116,45,-4},{116,99,-4},{116,100,-4},{116,101,-4},{116,111,-4},
-+ {118,44,-13},{118,45,-7},{118,46,-13},{118,97,-5},{118,99,-7},{118,100,-7},{118,101,-7},{118,103,-8},
-+ {118,111,-7},{118,113,-8},{118,115,-10},{118,133,16},{119,44,-13},{119,45,-7},{119,46,-13},{119,97,-5},
-+ {119,99,-7},{119,100,-7},{119,101,-7},{119,103,-8},{119,111,-7},{119,113,-8},{119,115,-10},{119,133,16},
-+ {120,45,-8},{120,99,-8},{120,100,-8},{120,101,-8},{120,103,-5},{120,111,-8},{120,113,-5},{121,44,-13},
-+ {121,45,-7},{121,46,-13},{121,97,-5},{121,99,-7},{121,100,-7},{121,101,-7},{121,103,-8},{121,111,-7},
-+ {121,113,-8},{121,115,-10},{121,133,16},{133,45,-25},{133,65,-20},{133,97,-7},{133,99,-25},{133,100,-25},
-+ {133,101,-25},{133,103,-21},{133,111,-25},{133,113,-21},{133,115,-20},{133,118,-4},{133,119,-4},{133,121,-4},
-+};
-+const struct fos_font fos_font_md_data = { md_bits, md_glyphs, md_lut, md_kern, 544, 20, 4 };
-+
-+static const uint8_t mdb_bits[] = {
-+ 129,11,15,8,131,11,15,8,131,11,15,7,131,11,15,7,131,10,15,7,131,10,15,6,
-+ 131,10,15,6,131,9,15,6,131,9,15,5,131,8,15,5,145,10,14,4,130,1,31,10,
-+ 131,11,14,4,129,8,15,9,1,31,1,8,15,9,128,31,1,7,15,8,128,31,128,7,
-+ 15,7,128,14,15,128,6,15,6,128,13,14,198,131,14,15,5,128,1,31,4,132,2,31,
-+ 3,128,3,31,2,132,4,31,1,128,5,31,131,2,127,31,6,129,2,127,31,6,130,2,
-+ 12,15,10,18,13,15,9,2,132,13,15,8,129,14,15,6,133,14,15,6,129,31,5,131,
-+ 1,2,31,6,2,3,31,5,1,130,13,127,15,10,130,13,127,15,10,131,7,15,13,129,
-+ 8,15,12,133,10,15,10,129,11,15,9,133,12,15,8,129,13,15,6,131,131,6,15,9,
-+ 135,6,15,9,133,3,11,47,11,4,130,3,14,95,5,129,10,15,12,3,1,3,12,15,
-+ 14,1,128,13,15,4,130,1,31,4,128,13,15,5,131,11,13,4,128,9,15,14,5,134,
-+ 1,13,31,12,6,133,1,9,47,13,6,133,2,8,14,31,8,134,1,9,31,18,30,132,
-+ 13,15,6,1,31,3,131,13,15,6,128,13,15,13,4,17,7,31,3,128,4,111,10,130,
-+ 4,12,47,14,8,133,6,15,11,135,5,15,10,131,129,3,12,15,12,4,131,13,11,132,
-+ 2,14,10,3,9,15,2,129,6,15,4,132,7,14,130,14,8,128,1,14,11,133,7,14,
-+ 130,14,8,128,7,15,3,133,3,15,7,1,7,15,3,1,14,11,135,6,14,15,14,6,
-+ 128,8,15,3,137,2,1,128,1,14,10,141,8,15,2,140,1,14,9,141,9,15,2,128,
-+ 6,13,14,10,2,134,2,15,9,128,6,15,6,4,28,134,9,15,2,128,12,10,129,3,
-+ 15,3,132,2,15,8,129,12,10,129,3,15,3,132,10,14,1,129,6,15,6,3,12,13,
-+ 132,2,15,8,131,7,13,14,11,2,129,130,6,12,15,14,10,2,134,7,79,14,1,133,
-+ 14,15,11,2,4,14,15,8,132,1,31,4,129,10,15,10,133,14,15,8,128,1,13,15,
-+ 8,133,7,31,5,12,31,2,134,11,63,5,134,1,11,47,4,134,1,13,31,14,15,10,
-+ 129,2,1,130,10,15,14,20,31,8,1,13,14,4,129,31,6,129,6,31,13,15,13,1,
-+ 128,2,31,4,130,9,47,3,130,14,15,11,19,7,14,31,14,1,130,8,95,14,13,15,
-+ 11,131,5,11,14,15,12,8,1,3,14,15,7,128,8,15,11,8,15,10,7,15,9,7,
-+ 15,9,5,15,8,157,130,11,15,8,130,5,31,2,130,12,15,10,130,3,31,5,130,7,
-+ 31,1,130,10,15,14,131,13,15,11,131,14,15,10,131,31,9,131,31,9,131,14,15,10,
-+ 131,13,15,11,131,11,15,13,131,7,31,1,130,3,31,5,131,12,15,10,131,6,31,2,
-+ 131,12,15,8,128,128,3,31,2,131,11,15,11,131,5,31,2,130,1,31,8,131,12,15,
-+ 12,131,9,31,1,130,6,31,3,130,5,31,4,130,4,31,5,130,4,31,5,130,5,31,
-+ 4,130,6,31,3,130,9,31,131,12,15,12,130,1,31,7,130,6,31,2,130,12,15,10,
-+ 130,3,15,14,2,129,130,26,130,1,5,128,11,10,128,5,128,5,15,60,15,5,128,5,
-+ 13,31,13,4,129,5,13,31,13,4,128,5,15,12,13,28,15,4,1,5,128,11,10,128,
-+ 6,131,26,194,130,1,15,13,134,1,15,14,134,1,15,14,132,18,3,15,14,34,128,5,
-+ 127,2,5,127,2,130,1,15,14,134,1,15,14,134,1,15,13,151,128,4,15,11,129,7,
-+ 15,7,129,10,15,3,129,12,14,130,14,10,129,128,82,128,5,95,6,5,95,6,167,128,
-+ 5,14,10,129,11,31,129,5,14,9,128,132,10,15,9,132,1,14,15,5,132,5,15,14,
-+ 133,10,15,9,132,1,14,15,4,132,5,15,14,133,10,15,9,132,1,31,4,132,5,15,
-+ 14,133,11,15,9,132,1,31,4,132,6,15,14,133,11,15,9,132,1,31,4,132,5,15,
-+ 13,133,129,1,8,13,15,14,10,3,130,1,13,95,4,129,8,31,7,2,4,13,15,13,
-+ 129,12,15,9,130,4,31,2,128,13,15,7,130,1,31,4,128,14,15,6,130,1,31,4,
-+ 128,14,15,6,130,1,31,4,128,14,15,6,130,1,31,4,128,14,15,6,130,1,31,4,
-+ 128,14,15,6,130,1,31,4,128,13,15,7,130,1,31,4,128,12,15,9,130,4,31,2,
-+ 128,7,31,7,2,4,13,15,13,129,1,12,95,4,130,1,8,13,15,14,10,3,129,128,
-+ 1,8,31,10,128,1,14,47,10,128,1,15,29,15,10,129,2,128,10,15,10,131,10,15,
-+ 10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,
-+ 10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,128,129,2,10,14,15,13,
-+ 8,1,130,3,14,79,12,130,12,15,14,5,2,7,31,6,129,31,6,130,11,15,10,128,
-+ 1,30,4,130,10,15,11,134,1,14,15,7,134,10,15,14,1,133,6,31,7,133,3,31,
-+ 11,133,2,14,15,13,1,132,1,12,15,14,3,133,10,31,4,133,8,31,8,66,129,127,
-+ 15,1,128,127,15,1,128,127,7,129,127,7,129,1,34,3,14,31,4,132,1,12,31,5,
-+ 132,1,12,31,6,133,11,31,12,2,133,11,63,5,132,1,5,2,9,15,14,1,135,14,
-+ 15,6,135,12,15,8,128,2,14,13,2,130,12,15,8,128,1,31,5,129,1,14,15,7,
-+ 129,11,15,13,4,2,10,31,2,129,2,14,79,7,131,2,10,30,12,5,130,131,8,15,
-+ 14,135,1,14,15,8,135,6,31,1,135,12,15,10,135,4,31,3,135,10,15,12,135,2,
-+ 31,6,129,12,15,7,130,8,15,14,130,12,15,8,130,14,15,10,35,13,15,9,2,128,
-+ 3,127,15,10,128,3,127,15,10,135,12,15,8,136,12,15,8,136,12,15,8,136,12,15,
-+ 7,129,128,14,111,4,129,14,111,4,129,14,15,7,66,130,14,15,5,135,14,15,5,135,
-+ 14,15,9,12,14,13,8,1,130,14,95,12,130,14,15,14,5,2,7,31,6,129,9,10,
-+ 5,130,12,15,9,135,9,15,11,129,21,2,130,9,15,11,129,13,15,9,130,13,15,9,
-+ 129,8,31,6,2,8,31,4,129,1,12,79,10,131,1,8,13,14,13,7,130,129,3,10,
-+ 14,15,13,7,131,3,95,10,130,11,15,14,5,3,10,31,3,129,14,15,7,130,14,15,
-+ 7,129,31,5,130,8,9,4,129,31,5,128,1,133,31,9,13,31,11,2,130,111,14,1,
-+ 129,31,14,4,1,6,31,7,129,31,7,130,10,15,11,129,14,15,5,130,8,15,12,129,
-+ 13,15,8,130,11,15,10,129,8,15,14,5,2,7,31,6,129,1,13,79,12,131,1,9,
-+ 13,15,13,8,1,129,7,127,6,7,127,6,7,15,8,34,4,31,4,3,7,3,130,8,
-+ 15,14,134,13,15,9,133,4,31,3,133,9,15,13,134,14,15,8,133,5,31,2,133,10,
-+ 15,12,133,1,14,15,7,133,5,31,2,133,11,15,11,133,1,31,6,133,6,15,14,1,
-+ 131,129,2,9,14,15,13,7,131,2,14,79,10,130,9,15,14,5,2,8,31,3,129,13,
-+ 15,8,130,13,15,7,129,13,15,7,130,12,15,7,129,9,15,14,5,2,8,31,3,129,
-+ 1,13,79,7,130,2,13,79,9,130,10,15,13,3,1,6,31,5,129,31,6,130,11,15,
-+ 9,128,1,31,4,130,9,15,11,129,31,7,130,12,15,9,129,11,15,14,5,3,8,31,
-+ 5,129,2,14,79,11,131,2,10,14,15,13,7,130,129,3,11,30,12,5,131,4,95,7,
-+ 130,13,15,12,3,2,9,31,2,128,2,31,4,130,14,15,6,128,4,31,1,130,12,15,
-+ 8,128,3,31,3,130,14,15,8,129,14,15,12,2,1,9,31,8,129,7,111,8,130,7,
-+ 14,31,9,13,15,8,132,1,129,12,15,8,129,8,9,3,130,12,15,8,129,13,15,8,
-+ 130,14,15,8,129,10,15,14,5,2,9,31,4,129,3,14,79,11,131,2,10,14,15,13,
-+ 7,130,129,7,14,8,131,13,15,13,131,7,14,7,152,7,14,8,131,13,15,13,131,7,
-+ 14,7,136,128,1,12,14,5,129,6,31,11,129,1,12,14,5,154,12,15,3,130,14,15,
-+ 130,1,15,12,130,3,15,8,130,4,15,5,129,135,1,134,2,8,14,2,131,3,10,47,
-+ 2,129,5,11,47,10,3,128,3,13,31,13,7,1,130,5,31,9,133,3,14,31,12,6,
-+ 1,131,1,6,13,31,14,8,2,132,5,11,47,2,133,3,10,15,2,135,2,1,5,127,
-+ 2,5,127,2,147,5,127,2,5,127,2,157,1,136,5,14,7,1,133,5,31,14,9,2,
-+ 132,5,11,47,10,3,132,2,9,14,31,11,1,132,1,11,31,2,130,1,7,13,31,13,
-+ 1,128,3,10,47,11,5,129,5,47,10,3,131,5,14,9,2,133,17,135,129,4,11,14,
-+ 15,12,5,130,6,95,7,128,1,14,15,11,19,11,31,1,4,31,1,129,2,31,4,3,
-+ 10,9,130,2,31,4,133,11,15,14,1,131,1,11,31,6,131,1,12,31,6,132,6,31,
-+ 4,133,8,15,12,134,3,7,5,144,6,14,8,134,12,15,14,134,6,14,8,131,132,2,
-+ 7,12,30,13,8,2,134,7,111,14,5,132,9,31,9,5,18,5,10,31,3,130,6,15,
-+ 13,3,133,6,15,12,129,1,30,2,135,11,15,2,128,7,15,6,129,8,30,10,15,4,
-+ 128,6,15,5,128,11,14,129,8,15,6,4,14,15,2,128,4,15,6,128,14,11,129,14,
-+ 9,129,10,15,129,4,15,6,1,15,9,128,2,15,5,129,12,13,129,7,15,3,128,15,
-+ 9,128,4,15,6,128,2,15,13,129,12,14,129,14,12,128,1,15,14,10,13,31,10,12,
-+ 15,6,129,10,15,2,128,5,13,14,11,3,10,14,13,7,130,5,15,12,1,140,11,15,
-+ 13,7,3,2,4,6,11,2,133,1,12,95,14,4,135,6,12,14,15,13,8,2,132,131,
-+ 2,47,1,135,6,47,6,135,11,47,10,134,1,31,11,15,14,134,5,31,2,31,4,133,
-+ 9,15,11,128,12,15,9,133,14,15,6,128,7,15,13,132,3,31,2,128,3,31,3,131,
-+ 8,15,12,130,13,15,7,131,12,15,7,130,8,15,12,130,2,31,78,31,1,129,6,127,
-+ 15,6,129,11,15,10,132,10,15,10,128,1,31,6,132,7,15,14,128,4,31,2,132,3,
-+ 31,4,128,8,79,14,11,4,130,8,127,5,129,8,15,12,34,4,13,15,13,129,8,15,
-+ 12,131,4,31,1,128,8,15,12,131,3,31,1,128,8,15,12,130,2,12,15,13,129,8,
-+ 111,14,3,129,8,111,9,130,8,15,12,34,4,13,15,9,129,8,15,12,131,3,31,2,
-+ 128,8,15,12,131,1,31,4,128,8,15,12,131,3,31,4,128,8,15,12,34,4,13,15,
-+ 14,1,128,8,127,6,129,8,79,14,11,4,129,130,5,11,30,12,7,1,131,9,95,13,
-+ 1,129,5,31,10,19,7,31,9,129,10,15,12,131,8,15,14,129,12,15,7,131,3,31,
-+ 1,128,13,15,7,136,13,15,7,136,13,15,7,136,13,15,7,136,13,15,7,136,12,15,
-+ 7,131,3,31,1,128,10,15,12,131,8,15,14,129,5,31,10,19,7,31,9,130,9,95,
-+ 12,1,131,5,11,30,12,7,1,129,128,8,79,14,10,3,130,8,127,4,129,8,15,12,
-+ 34,5,13,15,14,129,8,15,12,131,4,31,3,128,8,15,12,132,31,5,128,8,15,12,
-+ 132,31,5,128,8,15,12,132,31,5,128,8,15,12,132,31,5,128,8,15,12,132,31,5,
-+ 128,8,15,12,132,31,5,128,8,15,12,132,31,5,128,8,15,12,131,4,31,3,128,8,
-+ 15,12,34,5,13,15,14,129,8,127,4,129,8,79,14,10,3,129,128,8,127,14,129,8,
-+ 127,14,129,8,15,12,82,1,129,8,15,12,136,8,15,12,136,8,15,12,136,8,15,12,
-+ 50,1,131,8,95,10,131,8,95,10,131,8,15,12,136,8,15,12,136,8,15,12,136,8,
-+ 15,12,82,1,129,8,127,14,129,8,127,14,128,128,8,127,14,128,8,127,14,128,8,15,
-+ 12,82,1,128,8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,50,1,130,8,95,
-+ 10,130,8,95,10,130,8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,135,8,15,
-+ 12,135,8,15,11,134,130,5,11,30,12,7,132,9,95,12,1,129,4,31,10,19,7,31,
-+ 9,129,10,15,12,131,7,15,14,129,12,15,8,131,3,31,1,128,13,15,7,136,13,15,
-+ 7,129,1,50,129,13,15,7,129,79,2,128,13,15,7,129,79,2,128,13,15,7,131,3,
-+ 31,2,128,12,15,8,131,3,31,1,128,10,15,12,131,7,15,14,129,4,31,11,4,2,
-+ 6,14,15,8,130,9,95,12,1,131,5,11,14,15,13,8,1,129,128,8,15,11,132,14,
-+ 15,6,129,8,15,12,132,14,15,6,129,8,15,12,132,14,15,6,129,8,15,12,132,14,
-+ 15,6,129,8,15,12,132,14,15,6,129,8,15,12,132,14,15,6,129,8,15,12,66,14,
-+ 15,6,129,8,127,15,6,129,8,127,15,6,129,8,15,12,132,14,15,6,129,8,15,12,
-+ 132,14,15,6,129,8,15,12,132,14,15,6,129,8,15,12,132,14,15,6,129,8,15,12,
-+ 132,14,15,6,129,8,15,11,132,14,15,6,128,128,8,15,11,129,8,15,12,129,8,15,
-+ 12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,
-+ 12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,12,129,8,15,
-+ 11,128,134,2,31,2,135,2,31,2,135,2,31,2,135,2,31,2,135,2,31,2,135,2,
-+ 31,2,135,2,31,2,135,2,31,2,128,3,5,4,131,2,31,2,128,8,15,12,131,2,
-+ 31,2,128,8,15,12,131,3,31,2,128,6,15,14,1,130,7,31,129,1,31,12,4,2,
-+ 6,14,15,10,130,6,95,13,1,131,4,11,14,15,13,8,1,130,128,8,15,11,131,3,
-+ 14,15,7,128,8,15,12,130,1,13,15,11,129,8,15,12,130,11,15,14,1,129,8,15,
-+ 12,129,8,31,4,130,8,15,12,128,4,31,7,131,8,15,12,2,14,15,11,132,8,15,
-+ 28,31,2,132,8,79,9,132,8,47,10,31,3,131,8,31,5,128,13,15,12,131,8,15,
-+ 12,129,4,31,6,130,8,15,12,130,10,15,14,1,129,8,15,12,130,1,14,15,9,129,
-+ 8,15,12,131,6,31,3,128,8,15,11,132,12,15,12,128,8,15,11,135,8,15,12,135,
-+ 8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,135,
-+ 8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,135,8,15,12,82,1,128,8,127,
-+ 12,128,8,127,12,128,8,15,14,1,132,11,15,12,129,8,31,9,131,5,31,13,129,8,
-+ 47,4,129,1,13,31,13,129,8,47,12,129,8,47,13,129,8,15,14,31,7,3,31,13,
-+ 15,13,129,8,15,12,8,15,14,12,15,12,7,15,13,129,8,15,12,128,13,47,3,7,
-+ 15,13,129,8,15,12,128,4,31,9,128,7,15,13,129,8,15,12,129,8,11,1,128,7,
-+ 15,13,129,8,15,12,133,7,15,13,129,8,15,12,133,7,15,13,129,8,15,12,133,7,
-+ 15,13,129,8,15,12,133,7,15,13,129,8,15,12,133,7,15,13,129,8,15,11,133,7,
-+ 15,12,128,128,8,15,13,1,131,6,15,14,129,8,31,8,131,6,15,14,129,8,31,14,
-+ 2,130,6,15,14,129,8,47,10,130,6,15,14,129,8,63,3,129,6,15,14,129,8,15,
-+ 27,15,11,129,6,15,14,129,8,15,11,3,31,5,128,6,15,14,129,8,15,11,128,9,
-+ 15,13,128,6,15,14,129,8,15,11,128,1,14,15,7,6,15,14,129,8,15,11,129,7,
-+ 15,14,7,15,14,129,8,15,11,130,13,15,14,15,14,129,8,15,11,130,4,47,14,129,
-+ 8,15,12,131,11,31,14,129,8,15,12,131,2,31,14,129,8,15,11,132,8,15,14,128,
-+ 130,4,11,30,13,7,1,131,7,95,12,1,129,3,31,11,4,3,7,31,10,129,9,15,
-+ 12,131,7,31,1,128,12,15,8,131,2,31,3,128,13,15,7,132,31,4,128,13,15,7,
-+ 132,31,4,128,13,15,7,132,31,4,128,13,15,7,132,31,4,128,13,15,7,132,31,4,
-+ 128,12,15,8,131,2,31,3,128,10,15,12,131,6,31,1,128,4,31,11,4,3,7,14,
-+ 15,10,130,8,95,13,1,131,4,11,30,13,7,1,129,128,10,79,14,11,4,130,10,127,
-+ 5,129,10,15,11,34,4,13,15,13,129,10,15,10,131,4,31,3,128,10,15,10,131,1,
-+ 31,4,128,10,15,10,131,3,31,3,128,10,15,11,34,4,13,15,13,129,10,127,5,129,
-+ 10,79,14,11,4,130,10,15,10,136,10,15,10,136,10,15,10,136,10,15,10,136,10,15,
-+ 10,136,10,15,10,135,130,6,12,30,11,4,132,11,95,7,130,7,31,8,19,11,31,3,
-+ 129,12,15,10,131,13,15,8,129,31,5,131,9,15,11,128,1,31,4,131,8,15,12,128,
-+ 1,31,4,131,8,15,12,128,1,31,4,131,8,15,12,128,1,31,4,131,8,15,12,128,
-+ 1,31,4,131,8,15,12,129,31,5,131,9,15,11,129,13,15,9,131,12,15,9,129,7,
-+ 31,6,1,2,9,31,3,129,1,11,95,8,132,7,13,31,12,5,134,4,31,1,135,4,
-+ 31,1,131,128,8,79,14,12,4,130,8,127,5,129,8,15,12,34,4,12,15,13,129,8,
-+ 15,12,131,3,31,3,128,8,15,12,132,31,5,128,8,15,12,131,3,31,3,128,8,15,
-+ 12,34,4,12,15,14,1,128,8,127,6,129,8,95,13,5,130,8,15,12,129,6,15,13,
-+ 131,8,15,12,130,14,15,5,130,8,15,12,130,7,15,13,130,8,15,12,130,1,14,15,
-+ 5,129,8,15,12,131,8,15,12,129,8,15,11,131,2,31,4,129,1,9,13,15,14,11,
-+ 6,131,2,14,95,10,130,10,15,14,5,2,3,10,31,6,129,13,15,7,131,11,15,11,
-+ 129,13,15,7,131,6,14,11,129,9,15,14,6,135,1,13,31,13,8,2,133,1,8,14,
-+ 47,9,1,133,1,6,12,31,13,2,135,5,14,15,10,128,2,31,1,131,7,15,13,128,
-+ 1,31,5,131,8,15,13,129,12,15,14,7,3,2,6,14,15,9,129,2,14,95,13,1,
-+ 130,1,8,13,14,15,13,8,1,129,4,127,15,13,128,5,127,15,14,129,34,8,15,13,
-+ 34,1,132,7,15,13,136,7,15,13,136,7,15,13,136,7,15,13,136,7,15,13,136,7,
-+ 15,13,136,7,15,13,136,7,15,13,136,7,15,13,136,7,15,13,136,7,15,13,136,6,
-+ 15,13,132,128,10,15,10,132,14,15,5,129,10,15,10,132,14,15,6,129,10,15,10,132,
-+ 14,15,6,129,10,15,10,132,14,15,6,129,10,15,10,132,14,15,6,129,10,15,10,132,
-+ 14,15,6,129,10,15,10,132,14,15,6,129,10,15,10,132,14,15,6,129,10,15,10,132,
-+ 14,15,6,129,10,15,10,132,14,15,6,129,9,15,11,132,31,5,129,7,15,14,1,130,
-+ 5,31,2,129,1,14,15,12,4,2,6,14,15,12,131,5,95,14,2,132,3,10,14,15,
-+ 13,9,2,130,4,31,2,132,13,15,8,1,31,6,131,2,31,4,128,11,15,10,131,6,
-+ 15,14,129,7,15,14,131,10,15,10,129,2,31,3,130,14,15,5,130,13,15,7,129,3,
-+ 31,1,130,9,15,11,129,7,15,12,131,4,31,1,128,11,15,7,131,1,31,4,1,31,
-+ 3,132,11,15,8,4,15,13,133,6,15,12,8,15,9,133,2,31,13,15,5,134,13,47,
-+ 1,134,8,31,11,135,4,31,6,131,6,15,14,1,130,7,31,1,130,5,15,14,128,3,
-+ 31,4,130,11,31,4,130,9,15,11,129,14,15,7,130,14,31,8,130,13,15,8,129,10,
-+ 15,11,129,3,47,12,129,1,31,4,129,6,15,14,129,6,63,129,4,31,1,129,3,31,
-+ 3,128,9,15,12,31,4,128,8,15,12,131,14,15,6,128,13,15,6,13,15,7,128,11,
-+ 15,8,131,10,15,10,1,31,3,10,15,11,128,14,15,5,131,6,15,13,5,15,14,128,
-+ 6,15,14,3,31,1,131,3,31,10,15,11,128,2,31,9,15,13,133,14,47,7,129,14,
-+ 47,9,133,10,47,3,129,10,47,5,133,6,47,130,6,47,2,133,3,31,11,130,2,31,
-+ 13,135,13,15,8,131,13,15,9,131,2,31,6,131,1,14,15,7,128,9,15,14,1,130,
-+ 10,15,13,1,128,2,14,15,8,129,3,31,6,130,8,31,2,128,12,15,12,131,1,14,
-+ 15,11,6,31,4,132,6,63,11,134,13,47,3,134,6,31,11,135,12,47,2,133,5,63,
-+ 10,133,13,15,11,6,31,3,131,7,31,2,128,12,15,12,130,1,14,15,8,129,4,31,
-+ 5,129,9,15,14,1,130,10,15,13,128,2,31,5,131,1,14,15,7,3,31,4,131,4,
-+ 31,3,128,11,15,11,131,11,15,11,129,4,31,3,129,3,31,4,130,12,15,10,129,10,
-+ 15,12,131,5,31,18,31,5,132,13,15,8,9,15,12,133,5,15,14,31,5,134,13,31,
-+ 13,135,6,31,6,135,3,31,2,135,3,31,2,135,3,31,2,135,3,31,2,135,3,31,
-+ 2,135,3,31,2,131,4,127,15,3,4,127,15,3,128,82,10,15,14,1,133,4,31,6,
-+ 133,1,13,15,11,134,8,15,14,2,133,3,31,7,134,12,15,12,134,7,31,3,133,2,
-+ 31,7,134,12,15,12,134,6,31,3,133,1,14,15,10,82,128,4,127,15,3,4,127,15,
-+ 3,4,63,8,129,5,63,8,129,5,31,18,1,129,5,31,132,5,31,132,5,31,132,5,
-+ 31,132,5,31,132,5,31,132,5,31,132,5,31,132,5,31,132,5,31,132,5,31,132,5,
-+ 31,132,5,31,132,5,31,132,5,31,18,1,129,5,63,9,129,4,63,8,129,128,10,15,
-+ 8,133,6,15,14,133,1,31,4,133,11,15,9,133,6,15,14,133,1,31,4,133,10,15,
-+ 9,133,5,15,14,133,1,31,4,133,10,15,9,133,5,15,14,133,1,14,15,4,133,10,
-+ 15,9,133,5,15,14,133,1,14,15,4,129,7,63,5,129,7,63,6,129,1,18,14,15,
-+ 6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,
-+ 6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,6,132,14,15,
-+ 6,132,14,15,6,132,14,15,6,129,1,18,14,15,6,129,7,63,6,129,7,63,5,130,
-+ 3,8,5,133,11,15,14,132,1,47,5,131,6,15,10,15,10,131,12,15,2,13,15,1,
-+ 129,2,15,12,128,8,15,6,129,7,15,7,128,3,15,11,129,13,15,2,129,13,15,2,
-+ 3,15,12,130,7,15,7,181,1,114,1,8,127,11,8,127,11,128,2,1,128,2,30,1,
-+ 128,4,15,9,175,129,4,11,30,12,6,130,6,95,9,129,14,15,12,3,2,8,31,2,
-+ 128,2,4,2,130,31,5,129,7,12,14,63,5,128,11,111,5,3,31,10,3,18,14,15,
-+ 21,31,1,129,1,31,5,3,31,7,2,4,12,31,5,128,12,111,5,128,2,10,14,15,
-+ 12,4,14,15,5,128,11,15,8,135,11,15,9,135,11,15,9,135,11,15,9,135,11,15,
-+ 25,30,10,2,130,11,95,14,2,129,11,31,9,3,6,31,10,129,11,15,14,130,9,15,
-+ 14,129,11,15,11,130,4,31,2,128,11,15,10,130,3,31,3,128,11,15,11,130,4,31,
-+ 2,128,11,15,14,130,8,15,14,129,11,31,10,3,6,31,9,129,11,95,14,2,129,11,
-+ 15,25,30,10,2,129,129,1,8,13,14,13,8,1,130,1,12,79,12,1,129,7,31,6,
-+ 2,6,14,15,9,129,13,15,9,130,8,15,11,129,31,5,135,31,5,135,31,5,135,12,
-+ 15,9,130,7,12,8,129,7,31,6,2,5,14,15,9,129,1,12,79,13,1,130,1,8,
-+ 13,15,13,8,1,129,134,6,15,13,135,6,15,14,135,6,15,14,135,6,15,14,130,1,
-+ 9,13,14,10,8,15,14,129,1,13,95,14,129,7,31,8,3,7,31,14,129,12,15,11,
-+ 130,11,15,14,129,14,15,7,130,8,15,14,129,31,6,130,7,15,14,129,14,15,7,130,
-+ 8,15,14,129,12,15,10,130,12,15,14,129,7,31,7,3,8,31,14,129,1,13,95,14,
-+ 130,1,9,30,10,7,15,13,128,129,1,8,13,15,13,9,1,130,1,12,79,13,1,129,
-+ 7,15,14,4,2,5,14,15,7,129,13,15,7,130,8,15,11,129,127,13,129,127,14,129,
-+ 14,15,6,66,1,129,11,15,9,130,1,4,130,6,31,7,2,3,11,15,5,130,11,95,
-+ 4,131,7,13,15,14,10,2,129,130,9,13,15,11,130,8,47,11,130,11,15,12,3,1,
-+ 130,13,15,8,130,6,79,12,128,6,79,12,129,2,13,15,8,2,1,130,13,15,7,132,
-+ 13,15,7,132,13,15,7,132,13,15,7,132,13,15,7,132,13,15,7,132,13,15,7,132,
-+ 12,15,7,130,129,2,10,30,10,9,15,12,129,2,14,95,12,129,9,31,6,2,7,31,
-+ 12,129,14,15,9,130,11,15,12,129,31,5,130,8,15,12,128,1,31,4,130,8,15,12,
-+ 129,31,5,130,8,15,12,129,14,15,8,130,11,15,12,129,10,31,6,2,7,31,12,129,
-+ 2,14,95,12,130,2,10,30,26,15,12,135,11,15,10,131,1,2,3,9,31,5,131,11,
-+ 63,11,132,11,15,14,11,6,130,128,11,15,8,135,12,15,8,135,12,15,8,135,12,15,
-+ 8,135,12,15,25,14,15,11,3,130,12,95,14,1,129,12,31,7,2,7,31,7,129,12,
-+ 15,11,130,12,15,10,129,12,15,9,130,9,15,11,129,12,15,8,130,9,15,11,129,12,
-+ 15,8,130,9,15,11,129,12,15,8,130,9,15,11,129,12,15,8,130,9,15,11,129,12,
-+ 15,8,130,9,15,11,129,11,15,8,130,9,15,10,128,128,7,14,8,129,12,15,14,129,
-+ 7,14,8,134,9,15,10,129,10,15,10,129,10,15,10,129,10,15,10,129,10,15,10,129,
-+ 10,15,10,129,10,15,10,129,10,15,10,129,10,15,10,129,10,15,10,129,9,15,10,128,
-+ 130,8,14,7,131,14,15,13,131,8,14,7,138,10,15,9,131,10,15,10,131,10,15,10,
-+ 131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,131,10,15,10,
-+ 131,10,15,10,131,10,15,10,131,11,15,9,129,2,6,31,7,129,47,14,2,129,15,14,
-+ 11,3,129,128,11,15,8,134,12,15,8,134,12,15,8,134,12,15,8,134,12,15,8,129,
-+ 6,31,5,128,12,15,8,128,4,31,9,129,12,15,8,2,14,15,12,130,12,15,9,13,
-+ 31,2,130,12,79,4,130,12,47,12,15,10,130,12,31,5,4,31,2,129,12,15,9,129,
-+ 13,15,8,129,12,15,8,129,6,15,14,1,128,12,15,8,129,1,14,15,6,128,11,15,
-+ 8,130,9,15,12,128,11,15,8,129,12,15,8,129,12,15,8,129,12,15,8,129,12,15,
-+ 8,129,12,15,8,129,12,15,8,129,12,15,8,129,12,15,8,129,12,15,8,129,12,15,
-+ 8,129,12,15,8,129,12,15,8,129,12,15,8,129,11,15,8,128,128,11,15,25,30,11,
-+ 3,1,9,30,11,2,130,12,95,14,11,63,13,130,12,31,6,2,9,47,6,2,9,31,
-+ 4,129,12,15,10,130,14,15,10,130,14,15,6,129,12,15,8,130,12,15,8,130,13,15,
-+ 7,129,12,15,8,130,12,15,8,130,13,15,7,129,12,15,8,130,12,15,8,130,13,15,
-+ 7,129,12,15,8,130,12,15,8,130,13,15,7,129,12,15,8,130,12,15,8,130,13,15,
-+ 7,129,12,15,8,130,12,15,8,130,13,15,7,129,11,15,8,130,12,15,7,130,12,15,
-+ 7,128,128,11,15,25,14,15,11,3,130,12,95,14,1,129,12,31,7,2,7,31,7,129,
-+ 12,15,11,130,12,15,10,129,12,15,9,130,9,15,11,129,12,15,8,130,9,15,11,129,
-+ 12,15,8,130,9,15,11,129,12,15,8,130,9,15,11,129,12,15,8,130,9,15,11,129,
-+ 12,15,8,130,9,15,11,129,11,15,8,130,9,15,10,128,129,1,7,13,14,13,8,1,
-+ 130,1,12,79,12,1,129,7,31,6,2,5,14,15,8,129,12,15,9,130,7,15,14,129,
-+ 31,5,130,4,31,17,31,4,130,3,31,2,128,31,5,130,4,31,1,128,12,15,9,130,
-+ 8,15,13,129,6,31,6,2,6,31,7,130,11,79,12,1,130,1,7,13,15,13,8,1,
-+ 129,128,10,15,10,8,30,11,3,130,10,95,14,3,129,10,31,10,3,5,14,15,11,129,
-+ 10,31,1,129,7,31,1,128,10,15,12,130,3,31,3,128,10,15,11,130,2,31,4,128,
-+ 10,15,12,130,3,31,3,128,10,31,1,129,7,31,1,128,10,31,10,3,5,14,15,11,
-+ 129,10,95,14,3,129,10,15,10,8,30,11,3,130,10,15,10,135,10,15,10,135,10,15,
-+ 10,135,10,15,10,134,129,1,9,30,10,7,15,13,129,1,13,95,14,129,7,31,6,2,
-+ 8,31,14,129,12,15,10,130,12,15,14,129,14,15,7,130,8,15,14,129,31,6,130,7,
-+ 15,14,129,14,15,7,130,8,15,14,129,12,15,11,130,11,15,14,129,7,31,7,3,7,
-+ 31,14,129,1,13,95,14,130,2,9,14,15,10,8,15,14,135,6,15,14,135,6,15,14,
-+ 135,6,15,14,135,6,15,13,128,128,11,15,25,14,13,2,128,12,79,1,128,12,31,7,
-+ 18,129,12,15,11,132,12,15,9,132,12,15,8,132,12,15,8,132,12,15,8,132,12,15,
-+ 8,132,12,15,8,132,11,15,8,131,129,6,12,30,11,5,130,8,95,6,129,31,9,2,
-+ 3,10,15,13,129,31,4,129,1,8,7,129,9,31,10,5,1,132,8,14,31,14,9,1,
-+ 131,1,5,10,14,15,11,128,1,25,1,129,4,31,17,31,9,19,10,31,1,128,8,95,
-+ 9,130,6,12,30,12,6,129,129,7,8,2,131,14,15,4,131,14,15,4,129,6,79,10,
-+ 6,79,10,128,2,14,15,6,2,1,129,14,15,4,131,14,15,4,131,14,15,4,131,14,
-+ 15,4,131,14,15,5,131,13,15,10,2,1,129,11,47,7,129,2,11,14,15,7,128,13,
-+ 15,6,130,11,15,8,129,13,15,7,130,11,15,9,129,13,15,7,130,11,15,9,129,13,
-+ 15,7,130,11,15,9,129,13,15,7,130,11,15,9,129,13,15,7,130,11,15,9,129,13,
-+ 15,7,130,11,15,9,129,13,15,9,130,13,15,9,129,11,15,14,5,2,9,31,9,129,
-+ 4,111,9,130,4,12,30,8,11,15,8,128,6,31,2,129,1,14,15,7,2,31,6,129,
-+ 5,31,3,128,12,15,10,129,9,15,13,129,8,15,14,129,13,15,9,129,3,31,3,2,
-+ 31,4,130,13,15,7,6,15,14,131,9,15,11,10,15,10,131,4,15,30,15,5,132,14,
-+ 47,1,132,10,31,11,133,5,31,6,130,6,15,14,130,9,15,10,130,11,15,9,2,31,
-+ 3,129,13,15,14,130,31,5,128,13,15,6,128,2,47,3,128,4,31,1,128,9,15,10,
-+ 128,6,47,7,128,7,15,12,129,5,15,13,128,9,15,12,15,10,128,11,15,8,129,1,
-+ 31,2,13,15,4,15,14,128,14,15,4,130,12,15,6,15,14,128,12,15,6,15,14,131,
-+ 8,15,13,15,10,128,8,15,13,15,11,131,4,47,6,128,4,47,6,132,14,31,2,128,
-+ 1,47,2,132,10,15,13,130,11,15,13,130,5,15,14,2,129,1,13,15,10,128,11,15,
-+ 11,129,9,15,14,1,128,2,14,15,6,3,31,6,130,7,15,14,13,15,12,132,12,47,
-+ 2,132,5,31,10,133,12,47,2,131,7,31,12,15,11,130,2,14,15,8,2,14,15,6,
-+ 129,11,15,13,1,128,7,15,14,1,5,31,4,130,12,15,9,7,15,14,130,1,31,4,
-+ 3,31,3,129,5,15,14,129,13,15,7,129,9,15,10,129,8,15,11,129,13,15,5,129,
-+ 4,31,128,2,15,14,1,130,14,15,4,6,15,10,131,9,15,8,10,15,6,131,4,15,
-+ 12,14,15,1,132,14,31,11,133,10,31,6,133,5,31,2,133,7,15,11,132,1,4,14,
-+ 15,6,131,1,47,13,132,1,15,14,10,2,132,5,111,6,5,111,6,128,50,11,15,14,
-+ 2,131,6,31,5,131,3,31,9,131,1,13,15,12,132,11,15,14,2,131,8,31,4,131,
-+ 4,31,9,50,1,7,111,7,6,111,7,129,3,12,31,4,129,11,47,5,129,14,15,11,
-+ 2,130,14,15,6,131,14,15,6,131,14,15,6,131,14,15,6,131,31,5,130,6,31,3,
-+ 129,4,31,10,130,4,31,12,131,5,31,4,131,31,5,131,14,15,6,131,14,15,6,131,
-+ 14,15,6,131,14,15,6,131,14,15,11,2,130,11,47,5,129,3,12,31,4,3,31,1,
-+ 4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,
-+ 4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,4,31,1,
-+ 4,31,1,4,31,12,3,129,5,47,11,130,2,11,15,14,131,6,15,14,131,6,15,14,
-+ 131,6,15,14,131,6,15,14,131,5,31,131,4,31,6,131,11,31,4,130,12,31,4,129,
-+ 4,31,5,130,5,31,131,6,15,14,131,6,15,14,131,6,15,14,131,6,15,14,130,2,
-+ 11,15,14,129,5,47,11,129,4,31,12,3,129,130,1,134,4,13,15,14,8,3,5,12,
-+ 3,2,127,8,1,9,7,1,3,9,30,8,168,128,10,14,5,128,1,31,10,129,10,14,
-+ 4,148,130,1,132,3,12,31,8,129,1,14,63,8,128,6,15,8,1,2,13,14,128,8,
-+ 15,1,129,7,15,1,6,15,9,2,4,13,14,128,1,13,63,7,129,2,10,14,13,7,
-+ 209,128,8,9,129,1,11,4,128,2,14,15,9,1,11,15,12,129,4,14,15,14,15,13,
-+ 2,130,5,31,14,2,130,1,11,47,9,129,1,11,15,13,6,14,15,9,128,1,12,13,
-+ 2,128,4,14,8,129,17,130,2,147,128,98,1,5,111,10,5,111,10,172,128,114,34,1,
-+ 5,127,47,11,5,127,47,11,192,128,13,15,6,2,31,1,6,15,11,128,9,15,6,128,
-+ 13,14,1,168,128,5,14,10,130,10,14,5,129,3,14,12,130,11,31,129,1,31,10,129,
-+ 8,31,3,129,5,14,9,130,10,14,4,129,3,14,12,129,128,5,13,14,8,128,2,63,
-+ 6,5,63,9,2,63,5,128,4,13,14,7,146,129,2,14,15,2,130,11,15,7,130,6,
-+ 15,12,131,14,15,4,131,7,15,11,132,12,15,6,131,2,30,2,142,128,3,15,14,1,
-+ 131,9,15,10,131,1,13,15,4,131,5,15,12,131,12,15,5,130,8,15,10,130,3,15,
-+ 14,1,143,
-+};
-+static const struct fos_glyph mdb_glyphs[] = {
-+ { 0, 4, 0, 0, 0, 64 }, /* 0x20 */
-+ { 0, 7, 15, 0, -15, 107 }, /* 0x21 */
-+ { 53, 7, 15, 0, -15, 104 }, /* 0x22 */
-+ { 85, 14, 14, 0, -14, 217 }, /* 0x23 */
-+ { 188, 11, 19, 0, -17, 181 }, /* 0x24 */
-+ { 302, 17, 15, 0, -15, 267 }, /* 0x25 */
-+ { 443, 14, 15, 0, -15, 220 }, /* 0x26 */
-+ { 566, 3, 15, 0, -15, 50 }, /* 0x27 */
-+ { 582, 7, 18, -1, -16, 101 }, /* 0x28 */
-+ { 653, 7, 18, 0, -16, 101 }, /* 0x29 */
-+ { 726, 8, 16, 0, -16, 127 }, /* 0x2a */
-+ { 772, 10, 11, 0, -11, 157 }, /* 0x2b */
-+ { 810, 5, 5, 0, -3, 85 }, /* 0x2c */
-+ { 829, 8, 8, 0, -8, 129 }, /* 0x2d */
-+ { 839, 5, 3, 0, -3, 87 }, /* 0x2e */
-+ { 851, 9, 15, 0, -15, 143 }, /* 0x2f */
-+ { 914, 11, 15, 0, -15, 182 }, /* 0x30 */
-+ { 1031, 7, 15, 0, -15, 113 }, /* 0x31 */
-+ { 1098, 11, 15, 0, -15, 176 }, /* 0x32 */
-+ { 1182, 11, 15, 0, -15, 170 }, /* 0x33 */
-+ { 1269, 12, 15, 0, -15, 187 }, /* 0x34 */
-+ { 1346, 11, 15, 0, -15, 170 }, /* 0x35 */
-+ { 1437, 11, 15, 0, -15, 169 }, /* 0x36 */
-+ { 1542, 10, 15, 0, -15, 156 }, /* 0x37 */
-+ { 1609, 11, 15, 0, -15, 171 }, /* 0x38 */
-+ { 1718, 11, 15, 0, -15, 169 }, /* 0x39 */
-+ { 1826, 7, 10, 0, -10, 114 }, /* 0x3a */
-+ { 1851, 6, 12, 0, -10, 100 }, /* 0x3b */
-+ { 1885, 10, 11, 0, -11, 157 }, /* 0x3c */
-+ { 1942, 10, 9, 0, -9, 157 }, /* 0x3d */
-+ { 1956, 10, 11, 0, -11, 157 }, /* 0x3e */
-+ { 2012, 10, 15, 0, -15, 160 }, /* 0x3f */
-+ { 2086, 16, 16, 0, -14, 263 }, /* 0x40 */
-+ { 2255, 13, 15, 0, -15, 207 }, /* 0x41 */
-+ { 2354, 12, 15, 0, -15, 199 }, /* 0x42 */
-+ { 2461, 12, 15, 0, -15, 195 }, /* 0x43 */
-+ { 2554, 12, 15, 0, -15, 198 }, /* 0x44 */
-+ { 2658, 12, 15, 0, -15, 189 }, /* 0x45 */
-+ { 2725, 11, 15, 0, -15, 180 }, /* 0x46 */
-+ { 2790, 12, 15, 0, -15, 196 }, /* 0x47 */
-+ { 2898, 13, 15, 0, -15, 204 }, /* 0x48 */
-+ { 3013, 5, 15, 0, -15, 84 }, /* 0x49 */
-+ { 3074, 12, 15, 0, -15, 186 }, /* 0x4a */
-+ { 3162, 12, 15, 0, -15, 198 }, /* 0x4b */
-+ { 3279, 11, 15, 0, -15, 183 }, /* 0x4c */
-+ { 3341, 14, 15, 0, -15, 229 }, /* 0x4d */
-+ { 3483, 13, 15, 0, -15, 214 }, /* 0x4e */
-+ { 3624, 12, 15, 0, -15, 199 }, /* 0x4f */
-+ { 3735, 12, 15, 0, -15, 190 }, /* 0x50 */
-+ { 3822, 12, 17, 0, -15, 188 }, /* 0x51 */
-+ { 3939, 12, 15, 0, -15, 196 }, /* 0x52 */
-+ { 4049, 12, 15, 0, -15, 189 }, /* 0x53 */
-+ { 4162, 12, 15, 0, -15, 185 }, /* 0x54 */
-+ { 4227, 13, 15, 0, -15, 204 }, /* 0x55 */
-+ { 4348, 12, 15, 0, -15, 195 }, /* 0x56 */
-+ { 4450, 18, 15, 0, -15, 281 }, /* 0x57 */
-+ { 4618, 12, 15, 0, -15, 197 }, /* 0x58 */
-+ { 4723, 12, 15, 0, -15, 192 }, /* 0x59 */
-+ { 4806, 11, 15, 0, -15, 177 }, /* 0x5a */
-+ { 4873, 8, 20, 0, -17, 129 }, /* 0x5b */
-+ { 4941, 9, 15, 0, -15, 143 }, /* 0x5c */
-+ { 5003, 8, 20, 0, -17, 129 }, /* 0x5d */
-+ { 5087, 9, 15, 0, -15, 149 }, /* 0x5e */
-+ { 5144, 10, 3, 0, -3, 163 }, /* 0x5f */
-+ { 5153, 4, 15, 0, -15, 70 }, /* 0x60 */
-+ { 5165, 10, 11, 0, -11, 167 }, /* 0x61 */
-+ { 5237, 11, 15, 0, -15, 179 }, /* 0x62 */
-+ { 5334, 11, 11, 0, -11, 170 }, /* 0x63 */
-+ { 5406, 11, 15, 0, -15, 179 }, /* 0x64 */
-+ { 5505, 11, 11, 0, -11, 173 }, /* 0x65 */
-+ { 5577, 8, 15, 0, -15, 120 }, /* 0x66 */
-+ { 5644, 11, 15, 0, -11, 176 }, /* 0x67 */
-+ { 5745, 11, 15, 0, -15, 174 }, /* 0x68 */
-+ { 5847, 5, 15, 0, -15, 82 }, /* 0x69 */
-+ { 5904, 7, 19, -2, -15, 80 }, /* 0x6a */
-+ { 5979, 10, 15, 0, -15, 167 }, /* 0x6b */
-+ { 6077, 5, 15, 0, -15, 76 }, /* 0x6c */
-+ { 6138, 17, 11, 0, -11, 265 }, /* 0x6d */
-+ { 6266, 11, 11, 0, -11, 174 }, /* 0x6e */
-+ { 6352, 11, 11, 0, -11, 178 }, /* 0x6f */
-+ { 6433, 11, 15, 0, -11, 180 }, /* 0x70 */
-+ { 6534, 11, 15, 0, -11, 180 }, /* 0x71 */
-+ { 6633, 8, 11, 0, -11, 120 }, /* 0x72 */
-+ { 6682, 10, 11, 0, -11, 158 }, /* 0x73 */
-+ { 6752, 7, 14, 0, -14, 120 }, /* 0x74 */
-+ { 6814, 11, 11, 0, -11, 173 }, /* 0x75 */
-+ { 6900, 10, 11, 0, -11, 161 }, /* 0x76 */
-+ { 6971, 15, 11, 0, -11, 244 }, /* 0x77 */
-+ { 7092, 10, 11, 0, -11, 165 }, /* 0x78 */
-+ { 7169, 10, 15, 0, -11, 156 }, /* 0x79 */
-+ { 7261, 9, 11, 0, -11, 146 }, /* 0x7a */
-+ { 7307, 7, 20, 0, -17, 112 }, /* 0x7b */
-+ { 7389, 4, 18, 0, -16, 61 }, /* 0x7c */
-+ { 7443, 7, 20, 0, -17, 112 }, /* 0x7d */
-+ { 7525, 10, 8, 0, -8, 167 }, /* 0x7e */
-+ { 7549, 5, 7, 0, -7, 72 }, /* 0x80 */
-+ { 7562, 8, 18, 0, -18, 121 }, /* 0x81 */
-+ { 7609, 9, 10, 0, -10, 140 }, /* 0x82 */
-+ { 7666, 9, 8, 0, -8, 149 }, /* 0x83 */
-+ { 7676, 13, 8, 0, -8, 214 }, /* 0x84 */
-+ { 7689, 4, 15, 0, -15, 58 }, /* 0x85 */
-+ { 7708, 17, 3, 0, -3, 266 }, /* 0x86 */
-+ { 7744, 6, 8, 0, -8, 100 }, /* 0x87 */
-+ { 7765, 7, 9, 0, -9, 110 }, /* 0x88 */
-+ { 7795, 7, 9, 0, -9, 118 }, /* 0x89 */
-+};
-+static const uint8_t mdb_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern mdb_kern[] = {
-+ {39,45,-16},{39,52,-5},{39,65,-25},{39,74,-16},{39,97,-4},{39,99,-16},{39,100,-16},{39,101,-16},
-+ {39,103,-11},{39,109,-4},{39,110,-4},{39,111,-16},{39,112,-4},{39,113,-11},{39,114,-4},{39,115,-8},
-+ {44,45,-4},{44,48,-9},{44,84,-18},{44,86,-9},{44,87,-9},{44,89,-18},{44,99,-4},{44,100,-4},
-+ {44,101,-4},{44,103,-4},{44,111,-4},{44,113,-4},{44,118,-13},{44,119,-13},{44,121,-13},{45,39,-7},
-+ {45,44,-4},{45,45,-45},{45,46,-4},{45,55,-20},{45,84,-11},{45,102,-4},{45,116,-4},{45,118,-8},
-+ {45,119,-8},{45,120,-7},{45,121,-8},{45,133,-8},{46,45,-4},{46,48,-9},{46,84,-18},{46,86,-9},
-+ {46,87,-9},{46,89,-18},{46,99,-4},{46,100,-4},{46,101,-4},{46,103,-4},{46,111,-4},{46,113,-4},
-+ {46,118,-13},{46,119,-13},{46,121,-13},{48,49,-5},{50,51,-4},{52,39,-9},{52,49,-30},{52,55,-18},
-+ {53,49,-5},{54,49,-4},{55,44,-19},{55,46,-19},{56,49,-5},{57,49,-6},{65,39,-28},{65,45,-5},
-+ {65,67,-6},{65,71,-6},{65,79,-6},{65,81,-6},{65,83,-13},{65,84,-25},{65,85,-4},{65,86,-9},
-+ {65,87,-9},{65,89,-26},{65,90,4},{65,99,-5},{65,100,-5},{65,101,-5},{65,102,-7},{65,103,-7},
-+ {65,111,-5},{65,113,-7},{65,116,-7},{65,118,-14},{65,119,-14},{65,121,-14},{65,133,-21},{66,65,-11},
-+ {66,84,-5},{66,86,-8},{66,87,-8},{66,88,-7},{66,89,-10},{66,103,-4},{66,113,-4},{66,115,-4},
-+ {67,74,4},{67,86,-4},{67,87,-4},{67,89,-7},{68,65,-11},{68,84,-5},{68,86,-8},{68,87,-8},
-+ {68,88,-7},{68,89,-10},{68,103,-4},{68,113,-4},{68,115,-4},{70,44,-27},{70,45,-17},{70,46,-27},
-+ {70,65,-22},{70,74,-17},{70,97,-14},{70,99,-17},{70,100,-17},{70,101,-17},{70,103,-12},{70,109,-7},
-+ {70,110,-7},{70,111,-17},{70,112,-7},{70,113,-12},{70,114,-7},{70,115,-14},{70,117,-9},{70,118,-15},
-+ {70,119,-15},{70,120,-14},{70,121,-15},{70,122,-7},{71,74,4},{71,86,-4},{71,87,-4},{71,89,-7},
-+ {74,65,-5},{75,45,-9},{75,65,5},{75,67,-7},{75,71,-7},{75,74,-6},{75,79,-7},{75,81,-7},
-+ {75,83,-5},{75,99,-9},{75,100,-9},{75,101,-9},{75,103,-7},{75,111,-9},{75,113,-7},{75,115,-4},
-+ {75,118,-12},{75,119,-12},{75,121,-12},{76,39,-25},{76,65,8},{76,84,-28},{76,86,-12},{76,87,-12},
-+ {76,89,-13},{76,102,-5},{76,116,-5},{76,118,-7},{76,119,-7},{76,121,-7},{76,122,4},{76,133,-15},
-+ {79,74,4},{79,86,-4},{79,87,-4},{79,89,-7},{80,44,-7},{80,45,-8},{80,46,-7},{80,65,-14},
-+ {80,74,-7},{80,86,-5},{80,87,-5},{80,88,-9},{80,89,-9},{80,99,-8},{80,100,-8},{80,101,-8},
-+ {80,103,-5},{80,111,-8},{80,113,-5},{80,115,-5},{81,65,-7},{81,74,4},{81,84,-4},{81,86,-9},
-+ {81,87,-9},{81,88,-9},{81,89,-15},{82,65,7},{82,86,-5},{82,87,-5},{82,89,-7},{83,84,-4},
-+ {83,86,-5},{83,87,-5},{83,88,-11},{83,89,-7},{84,44,-18},{84,45,-25},{84,46,-18},{84,65,-20},
-+ {84,67,-11},{84,71,-11},{84,74,-13},{84,79,-11},{84,81,-11},{84,97,-9},{84,99,-25},{84,100,-25},
-+ {84,101,-25},{84,103,-20},{84,109,-18},{84,110,-18},{84,111,-25},{84,112,-18},{84,113,-20},{84,114,-18},
-+ {84,115,-18},{84,117,-15},{84,118,-15},{84,119,-15},{84,120,-17},{84,121,-15},{85,65,-5},{86,44,-19},
-+ {86,45,-18},{86,46,-19},{86,65,-31},{86,67,-9},{86,71,-9},{86,74,-13},{86,75,-5},{86,79,-9},
-+ {86,81,-9},{86,83,-5},{86,97,-18},{86,99,-18},{86,100,-18},{86,101,-18},{86,103,-17},{86,109,-4},
-+ {86,110,-4},{86,111,-18},{86,112,-4},{86,113,-17},{86,114,-4},{86,115,-12},{86,117,-5},{86,118,-5},
-+ {86,119,-5},{86,121,-5},{87,44,-19},{87,45,-18},{87,46,-19},{87,65,-31},{87,67,-9},{87,71,-9},
-+ {87,74,-13},{87,75,-5},{87,79,-9},{87,81,-9},{87,83,-5},{87,97,-18},{87,99,-18},{87,100,-18},
-+ {87,101,-18},{87,103,-17},{87,109,-4},{87,110,-4},{87,111,-18},{87,112,-4},{87,113,-17},{87,114,-4},
-+ {87,115,-12},{87,117,-5},{87,118,-5},{87,119,-5},{87,121,-5},{88,45,-9},{88,67,-7},{88,71,-7},
-+ {88,74,-4},{88,79,-7},{88,81,-7},{88,83,-8},{88,97,-5},{88,99,-9},{88,100,-9},{88,101,-9},
-+ {88,103,-11},{88,111,-9},{88,113,-11},{88,118,-9},{88,119,-9},{88,121,-9},{89,44,-29},{89,45,-23},
-+ {89,46,-29},{89,65,-35},{89,67,-10},{89,71,-10},{89,74,-17},{89,79,-10},{89,81,-10},{89,83,-7},
-+ {89,97,-19},{89,99,-23},{89,100,-23},{89,101,-23},{89,102,-12},{89,103,-27},{89,109,-16},{89,110,-16},
-+ {89,111,-23},{89,112,-16},{89,113,-27},{89,114,-16},{89,115,-14},{89,116,-12},{89,117,-12},{89,118,-12},
-+ {89,119,-12},{89,120,-12},{89,121,-12},{89,122,-7},{97,39,-8},{97,84,-9},{97,89,-11},{97,118,-4},
-+ {97,119,-4},{97,121,-4},{97,133,-5},{98,39,-12},{98,44,-4},{98,46,-4},{98,118,-6},{98,119,-6},
-+ {98,121,-6},{98,133,-4},{99,39,-7},{99,44,-8},{99,46,-8},{99,120,-5},{99,133,-5},{101,39,-11},
-+ {101,44,-6},{101,46,-6},{101,118,-7},{101,119,-7},{101,120,-6},{101,121,-7},{101,133,-7},{102,44,-16},
-+ {102,45,-12},{102,46,-16},{102,97,-4},{102,99,-12},{102,100,-12},{102,101,-12},{102,103,-9},{102,111,-12},
-+ {102,113,-9},{102,115,-4},{102,133,4},{104,39,-12},{104,44,-4},{104,46,-4},{104,118,-6},{104,119,-6},
-+ {104,121,-6},{104,133,-4},{107,45,-12},{107,97,-5},{107,99,-12},{107,100,-12},{107,101,-12},{107,103,-8},
-+ {107,111,-12},{107,113,-8},{109,39,-12},{109,44,-4},{109,46,-4},{109,118,-6},{109,119,-6},{109,121,-6},
-+ {109,133,-4},{110,39,-12},{110,44,-4},{110,46,-4},{110,118,-6},{110,119,-6},{110,121,-6},{110,133,-4},
-+ {111,39,-7},{111,44,-4},{111,46,-4},{111,55,-20},{111,84,-11},{111,102,-4},{111,116,-4},{111,118,-8},
-+ {111,119,-8},{111,120,-7},{111,121,-8},{111,133,-8},{112,39,-12},{112,44,-4},{112,46,-4},{112,118,-6},
-+ {112,119,-6},{112,121,-6},{112,133,-4},{114,39,7},{114,44,-12},{114,46,-12},{114,103,-6},{114,113,-6},
-+ {114,118,5},{114,119,5},{114,121,5},{114,133,16},{115,39,-5},{115,118,-11},{115,119,-11},{115,120,-4},
-+ {115,121,-11},{115,133,-7},{118,44,-12},{118,45,-9},{118,46,-12},{118,97,-7},{118,99,-9},{118,100,-9},
-+ {118,101,-9},{118,103,-9},{118,111,-9},{118,113,-9},{118,115,-11},{118,133,12},{119,44,-12},{119,45,-9},
-+ {119,46,-12},{119,97,-7},{119,99,-9},{119,100,-9},{119,101,-9},{119,103,-9},{119,111,-9},{119,113,-9},
-+ {119,115,-11},{119,133,12},{120,45,-10},{120,99,-10},{120,100,-10},{120,101,-10},{120,103,-7},{120,111,-10},
-+ {120,113,-7},{121,44,-12},{121,45,-9},{121,46,-12},{121,97,-7},{121,99,-9},{121,100,-9},{121,101,-9},
-+ {121,103,-9},{121,111,-9},{121,113,-9},{121,115,-11},{121,133,12},{133,45,-27},{133,65,-22},{133,97,-5},
-+ {133,99,-27},{133,100,-27},{133,101,-27},{133,102,-4},{133,103,-24},{133,111,-27},{133,113,-24},{133,115,-22},
-+ {133,116,-4},{133,118,-5},{133,119,-5},{133,120,-4},{133,121,-5},
-+};
-+const struct fos_font fos_font_mdb_data = { mdb_bits, mdb_glyphs, mdb_lut, mdb_kern, 501, 20, 4 };
-+
-+static const uint8_t lg_bits[] = {
-+ 130,14,31,1,132,47,1,132,14,31,1,132,14,31,1,132,14,31,133,13,31,133,13,31,
-+ 133,13,15,14,133,12,15,14,133,12,15,14,133,11,15,13,133,11,15,13,133,10,15,12,
-+ 150,1,11,14,9,132,6,47,3,131,6,47,3,131,1,11,14,9,130,6,31,7,128,10,
-+ 31,3,6,31,7,128,10,31,3,5,31,6,128,9,31,2,4,31,6,128,8,31,1,3,
-+ 31,5,128,7,31,1,2,31,4,128,6,15,14,245,132,2,20,3,130,3,20,1,134,8,
-+ 31,9,130,14,31,4,134,11,31,7,129,1,47,1,134,13,31,4,129,3,31,14,135,47,
-+ 2,129,6,31,12,132,7,127,79,11,130,7,127,79,11,130,5,11,13,31,13,43,47,12,
-+ 11,7,132,10,31,8,130,47,2,134,12,31,5,129,2,47,135,14,31,3,129,4,31,13,
-+ 132,5,27,47,43,12,31,14,11,8,130,7,127,79,12,130,7,127,79,11,132,8,31,9,
-+ 130,14,31,3,134,11,31,6,129,1,47,1,134,13,31,4,129,3,31,14,135,47,2,129,
-+ 6,31,11,135,35,130,1,19,2,132,133,12,15,14,139,12,15,14,137,1,5,14,15,14,
-+ 6,2,134,7,111,9,1,131,9,127,15,11,130,3,47,7,2,1,3,9,47,6,129,7,
-+ 31,8,132,7,31,12,129,8,31,6,132,1,31,14,129,7,31,10,133,9,10,9,129,2,
-+ 47,10,2,137,8,63,10,4,136,7,14,63,13,6,135,1,8,14,63,13,3,136,6,12,
-+ 47,14,2,137,5,13,31,10,129,9,27,133,2,47,129,13,31,1,133,13,31,1,128,11,
-+ 31,8,132,2,47,129,6,47,9,3,17,4,12,31,11,130,12,127,31,3,130,1,10,111,
-+ 13,4,133,3,8,14,31,9,5,1,136,11,31,139,11,31,133,130,2,10,30,11,4,132,
-+ 1,13,15,4,133,2,14,31,14,31,5,131,8,15,12,134,11,15,9,129,6,15,14,130,
-+ 2,14,15,3,134,15,14,131,12,15,3,129,9,15,10,135,14,15,1,130,12,15,3,128,
-+ 3,31,2,135,10,15,10,2,1,8,15,13,129,11,15,8,136,2,13,63,14,4,128,4,
-+ 15,14,1,137,1,8,28,9,2,129,12,15,7,145,6,15,13,145,1,13,15,5,145,7,
-+ 15,12,145,1,14,15,4,129,7,13,15,13,7,138,9,15,10,129,10,31,14,31,10,136,
-+ 2,31,2,128,5,15,13,2,128,2,13,15,5,135,11,15,9,129,9,15,6,130,6,15,
-+ 9,134,4,15,14,1,129,9,15,6,130,6,15,9,134,12,15,7,130,5,15,13,2,128,
-+ 2,13,15,5,133,5,15,13,1,131,10,31,14,31,10,134,13,15,5,133,7,13,15,13,
-+ 7,130,131,2,9,13,15,14,11,6,138,4,14,95,11,1,135,1,14,31,14,11,12,47,
-+ 8,135,5,31,14,2,129,6,31,14,135,6,31,11,130,1,47,1,134,4,31,14,1,129,
-+ 5,31,14,136,13,31,11,128,4,14,31,9,136,3,47,12,47,13,1,137,6,79,12,2,
-+ 137,1,9,63,11,138,2,13,79,14,3,130,2,133,13,31,14,6,10,31,14,2,128,2,
-+ 14,12,3,130,7,31,14,3,129,11,31,13,2,12,31,9,130,11,31,7,130,1,12,79,
-+ 13,1,130,12,31,6,131,1,13,47,14,2,131,11,31,12,1,129,1,6,14,47,10,132,
-+ 6,47,14,11,12,14,95,6,132,9,127,12,8,47,3,132,4,10,13,15,14,13,9,4,
-+ 129,8,31,13,1,128,6,31,10,6,31,10,5,31,9,4,31,8,3,31,7,2,31,6,
-+ 179,130,1,13,31,2,132,8,31,11,132,2,47,4,132,8,31,13,133,13,31,8,132,3,
-+ 47,3,132,7,47,133,10,31,12,133,13,31,10,133,14,31,9,133,47,8,133,47,7,133,
-+ 47,8,133,14,31,9,133,13,31,10,133,10,31,12,133,7,47,133,4,47,3,133,14,31,
-+ 8,133,8,31,13,133,2,47,3,133,8,31,11,133,1,13,31,3,129,129,10,31,7,132,
-+ 3,47,2,132,10,31,10,132,5,47,1,131,1,14,31,7,132,10,31,12,132,7,47,1,
-+ 131,4,47,4,131,2,47,6,131,1,47,7,132,47,8,132,14,31,9,132,47,8,131,1,
-+ 47,7,131,2,47,6,131,4,47,3,131,7,31,14,132,10,31,11,131,1,14,31,6,131,
-+ 5,47,1,131,11,31,9,131,3,31,14,2,131,9,31,6,130,131,8,15,4,132,2,129,
-+ 8,15,4,128,17,128,1,14,12,3,8,15,4,5,13,10,128,2,13,31,14,15,14,31,
-+ 11,130,6,14,47,12,4,131,6,14,47,12,4,129,2,13,31,14,15,13,31,11,128,1,
-+ 14,12,3,8,15,4,5,13,10,129,2,129,8,15,4,128,17,132,8,15,4,252,132,10,
-+ 15,14,137,11,31,137,11,31,137,11,31,137,11,31,132,2,127,47,5,2,127,47,5,1,
-+ 10,43,14,31,59,3,132,11,31,137,11,31,137,11,31,137,10,15,14,158,129,10,31,1,
-+ 130,13,15,13,131,31,9,130,2,31,5,130,5,31,1,130,7,15,13,131,9,15,8,130,
-+ 1,10,107,10,128,2,127,15,128,2,127,15,205,129,9,14,11,1,129,4,47,6,129,4,
-+ 47,6,130,9,14,11,1,128,134,11,31,5,134,2,31,14,1,134,7,31,10,135,12,31,
-+ 4,134,3,31,14,135,8,31,9,135,13,31,3,134,4,31,13,135,9,31,7,134,1,14,
-+ 31,2,134,5,31,12,135,11,31,6,134,1,47,1,134,6,31,10,135,12,31,5,134,2,
-+ 31,14,135,8,31,9,135,13,31,4,134,3,31,13,135,131,5,11,14,15,14,12,7,1,
-+ 132,1,11,111,13,3,131,9,47,14,11,13,47,13,1,129,2,47,8,130,4,47,7,129,
-+ 6,31,13,132,8,31,11,129,7,31,10,132,5,31,12,129,8,31,9,132,4,31,13,129,
-+ 8,31,9,132,4,31,13,129,8,31,9,132,4,31,13,129,8,31,9,132,4,31,13,129,
-+ 8,31,9,132,4,31,13,129,8,31,9,132,4,31,13,129,8,31,9,132,4,31,13,129,
-+ 7,31,10,132,5,31,12,129,6,31,13,132,8,31,11,129,2,47,8,130,4,47,6,130,
-+ 9,47,14,11,13,47,13,1,131,11,111,13,2,133,5,11,14,15,14,12,7,1,130,129,
-+ 1,7,14,31,9,130,6,14,63,10,130,12,79,10,130,11,12,8,10,31,10,133,7,31,
-+ 10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,
-+ 10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,10,133,7,31,
-+ 10,133,7,31,10,133,7,31,9,129,130,1,7,12,14,15,13,9,3,133,3,14,111,8,
-+ 131,1,14,47,12,11,14,47,6,130,7,31,14,4,129,1,11,31,13,130,10,31,9,131,
-+ 2,47,1,129,11,31,6,131,1,47,2,129,2,20,1,131,5,31,14,137,1,13,31,9,
-+ 137,10,31,14,2,136,7,47,6,136,5,47,10,136,3,14,31,12,136,2,14,31,13,1,
-+ 135,1,13,31,14,2,135,1,11,31,14,3,136,10,47,4,136,8,47,14,107,6,129,10,
-+ 127,47,9,129,9,127,47,9,128,128,9,127,31,11,129,10,127,31,12,129,6,91,13,47,
-+ 11,135,3,14,31,14,3,134,4,14,31,14,3,134,4,14,31,14,3,134,4,14,31,14,
-+ 3,135,14,63,11,5,134,6,95,8,134,6,1,128,6,47,3,137,9,31,9,137,5,31,
-+ 13,129,3,20,132,3,31,14,129,14,31,4,131,4,31,13,129,11,31,8,131,8,31,11,
-+ 129,6,31,14,3,129,3,14,31,7,130,13,47,28,47,13,131,2,13,95,13,3,132,1,
-+ 7,12,30,12,7,1,130,133,13,31,6,138,5,31,14,1,138,12,31,8,138,4,47,1,
-+ 138,11,31,9,138,3,47,3,138,9,31,11,138,1,47,4,129,4,31,12,132,8,31,12,
-+ 130,5,31,12,131,1,14,31,5,130,5,31,12,131,6,31,13,131,5,31,12,131,13,31,
-+ 14,60,13,47,12,5,129,127,79,6,129,14,127,63,6,137,5,31,13,139,5,31,12,139,
-+ 5,31,12,139,5,31,12,139,4,31,12,130,128,8,127,31,8,129,9,127,31,8,129,9,
-+ 31,13,107,5,129,9,31,8,137,9,31,8,137,9,31,8,137,9,31,8,137,9,31,8,
-+ 7,12,14,13,11,4,131,9,127,15,9,130,9,63,12,11,14,47,6,129,9,47,4,130,
-+ 10,31,13,129,3,22,4,131,2,47,2,137,47,3,128,2,20,2,132,47,3,128,8,31,
-+ 12,131,4,47,1,128,3,47,6,129,1,12,31,12,130,10,47,13,11,14,47,4,130,1,
-+ 11,111,6,133,5,11,30,13,9,3,130,130,1,8,12,30,13,9,3,132,3,14,111,6,
-+ 130,1,14,47,28,63,3,129,6,47,4,129,2,13,31,9,129,9,31,10,131,7,31,12,
-+ 129,9,31,8,131,2,24,6,129,9,31,8,137,9,31,8,7,13,15,14,11,5,131,9,
-+ 127,15,9,130,9,63,12,11,14,47,6,129,9,47,5,129,1,11,31,12,129,9,31,11,
-+ 131,3,47,1,128,9,31,8,132,14,31,3,128,9,31,8,132,14,31,3,128,7,31,11,
-+ 131,3,47,1,128,2,47,5,129,1,11,31,11,130,10,47,12,11,14,47,4,130,1,11,
-+ 111,7,133,6,11,14,15,13,10,3,130,4,127,47,10,4,127,47,11,4,31,12,75,14,
-+ 31,10,4,31,4,132,13,31,6,1,22,1,131,4,47,1,135,10,31,10,135,1,47,4,
-+ 135,6,31,14,136,12,31,8,135,3,47,2,135,8,31,12,136,14,31,6,135,5,47,1,
-+ 135,10,31,10,135,1,47,4,135,7,31,14,136,12,31,8,135,3,47,2,135,8,31,12,
-+ 133,131,7,12,14,15,13,9,3,132,2,13,111,6,131,12,47,12,11,14,47,2,129,4,
-+ 47,4,129,1,12,31,9,129,7,31,10,131,4,31,12,129,7,31,10,131,4,31,12,129,
-+ 4,47,4,129,1,12,31,8,130,11,47,28,14,31,14,2,130,1,13,111,3,131,7,127,
-+ 12,130,2,47,8,1,128,4,14,31,8,129,8,31,11,131,5,31,13,129,11,31,7,131,
-+ 1,47,1,128,12,31,7,131,1,47,2,128,10,31,10,131,4,47,129,6,47,4,129,1,
-+ 12,31,11,130,13,47,12,11,14,47,4,130,2,13,111,6,132,1,7,12,14,15,13,9,
-+ 3,130,130,2,8,12,30,12,7,1,132,4,14,95,13,2,130,1,14,47,11,12,47,13,
-+ 130,8,31,13,2,129,2,14,31,6,129,12,31,6,131,8,31,11,129,14,31,3,131,4,
-+ 31,12,129,14,31,3,131,5,31,13,129,13,31,6,131,8,31,13,129,9,31,13,2,129,
-+ 3,14,31,13,129,3,63,11,12,63,13,130,6,95,14,31,13,131,3,10,14,15,13,9,
-+ 5,31,13,137,4,31,13,129,4,24,5,131,4,31,13,129,8,31,11,131,6,31,12,129,
-+ 6,47,4,129,2,13,31,10,129,1,14,47,28,63,3,130,3,14,111,6,132,1,8,12,
-+ 30,13,9,3,130,130,7,14,12,2,132,1,47,8,132,1,47,8,133,7,14,12,2,173,
-+ 7,14,12,2,132,1,47,8,132,1,47,8,133,7,14,12,2,140,129,3,12,14,9,131,
-+ 12,47,5,130,12,47,5,130,3,12,14,9,163,1,31,10,131,3,31,8,131,4,31,4,
-+ 131,6,31,1,131,8,15,13,132,9,15,10,132,10,15,6,130,137,2,8,4,135,3,9,
-+ 31,5,133,4,11,63,5,131,5,12,63,14,8,1,128,1,7,13,63,12,5,130,1,14,
-+ 47,14,9,3,132,2,47,10,1,134,2,63,12,5,134,4,11,63,13,7,1,133,3,10,
-+ 79,9,3,133,2,8,14,63,4,134,1,7,13,31,5,137,5,12,5,140,1,125,45,4,
-+ 2,127,47,5,2,127,47,5,166,1,125,45,4,2,127,47,5,2,127,47,5,179,1,9,
-+ 3,137,2,31,11,4,135,2,63,12,6,134,6,12,63,13,7,1,133,4,10,63,14,8,
-+ 2,133,2,8,14,63,4,135,7,47,5,133,4,10,63,5,131,6,12,63,13,6,129,2,
-+ 8,14,63,11,4,130,1,79,10,3,132,2,31,14,8,2,134,2,13,7,1,149,130,3,
-+ 9,13,30,12,8,1,132,8,111,14,3,130,6,47,14,11,12,47,13,1,129,13,31,10,
-+ 1,129,4,47,5,128,1,47,2,131,11,31,8,128,1,29,12,132,11,31,8,136,3,47,
-+ 5,135,4,14,31,12,135,8,47,13,2,134,8,47,9,1,134,2,47,7,136,4,31,13,
-+ 137,4,31,12,165,2,12,14,6,137,10,47,137,10,31,14,137,2,13,14,6,133,135,5,
-+ 9,12,30,13,11,7,1,138,6,13,127,15,6,135,1,10,31,12,6,3,1,128,2,5,
-+ 11,31,10,133,1,12,15,14,5,135,6,31,7,132,10,15,14,2,137,7,31,2,130,4,
-+ 31,3,129,2,9,12,11,6,11,13,3,129,13,15,7,130,12,15,8,129,3,14,95,2,
-+ 129,9,15,11,129,2,31,2,129,12,15,10,18,12,31,130,7,15,13,129,6,15,12,129,
-+ 2,15,14,1,129,6,15,13,130,6,15,13,129,9,15,9,129,6,15,11,130,7,15,11,
-+ 130,7,15,12,129,11,15,8,129,8,15,8,130,9,15,9,130,11,15,9,129,11,15,7,
-+ 129,9,15,8,130,13,15,9,129,1,14,15,5,129,10,15,9,129,7,15,13,2,128,8,
-+ 31,13,2,1,11,15,13,130,8,15,12,129,2,14,63,14,79,14,4,130,4,31,2,129,
-+ 3,11,30,10,2,4,12,15,14,11,3,132,13,15,11,146,3,31,10,1,134,2,137,7,
-+ 31,13,7,3,18,3,7,12,14,2,137,5,14,127,13,4,138,1,7,11,14,15,14,13,
-+ 10,5,1,134,133,5,47,12,140,10,63,2,138,1,79,7,138,5,79,12,138,10,31,11,
-+ 47,2,137,14,31,4,13,31,7,136,4,31,14,128,8,31,12,136,9,31,10,128,3,47,
-+ 1,135,14,31,6,129,14,31,6,134,4,47,1,129,9,31,11,134,9,31,11,130,5,47,
-+ 1,133,13,31,7,130,1,14,31,6,132,3,47,2,131,10,31,10,132,8,47,71,11,31,
-+ 14,1,131,13,127,63,5,130,2,127,79,10,130,7,31,14,134,6,31,14,130,12,31,9,
-+ 134,1,47,4,128,1,47,3,135,11,31,9,128,129,111,14,13,10,4,133,127,47,9,132,
-+ 47,59,12,63,6,131,47,2,131,2,12,31,12,131,47,2,132,3,31,14,131,47,2,132,
-+ 1,47,131,47,2,132,5,31,12,131,47,2,130,1,5,14,31,6,131,127,47,7,132,127,
-+ 31,12,2,132,47,59,12,14,31,14,3,131,47,2,131,1,10,31,12,131,47,2,132,1,
-+ 47,2,130,47,2,133,13,31,4,130,47,2,132,1,47,3,130,47,2,131,1,10,31,14,
-+ 1,130,47,75,14,47,8,131,127,47,10,132,127,13,10,4,131,131,2,7,12,14,15,13,
-+ 10,5,134,5,14,111,12,2,131,4,63,12,11,14,47,13,1,130,13,31,12,2,130,6,
-+ 47,7,129,4,31,14,2,132,8,31,12,129,6,31,11,133,3,47,129,7,31,10,134,22,
-+ 5,129,7,31,10,139,7,31,10,139,7,31,10,139,7,31,10,139,7,31,10,139,7,31,
-+ 10,134,5,6,5,129,6,31,11,133,3,31,14,129,4,31,14,2,132,8,31,12,130,13,
-+ 31,12,2,130,6,47,7,130,4,63,12,11,14,47,12,1,131,5,14,111,12,2,133,2,
-+ 7,12,14,15,13,10,5,131,129,111,14,13,8,2,133,127,47,7,132,47,59,12,63,6,
-+ 131,47,2,131,2,12,31,13,131,47,2,132,3,47,3,130,47,2,133,14,31,4,130,47,
-+ 2,133,12,31,5,130,47,2,133,12,31,5,130,47,2,133,12,31,5,130,47,2,133,12,
-+ 31,5,130,47,2,133,12,31,5,130,47,2,133,12,31,5,130,47,2,133,12,31,5,130,
-+ 47,2,133,14,31,4,130,47,2,132,3,47,3,130,47,2,131,2,12,31,13,131,47,59,
-+ 12,63,6,131,127,47,7,132,111,14,13,9,3,131,129,127,63,11,130,127,63,12,130,47,
-+ 123,11,8,130,47,2,139,47,2,139,47,2,139,47,2,139,47,2,139,127,15,11,133,127,
-+ 15,11,133,47,91,7,133,47,2,139,47,2,139,47,2,139,47,2,139,47,2,139,47,123,
-+ 11,8,130,127,63,12,130,127,63,11,128,129,127,63,11,129,127,63,11,129,47,123,11,7,
-+ 129,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,127,15,11,132,127,15,11,132,
-+ 47,91,7,132,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,
-+ 138,47,1,136,131,2,7,12,14,15,13,11,5,135,5,14,111,12,2,132,4,63,13,11,
-+ 13,47,13,1,131,13,31,12,2,130,5,14,31,8,130,4,31,14,2,132,6,31,13,130,
-+ 6,31,11,133,2,47,130,7,31,10,134,33,130,7,31,10,140,7,31,10,130,9,75,10,
-+ 130,7,31,10,130,13,95,130,7,31,10,130,13,95,130,7,31,10,133,2,47,130,7,31,
-+ 10,133,1,47,130,6,31,11,133,3,31,14,130,3,31,14,1,132,7,31,11,131,13,31,
-+ 12,3,130,5,14,31,5,131,4,63,13,11,13,47,11,133,5,14,111,11,1,134,2,7,
-+ 12,14,15,14,11,5,132,129,47,1,133,10,31,5,130,47,2,133,11,31,6,130,47,2,
-+ 133,11,31,6,130,47,2,133,11,31,6,130,47,2,133,11,31,6,130,47,2,133,11,31,
-+ 6,130,47,2,133,11,31,6,130,47,2,133,11,31,6,130,127,79,6,130,127,79,6,130,
-+ 47,107,14,31,6,130,47,2,133,11,31,6,130,47,2,133,11,31,6,130,47,2,133,11,
-+ 31,6,130,47,2,133,11,31,6,130,47,2,133,11,31,6,130,47,2,133,11,31,6,130,
-+ 47,2,133,11,31,6,130,47,1,133,11,31,5,128,129,47,1,130,47,2,130,47,2,130,
-+ 47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,
-+ 47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,2,130,47,1,128,
-+ 137,5,31,10,139,6,31,11,139,6,31,11,139,6,31,11,139,6,31,11,139,6,31,11,
-+ 139,6,31,11,139,6,31,11,139,6,31,11,139,6,31,11,130,33,133,6,31,11,129,6,
-+ 31,11,133,6,31,11,129,6,31,11,133,6,31,11,129,5,31,12,133,7,31,10,129,3,
-+ 47,2,132,11,31,8,130,13,31,12,2,130,8,47,3,130,5,63,12,11,14,47,9,132,
-+ 6,127,10,134,2,8,12,30,13,10,4,132,129,47,1,132,1,13,31,8,130,47,2,132,
-+ 12,31,12,131,47,2,131,10,31,14,1,131,47,2,130,7,47,3,132,47,2,129,5,47,
-+ 6,133,47,2,128,3,14,31,9,134,47,18,13,31,11,135,47,2,12,31,13,1,135,47,
-+ 12,47,10,136,127,4,135,63,14,11,31,13,1,134,63,4,1,14,31,8,134,47,6,129,
-+ 5,47,3,133,47,2,130,11,31,12,133,47,2,130,2,14,31,7,132,47,2,131,6,47,
-+ 2,131,47,2,132,12,31,11,131,47,2,132,2,47,6,130,47,1,133,7,31,14,1,129,
-+ 47,1,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,
-+ 47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,47,2,138,
-+ 47,123,11,6,129,127,63,9,129,127,63,9,129,47,5,134,2,14,31,4,130,47,14,1,
-+ 133,10,47,5,130,63,10,132,5,63,5,130,79,5,130,1,14,63,5,130,79,13,1,129,
-+ 10,79,5,130,47,14,31,9,128,5,47,14,31,5,130,47,5,47,5,13,31,8,12,31,
-+ 5,130,47,2,9,79,13,128,12,31,5,130,47,2,1,13,63,4,128,12,31,5,130,47,
-+ 2,128,4,47,9,129,12,31,5,130,47,2,129,9,15,13,1,129,12,31,5,130,47,2,
-+ 130,2,1,130,12,31,5,130,47,2,135,12,31,5,130,47,2,135,12,31,5,130,47,2,
-+ 135,12,31,5,130,47,2,135,12,31,5,130,47,2,135,12,31,5,130,47,2,135,12,31,
-+ 5,130,47,1,135,12,31,4,128,129,47,4,134,47,1,130,47,12,133,1,47,1,130,63,
-+ 7,132,1,47,1,130,63,14,2,131,1,47,1,130,79,10,131,1,47,1,130,95,4,130,
-+ 1,47,1,130,47,8,31,13,131,47,1,130,47,1,13,31,7,130,47,1,130,47,1,4,
-+ 31,14,2,129,47,1,130,47,1,128,10,31,10,129,47,1,130,47,1,128,2,14,31,4,
-+ 128,47,1,130,47,1,129,7,31,13,1,47,1,130,47,1,130,12,31,8,47,1,130,47,
-+ 1,130,4,95,1,130,47,1,131,9,79,1,130,47,1,131,1,14,63,1,130,47,1,132,
-+ 6,63,1,130,47,2,133,12,47,1,130,47,1,133,3,14,31,1,128,131,1,7,12,14,
-+ 15,13,11,5,135,4,14,111,12,2,132,3,63,12,11,13,47,13,1,131,12,31,13,2,
-+ 130,4,14,31,8,130,3,47,2,132,5,31,14,130,6,31,11,134,47,2,129,7,31,10,
-+ 134,13,31,4,129,7,31,10,134,13,31,4,129,7,31,10,134,13,31,4,129,7,31,10,
-+ 134,13,31,4,129,7,31,10,134,13,31,4,129,7,31,10,134,13,31,4,129,7,31,10,
-+ 134,13,31,3,129,6,31,11,134,47,2,129,3,47,2,132,5,31,14,131,12,31,12,2,
-+ 130,4,14,31,8,131,3,63,12,11,13,47,13,1,132,4,14,111,12,2,134,1,7,12,
-+ 14,15,13,11,6,132,128,2,127,13,10,4,131,3,127,47,8,130,3,47,59,12,14,47,
-+ 5,129,3,31,14,132,2,12,31,12,129,3,31,14,133,2,47,2,128,3,31,14,134,14,
-+ 31,4,128,3,31,14,134,14,31,3,128,3,31,14,133,4,47,1,128,3,31,14,131,1,
-+ 5,14,31,11,129,3,127,47,14,3,129,3,127,31,13,4,130,3,47,59,10,9,5,1,
-+ 131,3,31,14,139,3,31,14,139,3,31,14,139,3,31,14,139,3,31,14,139,3,31,14,
-+ 139,2,31,14,138,131,3,9,13,30,12,8,2,134,7,111,14,5,132,6,47,14,11,12,
-+ 63,4,130,1,47,10,1,129,1,12,31,13,130,6,31,13,1,131,2,14,31,4,129,9,
-+ 31,8,133,11,31,7,129,11,31,6,133,8,31,8,129,11,31,6,133,8,31,9,129,11,
-+ 31,6,133,8,31,9,129,11,31,6,133,8,31,9,129,11,31,6,133,8,31,9,129,11,
-+ 31,6,133,8,31,9,129,11,31,6,133,8,31,9,129,11,31,7,133,9,31,8,129,9,
-+ 31,9,133,11,31,7,129,5,31,14,2,131,4,47,3,130,13,31,13,4,17,5,14,31,
-+ 11,131,3,14,127,13,2,132,3,12,95,11,2,135,3,12,31,10,2,138,9,31,8,139,
-+ 9,31,7,133,129,127,14,11,5,133,127,47,9,132,47,75,14,47,7,131,47,2,131,1,
-+ 10,31,14,131,47,2,132,1,47,3,130,47,2,133,13,31,4,130,47,2,132,1,47,3,
-+ 130,47,2,131,1,10,31,14,1,130,47,75,14,47,8,131,127,47,10,132,127,15,13,5,
-+ 133,47,2,129,3,31,13,134,47,2,130,11,31,6,133,47,2,130,4,31,13,133,47,2,
-+ 131,12,31,6,132,47,2,131,5,31,13,132,47,2,132,13,31,6,131,47,2,132,6,31,
-+ 13,131,47,1,133,13,31,5,128,131,6,11,14,15,14,12,8,3,133,2,12,127,9,132,
-+ 12,47,13,11,12,63,9,130,5,31,14,4,130,1,9,47,3,129,8,31,9,133,11,31,
-+ 7,129,7,31,9,133,7,31,9,129,5,31,14,3,132,1,20,2,130,12,47,10,3,137,
-+ 1,12,63,13,7,2,136,6,13,79,10,2,136,4,10,63,14,4,137,1,7,14,31,14,
-+ 2,129,4,21,1,132,2,13,31,8,129,13,31,3,133,6,31,11,129,11,31,7,133,8,
-+ 31,10,129,7,47,6,131,4,14,31,7,129,1,13,47,14,12,11,13,47,14,1,130,2,
-+ 12,127,13,3,133,5,10,13,14,15,14,11,6,1,130,1,127,79,10,128,1,127,79,11,
-+ 128,1,10,59,14,31,12,59,7,134,13,31,4,139,13,31,4,139,13,31,4,139,13,31,
-+ 4,139,13,31,4,139,13,31,4,139,13,31,4,139,13,31,4,139,13,31,4,139,13,31,
-+ 4,139,13,31,4,139,13,31,4,139,13,31,4,139,13,31,4,139,13,31,4,139,12,31,
-+ 4,133,128,2,31,14,134,11,31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,
-+ 31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,
-+ 31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,
-+ 31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,31,5,129,3,31,14,134,12,
-+ 31,5,129,3,31,14,134,12,31,5,129,1,47,1,133,13,31,4,130,14,31,6,132,4,
-+ 47,2,130,9,31,14,5,130,3,13,31,11,131,1,13,47,13,11,13,47,14,3,132,2,
-+ 12,111,14,4,135,6,11,13,15,14,12,7,1,131,1,47,3,134,10,31,9,128,12,31,
-+ 8,134,14,31,5,128,8,31,12,133,4,31,14,129,3,47,1,132,8,31,10,130,13,31,
-+ 5,132,12,31,5,130,9,31,10,131,1,47,1,130,4,31,14,131,6,31,11,132,14,31,
-+ 3,130,10,31,6,132,10,31,8,130,14,31,2,132,5,31,12,129,3,31,12,133,1,47,
-+ 1,128,8,31,7,134,11,31,5,128,12,31,3,134,6,31,10,1,31,13,135,2,31,14,
-+ 5,31,8,136,12,31,13,31,3,136,7,63,14,137,3,63,9,138,13,47,4,138,8,31,
-+ 14,133,3,47,1,132,13,31,8,132,3,31,14,129,14,31,5,131,2,47,12,132,7,31,
-+ 11,129,11,31,8,131,5,63,1,131,11,31,7,129,7,31,12,131,9,63,5,131,14,31,
-+ 3,129,3,47,1,130,13,63,8,130,3,31,14,131,14,31,4,129,1,31,14,31,12,130,
-+ 7,31,10,131,10,31,8,129,5,31,9,14,31,1,129,11,31,7,131,6,31,12,129,8,
-+ 31,5,10,31,5,129,14,31,3,131,2,47,1,128,12,31,2,7,31,9,128,3,31,14,
-+ 133,13,31,4,1,31,13,128,3,31,12,128,6,31,10,133,9,31,8,4,31,10,129,14,
-+ 31,1,10,31,6,133,5,31,12,7,31,6,129,11,31,5,14,31,2,133,1,47,12,31,
-+ 3,129,7,31,11,31,14,135,12,63,14,130,3,79,10,135,8,63,11,131,14,63,6,135,
-+ 4,63,7,131,11,63,2,136,14,47,4,131,7,47,13,137,11,47,132,4,47,10,137,6,
-+ 31,11,133,14,31,5,132,128,14,31,7,134,12,31,8,129,6,31,14,1,132,6,31,14,
-+ 1,130,12,31,10,131,1,14,31,6,131,3,47,3,130,9,31,12,133,9,31,12,129,3,
-+ 47,3,133,1,14,31,6,128,11,31,9,135,6,31,14,6,31,14,1,136,12,79,7,137,
-+ 4,63,13,139,11,47,6,138,3,63,12,138,12,79,6,136,6,31,14,7,31,14,1,134,
-+ 1,14,31,6,128,12,31,9,134,9,31,12,129,3,47,3,132,3,47,3,130,9,31,12,
-+ 132,11,31,9,131,1,14,31,6,130,5,31,14,1,132,6,31,14,1,129,13,31,6,134,
-+ 12,31,8,128,1,14,31,5,133,2,14,31,3,128,8,31,12,133,10,31,11,129,1,14,
-+ 31,5,131,2,47,3,130,7,31,12,131,10,31,10,131,1,14,31,5,129,2,47,3,132,
-+ 7,31,12,129,10,31,10,133,1,14,31,4,2,47,2,134,7,31,12,10,31,9,135,1,
-+ 14,79,2,136,6,63,9,138,13,47,2,138,8,31,10,139,8,31,10,139,8,31,10,139,
-+ 8,31,10,139,8,31,10,139,8,31,10,139,8,31,10,139,7,31,9,133,128,127,63,12,
-+ 129,127,63,12,129,10,123,14,31,12,137,3,47,5,136,1,13,31,10,137,9,31,13,1,
-+ 136,4,47,4,136,1,14,31,8,137,10,31,12,137,6,47,3,136,2,14,31,7,137,11,
-+ 31,12,137,7,31,14,2,136,3,47,6,137,12,31,10,137,8,31,14,1,137,47,13,123,
-+ 8,129,127,63,12,129,127,63,12,128,1,95,7,130,1,95,8,130,1,47,43,5,130,1,
-+ 47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,
-+ 47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,
-+ 47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,47,1,133,1,
-+ 47,1,133,1,47,43,5,130,1,95,8,130,1,95,8,130,128,4,31,12,136,14,31,2,
-+ 135,9,31,8,135,4,31,13,136,13,31,3,135,8,31,9,135,2,31,14,136,12,31,5,
-+ 135,7,31,10,135,1,47,1,135,11,31,6,135,6,31,11,135,1,14,31,2,135,10,31,
-+ 7,135,4,31,12,136,14,31,3,135,9,31,8,135,3,31,13,136,13,31,3,130,9,79,
-+ 14,131,9,95,131,6,27,12,47,134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,
-+ 134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,
-+ 134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,134,3,47,131,6,43,47,131,9,
-+ 95,131,9,79,14,128,131,4,31,11,136,10,47,2,134,1,14,47,8,134,6,31,12,15,
-+ 13,134,11,15,12,4,31,4,132,2,31,7,128,14,15,9,132,7,31,2,128,9,15,14,
-+ 1,131,13,15,12,129,3,31,6,130,3,31,6,130,13,15,11,130,9,31,1,130,8,31,
-+ 2,129,14,15,11,131,2,31,7,232,4,123,43,10,1,6,127,63,2,6,127,63,2,1,
-+ 14,15,12,130,4,31,6,130,7,15,14,1,223,130,3,9,13,15,14,12,8,2,132,7,
-+ 111,14,4,130,4,47,14,27,14,31,14,1,129,10,31,13,1,129,1,13,31,7,130,2,
-+ 4,3,131,8,31,9,131,2,7,26,27,13,31,10,130,9,127,15,10,129,8,127,31,10,
-+ 129,14,31,11,4,1,129,8,31,10,128,2,47,2,131,9,31,10,128,1,47,5,130,5,
-+ 14,31,10,129,13,47,12,11,13,63,10,129,4,111,12,31,10,130,3,10,14,15,14,10,
-+ 3,7,31,9,128,128,4,31,12,138,4,31,12,138,4,31,12,138,4,31,12,138,4,31,
-+ 12,138,4,31,12,2,10,30,12,7,1,131,4,31,30,79,12,1,130,4,63,14,11,13,
-+ 47,10,130,4,47,12,1,129,8,47,3,129,4,47,5,131,14,31,7,129,4,47,132,9,
-+ 31,10,129,4,31,14,132,7,31,11,129,4,31,14,132,7,31,11,129,4,47,132,9,31,
-+ 10,129,4,47,4,131,13,31,7,129,4,47,12,1,129,7,47,2,129,4,63,14,11,13,
-+ 47,10,130,4,31,30,79,12,1,130,4,31,12,2,10,30,12,7,131,131,5,11,14,15,
-+ 14,10,4,133,10,111,10,131,9,47,13,11,13,47,9,129,2,47,7,130,8,47,2,128,
-+ 7,31,12,132,13,15,14,4,128,9,31,8,132,2,1,130,10,31,7,137,10,31,7,137,
-+ 9,31,8,132,1,131,6,31,12,132,14,15,12,3,128,2,47,7,130,8,47,1,129,8,
-+ 47,13,11,13,47,9,131,9,111,10,133,5,11,14,15,14,10,5,130,137,11,31,5,138,
-+ 12,31,5,138,12,31,5,138,12,31,5,138,12,31,5,132,6,12,30,11,3,12,31,5,
-+ 130,1,11,79,30,31,5,130,9,47,13,11,14,63,5,129,2,47,9,129,1,11,47,5,
-+ 129,6,31,14,1,130,3,47,5,129,9,31,10,132,14,31,5,129,10,31,9,132,13,31,
-+ 5,129,10,31,8,132,13,31,5,129,8,31,10,132,14,31,5,129,6,31,14,131,3,47,
-+ 5,129,1,47,8,129,1,11,47,5,130,9,47,13,11,14,63,5,130,1,11,95,14,31,
-+ 5,132,6,12,30,11,3,11,31,5,128,131,5,11,14,15,14,10,4,134,10,111,9,132,
-+ 9,47,12,11,13,47,6,130,2,47,4,130,8,31,13,130,7,31,10,132,14,31,2,129,
-+ 9,31,13,75,14,31,5,129,10,127,47,6,129,9,127,47,6,129,8,31,8,138,5,31,
-+ 12,132,1,2,131,1,14,31,8,130,2,12,14,4,131,6,47,14,11,12,47,13,132,8,
-+ 111,13,3,133,4,10,13,15,14,12,7,1,130,131,6,11,14,31,1,130,6,79,2,130,
-+ 13,47,12,10,1,130,47,5,132,1,47,1,130,3,127,2,3,127,3,2,27,47,43,2,
-+ 129,1,47,1,132,1,47,1,132,1,47,1,132,1,47,1,132,1,47,1,132,1,47,1,
-+ 132,1,47,1,132,1,47,1,132,1,47,1,132,1,47,1,132,1,47,131,130,1,8,12,
-+ 30,11,3,13,31,3,130,1,13,127,15,4,130,11,47,13,11,14,63,4,129,4,47,7,
-+ 129,1,11,47,4,129,8,31,12,131,3,47,4,129,10,31,8,132,14,31,4,129,11,31,
-+ 7,132,13,31,4,129,11,31,6,132,13,31,4,129,10,31,8,132,14,31,4,129,9,31,
-+ 11,131,2,47,4,129,5,47,7,129,1,10,47,4,130,13,47,13,11,14,63,4,130,2,
-+ 13,127,15,4,131,1,7,12,30,11,3,14,31,3,137,2,47,1,136,1,11,31,12,133,
-+ 6,27,12,63,4,133,10,79,14,5,134,9,31,14,11,7,1,131,128,4,31,12,138,5,
-+ 31,12,138,5,31,12,138,5,31,12,138,5,31,12,138,5,31,12,2,10,14,15,13,8,
-+ 1,131,5,31,30,79,13,1,130,5,63,13,11,14,47,9,130,5,47,9,129,1,11,31,
-+ 14,130,5,31,14,131,3,47,1,129,5,31,12,131,1,47,1,129,5,31,12,132,47,1,
-+ 129,5,31,12,132,47,1,129,5,31,12,132,47,1,129,5,31,12,132,47,1,129,5,31,
-+ 12,132,47,1,129,5,31,12,132,47,1,129,5,31,12,132,47,1,129,4,31,12,132,47,
-+ 1,128,129,3,7,3,130,3,31,14,2,129,6,47,5,129,3,31,14,2,130,3,7,3,
-+ 137,2,31,14,130,2,47,130,2,47,130,2,47,130,2,47,130,2,47,130,2,47,130,2,
-+ 47,130,2,47,130,2,47,130,2,47,130,2,47,130,2,47,130,2,31,14,129,131,4,7,
-+ 2,132,4,31,14,1,131,8,47,3,131,4,31,14,1,132,4,7,2,141,3,31,13,132,
-+ 3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,
-+ 3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,
-+ 3,31,14,132,4,31,13,131,1,11,31,12,129,4,11,14,47,8,129,6,63,13,1,129,
-+ 5,15,14,12,7,1,130,128,4,31,12,137,5,31,12,137,5,31,12,137,5,31,12,137,
-+ 5,31,12,137,5,31,12,130,1,12,31,10,129,5,31,12,130,11,31,13,1,129,5,31,
-+ 12,129,10,31,14,3,130,5,31,12,128,8,47,5,131,5,31,12,6,47,9,132,5,31,
-+ 14,63,9,132,5,127,2,131,5,63,7,8,31,8,131,5,47,9,128,2,31,14,1,130,
-+ 5,31,13,130,10,31,7,130,5,31,12,130,4,31,14,130,5,31,12,131,12,31,6,129,
-+ 5,31,12,131,6,31,13,129,4,31,12,132,13,31,5,128,4,31,12,129,5,31,12,129,
-+ 5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,
-+ 5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,
-+ 5,31,12,129,5,31,12,129,5,31,12,129,5,31,12,129,4,31,12,128,128,4,31,12,
-+ 2,10,14,15,13,8,1,128,2,10,14,15,13,8,1,130,5,31,30,79,12,3,14,79,
-+ 12,1,129,5,63,13,11,14,79,13,11,14,47,7,129,5,47,7,129,2,13,47,8,129,
-+ 1,13,31,11,129,5,31,14,131,7,31,14,131,6,31,13,129,5,31,12,131,4,31,13,
-+ 131,4,31,13,129,5,31,12,131,4,31,12,131,4,31,13,129,5,31,12,131,4,31,12,
-+ 131,4,31,13,129,5,31,12,131,4,31,12,131,4,31,13,129,5,31,12,131,4,31,12,
-+ 131,4,31,13,129,5,31,12,131,4,31,12,131,4,31,13,129,5,31,12,131,4,31,12,
-+ 131,4,31,13,129,5,31,12,131,4,31,12,131,4,31,13,129,4,31,12,131,4,31,12,
-+ 131,3,31,13,128,128,4,31,12,3,10,14,15,13,8,1,131,5,31,30,79,13,1,130,
-+ 5,63,13,11,14,47,9,130,5,47,9,129,1,11,31,14,130,5,31,14,131,3,47,1,
-+ 129,5,31,12,131,1,47,1,129,5,31,12,132,47,1,129,5,31,12,132,47,1,129,5,
-+ 31,12,132,47,1,129,5,31,12,132,47,1,129,5,31,12,132,47,1,129,5,31,12,132,
-+ 47,1,129,5,31,12,132,47,1,129,4,31,12,132,47,1,128,131,5,11,14,15,14,11,
-+ 4,134,9,111,9,132,8,47,13,11,13,47,7,130,2,47,8,130,8,31,14,1,129,6,
-+ 31,13,132,13,31,6,129,9,31,8,132,8,31,9,129,11,31,7,132,7,31,10,129,10,
-+ 31,7,132,7,31,10,129,9,31,8,132,9,31,9,129,6,31,13,132,13,31,5,129,1,
-+ 14,31,8,130,8,31,14,1,130,7,47,13,11,13,47,7,132,9,111,8,134,4,10,14,
-+ 15,14,11,4,131,128,2,31,14,2,10,30,12,7,1,131,3,47,14,79,13,1,130,3,
-+ 63,14,11,13,47,11,130,3,47,13,2,129,6,47,4,129,3,47,6,131,12,31,8,129,
-+ 3,47,2,131,7,31,11,129,3,47,1,131,6,31,12,129,3,47,1,131,6,31,12,129,
-+ 3,47,2,131,8,31,11,129,3,47,6,131,13,31,9,129,3,47,13,2,129,7,47,4,
-+ 129,3,63,14,11,13,47,12,130,3,47,13,79,13,2,130,3,31,14,2,10,30,12,8,
-+ 1,131,3,31,14,138,3,31,14,138,3,31,14,138,3,31,14,138,2,31,14,137,131,6,
-+ 12,30,11,3,11,31,5,130,1,11,95,14,31,5,130,9,47,13,11,14,63,5,129,1,
-+ 47,8,129,1,11,47,5,129,6,31,14,131,3,47,5,129,8,31,10,132,14,31,5,129,
-+ 10,31,8,132,13,31,5,129,10,31,9,132,13,31,5,129,9,31,10,132,14,31,5,129,
-+ 6,31,14,1,130,3,47,5,129,2,47,9,129,1,11,47,5,130,9,47,13,11,14,63,
-+ 5,130,1,12,79,30,31,5,132,6,12,30,11,3,12,31,5,138,12,31,5,138,12,31,
-+ 5,138,12,31,5,138,12,31,5,138,11,31,5,128,128,4,31,12,3,11,30,9,128,5,
-+ 31,30,47,9,128,5,63,14,11,12,5,128,5,47,10,132,5,47,1,132,5,31,13,133,
-+ 5,31,12,133,5,31,12,133,5,31,12,133,5,31,12,133,5,31,12,133,5,31,12,133,
-+ 5,31,12,133,4,31,12,132,130,5,11,14,15,14,12,7,132,10,111,13,1,129,6,47,
-+ 13,11,12,47,10,129,10,31,8,130,3,47,1,128,10,31,6,131,6,24,1,128,5,47,
-+ 10,5,1,134,7,79,11,6,133,2,8,13,63,13,3,134,2,7,13,31,13,1,128,7,
-+ 25,1,131,13,31,4,128,12,31,8,130,3,14,31,4,128,7,47,14,11,12,47,14,1,
-+ 129,10,127,5,131,5,10,13,15,14,13,9,2,129,129,1,7,8,5,133,3,31,12,133,
-+ 3,31,12,133,3,31,12,131,3,111,14,128,3,127,128,2,11,12,31,14,27,10,130,3,
-+ 31,12,133,3,31,12,133,3,31,12,133,3,31,12,133,3,31,12,133,3,31,12,133,3,
-+ 31,12,133,3,31,14,1,132,2,47,14,11,8,131,12,63,12,131,1,9,13,31,11,128,
-+ 128,7,31,9,131,2,31,14,130,7,31,10,131,3,31,14,130,7,31,10,131,3,31,14,
-+ 130,7,31,10,131,3,31,14,130,7,31,10,131,3,31,14,130,7,31,10,131,3,31,14,
-+ 130,7,31,10,131,3,31,14,130,7,31,10,131,3,31,14,130,7,31,10,131,3,31,14,
-+ 130,7,31,12,131,5,31,14,130,6,47,5,129,2,13,31,14,130,1,63,12,11,14,47,
-+ 14,131,6,95,13,31,14,132,4,10,14,15,13,8,3,31,14,129,3,47,2,131,8,31,
-+ 12,129,14,31,7,131,13,31,8,129,9,31,11,130,2,47,3,129,4,47,1,129,6,31,
-+ 13,131,14,31,5,129,11,31,9,131,9,31,9,129,14,31,4,131,5,31,13,128,4,31,
-+ 14,133,14,31,2,8,31,9,133,10,31,7,13,31,4,133,5,31,13,31,14,134,1,14,
-+ 63,10,135,10,63,5,135,5,47,14,136,1,14,31,10,132,3,31,14,131,5,31,10,131,
-+ 6,31,11,129,14,31,3,130,10,31,14,131,10,31,7,129,10,31,7,130,13,47,4,130,
-+ 14,31,3,129,6,31,11,129,2,63,7,129,3,31,13,130,2,31,14,129,6,63,11,129,
-+ 7,31,9,131,12,31,3,128,10,31,13,31,1,128,11,31,5,131,8,31,7,128,14,15,
-+ 12,7,31,4,128,14,31,1,131,4,31,10,3,31,8,3,31,8,4,31,11,133,14,15,
-+ 14,7,31,4,128,13,15,12,8,31,7,133,10,31,13,31,1,128,9,31,13,31,2,133,
-+ 6,63,11,129,5,63,13,134,1,63,7,129,1,63,9,135,12,47,3,130,11,47,4,135,
-+ 7,31,14,131,7,31,14,1,131,3,31,14,3,131,6,47,2,128,8,31,12,130,2,14,
-+ 31,7,129,1,13,31,7,129,10,31,12,131,3,31,14,2,5,47,3,132,8,31,11,14,
-+ 31,7,133,1,13,63,12,135,3,63,3,135,2,47,14,2,135,12,63,11,134,7,31,14,
-+ 13,31,6,132,3,47,6,4,31,14,2,131,12,31,10,129,9,31,12,130,8,31,14,1,
-+ 129,1,13,31,7,128,2,47,5,131,3,47,2,5,31,13,132,9,31,8,1,47,3,131,
-+ 14,31,3,128,10,31,7,130,3,31,13,129,5,31,12,130,8,31,8,129,1,47,1,129,
-+ 12,31,3,130,10,31,5,128,1,31,13,131,5,31,10,128,5,31,8,131,1,14,15,14,
-+ 128,10,31,3,132,10,31,3,14,15,13,133,5,31,11,31,8,133,1,14,63,3,134,10,
-+ 47,13,135,5,47,8,135,1,47,3,135,3,31,12,136,11,31,6,133,7,10,13,31,14,
-+ 1,133,12,63,5,134,11,14,13,10,3,134,1,127,31,5,2,127,31,5,1,10,75,13,
-+ 47,5,133,1,13,31,11,134,12,31,13,1,133,10,31,14,2,133,7,47,4,133,5,47,
-+ 6,133,3,14,31,9,133,1,13,31,11,134,11,31,13,1,133,3,47,13,91,20,127,31,
-+ 7,3,127,31,6,130,2,11,14,31,8,130,12,63,8,129,2,47,14,11,5,129,3,47,
-+ 2,131,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,4,31,
-+ 13,132,10,31,11,130,1,14,47,5,130,1,47,10,131,1,12,47,6,132,9,31,12,132,
-+ 4,31,13,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,3,31,14,132,
-+ 3,47,2,131,2,47,14,11,5,130,12,63,8,130,2,11,14,31,8,128,47,2,128,47,
-+ 2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,
-+ 2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,
-+ 2,128,47,2,128,47,2,128,47,2,128,47,2,128,47,2,1,47,13,6,130,1,79,4,
-+ 129,1,10,12,47,8,132,11,31,10,132,7,31,10,132,7,31,10,132,7,31,10,132,7,
-+ 31,10,132,7,31,10,132,7,31,11,132,5,47,3,131,1,13,47,6,131,4,47,8,130,
-+ 1,14,31,14,5,130,5,31,14,1,131,7,31,11,132,7,31,10,132,7,31,10,132,7,
-+ 31,10,132,7,31,10,132,7,31,10,132,11,31,10,130,10,12,47,8,129,1,79,4,129,
-+ 1,47,13,6,130,129,5,12,14,13,9,3,129,4,10,2,129,6,95,28,31,14,1,128,
-+ 14,31,11,12,95,8,129,3,11,3,129,2,8,13,15,13,6,213,128,3,13,14,5,129,
-+ 11,31,13,129,11,31,13,129,3,13,14,5,164,129,3,10,30,11,4,130,4,95,6,129,
-+ 13,15,11,3,2,8,31,2,4,15,13,131,11,15,7,6,15,11,131,8,15,8,4,15,
-+ 13,131,11,15,6,128,13,15,11,3,2,8,31,2,128,4,14,79,6,130,3,10,30,11,
-+ 4,255,131,129,4,1,131,18,130,5,15,12,1,129,2,13,14,2,129,13,31,12,1,2,
-+ 13,31,10,129,2,13,31,12,13,31,11,1,130,2,13,63,11,1,132,3,63,2,132,2,
-+ 13,63,12,1,130,2,13,31,12,13,31,12,1,129,12,31,11,1,2,13,31,9,129,3,
-+ 14,11,1,129,2,29,2,130,3,1,131,17,165,1,10,123,11,7,128,2,127,31,11,128,
-+ 2,127,31,11,206,1,10,123,91,10,1,2,127,127,3,2,127,127,2,235,128,6,31,9,
-+ 128,11,31,4,1,31,13,128,4,31,7,128,9,31,2,128,12,15,10,194,129,9,14,11,
-+ 1,130,2,12,14,6,131,8,14,12,1,129,4,47,6,130,10,47,130,2,47,7,129,4,
-+ 47,6,130,10,31,14,130,2,47,7,130,9,14,11,1,130,2,13,14,6,131,8,14,11,
-+ 1,128,129,7,13,15,11,2,129,7,63,13,1,128,14,79,6,2,95,8,128,14,79,6,
-+ 128,7,63,13,1,129,7,13,14,11,2,160,130,1,13,15,14,1,131,10,31,5,131,6,
-+ 31,9,131,2,14,15,13,1,131,9,31,5,132,2,14,15,12,133,6,31,9,133,10,31,
-+ 5,132,1,13,15,14,1,155,129,10,31,5,133,1,14,15,14,1,133,4,31,10,134,9,
-+ 31,6,133,1,31,13,133,8,31,6,132,4,31,11,132,1,13,15,14,1,132,9,31,5,
-+ 161,
-+};
-+static const struct fos_glyph lg_glyphs[] = {
-+ { 0, 5, 0, 0, 0, 86 }, /* 0x20 */
-+ { 0, 9, 19, 0, -19, 145 }, /* 0x21 */
-+ { 67, 9, 19, 0, -19, 140 }, /* 0x22 */
-+ { 110, 18, 19, 0, -19, 292 }, /* 0x23 */
-+ { 250, 15, 24, 0, -22, 245 }, /* 0x24 */
-+ { 401, 22, 19, 0, -19, 360 }, /* 0x25 */
-+ { 602, 19, 19, 0, -19, 297 }, /* 0x26 */
-+ { 774, 4, 19, 0, -19, 67 }, /* 0x27 */
-+ { 793, 10, 23, -1, -20, 137 }, /* 0x28 */
-+ { 883, 9, 23, 0, -20, 137 }, /* 0x29 */
-+ { 977, 11, 21, 0, -21, 172 }, /* 0x2a */
-+ { 1054, 13, 14, 0, -14, 212 }, /* 0x2b */
-+ { 1100, 7, 7, 0, -5, 114 }, /* 0x2c */
-+ { 1128, 11, 10, 0, -10, 175 }, /* 0x2d */
-+ { 1141, 7, 4, 0, -4, 118 }, /* 0x2e */
-+ { 1160, 12, 19, 0, -19, 193 }, /* 0x2f */
-+ { 1239, 15, 19, 0, -19, 245 }, /* 0x30 */
-+ { 1391, 10, 19, 0, -19, 152 }, /* 0x31 */
-+ { 1474, 15, 19, 0, -19, 238 }, /* 0x32 */
-+ { 1593, 14, 19, 0, -19, 229 }, /* 0x33 */
-+ { 1711, 16, 19, 0, -19, 253 }, /* 0x34 */
-+ { 1812, 14, 19, 0, -19, 229 }, /* 0x35 */
-+ { 1931, 14, 19, 0, -19, 229 }, /* 0x36 */
-+ { 2075, 13, 19, 0, -19, 211 }, /* 0x37 */
-+ { 2161, 14, 19, 0, -19, 230 }, /* 0x38 */
-+ { 2306, 14, 19, 0, -19, 228 }, /* 0x39 */
-+ { 2453, 10, 13, 0, -13, 153 }, /* 0x3a */
-+ { 2490, 8, 15, 0, -13, 136 }, /* 0x3b */
-+ { 2537, 13, 14, 0, -14, 212 }, /* 0x3c */
-+ { 2612, 13, 13, 0, -13, 212 }, /* 0x3d */
-+ { 2638, 13, 14, 0, -14, 212 }, /* 0x3e */
-+ { 2710, 14, 19, 0, -19, 216 }, /* 0x3f */
-+ { 2806, 22, 20, 0, -18, 355 }, /* 0x40 */
-+ { 3052, 18, 19, 0, -19, 280 }, /* 0x41 */
-+ { 3181, 17, 19, 0, -19, 269 }, /* 0x42 */
-+ { 3305, 16, 19, 0, -19, 263 }, /* 0x43 */
-+ { 3440, 17, 19, 0, -19, 267 }, /* 0x44 */
-+ { 3566, 16, 19, 0, -19, 256 }, /* 0x45 */
-+ { 3635, 15, 19, 0, -19, 243 }, /* 0x46 */
-+ { 3700, 17, 19, 0, -19, 265 }, /* 0x47 */
-+ { 3847, 17, 19, 0, -19, 275 }, /* 0x48 */
-+ { 3974, 7, 19, 0, -19, 113 }, /* 0x49 */
-+ { 4032, 16, 19, 0, -19, 251 }, /* 0x4a */
-+ { 4140, 17, 19, 0, -19, 268 }, /* 0x4b */
-+ { 4271, 15, 19, 0, -19, 247 }, /* 0x4c */
-+ { 4332, 19, 19, 0, -19, 309 }, /* 0x4d */
-+ { 4497, 18, 19, 0, -19, 289 }, /* 0x4e */
-+ { 4651, 17, 19, 0, -19, 268 }, /* 0x4f */
-+ { 4806, 16, 19, 0, -19, 257 }, /* 0x50 */
-+ { 4925, 16, 22, 0, -19, 254 }, /* 0x51 */
-+ { 5092, 17, 19, 0, -19, 265 }, /* 0x52 */
-+ { 5217, 16, 19, 0, -19, 255 }, /* 0x53 */
-+ { 5367, 16, 19, 0, -19, 250 }, /* 0x54 */
-+ { 5450, 17, 19, 0, -19, 275 }, /* 0x55 */
-+ { 5606, 16, 19, 0, -19, 264 }, /* 0x56 */
-+ { 5738, 24, 19, 0, -19, 379 }, /* 0x57 */
-+ { 5959, 17, 19, 0, -19, 266 }, /* 0x58 */
-+ { 6100, 16, 19, 0, -19, 259 }, /* 0x59 */
-+ { 6212, 15, 19, 0, -19, 239 }, /* 0x5a */
-+ { 6298, 11, 25, 0, -21, 174 }, /* 0x5b */
-+ { 6400, 12, 19, 0, -19, 193 }, /* 0x5c */
-+ { 6477, 11, 25, 0, -21, 174 }, /* 0x5d */
-+ { 6558, 13, 19, 0, -19, 201 }, /* 0x5e */
-+ { 6634, 14, 3, 0, -3, 220 }, /* 0x5f */
-+ { 6647, 6, 19, 0, -19, 95 }, /* 0x60 */
-+ { 6661, 14, 14, 0, -14, 226 }, /* 0x61 */
-+ { 6773, 15, 19, 0, -19, 241 }, /* 0x62 */
-+ { 6907, 14, 14, 0, -14, 229 }, /* 0x63 */
-+ { 7003, 15, 19, 0, -19, 241 }, /* 0x64 */
-+ { 7139, 15, 14, 0, -14, 234 }, /* 0x65 */
-+ { 7237, 10, 19, 0, -19, 162 }, /* 0x66 */
-+ { 7316, 15, 19, 0, -14, 237 }, /* 0x67 */
-+ { 7458, 15, 19, 0, -19, 235 }, /* 0x68 */
-+ { 7586, 7, 20, 0, -20, 110 }, /* 0x69 */
-+ { 7653, 9, 25, -2, -20, 108 }, /* 0x6a */
-+ { 7759, 14, 19, 0, -19, 226 }, /* 0x6b */
-+ { 7887, 6, 19, 0, -19, 103 }, /* 0x6c */
-+ { 7964, 22, 14, 0, -14, 358 }, /* 0x6d */
-+ { 8141, 15, 14, 0, -14, 235 }, /* 0x6e */
-+ { 8249, 15, 14, 0, -14, 240 }, /* 0x6f */
-+ { 8357, 15, 19, 0, -14, 243 }, /* 0x70 */
-+ { 8494, 15, 19, 0, -14, 243 }, /* 0x71 */
-+ { 8630, 10, 14, 0, -14, 162 }, /* 0x72 */
-+ { 8696, 13, 14, 0, -14, 213 }, /* 0x73 */
-+ { 8798, 10, 18, 0, -18, 162 }, /* 0x74 */
-+ { 8880, 15, 14, 0, -14, 234 }, /* 0x75 */
-+ { 8994, 14, 14, 0, -14, 218 }, /* 0x76 */
-+ { 9088, 21, 14, 0, -14, 329 }, /* 0x77 */
-+ { 9249, 14, 14, 0, -14, 223 }, /* 0x78 */
-+ { 9349, 13, 19, 0, -14, 211 }, /* 0x79 */
-+ { 9468, 12, 14, 0, -14, 197 }, /* 0x7a */
-+ { 9533, 9, 25, 0, -21, 151 }, /* 0x7b */
-+ { 9643, 5, 23, 0, -21, 82 }, /* 0x7c */
-+ { 9712, 9, 25, 0, -21, 151 }, /* 0x7d */
-+ { 9821, 14, 10, 0, -10, 226 }, /* 0x7e */
-+ { 9858, 6, 10, 0, -10, 98 }, /* 0x80 */
-+ { 9877, 10, 22, 0, -22, 163 }, /* 0x81 */
-+ { 9939, 12, 14, 0, -14, 189 }, /* 0x82 */
-+ { 10021, 13, 9, 0, -9, 202 }, /* 0x83 */
-+ { 10037, 18, 9, 0, -9, 289 }, /* 0x84 */
-+ { 10052, 5, 19, 0, -19, 78 }, /* 0x85 */
-+ { 10076, 22, 4, 0, -4, 359 }, /* 0x86 */
-+ { 10130, 8, 11, 0, -11, 136 }, /* 0x87 */
-+ { 10164, 9, 12, 0, -12, 149 }, /* 0x88 */
-+ { 10208, 10, 12, 0, -12, 159 }, /* 0x89 */
-+};
-+static const uint8_t lg_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern lg_kern[] = {
-+ {39,45,-22},{39,52,-7},{39,65,-34},{39,74,-22},{39,97,-5},{39,99,-22},{39,100,-22},{39,101,-22},
-+ {39,103,-15},{39,109,-6},{39,110,-6},{39,111,-22},{39,112,-6},{39,113,-15},{39,114,-6},{39,115,-10},
-+ {44,45,-6},{44,48,-13},{44,84,-25},{44,86,-12},{44,87,-12},{44,89,-25},{44,99,-6},{44,100,-6},
-+ {44,101,-6},{44,102,-4},{44,103,-6},{44,111,-6},{44,113,-6},{44,116,-4},{44,118,-17},{44,119,-17},
-+ {44,121,-17},{45,39,-10},{45,44,-6},{45,45,-60},{45,46,-6},{45,55,-27},{45,84,-14},{45,102,-5},
-+ {45,116,-5},{45,118,-11},{45,119,-11},{45,120,-10},{45,121,-11},{45,133,-11},{46,45,-6},{46,48,-13},
-+ {46,84,-25},{46,86,-12},{46,87,-12},{46,89,-25},{46,99,-6},{46,100,-6},{46,101,-6},{46,102,-4},
-+ {46,103,-6},{46,111,-6},{46,113,-6},{46,116,-4},{46,118,-17},{46,119,-17},{46,121,-17},{48,49,-7},
-+ {50,49,-4},{50,51,-5},{52,39,-12},{52,49,-41},{52,55,-25},{53,49,-7},{54,49,-5},{55,44,-25},
-+ {55,46,-25},{56,49,-7},{57,49,-9},{65,39,-38},{65,45,-7},{65,67,-8},{65,71,-8},{65,79,-8},
-+ {65,81,-8},{65,83,-18},{65,84,-34},{65,85,-5},{65,86,-13},{65,87,-13},{65,89,-35},{65,90,6},
-+ {65,99,-7},{65,100,-7},{65,101,-7},{65,102,-10},{65,103,-9},{65,111,-7},{65,113,-9},{65,116,-10},
-+ {65,118,-19},{65,119,-19},{65,121,-19},{65,133,-29},{66,44,-4},{66,46,-4},{66,65,-14},{66,84,-7},
-+ {66,86,-10},{66,87,-10},{66,88,-10},{66,89,-14},{66,102,-4},{66,103,-6},{66,113,-6},{66,115,-5},
-+ {66,116,-4},{66,117,-4},{67,65,-4},{67,74,6},{67,86,-5},{67,87,-5},{67,89,-10},{67,103,-4},
-+ {67,113,-4},{68,44,-4},{68,46,-4},{68,65,-14},{68,84,-7},{68,86,-10},{68,87,-10},{68,88,-10},
-+ {68,89,-14},{68,102,-4},{68,103,-6},{68,113,-6},{68,115,-5},{68,116,-4},{68,117,-4},{69,86,4},
-+ {69,87,4},{70,44,-36},{70,45,-22},{70,46,-36},{70,65,-29},{70,74,-23},{70,97,-19},{70,99,-22},
-+ {70,100,-22},{70,101,-22},{70,103,-16},{70,109,-10},{70,110,-10},{70,111,-22},{70,112,-10},{70,113,-16},
-+ {70,114,-10},{70,115,-19},{70,117,-12},{70,118,-21},{70,119,-21},{70,120,-19},{70,121,-21},{70,122,-10},
-+ {71,65,-4},{71,74,6},{71,86,-5},{71,87,-5},{71,89,-10},{71,103,-4},{71,113,-4},{74,44,-4},
-+ {74,46,-4},{74,65,-6},{74,67,-4},{74,71,-4},{74,79,-4},{74,81,-4},{75,45,-12},{75,65,7},
-+ {75,67,-10},{75,71,-10},{75,74,-8},{75,79,-10},{75,81,-10},{75,83,-7},{75,99,-12},{75,100,-12},
-+ {75,101,-12},{75,103,-10},{75,111,-12},{75,113,-10},{75,115,-5},{75,118,-17},{75,119,-17},{75,121,-17},
-+ {76,39,-34},{76,65,11},{76,84,-37},{76,86,-16},{76,87,-16},{76,89,-18},{76,102,-7},{76,116,-7},
-+ {76,118,-10},{76,119,-10},{76,121,-10},{76,122,5},{76,133,-21},{78,66,-4},{78,68,-4},{78,69,-4},
-+ {78,70,-4},{78,78,-4},{78,80,-4},{79,65,-4},{79,74,6},{79,86,-5},{79,87,-5},{79,89,-10},
-+ {79,103,-4},{79,113,-4},{80,44,-10},{80,45,-11},{80,46,-10},{80,65,-19},{80,74,-10},{80,86,-6},
-+ {80,87,-6},{80,88,-12},{80,89,-12},{80,99,-11},{80,100,-11},{80,101,-11},{80,103,-7},{80,111,-11},
-+ {80,113,-7},{80,115,-6},{81,65,-10},{81,74,6},{81,84,-5},{81,86,-12},{81,87,-12},{81,88,-12},
-+ {81,89,-20},{81,103,-4},{81,113,-4},{82,65,10},{82,86,-7},{82,87,-7},{82,89,-10},{83,44,-4},
-+ {83,46,-4},{83,84,-6},{83,86,-7},{83,87,-7},{83,88,-14},{83,89,-10},{84,44,-25},{84,45,-34},
-+ {84,46,-25},{84,65,-26},{84,67,-15},{84,71,-15},{84,74,-17},{84,79,-15},{84,81,-15},{84,97,-12},
-+ {84,99,-34},{84,100,-34},{84,101,-34},{84,103,-26},{84,105,-4},{84,109,-24},{84,110,-24},{84,111,-34},
-+ {84,112,-24},{84,113,-26},{84,114,-24},{84,115,-25},{84,117,-20},{84,118,-21},{84,119,-21},{84,120,-22},
-+ {84,121,-21},{85,44,-4},{85,46,-4},{85,65,-6},{85,67,-4},{85,71,-4},{85,79,-4},{85,81,-4},
-+ {86,44,-26},{86,45,-25},{86,46,-26},{86,65,-42},{86,66,-4},{86,67,-13},{86,68,-4},{86,69,-4},
-+ {86,70,-4},{86,71,-13},{86,74,-17},{86,75,-7},{86,78,-4},{86,79,-13},{86,80,-4},{86,81,-13},
-+ {86,83,-7},{86,97,-24},{86,99,-25},{86,100,-25},{86,101,-25},{86,103,-23},{86,109,-6},{86,110,-6},
-+ {86,111,-25},{86,112,-6},{86,113,-23},{86,114,-6},{86,115,-16},{86,117,-7},{86,118,-7},{86,119,-7},
-+ {86,121,-7},{87,44,-26},{87,45,-25},{87,46,-26},{87,65,-42},{87,66,-4},{87,67,-13},{87,68,-4},
-+ {87,69,-4},{87,70,-4},{87,71,-13},{87,74,-17},{87,75,-7},{87,78,-4},{87,79,-13},{87,80,-4},
-+ {87,81,-13},{87,83,-7},{87,97,-24},{87,99,-25},{87,100,-25},{87,101,-25},{87,103,-23},{87,109,-6},
-+ {87,110,-6},{87,111,-25},{87,112,-6},{87,113,-23},{87,114,-6},{87,115,-16},{87,117,-7},{87,118,-7},
-+ {87,119,-7},{87,121,-7},{88,45,-13},{88,67,-10},{88,71,-10},{88,74,-5},{88,79,-10},{88,81,-10},
-+ {88,83,-11},{88,97,-7},{88,99,-13},{88,100,-13},{88,101,-13},{88,103,-14},{88,111,-13},{88,113,-14},
-+ {88,118,-12},{88,119,-12},{88,121,-12},{89,44,-39},{89,45,-32},{89,46,-39},{89,65,-47},{89,66,-4},
-+ {89,67,-14},{89,68,-4},{89,69,-4},{89,70,-4},{89,71,-14},{89,74,-23},{89,78,-4},{89,79,-14},
-+ {89,80,-4},{89,81,-14},{89,83,-10},{89,97,-25},{89,99,-32},{89,100,-32},{89,101,-32},{89,102,-16},
-+ {89,103,-36},{89,109,-22},{89,110,-22},{89,111,-32},{89,112,-22},{89,113,-36},{89,114,-22},{89,115,-19},
-+ {89,116,-16},{89,117,-16},{89,118,-16},{89,119,-16},{89,120,-16},{89,121,-16},{89,122,-10},{97,39,-10},
-+ {97,84,-12},{97,89,-15},{97,118,-5},{97,119,-5},{97,121,-5},{97,133,-7},{98,39,-16},{98,44,-6},
-+ {98,46,-6},{98,118,-8},{98,119,-8},{98,121,-8},{98,133,-5},{99,39,-10},{99,44,-10},{99,46,-10},
-+ {99,118,-4},{99,119,-4},{99,120,-7},{99,121,-4},{99,133,-7},{101,39,-15},{101,44,-9},{101,46,-9},
-+ {101,102,-4},{101,116,-4},{101,118,-10},{101,119,-10},{101,120,-9},{101,121,-10},{101,133,-10},{102,39,4},
-+ {102,44,-22},{102,45,-16},{102,46,-22},{102,97,-5},{102,99,-16},{102,100,-16},{102,101,-16},{102,103,-12},
-+ {102,111,-16},{102,113,-12},{102,115,-6},{102,133,6},{103,39,-4},{104,39,-16},{104,44,-6},{104,46,-6},
-+ {104,118,-8},{104,119,-8},{104,121,-8},{104,133,-5},{107,45,-16},{107,97,-7},{107,99,-16},{107,100,-16},
-+ {107,101,-16},{107,103,-11},{107,111,-16},{107,113,-11},{109,39,-16},{109,44,-6},{109,46,-6},{109,118,-8},
-+ {109,119,-8},{109,121,-8},{109,133,-5},{110,39,-16},{110,44,-6},{110,46,-6},{110,118,-8},{110,119,-8},
-+ {110,121,-8},{110,133,-5},{111,39,-10},{111,44,-6},{111,46,-6},{111,55,-27},{111,84,-14},{111,102,-5},
-+ {111,116,-5},{111,118,-11},{111,119,-11},{111,120,-10},{111,121,-11},{111,133,-11},{112,39,-16},{112,44,-6},
-+ {112,46,-6},{112,118,-8},{112,119,-8},{112,121,-8},{112,133,-5},{113,39,-4},{114,39,10},{114,44,-16},
-+ {114,45,-4},{114,46,-16},{114,99,-4},{114,100,-4},{114,101,-4},{114,102,4},{114,103,-8},{114,111,-4},
-+ {114,113,-8},{114,116,4},{114,118,7},{114,119,7},{114,121,7},{114,133,21},{115,39,-7},{115,115,-4},
-+ {115,118,-15},{115,119,-15},{115,120,-5},{115,121,-15},{115,133,-10},{116,45,-4},{116,99,-4},{116,100,-4},
-+ {116,101,-4},{116,111,-4},{118,44,-17},{118,45,-12},{118,46,-17},{118,97,-10},{118,99,-12},{118,100,-12},
-+ {118,101,-12},{118,103,-13},{118,111,-12},{118,113,-13},{118,115,-15},{118,133,17},{119,44,-17},{119,45,-12},
-+ {119,46,-17},{119,97,-10},{119,99,-12},{119,100,-12},{119,101,-12},{119,103,-13},{119,111,-12},{119,113,-13},
-+ {119,115,-15},{119,133,17},{120,45,-13},{120,99,-13},{120,100,-13},{120,101,-13},{120,103,-10},{120,111,-13},
-+ {120,113,-10},{121,44,-17},{121,45,-12},{121,46,-17},{121,97,-10},{121,99,-12},{121,100,-12},{121,101,-12},
-+ {121,103,-13},{121,111,-12},{121,113,-13},{121,115,-15},{121,133,17},{133,45,-36},{133,65,-29},{133,97,-7},
-+ {133,99,-36},{133,100,-36},{133,101,-36},{133,102,-5},{133,103,-32},{133,111,-36},{133,113,-32},{133,115,-29},
-+ {133,116,-5},{133,118,-7},{133,119,-7},{133,120,-5},{133,121,-7},
-+};
-+const struct fos_font fos_font_lg_data = { lg_bits, lg_glyphs, lg_lut, lg_kern, 589, 27, 6 };
-+
-+static const uint8_t xl_bits[] = {
-+ 130,2,14,63,7,133,3,79,9,133,2,79,8,133,2,79,8,133,1,79,7,133,1,79,
-+ 7,133,1,79,7,134,79,6,134,79,6,134,14,63,6,134,14,63,5,134,14,63,5,134,
-+ 13,63,4,134,13,63,4,134,12,63,4,134,12,63,3,134,11,63,3,134,11,63,3,134,
-+ 11,63,2,134,10,63,2,134,10,63,1,134,9,63,1,134,7,47,14,200,3,11,14,13,
-+ 8,134,3,79,9,133,9,95,1,132,11,95,3,132,9,95,1,132,2,79,9,134,3,11,
-+ 14,13,8,131,1,14,63,4,128,1,14,63,4,1,79,4,128,1,79,4,128,79,4,129,
-+ 79,4,128,14,63,3,129,14,63,3,128,13,63,2,129,13,63,2,128,13,63,1,129,13,
-+ 63,1,128,12,63,1,129,12,63,1,128,11,63,130,11,63,129,10,47,14,130,10,47,14,
-+ 129,10,47,13,130,10,47,13,129,7,47,11,130,7,47,11,255,255,232,135,2,14,63,8,
-+ 132,8,79,2,138,4,79,8,132,11,79,1,138,7,79,6,132,13,63,14,139,9,79,3,
-+ 131,1,79,12,139,11,79,1,131,3,79,10,139,13,63,14,132,5,79,7,139,79,12,132,
-+ 7,79,5,138,3,79,10,132,10,79,3,134,2,14,127,127,111,3,131,3,127,127,127,4,
-+ 131,3,127,127,127,4,131,3,127,127,127,4,131,2,127,127,127,3,134,1,79,11,132,8,
-+ 79,4,138,3,79,9,132,10,79,2,138,5,79,7,132,12,79,139,7,79,5,132,14,63,
-+ 13,139,9,79,3,131,1,79,11,139,11,79,1,131,3,79,9,139,13,63,14,132,5,79,
-+ 8,135,12,127,127,111,7,132,14,127,127,111,8,132,14,127,127,111,8,132,14,127,127,111,
-+ 8,132,12,127,127,111,7,135,12,79,1,131,4,79,8,139,14,63,13,132,6,79,6,138,
-+ 2,79,10,132,8,79,4,138,4,79,8,132,11,79,1,138,6,79,6,132,13,63,14,139,
-+ 9,79,3,131,1,79,12,139,11,79,1,131,3,79,9,139,5,55,6,132,1,71,3,165,
-+ 135,3,47,13,144,4,63,144,4,47,14,144,4,47,14,142,2,7,12,63,9,4,138,1,
-+ 9,127,15,12,3,135,1,13,127,47,14,4,134,12,127,79,14,3,132,6,127,111,12,132,
-+ 13,79,12,3,128,2,8,95,4,130,2,79,14,1,131,8,79,9,130,5,79,8,132,1,
-+ 79,12,130,6,79,5,133,13,63,14,130,6,79,5,133,11,63,14,130,4,79,8,133,10,
-+ 63,13,130,1,79,14,1,142,11,79,11,1,141,4,95,12,2,141,9,95,14,4,140,1,
-+ 12,111,8,140,1,12,111,12,2,139,1,10,111,14,4,140,7,127,6,140,3,13,111,7,
-+ 140,1,10,111,5,141,6,14,79,14,1,141,3,14,79,8,142,4,79,13,130,2,11,60,
-+ 4,133,12,79,1,129,4,79,7,133,8,79,2,129,4,79,8,133,9,79,3,129,3,79,
-+ 11,133,11,79,1,129,1,95,4,131,4,79,14,131,11,79,14,5,17,6,14,79,10,131,
-+ 5,127,127,4,132,11,127,95,10,133,2,13,127,63,12,1,134,2,11,127,31,10,1,137,
-+ 5,11,14,63,14,10,4,141,4,63,1,143,3,63,1,143,4,63,1,143,3,47,14,1,
-+ 135,133,2,7,12,30,13,9,3,139,11,47,5,140,6,14,111,10,1,136,4,47,13,140,
-+ 7,127,31,12,1,135,12,47,6,139,4,47,13,5,1,128,3,10,47,9,134,6,47,12,
-+ 140,11,31,12,1,132,8,47,2,133,13,47,5,139,1,47,3,134,13,31,7,132,7,47,
-+ 12,140,3,31,14,135,9,31,9,131,1,14,47,4,140,3,31,14,135,9,31,9,131,8,
-+ 47,10,141,1,47,4,134,13,31,7,130,1,14,47,3,142,11,31,12,1,132,8,47,2,
-+ 130,9,47,9,143,4,47,13,5,1,128,3,10,47,9,130,2,63,2,144,7,127,31,12,
-+ 1,130,10,47,8,146,6,14,111,10,1,130,3,47,14,1,147,2,7,12,30,13,9,4,
-+ 132,11,47,7,160,4,47,14,1,160,12,47,6,160,5,47,13,161,13,47,5,160,6,47,
-+ 12,160,1,14,47,4,160,7,47,11,132,6,11,14,15,14,10,5,148,1,14,47,3,130,
-+ 2,12,111,11,1,146,9,47,10,130,2,14,127,15,13,1,144,2,63,2,130,12,31,14,
-+ 7,2,128,2,9,47,10,144,10,47,9,130,6,47,3,132,6,47,2,142,3,47,14,1,
-+ 130,11,31,8,134,11,31,8,142,11,47,7,131,14,31,3,134,6,31,11,141,4,47,14,
-+ 1,131,47,2,134,5,31,12,141,12,47,6,132,14,31,3,134,6,31,11,140,5,47,13,
-+ 133,11,31,8,134,11,31,8,140,13,47,5,133,6,47,4,132,6,47,2,139,6,47,12,
-+ 135,12,31,14,7,2,128,2,9,47,10,139,1,14,47,4,135,2,14,127,15,13,1,139,
-+ 7,47,11,137,2,13,111,11,1,140,13,31,14,3,139,5,11,13,15,13,10,4,134,134,
-+ 1,6,10,13,14,15,13,10,6,146,5,14,127,13,4,143,6,127,63,6,141,3,127,95,
-+ 4,140,11,127,95,13,139,2,95,9,2,1,7,95,5,138,6,79,11,131,8,79,9,138,
-+ 7,79,6,131,2,79,11,138,8,79,4,131,1,79,12,138,6,79,6,131,3,79,11,138,
-+ 3,79,10,131,9,79,8,139,13,79,3,129,4,95,4,139,6,79,12,128,3,14,79,13,
-+ 141,12,79,10,14,95,4,141,2,127,63,7,143,6,127,31,8,145,13,127,7,145,10,127,
-+ 4,145,11,127,15,4,144,10,127,31,13,1,132,1,136,7,127,63,11,131,2,14,10,2,
-+ 133,2,95,12,2,13,79,7,130,10,47,8,1,131,10,79,13,1,128,2,14,79,4,128,
-+ 4,79,7,131,14,79,3,130,5,79,14,2,13,63,14,1,130,3,79,11,132,8,127,47,
-+ 7,131,5,79,7,133,11,127,15,13,132,6,79,7,133,1,13,127,4,132,5,79,10,134,
-+ 3,111,8,133,3,95,3,133,8,111,1,134,14,79,14,6,1,128,2,6,13,127,9,134,
-+ 9,127,127,79,5,133,2,14,127,127,63,14,2,133,4,127,95,12,10,79,11,134,3,12,
-+ 127,31,13,6,129,12,79,7,135,4,9,12,14,15,14,13,11,8,4,131,3,14,63,14,
-+ 129,1,14,63,8,128,1,79,9,129,79,8,129,14,63,7,129,13,63,6,129,13,63,6,
-+ 129,12,63,5,129,11,63,4,129,10,63,3,129,10,63,2,129,7,47,14,1,255,192,132,
-+ 12,63,12,134,7,79,8,133,1,14,79,2,133,7,79,11,134,13,79,6,133,4,95,1,
-+ 133,9,79,11,134,14,79,7,133,4,95,3,133,8,79,14,134,12,79,10,134,95,7,133,
-+ 3,95,4,133,5,95,2,133,8,95,134,10,79,13,134,11,79,11,134,13,79,10,134,14,
-+ 79,9,134,14,79,8,134,95,8,134,95,8,134,95,8,134,14,79,8,134,14,79,9,134,
-+ 13,79,10,134,11,79,11,134,10,79,12,134,8,79,14,134,6,95,1,133,4,95,4,133,
-+ 1,95,7,134,12,79,10,134,9,79,13,134,4,95,2,133,1,14,79,6,134,10,79,10,
-+ 134,5,79,14,1,134,14,79,5,134,7,79,10,134,1,14,79,1,134,8,79,8,134,1,
-+ 13,63,12,130,130,12,63,12,135,8,79,7,134,2,79,14,1,134,11,79,7,134,6,79,
-+ 13,134,1,95,4,134,11,79,9,134,7,79,14,134,3,95,4,134,14,79,8,134,11,79,
-+ 12,134,8,95,134,4,95,3,133,2,95,6,134,95,8,134,13,79,10,134,12,79,11,134,
-+ 11,79,13,134,9,79,14,134,9,79,14,134,9,95,134,8,95,134,9,95,134,9,79,14,
-+ 134,10,79,14,134,11,79,12,134,12,79,11,134,13,79,10,134,95,8,133,2,95,5,133,
-+ 5,95,3,133,8,79,14,134,11,79,11,134,14,79,8,133,3,95,3,133,7,79,14,134,
-+ 12,79,9,133,1,95,4,133,6,79,13,134,11,79,6,133,2,79,14,1,133,8,79,6,
-+ 134,12,63,12,132,134,8,31,10,141,10,31,11,141,10,31,11,136,9,6,130,10,31,11,
-+ 130,6,10,130,4,31,12,3,128,10,31,11,128,3,12,31,5,129,12,63,9,11,31,12,
-+ 8,63,13,129,7,14,127,79,7,130,2,10,127,31,11,2,133,4,12,95,13,5,135,2,
-+ 11,95,12,2,134,7,14,127,15,8,1,130,4,13,127,63,13,4,129,13,63,11,12,31,
-+ 12,11,63,14,129,6,31,13,5,128,10,31,11,128,5,14,31,7,130,11,8,1,129,10,
-+ 31,11,129,1,9,12,1,135,10,31,11,141,10,31,11,141,8,31,10,255,255,238,135,2,
-+ 63,2,143,3,63,3,143,3,63,3,143,3,63,3,143,3,63,3,143,3,63,3,143,3,
-+ 63,3,136,8,127,127,31,8,129,10,127,127,31,10,129,10,127,127,31,10,129,10,127,127,
-+ 31,10,129,8,127,127,31,8,136,3,63,3,143,3,63,3,143,3,63,3,143,3,63,3,
-+ 143,3,63,3,143,3,63,3,143,2,63,2,255,161,129,1,14,47,14,131,2,63,13,131,
-+ 4,63,9,131,6,63,6,131,8,63,3,131,10,47,14,132,11,47,11,132,13,47,7,132,
-+ 63,4,131,2,63,1,131,4,47,12,132,4,47,8,131,128,8,127,63,12,129,10,127,63,
-+ 14,129,10,127,63,14,129,10,127,63,14,129,8,127,63,12,255,208,130,7,13,14,12,4,
-+ 132,9,79,3,130,1,95,9,130,3,95,12,130,1,95,9,131,9,79,3,132,7,13,14,
-+ 11,3,130,138,10,63,14,139,1,79,12,139,5,79,8,139,9,79,3,139,14,63,13,139,
-+ 3,79,9,139,8,79,4,139,12,63,14,139,2,79,10,139,7,79,6,139,11,79,1,138,
-+ 1,79,12,139,5,79,7,139,10,79,2,139,14,63,13,139,4,79,8,139,8,79,4,139,
-+ 13,63,14,139,2,79,10,139,7,79,5,139,12,79,1,138,1,79,11,139,6,79,7,139,
-+ 10,79,2,139,14,63,12,139,4,79,8,139,9,79,3,139,13,63,14,139,3,79,9,139,
-+ 8,79,5,139,12,79,1,138,2,79,11,139,6,79,6,139,11,79,2,139,13,63,11,139,
-+ 134,5,10,13,14,15,13,11,7,2,139,4,13,127,15,9,137,6,127,63,12,1,134,4,
-+ 127,95,11,134,13,127,111,6,132,6,95,7,1,128,4,12,79,13,132,11,79,7,131,1,
-+ 14,79,3,131,14,63,14,133,7,79,6,131,79,12,133,4,79,8,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,79,9,130,1,79,11,133,3,
-+ 79,9,130,1,79,11,133,3,79,9,131,79,12,133,4,79,8,131,14,63,14,133,7,79,
-+ 6,131,11,79,7,131,1,14,79,3,131,6,95,7,1,128,4,12,79,13,133,13,127,111,
-+ 6,133,4,127,95,11,135,6,127,63,12,1,136,4,13,127,15,9,140,5,10,13,14,15,
-+ 14,11,7,2,134,130,1,7,13,79,6,130,2,8,14,111,8,129,5,127,31,8,129,7,
-+ 127,31,8,129,6,127,31,8,129,6,127,31,8,129,3,11,8,5,2,5,79,8,134,4,
-+ 79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,
-+ 79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,
-+ 79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,
-+ 79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,79,8,134,4,
-+ 79,8,134,4,79,8,134,4,79,8,134,3,79,6,129,133,2,8,12,14,15,14,12,9,
-+ 3,138,9,127,15,11,1,134,1,12,127,47,13,2,133,11,127,79,12,132,5,127,111,6,
-+ 131,13,79,11,3,128,3,12,79,13,130,2,79,14,1,130,1,14,79,2,129,6,79,8,
-+ 132,9,79,5,129,8,79,6,132,7,79,7,129,8,79,5,132,6,79,7,129,8,79,5,
-+ 132,7,79,6,129,3,72,1,132,11,79,4,140,1,14,79,1,140,6,79,12,141,13,79,
-+ 7,140,5,79,14,1,140,13,79,9,140,8,79,14,1,139,3,95,6,140,12,79,12,140,
-+ 7,95,3,139,3,95,7,139,1,13,79,11,140,9,79,14,2,139,5,95,5,139,2,14,
-+ 79,9,140,12,79,13,1,139,8,79,14,3,139,4,95,6,139,1,14,79,10,140,6,127,
-+ 127,31,2,128,7,127,127,31,3,128,7,127,127,31,3,128,7,127,127,31,3,128,5,127,
-+ 127,31,2,128,1,14,127,127,3,129,2,127,127,15,4,129,2,127,127,15,4,129,2,127,
-+ 127,15,4,129,1,14,127,127,3,139,1,14,79,13,140,11,79,14,3,139,7,95,6,139,
-+ 4,95,10,139,1,14,79,13,1,139,11,95,3,139,7,95,6,139,4,95,10,139,1,13,
-+ 95,11,5,138,1,13,127,13,3,137,2,13,127,14,2,137,2,13,10,6,9,79,11,142,
-+ 4,79,4,142,11,63,9,142,7,63,13,142,5,79,1,141,4,79,3,141,3,79,4,129,
-+ 1,68,133,3,79,5,129,8,79,3,132,4,79,5,129,8,79,4,132,4,79,4,129,7,
-+ 79,6,132,6,79,3,129,6,79,9,132,9,79,1,129,4,79,14,1,130,1,14,63,13,
-+ 130,1,14,79,12,3,1,3,12,79,9,131,9,127,111,3,131,1,14,127,79,10,133,4,
-+ 14,127,47,13,1,134,3,12,127,15,11,1,137,4,9,12,14,15,14,12,9,4,133,134,
-+ 1,14,63,14,143,6,79,12,143,11,79,7,142,2,95,2,142,6,79,13,143,11,79,8,
-+ 142,1,95,3,142,6,79,13,143,11,79,8,142,1,95,4,142,6,79,14,143,11,79,9,
-+ 142,1,95,4,142,6,79,14,143,11,79,10,131,13,63,10,132,1,95,5,131,79,12,132,
-+ 6,79,14,1,131,79,12,132,11,79,10,132,79,12,131,1,95,5,132,79,12,131,6,95,
-+ 1,132,79,12,131,11,79,11,133,79,12,130,1,127,127,63,14,1,2,127,127,79,18,127,
-+ 127,79,18,127,127,79,2,1,14,127,127,47,14,1,141,79,12,144,79,12,144,79,12,144,
-+ 79,12,144,79,12,144,79,12,144,79,12,144,79,12,144,13,63,10,130,129,14,127,127,5,
-+ 129,1,127,127,15,7,129,1,127,127,15,7,129,1,127,127,15,7,129,1,127,127,15,5,
-+ 129,1,79,12,141,1,79,11,141,1,79,11,141,1,79,11,141,1,79,11,141,1,79,11,
-+ 141,1,79,11,141,1,79,11,141,1,79,11,128,2,9,13,15,14,12,7,1,132,1,79,
-+ 11,7,111,13,2,131,1,127,111,13,1,130,1,127,127,9,130,1,127,127,15,1,129,1,
-+ 95,13,5,17,7,95,6,129,1,95,3,131,9,79,9,130,11,60,9,132,3,79,11,142,
-+ 79,13,142,13,63,14,142,12,79,142,12,79,130,7,56,5,133,13,63,14,130,14,63,13,
-+ 133,14,63,13,130,13,79,2,131,2,79,12,130,10,79,8,131,8,79,9,130,6,95,7,
-+ 17,7,95,6,130,1,14,127,95,14,1,131,7,127,95,7,133,10,127,63,10,135,7,127,
-+ 31,7,137,1,7,11,14,31,13,11,7,1,132,133,1,7,11,13,30,13,10,6,138,7,
-+ 14,127,13,4,135,10,127,63,6,133,8,127,95,3,131,2,127,111,11,131,8,79,14,6,
-+ 1,2,10,95,2,130,12,79,6,131,12,79,6,130,14,63,14,132,6,79,7,130,79,12,
-+ 132,4,79,8,129,1,79,12,132,2,77,6,129,1,79,12,141,1,79,12,141,1,79,12,
-+ 1,8,13,15,14,12,8,2,134,79,14,13,111,7,133,127,111,7,132,127,127,4,131,127,
-+ 127,12,131,111,7,17,7,95,3,130,95,8,131,9,79,8,130,95,2,131,3,79,10,130,
-+ 95,133,79,12,130,79,14,133,13,63,13,130,79,13,133,13,63,14,130,79,12,133,12,79,
-+ 130,79,12,133,12,79,130,14,63,13,133,13,79,130,13,63,14,133,14,79,130,11,79,2,
-+ 131,3,79,13,130,8,79,8,131,9,79,11,130,4,95,7,17,8,95,7,131,13,127,111,
-+ 2,131,5,127,95,8,133,8,127,63,10,135,6,14,127,15,7,137,1,7,11,13,31,14,
-+ 11,7,1,132,1,14,127,127,13,128,2,127,127,31,128,3,127,127,31,128,3,127,127,31,
-+ 128,3,127,127,31,128,3,63,8,133,5,79,13,128,3,63,8,133,9,79,9,128,1,9,
-+ 42,4,133,13,79,4,139,2,95,1,139,7,79,11,140,11,79,6,139,1,95,2,139,4,
-+ 79,13,140,9,79,9,140,13,79,4,139,2,79,14,140,7,79,11,140,11,79,6,139,1,
-+ 14,79,2,139,4,79,13,140,9,79,8,140,13,79,4,139,2,79,14,140,6,79,11,140,
-+ 11,79,6,140,14,79,2,139,4,79,13,140,8,79,8,140,13,79,4,139,2,79,14,140,
-+ 6,79,10,140,10,79,6,140,14,79,2,139,4,79,13,140,6,79,7,136,133,2,7,11,
-+ 14,15,14,13,10,5,139,8,127,15,13,4,136,11,127,63,5,134,8,127,95,3,132,2,
-+ 127,111,11,132,7,79,14,5,1,2,9,95,2,131,12,79,5,131,11,79,7,131,14,63,
-+ 14,132,4,79,10,130,1,79,10,132,1,79,11,130,1,79,9,133,79,11,131,14,63,11,
-+ 132,1,79,10,131,12,63,14,132,4,79,8,131,7,79,6,131,10,79,3,131,2,79,14,
-+ 5,1,2,9,79,13,133,7,127,95,4,134,9,127,63,8,136,11,127,31,6,136,9,127,
-+ 47,12,2,134,8,127,79,14,1,132,2,79,14,6,1,2,10,79,9,132,6,79,7,131,
-+ 12,79,1,131,11,79,1,131,6,79,5,131,14,63,12,132,2,79,9,131,79,10,133,79,
-+ 11,130,1,79,9,133,79,12,130,1,79,10,132,1,79,11,131,14,63,12,132,2,79,10,
-+ 131,12,79,1,131,5,79,8,131,9,79,6,131,11,79,4,131,4,79,14,6,1,2,9,
-+ 79,14,133,12,127,95,7,133,3,127,79,13,135,6,127,47,13,2,136,4,13,127,11,2,
-+ 138,1,6,11,14,15,14,13,9,4,134,132,1,6,10,13,14,15,14,11,7,2,137,6,
-+ 14,127,15,8,135,9,127,63,10,133,6,127,95,7,131,1,14,127,111,1,130,5,95,9,
-+ 2,1,5,14,79,7,130,9,79,11,131,5,79,11,130,11,79,4,132,14,63,13,130,12,
-+ 79,1,132,12,79,130,13,79,133,11,79,1,129,13,79,133,10,79,2,129,13,79,133,10,
-+ 79,2,129,12,79,2,132,11,79,2,129,11,79,3,132,12,79,2,129,9,79,5,132,14,
-+ 79,2,129,7,79,10,131,4,95,3,129,3,95,9,2,1,5,14,95,3,130,12,127,127,
-+ 3,130,4,127,127,3,131,7,127,111,3,132,6,111,14,13,79,3,133,1,8,12,14,15,
-+ 13,9,2,10,79,3,141,10,79,3,141,10,79,3,129,2,72,2,132,10,79,3,129,6,
-+ 79,6,132,10,79,3,129,6,79,7,132,11,79,3,129,5,79,9,132,13,79,2,129,3,
-+ 79,14,1,130,5,79,14,131,14,79,12,2,1,5,14,79,11,131,7,127,111,4,131,1,
-+ 13,127,79,11,133,3,14,127,47,12,1,134,2,12,127,15,9,1,137,4,9,13,14,15,
-+ 14,11,8,2,133,131,7,13,14,12,4,134,8,79,4,133,14,79,11,132,2,95,13,133,
-+ 14,79,11,133,8,79,4,134,7,13,14,12,4,255,137,7,13,14,12,4,134,8,79,4,
-+ 133,14,79,11,132,2,95,13,133,14,79,11,133,8,79,4,134,7,13,14,12,4,131,130,
-+ 5,13,15,12,4,132,6,79,4,131,14,79,13,130,3,111,2,129,3,111,2,130,14,79,
-+ 13,131,7,79,5,132,6,13,15,13,5,232,14,63,1,131,2,63,14,132,3,63,11,132,
-+ 5,63,8,132,6,63,5,132,7,63,2,132,9,47,14,133,10,47,11,133,11,47,8,133,
-+ 13,47,5,133,14,47,2,133,14,31,13,132,146,20,145,4,12,15,10,143,5,12,47,10,
-+ 141,6,13,79,10,138,1,7,14,111,10,136,1,8,14,127,15,8,134,2,9,127,31,11,
-+ 4,133,3,10,127,15,14,9,2,133,4,11,127,15,13,7,1,134,8,127,15,12,5,137,
-+ 10,111,10,3,139,10,79,9,2,141,10,79,14,7,1,140,10,127,9,3,138,4,13,127,
-+ 15,11,4,138,5,12,127,15,13,6,1,137,4,11,127,15,14,8,2,137,3,10,127,31,
-+ 10,2,137,2,9,127,15,10,139,2,8,14,95,10,141,1,7,14,63,10,143,1,7,13,
-+ 31,10,146,6,12,9,148,1,172,128,8,127,127,31,8,129,10,127,127,31,10,129,10,127,
-+ 127,31,10,129,8,127,127,31,8,239,8,127,127,31,8,129,10,127,127,31,10,129,10,127,
-+ 127,31,10,129,8,127,127,31,8,255,198,128,20,147,10,15,12,4,145,10,47,12,5,143,
-+ 10,79,13,6,141,10,111,14,7,1,138,8,127,15,14,8,1,137,4,11,127,31,9,2,
-+ 137,2,9,14,127,15,10,3,137,1,7,13,127,15,11,4,138,5,12,127,15,8,139,3,
-+ 10,111,10,141,2,9,79,10,140,1,7,14,79,10,138,3,9,127,10,136,4,11,127,15,
-+ 13,4,133,1,6,13,127,15,12,5,133,2,8,14,127,15,11,4,133,2,10,127,31,10,
-+ 3,135,10,127,15,9,2,137,10,95,14,8,2,139,10,63,14,7,1,141,10,31,13,7,
-+ 1,143,10,12,6,146,1,191,133,3,9,12,14,15,14,12,9,3,137,1,11,127,15,11,
-+ 1,134,3,13,127,47,13,2,132,1,13,127,79,12,1,131,10,127,111,7,130,3,95,9,
-+ 2,128,3,12,79,14,130,8,79,10,131,1,14,79,3,129,11,79,2,132,9,79,6,129,
-+ 13,63,14,133,6,79,7,129,14,63,13,133,5,79,8,129,11,61,10,133,7,79,7,141,
-+ 12,79,5,140,6,95,1,139,4,95,10,139,4,111,3,138,4,111,7,138,4,111,8,138,
-+ 1,14,95,8,139,9,95,7,140,14,79,8,140,2,79,13,141,3,79,9,141,4,79,8,
-+ 141,3,79,8,142,4,53,1,205,4,12,14,13,7,142,3,79,8,141,10,95,1,140,12,
-+ 95,2,140,10,95,141,3,79,8,142,4,12,14,13,7,136,142,1,6,9,12,30,15,14,
-+ 13,10,7,3,151,4,11,127,63,12,6,147,3,12,127,127,12,3,144,8,127,127,63,6,
-+ 141,1,11,95,11,6,3,1,128,1,2,4,8,13,95,7,139,1,12,79,8,1,137,5,
-+ 13,79,4,137,1,12,63,12,2,140,1,10,63,14,1,136,9,63,10,144,10,63,8,135,
-+ 5,63,9,145,1,13,47,14,1,133,1,14,47,11,132,5,11,30,12,6,5,43,3,131,
-+ 5,63,5,133,8,47,14,1,131,9,127,31,5,132,13,47,10,132,1,14,47,6,131,6,
-+ 127,47,3,132,8,47,13,132,7,47,12,132,14,47,9,1,2,12,63,1,132,5,63,132,
-+ 13,47,6,131,4,47,12,130,4,47,14,133,3,63,1,130,2,47,14,1,131,7,47,7,
-+ 130,3,47,12,133,3,63,1,130,6,47,10,132,9,47,4,130,5,47,10,133,3,63,131,
-+ 9,47,6,132,11,47,2,130,6,47,8,133,4,63,131,12,47,4,132,13,47,131,8,47,
-+ 6,133,7,47,12,131,14,47,1,132,47,14,131,10,47,4,133,11,47,9,130,1,63,132,
-+ 2,47,12,131,12,47,3,132,1,14,47,5,130,1,63,132,4,47,10,131,13,47,4,132,
-+ 7,63,1,130,1,63,132,5,47,9,130,1,63,9,131,3,14,47,9,132,63,1,131,4,
-+ 47,12,130,6,79,7,2,1,6,14,47,14,2,132,14,47,4,131,1,63,6,1,5,14,
-+ 127,79,6,133,12,47,8,132,10,127,127,47,8,134,9,47,13,132,1,12,95,12,4,13,
-+ 111,14,6,135,4,63,5,133,7,12,14,15,12,7,1,128,1,7,12,14,15,14,11,7,
-+ 1,137,14,47,13,1,159,7,63,11,159,1,13,63,10,1,139,2,145,5,79,13,4,136,
-+ 1,8,15,8,145,7,95,12,7,3,1,128,1,2,5,10,63,2,145,8,127,127,31,8,
-+ 146,5,14,127,111,10,1,147,1,8,14,127,47,10,3,151,1,5,9,12,14,15,14,13,
-+ 12,9,5,1,143,135,12,79,9,142,2,95,14,142,5,111,2,141,8,111,5,141,12,111,
-+ 9,141,127,12,140,3,127,15,140,6,127,15,3,139,10,63,11,63,7,139,13,47,14,5,
-+ 63,10,138,1,63,11,2,63,13,138,5,63,9,128,14,63,1,137,8,63,6,128,12,63,
-+ 5,137,11,63,3,128,9,63,8,137,14,63,129,6,63,11,136,3,63,13,129,3,63,14,
-+ 136,6,63,10,129,1,79,3,135,9,63,7,130,13,63,6,135,13,63,4,130,10,63,9,
-+ 134,1,79,1,130,7,63,13,134,4,63,14,131,4,79,1,133,7,63,11,131,1,79,4,
-+ 133,11,63,8,132,13,63,8,133,14,63,5,132,11,63,11,132,2,127,127,14,132,5,127,
-+ 127,15,2,131,9,127,127,15,6,131,12,127,127,15,9,130,1,127,127,31,12,130,4,79,
-+ 6,134,10,79,1,129,7,79,3,134,7,79,4,129,10,79,135,4,79,7,129,13,63,12,
-+ 135,2,79,10,128,2,79,9,136,14,63,14,128,3,79,6,136,10,79,1,129,3,127,15,
-+ 14,12,9,5,136,4,127,79,14,6,134,4,127,111,10,133,4,127,127,9,132,4,127,127,
-+ 15,3,131,4,79,8,130,2,8,95,10,131,4,79,8,132,6,79,14,131,4,79,8,133,
-+ 12,79,3,130,4,79,8,133,8,79,4,130,4,79,8,133,6,79,5,130,4,79,8,133,
-+ 6,79,4,130,4,79,8,133,7,79,2,130,4,79,8,133,12,63,13,131,4,79,8,132,
-+ 5,79,8,131,4,79,8,130,2,8,79,14,1,131,4,127,127,4,132,4,127,95,14,3,
-+ 133,4,127,95,13,3,133,4,127,111,14,4,132,4,79,8,130,2,7,14,63,13,1,131,
-+ 4,79,8,132,4,79,9,131,4,79,8,133,10,79,1,130,4,79,8,133,4,79,6,130,
-+ 4,79,8,133,2,79,9,130,4,79,8,133,1,79,11,130,4,79,8,133,2,79,11,130,
-+ 4,79,8,133,4,79,10,130,4,79,8,133,9,79,9,130,4,79,8,132,3,95,5,130,
-+ 4,79,8,130,1,6,14,95,1,130,4,127,127,15,9,131,4,127,127,13,1,131,4,127,
-+ 111,13,2,132,4,127,95,10,1,133,3,127,31,13,11,8,2,133,134,4,9,12,14,15,
-+ 14,12,9,4,139,3,12,127,15,12,3,136,5,127,79,6,134,3,127,111,4,133,12,127,
-+ 111,13,132,4,95,9,2,128,2,8,95,5,131,9,79,10,132,8,79,10,131,12,79,2,
-+ 132,1,79,13,131,13,63,14,134,13,63,14,131,14,63,14,134,13,79,131,14,63,14,134,
-+ 5,56,6,131,14,63,14,144,14,63,14,144,14,63,14,144,14,63,14,144,14,63,14,144,
-+ 14,63,14,144,14,63,14,144,14,63,14,144,14,63,14,144,14,63,14,144,14,63,14,144,
-+ 14,63,14,144,14,63,14,144,14,63,14,134,5,56,6,131,14,63,14,134,13,79,131,13,
-+ 63,14,134,13,63,14,131,12,79,2,132,1,79,13,131,8,79,10,132,8,79,9,131,4,
-+ 95,9,2,128,2,8,95,5,132,12,127,111,12,133,3,14,127,95,3,134,4,14,127,47,
-+ 14,5,136,3,12,127,15,12,3,139,4,9,12,14,15,14,12,9,4,134,129,3,127,15,
-+ 14,13,10,6,1,136,4,127,79,14,6,135,4,127,111,8,134,4,127,127,6,133,4,127,
-+ 127,15,2,132,4,79,8,130,2,7,95,8,132,4,79,8,132,7,79,13,132,4,79,8,
-+ 133,13,79,2,131,4,79,8,133,10,79,3,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,133,8,79,4,131,4,79,8,
-+ 133,8,79,4,131,4,79,8,133,11,79,3,131,4,79,8,132,1,14,79,2,131,4,79,
-+ 8,132,8,79,13,132,4,79,8,130,2,8,95,9,132,4,127,127,15,2,132,4,127,127,
-+ 7,133,4,127,111,9,134,4,127,79,14,6,135,3,127,15,14,13,10,6,1,134,129,3,
-+ 127,127,14,1,130,4,127,127,15,2,130,4,127,127,15,2,130,4,127,127,15,2,130,4,
-+ 127,127,14,1,130,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,
-+ 142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,127,63,
-+ 10,135,4,127,63,11,135,4,127,63,11,135,4,127,63,11,135,4,127,63,10,135,4,79,
-+ 8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,
-+ 8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,127,127,14,1,130,4,127,127,15,
-+ 2,130,4,127,127,15,2,130,4,127,127,15,2,130,3,127,127,14,1,128,129,3,127,127,
-+ 14,1,129,4,127,127,15,1,129,4,127,127,15,1,129,4,127,127,15,1,129,4,127,127,
-+ 14,1,129,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,
-+ 79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,127,63,9,134,
-+ 4,127,63,11,134,4,127,63,11,134,4,127,63,11,134,4,127,63,9,134,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,3,79,6,139,134,5,9,12,14,15,14,13,9,5,139,3,13,127,15,13,
-+ 4,136,6,127,79,7,134,4,127,111,5,133,13,127,111,14,1,131,5,95,8,2,128,2,
-+ 8,95,7,131,9,79,9,132,7,79,11,131,12,79,1,133,14,63,13,131,13,63,14,134,
-+ 12,79,131,14,63,13,134,12,79,131,14,63,13,134,11,79,131,14,63,13,134,1,50,1,
-+ 131,14,63,13,144,14,63,13,144,14,63,13,144,14,63,13,144,14,63,13,130,9,127,13,
-+ 131,14,63,13,130,11,127,15,131,14,63,13,130,11,127,15,131,14,63,13,130,11,127,15,
-+ 131,14,63,13,130,9,127,15,131,14,63,13,134,12,79,131,14,63,13,134,12,79,131,14,
-+ 63,13,134,12,79,131,14,63,13,134,12,79,131,14,63,13,134,12,79,131,13,63,14,134,
-+ 13,63,14,131,12,79,1,132,1,79,13,131,9,79,9,132,8,79,10,131,5,95,8,2,
-+ 128,2,8,95,5,132,13,127,111,13,133,4,127,111,4,134,6,127,79,5,136,3,13,127,
-+ 15,12,3,139,5,9,13,14,15,14,12,9,4,134,129,3,79,6,133,8,63,14,1,131,
-+ 4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,
-+ 4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,
-+ 4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,
-+ 4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,
-+ 4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,127,127,31,2,131,4,127,
-+ 127,31,2,131,4,127,127,31,2,131,4,127,127,31,2,131,4,127,127,31,2,131,4,79,
-+ 8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,
-+ 8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,
-+ 8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,
-+ 8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,8,133,10,79,2,131,4,79,
-+ 8,133,10,79,2,131,4,79,8,133,10,79,2,131,3,79,6,133,8,63,14,1,129,129,
-+ 2,79,6,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,
-+ 4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,
-+ 4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,
-+ 4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,
-+ 4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,
-+ 4,79,8,131,4,79,8,131,4,79,8,131,4,79,8,131,3,79,6,129,140,5,79,5,
-+ 142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,
-+ 142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,
-+ 142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,142,6,79,6,
-+ 142,6,79,6,142,6,79,6,130,3,52,1,133,6,79,6,129,2,79,9,133,6,79,6,
-+ 129,2,79,10,133,6,79,6,129,2,79,10,133,6,79,6,129,2,79,10,133,6,79,6,
-+ 129,2,79,11,133,7,79,5,129,1,79,13,133,10,79,4,130,13,79,5,131,2,95,1,
-+ 130,8,79,14,6,17,4,13,79,12,131,2,127,127,5,132,7,127,95,11,134,9,127,63,
-+ 12,1,135,6,14,127,15,8,138,1,6,10,13,14,15,13,11,7,2,134,129,2,79,6,
-+ 134,10,79,5,130,4,79,8,133,4,79,14,1,130,4,79,8,133,12,79,7,131,4,79,
-+ 8,132,4,79,14,1,131,4,79,8,132,12,79,6,132,4,79,8,131,5,79,13,133,4,
-+ 79,8,131,13,79,6,133,4,79,8,130,6,79,13,134,4,79,8,130,13,79,5,134,4,
-+ 79,8,129,7,79,12,135,4,79,8,128,1,14,79,4,135,4,79,8,128,7,79,11,136,
-+ 4,79,8,1,14,79,3,136,4,79,24,79,11,137,4,79,9,14,79,3,137,4,127,47,
-+ 14,138,4,127,63,5,137,4,127,63,12,137,4,127,79,3,136,4,127,79,9,136,4,111,
-+ 8,14,79,1,135,4,95,13,128,8,79,7,135,4,95,4,128,2,79,13,135,4,79,10,
-+ 130,11,79,5,134,4,79,8,130,5,79,11,134,4,79,8,131,13,79,3,133,4,79,8,
-+ 131,7,79,9,133,4,79,8,131,1,95,1,132,4,79,8,132,10,79,7,132,4,79,8,
-+ 132,4,79,13,132,4,79,8,133,13,79,5,131,4,79,8,133,6,79,11,131,4,79,8,
-+ 133,1,14,79,3,130,4,79,8,134,9,79,9,130,3,79,6,134,3,14,63,14,128,129,
-+ 2,79,6,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,4,79,8,141,
-+ 4,127,127,14,1,129,4,127,127,15,2,129,4,127,127,15,2,129,4,127,127,15,2,129,
-+ 3,127,127,14,1,129,4,79,7,136,9,79,4,131,7,95,2,134,3,95,5,131,7,95,
-+ 9,134,11,95,5,131,7,111,3,132,4,111,5,131,7,111,11,132,12,111,5,131,7,127,
-+ 4,130,5,127,5,131,7,127,12,130,12,127,5,131,7,127,15,5,128,6,127,15,5,131,
-+ 7,127,15,13,1,13,127,15,5,131,7,127,31,13,127,31,5,131,7,127,127,79,5,131,
-+ 7,79,7,127,14,8,79,5,131,7,79,5,8,111,23,79,5,131,7,79,5,1,14,79,
-+ 13,128,7,79,5,131,7,79,5,128,7,79,5,128,7,79,5,131,7,79,5,129,13,47,
-+ 12,129,7,79,5,131,7,79,5,129,5,47,4,129,7,79,5,131,7,79,5,130,12,15,
-+ 10,130,7,79,5,131,7,79,5,130,3,15,2,130,7,79,5,131,7,79,5,131,2,131,
-+ 7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,
-+ 7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,
-+ 7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,
-+ 7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,
-+ 7,79,5,131,7,79,5,136,7,79,5,131,7,79,5,136,7,79,5,131,5,79,4,136,
-+ 5,79,4,129,129,2,79,14,1,134,14,63,8,131,4,95,7,133,1,79,10,131,4,95,
-+ 12,133,1,79,10,131,4,111,2,132,1,79,10,131,4,111,8,132,1,79,10,131,4,111,
-+ 13,132,1,79,10,131,4,127,3,131,1,79,10,131,4,127,8,131,1,79,10,131,4,127,
-+ 14,131,1,79,10,131,4,127,15,4,130,1,79,10,131,4,127,15,9,130,1,79,10,131,
-+ 4,127,15,14,130,1,79,10,131,4,127,31,5,129,1,79,10,131,4,79,13,63,10,129,
-+ 1,79,10,131,4,79,7,14,63,1,128,1,79,10,131,4,79,6,9,63,6,128,1,79,
-+ 10,131,4,79,6,4,63,11,128,1,79,10,131,4,79,6,128,13,63,2,1,79,10,131,
-+ 4,79,6,128,8,63,7,1,79,10,131,4,79,6,128,3,63,12,1,79,10,131,4,79,
-+ 6,129,13,63,4,79,10,131,4,79,6,129,7,63,10,79,10,131,4,79,6,129,2,127,
-+ 31,10,131,4,79,6,130,12,127,15,10,131,4,79,6,130,6,127,15,10,131,4,79,6,
-+ 130,1,127,15,10,131,4,79,7,131,11,127,10,131,4,79,7,131,5,127,10,131,4,79,
-+ 7,131,1,14,111,10,131,4,79,7,132,9,111,10,131,4,79,7,132,4,111,10,131,4,
-+ 79,7,133,14,95,10,131,4,79,7,133,8,95,10,131,4,79,7,133,3,95,10,131,3,
-+ 79,5,134,12,79,8,129,134,3,8,12,14,15,14,13,9,5,139,2,11,127,15,13,5,
-+ 136,4,14,127,63,7,134,2,14,127,95,6,133,11,127,111,14,1,131,3,95,10,3,128,
-+ 2,7,95,8,131,8,79,10,132,5,79,13,131,11,79,3,133,12,79,1,130,13,63,14,
-+ 134,9,79,3,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,
-+ 134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,
-+ 134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,
-+ 134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,
-+ 134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,
-+ 134,8,79,4,130,14,63,14,134,8,79,4,130,14,63,14,134,8,79,4,130,13,63,14,
-+ 134,9,79,3,130,11,79,3,133,12,79,1,130,8,79,10,132,5,79,13,131,3,95,10,
-+ 3,128,2,7,95,8,132,11,127,111,14,1,132,2,14,127,95,6,134,4,14,127,63,8,
-+ 136,2,11,127,15,13,5,139,3,8,12,14,15,14,13,10,5,134,129,4,127,31,14,12,
-+ 8,2,135,5,127,95,9,134,5,127,111,11,1,132,5,127,127,9,132,5,127,127,15,4,
-+ 131,5,79,7,130,1,7,14,79,11,131,5,79,7,132,4,95,1,130,5,79,7,133,10,
-+ 79,5,130,5,79,7,133,6,79,7,130,5,79,7,133,4,79,8,130,5,79,7,133,3,
-+ 79,8,130,5,79,7,133,5,79,7,130,5,79,7,133,10,79,6,130,5,79,7,132,4,
-+ 95,2,130,5,79,7,130,1,6,14,79,13,131,5,127,127,15,6,131,5,127,127,12,132,
-+ 5,127,111,13,2,132,5,127,95,11,1,133,5,127,31,14,13,9,4,135,5,79,7,143,
-+ 5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,
-+ 5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,5,79,7,143,
-+ 5,79,7,143,4,79,5,141,134,4,9,12,14,15,14,12,7,2,139,2,11,127,15,8,
-+ 137,3,13,127,47,11,1,134,1,13,127,79,10,134,9,127,111,5,132,2,95,9,2,128,
-+ 3,12,79,12,132,6,79,10,131,1,13,79,3,131,10,79,3,132,7,79,6,131,12,79,
-+ 133,4,79,8,131,13,63,14,133,2,79,9,131,14,63,14,133,2,79,10,131,14,63,14,
-+ 133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,
-+ 133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,
-+ 133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,
-+ 133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,
-+ 133,2,79,10,131,14,63,14,133,2,79,10,131,14,63,14,133,2,79,10,131,13,63,14,
-+ 133,2,79,10,131,13,79,133,4,79,9,131,11,79,3,132,7,79,7,131,7,79,10,131,
-+ 1,13,79,3,131,2,95,9,2,128,3,12,79,13,133,10,127,111,6,133,2,14,127,79,
-+ 12,135,4,14,127,47,13,2,136,3,12,127,15,11,1,139,6,13,79,11,4,142,8,79,
-+ 4,143,8,79,4,143,8,79,4,143,8,79,4,143,7,79,3,135,129,3,127,31,14,12,
-+ 8,3,135,4,127,95,9,1,133,4,127,111,12,1,132,4,127,127,10,132,4,127,127,15,
-+ 5,131,4,79,8,130,1,6,14,79,12,131,4,79,8,132,4,95,2,130,4,79,8,133,
-+ 9,79,6,130,4,79,8,133,5,79,8,130,4,79,8,133,3,79,9,130,4,79,8,133,
-+ 3,79,10,130,4,79,8,133,5,79,9,130,4,79,8,133,9,79,7,130,4,79,8,132,
-+ 3,95,3,130,4,79,8,130,1,6,14,79,13,131,4,127,127,15,7,131,4,127,127,12,
-+ 132,4,127,111,13,2,132,4,127,95,10,1,133,4,127,95,1,134,4,79,8,129,4,79,
-+ 5,134,4,79,8,130,14,63,10,134,4,79,8,130,10,79,1,133,4,79,8,130,6,79,
-+ 5,133,4,79,8,130,1,79,10,133,4,79,8,131,12,63,14,133,4,79,8,131,7,79,
-+ 5,132,4,79,8,131,3,79,10,132,4,79,8,132,13,63,14,132,4,79,8,132,9,79,
-+ 4,131,4,79,8,132,4,79,9,131,4,79,8,133,14,63,14,131,4,79,8,133,10,79,
-+ 4,130,4,79,8,133,6,79,9,130,3,79,6,133,1,14,63,12,128,133,3,8,12,14,
-+ 15,14,13,9,5,138,1,10,127,15,12,3,135,2,13,127,63,5,134,12,127,79,14,3,
-+ 132,6,127,111,12,132,13,79,12,3,128,2,8,95,4,130,2,79,14,1,131,8,79,9,
-+ 130,5,79,8,132,1,79,12,130,6,79,5,133,13,63,13,130,6,79,5,133,11,63,14,
-+ 130,4,79,8,133,10,63,13,130,1,79,14,1,142,11,79,12,1,141,3,95,13,2,141,
-+ 9,95,14,5,140,1,12,111,9,1,139,1,12,111,13,3,139,1,10,111,14,5,140,6,
-+ 127,8,140,3,13,111,8,140,1,9,111,6,141,5,14,79,14,2,141,3,14,79,8,142,
-+ 4,79,13,130,2,11,60,4,133,12,79,1,129,4,79,7,133,8,79,2,129,4,79,8,
-+ 133,9,79,2,129,3,79,11,133,11,79,1,129,1,95,4,131,4,79,13,131,11,79,14,
-+ 5,17,6,14,79,8,131,4,127,127,2,132,10,127,95,7,134,11,127,63,9,136,8,14,
-+ 127,14,6,138,1,7,11,13,15,14,13,10,6,1,133,128,7,127,127,47,3,129,9,127,
-+ 127,47,4,129,9,127,127,47,4,129,9,127,127,47,4,129,7,127,127,47,3,136,12,79,
-+ 1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,
-+ 1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,
-+ 1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,
-+ 1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,
-+ 1,143,11,79,1,143,11,79,1,143,11,79,1,143,11,79,1,143,10,63,14,136,129,6,
-+ 79,3,133,5,79,5,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,79,4,133,6,79,6,131,8,
-+ 79,4,133,6,79,6,131,7,79,5,133,6,79,6,131,6,79,6,133,8,79,4,131,4,
-+ 79,10,133,11,79,2,132,95,3,131,4,79,14,133,10,79,13,5,17,6,14,79,8,133,
-+ 3,127,111,14,1,134,8,127,95,6,136,9,127,63,8,138,7,14,127,14,5,140,1,7,
-+ 11,13,30,13,10,6,1,134,128,8,79,8,135,12,79,2,129,6,79,11,134,1,79,14,
-+ 130,3,79,14,134,4,79,11,131,95,1,133,6,79,8,131,12,79,4,133,9,79,5,131,
-+ 9,79,7,133,11,79,2,131,5,79,9,133,14,63,14,132,2,79,12,132,1,79,10,133,
-+ 14,63,14,132,4,79,7,133,11,79,2,131,6,79,4,133,8,79,5,131,9,79,1,133,
-+ 5,79,7,131,11,63,13,134,1,79,10,131,14,63,9,135,13,63,12,130,1,79,6,135,
-+ 10,79,130,4,79,3,135,7,79,2,129,6,79,136,4,79,5,129,9,63,12,136,1,79,
-+ 8,129,11,63,8,137,12,63,10,129,14,63,5,137,9,63,13,128,1,79,2,137,6,79,
-+ 128,4,63,14,138,3,79,3,6,63,11,139,14,63,5,9,63,7,139,12,63,8,11,63,
-+ 4,139,8,63,11,14,63,1,139,5,127,15,13,140,2,127,15,10,141,14,127,7,141,11,
-+ 127,3,141,8,127,142,4,111,12,142,1,111,9,143,13,95,6,143,10,95,2,143,6,79,
-+ 13,136,128,11,63,14,2,133,12,63,5,133,10,63,14,1,128,10,79,5,132,1,79,8,
-+ 133,13,63,14,129,7,79,7,132,3,79,11,132,1,79,11,129,4,79,10,132,5,79,13,
-+ 132,3,79,8,129,1,79,12,132,7,95,1,131,5,79,6,130,13,79,132,10,95,3,131,
-+ 7,79,3,130,10,79,2,131,12,95,5,131,10,79,131,7,79,5,131,14,95,8,131,12,
-+ 63,12,131,4,79,7,130,1,111,10,131,14,63,9,131,1,79,10,130,4,111,13,130,1,
-+ 79,7,132,13,63,12,130,6,127,130,4,79,4,132,10,63,14,130,8,127,2,129,6,79,
-+ 1,132,7,79,2,129,10,127,5,129,8,63,13,133,4,79,5,129,13,47,10,63,7,129,
-+ 10,63,10,133,1,79,7,129,63,5,14,47,10,129,13,63,7,134,13,63,10,128,2,63,
-+ 3,12,47,12,129,79,5,134,10,63,12,128,4,63,1,10,47,14,128,2,79,2,134,7,
-+ 63,14,128,7,47,14,128,7,63,2,4,63,14,135,4,79,2,9,47,12,128,5,63,4,
-+ 7,63,11,135,1,79,5,11,47,9,128,2,63,7,9,63,8,136,14,63,7,13,47,7,
-+ 129,63,9,11,63,6,136,11,63,11,63,5,129,13,47,12,14,63,3,136,8,127,15,3,
-+ 129,10,127,15,137,5,127,15,1,129,8,127,12,137,2,127,14,130,6,127,9,138,14,111,
-+ 11,130,3,127,6,138,11,111,9,130,1,127,4,138,8,111,7,131,14,111,1,138,5,111,
-+ 5,131,11,95,13,139,2,111,3,131,9,95,10,140,14,95,132,6,95,7,140,11,79,13,
-+ 132,4,95,5,140,8,79,11,132,2,95,2,140,5,79,9,133,14,63,14,141,2,14,63,
-+ 6,133,11,63,10,134,128,6,79,5,134,4,79,6,129,2,79,11,134,10,79,2,130,11,
-+ 79,2,132,1,79,11,131,5,79,7,132,6,79,5,132,13,63,12,132,11,63,13,133,8,
-+ 79,3,130,2,79,8,133,2,79,8,130,7,79,2,134,10,63,13,130,12,63,10,135,4,
-+ 79,4,128,3,79,4,136,13,63,9,128,8,63,13,137,7,63,14,1,13,63,7,137,1,
-+ 79,9,79,1,138,10,127,15,10,139,4,127,15,4,140,13,111,13,141,7,111,7,141,1,
-+ 111,1,142,10,79,10,143,13,79,13,142,4,111,4,141,10,111,10,140,2,127,15,2,139,
-+ 8,127,15,8,139,14,63,14,63,14,138,5,79,4,79,5,137,12,63,12,128,10,63,12,
-+ 136,3,79,6,128,5,79,3,135,9,79,1,129,14,63,9,134,1,14,63,10,130,9,63,
-+ 14,1,133,7,79,4,130,3,79,7,133,13,63,13,132,12,63,13,132,4,79,8,132,7,
-+ 79,4,131,10,79,2,132,1,79,10,130,2,79,12,134,11,79,2,129,6,79,5,134,5,
-+ 79,6,128,128,7,79,6,134,9,79,4,129,3,79,12,134,14,79,1,130,13,79,1,132,
-+ 4,79,10,131,8,79,5,132,8,79,5,131,3,79,9,132,13,63,14,133,12,63,14,131,
-+ 2,79,9,133,7,79,3,130,6,79,4,133,2,79,7,130,10,63,14,135,12,63,12,130,
-+ 14,63,9,135,7,79,1,128,4,79,3,135,1,79,5,128,8,63,13,137,11,63,9,128,
-+ 12,63,8,137,6,63,14,2,79,3,137,1,79,9,63,13,139,10,127,15,7,139,5,127,
-+ 15,2,139,1,14,111,12,141,10,111,7,141,4,111,2,142,14,79,11,143,9,79,6,143,
-+ 8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,
-+ 8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,8,79,4,143,
-+ 8,79,4,143,6,79,3,135,128,10,127,127,11,129,11,127,127,13,129,11,127,127,13,129,
-+ 11,127,127,13,129,10,127,127,12,140,8,79,9,139,1,14,79,3,139,6,79,11,140,13,
-+ 79,4,139,5,79,12,140,12,79,5,139,4,79,13,140,11,79,6,139,3,79,14,1,139,
-+ 10,79,7,139,2,79,14,1,139,8,79,9,139,1,14,79,2,139,7,79,10,140,14,79,
-+ 3,139,6,79,11,140,13,79,4,139,5,79,12,140,12,79,5,139,3,79,13,140,10,79,
-+ 6,139,2,79,14,1,139,9,79,8,139,1,95,1,139,8,79,9,140,11,127,127,11,129,
-+ 11,127,127,13,129,11,127,127,13,129,11,127,127,13,129,10,127,127,11,128,128,8,127,15,
-+ 11,133,10,127,15,13,133,10,127,15,13,133,10,127,15,13,133,10,127,15,11,133,10,79,
-+ 3,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,
-+ 2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,
-+ 2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,
-+ 2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,
-+ 2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,
-+ 2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,2,137,10,79,3,137,10,127,
-+ 15,11,133,10,127,15,13,133,10,127,15,13,133,10,127,15,13,133,8,127,15,11,132,129,
-+ 10,63,14,1,139,7,79,5,139,2,79,10,140,13,63,14,140,8,79,4,139,4,79,8,
-+ 140,14,63,13,140,10,79,3,139,5,79,7,139,1,79,12,140,11,79,1,139,6,79,6,
-+ 139,2,79,10,140,12,63,14,140,8,79,4,139,3,79,9,140,14,63,13,140,9,79,3,
-+ 139,5,79,8,139,1,14,63,12,140,11,79,2,139,6,79,6,139,1,79,11,140,12,79,
-+ 1,139,7,79,5,139,3,79,9,140,13,63,14,140,9,79,4,139,4,79,8,140,14,63,
-+ 13,140,10,79,2,139,5,79,7,139,1,79,11,140,11,79,1,139,6,79,4,131,4,127,
-+ 15,14,1,132,5,127,31,1,132,5,127,31,1,132,5,127,31,1,132,4,127,31,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,
-+ 11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,137,11,79,1,132,
-+ 4,127,31,1,132,5,127,31,1,132,5,127,31,1,132,5,127,31,1,132,4,127,15,14,
-+ 1,128,134,4,63,13,142,9,79,4,141,14,79,8,140,4,95,13,140,9,111,3,139,14,
-+ 111,8,138,4,63,13,47,13,138,9,47,14,5,63,3,137,14,47,10,128,14,47,8,136,
-+ 4,63,6,128,10,47,13,136,9,63,1,128,6,63,3,135,13,47,12,129,2,63,8,134,
-+ 3,63,7,130,12,47,13,134,8,63,3,130,8,63,3,133,13,47,13,131,3,63,8,132,
-+ 3,63,9,132,14,47,13,132,8,63,4,132,10,63,3,131,13,47,14,1,132,5,63,8,
-+ 130,3,63,11,133,1,63,12,130,6,63,5,134,10,63,1,255,255,187,1,14,127,127,15,
-+ 4,2,127,127,31,6,2,127,127,31,6,2,127,127,31,6,1,14,127,127,15,4,128,10,
-+ 47,14,3,131,2,14,47,11,132,5,63,5,132,9,47,14,1,132,12,47,8,132,2,14,
-+ 31,14,1,255,255,161,133,1,6,11,13,30,13,10,6,1,138,6,14,127,14,6,136,9,
-+ 127,63,8,134,7,127,95,6,132,1,14,127,95,14,1,131,6,95,6,1,2,8,95,6,
-+ 131,9,79,8,131,8,79,10,131,8,76,3,131,2,79,12,143,79,13,143,14,63,13,135,
-+ 4,9,12,30,127,13,133,5,13,127,79,13,132,8,127,111,13,131,5,127,127,13,131,13,
-+ 79,13,6,2,130,14,63,13,130,3,79,14,2,132,14,63,13,130,6,79,9,133,14,63,
-+ 13,130,7,79,6,133,79,13,130,8,79,8,132,2,79,13,130,7,79,12,132,10,79,13,
-+ 130,6,95,9,2,1,4,11,95,13,130,2,127,127,15,13,131,12,127,127,13,131,3,14,
-+ 127,111,13,132,4,13,127,6,14,63,13,133,1,6,11,14,15,14,12,8,2,128,13,63,
-+ 11,129,129,9,63,14,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,
-+ 11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,2,8,12,30,13,
-+ 8,2,134,11,79,7,14,111,6,133,11,127,111,5,132,11,127,111,14,1,131,11,127,127,
-+ 6,131,11,95,8,2,1,6,14,79,10,131,11,79,9,131,5,79,13,131,11,79,3,132,
-+ 14,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,
-+ 12,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,
-+ 12,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,12,63,14,131,11,79,1,132,
-+ 12,63,14,131,11,79,1,132,12,63,14,131,11,79,3,132,14,63,14,131,11,79,9,131,
-+ 5,79,13,131,11,95,7,2,1,6,14,79,10,131,11,127,127,6,131,11,127,111,14,1,
-+ 131,11,127,111,5,132,11,79,11,127,6,133,9,63,14,1,3,10,13,15,14,13,9,2,
-+ 132,133,3,8,12,14,15,14,13,10,6,1,136,1,10,127,15,14,6,134,1,13,127,63,
-+ 8,133,12,127,95,6,131,5,127,111,14,1,130,11,79,14,5,1,2,9,95,5,130,14,
-+ 79,4,131,9,79,8,129,1,79,13,132,4,79,10,129,1,79,11,132,2,79,8,129,1,
-+ 79,11,141,1,79,11,141,1,79,11,141,1,79,11,141,1,79,11,141,1,79,11,141,1,
-+ 79,11,141,1,79,11,133,66,130,1,79,11,132,2,79,9,129,1,79,13,132,4,79,10,
-+ 130,14,79,4,131,10,79,8,130,11,79,14,5,1,2,9,95,5,130,6,127,111,14,1,
-+ 131,12,127,95,7,132,2,13,127,63,9,134,1,11,127,15,14,6,137,3,8,12,14,15,
-+ 14,13,10,6,1,132,140,2,79,7,142,4,79,8,142,4,79,8,142,4,79,8,142,4,
-+ 79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,134,3,9,13,30,12,
-+ 7,1,4,79,8,133,8,111,13,7,79,8,132,7,127,111,8,131,2,127,127,8,131,8,
-+ 127,127,8,131,12,79,13,4,1,2,10,95,8,131,95,3,131,11,79,8,130,1,79,12,
-+ 132,6,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,
-+ 132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,
-+ 132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,
-+ 132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,12,132,5,79,8,131,95,3,131,
-+ 11,79,8,131,12,79,13,4,1,2,9,95,8,131,8,127,127,8,131,2,127,127,8,132,
-+ 7,127,111,8,133,8,127,11,79,8,134,3,9,13,14,15,13,9,3,2,79,7,129,133,
-+ 3,8,12,14,15,14,13,10,6,1,136,1,10,127,15,14,5,134,1,13,127,63,7,133,
-+ 12,127,95,5,131,5,127,111,13,131,11,79,14,5,1,2,9,95,3,130,14,79,4,131,
-+ 11,79,7,129,1,79,13,132,5,79,8,129,1,79,11,132,3,79,9,129,1,79,11,132,
-+ 2,79,9,129,1,79,11,132,3,79,9,129,1,127,127,15,9,129,1,127,127,15,9,129,
-+ 1,127,127,15,9,129,1,127,127,15,7,129,1,79,11,141,1,79,11,141,1,79,11,141,
-+ 1,79,13,132,3,14,63,5,130,14,79,4,131,10,79,5,130,11,79,14,5,1,2,9,
-+ 95,1,130,6,127,111,11,132,12,127,95,3,132,2,14,127,63,7,134,1,11,127,15,14,
-+ 6,137,3,8,12,14,15,14,13,10,6,1,132,134,4,9,12,46,1,133,3,12,95,2,
-+ 132,2,14,111,1,132,10,127,1,131,1,127,14,132,4,95,7,2,133,6,79,9,135,7,
-+ 79,5,135,7,79,5,133,12,127,47,3,129,14,127,47,4,129,14,127,47,4,129,12,127,
-+ 47,3,131,7,79,5,135,7,79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,
-+ 79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,
-+ 79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,7,
-+ 79,4,135,7,79,4,135,7,79,4,135,7,79,4,135,5,79,3,132,132,4,10,13,15,
-+ 14,12,7,1,2,79,7,133,10,111,13,6,79,8,132,9,127,111,8,131,3,127,127,8,
-+ 131,9,127,127,8,131,12,79,14,5,1,2,10,95,8,131,95,4,131,12,79,8,130,1,
-+ 79,13,132,6,79,8,130,1,79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,
-+ 79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,
-+ 79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,
-+ 79,11,132,4,79,8,130,1,79,11,132,4,79,8,130,1,79,13,132,6,79,8,131,95,
-+ 4,131,12,79,8,131,12,79,14,5,1,2,10,95,8,131,8,127,127,8,131,2,127,127,
-+ 8,132,8,127,15,14,79,8,133,9,111,12,5,79,8,134,4,10,13,15,14,11,6,128,
-+ 5,79,7,142,6,79,7,142,10,79,5,141,1,14,79,2,140,1,11,79,14,138,1,3,
-+ 7,14,95,8,136,13,127,47,2,136,14,127,31,7,137,14,127,15,9,138,14,111,13,6,
-+ 139,11,31,14,13,11,8,4,135,129,9,63,14,1,142,11,79,1,142,11,79,1,142,11,
-+ 79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,
-+ 79,1,128,7,12,14,15,13,10,3,134,11,79,3,13,111,7,133,11,79,14,127,15,5,
-+ 132,11,127,111,14,132,11,127,127,5,131,11,95,8,17,6,14,79,8,131,11,79,10,131,
-+ 7,79,11,131,11,79,4,131,2,79,12,131,11,79,2,132,79,13,131,11,79,1,132,14,
-+ 63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,
-+ 63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,
-+ 63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,
-+ 63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,
-+ 63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,
-+ 63,13,131,9,63,14,1,132,13,63,11,129,130,7,13,14,12,4,132,8,79,3,130,1,
-+ 95,10,130,2,95,12,130,1,95,10,131,8,79,3,132,7,13,14,12,4,165,6,79,3,
-+ 131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,
-+ 131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,
-+ 131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,
-+ 131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,131,8,79,4,
-+ 131,6,79,3,129,132,1,8,13,14,11,3,135,10,63,14,2,133,2,95,8,133,5,95,
-+ 10,133,2,95,8,134,10,63,14,2,134,1,8,13,14,11,3,191,9,63,14,1,134,11,
-+ 79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,
-+ 79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,
-+ 79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,
-+ 79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,79,1,134,11,
-+ 79,1,134,11,79,1,134,12,79,1,133,1,14,79,134,7,79,14,132,2,7,95,11,130,
-+ 4,127,15,8,130,5,127,15,2,130,5,127,7,131,5,95,14,5,132,4,15,30,12,9,
-+ 5,134,129,9,63,14,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,
-+ 11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,142,11,79,1,131,3,14,63,11,
-+ 131,11,79,1,131,12,79,3,131,11,79,1,130,7,79,9,132,11,79,1,129,2,14,63,
-+ 13,1,132,11,79,1,129,10,79,4,133,11,79,1,128,5,79,9,134,11,79,17,13,63,
-+ 14,1,134,11,79,1,8,79,5,135,11,79,4,79,10,136,11,79,14,79,9,136,11,127,
-+ 47,14,136,11,127,63,5,135,11,127,63,11,135,11,127,79,1,134,11,111,4,79,7,134,
-+ 11,95,8,128,10,63,12,134,11,79,13,1,128,6,79,3,133,11,79,4,129,1,79,8,
-+ 133,11,79,1,130,11,63,14,133,11,79,1,130,6,79,5,132,11,79,1,130,1,79,10,
-+ 132,11,79,1,131,11,79,1,131,11,79,1,131,6,79,6,131,11,79,1,131,2,79,12,
-+ 131,11,79,1,132,12,79,2,130,9,63,14,1,132,6,79,6,128,129,11,63,12,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,63,14,131,14,
-+ 63,14,131,14,63,14,131,14,63,14,131,12,63,12,129,129,9,63,14,128,2,8,12,30,
-+ 12,8,2,131,5,10,13,15,14,11,5,134,11,79,8,111,14,4,128,1,11,111,10,133,
-+ 11,127,95,14,3,11,127,15,9,132,11,127,127,127,47,3,131,11,127,127,127,47,8,131,
-+ 11,95,7,17,8,111,13,3,128,3,12,79,12,131,11,79,10,131,11,95,3,130,2,95,
-+ 131,11,79,4,131,5,79,12,132,12,79,1,130,11,79,1,131,3,79,10,132,10,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,11,79,1,131,2,79,9,132,9,79,2,130,11,79,1,131,2,79,9,132,9,79,2,
-+ 130,9,63,14,132,1,14,63,7,132,7,63,14,1,128,129,9,63,14,17,8,12,14,15,
-+ 13,10,3,134,11,79,6,14,111,7,133,11,127,111,5,132,11,127,111,14,132,11,127,127,
-+ 5,131,11,95,8,17,6,14,79,8,131,11,79,10,131,7,79,11,131,11,79,4,131,2,
-+ 79,12,131,11,79,2,132,79,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,
-+ 13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,
-+ 13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,
-+ 13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,
-+ 13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,
-+ 13,131,11,79,1,132,14,63,13,131,11,79,1,132,14,63,13,131,9,63,14,1,132,13,
-+ 63,11,129,133,3,8,12,14,15,14,13,10,6,1,137,1,10,127,15,14,6,135,1,13,
-+ 127,63,9,134,12,127,95,6,132,5,127,111,14,1,131,11,79,14,5,1,2,8,95,5,
-+ 131,14,79,4,131,9,79,9,130,1,79,13,132,3,79,11,130,1,79,11,132,1,79,11,
-+ 130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,
-+ 130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,
-+ 130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,130,1,79,11,132,1,79,11,
-+ 130,1,79,13,132,3,79,11,131,14,79,4,131,9,79,9,131,11,79,14,5,1,2,8,
-+ 95,6,131,6,127,111,14,1,132,12,127,95,7,133,2,13,127,63,10,135,1,11,127,15,
-+ 14,7,138,3,8,12,14,15,14,13,11,7,1,133,129,6,79,3,2,9,13,30,13,9,
-+ 3,134,8,79,11,127,8,133,8,127,111,8,132,8,127,127,3,131,8,127,127,9,131,8,
-+ 95,10,2,1,4,13,79,13,131,8,79,12,131,3,95,1,130,8,79,7,132,11,79,2,
-+ 130,8,79,5,132,9,79,2,130,8,79,4,132,9,79,2,130,8,79,4,132,9,79,2,
-+ 130,8,79,4,132,9,79,2,130,8,79,4,132,9,79,2,130,8,79,4,132,9,79,2,
-+ 130,8,79,4,132,9,79,2,130,8,79,4,132,9,79,2,130,8,79,4,132,9,79,2,
-+ 130,8,79,5,132,9,79,2,130,8,79,7,132,11,79,2,130,8,79,12,131,2,95,1,
-+ 130,8,95,10,2,1,4,13,79,13,131,8,127,127,9,131,8,127,127,3,131,8,127,111,
-+ 8,132,8,79,8,13,111,9,133,8,79,4,1,7,12,14,15,13,10,3,134,8,79,4,
-+ 142,8,79,4,142,8,79,4,142,8,79,4,142,8,79,4,142,8,79,4,142,8,79,4,
-+ 142,8,79,4,142,6,79,3,140,132,3,9,13,30,13,9,18,79,7,133,8,127,11,79,
-+ 8,132,7,127,111,8,131,2,127,127,8,131,8,127,127,8,131,12,79,14,5,1,2,10,
-+ 95,8,131,95,3,131,11,79,8,130,1,79,12,132,6,79,8,130,1,79,10,132,4,79,
-+ 8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,
-+ 8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,
-+ 8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,8,130,1,79,10,132,4,79,
-+ 8,130,1,79,12,132,5,79,8,131,95,3,131,11,79,8,131,12,79,13,4,1,2,9,
-+ 95,8,131,8,127,127,8,131,2,127,127,8,132,7,127,111,8,133,8,111,13,7,79,8,
-+ 134,3,9,13,30,12,7,1,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,
-+ 4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,4,79,8,142,3,79,7,129,
-+ 129,9,63,14,1,128,6,12,30,10,130,11,79,1,9,79,2,129,11,79,6,79,14,130,
-+ 11,79,14,79,11,130,11,127,47,9,130,11,127,47,6,130,11,95,14,6,2,1,3,1,
-+ 130,11,95,3,135,11,79,10,136,11,79,4,136,11,79,2,136,11,79,1,136,11,79,1,
-+ 136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,
-+ 136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,136,11,79,1,
-+ 136,9,63,14,1,134,132,1,7,11,13,30,13,11,6,1,136,6,14,127,14,5,134,7,
-+ 127,63,6,132,3,127,95,3,131,11,127,95,11,130,1,95,8,2,1,5,14,79,1,129,
-+ 3,79,10,131,5,79,5,129,3,79,5,132,79,6,129,3,79,7,132,7,57,3,129,1,
-+ 79,14,4,140,11,95,9,2,138,4,127,11,5,137,8,127,15,13,6,136,6,14,127,15,
-+ 12,2,135,2,10,127,15,14,2,136,2,8,14,111,13,138,1,6,13,95,6,139,1,12,
-+ 79,10,129,3,57,8,132,3,79,12,129,7,79,1,131,1,79,12,129,6,79,6,131,4,
-+ 79,10,129,2,79,14,7,2,1,5,13,79,6,130,10,127,95,13,131,1,12,127,63,14,
-+ 3,132,1,9,127,31,11,2,135,2,7,11,30,15,14,12,9,3,132,130,7,63,14,135,
-+ 8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,9,79,1,131,1,14,127,31,
-+ 13,128,2,127,63,128,2,127,63,128,1,14,127,31,14,131,8,79,1,134,8,79,1,134,
-+ 8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,
-+ 8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,8,79,1,134,
-+ 8,79,1,134,8,79,4,134,8,79,13,3,133,6,127,7,131,3,127,9,132,12,111,9,
-+ 132,2,13,95,9,133,1,6,11,13,14,31,7,128,129,12,63,12,132,1,14,63,8,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,14,63,14,132,2,79,10,131,
-+ 14,63,14,132,2,79,10,131,14,63,14,132,3,79,10,131,14,79,1,131,5,79,10,131,
-+ 13,79,6,131,11,79,10,131,11,79,14,5,17,9,95,10,131,8,127,127,10,131,2,127,
-+ 127,10,132,8,127,111,10,133,9,111,14,5,79,10,134,3,10,13,15,14,13,8,17,14,
-+ 63,8,129,128,14,79,3,132,6,79,11,129,14,79,6,132,10,79,9,129,10,79,9,132,
-+ 13,79,5,129,6,79,12,131,1,95,2,129,3,95,131,3,79,13,131,14,79,3,130,6,
-+ 79,9,131,10,79,6,130,9,79,6,131,7,79,8,130,12,79,2,131,3,79,11,130,14,
-+ 63,13,133,14,63,14,129,2,79,10,133,10,79,2,128,5,79,6,133,7,79,5,128,8,
-+ 79,2,133,3,79,7,128,11,63,14,135,14,63,10,128,14,63,10,135,10,63,13,1,79,
-+ 6,135,7,79,5,79,3,135,3,79,12,63,14,137,14,127,15,10,137,10,127,15,7,137,
-+ 7,127,15,3,137,3,127,14,139,14,111,11,139,11,111,7,139,7,111,3,139,3,95,14,
-+ 141,13,79,10,134,128,14,63,7,132,11,63,5,132,11,63,9,129,14,63,11,132,14,63,
-+ 9,132,79,7,129,11,63,13,131,2,79,11,131,3,79,4,129,8,79,1,130,5,79,14,
-+ 131,5,79,1,129,4,79,3,130,7,95,1,130,8,63,12,130,1,79,5,130,10,95,4,
-+ 130,10,63,9,131,13,63,8,130,12,95,7,130,13,63,6,131,9,63,10,130,111,9,130,
-+ 79,3,131,6,63,13,129,3,111,12,129,2,63,14,132,3,79,129,5,111,14,129,5,63,
-+ 11,133,14,63,3,128,8,47,14,63,2,128,7,63,8,133,11,63,5,128,10,47,7,63,
-+ 5,128,10,63,5,133,8,63,8,128,13,47,4,13,47,7,128,13,63,1,133,5,63,10,
-+ 1,63,1,10,47,10,128,63,13,134,1,63,12,3,47,13,128,7,47,13,2,63,10,135,
-+ 13,63,6,47,11,128,5,63,5,63,7,135,10,63,12,47,8,128,2,63,12,63,3,135,
-+ 7,127,5,129,14,127,136,3,127,3,129,12,111,12,137,127,130,9,111,9,137,12,95,12,
-+ 130,6,111,5,137,9,95,10,130,3,111,2,137,5,95,7,130,1,95,14,138,2,95,4,
-+ 131,13,79,11,139,14,79,2,131,10,79,7,139,9,63,13,132,6,79,3,133,128,14,63,
-+ 14,2,132,4,79,12,129,9,79,9,132,12,79,7,129,2,95,2,130,4,79,14,1,130,
-+ 10,79,8,130,11,79,8,131,3,79,14,1,128,3,79,14,1,132,11,79,7,128,10,79,
-+ 8,133,3,79,13,2,95,2,134,11,79,13,79,9,135,4,127,47,2,136,12,127,15,10,
-+ 137,5,127,15,2,138,12,111,10,139,5,111,3,139,6,111,3,139,13,111,10,138,5,127,
-+ 15,3,137,12,127,15,10,136,4,127,47,2,135,12,79,12,79,9,134,4,79,13,1,14,
-+ 79,2,133,11,79,6,128,9,79,8,132,3,79,14,1,128,2,79,14,1,131,10,79,8,
-+ 130,10,79,8,130,2,95,1,130,3,79,14,1,129,9,79,9,132,12,79,7,129,14,63,
-+ 14,2,132,4,79,12,128,2,79,12,133,11,79,4,1,95,1,132,14,79,2,128,12,79,
-+ 4,131,2,79,13,129,8,79,7,131,5,79,9,129,4,79,9,131,7,79,6,129,1,79,
-+ 12,131,10,79,2,130,12,79,131,13,63,13,131,8,79,2,130,79,9,131,4,79,5,129,
-+ 3,79,6,131,1,79,8,129,6,79,2,132,12,63,11,129,8,63,13,133,8,63,13,129,
-+ 11,63,9,133,4,79,1,128,13,63,6,133,1,79,4,1,79,2,134,11,63,6,4,63,
-+ 13,135,8,63,9,6,63,9,135,4,63,12,9,63,6,136,79,13,63,2,136,11,127,13,
-+ 137,7,127,9,137,4,127,5,138,14,111,2,138,11,95,13,139,7,95,9,139,3,95,5,
-+ 140,14,79,2,140,14,63,13,140,2,79,9,140,6,79,5,139,1,13,63,14,1,137,1,
-+ 5,12,79,10,136,3,127,15,4,136,4,127,11,137,4,111,14,2,137,4,95,12,2,138,
-+ 4,31,14,12,9,4,139,128,7,127,95,14,129,9,127,111,1,128,9,127,111,1,128,9,
-+ 127,111,1,128,7,127,111,137,2,95,12,137,10,95,3,136,3,95,10,137,12,79,14,2,
-+ 136,5,95,7,137,13,79,13,137,7,95,5,136,1,14,79,11,137,9,95,3,136,2,95,
-+ 9,137,11,79,14,1,136,4,95,6,137,12,79,12,137,6,95,4,136,1,14,79,10,137,
-+ 7,95,2,137,12,127,111,3,128,12,127,111,4,128,12,127,111,4,128,12,127,111,4,128,
-+ 11,127,111,3,134,6,11,14,63,7,133,1,11,111,8,133,8,127,8,133,14,127,8,132,
-+ 3,127,15,7,132,5,95,9,1,134,5,79,12,136,5,79,8,136,5,79,7,136,5,79,
-+ 7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,79,
-+ 7,136,6,79,7,136,7,79,6,136,11,79,5,135,5,95,2,133,3,11,95,12,134,10,
-+ 111,4,134,10,79,14,4,135,10,95,6,135,9,111,4,134,1,6,13,79,13,136,2,14,
-+ 79,2,136,10,79,5,136,7,79,6,136,5,79,7,136,5,79,7,136,5,79,7,136,5,
-+ 79,7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,79,7,136,5,
-+ 79,8,136,5,79,12,136,5,95,8,1,134,3,127,15,7,133,14,127,8,133,9,127,8,
-+ 133,1,12,111,8,135,6,12,14,63,7,128,128,7,63,14,1,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,2,129,10,79,
-+ 2,129,10,79,2,129,10,79,2,129,8,63,14,1,128,128,8,63,14,11,6,135,10,111,
-+ 11,134,10,127,7,133,10,127,14,133,8,127,15,2,134,2,10,95,4,136,13,79,4,136,
-+ 9,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,
-+ 8,79,4,136,8,79,4,136,8,79,4,136,7,79,5,136,7,79,6,136,6,79,11,136,
-+ 3,95,4,136,13,95,10,3,134,5,111,8,135,5,14,79,8,135,6,95,8,134,5,111,
-+ 8,134,13,79,13,5,134,3,79,14,2,135,6,79,9,136,7,79,6,136,8,79,5,136,
-+ 8,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,8,79,4,136,
-+ 8,79,4,136,8,79,4,136,9,79,4,136,13,79,4,134,2,9,95,4,132,8,127,15,
-+ 3,132,10,127,14,133,10,127,7,133,10,111,11,134,8,63,14,11,6,134,131,1,7,12,
-+ 30,11,5,143,3,13,95,12,4,132,8,14,6,132,3,14,127,15,10,4,17,8,47,11,
-+ 2,130,12,127,127,47,5,129,5,127,127,47,10,130,4,14,47,9,2,128,3,10,127,15,
-+ 13,1,131,1,10,15,6,132,4,12,95,12,1,134,1,135,5,11,14,15,13,7,1,255,
-+ 255,139,130,7,13,14,12,4,132,8,79,4,131,14,79,11,130,2,95,13,131,14,79,11,
-+ 131,8,79,4,132,7,13,14,12,4,251,132,3,9,13,15,14,13,9,2,136,9,127,8,
-+ 134,11,127,31,11,132,8,127,63,8,130,3,63,12,4,17,5,13,63,2,129,10,47,11,
-+ 132,1,12,47,9,129,14,47,2,133,3,47,13,128,1,47,12,135,13,47,128,2,47,10,
-+ 135,12,47,17,47,12,135,13,47,129,14,47,2,133,3,47,13,129,10,47,11,132,1,12,
-+ 47,9,129,3,63,12,4,17,5,13,63,2,130,8,127,63,7,132,11,127,31,11,134,9,
-+ 127,8,136,3,9,13,31,13,9,3,255,255,255,180,130,2,9,1,135,6,5,132,2,13,
-+ 15,12,1,133,7,31,5,130,1,13,47,12,1,131,7,63,5,129,4,79,12,1,129,7,
-+ 79,10,130,6,79,12,1,7,79,11,1,131,6,79,13,79,11,1,133,6,127,15,11,1,
-+ 135,6,111,11,1,137,10,95,2,137,7,111,12,1,135,7,127,15,12,1,133,7,79,13,
-+ 79,12,1,131,7,79,11,1,6,79,12,1,129,5,79,11,1,129,6,79,11,129,1,13,
-+ 47,11,1,131,6,63,5,130,2,13,15,11,1,133,6,31,5,132,2,8,1,135,5,4,
-+ 255,135,128,8,127,111,7,129,10,127,111,8,129,10,127,111,8,129,10,127,111,8,129,8,
-+ 127,111,7,255,228,128,8,127,127,127,31,3,129,10,127,127,127,31,4,129,10,127,127,127,
-+ 31,4,129,10,127,127,127,31,4,129,8,127,127,127,31,3,255,255,232,129,10,63,14,130,
-+ 14,63,11,129,2,79,6,129,6,79,1,129,9,63,11,130,12,63,6,129,1,79,1,129,
-+ 4,63,11,130,7,63,6,130,10,63,1,130,12,47,10,255,219,130,7,13,14,12,4,133,
-+ 2,10,30,10,2,133,4,12,14,13,7,132,9,79,3,131,1,13,63,13,132,3,79,9,
-+ 130,1,95,9,131,5,95,5,131,10,95,1,129,3,95,12,131,8,95,7,131,12,95,3,
-+ 129,1,95,9,131,5,95,5,131,10,95,1,130,9,79,3,131,1,13,63,12,132,3,79,
-+ 8,132,7,13,14,11,3,133,2,10,30,10,1,133,4,12,14,13,7,130,131,3,10,13,
-+ 15,14,10,4,134,8,111,10,132,7,127,15,9,130,2,127,47,3,129,7,127,47,9,129,
-+ 9,127,47,11,129,9,127,47,11,129,6,127,47,8,129,1,14,127,31,2,130,6,127,15,
-+ 8,132,7,111,8,134,3,9,13,15,13,10,4,236,133,6,63,11,135,1,14,63,5,135,
-+ 9,63,11,135,2,79,3,135,10,63,9,135,4,63,14,1,135,12,63,7,135,5,63,13,
-+ 136,11,63,6,136,6,63,12,137,12,63,6,136,4,63,14,1,136,11,63,8,136,2,79,
-+ 2,136,9,63,11,136,1,14,63,5,136,6,63,12,205,130,13,63,4,137,7,63,13,138,
-+ 13,63,6,137,4,63,14,1,137,11,63,8,137,2,79,2,137,8,63,10,137,1,14,63,
-+ 3,137,8,63,9,136,1,13,63,4,136,8,63,11,136,2,79,2,136,10,63,9,136,4,
-+ 63,14,1,136,12,63,7,136,7,63,13,137,13,63,4,214,
-+};
-+static const struct fos_glyph xl_glyphs[] = {
-+ { 0, 10, 0, 0, 0, 160 }, /* 0x20 */
-+ { 0, 13, 35, 0, -35, 215 }, /* 0x21 */
-+ { 124, 15, 35, 0, -35, 245 }, /* 0x22 */
-+ { 211, 30, 34, 0, -34, 485 }, /* 0x23 */
-+ { 456, 22, 43, 0, -39, 347 }, /* 0x24 */
-+ { 721, 39, 35, 0, -35, 618 }, /* 0x25 */
-+ { 1103, 29, 35, 0, -35, 465 }, /* 0x26 */
-+ { 1393, 8, 35, 0, -35, 122 }, /* 0x27 */
-+ { 1439, 14, 43, 0, -38, 223 }, /* 0x28 */
-+ { 1612, 14, 43, 0, -38, 223 }, /* 0x29 */
-+ { 1781, 18, 38, 0, -38, 289 }, /* 0x2a */
-+ { 1918, 22, 26, 0, -26, 351 }, /* 0x2b */
-+ { 2006, 10, 12, 0, -7, 159 }, /* 0x2c */
-+ { 2055, 16, 18, 0, -18, 260 }, /* 0x2d */
-+ { 2082, 11, 7, 0, -7, 169 }, /* 0x2e */
-+ { 2115, 19, 35, 0, -35, 309 }, /* 0x2f */
-+ { 2256, 23, 35, 0, -35, 360 }, /* 0x30 */
-+ { 2525, 14, 35, 0, -35, 219 }, /* 0x31 */
-+ { 2679, 21, 35, 0, -35, 340 }, /* 0x32 */
-+ { 2883, 21, 35, 0, -35, 341 }, /* 0x33 */
-+ { 3095, 23, 35, 0, -35, 367 }, /* 0x34 */
-+ { 3259, 21, 35, 0, -35, 342 }, /* 0x35 */
-+ { 3469, 21, 35, 0, -35, 343 }, /* 0x36 */
-+ { 3700, 20, 35, 0, -35, 314 }, /* 0x37 */
-+ { 3860, 22, 35, 0, -35, 347 }, /* 0x38 */
-+ { 4115, 21, 35, 0, -35, 338 }, /* 0x39 */
-+ { 4373, 13, 24, 0, -24, 202 }, /* 0x3a */
-+ { 4439, 11, 29, 0, -25, 174 }, /* 0x3b */
-+ { 4524, 22, 26, 0, -26, 351 }, /* 0x3c */
-+ { 4665, 22, 22, 0, -22, 351 }, /* 0x3d */
-+ { 4715, 22, 26, 0, -26, 351 }, /* 0x3e */
-+ { 4856, 21, 35, 0, -35, 330 }, /* 0x3f */
-+ { 5032, 38, 36, 0, -32, 607 }, /* 0x40 */
-+ { 5477, 23, 35, 0, -35, 365 }, /* 0x41 */
-+ { 5708, 23, 35, 0, -35, 370 }, /* 0x42 */
-+ { 5970, 23, 35, 0, -35, 366 }, /* 0x43 */
-+ { 6188, 24, 35, 0, -35, 378 }, /* 0x44 */
-+ { 6454, 22, 35, 0, -35, 348 }, /* 0x45 */
-+ { 6620, 21, 35, 0, -35, 332 }, /* 0x46 */
-+ { 6776, 23, 35, 0, -35, 370 }, /* 0x47 */
-+ { 7022, 24, 35, 0, -35, 382 }, /* 0x48 */
-+ { 7295, 11, 35, 0, -35, 179 }, /* 0x49 */
-+ { 7436, 22, 35, 0, -35, 354 }, /* 0x4a */
-+ { 7628, 24, 35, 0, -35, 382 }, /* 0x4b */
-+ { 7895, 21, 35, 0, -35, 332 }, /* 0x4c */
-+ { 8045, 27, 35, 0, -35, 430 }, /* 0x4d */
-+ { 8356, 25, 35, 0, -35, 406 }, /* 0x4e */
-+ { 8671, 23, 35, 0, -35, 374 }, /* 0x4f */
-+ { 8946, 23, 35, 0, -35, 366 }, /* 0x50 */
-+ { 9152, 23, 41, 0, -35, 364 }, /* 0x51 */
-+ { 9450, 23, 35, 0, -35, 369 }, /* 0x52 */
-+ { 9715, 22, 35, 0, -35, 347 }, /* 0x53 */
-+ { 9951, 23, 35, 0, -35, 362 }, /* 0x54 */
-+ { 10102, 24, 35, 0, -35, 382 }, /* 0x55 */
-+ { 10376, 24, 35, 0, -35, 377 }, /* 0x56 */
-+ { 10610, 33, 35, 0, -35, 532 }, /* 0x57 */
-+ { 10998, 23, 35, 0, -35, 368 }, /* 0x58 */
-+ { 11235, 23, 35, 0, -35, 365 }, /* 0x59 */
-+ { 11432, 20, 35, 0, -35, 325 }, /* 0x5a */
-+ { 11588, 17, 46, 0, -39, 264 }, /* 0x5b */
-+ { 11783, 19, 35, 0, -35, 309 }, /* 0x5c */
-+ { 11925, 17, 46, 0, -39, 264 }, /* 0x5d */
-+ { 12122, 21, 35, 0, -35, 330 }, /* 0x5e */
-+ { 12259, 20, 5, 0, -5, 324 }, /* 0x5f */
-+ { 12286, 10, 35, 0, -35, 165 }, /* 0x60 */
-+ { 12318, 22, 26, 0, -26, 347 }, /* 0x61 */
-+ { 12506, 22, 35, 0, -35, 350 }, /* 0x62 */
-+ { 12745, 21, 26, 0, -26, 338 }, /* 0x63 */
-+ { 12918, 22, 35, 0, -35, 350 }, /* 0x64 */
-+ { 13151, 21, 26, 0, -26, 341 }, /* 0x65 */
-+ { 13333, 15, 35, 0, -35, 233 }, /* 0x66 */
-+ { 13483, 22, 36, 0, -26, 345 }, /* 0x67 */
-+ { 13737, 22, 35, 0, -35, 351 }, /* 0x68 */
-+ { 13980, 11, 36, 0, -36, 172 }, /* 0x69 */
-+ { 14117, 14, 47, -3, -37, 169 }, /* 0x6a */
-+ { 14306, 22, 35, 0, -35, 346 }, /* 0x6b */
-+ { 14538, 10, 35, 0, -35, 159 }, /* 0x6c */
-+ { 14679, 33, 26, 0, -26, 532 }, /* 0x6d */
-+ { 14991, 22, 26, 0, -26, 351 }, /* 0x6e */
-+ { 15195, 22, 26, 0, -26, 346 }, /* 0x6f */
-+ { 15398, 22, 35, 0, -26, 353 }, /* 0x70 */
-+ { 15633, 22, 35, 0, -26, 353 }, /* 0x71 */
-+ { 15864, 16, 26, 0, -26, 250 }, /* 0x72 */
-+ { 15990, 20, 26, 0, -26, 318 }, /* 0x73 */
-+ { 16171, 14, 32, 0, -32, 226 }, /* 0x74 */
-+ { 16310, 22, 26, 0, -26, 350 }, /* 0x75 */
-+ { 16515, 21, 26, 0, -26, 332 }, /* 0x76 */
-+ { 16685, 30, 26, 0, -26, 474 }, /* 0x77 */
-+ { 16965, 21, 26, 0, -26, 334 }, /* 0x78 */
-+ { 17143, 20, 36, 0, -26, 322 }, /* 0x79 */
-+ { 17359, 18, 26, 0, -26, 294 }, /* 0x7a */
-+ { 17476, 16, 46, 0, -39, 255 }, /* 0x7b */
-+ { 17676, 9, 42, 0, -38, 137 }, /* 0x7c */
-+ { 17847, 16, 46, 0, -39, 255 }, /* 0x7d */
-+ { 18044, 24, 19, 0, -19, 384 }, /* 0x7e */
-+ { 18122, 11, 18, 0, -18, 172 }, /* 0x80 */
-+ { 18155, 18, 41, 0, -41, 287 }, /* 0x81 */
-+ { 18278, 19, 24, 0, -24, 311 }, /* 0x82 */
-+ { 18410, 19, 17, 0, -17, 302 }, /* 0x83 */
-+ { 18437, 30, 17, 0, -17, 474 }, /* 0x84 */
-+ { 18475, 9, 35, 0, -35, 132 }, /* 0x85 */
-+ { 18521, 34, 7, 0, -7, 543 }, /* 0x86 */
-+ { 18620, 15, 19, 0, -19, 242 }, /* 0x87 */
-+ { 18686, 15, 22, 0, -22, 238 }, /* 0x88 */
-+ { 18759, 16, 22, 0, -22, 249 }, /* 0x89 */
-+};
-+static const uint8_t xl_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
-+ 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
-+ 88,89,90,91,92,93,94,255,95,96,97,98,99,100,101,102,103,104,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern xl_kern[] = {
-+ {39,45,-19},{39,65,-34},{39,74,-41},{39,97,-12},{39,99,-19},{39,100,-19},{39,101,-19},{39,111,-19},
-+ {39,115,-16},{44,48,-32},{44,55,-25},{44,75,-7},{44,76,-7},{44,84,-41},{44,86,-26},{44,87,-26},
-+ {44,88,8},{44,89,-54},{44,118,-14},{44,119,-14},{44,121,-14},{45,39,-5},{45,45,-46},{45,118,-12},
-+ {45,119,-12},{45,120,-13},{45,121,-12},{46,48,-32},{46,55,-25},{46,75,-7},{46,76,-7},{46,84,-41},
-+ {46,86,-26},{46,87,-26},{46,88,8},{46,89,-54},{46,118,-14},{46,119,-14},{46,121,-14},{49,49,-10},
-+ {50,49,-17},{51,49,-20},{52,49,-41},{52,55,-42},{53,49,-10},{54,49,-14},{55,44,-39},{55,46,-39},
-+ {56,49,-18},{57,49,-18},{65,39,-34},{65,65,18},{65,67,-13},{65,71,-13},{65,79,-13},{65,81,-13},
-+ {65,83,-18},{65,84,-47},{65,86,-55},{65,87,-55},{65,89,-38},{65,102,-4},{65,116,-4},{65,117,-9},
-+ {65,118,-26},{65,119,-26},{65,120,10},{65,121,-26},{65,133,-40},{66,44,-7},{66,46,-7},{66,65,-16},
-+ {66,86,-17},{66,87,-17},{66,88,-18},{66,89,-22},{66,115,-7},{66,118,-5},{66,119,-5},{66,121,-5},
-+ {67,45,-6},{67,65,-6},{67,88,-9},{67,89,-8},{67,99,-6},{67,100,-6},{67,101,-6},{67,111,-6},
-+ {67,118,-5},{67,119,-5},{67,121,-5},{68,44,-7},{68,46,-7},{68,65,-16},{68,86,-17},{68,87,-17},
-+ {68,88,-18},{68,89,-22},{68,115,-7},{68,118,-5},{68,119,-5},{68,121,-5},{69,65,15},{69,74,10},
-+ {70,45,-25},{70,65,-29},{70,74,-7},{70,97,-18},{70,99,-25},{70,100,-25},{70,101,-25},{70,102,-5},
-+ {70,103,-25},{70,109,-25},{70,110,-25},{70,111,-25},{70,112,-25},{70,113,-25},{70,114,-25},{70,115,-21},
-+ {70,116,-5},{70,117,-13},{70,118,-14},{70,119,-14},{70,120,-14},{70,121,-14},{70,122,-14},{71,45,-6},
-+ {71,65,-6},{71,88,-9},{71,89,-8},{71,99,-6},{71,100,-6},{71,101,-6},{71,111,-6},{71,118,-5},
-+ {71,119,-5},{71,121,-5},{74,44,-7},{74,46,-7},{74,65,-9},{74,66,-7},{74,68,-7},{74,69,-7},
-+ {74,70,-7},{74,78,-7},{74,80,-7},{75,44,7},{75,46,7},{75,65,10},{75,67,-13},{75,71,-13},
-+ {75,79,-13},{75,81,-13},{75,83,-14},{76,44,7},{76,46,7},{76,65,21},{76,84,-60},{76,89,-25},
-+ {76,102,-10},{76,116,-10},{79,45,-6},{79,65,-6},{79,88,-9},{79,89,-8},{79,99,-6},{79,100,-6},
-+ {79,101,-6},{79,111,-6},{79,118,-5},{79,119,-5},{79,121,-5},{80,44,-21},{80,46,-21},{80,65,-25},
-+ {80,74,-36},{80,86,-9},{80,87,-9},{80,88,-14},{80,89,-14},{81,45,-6},{81,65,-6},{81,88,-8},
-+ {81,89,-9},{81,99,-6},{81,100,-6},{81,101,-6},{81,111,-6},{81,118,-5},{81,119,-5},{81,121,-5},
-+ {82,65,6},{82,89,-18},{83,84,-7},{83,86,-10},{83,87,-10},{83,88,-21},{83,89,-18},{83,118,-5},
-+ {83,119,-5},{83,121,-5},{84,44,-35},{84,45,-50},{84,46,-35},{84,65,-38},{84,67,-19},{84,71,-19},
-+ {84,79,-19},{84,81,-19},{84,97,-32},{84,99,-50},{84,100,-50},{84,101,-50},{84,102,-9},{84,103,-46},
-+ {84,109,-22},{84,110,-22},{84,111,-50},{84,112,-22},{84,113,-46},{84,114,-22},{84,115,-40},{84,116,-9},
-+ {84,117,-13},{84,118,-24},{84,119,-24},{84,120,-10},{84,121,-24},{84,122,-18},{85,44,-7},{85,46,-7},
-+ {85,65,-9},{85,66,-7},{85,68,-7},{85,69,-7},{85,70,-7},{85,78,-7},{85,80,-7},{86,44,-25},
-+ {86,45,-36},{86,46,-25},{86,65,-53},{86,67,-11},{86,71,-11},{86,74,-22},{86,79,-11},{86,81,-11},
-+ {86,83,-10},{86,97,-19},{86,99,-36},{86,100,-36},{86,101,-36},{86,102,-10},{86,103,-26},{86,109,-14},
-+ {86,110,-14},{86,111,-36},{86,112,-14},{86,113,-26},{86,114,-14},{86,115,-30},{86,116,-10},{86,117,-5},
-+ {86,118,-8},{86,119,-8},{86,120,-14},{86,121,-8},{86,122,-9},{87,44,-25},{87,45,-36},{87,46,-25},
-+ {87,65,-53},{87,67,-11},{87,71,-11},{87,74,-22},{87,79,-11},{87,81,-11},{87,83,-10},{87,97,-19},
-+ {87,99,-36},{87,100,-36},{87,101,-36},{87,102,-10},{87,103,-26},{87,109,-14},{87,110,-14},{87,111,-36},
-+ {87,112,-14},{87,113,-26},{87,114,-14},{87,115,-30},{87,116,-10},{87,117,-5},{87,118,-8},{87,119,-8},
-+ {87,120,-14},{87,121,-8},{87,122,-9},{88,45,-9},{88,67,-10},{88,71,-10},{88,74,-5},{88,79,-10},
-+ {88,81,-10},{88,83,-21},{88,99,-9},{88,100,-9},{88,101,-9},{88,102,-9},{88,103,-9},{88,111,-9},
-+ {88,113,-9},{88,115,-9},{88,116,-9},{88,117,-9},{88,118,-30},{88,119,-30},{88,121,-30},{89,44,-54},
-+ {89,45,-42},{89,46,-54},{89,65,-50},{89,66,-10},{89,67,-14},{89,68,-10},{89,69,-10},{89,70,-10},
-+ {89,71,-14},{89,74,-36},{89,78,-10},{89,79,-14},{89,80,-10},{89,81,-14},{89,82,-4},{89,83,-18},
-+ {89,99,-42},{89,100,-42},{89,101,-42},{89,102,-18},{89,103,-41},{89,109,-25},{89,110,-25},{89,111,-42},
-+ {89,112,-25},{89,113,-41},{89,114,-25},{89,116,-18},{89,117,-22},{89,118,-27},{89,119,-27},{89,120,-14},
-+ {89,121,-27},{89,122,-14},{97,39,-10},{97,118,-9},{97,119,-9},{97,121,-9},{97,133,-10},{98,39,-4},
-+ {98,44,-7},{98,46,-7},{98,118,-5},{98,119,-5},{98,120,-9},{98,121,-5},{99,102,-4},{99,116,-4},
-+ {99,118,-13},{99,119,-13},{99,120,-9},{99,121,-13},{101,39,-8},{101,97,-4},{101,118,-9},{101,119,-9},
-+ {101,121,-9},{101,133,-9},{102,103,-7},{102,113,-7},{102,133,16},{103,118,-7},{103,119,-7},{103,121,-7},
-+ {104,39,-4},{104,44,-7},{104,46,-7},{104,118,-5},{104,119,-5},{104,120,-9},{104,121,-5},{105,106,-5},
-+ {107,45,-14},{107,99,-14},{107,100,-14},{107,101,-14},{107,102,-9},{107,103,-14},{107,111,-14},{107,113,-14},
-+ {107,115,-14},{107,116,-9},{109,39,-4},{109,44,-7},{109,46,-7},{109,118,-5},{109,119,-5},{109,120,-9},
-+ {109,121,-5},{110,39,-4},{110,44,-7},{110,46,-7},{110,118,-5},{110,119,-5},{110,120,-9},{110,121,-5},
-+ {111,39,-5},{111,118,-12},{111,119,-12},{111,120,-13},{111,121,-12},{112,39,-4},{112,44,-7},{112,46,-7},
-+ {112,118,-5},{112,119,-5},{112,120,-9},{112,121,-5},{113,118,-7},{113,119,-7},{113,121,-7},{114,45,-5},
-+ {114,99,-5},{114,100,-5},{114,101,-5},{114,103,-8},{114,111,-5},{114,113,-8},{114,118,6},{114,119,6},
-+ {114,121,6},{114,133,18},{115,39,-10},{115,115,-12},{115,118,-14},{115,119,-14},{115,120,-9},{115,121,-14},
-+ {115,133,-10},{117,133,-7},{118,44,-14},{118,45,-10},{118,46,-14},{118,97,-9},{118,99,-10},{118,100,-10},
-+ {118,101,-10},{118,103,-16},{118,111,-10},{118,113,-16},{118,115,-10},{118,118,7},{118,119,7},{118,121,7},
-+ {118,133,17},{119,44,-14},{119,45,-10},{119,46,-14},{119,97,-9},{119,99,-10},{119,100,-10},{119,101,-10},
-+ {119,103,-16},{119,111,-10},{119,113,-16},{119,115,-10},{119,118,7},{119,119,7},{119,121,7},{119,133,17},
-+ {120,45,-13},{120,99,-13},{120,100,-13},{120,101,-13},{120,111,-13},{121,44,-14},{121,45,-10},{121,46,-14},
-+ {121,97,-9},{121,99,-10},{121,100,-10},{121,101,-10},{121,103,-16},{121,111,-10},{121,113,-16},{121,115,-10},
-+ {121,118,7},{121,119,7},{121,121,7},{121,133,17},{133,45,-50},{133,65,-46},{133,74,-50},{133,97,-46},
-+ {133,99,-50},{133,100,-50},{133,101,-50},{133,103,-33},{133,109,-21},{133,110,-21},{133,111,-50},{133,112,-21},
-+ {133,113,-33},{133,114,-21},{133,115,-58},
-+};
-+const struct fos_font fos_font_xl_data = { xl_bits, xl_glyphs, xl_lut, xl_kern, 515, 50, 10 };
-+
-+static const uint8_t num_bits[] = {
-+ 130,113,113,49,133,6,127,127,79,5,131,8,127,127,79,7,131,8,127,127,79,7,131,8,
-+ 127,127,79,7,131,8,127,127,79,7,131,8,127,127,79,7,131,6,127,127,79,4,255,255,
-+ 255,255,211,132,3,10,14,15,13,9,2,136,5,95,14,4,134,2,14,111,14,1,133,8,
-+ 127,15,8,133,12,127,15,11,133,13,127,15,13,133,12,127,15,11,133,8,127,15,8,133,
-+ 2,14,111,14,2,134,5,95,14,4,136,3,10,14,15,14,9,2,149,145,9,95,14,2,
-+ 148,14,111,1,147,4,111,11,148,8,111,7,148,13,111,3,147,2,111,14,148,6,111,10,
-+ 148,10,111,5,148,14,111,1,147,4,111,12,148,8,111,8,148,12,111,4,147,1,111,14,
-+ 148,5,111,10,148,10,111,6,148,14,111,2,147,3,111,13,148,7,111,8,148,12,111,4,
-+ 147,1,111,14,148,5,111,11,148,9,111,7,148,13,111,2,147,3,111,13,148,7,111,9,
-+ 148,11,111,5,147,1,127,1,147,4,111,11,148,9,111,7,148,13,111,3,147,2,111,14,
-+ 148,6,111,9,148,11,111,5,148,14,111,1,147,4,111,12,148,8,111,8,148,12,111,3,
-+ 147,2,111,14,148,6,111,10,148,10,111,6,148,14,111,2,147,3,111,12,148,8,111,8,
-+ 148,12,111,4,147,1,111,14,148,5,111,11,148,9,111,6,148,14,111,2,147,3,111,13,
-+ 148,7,111,9,148,11,111,4,147,1,127,1,147,5,111,11,148,9,111,7,148,13,111,3,
-+ 147,2,111,13,148,7,111,9,148,11,111,5,148,14,111,1,147,1,14,95,10,147,142,3,
-+ 5,39,6,4,2,154,5,11,127,15,13,8,2,149,5,13,127,95,9,1,145,1,10,127,
-+ 127,15,14,4,143,1,12,127,127,63,5,142,11,127,127,95,4,140,8,127,127,111,14,2,
-+ 138,3,127,31,14,10,25,12,127,31,10,138,10,127,14,6,132,2,10,127,15,3,136,2,
-+ 127,13,2,135,8,127,10,136,7,127,4,137,11,127,1,135,11,111,10,138,2,127,4,135,
-+ 14,111,4,139,11,111,8,134,2,127,1,139,7,111,10,134,3,111,13,140,5,111,12,134,
-+ 4,111,12,140,4,111,12,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,4,111,12,140,3,111,13,134,
-+ 4,111,12,140,3,111,13,134,4,111,12,140,4,111,12,134,3,111,13,140,5,111,12,134,
-+ 2,127,140,7,111,10,135,14,111,4,139,11,111,8,135,11,111,10,138,2,127,4,135,7,
-+ 127,4,137,10,127,1,135,2,127,13,2,135,8,127,10,137,10,127,14,5,132,2,10,127,
-+ 15,3,137,3,127,31,14,10,25,12,127,31,10,139,8,127,127,111,14,2,140,11,127,127,
-+ 95,4,141,1,12,127,127,63,5,143,1,10,127,127,15,14,4,146,5,13,127,95,10,1,
-+ 149,6,11,127,15,13,8,2,154,3,5,39,6,4,2,142,135,3,11,111,13,137,3,10,
-+ 127,31,1,134,3,10,127,63,1,132,2,10,127,95,1,131,9,127,127,1,130,2,127,127,
-+ 15,1,130,1,127,127,15,1,131,127,127,15,1,131,14,127,127,1,131,13,63,13,9,5,
-+ 2,127,1,131,10,13,9,5,1,131,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,140,127,1,
-+ 140,127,1,140,127,1,140,127,1,140,127,1,140,12,95,13,131,140,1,4,6,39,5,3,
-+ 152,6,11,127,14,9,3,147,5,13,127,79,10,2,143,1,10,127,127,14,4,141,1,11,
-+ 127,127,31,14,4,140,10,127,127,63,14,2,138,7,127,127,95,11,137,1,14,127,15,12,
-+ 25,11,127,31,6,136,9,127,12,3,131,2,11,127,13,135,1,127,12,1,134,11,127,5,
-+ 134,5,127,3,135,2,14,111,9,134,10,111,10,137,8,111,13,134,13,111,5,137,3,127,
-+ 1,133,127,2,138,14,111,3,132,2,127,1,138,12,111,4,132,3,127,139,11,111,6,132,
-+ 4,127,139,12,111,6,132,4,127,139,12,111,5,132,4,127,139,14,111,4,132,2,14,95,
-+ 13,138,2,127,3,152,6,127,1,152,10,111,12,152,1,14,111,9,152,5,127,5,152,11,
-+ 127,1,151,3,127,10,152,9,127,4,151,2,127,13,152,9,127,7,151,3,127,14,1,151,
-+ 11,127,7,151,5,127,14,1,150,1,13,127,6,151,8,127,12,151,3,127,15,3,151,12,
-+ 127,9,151,7,127,14,1,150,2,14,127,5,151,11,127,10,151,6,127,14,2,150,1,14,
-+ 127,6,151,10,127,11,151,5,127,14,2,150,1,14,127,7,151,10,127,12,151,5,127,15,
-+ 3,150,1,14,127,7,151,10,127,12,151,5,127,15,3,150,1,14,127,8,151,10,127,12,
-+ 151,5,127,15,3,150,1,14,127,7,151,10,127,12,113,113,33,133,127,127,127,79,11,131,
-+ 1,127,127,127,79,13,131,1,127,127,127,79,13,131,1,127,127,127,79,13,131,1,127,127,
-+ 127,79,13,131,1,127,127,127,79,13,132,13,127,127,127,63,10,129,130,8,127,127,127,31,
-+ 14,1,133,11,127,127,127,47,2,133,11,127,127,127,47,2,133,11,127,127,127,47,2,133,
-+ 11,127,127,127,47,2,133,11,127,127,127,47,2,133,9,127,127,127,47,2,134,113,113,2,
-+ 14,127,11,151,9,127,14,2,150,4,127,15,6,150,1,13,127,11,151,9,127,14,2,150,
-+ 4,127,15,7,150,1,13,127,12,151,9,127,15,2,150,3,127,15,7,151,13,127,12,151,
-+ 8,127,15,2,150,3,127,15,7,151,13,127,12,151,8,127,15,3,150,3,127,15,7,151,
-+ 12,127,15,4,150,7,127,63,9,2,147,9,127,79,14,6,146,1,12,127,95,8,146,2,
-+ 13,127,95,6,146,2,14,15,14,9,7,9,14,127,2,146,3,8,1,130,1,10,111,11,
-+ 154,10,111,3,153,1,14,95,10,154,8,95,14,1,153,3,111,5,154,14,95,8,154,12,
-+ 95,10,154,10,95,13,154,9,111,154,8,111,2,153,7,111,3,153,6,111,3,153,6,111,
-+ 4,132,1,7,88,3,139,6,111,5,132,4,111,11,139,7,111,4,132,4,111,12,139,7,
-+ 111,3,132,4,111,13,139,8,111,3,132,3,111,14,139,10,111,2,132,1,127,1,138,11,
-+ 111,134,127,3,138,13,95,13,134,13,111,7,137,1,111,10,134,10,111,12,137,6,111,7,
-+ 134,7,127,4,136,13,111,3,134,3,127,13,1,134,8,111,14,136,12,127,13,3,131,1,
-+ 9,127,8,136,6,127,31,12,25,10,14,127,15,2,137,12,127,127,95,9,138,3,14,127,
-+ 127,63,13,1,139,4,14,127,127,31,14,3,141,4,13,127,127,14,4,143,1,10,127,95,
-+ 11,2,146,2,8,13,127,14,10,3,151,2,5,6,23,6,5,3,141,140,1,13,111,6,
-+ 154,6,127,4,154,11,111,14,154,1,127,9,154,6,127,4,154,11,111,14,154,1,127,10,
-+ 154,6,127,5,154,10,111,14,1,153,1,127,10,154,5,127,5,154,10,127,1,153,1,14,
-+ 111,11,154,5,127,6,154,10,127,1,154,14,111,11,154,5,127,6,154,10,127,2,154,14,
-+ 111,12,154,4,127,7,154,9,127,2,154,14,111,12,154,4,127,8,154,9,127,3,154,14,
-+ 111,13,135,6,111,5,137,4,127,8,135,8,111,8,137,9,127,3,135,8,111,8,137,13,
-+ 111,13,136,8,111,8,136,4,127,9,136,8,111,8,136,8,127,4,136,8,111,8,136,13,
-+ 111,14,137,8,111,8,135,3,127,9,137,8,111,8,135,8,127,4,137,8,111,8,135,13,
-+ 111,14,138,8,111,8,134,3,127,10,138,8,111,8,134,8,127,5,138,8,111,8,134,13,
-+ 127,2,113,33,9,111,8,17,131,3,127,127,127,127,15,4,129,6,127,127,127,127,15,5,
-+ 129,6,127,127,127,127,15,5,129,6,127,127,127,127,15,5,129,6,127,127,127,127,15,5,
-+ 129,6,127,127,127,127,15,5,129,4,127,127,127,127,14,3,151,8,111,8,155,8,111,8,
-+ 155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,
-+ 155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,155,8,111,8,
-+ 155,8,111,8,155,6,111,5,132,130,2,14,127,127,127,31,4,133,3,127,127,127,47,6,
-+ 133,3,127,127,127,47,6,133,3,127,127,127,47,6,133,3,127,127,127,47,6,133,3,127,
-+ 127,127,47,6,133,3,127,127,127,47,4,133,3,111,13,113,113,17,135,3,111,13,153,3,
-+ 111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,
-+ 111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,111,13,153,3,
-+ 111,13,153,3,111,13,153,3,111,13,130,1,5,10,13,14,15,14,13,10,5,140,3,111,
-+ 13,129,5,14,127,15,13,5,138,3,111,13,128,9,127,79,9,137,3,111,14,10,127,111,
-+ 9,136,3,127,127,127,15,6,135,3,127,127,127,15,14,1,134,3,127,127,127,31,8,134,
-+ 3,127,31,14,7,3,1,128,3,8,14,127,14,134,3,127,15,12,1,133,3,14,127,4,
-+ 133,3,127,14,1,135,4,127,8,133,3,127,7,137,11,111,11,133,3,127,2,137,5,111,
-+ 14,134,8,89,6,138,2,127,1,153,14,111,3,153,11,111,6,153,9,111,7,153,9,111,
-+ 7,153,8,111,8,153,7,111,9,153,8,111,8,153,8,111,8,133,4,86,3,139,9,111,
-+ 7,132,1,111,13,139,10,111,6,132,1,127,1,138,13,111,5,133,14,111,3,138,127,3,
-+ 133,12,111,7,137,3,127,1,133,9,111,11,137,8,111,14,134,5,127,3,135,1,14,111,
-+ 11,134,1,127,12,1,134,10,127,7,135,10,127,12,2,131,1,10,127,15,2,135,4,127,
-+ 31,12,25,11,14,127,15,11,137,10,127,127,111,2,137,2,14,127,127,79,7,139,3,14,
-+ 127,127,47,9,141,4,13,127,127,15,8,143,1,10,127,95,13,4,146,2,9,13,127,14,
-+ 11,5,151,2,5,6,23,6,5,3,140,141,1,4,5,23,6,5,2,151,2,8,12,127,
-+ 13,7,1,146,1,8,127,79,14,7,144,2,13,127,127,11,1,141,4,14,127,127,31,12,
-+ 1,139,2,14,127,127,63,9,139,12,127,127,95,6,137,6,127,31,12,25,12,127,15,14,
-+ 137,13,127,13,3,131,4,14,127,6,135,4,127,13,1,133,3,14,111,13,135,8,127,3,
-+ 135,8,127,1,134,12,111,10,136,1,127,5,134,127,5,137,11,111,8,133,1,127,2,137,
-+ 7,111,9,133,2,127,138,6,111,10,133,3,111,14,138,5,111,11,133,3,111,14,138,5,
-+ 111,11,133,3,111,14,138,3,111,10,133,3,111,14,139,1,82,134,3,111,14,153,3,111,
-+ 14,153,3,111,14,153,3,111,14,153,3,111,14,129,2,8,12,14,15,14,13,11,7,3,
-+ 141,3,111,14,128,8,127,31,11,3,139,3,127,11,127,79,8,138,3,127,127,111,11,137,
-+ 3,127,127,127,9,136,3,127,127,127,15,6,135,3,127,127,127,15,14,1,134,3,127,47,
-+ 10,4,1,128,2,7,14,127,9,134,3,127,31,6,133,2,13,111,14,134,3,127,15,9,
-+ 135,3,127,5,133,3,127,15,1,136,11,111,9,133,2,127,10,137,5,111,12,133,2,127,
-+ 6,137,1,127,133,2,127,4,138,14,111,2,132,2,127,2,138,12,111,4,132,2,127,1,
-+ 138,10,111,6,132,2,127,139,9,111,8,132,2,127,139,8,111,9,132,2,111,14,139,7,
-+ 111,9,132,2,111,14,139,7,111,10,132,2,111,14,139,8,111,10,132,1,127,139,8,111,
-+ 9,132,1,127,139,9,111,9,133,127,2,138,10,111,8,133,13,111,3,138,12,111,6,133,
-+ 11,111,5,138,14,111,5,133,8,111,9,137,3,127,3,133,5,111,14,137,8,127,1,133,
-+ 2,127,6,135,1,14,111,13,135,12,111,14,2,134,10,127,8,135,7,127,13,3,131,1,
-+ 10,127,15,3,135,1,14,127,15,12,25,11,127,31,11,137,7,127,127,111,3,138,12,127,
-+ 127,79,8,139,1,13,127,127,47,10,141,2,12,127,127,15,9,144,8,14,127,79,13,5,
-+ 146,1,7,12,127,14,11,5,151,1,4,6,23,6,5,3,140,128,3,14,127,127,127,47,
-+ 9,129,5,127,127,127,63,11,129,5,127,127,127,63,11,129,5,127,127,127,63,11,129,5,
-+ 127,127,127,63,11,129,5,127,127,127,63,11,129,6,127,127,127,63,11,129,6,95,4,113,
-+ 65,14,111,8,129,6,95,4,139,3,127,4,129,6,95,4,139,8,127,1,129,6,95,3,
-+ 139,12,111,11,130,1,7,56,7,139,1,127,7,149,5,127,3,149,9,111,14,150,13,111,
-+ 10,149,2,127,5,149,6,127,1,149,10,111,12,150,14,111,8,149,3,127,4,149,8,111,
-+ 14,150,12,111,11,149,1,127,7,149,5,127,3,149,9,111,13,150,13,111,9,149,2,127,
-+ 5,149,6,127,1,149,10,111,12,150,14,111,8,149,3,127,4,149,8,111,14,150,12,111,
-+ 11,149,1,127,7,149,5,127,2,149,9,111,13,150,13,111,9,149,2,127,5,149,6,127,
-+ 1,149,10,111,12,150,14,111,8,149,3,127,4,149,8,111,14,150,12,111,11,149,1,127,
-+ 6,149,5,127,2,149,9,111,13,150,13,111,9,149,2,127,5,149,6,127,1,149,10,111,
-+ 12,150,14,111,8,149,3,127,4,149,8,111,14,150,12,111,10,149,1,127,6,149,5,127,
-+ 2,149,9,111,13,150,13,111,9,150,13,95,14,4,142,141,2,5,6,23,6,4,2,152,
-+ 2,9,13,127,13,8,2,147,1,10,127,95,9,1,144,4,14,127,127,14,3,142,5,127,
-+ 127,63,4,140,3,14,127,127,63,14,2,139,13,127,127,95,12,138,7,127,31,12,25,12,
-+ 127,31,6,137,13,127,12,3,131,3,12,127,13,136,5,127,12,1,133,1,12,127,4,135,
-+ 9,127,3,135,4,127,8,135,13,111,11,137,11,111,12,134,1,127,5,137,4,111,14,134,
-+ 3,127,1,138,127,2,133,4,111,13,139,12,111,3,133,4,111,11,139,11,111,3,133,4,
-+ 111,10,139,10,111,3,133,3,111,11,139,11,111,3,133,2,111,12,139,12,111,1,134,111,
-+ 14,139,14,95,14,135,12,111,2,137,3,111,12,135,8,111,7,137,7,111,8,135,3,111,
-+ 13,137,13,111,3,136,12,111,6,135,6,111,12,137,4,127,4,133,4,127,4,138,10,127,
-+ 9,3,17,3,9,127,10,139,1,12,127,127,63,12,1,140,1,12,127,127,31,11,1,143,
-+ 8,127,127,8,145,6,127,127,7,143,1,11,127,127,31,11,1,140,1,12,127,127,63,12,
-+ 140,9,127,9,3,17,4,10,127,8,138,3,127,5,133,6,127,2,137,10,111,8,135,9,
-+ 111,9,136,1,111,14,1,135,1,111,14,136,6,111,9,137,11,111,4,135,9,111,5,137,
-+ 6,111,8,135,13,111,1,137,3,111,12,135,111,14,139,111,14,134,2,111,12,139,13,111,
-+ 1,133,3,111,11,139,12,111,2,133,4,111,10,139,11,111,3,133,4,111,10,139,11,111,
-+ 4,133,4,111,11,139,12,111,3,133,4,111,12,139,12,111,3,133,2,111,13,139,14,111,
-+ 2,133,1,127,1,137,1,127,135,14,111,3,137,4,111,13,135,11,111,7,137,8,111,10,
-+ 135,7,111,13,137,13,111,7,135,3,127,5,135,5,127,3,136,12,111,14,2,133,2,14,
-+ 111,12,137,6,127,13,3,131,3,13,127,6,138,13,127,15,12,25,12,127,15,13,139,4,
-+ 127,127,95,4,140,9,127,127,63,8,142,11,127,127,31,10,144,9,127,127,9,146,5,13,
-+ 127,63,13,5,148,1,6,12,127,12,6,1,152,1,4,6,23,6,4,1,141,139,1,4,
-+ 5,6,7,6,5,4,1,150,1,7,12,127,15,12,6,147,7,14,127,79,14,6,143,1,
-+ 11,127,127,15,10,1,140,1,13,127,127,47,11,140,11,127,127,79,9,138,6,127,127,111,
-+ 4,136,1,14,127,15,14,10,9,10,13,127,15,12,136,6,127,15,8,1,131,5,14,127,
-+ 3,135,11,127,7,134,4,127,9,134,1,127,12,136,9,111,14,134,4,127,5,136,2,127,
-+ 2,133,6,111,14,138,12,111,5,133,8,111,11,138,8,111,7,133,9,111,8,138,6,111,
-+ 9,133,10,111,7,138,5,111,11,133,11,111,6,138,4,111,12,133,12,111,6,138,3,111,
-+ 13,133,12,111,5,138,3,111,13,133,12,111,5,138,2,111,14,133,12,111,5,138,3,111,
-+ 14,133,12,111,6,138,3,111,14,133,11,111,6,138,4,111,14,133,10,111,7,138,4,111,
-+ 14,133,8,111,9,138,6,111,14,133,6,111,11,138,8,111,14,133,3,111,13,138,10,111,
-+ 14,133,1,127,2,137,14,111,14,134,13,111,7,136,4,127,14,134,8,111,14,1,135,12,
-+ 127,14,134,3,127,11,1,133,9,127,15,14,135,11,127,13,6,2,128,1,5,12,127,31,
-+ 14,135,3,127,127,127,15,14,136,9,127,127,127,14,137,12,127,127,111,14,137,1,12,127,
-+ 127,95,14,138,1,10,127,79,11,111,14,140,5,12,127,15,14,5,2,127,142,4,8,12,
-+ 14,31,14,12,7,1,128,2,127,153,2,127,153,2,127,153,2,127,153,2,127,135,97,138,
-+ 2,127,134,13,95,14,138,2,127,134,127,1,137,2,127,134,14,111,2,137,2,127,134,14,
-+ 111,2,137,3,111,14,134,13,111,4,137,5,111,13,134,11,111,7,137,9,111,12,134,9,
-+ 111,12,137,14,111,9,134,5,127,5,135,6,127,5,134,1,127,13,1,133,3,14,127,1,
-+ 135,10,127,12,2,131,5,14,127,10,136,3,127,31,11,9,10,13,127,31,2,137,9,127,
-+ 127,95,9,138,1,13,127,127,63,12,140,2,14,127,127,31,13,2,141,2,12,127,127,11,
-+ 1,143,1,8,127,79,14,7,147,2,9,13,127,11,7,1,151,2,5,6,7,6,5,4,
-+ 1,141,134,7,12,30,12,6,139,1,12,95,10,138,10,127,7,136,2,127,15,14,136,5,
-+ 127,31,3,135,7,127,31,4,135,5,127,31,3,135,2,127,15,14,137,10,127,7,137,1,
-+ 12,95,10,139,1,7,12,15,14,12,6,255,255,225,7,12,30,12,6,139,1,12,95,10,
-+ 138,10,127,7,136,2,127,15,14,136,5,127,31,3,135,7,127,31,4,135,5,127,31,3,
-+ 135,2,127,15,14,137,10,127,7,137,1,12,95,10,139,1,7,12,15,14,12,6,154,141,
-+ 3,5,6,23,6,4,1,152,6,11,14,127,12,7,1,147,5,13,127,79,14,7,145,9,
-+ 127,127,15,11,1,141,1,12,127,127,47,13,2,140,10,127,127,79,13,1,138,7,127,127,
-+ 111,10,137,2,127,31,13,10,9,10,13,127,31,4,136,9,127,13,4,132,4,12,127,12,
-+ 135,1,14,111,13,1,134,1,12,127,4,134,4,127,3,136,1,14,111,9,134,8,111,10,
-+ 138,6,111,13,134,11,111,5,138,1,14,111,1,133,12,111,1,139,11,111,3,133,13,111,
-+ 140,9,111,5,133,14,95,14,140,8,111,6,133,14,111,140,7,111,6,133,13,111,2,139,
-+ 7,111,6,133,11,111,6,139,6,111,5,133,8,111,11,140,3,68,3,134,4,127,4,153,
-+ 1,14,111,13,2,153,8,127,13,1,152,1,14,127,13,2,152,6,127,15,14,3,152,12,
-+ 127,31,5,151,2,14,127,31,9,151,3,14,127,31,12,2,150,5,127,47,14,4,150,4,
-+ 14,127,47,8,150,3,13,127,47,10,1,149,1,12,127,47,13,2,150,9,127,47,14,3,
-+ 150,6,14,127,31,14,5,150,3,13,127,47,5,150,1,10,127,47,3,151,6,127,31,13,
-+ 1,151,4,14,127,15,10,152,2,13,127,15,3,152,2,13,127,10,153,2,14,127,1,153,
-+ 6,127,5,154,12,111,8,133,7,92,10,140,7,111,11,133,12,111,1,139,3,111,12,133,
-+ 12,111,1,139,1,111,12,133,12,111,2,139,1,111,12,133,12,111,3,139,2,111,11,133,
-+ 10,111,6,139,4,111,10,133,8,111,10,139,8,111,8,133,5,111,14,1,138,14,111,4,
-+ 133,1,127,9,137,8,127,1,134,11,127,6,135,5,127,10,135,5,127,15,9,1,131,1,
-+ 8,127,15,4,136,12,127,31,11,25,11,127,31,11,137,3,127,127,111,14,2,138,6,127,
-+ 127,95,5,140,8,127,127,63,6,142,6,127,127,15,14,5,144,3,11,127,95,10,2,147,
-+ 3,9,14,127,14,9,3,152,2,5,39,6,5,2,141,
-+};
-+static const struct fos_glyph num_glyphs[] = {
-+ { 0, 17, 0, 0, 0, 269 }, /* 0x20 */
-+ { 0, 27, 30, 0, -30, 430 }, /* 0x2d */
-+ { 51, 17, 12, 0, -12, 271 }, /* 0x2e */
-+ { 115, 30, 60, 0, -60, 488 }, /* 0x2f */
-+ { 358, 38, 62, 0, -61, 601 }, /* 0x30 */
-+ { 856, 22, 60, 0, -60, 357 }, /* 0x31 */
-+ { 1073, 35, 61, 0, -61, 558 }, /* 0x32 */
-+ { 1434, 35, 61, 0, -60, 562 }, /* 0x33 */
-+ { 1819, 37, 60, 0, -60, 591 }, /* 0x34 */
-+ { 2145, 35, 61, 0, -60, 564 }, /* 0x35 */
-+ { 2555, 35, 62, 0, -61, 564 }, /* 0x36 */
-+ { 3041, 32, 60, 0, -60, 512 }, /* 0x37 */
-+ { 3327, 36, 62, 0, -61, 577 }, /* 0x38 */
-+ { 3813, 35, 62, 0, -61, 556 }, /* 0x39 */
-+ { 4298, 20, 40, 0, -40, 315 }, /* 0x3a */
-+ { 4415, 36, 62, 0, -61, 573 }, /* 0x53 */
-+};
-+static const uint8_t num_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,1,2,3,
-+ 4,5,6,7,8,9,10,11,12,13,14,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern num_kern[] = {
-+ {45,45,-65},{45,46,-8},{46,45,-8},{46,48,-51},{46,55,-39},{49,49,-23},{50,49,-36},{51,49,-43},
-+ {52,49,-65},{52,55,-67},{53,49,-23},{54,49,-30},{55,46,-69},{55,49,-8},{56,49,-38},{57,49,-38},
-+ {83,46,-8},
-+};
-+const struct fos_font fos_font_num_data = { num_bits, num_glyphs, num_lut, num_kern, 17, 84, 17 };
-+
-+static const uint8_t lbig_bits[] = {
-+ 134,2,7,11,13,14,15,14,12,9,5,140,2,9,127,31,13,6,137,4,14,127,79,10,
-+ 1,134,3,127,127,11,133,1,14,127,127,15,9,132,8,127,127,47,2,130,1,14,127,127,
-+ 47,9,130,5,127,15,12,10,14,127,14,130,8,127,11,129,3,127,15,2,129,10,127,5,
-+ 130,11,127,4,129,11,127,3,130,9,127,5,129,12,127,3,130,9,127,6,129,12,127,3,
-+ 130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,
-+ 130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,
-+ 130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,
-+ 130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,130,9,127,6,129,12,127,3,
-+ 130,9,127,6,129,12,127,3,130,9,127,6,129,11,127,3,130,9,127,5,129,10,127,5,
-+ 130,11,127,4,129,8,127,11,129,3,127,15,2,129,5,127,15,12,10,14,127,14,130,1,
-+ 14,127,127,47,9,131,8,127,127,47,2,131,1,14,127,127,15,9,133,3,127,127,12,135,
-+ 4,14,127,79,11,1,136,2,10,127,31,14,6,140,2,7,11,13,14,15,14,12,9,5,
-+ 135,130,5,10,14,127,5,128,2,9,14,127,47,6,128,8,127,79,6,128,8,127,79,6,
-+ 128,8,127,79,6,128,8,127,79,6,128,7,127,79,6,128,7,127,79,6,128,1,53,11,
-+ 127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,
-+ 127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,
-+ 127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,
-+ 127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,8,
-+ 127,6,133,8,127,6,133,8,127,6,133,8,127,6,133,6,127,5,128,134,1,6,10,13,
-+ 14,15,14,13,10,5,1,138,1,9,127,31,14,7,136,5,14,127,79,11,1,133,5,127,
-+ 127,12,1,131,3,127,127,31,8,131,12,127,127,47,2,129,4,127,127,63,8,129,9,127,
-+ 15,11,10,127,15,13,129,12,127,8,129,6,127,15,1,128,14,127,2,130,127,15,3,128,
-+ 127,15,1,130,13,127,3,128,127,15,1,130,127,15,2,128,13,111,14,1,129,3,127,15,
-+ 1,140,8,127,13,140,1,14,127,9,140,7,127,15,4,139,2,14,127,13,140,11,127,15,
-+ 6,139,7,127,15,12,139,4,127,31,3,138,2,14,127,15,7,138,1,13,127,15,10,139,
-+ 11,127,15,12,1,138,9,127,15,14,2,138,8,127,15,14,3,138,6,127,31,4,138,4,
-+ 127,31,5,138,3,14,127,15,7,138,2,14,127,15,9,139,11,127,31,121,41,4,128,12,
-+ 127,127,79,10,128,12,127,127,79,10,128,12,127,127,79,10,128,12,127,127,79,10,128,12,
-+ 127,127,79,10,128,12,127,127,79,10,128,10,127,127,79,8,128,2,127,127,63,9,129,4,
-+ 127,127,63,11,129,4,127,127,63,11,129,4,127,127,63,11,129,4,127,127,63,11,129,4,
-+ 127,127,63,11,129,4,127,127,63,11,129,1,8,121,10,127,31,9,138,1,11,127,15,12,
-+ 1,137,1,11,127,15,13,1,138,11,127,15,14,2,138,10,127,15,14,3,138,10,127,31,
-+ 4,138,10,127,31,6,138,8,127,31,11,3,138,6,127,63,14,6,137,7,127,79,8,137,
-+ 7,127,79,4,137,7,15,14,8,7,14,111,13,138,5,2,129,3,127,3,142,13,111,7,
-+ 142,12,111,9,142,12,111,10,142,11,111,11,129,4,102,4,131,11,111,11,129,127,14,131,
-+ 11,111,12,129,127,15,131,12,111,11,129,14,127,2,130,13,111,11,129,13,127,8,129,4,
-+ 127,10,129,11,127,15,11,10,127,15,8,129,8,127,127,63,4,129,2,127,127,47,14,131,
-+ 9,127,127,31,6,132,12,127,127,10,133,1,11,127,95,10,136,6,13,127,31,13,5,139,
-+ 4,9,12,14,31,14,12,9,5,134,134,5,127,14,1,143,11,127,12,143,1,127,15,8,
-+ 143,6,127,15,3,143,11,127,13,143,1,127,15,8,143,6,127,15,4,143,11,127,14,143,
-+ 1,127,15,9,143,6,127,15,4,143,11,127,14,143,1,127,15,10,143,6,127,15,5,143,
-+ 11,127,15,1,142,1,127,15,11,129,9,111,14,2,131,6,127,15,6,129,12,127,3,131,
-+ 11,127,15,1,129,12,127,3,130,1,127,15,11,130,12,127,3,130,6,127,15,7,130,12,
-+ 127,3,130,11,127,15,2,130,12,127,3,129,1,127,127,127,15,12,5,127,127,127,15,13,
-+ 6,127,127,127,15,13,6,127,127,127,15,13,6,127,127,127,15,13,6,127,127,127,15,13,
-+ 6,127,127,127,15,13,2,121,89,14,127,10,9,6,142,12,127,3,144,12,127,3,144,12,
-+ 127,3,144,12,127,3,144,12,127,3,144,12,127,3,144,12,127,3,144,12,127,3,144,10,
-+ 111,14,2,129,128,9,127,127,63,14,129,11,127,127,79,1,128,11,127,127,79,1,128,11,
-+ 127,127,79,1,128,11,127,127,79,1,128,11,127,127,79,1,128,11,127,127,79,1,128,11,
-+ 127,11,121,41,8,129,11,127,4,141,11,127,4,141,11,127,4,141,11,127,4,141,11,127,
-+ 4,141,11,127,4,1,7,12,30,13,10,5,133,11,127,7,13,111,11,1,131,11,127,127,
-+ 31,13,1,130,11,127,127,47,10,130,11,127,127,63,3,129,11,127,127,63,9,129,11,127,
-+ 127,63,13,129,11,127,15,11,10,14,127,15,129,11,127,9,129,4,127,15,2,128,3,119,
-+ 1,130,13,127,3,141,11,127,4,141,10,127,4,141,10,127,4,128,8,127,4,130,11,127,
-+ 4,128,9,127,7,130,12,127,3,128,7,127,12,129,3,127,15,2,128,4,127,15,12,10,
-+ 14,127,15,1,128,1,14,127,127,47,12,130,9,127,127,47,7,130,2,127,127,31,13,1,
-+ 131,6,127,127,15,4,133,7,127,95,14,4,135,3,12,127,47,10,1,138,3,8,11,13,
-+ 14,15,14,13,10,7,1,133,134,4,8,11,13,14,15,14,12,9,5,139,5,13,127,31,
-+ 14,7,136,10,127,95,12,1,133,10,127,127,12,1,131,6,127,127,31,9,130,1,14,127,
-+ 127,47,2,129,4,127,127,63,7,129,8,127,15,12,10,127,15,10,129,10,127,10,129,7,
-+ 127,12,129,10,127,5,129,2,127,13,129,10,127,5,129,2,127,13,129,10,127,5,130,6,
-+ 103,4,129,10,127,5,141,10,127,5,1,8,13,15,14,13,9,3,133,10,127,10,14,111,
-+ 10,1,131,10,127,127,31,12,1,130,10,127,127,47,9,130,10,127,127,63,3,129,10,127,
-+ 127,63,9,129,10,127,14,4,1,9,127,13,129,10,127,8,129,1,127,15,1,128,9,127,
-+ 6,130,13,127,3,128,9,127,5,130,12,127,4,128,9,127,5,130,12,127,5,128,9,127,
-+ 5,130,11,127,5,128,9,127,5,130,11,127,5,128,9,127,5,130,12,127,5,128,8,127,
-+ 7,130,13,127,5,128,6,127,12,129,4,127,15,4,128,4,127,15,12,10,14,127,15,2,
-+ 128,1,127,127,63,14,130,10,127,127,47,9,130,3,127,127,31,14,2,131,8,127,127,15,
-+ 6,133,8,127,111,6,135,4,12,127,47,11,2,138,3,8,11,13,14,15,14,13,10,7,
-+ 2,133,5,127,127,79,4,7,127,127,79,5,7,127,127,79,5,7,127,127,79,5,7,127,
-+ 127,79,5,7,127,127,79,5,7,127,127,79,5,8,95,14,57,10,127,15,5,8,95,11,
-+ 131,6,127,15,1,7,95,10,131,10,127,12,128,1,84,1,130,1,14,127,7,139,5,127,
-+ 15,2,139,9,127,13,140,14,127,8,139,3,127,15,3,139,8,127,14,140,13,127,9,139,
-+ 2,127,15,4,139,7,127,14,140,11,127,10,139,1,127,15,6,139,6,127,15,1,139,10,
-+ 127,11,140,14,127,7,139,4,127,15,2,139,9,127,13,140,13,127,8,139,3,127,15,3,
-+ 139,8,127,14,140,12,127,9,139,2,127,15,4,139,7,127,14,140,11,127,10,139,1,127,
-+ 15,5,139,5,127,15,1,139,10,127,11,140,12,127,6,136,134,3,8,11,14,31,14,12,
-+ 8,4,139,3,12,127,31,13,5,136,7,127,95,9,134,7,127,127,10,132,4,127,127,31,
-+ 6,131,12,127,127,31,14,130,2,127,127,63,5,129,7,127,15,11,10,127,15,9,129,9,
-+ 127,8,129,7,127,12,129,11,127,3,129,2,127,13,129,11,127,1,130,127,12,129,10,127,
-+ 2,130,127,11,129,8,127,4,129,2,127,8,129,4,127,12,2,1,11,127,2,130,13,127,
-+ 127,31,11,131,5,127,127,15,14,2,132,10,127,111,14,3,134,8,127,95,5,135,9,127,
-+ 95,14,5,133,11,127,127,15,3,131,7,127,127,31,12,131,14,111,13,18,12,127,2,129,
-+ 4,127,5,129,4,127,7,129,8,127,2,129,2,127,10,129,10,127,1,130,127,12,129,11,
-+ 127,1,130,14,111,13,129,11,127,2,130,127,12,129,10,127,3,129,2,127,11,129,8,127,
-+ 9,129,8,127,9,129,4,127,15,27,127,15,4,129,1,127,127,47,14,1,130,9,127,127,
-+ 31,8,131,1,13,127,127,13,1,132,4,14,127,95,14,3,134,4,14,127,63,13,3,136,
-+ 2,10,127,31,9,1,139,2,7,11,13,31,14,11,7,2,134,133,2,7,10,13,14,15,
-+ 14,13,11,8,4,138,2,10,127,47,13,5,135,6,127,111,9,133,5,127,127,15,9,131,
-+ 2,14,127,127,31,5,130,8,127,127,47,12,130,13,127,127,63,2,128,1,127,31,10,12,
-+ 127,15,6,128,2,127,15,4,129,10,127,8,128,3,127,14,130,5,127,10,128,4,127,13,
-+ 130,4,127,11,128,4,127,13,130,4,127,11,128,4,127,13,130,4,127,11,128,3,127,13,
-+ 130,4,127,11,128,2,127,14,130,4,127,11,128,1,127,15,1,129,6,127,11,129,13,127,
-+ 9,1,2,13,127,11,129,9,127,127,63,11,129,3,127,127,63,11,130,9,127,127,47,11,
-+ 130,1,12,127,127,31,11,131,1,10,127,11,127,11,133,3,9,12,14,15,13,9,3,4,
-+ 127,11,141,4,127,12,129,1,99,2,130,4,127,12,129,11,127,2,129,4,127,12,129,12,
-+ 127,3,129,4,127,12,129,11,127,4,129,5,127,12,129,10,127,10,129,10,127,11,129,8,
-+ 127,15,11,12,127,15,9,129,4,127,127,63,5,130,13,127,127,31,14,1,130,6,127,127,
-+ 31,7,132,9,127,127,11,134,9,127,95,10,1,135,5,13,127,31,13,6,139,4,9,12,
-+ 14,15,14,13,12,8,4,134,128,1,14,111,11,131,9,127,2,129,2,127,13,131,11,127,
-+ 4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,
-+ 4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,
-+ 4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,
-+ 4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,
-+ 4,129,2,127,14,57,14,127,4,129,2,127,127,95,4,129,2,127,127,95,4,129,2,127,
-+ 127,95,4,129,2,127,127,95,4,129,2,127,127,95,4,129,2,127,127,95,4,129,2,127,
-+ 127,95,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,
-+ 11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,
-+ 11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,
-+ 11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,
-+ 11,127,4,129,2,127,13,131,11,127,4,129,2,127,13,131,11,127,4,129,1,14,111,11,
-+ 131,9,127,2,128,128,2,14,127,63,14,11,7,2,135,3,127,127,15,8,1,133,3,127,
-+ 127,31,13,2,132,3,127,127,47,13,1,131,3,127,127,63,10,131,3,127,127,79,4,130,
-+ 3,127,127,79,11,130,3,127,14,25,12,127,31,2,129,3,127,11,130,5,127,15,6,129,
-+ 3,127,11,131,11,127,8,129,3,127,11,131,6,127,10,129,3,127,11,131,4,127,11,129,
-+ 3,127,11,131,5,127,10,129,3,127,11,131,7,127,9,129,3,127,11,131,13,127,7,129,
-+ 3,127,12,129,2,11,127,15,4,129,3,127,127,79,14,130,3,127,127,79,8,130,3,127,
-+ 127,63,14,1,130,3,127,127,63,4,131,3,127,127,47,5,132,3,127,127,15,12,3,133,
-+ 3,127,79,14,12,9,4,135,3,127,12,143,3,127,11,143,3,127,11,143,3,127,11,143,
-+ 3,127,11,143,3,127,11,143,3,127,11,143,3,127,11,143,3,127,11,143,3,127,11,143,
-+ 3,127,11,143,3,127,11,143,3,127,11,143,2,14,111,10,142,128,11,127,127,95,14,129,
-+ 13,127,127,111,1,128,13,127,127,111,1,128,13,127,127,111,1,128,13,127,127,111,1,128,
-+ 13,127,127,111,1,128,13,127,127,111,1,128,6,89,12,127,12,89,8,136,8,127,7,143,
-+ 8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,
-+ 8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,
-+ 8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,
-+ 8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,8,127,7,143,
-+ 8,127,7,143,8,127,7,143,8,127,7,143,6,127,5,135,
-+};
-+static const struct fos_glyph lbig_glyphs[] = {
-+ { 0, 11, 0, 0, 0, 173 }, /* 0x20 */
-+ { 0, 25, 37, 0, -37, 394 }, /* 0x30 */
-+ { 289, 16, 37, 0, -37, 254 }, /* 0x31 */
-+ { 451, 24, 37, 0, -37, 390 }, /* 0x32 */
-+ { 688, 24, 37, 0, -37, 385 }, /* 0x33 */
-+ { 922, 27, 37, 0, -37, 439 }, /* 0x34 */
-+ { 1132, 24, 37, 0, -37, 389 }, /* 0x35 */
-+ { 1376, 24, 37, 0, -37, 390 }, /* 0x36 */
-+ { 1658, 23, 37, 0, -37, 365 }, /* 0x37 */
-+ { 1840, 24, 37, 0, -37, 385 }, /* 0x38 */
-+ { 2105, 24, 37, 0, -37, 385 }, /* 0x39 */
-+ { 2384, 26, 37, 0, -37, 417 }, /* 0x48 */
-+ { 2669, 26, 37, 0, -37, 410 }, /* 0x50 */
-+ { 2897, 26, 37, 0, -37, 419 }, /* 0x54 */
-+};
-+static const uint8_t lbig_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 1,2,3,4,5,6,7,8,9,10,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 11,255,255,255,255,255,255,255,12,255,255,255,13,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern lbig_kern[] = {
-+ {50,49,-5},{51,49,-7},{52,49,-48},{52,55,-51},{54,49,-4},{56,49,-6},{57,49,-6},
-+};
-+const struct fos_font fos_font_lbig_data = { lbig_bits, lbig_glyphs, lbig_lut, lbig_kern, 7, 54, 11 };
-+
-+static const uint8_t lname_bits[] = {
-+ 128,4,47,3,129,4,47,3,129,3,47,2,129,3,47,2,129,2,47,1,129,2,47,1,
-+ 129,1,47,130,1,47,131,31,14,131,31,14,131,14,15,13,145,10,14,10,130,6,47,5,
-+ 129,6,47,5,130,10,14,10,129,9,31,10,128,47,3,8,31,9,128,47,3,7,31,8,
-+ 128,14,31,2,7,31,7,128,13,31,1,6,31,6,128,12,31,128,4,31,5,128,11,15,
-+ 14,227,131,6,23,5,129,39,4,132,14,31,9,128,1,47,7,131,1,47,7,128,4,47,
-+ 4,131,4,47,4,128,6,47,2,129,4,127,63,8,128,4,127,63,8,128,4,127,63,8,
-+ 130,13,31,10,128,1,47,8,132,47,8,128,2,47,6,131,2,47,7,128,4,47,4,129,
-+ 2,127,63,10,128,2,127,63,10,128,2,127,63,10,130,11,31,12,129,13,31,10,132,13,
-+ 31,10,129,47,8,132,47,8,128,3,47,5,131,1,40,3,128,2,40,2,130,129,3,10,
-+ 30,10,2,131,5,31,3,131,3,14,15,30,15,14,2,130,13,15,10,132,11,15,7,129,
-+ 8,15,10,129,7,31,2,132,13,15,130,1,15,12,128,1,14,15,8,133,11,15,7,129,
-+ 8,15,10,128,8,15,14,1,133,3,14,15,30,15,14,3,2,31,7,135,3,11,30,10,
-+ 3,128,10,15,13,142,3,31,5,142,11,15,12,142,5,31,4,128,6,11,12,9,1,136,
-+ 13,15,10,128,10,63,14,2,134,6,31,2,5,15,12,3,1,9,15,10,133,1,14,15,
-+ 9,128,10,15,4,130,14,15,133,8,15,14,1,128,10,15,4,130,14,15,132,2,14,15,
-+ 7,129,6,15,11,1,128,7,15,11,132,9,15,13,1,130,12,15,30,15,14,3,131,2,
-+ 31,5,131,1,9,30,11,3,129,130,5,11,30,12,7,135,7,95,12,1,132,2,127,8,
-+ 132,6,47,6,2,12,31,13,132,6,47,2,128,9,31,14,132,4,47,6,1,13,31,12,
-+ 133,11,31,14,12,47,5,133,2,14,79,9,134,2,13,63,7,134,2,14,79,7,129,10,
-+ 5,130,11,47,12,47,5,7,31,10,128,2,47,8,128,11,95,8,128,4,47,4,128,1,
-+ 12,63,12,129,4,47,10,18,9,63,3,129,1,14,127,31,9,130,6,127,47,5,130,4,
-+ 11,14,15,14,12,7,1,11,31,14,1,9,31,13,8,31,12,8,31,11,7,31,10,6,
-+ 31,9,5,31,8,171,129,5,47,2,130,13,31,12,130,6,47,6,130,12,47,1,129,2,
-+ 47,12,130,6,47,8,130,9,47,5,130,12,47,3,130,13,47,1,130,14,47,131,14,47,
-+ 131,14,47,131,13,47,1,130,12,47,3,130,9,47,5,130,6,47,8,130,2,47,12,131,
-+ 12,47,1,130,6,47,6,131,13,31,12,131,5,47,2,128,128,6,31,14,2,130,1,14,
-+ 31,10,131,9,47,3,130,4,47,8,131,14,31,14,131,11,47,2,130,9,47,5,130,6,
-+ 47,8,130,5,47,9,130,4,47,10,130,3,47,11,130,4,47,10,130,5,47,9,130,6,
-+ 47,8,130,9,47,5,130,11,47,2,129,1,47,14,130,4,47,8,130,9,47,3,129,1,
-+ 14,31,10,130,6,31,14,2,129,130,7,15,7,131,7,1,7,15,8,1,7,128,4,15,
-+ 14,11,15,11,14,15,5,3,12,79,13,4,129,11,47,12,1,128,3,12,79,12,3,4,
-+ 15,14,11,15,12,14,15,5,128,6,1,7,15,8,1,7,131,7,15,7,211,131,12,15,
-+ 11,135,13,15,12,135,13,15,12,135,13,15,12,131,6,127,15,5,6,127,15,22,127,15,
-+ 5,131,13,15,12,135,13,15,12,135,12,15,12,164,128,10,31,5,128,13,31,2,128,14,
-+ 15,13,129,31,10,128,2,31,6,128,3,31,2,128,135,6,95,10,6,95,10,6,95,10,
-+ 175,128,7,14,13,3,128,1,47,10,128,1,47,10,129,7,14,12,2,128,132,2,47,5,
-+ 132,7,47,1,132,12,31,11,132,2,47,6,132,7,47,1,132,12,31,11,132,2,47,6,
-+ 132,7,47,1,132,12,31,11,132,2,47,6,132,7,47,1,132,12,31,11,132,2,47,6,
-+ 132,7,47,1,132,12,31,11,132,2,47,6,132,7,31,14,1,132,129,1,9,13,15,14,
-+ 10,3,130,2,14,95,5,129,11,111,14,17,47,11,1,7,47,6,3,47,5,129,47,8,
-+ 4,47,4,129,14,31,9,4,47,4,129,14,31,9,4,47,4,129,14,31,9,4,47,4,
-+ 129,14,31,9,4,47,4,129,14,31,9,4,47,4,129,14,31,9,4,47,4,129,14,31,
-+ 9,3,47,5,129,47,8,1,47,11,1,7,47,6,128,11,111,14,1,128,2,14,95,5,
-+ 130,2,9,13,15,14,10,3,129,2,8,13,47,3,11,79,3,11,79,3,6,7,9,47,
-+ 3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,
-+ 3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,3,129,5,47,
-+ 3,129,5,47,3,129,2,9,13,15,14,10,2,130,4,14,79,14,3,129,13,111,12,128,
-+ 4,47,8,1,11,47,2,6,47,3,128,5,47,3,5,44,2,128,7,47,2,133,12,31,
-+ 14,133,4,47,9,132,1,13,31,14,2,132,10,47,6,132,6,47,9,132,3,47,12,132,
-+ 2,14,31,14,2,131,1,12,47,4,132,5,127,15,8,5,127,15,8,5,127,15,8,2,
-+ 127,15,1,2,127,15,1,2,127,15,1,132,9,47,10,132,6,47,12,1,131,4,47,13,
-+ 1,131,2,14,47,7,132,1,11,63,12,1,131,1,7,4,12,31,9,134,5,31,13,134,
-+ 4,47,128,3,41,1,128,4,47,1,6,47,2,128,5,47,1,4,47,8,1,11,31,14,
-+ 128,1,14,111,10,129,5,95,14,2,130,3,10,14,15,13,9,2,129,130,5,47,6,134,
-+ 11,47,1,133,1,47,11,134,7,47,5,134,12,31,14,1,133,2,47,10,134,8,47,4,
-+ 128,14,31,8,129,13,31,14,129,47,8,128,3,47,9,129,47,8,128,8,127,31,11,10,
-+ 127,31,11,10,127,31,11,133,1,47,9,135,47,8,135,47,8,135,47,8,135,14,31,8,
-+ 128,3,127,15,19,127,15,19,127,15,19,47,5,133,3,47,4,133,3,47,4,133,3,47,
-+ 5,6,10,8,3,129,3,47,14,63,5,128,3,127,14,128,3,47,11,3,10,47,3,128,
-+ 36,1,128,3,47,5,133,2,47,6,2,45,5,128,3,47,5,1,47,11,1,9,47,4,
-+ 128,11,111,14,1,128,2,14,95,5,130,2,9,13,15,14,11,4,129,129,2,10,13,15,
-+ 14,10,2,130,4,14,79,14,3,129,13,111,12,128,2,47,10,1,10,47,2,3,47,5,
-+ 128,5,47,2,3,47,5,129,34,128,3,47,8,12,15,12,5,129,3,127,5,128,3,127,
-+ 13,128,3,47,11,1,9,47,2,3,47,6,128,3,47,5,3,47,5,128,3,47,6,2,
-+ 47,6,128,3,47,6,128,14,31,11,1,9,47,5,128,10,127,2,128,2,14,95,7,130,
-+ 2,9,13,15,13,11,4,129,9,127,13,10,127,14,10,127,14,10,31,3,128,1,14,31,
-+ 12,2,20,129,4,47,7,132,8,47,3,132,13,31,13,132,2,47,8,132,7,47,4,132,
-+ 11,31,14,132,1,47,10,132,5,47,5,132,10,47,1,132,14,31,11,132,4,47,7,132,
-+ 9,47,2,132,13,31,12,131,129,2,9,13,15,13,10,3,130,3,14,95,4,129,12,111,
-+ 13,128,2,47,9,2,10,47,19,47,4,128,4,47,3,2,47,9,1,9,31,14,1,128,
-+ 13,111,7,129,4,95,11,130,1,12,95,6,129,10,31,11,1,11,31,13,128,1,47,5,
-+ 128,5,47,2,3,47,4,128,4,47,19,47,5,128,5,47,3,1,47,11,1,11,31,14,
-+ 129,10,111,8,129,2,13,79,12,1,130,1,9,13,15,13,8,1,129,129,6,12,30,13,
-+ 8,1,130,9,95,13,1,128,3,127,9,128,7,47,7,1,12,31,13,128,8,47,1,128,
-+ 8,47,128,8,47,1,128,7,47,1,7,47,1,128,8,47,1,4,47,7,1,13,47,17,
-+ 14,127,1,128,7,127,1,129,7,13,15,12,10,47,1,128,34,129,7,47,1,4,47,3,
-+ 128,7,47,1,4,47,8,1,12,47,128,1,14,111,11,129,5,95,14,2,130,4,11,14,
-+ 15,13,9,2,129,128,1,11,14,10,130,6,47,5,129,6,47,5,129,1,11,14,10,158,
-+ 1,11,14,10,130,6,47,5,129,6,47,5,129,1,11,14,10,129,128,6,14,13,4,128,
-+ 2,47,14,128,2,47,14,129,7,14,13,4,153,9,31,6,129,11,31,4,129,12,31,1,
-+ 129,13,15,12,130,14,15,9,130,31,5,129,129,2,9,13,15,14,10,3,130,4,14,95,
-+ 5,128,1,14,111,14,1,6,47,7,1,8,47,5,8,47,129,2,47,7,3,37,129,4,
-+ 47,6,132,2,13,47,1,131,3,14,47,6,131,2,14,47,6,132,7,47,5,133,9,31,
-+ 14,134,4,23,5,145,3,13,14,6,134,11,47,134,11,47,134,3,13,14,6,131,130,1,
-+ 63,1,133,4,63,5,133,7,63,8,133,10,63,11,133,14,79,132,2,31,11,13,31,3,
-+ 131,6,31,9,10,31,6,131,9,31,6,7,31,10,131,12,31,3,4,31,13,130,1,47,
-+ 1,2,47,1,129,4,31,13,129,14,31,5,129,7,31,14,27,14,31,8,129,11,127,12,
-+ 129,14,127,15,128,2,47,3,129,3,47,3,6,47,1,129,1,47,7,9,31,13,131,13,
-+ 31,10,128,13,63,14,11,6,131,14,111,11,130,14,127,6,129,14,31,10,1,4,14,31,
-+ 11,129,14,31,9,129,9,31,13,129,14,31,9,129,9,31,13,129,14,31,10,128,3,14,
-+ 31,9,129,14,111,14,2,129,14,111,6,130,14,111,14,3,129,14,31,10,128,3,13,31,
-+ 11,129,14,31,9,129,7,47,1,128,14,31,9,129,7,47,2,128,14,31,10,128,3,13,
-+ 47,1,128,14,127,11,129,14,111,14,2,129,13,79,13,8,1,129,129,1,8,13,15,14,
-+ 12,5,131,2,13,95,9,130,10,127,5,128,1,47,11,2,3,14,31,10,128,2,47,6,
-+ 129,11,31,12,128,2,47,6,129,3,21,3,128,2,47,6,134,2,47,6,134,2,47,6,
-+ 134,2,47,6,134,2,47,6,134,2,47,6,129,3,21,4,128,2,47,6,129,11,31,12,
-+ 128,1,47,11,2,3,14,31,10,129,10,127,4,129,2,13,95,9,131,1,8,13,15,14,
-+ 11,5,130,128,13,63,14,12,6,131,14,111,11,130,14,127,7,129,14,31,10,128,4,14,
-+ 31,12,129,14,31,9,129,10,31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,
-+ 31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,
-+ 31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,10,
-+ 31,14,129,14,31,10,128,4,14,31,12,129,14,127,7,129,14,111,11,130,13,63,14,12,
-+ 6,130,128,13,127,4,128,14,127,4,128,14,127,4,128,14,31,10,134,14,31,9,134,14,
-+ 31,9,134,14,31,10,134,14,95,1,130,14,95,1,130,14,95,1,130,14,31,10,134,14,
-+ 31,9,134,14,31,9,134,14,31,10,134,14,127,4,128,14,127,4,128,13,127,4,128,13,
-+ 127,3,128,14,127,4,128,14,127,3,128,14,31,10,134,14,31,9,134,14,31,9,134,14,
-+ 31,10,134,14,95,131,14,95,131,14,95,131,14,31,10,134,14,31,9,134,14,31,9,134,
-+ 14,31,9,134,14,31,9,134,14,31,9,134,13,31,9,133,129,1,8,13,15,14,12,6,
-+ 131,2,13,95,11,130,11,127,7,128,1,47,12,2,3,14,31,11,128,2,47,6,129,11,
-+ 31,12,128,2,47,6,129,3,20,3,128,2,47,6,134,2,47,6,3,63,12,128,2,47,
-+ 6,3,63,12,128,2,47,6,3,63,12,128,2,47,6,129,11,31,12,128,2,47,6,129,
-+ 11,31,12,128,2,47,6,129,11,31,12,128,1,47,12,2,4,47,10,129,11,127,4,129,
-+ 2,14,95,9,131,1,8,13,15,14,11,5,130,128,13,31,9,129,9,31,13,129,14,31,
-+ 9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,
-+ 9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,10,129,10,31,14,129,14,127,
-+ 14,129,14,127,14,129,14,127,14,129,14,31,10,129,10,31,14,129,14,31,9,129,9,31,
-+ 14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,31,14,129,14,31,9,129,9,31,
-+ 14,129,14,31,9,129,9,31,14,129,13,31,9,129,9,31,13,128,128,13,31,9,129,14,
-+ 31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,
-+ 31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,31,9,129,14,
-+ 31,9,129,14,31,9,129,14,31,9,129,13,31,9,128,133,5,47,3,133,5,47,3,133,
-+ 5,47,3,133,5,47,3,133,5,47,3,133,5,47,3,133,5,47,3,133,5,47,3,133,
-+ 5,47,3,133,5,47,3,5,24,7,129,5,47,3,10,31,13,129,5,47,3,10,31,14,
-+ 129,5,47,3,8,47,5,1,11,47,1,3,127,11,129,8,95,14,2,130,5,11,14,15,
-+ 13,9,1,129,128,13,31,9,129,2,14,31,8,128,14,31,9,129,10,31,14,1,128,14,
-+ 31,9,128,3,47,8,129,14,31,9,128,10,31,14,1,129,14,31,9,3,47,7,130,14,
-+ 31,9,11,31,14,1,130,14,31,13,47,7,131,14,95,1,131,14,95,6,131,14,95,12,
-+ 131,14,47,11,47,3,130,14,31,12,1,14,31,10,130,14,31,9,128,9,47,2,129,14,
-+ 31,9,128,3,47,8,129,14,31,9,129,11,31,14,129,14,31,9,129,5,47,6,128,13,
-+ 31,9,130,13,31,12,128,13,31,9,134,14,31,9,134,14,31,9,134,14,31,9,134,14,
-+ 31,9,134,14,31,9,134,14,31,9,134,14,31,9,134,14,31,9,134,14,31,9,134,14,
-+ 31,9,134,14,31,9,134,14,31,9,134,14,31,10,134,14,127,4,128,14,127,4,128,13,
-+ 127,4,128,14,31,11,130,2,14,31,10,129,63,5,129,9,47,10,129,63,13,128,2,63,
-+ 10,129,79,7,11,63,10,129,127,47,10,129,47,14,111,10,129,47,9,13,31,9,13,31,
-+ 10,129,47,8,5,15,14,1,13,31,10,129,47,8,128,11,7,128,13,31,10,129,47,8,
-+ 128,2,129,13,31,10,129,47,8,131,13,31,10,129,47,8,131,13,31,10,129,47,8,131,
-+ 13,31,10,129,47,8,131,13,31,10,129,47,8,131,13,31,10,129,47,8,131,13,31,10,
-+ 129,14,31,8,131,12,31,10,128,128,13,31,14,1,129,11,31,11,129,14,47,6,129,11,
-+ 31,11,129,14,47,11,129,11,31,11,129,14,63,1,128,11,31,11,129,14,63,6,128,11,
-+ 31,11,129,14,63,11,128,11,31,11,129,14,79,1,11,31,11,129,14,31,13,31,6,11,
-+ 31,11,129,14,31,9,14,15,27,31,11,129,14,31,25,31,12,31,11,129,14,31,9,4,
-+ 79,11,129,14,31,9,128,14,63,11,129,14,31,9,128,9,63,11,129,14,31,9,128,4,
-+ 63,11,129,14,31,9,129,14,47,11,129,14,31,9,129,9,47,11,129,13,31,9,129,4,
-+ 47,11,128,129,1,8,13,15,14,12,6,131,1,13,95,11,130,10,127,7,129,47,12,2,
-+ 3,14,31,12,128,2,47,6,129,9,31,14,128,2,47,6,129,8,47,128,2,47,6,129,
-+ 8,47,128,2,47,6,129,8,47,128,2,47,6,129,8,47,128,2,47,6,129,8,47,128,
-+ 2,47,6,129,8,47,128,2,47,6,129,8,47,128,2,47,6,129,9,31,14,128,1,47,
-+ 12,2,3,14,31,12,129,10,127,7,129,1,13,95,11,131,1,8,13,15,14,12,6,130,
-+ 128,13,79,13,7,1,130,14,111,12,130,14,127,8,129,14,31,9,128,3,13,31,13,129,
-+ 14,31,9,129,7,47,1,128,14,31,9,129,7,47,1,128,14,31,9,128,3,13,31,14,
-+ 129,14,127,10,129,14,111,13,2,129,14,79,14,10,2,130,14,31,9,135,14,31,9,135,
-+ 14,31,9,135,14,31,9,135,14,31,9,135,14,31,9,135,14,31,9,134,130,7,12,30,
-+ 11,3,132,12,95,5,130,8,111,14,1,129,14,31,12,2,5,47,7,128,1,47,6,129,
-+ 13,31,9,128,2,47,6,129,13,31,10,128,2,47,6,129,13,31,10,128,2,47,6,129,
-+ 13,31,10,128,2,47,6,129,13,31,10,128,2,47,6,129,13,31,10,128,2,47,6,129,
-+ 13,31,10,128,2,47,6,129,13,31,10,128,2,47,6,129,13,31,10,128,1,47,6,129,
-+ 13,31,9,129,13,31,12,1,5,47,6,129,7,111,14,1,130,11,95,4,132,6,47,12,
-+ 2,134,47,8,135,47,8,131,128,13,79,13,8,1,130,14,111,12,1,129,14,127,8,129,
-+ 14,31,10,128,3,13,31,14,129,14,31,9,129,7,47,1,128,14,31,9,129,7,47,2,
-+ 128,14,31,10,128,3,13,31,14,129,14,127,9,129,14,111,13,1,129,14,111,1,130,14,
-+ 31,10,3,47,4,130,14,31,9,128,13,31,9,130,14,31,9,128,9,31,14,130,14,31,
-+ 9,128,4,47,4,129,14,31,9,128,1,47,8,129,14,31,9,129,11,31,13,129,13,31,
-+ 9,129,6,47,3,129,3,10,14,15,14,10,2,130,4,95,14,4,129,14,111,13,128,3,
-+ 47,9,1,8,47,4,5,47,3,128,2,47,5,3,47,7,129,39,2,128,12,47,6,133,
-+ 3,14,47,10,1,132,3,13,47,13,3,132,1,10,63,4,133,6,47,14,17,38,1,128,
-+ 5,47,6,4,47,4,129,47,7,2,47,10,1,7,47,6,128,12,111,14,1,128,3,14,
-+ 95,6,130,2,9,13,15,14,10,4,129,6,127,31,1,6,127,31,1,6,127,31,1,130,
-+ 1,47,9,135,47,8,135,47,8,135,47,8,135,47,8,135,47,8,135,47,8,135,47,8,
-+ 135,47,8,135,47,8,135,47,8,135,47,8,135,47,8,135,14,31,8,131,128,14,31,8,
-+ 129,8,31,14,129,47,8,129,9,31,14,129,47,8,129,9,31,14,129,47,8,129,9,31,
-+ 14,129,47,8,129,9,31,14,129,47,8,129,9,31,14,129,47,8,129,9,31,14,129,47,
-+ 8,129,9,31,14,129,47,8,129,9,31,14,129,47,8,129,9,31,14,129,47,8,129,9,
-+ 31,14,129,47,8,129,9,31,14,129,14,31,9,129,9,31,14,129,12,31,14,19,14,31,
-+ 11,129,6,127,6,130,11,95,10,132,6,12,30,12,6,130,5,47,6,129,2,47,8,2,
-+ 47,8,129,4,47,5,128,14,31,11,129,6,47,2,128,11,31,13,129,9,31,14,129,8,
-+ 47,1,128,11,31,11,129,4,47,3,128,13,31,7,129,1,47,5,128,47,4,130,13,31,
-+ 8,3,47,1,130,10,31,10,5,31,13,131,6,31,12,7,31,9,131,3,31,14,10,31,
-+ 6,132,47,14,31,3,132,12,63,14,133,8,63,11,133,5,63,8,133,2,63,5,134,13,
-+ 47,1,130,6,47,3,129,14,31,4,129,13,31,10,3,47,5,128,2,47,7,129,47,7,
-+ 1,47,8,128,4,47,9,128,2,47,4,128,12,31,10,128,6,47,12,128,5,47,1,128,
-+ 9,31,12,128,8,47,14,128,7,31,13,129,6,47,128,11,63,1,9,31,11,129,3,47,
-+ 2,13,63,4,11,31,8,130,47,5,31,13,31,6,13,31,5,130,12,31,9,31,8,31,
-+ 9,47,2,130,9,31,14,31,4,31,14,31,14,131,6,79,2,12,63,11,131,3,63,14,
-+ 128,10,63,8,132,14,47,12,128,8,63,5,132,11,47,10,128,5,63,2,132,8,47,8,
-+ 128,3,47,14,133,5,47,6,129,47,12,133,2,47,3,129,13,31,8,130,4,47,4,129,
-+ 5,47,2,128,13,31,10,129,11,31,11,129,7,31,14,1,2,47,5,129,1,14,31,5,
-+ 7,31,13,131,9,31,11,12,31,7,131,3,95,1,132,12,63,10,133,5,63,4,133,1,
-+ 47,14,134,5,63,3,133,11,63,9,132,3,95,1,131,9,31,11,13,31,7,130,1,14,
-+ 31,6,7,31,13,130,7,31,14,1,2,47,5,129,13,31,10,129,11,31,11,128,4,47,
-+ 4,129,5,47,2,4,47,5,129,7,47,2,128,14,31,9,129,12,31,12,129,9,31,13,
-+ 128,1,47,7,129,4,47,2,5,47,2,130,14,31,6,9,31,11,131,8,31,10,13,31,
-+ 6,131,3,95,1,132,13,63,10,133,8,63,5,133,2,47,14,1,134,13,31,10,135,13,
-+ 31,10,135,13,31,10,135,13,31,10,135,13,31,10,135,13,31,10,135,12,31,10,131,7,
-+ 127,10,8,127,11,7,127,11,132,4,47,7,132,11,31,14,1,131,4,47,7,132,11,31,
-+ 14,1,131,4,47,7,132,11,31,14,1,131,4,47,7,132,11,31,14,1,131,4,47,7,
-+ 132,11,31,14,1,131,4,47,7,132,7,127,10,8,127,11,7,127,10,
-+};
-+static const struct fos_glyph lname_glyphs[] = {
-+ { 0, 5, 0, 0, 0, 80 }, /* 0x20 */
-+ { 0, 7, 17, 0, -17, 112 }, /* 0x21 */
-+ { 57, 9, 17, 0, -17, 138 }, /* 0x22 */
-+ { 98, 15, 17, 0, -17, 246 }, /* 0x23 */
-+ { 213, 19, 17, 0, -17, 306 }, /* 0x25 */
-+ { 393, 15, 17, 0, -17, 241 }, /* 0x26 */
-+ { 515, 4, 17, 0, -17, 68 }, /* 0x27 */
-+ { 534, 8, 21, 0, -19, 124 }, /* 0x28 */
-+ { 616, 8, 21, 0, -19, 124 }, /* 0x29 */
-+ { 705, 9, 18, 0, -18, 144 }, /* 0x2a */
-+ { 765, 11, 13, 0, -13, 175 }, /* 0x2b */
-+ { 806, 5, 6, 0, -4, 84 }, /* 0x2c */
-+ { 830, 8, 10, 0, -10, 132 }, /* 0x2d */
-+ { 841, 6, 4, 0, -4, 89 }, /* 0x2e */
-+ { 860, 10, 17, 0, -17, 166 }, /* 0x2f */
-+ { 930, 11, 17, 0, -17, 181 }, /* 0x30 */
-+ { 1041, 7, 17, 0, -17, 114 }, /* 0x31 */
-+ { 1109, 11, 17, 0, -17, 175 }, /* 0x32 */
-+ { 1199, 11, 17, 0, -17, 174 }, /* 0x33 */
-+ { 1291, 12, 17, 0, -17, 194 }, /* 0x34 */
-+ { 1369, 11, 17, 0, -17, 176 }, /* 0x35 */
-+ { 1459, 11, 17, 0, -17, 176 }, /* 0x36 */
-+ { 1568, 10, 17, 0, -17, 163 }, /* 0x37 */
-+ { 1640, 11, 17, 0, -17, 176 }, /* 0x38 */
-+ { 1747, 11, 17, 0, -17, 174 }, /* 0x39 */
-+ { 1853, 7, 12, 0, -12, 110 }, /* 0x3a */
-+ { 1890, 6, 14, 0, -12, 93 }, /* 0x3b */
-+ { 1932, 11, 17, 0, -17, 175 }, /* 0x3f */
-+ { 2014, 12, 17, 0, -17, 193 }, /* 0x41 */
-+ { 2114, 12, 17, 0, -17, 188 }, /* 0x42 */
-+ { 2226, 12, 17, 0, -17, 186 }, /* 0x43 */
-+ { 2331, 12, 17, 0, -17, 190 }, /* 0x44 */
-+ { 2450, 11, 17, 0, -17, 175 }, /* 0x45 */
-+ { 2518, 11, 17, 0, -17, 168 }, /* 0x46 */
-+ { 2584, 12, 17, 0, -17, 187 }, /* 0x47 */
-+ { 2701, 12, 17, 0, -17, 192 }, /* 0x48 */
-+ { 2826, 6, 17, 0, -17, 92 }, /* 0x49 */
-+ { 2895, 11, 17, 0, -17, 181 }, /* 0x4a */
-+ { 2980, 12, 17, 0, -17, 196 }, /* 0x4b */
-+ { 3102, 11, 17, 0, -17, 170 }, /* 0x4c */
-+ { 3170, 14, 17, 0, -17, 219 }, /* 0x4d */
-+ { 3297, 13, 17, 0, -17, 206 }, /* 0x4e */
-+ { 3435, 12, 17, 0, -17, 189 }, /* 0x4f */
-+ { 3552, 12, 17, 0, -17, 186 }, /* 0x50 */
-+ { 3644, 12, 20, 0, -17, 184 }, /* 0x51 */
-+ { 3776, 12, 17, 0, -17, 188 }, /* 0x52 */
-+ { 3893, 11, 17, 0, -17, 178 }, /* 0x53 */
-+ { 3995, 12, 17, 0, -17, 187 }, /* 0x54 */
-+ { 4052, 12, 17, 0, -17, 192 }, /* 0x55 */
-+ { 4168, 12, 17, 0, -17, 195 }, /* 0x56 */
-+ { 4275, 17, 17, 0, -17, 276 }, /* 0x57 */
-+ { 4436, 12, 17, 0, -17, 190 }, /* 0x58 */
-+ { 4541, 12, 17, 0, -17, 190 }, /* 0x59 */
-+ { 4631, 10, 17, 0, -17, 165 }, /* 0x5a */
-+};
-+static const uint8_t lname_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,255,4,5,6,7,8,9,10,11,12,13,14,
-+ 15,16,17,18,19,20,21,22,23,24,25,26,255,255,255,27,255,28,29,30,31,32,33,34,
-+ 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern lname_kern[] = {
-+ {39,45,-9},{39,65,-20},{39,74,-26},{44,48,-17},{44,55,-14},{44,84,-22},{44,86,-16},{44,87,-16},
-+ {44,88,4},{44,89,-30},{45,45,-28},{46,48,-17},{46,55,-14},{46,84,-22},{46,86,-16},{46,87,-16},
-+ {46,88,4},{46,89,-30},{50,49,-6},{51,49,-6},{52,49,-22},{52,55,-22},{54,49,-4},{55,44,-18},
-+ {55,46,-18},{56,49,-6},{57,49,-6},{65,39,-20},{65,65,6},{65,67,-8},{65,71,-8},{65,79,-8},
-+ {65,81,-8},{65,83,-10},{65,84,-24},{65,86,-30},{65,87,-30},{65,89,-22},{66,65,-8},{66,86,-10},
-+ {66,87,-10},{66,88,-11},{66,89,-14},{67,65,-4},{67,88,-6},{67,89,-5},{68,65,-8},{68,86,-10},
-+ {68,87,-10},{68,88,-11},{68,89,-14},{69,65,6},{70,45,-14},{70,65,-16},{71,65,-4},{71,88,-6},
-+ {71,89,-5},{74,65,-6},{75,67,-8},{75,71,-8},{75,79,-8},{75,81,-8},{75,83,-9},{76,65,7},
-+ {76,84,-33},{76,89,-14},{79,65,-4},{79,88,-6},{79,89,-5},{80,44,-7},{80,46,-7},{80,65,-14},
-+ {80,74,-23},{80,86,-6},{80,87,-6},{80,88,-9},{80,89,-9},{81,65,-4},{81,88,-5},{81,89,-6},
-+ {82,89,-11},{83,86,-6},{83,87,-6},{83,88,-11},{83,89,-10},{84,44,-17},{84,45,-28},{84,46,-17},
-+ {84,65,-22},{84,67,-8},{84,71,-8},{84,79,-8},{84,81,-8},{85,65,-6},{86,44,-14},{86,45,-20},
-+ {86,46,-14},{86,65,-30},{86,67,-7},{86,71,-7},{86,74,-14},{86,79,-7},{86,81,-7},{86,83,-6},
-+ {87,44,-14},{87,45,-20},{87,46,-14},{87,65,-30},{87,67,-7},{87,71,-7},{87,74,-14},{87,79,-7},
-+ {87,81,-7},{87,83,-6},{88,45,-6},{88,67,-6},{88,71,-6},{88,79,-6},{88,81,-6},{88,83,-11},
-+ {89,44,-30},{89,45,-24},{89,46,-30},{89,65,-28},{89,67,-9},{89,71,-9},{89,74,-23},{89,79,-9},
-+ {89,81,-9},{89,83,-11},
-+};
-+const struct fos_font fos_font_lname_data = { lname_bits, lname_glyphs, lname_lut, lname_kern, 130, 25, 5 };
-+
-+static const uint8_t lsm_bits[] = {
-+ 128,15,7,129,15,7,129,14,7,129,14,6,129,14,6,129,13,5,133,4,1,128,1,14,
-+ 8,128,11,9,10,27,25,10,9,24,9,151,129,27,128,27,130,14,9,128,14,9,129,95,
-+ 5,128,7,15,8,7,15,8,2,128,4,15,3,4,15,3,129,6,15,3,6,15,3,128,
-+ 7,79,14,128,2,12,13,4,12,13,3,129,13,10,128,12,10,129,128,7,14,11,1,128,
-+ 5,11,129,2,13,6,11,7,128,13,3,129,3,11,2,24,7,9,131,11,15,14,3,14,
-+ 2,132,3,1,24,128,1,132,2,14,2,12,15,9,131,10,23,10,5,12,4,129,3,13,
-+ 128,6,11,6,12,3,129,11,5,128,1,11,15,8,128,128,5,13,14,8,131,14,12,9,
-+ 15,4,129,1,15,7,3,15,5,130,9,14,29,1,130,6,31,2,130,3,15,10,14,8,
-+ 7,8,128,8,15,128,5,31,7,128,7,15,23,31,2,128,1,10,30,8,28,128,43,10,
-+ 25,139,128,12,11,128,4,15,6,128,9,15,2,128,12,14,129,14,12,129,15,11,129,15,
-+ 11,129,14,11,129,12,13,129,9,15,1,128,4,15,5,129,13,11,128,1,15,7,129,11,
-+ 14,129,7,15,3,128,4,15,6,128,2,15,8,128,1,15,9,128,1,15,9,128,2,15,
-+ 8,128,4,15,6,128,7,15,3,128,11,13,128,1,15,7,128,18,12,2,1,6,13,14,
-+ 12,3,6,13,14,12,19,2,12,2,1,152,129,11,6,129,17,11,7,1,128,10,63,6,
-+ 2,4,12,9,4,1,129,11,6,141,4,15,128,6,12,128,24,128,49,10,31,13,2,20,
-+ 3,139,130,6,15,2,1,3,128,129,3,15,5,129,7,15,1,129,12,11,129,2,15,6,
-+ 129,6,15,2,129,11,12,129,1,15,7,129,5,15,3,129,9,13,130,128,8,14,13,6,
-+ 128,5,15,8,10,15,2,7,15,128,3,15,5,8,15,128,2,15,5,8,15,128,2,15,
-+ 5,8,15,128,2,15,5,7,15,128,3,15,21,15,8,10,15,2,128,8,30,6,128,8,
-+ 14,15,128,8,12,15,129,8,15,129,8,15,129,8,15,129,8,15,129,8,15,129,8,15,
-+ 129,8,15,128,128,9,14,13,4,128,6,15,7,12,13,128,9,14,128,8,15,131,11,13,
-+ 130,4,15,6,129,1,13,11,130,10,14,2,129,6,15,9,21,1,9,63,4,8,63,128,
-+ 2,5,6,15,12,130,10,14,2,129,5,15,11,1,130,4,11,10,131,7,14,128,8,12,
-+ 128,7,15,128,7,15,7,28,128,1,10,14,13,4,128,128,1,15,8,130,7,15,3,130,
-+ 28,130,2,15,7,5,15,2,8,15,3,7,15,3,12,63,11,3,20,8,15,5,130,5,
-+ 15,2,130,5,15,2,7,63,1,8,15,37,128,8,15,131,8,15,12,15,7,128,7,15,
-+ 7,11,15,1,128,1,128,5,15,2,4,9,128,5,15,2,4,15,9,11,15,129,9,14,
-+ 13,5,128,128,9,14,13,5,128,5,15,8,12,14,128,7,15,1,3,6,128,7,15,14,
-+ 15,6,128,7,15,8,11,15,128,7,15,1,5,15,3,7,15,1,5,15,3,4,15,9,
-+ 11,15,1,128,9,14,13,6,128,12,47,14,12,9,5,29,1,128,1,14,9,129,4,15,
-+ 5,129,9,15,1,129,13,11,129,2,15,7,129,7,15,2,129,11,13,129,1,10,14,13,
-+ 5,128,6,15,7,11,14,128,6,15,3,8,15,1,128,12,31,12,128,3,15,8,12,7,
-+ 128,6,15,128,6,14,128,7,15,128,6,15,1,3,15,9,12,14,129,8,14,13,4,128,
-+ 1,11,14,12,3,128,8,15,7,13,12,128,11,12,128,8,14,128,9,14,3,11,15,128,
-+ 3,14,47,129,2,3,8,15,128,8,14,128,9,15,128,6,15,8,29,129,10,14,13,3,
-+ 128,130,2,15,7,128,3,1,136,2,15,7,128,3,1,5,14,3,6,15,3,128,1,134,
-+ 4,15,1,5,12,128,7,9,128,1,10,14,13,3,128,8,15,7,12,13,128,10,12,128,
-+ 8,15,1,130,12,13,130,10,15,5,129,3,15,7,130,2,10,2,131,4,1,130,4,14,
-+ 4,129,129,14,13,130,3,31,2,129,6,12,14,5,129,10,9,11,9,129,13,6,8,12,
-+ 128,1,15,4,5,15,1,4,63,4,8,14,19,15,7,27,129,12,10,4,31,14,8,128,
-+ 4,15,7,9,15,5,4,15,3,128,15,8,4,15,20,15,5,4,47,12,128,4,15,22,
-+ 15,5,4,15,3,128,13,9,4,15,23,15,7,4,31,14,10,1,128,8,30,7,128,4,
-+ 15,24,15,4,7,15,17,11,5,7,15,1,130,7,15,1,130,7,15,1,130,7,15,17,
-+ 11,5,4,15,24,15,4,128,8,30,7,128,4,31,14,8,128,4,15,7,8,15,5,4,
-+ 15,3,128,15,8,4,15,3,128,15,8,4,15,3,128,15,8,4,15,3,128,15,8,4,
-+ 15,3,1,15,8,4,15,7,9,15,5,4,31,14,8,128,4,63,3,4,15,7,21,1,
-+ 4,15,3,130,4,15,4,1,129,4,47,1,128,4,15,6,4,129,4,15,3,130,4,15,
-+ 7,21,1,4,63,3,4,63,3,4,15,7,21,1,4,15,3,130,4,15,4,1,129,4,
-+ 47,1,128,4,15,6,4,129,4,15,3,130,4,15,3,130,4,15,3,130,128,8,30,8,
-+ 128,4,15,25,15,4,7,15,17,12,5,7,15,33,128,7,15,2,31,23,15,1,5,15,
-+ 23,15,17,15,7,4,15,25,15,4,128,8,30,7,128,4,15,3,128,15,7,4,15,3,
-+ 128,15,8,4,15,3,128,15,8,4,15,4,1,15,8,4,63,8,4,15,6,4,15,8,
-+ 4,15,3,128,15,8,4,15,3,128,15,8,4,15,3,128,15,7,4,15,3,4,15,3,
-+ 4,15,3,4,15,3,4,15,3,4,15,3,4,15,3,4,15,3,4,15,3,130,7,15,
-+ 1,130,7,15,1,130,7,15,1,130,7,15,1,130,7,15,1,21,128,7,15,1,12,11,
-+ 128,7,15,1,9,14,6,12,13,128,1,11,14,12,3,128,4,15,3,1,14,10,4,15,
-+ 3,8,15,2,4,15,4,14,9,128,4,15,12,14,1,128,4,47,2,128,4,15,9,14,
-+ 8,128,4,15,3,9,14,1,4,15,19,15,6,4,15,3,128,28,4,15,3,130,4,15,
-+ 3,130,4,15,3,130,4,15,3,130,4,15,3,130,4,15,3,130,4,15,3,130,4,15,
-+ 7,21,1,4,63,3,5,15,6,128,6,15,21,15,14,2,14,15,21,31,14,31,21,15,
-+ 8,15,8,15,21,15,3,8,3,15,21,15,3,128,3,15,21,15,3,128,3,15,21,15,
-+ 3,128,3,15,21,15,2,128,2,15,5,4,15,7,128,9,13,128,4,15,13,128,9,13,
-+ 128,4,31,3,9,13,128,4,15,14,25,13,128,4,15,8,14,9,13,128,4,15,4,30,
-+ 13,128,4,15,3,10,15,13,128,4,15,3,4,15,13,128,4,15,3,128,14,13,128,128,
-+ 7,30,8,128,4,15,9,8,15,5,7,15,1,128,15,8,7,15,1,128,15,8,7,15,
-+ 1,128,15,8,7,15,1,128,15,8,7,15,1,128,15,8,4,15,9,8,15,5,128,7,
-+ 30,8,128,5,47,9,128,5,15,7,8,15,6,5,15,3,128,14,9,5,15,20,15,7,
-+ 5,47,13,1,5,15,6,3,1,128,5,15,3,130,5,15,3,130,5,15,3,130,128,7,
-+ 14,13,6,128,3,15,9,10,15,2,6,15,1,3,15,5,7,15,1,2,15,6,7,15,
-+ 1,2,15,6,7,15,1,2,15,6,7,15,1,2,15,22,15,3,4,15,5,1,46,13,
-+ 1,128,2,29,2,130,12,10,129,4,47,9,128,4,15,7,8,15,6,4,15,3,128,14,
-+ 9,4,15,20,15,8,4,47,13,1,4,15,6,14,8,128,4,15,3,9,13,128,4,15,
-+ 3,4,15,3,4,15,3,128,14,8,128,10,14,13,5,128,6,15,7,11,14,1,8,14,
-+ 128,4,13,2,3,15,9,131,5,14,12,2,130,2,29,128,7,12,128,4,15,3,6,15,
-+ 8,10,15,1,128,9,14,13,5,128,10,63,8,3,5,14,12,5,3,129,13,10,131,13,
-+ 10,131,13,10,131,13,10,131,13,10,131,13,10,131,13,10,129,5,15,2,128,14,8,5,
-+ 15,2,128,14,8,5,15,2,128,14,8,5,15,2,128,14,8,5,15,2,128,14,8,5,
-+ 15,2,128,14,8,5,15,3,128,14,8,2,15,10,8,15,5,128,6,13,14,8,128,8,
-+ 15,1,128,13,10,5,15,3,1,15,7,2,15,6,3,15,4,128,14,8,6,15,1,128,
-+ 27,8,12,129,8,14,11,9,129,4,15,14,6,129,1,31,3,130,13,14,129,9,14,128,
-+ 6,15,1,3,15,4,6,15,1,8,15,4,6,15,1,3,15,4,10,15,6,8,13,128,
-+ 1,15,6,29,9,10,11,129,12,9,15,9,11,13,8,129,9,14,15,4,14,15,5,129,
-+ 6,15,13,2,31,2,129,3,15,10,128,30,130,1,15,8,128,12,11,129,7,15,17,15,
-+ 7,1,15,23,14,1,128,10,28,9,129,3,31,3,130,14,13,130,3,31,3,129,9,28,
-+ 9,128,1,15,23,14,1,7,15,17,15,7,7,15,1,2,15,6,2,15,5,6,15,1,
-+ 128,12,10,27,129,6,14,15,5,129,1,15,14,1,130,12,11,131,12,11,131,12,11,131,
-+ 12,11,129,10,47,14,3,21,13,12,129,3,15,5,129,11,13,129,3,15,6,129,10,14,
-+ 129,2,15,7,129,9,15,6,21,10,47,14,
-+};
-+static const struct fos_glyph lsm_glyphs[] = {
-+ { 0, 3, 0, 0, 0, 42 }, /* 0x20 */
-+ { 0, 4, 9, 0, -9, 56 }, /* 0x21 */
-+ { 26, 4, 9, 0, -9, 64 }, /* 0x22 */
-+ { 36, 8, 9, 0, -9, 126 }, /* 0x23 */
-+ { 90, 10, 9, 0, -9, 161 }, /* 0x25 */
-+ { 159, 8, 9, 0, -9, 121 }, /* 0x26 */
-+ { 214, 2, 9, 0, -9, 32 }, /* 0x27 */
-+ { 218, 4, 12, 0, -11, 58 }, /* 0x28 */
-+ { 259, 4, 12, 0, -11, 58 }, /* 0x29 */
-+ { 305, 5, 9, 0, -9, 75 }, /* 0x2a */
-+ { 324, 6, 7, 0, -7, 91 }, /* 0x2b */
-+ { 346, 3, 3, 0, -2, 41 }, /* 0x2c */
-+ { 354, 4, 6, 0, -6, 68 }, /* 0x2d */
-+ { 362, 3, 3, 0, -2, 44 }, /* 0x2e */
-+ { 369, 5, 9, 0, -9, 80 }, /* 0x2f */
-+ { 403, 6, 9, 0, -9, 94 }, /* 0x30 */
-+ { 455, 4, 9, 0, -9, 57 }, /* 0x31 */
-+ { 484, 6, 9, 0, -9, 88 }, /* 0x32 */
-+ { 525, 6, 9, 0, -9, 89 }, /* 0x33 */
-+ { 567, 6, 9, 0, -9, 95 }, /* 0x34 */
-+ { 606, 6, 9, 0, -9, 89 }, /* 0x35 */
-+ { 651, 6, 9, 0, -9, 89 }, /* 0x36 */
-+ { 705, 5, 9, 0, -9, 82 }, /* 0x37 */
-+ { 740, 6, 9, 0, -9, 90 }, /* 0x38 */
-+ { 792, 6, 9, 0, -9, 88 }, /* 0x39 */
-+ { 841, 3, 8, 0, -7, 52 }, /* 0x3a */
-+ { 855, 3, 8, 0, -7, 45 }, /* 0x3b */
-+ { 873, 6, 9, 0, -9, 86 }, /* 0x3f */
-+ { 914, 6, 9, 0, -9, 95 }, /* 0x41 */
-+ { 955, 6, 9, 0, -9, 96 }, /* 0x42 */
-+ { 1002, 6, 9, 0, -9, 95 }, /* 0x43 */
-+ { 1044, 6, 9, 0, -9, 98 }, /* 0x44 */
-+ { 1096, 6, 9, 0, -9, 90 }, /* 0x45 */
-+ { 1134, 6, 9, 0, -9, 86 }, /* 0x46 */
-+ { 1172, 6, 9, 0, -9, 96 }, /* 0x47 */
-+ { 1215, 6, 9, 0, -9, 99 }, /* 0x48 */
-+ { 1266, 3, 9, 0, -9, 47 }, /* 0x49 */
-+ { 1293, 6, 9, 0, -9, 92 }, /* 0x4a */
-+ { 1336, 6, 9, 0, -9, 99 }, /* 0x4b */
-+ { 1386, 6, 9, 0, -9, 86 }, /* 0x4c */
-+ { 1422, 7, 9, 0, -9, 112 }, /* 0x4d */
-+ { 1475, 7, 9, 0, -9, 105 }, /* 0x4e */
-+ { 1535, 6, 9, 0, -9, 97 }, /* 0x4f */
-+ { 1587, 6, 9, 0, -9, 95 }, /* 0x50 */
-+ { 1630, 6, 11, 0, -9, 95 }, /* 0x51 */
-+ { 1689, 6, 9, 0, -9, 96 }, /* 0x52 */
-+ { 1738, 6, 9, 0, -9, 90 }, /* 0x53 */
-+ { 1786, 6, 9, 0, -9, 94 }, /* 0x54 */
-+ { 1817, 6, 9, 0, -9, 99 }, /* 0x55 */
-+ { 1871, 6, 9, 0, -9, 98 }, /* 0x56 */
-+ { 1917, 9, 9, 0, -9, 138 }, /* 0x57 */
-+ { 1988, 6, 9, 0, -9, 96 }, /* 0x58 */
-+ { 2028, 6, 9, 0, -9, 95 }, /* 0x59 */
-+ { 2067, 5, 9, 0, -9, 84 }, /* 0x5a */
-+};
-+static const uint8_t lsm_lut[256] = {
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,0,1,2,3,255,4,5,6,7,8,9,10,11,12,13,14,
-+ 15,16,17,18,19,20,21,22,23,24,25,26,255,255,255,27,255,28,29,30,31,32,33,34,
-+ 35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+ 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-+};
-+static const struct fos_kern lsm_kern[] = {
-+ {39,45,-5},{39,65,-9},{39,74,-11},{44,48,-8},{44,55,-6},{44,84,-11},{44,86,-7},{44,87,-7},
-+ {44,89,-14},{45,45,-12},{46,48,-8},{46,55,-6},{46,84,-11},{46,86,-7},{46,87,-7},{46,89,-14},
-+ {50,49,-4},{51,49,-5},{52,49,-11},{52,55,-11},{54,49,-4},{55,44,-10},{55,46,-10},{56,49,-5},
-+ {57,49,-5},{65,39,-9},{65,65,5},{65,83,-5},{65,84,-12},{65,86,-14},{65,87,-14},{65,89,-10},
-+ {66,65,-4},{66,86,-4},{66,87,-4},{66,88,-5},{66,89,-6},{68,65,-4},{68,86,-4},{68,87,-4},
-+ {68,88,-5},{68,89,-6},{69,65,4},{70,45,-6},{70,65,-7},{75,83,-4},{76,65,5},{76,84,-16},
-+ {76,89,-6},{80,44,-5},{80,46,-5},{80,65,-6},{80,74,-9},{80,88,-4},{80,89,-4},{82,89,-5},
-+ {83,88,-5},{83,89,-5},{84,44,-9},{84,45,-13},{84,46,-9},{84,65,-10},{84,67,-5},{84,71,-5},
-+ {84,79,-5},{84,81,-5},{86,44,-6},{86,45,-9},{86,46,-6},{86,65,-14},{86,74,-6},{87,44,-6},
-+ {87,45,-9},{87,46,-6},{87,65,-14},{87,74,-6},{88,83,-5},{89,44,-14},{89,45,-11},{89,46,-14},
-+ {89,65,-13},{89,67,-4},{89,71,-4},{89,74,-9},{89,79,-4},{89,81,-4},{89,83,-5},
-+};
-+const struct fos_font fos_font_lsm_data = { lsm_bits, lsm_glyphs, lsm_lut, lsm_kern, 87, 13, 3 };
-diff --git a/src/fos_gfx.c b/src/fos_gfx.c
-new file mode 100644
-index 000000000..4c4bbbc16
---- /dev/null
-+++ b/src/fos_gfx.c
-@@ -0,0 +1,970 @@
-+/* fos_gfx: palette ramps, dithering, anti-aliased shapes and text.
-+ * See fos_gfx.h for the idea. Everything here is integer maths except the
-+ * one-time palette build. */
-+
-+#include "fos_gfx.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+
-+/* ---------------------------------------------------------------- ramps */
-+
-+struct ramp_def
-+{
-+ uint32_t lo, mid, hi; /* near-black, hue, light tint (0xRRGGBB) */
-+ int mid_at; /* level of the hue, 0 = straight lo -> hi */
-+ int n; /* palette entries */
-+};
-+
-+/* 254 entries in all (index 0 and 255 stay Canon's) */
-+static const struct ramp_def ramp_defs[RAMP_COUNT] =
-+{
-+ [RAMP_GRAY] = { 0x040303, 0, 0xFFFCF6, 0, 86 },
-+ [RAMP_METAL] = { 0x050608, 0x878F98, 0xF4F7FA, 150, 22 },
-+ [RAMP_AMBER] = { 0x080402, 0xF4A81C, 0xFFF2D2, 185, 24 },
-+ [RAMP_RED] = { 0x080202, 0xDF262D, 0xFFD8D4, 150, 18 },
-+ [RAMP_ORANGE] = { 0x080302, 0xEA5D1E, 0xFFDEC9, 160, 16 },
-+ [RAMP_CRIMSON] = { 0x060102, 0x9C1320, 0xF6C4C8, 120, 16 },
-+ [RAMP_GREEN] = { 0x020604, 0x13894B, 0xD0F5DF, 140, 18 },
-+ [RAMP_VIOLET] = { 0x040208, 0x5A2D8A, 0xE9DCF7, 120, 16 },
-+ [RAMP_BLUE] = { 0x020508, 0x1E77C6, 0xD5EBFF, 150, 16 },
-+ [RAMP_LEADER] = { 0x050403, 0x4C3B2E, 0xDCCAB6, 130, 22 },
-+};
-+
-+uint32_t fos_pal[256];
-+
-+uint8_t fos_ramp_base[RAMP_COUNT];
-+uint8_t fos_ramp_last[RAMP_COUNT];
-+int fos_ramp_mul[RAMP_COUNT];
-+#define ramp_base fos_ramp_base
-+#define ramp_mul fos_ramp_mul
-+static uint8_t ramp_n[RAMP_COUNT];
-+
-+uint8_t fos_rev_ramp[256];
-+uint16_t fos_rev_lv[256];
-+uint8_t fos_luma_tab[256];
-+uint8_t fos_chroma_tab[256];
-+uint16_t fos_lum2lv[RAMP_COUNT][256];
-+#define rev_ramp fos_rev_ramp
-+#define rev_lv fos_rev_lv
-+#define luma_tab fos_luma_tab
-+#define chroma_tab fos_chroma_tab
-+#define lum2lv fos_lum2lv
-+
-+const uint8_t fos_bayer[4][4] =
-+{
-+ { 0, 8, 2, 10 },
-+ { 12, 4, 14, 6 },
-+ { 3, 11, 1, 9 },
-+ { 15, 7, 13, 5 },
-+};
-+
-+static int chan(uint32_t c, int s) { return (c >> s) & 0xFF; }
-+
-+static uint32_t lerp_rgb(uint32_t a, uint32_t b, int t, int tmax)
-+{
-+ uint32_t out = 0;
-+ for (int s = 0; s <= 16; s += 8)
-+ {
-+ int v = chan(a, s) + (chan(b, s) - chan(a, s)) * t / tmax;
-+ out |= (uint32_t) fos_clamp(v, 0, 255) << s;
-+ }
-+ return out;
-+}
-+
-+static int rgb_luma(uint32_t c)
-+{
-+ return (54 * chan(c, 16) + 183 * chan(c, 8) + 19 * chan(c, 0) + 128) >> 8;
-+}
-+
-+static int rgb_chroma(uint32_t c)
-+{
-+ int r = chan(c, 16), g = chan(c, 8), b = chan(c, 0);
-+ int mx = r > g ? (r > b ? r : b) : (g > b ? g : b);
-+ int mn = r < g ? (r < b ? r : b) : (g < b ? g : b);
-+ return mx - mn;
-+}
-+
-+FOS_INLINE int ix_near(int ramp, int lv)
-+{
-+ int n = ramp_n[ramp];
-+ int p = ((lv < 0 ? 0 : lv) * ramp_mul[ramp] + (8 << 16)) >> 20;
-+ return ramp_base[ramp] + (p >= n ? n - 1 : p);
-+}
-+
-+FOS_INLINE int ix_dith(int ramp, int lv, int x, int y)
-+{
-+ int n = ramp_n[ramp];
-+ int p = (((lv < 0 ? 0 : lv) * ramp_mul[ramp] >> 16) + fos_bayer[y & 3][x & 3]) >> 4;
-+ return ramp_base[ramp] + (p >= n ? n - 1 : p);
-+}
-+
-+void fos_gfx_init()
-+{
-+ int ix = 1;
-+ for (int r = 0; r < RAMP_COUNT; r++)
-+ {
-+ const struct ramp_def *d = &ramp_defs[r];
-+ ramp_base[r] = ix;
-+ ramp_n[r] = d->n;
-+ fos_ramp_last[r] = d->n - 1;
-+ ramp_mul[r] = (d->n - 1) * 16 * 65536 / LV_MAX;
-+ for (int i = 0; i < d->n; i++, ix++)
-+ {
-+ int lv = i * 255 / (d->n - 1); /* 0..255 along the ramp */
-+ uint32_t c;
-+ if (!d->mid_at)
-+ c = lerp_rgb(d->lo, d->hi, lv, 255);
-+ else if (lv <= d->mid_at)
-+ c = lerp_rgb(d->lo, d->mid, lv, d->mid_at);
-+ else
-+ c = lerp_rgb(d->mid, d->hi, lv - d->mid_at, 255 - d->mid_at);
-+ fos_pal[ix] = c;
-+ rev_ramp[ix] = r;
-+ rev_lv[ix] = i * LV_MAX / (d->n - 1);
-+ luma_tab[ix] = rgb_luma(c);
-+ chroma_tab[ix] = rgb_chroma(c);
-+ }
-+ }
-+
-+ /* Canon's entries (and anything unused) read as black */
-+ for (int i = ix; i < 256; i++)
-+ rev_ramp[i] = RAMP_GRAY;
-+ rev_ramp[0] = RAMP_GRAY;
-+
-+ /* luminance -> level, per ramp (ramps get lighter monotonically) */
-+ for (int r = 0; r < RAMP_COUNT; r++)
-+ {
-+ int b = ramp_base[r], n = ramp_n[r];
-+ int j = 0;
-+ for (int l = 0; l < 256; l++)
-+ {
-+ while (j < n - 2 && luma_tab[b + j + 1] < l)
-+ j++;
-+ int l0 = luma_tab[b + j], l1 = luma_tab[b + j + 1];
-+ int f = l1 > l0 ? fos_clamp((l - l0) * 256 / (l1 - l0), 0, 256) : 0;
-+ int lv = (j * 256 + f) * LV_MAX / ((n - 1) * 256);
-+ lum2lv[r][l] = fos_clamp(lv, 0, LV_MAX);
-+ }
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- screen colour */
-+
-+uint32_t fos_screen_yuv(int ix, int white_y, int std, int sat, int warm, int bright)
-+{
-+ return fos_screen_yuv_rgb(fos_pal[ix], white_y, std, sat, warm, bright);
-+}
-+
-+uint32_t fos_screen_yuv_rgb(uint32_t rgb, int white_y, int std, int sat, int warm, int bright)
-+{
-+ int c[3] = { (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF };
-+ /* warmer: more red, less blue, white included */
-+ c[0] = fos_clamp(c[0] * (100 + 3 * warm) / 100, 0, 255);
-+ c[2] = fos_clamp(c[2] * (100 - 3 * warm) / 100, 0, 255);
-+ /* brighter: the mid tones lift, black and white stay */
-+ for (int i = 0; i < 3; i++)
-+ c[i] = fos_clamp(c[i] + bright * 6 * c[i] * (255 - c[i]) / (100 * 255), 0, 255);
-+ int r = c[0], g = c[1], b = c[2];
-+ int s = 100 + 6 * sat; /* colour, % */
-+ int y, u, v;
-+ if (std == 1)
-+ {
-+ y = (217 * r + 732 * g + 73 * b) / 1024;
-+ u = (-117 * r - 394 * g + 512 * b) / 1024;
-+ v = (512 * r - 465 * g - 46 * b) / 1024;
-+ }
-+ else
-+ {
-+ /* BT.601 Y'CbCr, all of it scaled so white lands on Canon's white:
-+ * Canon's own entries on the EOS M decode this way to clean
-+ * primaries (dark red 202,0,0; blue 0,0,170; green 0,155,0) */
-+ int yf = (299 * r + 587 * g + 114 * b) / 1000;
-+ y = yf * white_y / 255;
-+ u = (b - yf) * 564 / 1000 * white_y / 255;
-+ v = (r - yf) * 713 / 1000 * white_y / 255;
-+ }
-+ y = fos_clamp(y, 0, 255);
-+ u = fos_clamp(u * s / 100, -127, 127);
-+ v = fos_clamp(v * s / 100, -127, 127);
-+ return (uint32_t) y << 16 | (uint32_t) (u & 0xFF) << 8 | (uint32_t) (v & 0xFF);
-+}
-+
-+uint32_t fos_screen_rgb(uint32_t yuv, int white_y)
-+{
-+ int y = (yuv >> 16) & 0xFF, u = (int8_t) ((yuv >> 8) & 0xFF), v = (int8_t) (yuv & 0xFF);
-+ /* undo the scale, then BT.601 */
-+ y = y * 255 / white_y; u = u * 255 / white_y; v = v * 255 / white_y;
-+ int r = y + v * 1000 / 713;
-+ int b = y + u * 1000 / 564;
-+ int g = (1000 * y - 299 * r - 114 * b) / 587;
-+ return (uint32_t) fos_clamp(r, 0, 255) << 16 | (uint32_t) fos_clamp(g, 0, 255) << 8 | (uint32_t) fos_clamp(b, 0, 255);
-+}
-+
-+uint8_t fos_ix(fcol c)
-+{
-+ return ix_near(FC_RAMP(c) % RAMP_COUNT, LV12(FC_LEVEL(c)));
-+}
-+
-+uint8_t fos_ix_dither(int ramp, int lv, int x, int y)
-+{
-+ return ix_dith(ramp, lv, x, y);
-+}
-+
-+fcol fos_colour_of(uint8_t ix)
-+{
-+ return FC(rev_ramp[ix], rev_lv[ix] * 255 / LV_MAX);
-+}
-+
-+int fos_luma(uint8_t ix)
-+{
-+ return luma_tab[ix];
-+}
-+
-+/* the blend of (ramp, lv) over dst at opacity a: within one ramp it is a
-+ * level blend; across ramps it keeps the luminance and takes the ramp that
-+ * contributes more colour, so amber text on grey gets amber edges and
-+ * white text on amber gets light-amber ones */
-+static void mix_target(uint8_t dst, int ramp, int lv, int a, int *out_ramp, int *out_lv)
-+{
-+ int rd = rev_ramp[dst];
-+ if (rd == ramp)
-+ {
-+ *out_ramp = ramp;
-+ *out_lv = rev_lv[dst] + (((lv - rev_lv[dst]) * a) >> 8);
-+ return;
-+ }
-+ int src = ix_near(ramp, lv);
-+ int ld = luma_tab[dst], ls = luma_tab[src];
-+ int l = ld + (((ls - ld) * a) >> 8);
-+ int r = chroma_tab[src] * a >= chroma_tab[dst] * (256 - a) ? ramp : rd;
-+ *out_ramp = r;
-+ *out_lv = lum2lv[r][fos_clamp(l, 0, 255)];
-+}
-+
-+void fos_lerp2(int ra, int la, int rb, int lb, int a, int *ramp, int *lv)
-+{
-+ if (ra == rb)
-+ {
-+ *ramp = ra;
-+ *lv = la + (((lb - la) * a) >> 8);
-+ return;
-+ }
-+ int ia = ix_near(ra, la), ib = ix_near(rb, lb);
-+ int l = luma_tab[ia] + (((luma_tab[ib] - luma_tab[ia]) * a) >> 8);
-+ int r = chroma_tab[ib] * a >= chroma_tab[ia] * (256 - a) ? rb : ra;
-+ *ramp = r;
-+ *lv = lum2lv[r][fos_clamp(l, 0, 255)];
-+}
-+
-+uint8_t fos_mix(uint8_t dst, int ramp, int lv, int a)
-+{
-+ if (a >= OPAQUE) return ix_near(ramp, lv);
-+ if (a <= 0) return dst;
-+ int r, l;
-+ mix_target(dst, ramp, lv, a, &r, &l);
-+ return ix_near(r, l);
-+}
-+
-+uint8_t fos_mix_dither(uint8_t dst, int ramp, int lv, int a, int x, int y)
-+{
-+ if (a >= OPAQUE) return ix_dith(ramp, lv, x, y);
-+ if (a <= 0) return dst;
-+ int r, l;
-+ mix_target(dst, ramp, lv, a, &r, &l);
-+ return ix_dith(r, l, x, y);
-+}
-+
-+/* ---------------------------------------------------------------- maths */
-+
-+int fos_isqrt(unsigned int v)
-+{
-+ if (!v) return 0;
-+ unsigned int r = 0, bit = 1u << ((31 - __builtin_clz(v)) & ~1);
-+ while (bit)
-+ {
-+ if (v >= r + bit) { v -= r + bit; r = (r >> 1) + bit; }
-+ else r >>= 1;
-+ bit >>= 2;
-+ }
-+ return r;
-+}
-+
-+/* quarter-wave sine, 4096 = 1.0 */
-+static const int16_t sin_q[65] =
-+{
-+ 0, 101, 201, 301, 401, 501, 601, 700, 799, 897, 995, 1092, 1189, 1285, 1380, 1474,
-+ 1567, 1660, 1751, 1842, 1931, 2019, 2106, 2191, 2276, 2359, 2440, 2520, 2598, 2675, 2751, 2824,
-+ 2896, 2967, 3035, 3102, 3166, 3229, 3290, 3349, 3406, 3461, 3513, 3564, 3612, 3659, 3703, 3745,
-+ 3784, 3822, 3857, 3889, 3920, 3948, 3973, 3996, 4017, 4036, 4052, 4065, 4076, 4085, 4091, 4095,
-+ 4096,
-+};
-+
-+int fos_sin(int a)
-+{
-+ a &= 0xFFFF;
-+ int q = a >> 14; /* quadrant */
-+ int t = a & 0x3FFF; /* 0..16383 within it */
-+ if (q & 1) t = 0x4000 - t;
-+ int i = t >> 8, f = t & 0xFF;
-+ int v = i >= 64 ? 4096 : sin_q[i] + (((sin_q[i + 1] - sin_q[i]) * f) >> 8);
-+ return q & 2 ? -v : v;
-+}
-+
-+int fos_cos(int a)
-+{
-+ return fos_sin(a + 0x4000);
-+}
-+
-+/* ---------------------------------------------------------------- canvas */
-+
-+void fos_canvas_init(struct fos_canvas *cv, uint8_t *px, int pitch, int w, int h)
-+{
-+ cv->px = px;
-+ cv->pitch = pitch;
-+ cv->w = w;
-+ cv->h = h;
-+ fos_noclip(cv);
-+}
-+
-+void fos_noclip(struct fos_canvas *cv)
-+{
-+ cv->cx0 = 0; cv->cy0 = 0; cv->cx1 = cv->w; cv->cy1 = cv->h;
-+}
-+
-+void fos_clip(struct fos_canvas *cv, int x0, int y0, int x1, int y1)
-+{
-+ cv->cx0 = fos_clamp(x0, 0, cv->w);
-+ cv->cy0 = fos_clamp(y0, 0, cv->h);
-+ cv->cx1 = fos_clamp(x1, cv->cx0, cv->w);
-+ cv->cy1 = fos_clamp(y1, cv->cy0, cv->h);
-+}
-+
-+/* clip a rectangle; returns 0 if nothing is left */
-+static int clip_rect(const struct fos_canvas *cv, int *x, int *y, int *w, int *h)
-+{
-+ int x0 = *x, y0 = *y, x1 = *x + *w, y1 = *y + *h;
-+ if (x0 < cv->cx0) x0 = cv->cx0;
-+ if (y0 < cv->cy0) y0 = cv->cy0;
-+ if (x1 > cv->cx1) x1 = cv->cx1;
-+ if (y1 > cv->cy1) y1 = cv->cy1;
-+ if (x1 <= x0 || y1 <= y0) return 0;
-+ *x = x0; *y = y0; *w = x1 - x0; *h = y1 - y0;
-+ return 1;
-+}
-+
-+#define PX(cv, x, y) ((cv)->px[(y) * (cv)->pitch + (x)])
-+
-+void fos_fill_ix(struct fos_canvas *cv, int x, int y, int w, int h, uint8_t ix)
-+{
-+ if (!clip_rect(cv, &x, &y, &w, &h)) return;
-+ uint32_t word = ix * 0x01010101u;
-+ for (int j = 0; j < h; j++)
-+ {
-+ uint8_t *p = &PX(cv, x, y + j);
-+ int n = w;
-+ while (n && ((uintptr_t) p & 3)) { *p++ = ix; n--; }
-+ while (n >= 4) { *(uint32_t *) p = word; p += 4; n -= 4; }
-+ while (n--) *p++ = ix;
-+ }
-+}
-+
-+void fos_fill(struct fos_canvas *cv, int x, int y, int w, int h, fcol c)
-+{
-+ fos_fill_ix(cv, x, y, w, h, fos_ix(c));
-+}
-+
-+void fos_blend(struct fos_canvas *cv, int x, int y, int w, int h, fcol c, int alpha)
-+{
-+ if (alpha >= OPAQUE) { fos_fill(cv, x, y, w, h, c); return; }
-+ if (alpha <= 0 || !clip_rect(cv, &x, &y, &w, &h)) return;
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ for (int j = y; j < y + h; j++)
-+ for (int i = x; i < x + w; i++)
-+ PX(cv, i, j) = fos_mix_dither(PX(cv, i, j), ramp, lv, alpha, i, j);
-+}
-+
-+void fos_scale_levels(struct fos_canvas *cv, int x, int y, int w, int h, int k)
-+{
-+ if (!clip_rect(cv, &x, &y, &w, &h)) return;
-+ /* every index, darkened, for the four pixels of a 2 x 2 dither */
-+ uint8_t lut[4][256];
-+ for (int ph = 0; ph < 4; ph++)
-+ for (int i = 0; i < 256; i++)
-+ lut[ph][i] = ix_dith(rev_ramp[i], (rev_lv[i] * k) >> 8, ph & 1, ph >> 1);
-+ for (int j = y; j < y + h; j++)
-+ {
-+ uint8_t *p = &PX(cv, x, j);
-+ int n = w, i = x;
-+ for (; n && ((uintptr_t) p & 3); n--, p++, i++)
-+ *p = lut[(j & 1) * 2 + (i & 1)][*p];
-+ const uint8_t *l0 = lut[(j & 1) * 2 + (i & 1)], *l1 = lut[(j & 1) * 2 + ((i + 1) & 1)];
-+ for (; n >= 4; n -= 4, p += 4, i += 4)
-+ {
-+ uint32_t v = *(uint32_t *) p;
-+ *(uint32_t *) p = l0[v & 0xFF] | l1[(v >> 8) & 0xFF] << 8 | l0[(v >> 16) & 0xFF] << 16 | (uint32_t) l1[v >> 24] << 24;
-+ }
-+ for (; n; n--, p++, i++)
-+ *p = lut[(j & 1) * 2 + (i & 1)][*p];
-+ }
-+}
-+
-+void fos_vgrad(struct fos_canvas *cv, int x, int y, int w, int h, int ramp, int lv0, int lv1)
-+{
-+ int y_top = y, h_all = h;
-+ if (h_all <= 0 || !clip_rect(cv, &x, &y, &w, &h)) return;
-+ int base = ramp_base[ramp], last = ramp_n[ramp] - 1;
-+ for (int j = y; j < y + h; j++)
-+ {
-+ int lv = lv0 + (lv1 - lv0) * (j - y_top) / (h_all > 1 ? h_all - 1 : 1);
-+ int pos = ((lv < 0 ? 0 : lv) * ramp_mul[ramp]) >> 16;
-+ /* the four dithered indices of this row */
-+ uint8_t ix[4];
-+ for (int k = 0; k < 4; k++)
-+ {
-+ int q = (pos + fos_bayer[j & 3][k]) >> 4;
-+ ix[k] = base + (q > last ? last : q);
-+ }
-+ uint8_t *p = &PX(cv, x, j);
-+ for (int i = x; i < x + w; i++)
-+ *p++ = ix[i & 3];
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- AA shapes */
-+
-+FOS_INLINE void put_cov(struct fos_canvas *cv, int x, int y, int ramp, int lv, int ix_solid, int cov, int alpha)
-+{
-+ if (cov <= 0) return;
-+ int a = cov >= 256 ? alpha : (cov * alpha) >> 8;
-+ if (a >= OPAQUE) PX(cv, x, y) = ix_solid;
-+ else if (a > 0) PX(cv, x, y) = fos_mix(PX(cv, x, y), ramp, lv, a);
-+}
-+
-+/* pixels x0..x1-1 of row y fully covered */
-+static void put_run(struct fos_canvas *cv, int x0, int x1, int y, int ramp, int lv, int ix_solid, int alpha)
-+{
-+ if (x1 <= x0) return;
-+ uint8_t *p = &PX(cv, x0, y);
-+ if (alpha >= OPAQUE) { memset(p, ix_solid, x1 - x0); return; }
-+ if (alpha <= 0) return;
-+ for (int x = x0; x < x1; x++, p++)
-+ *p = fos_mix(*p, ramp, lv, alpha);
-+}
-+
-+/* coverage (0..256) of pixel (i, j) in a w x h rounded rect at the origin */
-+static int rrect_cov(int i, int j, int w, int h, int r)
-+{
-+ if (i < 0 || j < 0 || i >= w || j >= h) return 0;
-+ int cx, cy;
-+ if (i < r) cx = r; else if (i >= w - r) cx = w - r; else return 256;
-+ if (j < r) cy = r; else if (j >= h - r) cy = h - r; else return 256;
-+ /* distance from the pixel centre to the corner circle centre, 1/16 px */
-+ int dx = (i * 16 + 8) - cx * 16;
-+ int dy = (j * 16 + 8) - cy * 16;
-+ if ((i < r && dx > 0) || (i >= w - r && dx < 0)) dx = 0;
-+ if ((j < r && dy > 0) || (j >= h - r && dy < 0)) dy = 0;
-+ int d = fos_isqrt(dx * dx + dy * dy) - r * 16; /* 1/16 px, + outside */
-+ return fos_clamp(128 - d * 16, 0, 256);
-+}
-+
-+void fos_rrect(struct fos_canvas *cv, int x, int y, int w, int h, int r, fcol c, int alpha)
-+{
-+ if (w <= 0 || h <= 0) return;
-+ r = fos_clamp(r, 0, (w < h ? w : h) / 2);
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+ /* straight middle band in one go */
-+ if (alpha >= OPAQUE)
-+ fos_fill_ix(cv, x, y + r, w, h - 2 * r, solid);
-+ else
-+ fos_blend(cv, x, y + r, w, h - 2 * r, c, alpha);
-+ for (int j = 0; j < h; j++)
-+ {
-+ if (j >= r && j < h - r) continue;
-+ int py = y + j;
-+ if (py < cv->cy0 || py >= cv->cy1) continue;
-+ /* the corners, then the straight part between them in one run */
-+ for (int i = 0; i < w; i++)
-+ {
-+ if (i == r && w - r > r)
-+ {
-+ put_run(cv, fos_clamp(x + r, cv->cx0, cv->cx1), fos_clamp(x + w - r, cv->cx0, cv->cx1),
-+ py, ramp, lv, solid, alpha);
-+ i = w - r - 1;
-+ continue;
-+ }
-+ int px = x + i;
-+ if (px < cv->cx0 || px >= cv->cx1) continue;
-+ put_cov(cv, px, py, ramp, lv, solid, rrect_cov(i, j, w, h, r), alpha);
-+ }
-+ }
-+}
-+
-+void fos_rrect_line(struct fos_canvas *cv, int x, int y, int w, int h, int r, int t, fcol c, int alpha)
-+{
-+ if (w <= 0 || h <= 0 || t <= 0) return;
-+ r = fos_clamp(r, 0, (w < h ? w : h) / 2);
-+ int ri = r > t ? r - t : 0;
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+ for (int j = 0; j < h; j++)
-+ {
-+ int py = y + j;
-+ if (py < cv->cy0 || py >= cv->cy1) continue;
-+ int inner_row = j >= t + ri && j < h - t - ri;
-+ int border_row = j < t || j >= h - t; /* straight top / bottom edge */
-+ int cut = r > t ? r : t;
-+ for (int i = 0; i < w; i++)
-+ {
-+ if (inner_row && i >= t && i < w - t) { i = w - t - 1; continue; }
-+ if (!inner_row && i == cut && w - cut > cut)
-+ {
-+ /* between the corners the border is solid or empty */
-+ if (border_row)
-+ put_run(cv, fos_clamp(x + cut, cv->cx0, cv->cx1), fos_clamp(x + w - cut, cv->cx0, cv->cx1),
-+ py, ramp, lv, solid, alpha);
-+ i = w - cut - 1;
-+ continue;
-+ }
-+ int px = x + i;
-+ if (px < cv->cx0 || px >= cv->cx1) continue;
-+ int cov = rrect_cov(i, j, w, h, r) - rrect_cov(i - t, j - t, w - 2 * t, h - 2 * t, ri);
-+ put_cov(cv, px, py, ramp, lv, solid, cov, alpha);
-+ }
-+ }
-+}
-+
-+/* distance (1/16 px, + outside) of a pixel at squared distance d2 (1/16 px)
-+ * from a circle of radius r16: near the edge of a big circle the square
-+ * root is as good as linear, d = (d2 - r^2) / 2r */
-+FOS_INLINE int circle_d(int d2, int r16, int inv2r)
-+{
-+ if (inv2r) return ((d2 - r16 * r16) * inv2r) >> 16;
-+ return fos_isqrt((unsigned) d2) - r16;
-+}
-+
-+/* inv2r for circle_d, or 0 when the circle is too small to approximate */
-+static int circle_inv(int r16)
-+{
-+ return r16 >= 16 * 12 ? 65536 / (2 * r16) : 0;
-+}
-+
-+void fos_disc(struct fos_canvas *cv, int cx8, int cy8, int r8, fcol c, int alpha)
-+{
-+ if (r8 <= 0) return;
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+ int r16 = r8 >> 4, inv2r = circle_inv(r16);
-+ int y0 = (cy8 - r8) >> 8, y1 = (cy8 + r8 + 255) >> 8;
-+ int x0 = (cx8 - r8) >> 8, x1 = (cx8 + r8 + 255) >> 8;
-+ y0 = fos_clamp(y0, cv->cy0, cv->cy1); y1 = fos_clamp(y1, cv->cy0, cv->cy1);
-+ x0 = fos_clamp(x0, cv->cx0, cv->cx1); x1 = fos_clamp(x1, cv->cx0, cv->cx1);
-+ for (int y = y0; y < y1; y++)
-+ {
-+ int dy = ((y * 256 + 128) - cy8) >> 4;
-+ int cx16 = cx8 >> 4;
-+ /* pixels whose centre is half a pixel inside the edge are solid */
-+ int in = r16 - 8;
-+ int half = in > 0 && in * in > dy * dy ? fos_isqrt(in * in - dy * dy) : -1;
-+ int sx0 = half >= 0 ? (cx16 - half - 8 + 15) >> 4 : x1;
-+ int sx1 = half >= 0 ? (cx16 + half - 8) >> 4 : x0 - 1;
-+ int s0 = fos_clamp(sx0, x0, x1), s1 = fos_clamp(sx1 + 1, s0, x1);
-+ /* nothing beyond half a pixel outside the edge */
-+ int out = r16 + 8;
-+ if (out * out <= dy * dy) continue;
-+ int ohalf = fos_isqrt(out * out - dy * dy);
-+ int xa = fos_clamp(((cx16 - ohalf - 8) >> 4) - 1, x0, x1), xb = fos_clamp(((cx16 + ohalf - 8) >> 4) + 2, xa, x1);
-+ for (int x = xa; x < xb; x++)
-+ {
-+ if (x == s0 && s1 > s0)
-+ {
-+ put_run(cv, s0, s1, y, ramp, lv, solid, alpha);
-+ x = s1 - 1;
-+ continue;
-+ }
-+ int dx = ((x * 256 + 128) - cx8) >> 4;
-+ int d = circle_d(dx * dx + dy * dy, r16, inv2r);
-+ put_cov(cv, x, y, ramp, lv, solid, fos_clamp(128 - d * 16, 0, 256), alpha);
-+ }
-+ }
-+}
-+
-+void fos_ring(struct fos_canvas *cv, int cx8, int cy8, int r8, int t8, fcol c, int alpha)
-+{
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+ int ro = r8 + t8 / 2 + 256;
-+ int y0 = fos_clamp((cy8 - ro) >> 8, cv->cy0, cv->cy1), y1 = fos_clamp((cy8 + ro + 255) >> 8, cv->cy0, cv->cy1);
-+ int x0 = fos_clamp((cx8 - ro) >> 8, cv->cx0, cv->cx1), x1 = fos_clamp((cx8 + ro + 255) >> 8, cv->cx0, cv->cx1);
-+ int r16 = r8 >> 4, h16 = t8 >> 5, inv2r = circle_inv(r16);
-+ int inner = r16 - h16 - 16, outer = r16 + h16 + 16; /* nothing inside / beyond these */
-+ for (int y = y0; y < y1; y++)
-+ {
-+ int dy = ((y * 256 + 128) - cy8) >> 4;
-+ if (dy * dy >= outer * outer) continue;
-+ int ox = fos_isqrt(outer * outer - dy * dy);
-+ int ix = inner > 0 && dy * dy < inner * inner ? fos_isqrt(inner * inner - dy * dy) : -1;
-+ int xa = fos_clamp(((cx8 - ox * 16) >> 8) - 1, x0, x1), xb = fos_clamp(((cx8 + ox * 16) >> 8) + 2, x0, x1);
-+ for (int x = xa; x < xb; x++)
-+ {
-+ int dx = ((x * 256 + 128) - cx8) >> 4;
-+ if (ix > 0 && dx > -ix && dx < ix)
-+ {
-+ /* across the hole */
-+ x = fos_clamp(((cx8 + ix * 16 - 128 + 255) >> 8) - 1, x, xb);
-+ continue;
-+ }
-+ int d = circle_d(dx * dx + dy * dy, r16, inv2r);
-+ if (d < 0) d = -d;
-+ put_cov(cv, x, y, ramp, lv, solid, fos_clamp(128 - (d - h16) * 16, 0, 256), alpha);
-+ }
-+ }
-+}
-+
-+void fos_line(struct fos_canvas *cv, int x0_8, int y0_8, int x1_8, int y1_8, int w8, fcol c, int alpha)
-+{
-+ /* a thin quad: the segment pushed out by half the width both ways */
-+ int dx = (x1_8 - x0_8) >> 4, dy = (y1_8 - y0_8) >> 4;
-+ int len = fos_isqrt((unsigned) (dx * dx + dy * dy));
-+ if (!len) return;
-+ int ox = -dy * (w8 / 2) / len, oy = dx * (w8 / 2) / len;
-+ int q[8] = { x0_8 + ox, y0_8 + oy, x1_8 + ox, y1_8 + oy, x1_8 - ox, y1_8 - oy, x0_8 - ox, y0_8 - oy };
-+ fos_convex(cv, q, 4, c, alpha);
-+}
-+
-+/* convex polygon, vertices in 1/256 px, either winding */
-+#define MAX_POLY 12
-+void fos_convex(struct fos_canvas *cv, const int *xy8, int n, fcol c, int alpha)
-+{
-+ if (n < 3 || n > MAX_POLY) return;
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+
-+ /* signed area tells the winding, so normals can point outwards */
-+ int64_t area = 0;
-+ for (int i = 0; i < n; i++)
-+ {
-+ int j = (i + 1) % n;
-+ area += (int64_t) xy8[2 * i] * xy8[2 * j + 1] - (int64_t) xy8[2 * j] * xy8[2 * i + 1];
-+ }
-+ int sgn = area > 0 ? 1 : -1;
-+
-+ /* edge lines: nx * x + ny * y - c, unit normal in 1/4096, distance in 1/256 px;
-+ * inv = 2^24 / nx turns "where does this edge cross" into a multiply */
-+ int nx[MAX_POLY], ny[MAX_POLY], nc[MAX_POLY], inv[MAX_POLY];
-+ int ymin = 1 << 30, ymax = -(1 << 30), xmin = 1 << 30, xmax = -(1 << 30);
-+ for (int i = 0; i < n; i++)
-+ {
-+ int j = (i + 1) % n;
-+ int ex = xy8[2 * j] - xy8[2 * i], ey = xy8[2 * j + 1] - xy8[2 * i + 1];
-+ /* length in 1/16 px; long edges (the shutter blades) measured coarser so
-+ * the squares fit */
-+ int sh = ((ex < 0 ? -ex : ex) | (ey < 0 ? -ey : ey)) >= (1 << 19) ? 7 : 4;
-+ int len = fos_isqrt((unsigned) ((ex >> sh) * (ex >> sh) + (ey >> sh) * (ey >> sh))) << (sh - 4);
-+ if (!len) len = 1;
-+ nx[i] = sgn * (ey >> 4) * 4096 / len;
-+ ny[i] = -sgn * (ex >> 4) * 4096 / len;
-+ nc[i] = (int) (((int64_t) nx[i] * xy8[2 * i] + (int64_t) ny[i] * xy8[2 * i + 1]) >> 12);
-+ inv[i] = nx[i] ? (1 << 24) / nx[i] : 0;
-+ if (xy8[2 * i + 1] < ymin) ymin = xy8[2 * i + 1];
-+ if (xy8[2 * i + 1] > ymax) ymax = xy8[2 * i + 1];
-+ if (xy8[2 * i] < xmin) xmin = xy8[2 * i];
-+ if (xy8[2 * i] > xmax) xmax = xy8[2 * i];
-+ }
-+ int py0 = fos_clamp((ymin >> 8) - 1, cv->cy0, cv->cy1), py1 = fos_clamp((ymax >> 8) + 2, cv->cy0, cv->cy1);
-+ int px0 = fos_clamp((xmin >> 8) - 1, cv->cx0, cv->cx1), px1 = fos_clamp((xmax >> 8) + 2, cv->cx0, cv->cx1);
-+
-+ for (int y = py0; y < py1; y++)
-+ {
-+ int yc = y * 256 + 128;
-+ /* [in0, in1]: every edge at least half a pixel inside (solid);
-+ * [out0, out1]: no edge more than half a pixel outside */
-+ int in0 = px0 * 256, in1 = px1 * 256, out0 = px0 * 256, out1 = px1 * 256;
-+ int empty = 0, nosolid = 0;
-+ for (int i = 0; i < n; i++)
-+ {
-+ /* d(x) = nx * x / 4096 + base (1/256 px) */
-+ int base = (int) (((int64_t) ny[i] * yc) >> 12) - nc[i];
-+ if (!nx[i])
-+ {
-+ if (base > 128) empty = 1;
-+ if (base > -128) nosolid = 1;
-+ continue;
-+ }
-+ int xa = (int) (((int64_t) (-128 - base) * inv[i]) >> 12);
-+ int xb = (int) (((int64_t) (128 - base) * inv[i]) >> 12);
-+ if (nx[i] > 0) { if (xa < in1) in1 = xa; if (xb < out1) out1 = xb; }
-+ else { if (xa > in0) in0 = xa; if (xb > out0) out0 = xb; }
-+ }
-+ if (empty || out1 < out0) continue;
-+ if (nosolid) in1 = in0 - 1;
-+ int sx0 = fos_clamp((out0 >> 8) - 1, px0, px1), sx1 = fos_clamp((out1 >> 8) + 2, px0, px1);
-+ /* whole pixels at least half a pixel inside every edge: one run */
-+ int s0 = sx1, s1 = sx1;
-+ if (in1 > in0)
-+ {
-+ s0 = fos_clamp((in0 + 255) >> 8, sx0, sx1);
-+ s1 = fos_clamp(in1 >> 8, s0, sx1);
-+ }
-+ for (int x = sx0; x < sx1; x++)
-+ {
-+ int xc = x * 256 + 128;
-+ if (x == s0 && s1 > s0)
-+ {
-+ put_run(cv, s0, s1, y, ramp, lv, solid, alpha);
-+ x = s1 - 1;
-+ continue;
-+ }
-+ /* pixel centres are on the canvas, so this fits in 32 bits */
-+ int dmax = -(1 << 30);
-+ for (int i = 0; i < n; i++)
-+ {
-+ int d = ((nx[i] * xc + ny[i] * yc) >> 12) - nc[i];
-+ if (d > dmax) dmax = d;
-+ }
-+ put_cov(cv, x, y, ramp, lv, solid, fos_clamp(128 - dmax, 0, 256), alpha);
-+ }
-+ }
-+}
-+
-+void fos_tri(struct fos_canvas *cv, int cx, int cy, int size, int dir, fcol c, int alpha)
-+{
-+ /* an arrow head pointing right, rotated by dir quarter turns */
-+ static const int base[6] = { 1, 0, -1, -1, -1, 1 };
-+ int pts[6];
-+ for (int i = 0; i < 3; i++)
-+ {
-+ int x = base[2 * i], y = base[2 * i + 1];
-+ for (int k = 0; k < dir; k++) { int t = x; x = -y; y = t; }
-+ pts[2 * i] = cx * 256 + 128 + x * size * 128;
-+ pts[2 * i + 1] = cy * 256 + 128 + y * size * 128;
-+ }
-+ fos_convex(cv, pts, 3, c, alpha);
-+}
-+
-+/* ---------------------------------------------------------------- text */
-+
-+/* ---- the fonts, from the card */
-+
-+#define FONT_DEF(n) struct fos_font fos_font_##n;
-+FOS_FONTS(FONT_DEF)
-+#define FONT_SLOT(n) &fos_font_##n,
-+static struct fos_font *const font_slots[] = { FOS_FONTS(FONT_SLOT) };
-+#define NFONTS ((int) (sizeof(font_slots) / sizeof(font_slots[0])))
-+static int fonts_ready;
-+
-+static uint32_t get32(const uint8_t *p) { return p[0] | p[1] << 8 | p[2] << 16 | (uint32_t) p[3] << 24; }
-+
-+/* "FOSF", version 1, the number of fonts; each font: bits, glyphs, kerning
-+ * pairs, ascent, descent (u32), then its bits, glyphs, lut and kerning,
-+ * each part starting on 4 bytes */
-+int fos_fonts_load(const uint8_t *b, int size)
-+{
-+ fonts_ready = 0;
-+ if (!b || size < 12 || memcmp(b, "FOSF", 4) || get32(b + 4) != 1 || (int) get32(b + 8) != NFONTS
-+ || sizeof(struct fos_glyph) != 8 || sizeof(struct fos_kern) != 3)
-+ return 0;
-+ int at = 12;
-+ for (int i = 0; i < NFONTS; i++)
-+ {
-+ if (at + 20 > size) return 0;
-+ uint32_t nbits = get32(b + at), nglyphs = get32(b + at + 4), nkern = get32(b + at + 8);
-+ int asc = (int) get32(b + at + 12), desc = (int) get32(b + at + 16);
-+ at += 20;
-+ uint32_t need = ((nbits + 3) & ~3u) + nglyphs * 8 + 256 + ((nkern * 3 + 3) & ~3u);
-+ if (nbits > (uint32_t) size || nglyphs > 256 || nkern > 65536 || (uint32_t) (size - at) < need) return 0;
-+ struct fos_font *f = font_slots[i];
-+ f->bits = b + at; at += (nbits + 3) & ~3u;
-+ f->glyphs = (const struct fos_glyph *) (b + at); at += nglyphs * 8;
-+ f->lut = b + at; at += 256;
-+ f->kern = nkern ? (const struct fos_kern *) (b + at) : 0;
-+ at += (nkern * 3 + 3) & ~3u;
-+ f->nkern = (int) nkern;
-+ f->ascent = asc;
-+ f->descent = desc;
-+ /* every glyph the lut names must exist */
-+ for (int c = 0; c < 256; c++)
-+ if (f->lut[c] != 0xFF && f->lut[c] >= nglyphs) { memset(f, 0, sizeof(*f)); return 0; }
-+ }
-+ fonts_ready = 1;
-+ return 1;
-+}
-+
-+int fos_fonts_ready()
-+{
-+ return fonts_ready;
-+}
-+
-+static const struct fos_glyph *glyph_of(const struct fos_font *f, int ch)
-+{
-+ if (!f->lut) return 0; /* not loaded */
-+ int i = f->lut[ch & 0xFF];
-+ return i == 0xFF ? 0 : &f->glyphs[i];
-+}
-+
-+static int kern_of(const struct fos_font *f, int a, int b)
-+{
-+ int lo = 0, hi = f->nkern - 1;
-+ int key = a << 8 | b;
-+ while (lo <= hi)
-+ {
-+ int mid = (lo + hi) / 2;
-+ int k = f->kern[mid].a << 8 | f->kern[mid].b;
-+ if (k == key) return f->kern[mid].k;
-+ if (k < key) lo = mid + 1; else hi = mid - 1;
-+ }
-+ return 0;
-+}
-+
-+static void draw_glyph(struct fos_canvas *cv, const struct fos_font *f, const struct fos_glyph *g,
-+ int x, int y, int ramp, int lv, int solid, int alpha)
-+{
-+ int gx = x + g->ox, gy = y + g->oy;
-+ int w = g->w, h = g->h;
-+ if (!w || !h) return;
-+ if (gx >= cv->cx1 || gy >= cv->cy1 || gx + w <= cv->cx0 || gy + h <= cv->cy0) return;
-+
-+ const uint8_t *p = f->bits + g->off;
-+ int col = 0, row = 0;
-+ int inside = gx >= cv->cx0 && gx + w <= cv->cx1 && gy >= cv->cy0 && gy + h <= cv->cy1;
-+ int memo_dst = -1, memo_a = -1, memo_out = 0;
-+ while (row < h)
-+ {
-+ int b = *p++;
-+ int run, v;
-+ if (b & 0x80) { run = (b & 0x7F) + 1; v = 0; }
-+ else { run = (b >> 4) + 1; v = b & 15; }
-+ if (!v)
-+ {
-+ col += run;
-+ while (col >= w) { col -= w; row++; }
-+ continue;
-+ }
-+ int a = v == 15 ? alpha : (v * 17 * alpha) >> 8;
-+ if (inside)
-+ {
-+ /* runs never pass the end of the bitmap, but may wrap rows */
-+ uint8_t *q = &PX(cv, gx + col, gy + row);
-+ if (a >= OPAQUE)
-+ while (run--)
-+ {
-+ *q++ = solid;
-+ if (++col == w) { col = 0; row++; q = &PX(cv, gx, gy + row); }
-+ }
-+ else
-+ while (run--)
-+ {
-+ /* the backdrop is a couple of dithered indices: remember the last blend */
-+ if (*q != memo_dst || a != memo_a)
-+ {
-+ memo_dst = *q; memo_a = a;
-+ memo_out = fos_mix(*q, ramp, lv, a);
-+ }
-+ *q++ = memo_out;
-+ if (++col == w) { col = 0; row++; q = &PX(cv, gx, gy + row); }
-+ }
-+ continue;
-+ }
-+ while (run--)
-+ {
-+ int px = gx + col, py = gy + row;
-+ if (px >= cv->cx0 && px < cv->cx1 && py >= cv->cy0 && py < cv->cy1)
-+ {
-+ if (a >= OPAQUE) PX(cv, px, py) = solid;
-+ else PX(cv, px, py) = fos_mix(PX(cv, px, py), ramp, lv, a);
-+ }
-+ if (++col == w) { col = 0; row++; }
-+ }
-+ }
-+}
-+
-+int fos_text_w(const struct fos_font *f, const char *s, int track)
-+{
-+ int pen = 0, prev = 0;
-+ for (; *s; s++)
-+ {
-+ int ch = (uint8_t) *s;
-+ const struct fos_glyph *g = glyph_of(f, ch);
-+ if (!g) continue;
-+ if (prev) pen += kern_of(f, prev, ch) + track;
-+ pen += g->adv;
-+ prev = ch;
-+ }
-+ return (pen + 8) >> 4;
-+}
-+
-+int fos_text(struct fos_canvas *cv, const struct fos_font *f, int x, int y, const char *s, fcol c, int alpha, int track)
-+{
-+ if (alpha <= 0) return fos_text_w(f, s, track);
-+ int ramp = FC_RAMP(c), lv = LV12(FC_LEVEL(c));
-+ int solid = fos_ix(c);
-+ int pen = x * 16, prev = 0;
-+ for (; *s; s++)
-+ {
-+ int ch = (uint8_t) *s;
-+ const struct fos_glyph *g = glyph_of(f, ch);
-+ if (!g) continue;
-+ if (prev) pen += kern_of(f, prev, ch) + track;
-+ draw_glyph(cv, f, g, (pen + 8) >> 4, y, ramp, lv, solid, alpha);
-+ pen += g->adv;
-+ prev = ch;
-+ }
-+ return ((pen + 8) >> 4) - x;
-+}
-+
-+int fos_text_c(struct fos_canvas *cv, const struct fos_font *f, int cx, int y, const char *s, fcol c, int alpha, int track)
-+{
-+ int w = fos_text_w(f, s, track);
-+ fos_text(cv, f, cx - w / 2, y, s, c, alpha, track);
-+ return w;
-+}
-+
-+int fos_text_r(struct fos_canvas *cv, const struct fos_font *f, int rx, int y, const char *s, fcol c, int alpha, int track)
-+{
-+ int w = fos_text_w(f, s, track);
-+ fos_text(cv, f, rx - w, y, s, c, alpha, track);
-+ return w;
-+}
-+
-+int fos_text_map(uint8_t *px, int pitch, int w, int h, const struct fos_font *f, int x, int y,
-+ const char *s, const uint8_t map[16], int track)
-+{
-+ int pen = x * 16, prev = 0;
-+ for (; *s; s++)
-+ {
-+ int ch = (uint8_t) *s;
-+ const struct fos_glyph *g = glyph_of(f, ch);
-+ if (!g) continue;
-+ if (prev) pen += kern_of(f, prev, ch) + track;
-+ int gx = ((pen + 8) >> 4) + g->ox, gy = y + g->oy;
-+ const uint8_t *p = f->bits + g->off;
-+ int col = 0, row = 0;
-+ while (row < g->h)
-+ {
-+ int b = *p++;
-+ int run, v;
-+ if (b & 0x80) { run = (b & 0x7F) + 1; v = 0; }
-+ else { run = (b >> 4) + 1; v = b & 15; }
-+ while (run--)
-+ {
-+ int qx = gx + col, qy = gy + row;
-+ if (v && map[v] && qx >= 0 && qx < w && qy >= 0 && qy < h)
-+ px[qy * pitch + qx] = map[v];
-+ if (++col == g->w) { col = 0; row++; }
-+ }
-+ }
-+ pen += g->adv;
-+ prev = ch;
-+ }
-+ return ((pen + 8) >> 4) - x;
-+}
-+
-+/* the overlay's colours over a photograph (a print, or the camera's own
-+ * picture): black, a panel, greys up to white for text on it, the accent,
-+ * red, a line, and a dim grey */
-+const uint8_t fos_fixed_rgb[FOS_FIXED_N][3] =
-+{
-+ { 0, 0, 0 }, { 22, 21, 20 }, { 52, 50, 48 }, { 88, 85, 82 }, { 128, 124, 120 }, { 170, 166, 160 },
-+ { 210, 206, 200 }, { 244, 241, 236 }, { 236, 168, 52 }, { 150, 104, 34 }, { 214, 64, 52 }, { 60, 58, 56 },
-+ { 112, 108, 104 }, { 0, 0, 0 },
-+};
-diff --git a/src/fos_gfx.h b/src/fos_gfx.h
-new file mode 100644
-index 000000000..22d1f64ea
---- /dev/null
-+++ b/src/fos_gfx.h
-@@ -0,0 +1,216 @@
-+/* fos_gfx: drawing for the film OS.
-+ *
-+ * The screen is the EOS M 8-bit bitmap overlay. Our palette is a set of
-+ * tone ramps, each running from near-black through a hue to a light tint,
-+ * so every colour is "a ramp and a level along it". Shading, gradients,
-+ * fades and anti-aliasing all become level changes, and ordered dithering
-+ * between neighbouring ramp entries keeps them smooth with 254 colours.
-+ *
-+ * Plain C, no ML headers: the same code runs on the camera and in the
-+ * simulator (sim/).
-+ */
-+
-+#ifndef _fos_gfx_h_
-+#define _fos_gfx_h_
-+
-+#include <stdint.h>
-+
-+/* the camera build warns (and fails) when gcc declines an inline at -Os,
-+ * so the few hot helpers are forced */
-+#define FOS_INLINE static inline __attribute__((always_inline))
-+
-+#define FOS_W 720
-+#define FOS_H 480
-+
-+enum
-+{
-+ RAMP_GRAY, /* warm neutral, also black and white ink */
-+ RAMP_METAL, /* cool steel for canister caps */
-+ RAMP_AMBER, /* UI accent and Kodak yellow */
-+ RAMP_RED,
-+ RAMP_ORANGE,
-+ RAMP_CRIMSON,
-+ RAMP_GREEN,
-+ RAMP_VIOLET,
-+ RAMP_BLUE,
-+ RAMP_LEADER, /* unprocessed film base */
-+ RAMP_COUNT
-+};
-+
-+/* a colour: ramp in the high byte, level 0..255 in the low byte */
-+typedef uint16_t fcol;
-+#define FC(ramp, level) ((fcol) (((ramp) << 8) | (level)))
-+#define FC_RAMP(c) ((c) >> 8)
-+#define FC_LEVEL(c) ((c) & 0xFF)
-+
-+/* shading works with 12-bit levels */
-+#define LV_MAX 4095
-+#define LV12(level8) ((level8) * 4095 / 255)
-+
-+/* opacity 0..256 */
-+#define OPAQUE 256
-+
-+/* palette index 0 is Canon's transparent entry: LiveView shows through */
-+#define IX_CLEAR 0
-+
-+struct fos_canvas
-+{
-+ uint8_t *px;
-+ int pitch;
-+ int w, h;
-+ int cx0, cy0, cx1, cy1; /* clip rectangle, cx1 / cy1 exclusive */
-+};
-+
-+struct fos_glyph { uint16_t off; uint8_t w, h; int8_t ox, oy; uint16_t adv; };
-+struct fos_kern { uint8_t a, b; int8_t k; };
-+
-+struct fos_font
-+{
-+ const uint8_t *bits; /* run-length coded 4-bit coverage */
-+ const struct fos_glyph *glyphs;
-+ const uint8_t *lut; /* byte -> glyph, 0xFF = none */
-+ const struct fos_kern *kern; /* sorted by (a, b), 1/16 px */
-+ int nkern;
-+ int ascent, descent;
-+};
-+
-+/* The fonts live in a file on the card (ML/DATA/FOSFONT.BIN, made from
-+ * fos_font.c by tools/fontblob.c), not in autoexec.bin: on the EOS M every
-+ * byte of autoexec.bin is taken from Canon's own memory at boot, and too
-+ * much stops the camera from starting. Until fos_fonts_load succeeds,
-+ * text draws nothing. */
-+extern struct fos_font fos_font_xs, fos_font_sm, fos_font_md, fos_font_mdb,
-+ fos_font_lg, fos_font_xl, fos_font_num,
-+ fos_font_lbig, fos_font_lname, fos_font_lsm;
-+#define FOS_FONT_FILE "FOSFONT.BIN"
-+#define FOS_FONTS(X) X(xs) X(sm) X(md) X(mdb) X(lg) X(xl) X(num) X(lbig) X(lname) X(lsm) /* the file's order */
-+/* blob: the file's contents, kept for as long as the fonts are used;
-+ * 1 when it holds every font */
-+int fos_fonts_load(const uint8_t *blob, int size);
-+int fos_fonts_ready();
-+
-+/* characters beyond ASCII in our strings (see tools/mkfont.py) */
-+#define T_DOT "\x80" /* middle dot */
-+#define T_DEG "\x81"
-+#define T_TIMES "\x82"
-+#define T_NDASH "\x83"
-+#define T_MDASH "\x84"
-+#define T_APOS "\x85"
-+#define T_ELLIPSIS "\x86"
-+#define T_BULLET "\x87"
-+#define T_LSAQUO "\x88" /* single angle quotes */
-+#define T_RSAQUO "\x89"
-+
-+/* 0x00RRGGBB for each palette index we own (1..254) */
-+extern uint32_t fos_pal[256];
-+
-+/* What the overlay gets for palette index ix: Y << 16 | U << 8 | V, U and
-+ * V signed bytes. std 0 is Canon's own conversion (BT.601 Y'CbCr, scaled
-+ * so white sits at white_y, the luma of Canon's white: 235 on the EOS M);
-+ * std 1 is full-range Rec.709. sat, warm and bright are the screen colour
-+ * settings, -6..6, 0 = as designed. */
-+uint32_t fos_screen_yuv(int ix, int white_y, int std, int sat, int warm, int bright);
-+uint32_t fos_screen_yuv_rgb(uint32_t rgb, int white_y, int std, int sat, int warm, int bright); /* any 0xRRGGBB */
-+
-+/* back to 0xRRGGBB, as a screen decoding Canon's way would show it */
-+uint32_t fos_screen_rgb(uint32_t yuv, int white_y);
-+
-+void fos_gfx_init();
-+
-+/* palette index of a flat colour */
-+uint8_t fos_ix(fcol c);
-+
-+/* palette index for a 12-bit level, dithered for pixel (x, y) */
-+uint8_t fos_ix_dither(int ramp, int lv, int x, int y);
-+
-+/* the same, inline, for inner loops */
-+extern uint8_t fos_ramp_base[RAMP_COUNT];
-+extern uint8_t fos_ramp_last[RAMP_COUNT]; /* entries - 1 */
-+extern int fos_ramp_mul[RAMP_COUNT]; /* lv * mul >> 16 = position in 1/16 entries */
-+extern const uint8_t fos_bayer[4][4];
-+
-+FOS_INLINE int fos_ramp_pos(int ramp, int lv)
-+{
-+ return ((lv < 0 ? 0 : lv) * fos_ramp_mul[ramp]) >> 16;
-+}
-+
-+FOS_INLINE uint8_t fos_ixd(int ramp, int pos16, int x, int y)
-+{
-+ int p = (pos16 + fos_bayer[y & 3][x & 3]) >> 4;
-+ return fos_ramp_base[ramp] + (p > fos_ramp_last[ramp] ? fos_ramp_last[ramp] : p);
-+}
-+
-+/* the colour behind a palette index, and its luminance */
-+fcol fos_colour_of(uint8_t ix);
-+int fos_luma(uint8_t ix);
-+
-+/* the same as tables, for inner loops */
-+extern uint8_t fos_rev_ramp[256];
-+extern uint16_t fos_rev_lv[256]; /* 12-bit */
-+extern uint8_t fos_luma_tab[256];
-+extern uint8_t fos_chroma_tab[256];
-+extern uint16_t fos_lum2lv[RAMP_COUNT][256]; /* luminance -> level, per ramp */
-+
-+/* a pixel at k/256 of its brightness, dithered again */
-+FOS_INLINE uint8_t fos_darken(uint8_t ix, int k, int x, int y)
-+{
-+ int r = fos_rev_ramp[ix];
-+ return fos_ixd(r, fos_ramp_pos(r, (fos_rev_lv[ix] * k) >> 8), x, y);
-+}
-+
-+/* dst with k/256 of src glazed over it (reflections): luminance blends,
-+ * the ramp is whichever brings more colour */
-+FOS_INLINE uint8_t fos_glaze(uint8_t dst, uint8_t src, int k, int x, int y)
-+{
-+ int ld = fos_luma_tab[dst];
-+ int l = ld + (((fos_luma_tab[src] - ld) * k) >> 8);
-+ int r = fos_chroma_tab[src] * k >= fos_chroma_tab[dst] * (256 - k) ? fos_rev_ramp[src] : fos_rev_ramp[dst];
-+ return fos_ixd(r, fos_ramp_pos(r, fos_lum2lv[r][l]), x, y);
-+}
-+
-+/* blend a 12-bit level of a ramp over a pixel (opacity 0..256) */
-+uint8_t fos_mix(uint8_t dst, int ramp, int lv, int alpha);
-+uint8_t fos_mix_dither(uint8_t dst, int ramp, int lv, int alpha, int x, int y);
-+
-+/* the colour a of the way from (ra, la) to (rb, lb), as a ramp and level */
-+void fos_lerp2(int ra, int la, int rb, int lb, int a, int *ramp, int *lv);
-+
-+/* canvas */
-+void fos_canvas_init(struct fos_canvas *cv, uint8_t *px, int pitch, int w, int h);
-+void fos_clip(struct fos_canvas *cv, int x0, int y0, int x1, int y1);
-+void fos_noclip(struct fos_canvas *cv);
-+
-+void fos_fill(struct fos_canvas *cv, int x, int y, int w, int h, fcol c);
-+void fos_fill_ix(struct fos_canvas *cv, int x, int y, int w, int h, uint8_t ix);
-+void fos_blend(struct fos_canvas *cv, int x, int y, int w, int h, fcol c, int alpha);
-+void fos_scale_levels(struct fos_canvas *cv, int x, int y, int w, int h, int k); /* k/256 */
-+void fos_vgrad(struct fos_canvas *cv, int x, int y, int w, int h, int ramp, int lv0, int lv1);
-+
-+/* anti-aliased shapes; coordinates in 1/256 px where named *8 */
-+void fos_rrect(struct fos_canvas *cv, int x, int y, int w, int h, int r, fcol c, int alpha);
-+void fos_rrect_line(struct fos_canvas *cv, int x, int y, int w, int h, int r, int t, fcol c, int alpha);
-+void fos_disc(struct fos_canvas *cv, int cx8, int cy8, int r8, fcol c, int alpha);
-+void fos_ring(struct fos_canvas *cv, int cx8, int cy8, int r8, int t8, fcol c, int alpha);
-+void fos_line(struct fos_canvas *cv, int x0_8, int y0_8, int x1_8, int y1_8, int w8, fcol c, int alpha);
-+void fos_convex(struct fos_canvas *cv, const int *xy8, int n, fcol c, int alpha);
-+void fos_tri(struct fos_canvas *cv, int cx, int cy, int size, int dir, fcol c, int alpha); /* dir 0 right, 1 down, 2 left, 3 up */
-+
-+/* text: y is the baseline; track is extra spacing in 1/16 px */
-+int fos_text(struct fos_canvas *cv, const struct fos_font *f, int x, int y, const char *s, fcol c, int alpha, int track);
-+int fos_text_w(const struct fos_font *f, const char *s, int track);
-+int fos_text_c(struct fos_canvas *cv, const struct fos_font *f, int cx, int y, const char *s, fcol c, int alpha, int track);
-+int fos_text_r(struct fos_canvas *cv, const struct fos_font *f, int rx, int y, const char *s, fcol c, int alpha, int track);
-+
-+/* text onto any 8-bit buffer with someone else's palette: map[coverage]
-+ * (1..15) is the index to write, 0 leaves the pixel alone */
-+int fos_text_map(uint8_t *px, int pitch, int w, int h, const struct fos_font *f, int x, int y,
-+ const char *s, const uint8_t map[16], int track);
-+
-+/* small integer helpers */
-+int fos_isqrt(unsigned int v);
-+int fos_sin(int a); /* a: 0..65535 = one turn; result -4096..4096 */
-+int fos_cos(int a);
-+
-+FOS_INLINE int fos_clamp(int v, int lo, int hi) { return v < lo ? lo : v > hi ? hi : v; }
-+
-+#endif
-diff --git a/src/fos_hud.c b/src/fos_hud.c
-new file mode 100644
-index 000000000..3d897a8e9
---- /dev/null
-+++ b/src/fos_hud.c
-@@ -0,0 +1,371 @@
-+/* fos_hud: the SLR viewfinder over LiveView - an aperture scale with the
-+ * meter needle on the right, a strip of red seven-segment LEDs below.
-+ *
-+ * Unlike the film OS screens this draws with Canon's palette (LiveView
-+ * shows through index 0, and Canon keeps drawing its own bits), so it
-+ * takes the indices it may use from the caller and draws straight into
-+ * the overlay buffer.
-+ */
-+
-+#include "fos.h"
-+
-+#define W 720
-+#define H 480
-+#define STRIP_W 64 /* meter strip on the right */
-+#define BAR_H 44 /* LED readout at the bottom */
-+#define VIEW_W (W - STRIP_W)
-+#define VIEW_H (H - BAR_H)
-+#define THIRD_PX 14 /* scale spacing per 1/3 stop */
-+#define SCALE_TOP 26 /* y of f/22; f/1 sits 27 thirds below */
-+
-+static uint8_t *vr;
-+static int vp;
-+static const struct fos_hud_palette *pal;
-+
-+static void fill(int x, int y, int w, int h, uint8_t c)
-+{
-+ if (x < 0) { w += x; x = 0; }
-+ if (y < 0) { h += y; y = 0; }
-+ if (x + w > W) w = W - x;
-+ if (y + h > H) h = H - y;
-+ for (int j = 0; j < h; j++)
-+ memset(vr + (y + j) * vp + x, c, w > 0 ? w : 0);
-+}
-+
-+static int fstop_y(int index)
-+{
-+ return SCALE_TOP + (fos_nfstops - 1 - index) * THIRD_PX;
-+}
-+
-+/* text through a coverage map: grey on black, or red LEDs (two levels) */
-+static int text_gray(const struct fos_font *f, int x, int y, const char *s, int pct, int track)
-+{
-+ uint8_t map[16];
-+ map[0] = 0;
-+ for (int i = 1; i < 16; i++)
-+ map[i] = i < 3 ? 0 : pal->gray[pct * i / 15];
-+ return fos_text_map(vr, vp, W, H, f, x, y, s, map, track);
-+}
-+
-+static int text_led(const struct fos_font *f, int x, int y, const char *s, int on, int track)
-+{
-+ uint8_t map[16];
-+ for (int i = 0; i < 16; i++)
-+ map[i] = i < 5 ? 0 : !on ? pal->gray[i < 10 ? 6 : 9] : i < 10 ? pal->dark_red : pal->red;
-+ return fos_text_map(vr, vp, W, H, f, x, y, s, map, track);
-+}
-+
-+/* ---------------------------------------------------------------- seven segments */
-+
-+/* segments a..g as bits 0..6 */
-+static int seg_bits(int ch)
-+{
-+ static const uint8_t digits[10] = { 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F };
-+ if (ch >= '0' && ch <= '9') return digits[ch - '0'];
-+ switch (ch)
-+ {
-+ case '-': return 0x40;
-+ case 'E': return 0x79;
-+ case 'n': return 0x54;
-+ case 'd': return 0x5E;
-+ case 'F': return 0x71;
-+ case 'b': return 0x7C;
-+ case 'u': return 0x1C;
-+ case 'L': return 0x38;
-+ case 'S': return 0x6D;
-+ }
-+ return 0;
-+}
-+
-+/* the digits' size: the HUD's, or the top plate's bigger ones (seg_size) */
-+static int DIG_W = 15, DIG_H = 26, SEG_T = 3, DIG_GAP = 6;
-+
-+static void seg_size(int w, int h, int t, int gap)
-+{
-+ DIG_W = w; DIG_H = h; SEG_T = t; DIG_GAP = gap;
-+}
-+
-+/* one slanted digit; off segments are drawn faintly, like the unlit LEDs
-+ * you can just see behind a real viewfinder mask */
-+static void seg_digit(int x, int y, int bits, uint8_t on, uint8_t off)
-+{
-+ int half = DIG_H / 2;
-+ for (int r = 0; r < DIG_H; r++)
-+ {
-+ int slant = (DIG_H - 1 - r) * (DIG_H * 3 / 26) / DIG_H; /* leans right like the real ones */
-+ int yy = y + r;
-+ /* horizontals: a at the top, g in the middle, d at the bottom */
-+ int hseg = -1;
-+ if (r < SEG_T) hseg = 0;
-+ else if (r >= half - 1 && r < half - 1 + SEG_T) hseg = 6;
-+ else if (r >= DIG_H - SEG_T) hseg = 3;
-+ if (hseg >= 0)
-+ {
-+ /* chamfered ends: shorter where the segment meets the verticals */
-+ int inset = (hseg == 6 ? 2 : (r == 0 || r == DIG_H - 1) ? 2 : 1) * SEG_T / 3;
-+ fill(x + slant + inset + 1, yy, DIG_W - 2 * inset - 2, 1, (bits >> hseg) & 1 ? on : off);
-+ }
-+ /* verticals: f and b above the middle, e and c below */
-+ int upper = r < half;
-+ if (r > 1 && r < DIG_H - 2 && r != half - 1 + SEG_T / 2)
-+ {
-+ int left = upper ? 5 : 4, right = upper ? 1 : 2;
-+ fill(x + slant, yy, SEG_T - (r == 2 || r == DIG_H - 3 ? 1 : 0), 1, (bits >> left) & 1 ? on : off);
-+ fill(x + slant + DIG_W - SEG_T, yy, SEG_T, 1, (bits >> right) & 1 ? on : off);
-+ }
-+ }
-+}
-+
-+/* a string of digits; '.' is a dot after the previous digit, '"' the
-+ * seconds mark; returns the width */
-+static int seg_text(int x, int y, const char *s, int lit)
-+{
-+ uint8_t on = lit ? pal->red : pal->gray[9], off = pal->gray[4];
-+ int x0 = x;
-+ for (; *s; s++)
-+ {
-+ if (*s == '.')
-+ {
-+ fill(x - DIG_GAP + 1, y + DIG_H - SEG_T, SEG_T, SEG_T, on);
-+ x += 2;
-+ continue;
-+ }
-+ if (*s == '"')
-+ {
-+ fill(x - 2, y, SEG_T * 2 / 3, DIG_H / 4, on);
-+ fill(x + SEG_T * 2 / 3, y, SEG_T * 2 / 3, DIG_H / 4, on);
-+ x += DIG_H / 3;
-+ continue;
-+ }
-+ seg_digit(x, y, seg_bits(*s), on, off);
-+ x += DIG_W + DIG_GAP;
-+ }
-+ return x - x0;
-+}
-+
-+/* the meter's pointer: a red wedge pointing at the scale */
-+static void needle(int y, uint8_t c)
-+{
-+ int x0 = W - STRIP_W + 4;
-+ for (int r = -7; r <= 7; r++)
-+ fill(x0, y + r, 16 - 2 * (r < 0 ? -r : r), 1, c);
-+}
-+
-+/* ---------------------------------------------------------------- the HUD */
-+
-+void fos_hud_draw(uint8_t *vram, int pitch, const struct fos_hud *h, const struct fos_hud_palette *p)
-+{
-+ vr = vram; vp = pitch; pal = p;
-+ uint8_t bg = p->black;
-+ char label[8];
-+
-+ /* the meter strip */
-+ int sx = W - STRIP_W;
-+ fill(sx, 0, STRIP_W, VIEW_H, bg);
-+ fill(sx, 0, 1, VIEW_H, p->gray[18]);
-+ /* red zones: more light than f/22 can take, less than the lens can open to */
-+ fill(sx + 27, 4, 4, SCALE_TOP - 11, p->dark_red);
-+ fill(sx + 27, fstop_y(h->widest) + 9, 4, 20, p->dark_red);
-+ for (int i = 1; i < fos_nfstops; i++)
-+ {
-+ int y = fstop_y(i);
-+ int usable = i >= h->widest;
-+ if ((i - 1) % 3)
-+ {
-+ fill(sx + 27, y, 4, 1, p->gray[usable ? 30 : 14]); /* thirds */
-+ continue;
-+ }
-+ fos_format_fstop(label, sizeof(label), i);
-+ fill(sx + 24, y, 8, 1, p->gray[usable ? 55 : 22]);
-+ text_gray(&fos_font_xs, sx + 36, y + 5, label, i == h->fstop ? 100 : usable ? 62 : 26, 0);
-+ }
-+ /* the aperture you set: white tick */
-+ fill(sx + 20, fstop_y(h->fstop) - 1, 14, 3, p->white);
-+ /* the needle points at the aperture the meter asks for, and blinks
-+ * at either end when that is out of reach */
-+ if (h->lit && h->meter)
-+ {
-+ int y;
-+ int out = h->want > fos_nfstops - 1 || h->want < h->widest;
-+ if (h->want > fos_nfstops - 1) y = SCALE_TOP - 12;
-+ else if (h->want < h->widest) y = fstop_y(h->widest) + 18;
-+ else y = fstop_y(h->want);
-+ if (!out || h->blink)
-+ needle(y, p->red);
-+ }
-+
-+ /* the LED strip */
-+ int by = VIEW_H;
-+ fill(0, by, W, BAR_H, bg);
-+ fill(0, by, W, 1, p->gray[18]);
-+ int ty = by + (BAR_H - DIG_H) / 2 + 1;
-+ int base = ty + DIG_H;
-+
-+ /* wind reminder: blinks whether or not the meter is on */
-+ text_led(&fos_font_mdb, 20, base - 3, "WIND", h->need_wind && h->blink, 24);
-+
-+ /* shutter speed: 1/125 shows as 125, slow speeds keep their seconds mark */
-+ seg_text(132, ty, h->shutter, h->lit);
-+
-+ /* aperture */
-+ text_gray(&fos_font_xs, 262, base - 4, "f", h->lit ? 70 : 30, 0);
-+ fos_format_fstop(label, sizeof(label), h->fstop);
-+ seg_text(274, ty, label, h->lit);
-+
-+ /* meter on */
-+ for (int r = -6; r <= 6; r++)
-+ {
-+ int w2 = fos_isqrt(36 - r * r);
-+ fill(392 - w2, by + BAR_H / 2 + r, 2 * w2 + 1, 1, h->lit ? p->red : p->gray[9]);
-+ }
-+
-+ /* the frame counter, END at the end */
-+ int lit_count = h->lit || h->finished;
-+ if (h->finished)
-+ seg_text(452, ty, h->blink ? "End" : " ", 1);
-+ else
-+ {
-+ char n[8];
-+ snprintf(n, sizeof(n), "%d", h->frame);
-+ int w = seg_text(452, ty, n, lit_count);
-+ snprintf(n, sizeof(n), "/%d", h->exposures);
-+ text_gray(&fos_font_sm, 452 + w + 2, base - 2, n, lit_count ? 55 : 28, 0);
-+ }
-+
-+ /* which film, quietly */
-+ if (h->film)
-+ {
-+ int w = fos_text_w(&fos_font_xs, h->film, 32);
-+ text_gray(&fos_font_xs, W - 22 - w, base - 6, h->film, 40, 32);
-+ }
-+
-+ /* focusing screen: microprism collar and split-image circle */
-+ if (h->focus_screen)
-+ {
-+ int cx = VIEW_W / 2, cy = VIEW_H / 2;
-+ for (int a = 0; a < 360; a += 2)
-+ {
-+ int c = fos_cos(a * 65536 / 360), s = fos_sin(a * 65536 / 360);
-+ int x = cx + c * 62 / 4096, y = cy + s * 62 / 4096;
-+ fill(x, y, 1, 1, p->gray[70]);
-+ x = cx + c * 28 / 4096; y = cy + s * 28 / 4096;
-+ fill(x, y, 1, 1, p->white);
-+ }
-+ fill(cx - 28, cy, 57, 1, p->white);
-+ }
-+}
-+
-+/* make our strips transparent again so LiveView shows through */
-+void fos_hud_clear(uint8_t *vram, int pitch, const struct fos_hud_palette *p)
-+{
-+ vr = vram; vp = pitch; pal = p;
-+ fill(W - STRIP_W, 0, STRIP_W, VIEW_H, p->clear);
-+ fill(0, VIEW_H, W, BAR_H, p->clear);
-+ fill(VIEW_W / 2 - 64, VIEW_H / 2 - 64, 129, 129, p->clear);
-+}
-+
-+/* ---------------------------------------------------------------- the top plate */
-+
-+/* not on the EOS M: it has no viewfinder to shoot through, and its boot
-+ * memory is short (MEMORY.md) */
-+#ifndef CONFIG_EOSM
-+
-+/* What a DSLR shows when you shoot through the viewfinder and the screen
-+ * on the back is Canon's settings display: a film camera's top plate in
-+ * its place, lit like the HUD's LEDs. Shutter, aperture and the frame
-+ * counter in big red digits, the meter's needle on a scale of stops, the
-+ * film and its speed. */
-+void fos_hud_plate(uint8_t *vram, int pitch, const struct fos_hud *h, const struct fos_hud_palette *p)
-+{
-+ vr = vram; vp = pitch; pal = p;
-+ char b[24];
-+ fill(0, 0, W, H, p->black);
-+
-+ /* the maker's plate: name, and the film loaded */
-+ text_gray(&fos_font_sm, 28, 40, "M" "\x80" "FILM", 46, 40);
-+ if (h->film)
-+ {
-+ int w = fos_text_w(&fos_font_lg, h->film, 0);
-+ text_gray(&fos_font_lg, W - 28 - w, 46, h->film, 100, 0);
-+ }
-+ if (h->iso)
-+ {
-+ snprintf(b, sizeof(b), "ISO %d", h->iso);
-+ int w = fos_text_w(&fos_font_sm, b, 24);
-+ text_gray(&fos_font_sm, W - 28 - w, 74, b, 55, 24);
-+ }
-+ fill(28, 92, W - 56, 1, p->gray[18]);
-+
-+ /* three windows: shutter, aperture, frames */
-+ static const char *const names[3] = { "SHUTTER", "APERTURE", "FRAME" };
-+ const int col[3] = { 28, 268, 488 };
-+ for (int i = 0; i < 3; i++)
-+ text_gray(&fos_font_xs, col[i], 132, names[i], 40, 48);
-+ seg_size(36, 64, 7, 12);
-+ int ty = 150;
-+ seg_text(col[0], ty, h->shutter, h->lit);
-+ fos_format_fstop(b, sizeof(b), h->fstop);
-+ int w = seg_text(col[1] + 22, ty, b, h->lit);
-+ text_gray(&fos_font_md, col[1], ty + 62, "f", h->lit ? 70 : 30, 0);
-+ (void) w;
-+ if (h->finished)
-+ seg_text(col[2], ty, h->blink ? "End" : " ", 1);
-+ else
-+ {
-+ snprintf(b, sizeof(b), "%d", h->frame);
-+ int fw = seg_text(col[2], ty, b, 1);
-+ snprintf(b, sizeof(b), "/%d", h->exposures);
-+ text_gray(&fos_font_md, col[2] + fw + 4, ty + 62, b, 55, 0);
-+ }
-+ seg_size(15, 26, 3, 6);
-+
-+ /* the meter: -2 .. +2 stops in thirds, the needle where the light is */
-+ int my = 286, mx0 = 120, mx1 = W - 120, mc = (mx0 + mx1) / 2, step = (mx1 - mx0) / 12;
-+ fill(mx0, my, mx1 - mx0, 1, p->gray[30]);
-+ for (int t = -6; t <= 6; t++)
-+ {
-+ int x = mc + t * step, big = t % 3 == 0;
-+ fill(x, my - (big ? 10 : 5), t == 0 ? 3 : 1, big ? 20 : 10, p->gray[t == 0 ? 70 : big ? 45 : 25]);
-+ if (big && t)
-+ {
-+ snprintf(b, sizeof(b), "%+d", t / 3);
-+ int tw = fos_text_w(&fos_font_xs, b, 0);
-+ text_gray(&fos_font_xs, x - tw / 2, my + 30, b, 40, 0);
-+ }
-+ }
-+ text_gray(&fos_font_xs, mx0 - 70, my + 5, "UNDER", 30, 24);
-+ text_gray(&fos_font_xs, mx1 + 16, my + 5, "OVER", 30, 24);
-+ if (h->lit && h->meter)
-+ {
-+ int thirds = h->want - h->fstop; /* + : brighter than the aperture set wants (over) */
-+ int out = thirds > 6 || thirds < -6;
-+ thirds = thirds > 6 ? 6 : thirds < -6 ? -6 : thirds;
-+ if (!out || h->blink)
-+ {
-+ int x = mc + thirds * step;
-+ for (int r = 0; r < 14; r++)
-+ fill(x - (14 - r) / 2, my - 26 + r, 14 - r + 1, 1, p->red);
-+ }
-+ }
-+
-+ /* the frames left, like the marks on a film counter */
-+ int n = h->exposures > 0 ? h->exposures : 36, done = h->finished ? n : h->frame - 1;
-+ int fx = 28, fw = (W - 56) / n;
-+ for (int i = 0; i < n; i++)
-+ fill(fx + i * fw, 364, fw - 3 > 1 ? fw - 3 : 1, 10, i < done ? p->gray[60] : i == done ? p->red : p->gray[14]);
-+ if (h->need_wind)
-+ text_led(&fos_font_mdb, 28, 420, "WIND ON", h->blink, 24);
-+
-+ /* the way back to the film OS */
-+ const char *hint = "TRASH Home PLAY Prints";
-+ int hw = fos_text_w(&fos_font_xs, hint, 24);
-+ text_gray(&fos_font_xs, W - 28 - hw, H - 22, hint, 36, 24);
-+}
-+
-+/* the plate off: Canon's screen shows again */
-+void fos_hud_plate_clear(uint8_t *vram, int pitch, const struct fos_hud_palette *p)
-+{
-+ vr = vram; vp = pitch; pal = p;
-+ fill(0, 0, W, H, p->clear);
-+}
-+#endif
-diff --git a/src/fos_jpeg.c b/src/fos_jpeg.c
-new file mode 100644
-index 000000000..a2ec300ff
---- /dev/null
-+++ b/src/fos_jpeg.c
-@@ -0,0 +1,397 @@
-+/* fos_jpeg: a small baseline JPEG writer for the developed frames - 4:2:0,
-+ * the standard Huffman tables, integer DCT (the camera has no FPU), and
-+ * EXIF with the date, the film and the f-stop.
-+ */
-+
-+#include "fos_jpeg.h"
-+#include "fos.h"
-+#include <string.h>
-+
-+/* ---------------------------------------------------------------- tables */
-+
-+static const uint8_t zigzag[64] =
-+{
-+ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
-+ 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
-+ 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
-+ 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
-+};
-+
-+/* the example tables of the standard (K.1, K.2), in natural order */
-+static const uint8_t std_q[2][64] =
-+{
-+ { 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56,
-+ 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92,
-+ 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99 },
-+ { 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99,
-+ 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
-+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
-+};
-+
-+/* the standard's Huffman tables (K.3): code counts by length, then values */
-+static const uint8_t dc_bits[2][16] = { { 0, 1, 5, 1, 1, 1, 1, 1, 1 }, { 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 } };
-+static const uint8_t dc_vals[12] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-+static const uint8_t ac_bits[2][16] =
-+{
-+ { 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d },
-+ { 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 },
-+};
-+static const uint8_t ac_vals[2][162] =
-+{
-+ { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
-+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
-+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
-+ 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
-+ 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
-+ 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
-+ 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
-+ 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
-+ 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
-+ 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
-+ 0xf9, 0xfa },
-+ { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
-+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
-+ 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
-+ 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
-+ 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
-+ 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-+ 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
-+ 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
-+ 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
-+ 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
-+ 0xf9, 0xfa },
-+};
-+
-+/* ---------------------------------------------------------------- output */
-+
-+struct jw
-+{
-+ void *f;
-+ uint8_t buf[2048];
-+ int n, ok;
-+ uint32_t bits;
-+ int nbits;
-+ uint16_t dc_code[2][12], ac_code[2][256];
-+ uint8_t dc_len[2][12], ac_len[2][256];
-+ int32_t recip[2][64]; /* 65536 / (8 q), zigzag order */
-+ uint8_t q[2][64]; /* zigzag order, as written */
-+};
-+
-+static void flush(struct jw *w)
-+{
-+ if (w->n && fos_port_write(w->f, w->buf, w->n) != w->n) w->ok = 0;
-+ w->n = 0;
-+}
-+
-+static void put8(struct jw *w, int b)
-+{
-+ if (w->n == (int) sizeof(w->buf)) flush(w);
-+ w->buf[w->n++] = (uint8_t) b;
-+}
-+
-+static void put16(struct jw *w, int v) { put8(w, v >> 8); put8(w, v); }
-+
-+static void put_bits(struct jw *w, uint32_t code, int len)
-+{
-+ w->bits = w->bits << len | (code & ((1u << len) - 1));
-+ w->nbits += len;
-+ while (w->nbits >= 8)
-+ {
-+ int b = (int) (w->bits >> (w->nbits - 8)) & 0xFF;
-+ put8(w, b);
-+ if (b == 0xFF) put8(w, 0); /* stuffed */
-+ w->nbits -= 8;
-+ }
-+}
-+
-+static void huff_codes(const uint8_t *bits, const uint8_t *vals, uint16_t *code, uint8_t *len)
-+{
-+ int c = 0, k = 0;
-+ for (int l = 1; l <= 16; l++)
-+ {
-+ for (int i = 0; i < bits[l - 1]; i++, k++)
-+ {
-+ code[vals[k]] = (uint16_t) c++;
-+ len[vals[k]] = (uint8_t) l;
-+ }
-+ c <<= 1;
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- one block */
-+
-+/* forward DCT, integer (libjpeg's islow, its constants in 1/8192): the
-+ * output 8 times too large */
-+enum { C0298 = 2446, C0390 = 3196, C0541 = 4433, C0765 = 6270, C0899 = 7373, C1175 = 9633,
-+ C1501 = 12299, C1847 = 15137, C1961 = 16069, C2053 = 16819, C2562 = 20995, C3072 = 25172 };
-+static void fdct(int32_t *d)
-+{
-+ for (int pass = 0; pass < 2; pass++)
-+ {
-+ for (int i = 0; i < 8; i++)
-+ {
-+ int32_t *p = pass ? d + i : d + i * 8;
-+ const int s = pass ? 8 : 1;
-+ int32_t t0 = p[0] + p[7 * s], t7 = p[0] - p[7 * s], t1 = p[s] + p[6 * s], t6 = p[s] - p[6 * s];
-+ int32_t t2 = p[2 * s] + p[5 * s], t5 = p[2 * s] - p[5 * s], t3 = p[3 * s] + p[4 * s], t4 = p[3 * s] - p[4 * s];
-+ int32_t t10 = t0 + t3, t13 = t0 - t3, t11 = t1 + t2, t12 = t1 - t2;
-+ const int sh = pass ? 15 : 11;
-+ if (pass) { p[0] = (t10 + t11 + 2) >> 2; p[4 * s] = (t10 - t11 + 2) >> 2; }
-+ else { p[0] = (t10 + t11) * 4; p[4 * s] = (t10 - t11) * 4; }
-+ int32_t z1 = (t12 + t13) * C0541;
-+ p[2 * s] = (z1 + t13 * C0765 + (1 << (sh - 1))) >> sh;
-+ p[6 * s] = (z1 - t12 * C1847 + (1 << (sh - 1))) >> sh;
-+ int32_t a = t4 + t7, b = t5 + t6, c = t4 + t6, e = t5 + t7;
-+ int32_t z5 = (c + e) * C1175;
-+ t4 *= C0298; t5 *= C2053; t6 *= C3072; t7 *= C1501;
-+ a *= -C0899; b *= -C2562; c = c * -C1961 + z5; e = e * -C0390 + z5;
-+ p[7 * s] = (t4 + a + c + (1 << (sh - 1))) >> sh;
-+ p[5 * s] = (t5 + b + e + (1 << (sh - 1))) >> sh;
-+ p[3 * s] = (t6 + b + c + (1 << (sh - 1))) >> sh;
-+ p[s] = (t7 + a + e + (1 << (sh - 1))) >> sh;
-+ }
-+ }
-+}
-+
-+static int bit_size(int v)
-+{
-+ int n = 0;
-+ if (v < 0) v = -v;
-+ while (v) { n++; v >>= 1; }
-+ return n;
-+}
-+
-+/* a block of samples (level-shifted) to the file; t: 0 luma, 1 chroma */
-+static void block(struct jw *w, int32_t *d, int t, int *dc_prev)
-+{
-+ fdct(d);
-+ int q[64];
-+ for (int i = 0; i < 64; i++)
-+ {
-+ int32_t v = d[zigzag[i]], r = w->recip[t][i];
-+ q[i] = v >= 0 ? (int) ((v * r + 32768) >> 16) : -(int) ((-v * r + 32768) >> 16);
-+ }
-+ int diff = q[0] - *dc_prev, n = bit_size(diff);
-+ *dc_prev = q[0];
-+ put_bits(w, w->dc_code[t][n], w->dc_len[t][n]);
-+ if (n) put_bits(w, (uint32_t) (diff < 0 ? diff - 1 : diff), n);
-+ int run = 0;
-+ for (int i = 1; i < 64; i++)
-+ {
-+ if (!q[i]) { run++; continue; }
-+ while (run > 15) { put_bits(w, w->ac_code[t][0xF0], w->ac_len[t][0xF0]); run -= 16; }
-+ int s = bit_size(q[i]), sym = run << 4 | s;
-+ put_bits(w, w->ac_code[t][sym], w->ac_len[t][sym]);
-+ put_bits(w, (uint32_t) (q[i] < 0 ? q[i] - 1 : q[i]), s);
-+ run = 0;
-+ }
-+ if (run) put_bits(w, w->ac_code[t][0], w->ac_len[t][0]);
-+}
-+
-+/* ---------------------------------------------------------------- EXIF */
-+
-+/* a tiny TIFF: IFD0 (description, make, model, software, date) and the
-+ * EXIF IFD (date taken, f-number) */
-+/* text for XML: the few characters that can't stand as they are */
-+static int xml_text(char *out, int size, const char *s)
-+{
-+ int n = 0;
-+ for (; *s && n < size - 6; s++)
-+ {
-+ const char *e = *s == '&' ? "&amp;" : *s == '<' ? "&lt;" : *s == '>' ? "&gt;" : 0;
-+ if (e) { int l = (int) strlen(e); memcpy(out + n, e, l); n += l; }
-+ else out[n++] = *s;
-+ }
-+ out[n] = 0;
-+ return n;
-+}
-+
-+static int xmp(char *out, int size, const char *film)
-+{
-+ char f[160];
-+ xml_text(f, sizeof(f), film);
-+ int n = snprintf(out, size,
-+ "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\"><rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">"
-+ "<rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"
-+ "<dc:description><rdf:Alt><rdf:li xml:lang=\"x-default\">%s</rdf:li></rdf:Alt></dc:description>"
-+ "<dc:subject><rdf:Bag><rdf:li>%s</rdf:li><rdf:li>M-Film</rdf:li><rdf:li>film simulation</rdf:li></rdf:Bag></dc:subject>"
-+ "</rdf:Description></rdf:RDF></x:xmpmeta>", f, f);
-+ return n < size ? n : size - 1;
-+}
-+
-+static int exif(uint8_t *out, const struct fos_jpeg_meta *m)
-+{
-+ char date[20] = "";
-+ if (m->when && strlen(m->when) >= 16)
-+ {
-+ /* "2026-10-22 17:45" -> "2026:10:22 17:45:00" */
-+ memcpy(date, m->when, 16);
-+ date[4] = date[7] = ':';
-+ memcpy(date + 16, ":00", 4);
-+ }
-+ int fnum = 0; /* x10 */
-+ if (m->fstop && *m->fstop)
-+ {
-+ const char *s = m->fstop;
-+ while (*s >= '0' && *s <= '9') fnum = fnum * 10 + (*s++ - '0');
-+ fnum *= 10;
-+ if (*s == '.' && s[1] >= '0' && s[1] <= '9') fnum += s[1] - '0';
-+ }
-+ struct { int tag, type; const char *s; } ifd0[] =
-+ {
-+ { 0x010E, 2, m->desc }, { 0x010F, 2, "Canon" }, { 0x0110, 2, fos_port_model() },
-+ { 0x0131, 2, "M-FILM darkroom" }, { 0x0132, 2, date },
-+ };
-+ const int n0 = 6, n1 = 1 + (fnum > 0);
-+ int p = 8, data = 8 + 2 + n0 * 12 + 4 + 2 + n1 * 12 + 4;
-+ memcpy(out, "II*\0\x08\0\0\0", 8);
-+#define W16(v) (out[p] = (uint8_t) (v), out[p + 1] = (uint8_t) ((v) >> 8), p += 2)
-+#define W32(v) (W16((v) & 0xFFFF), W16((uint32_t) (v) >> 16))
-+ W16(n0);
-+ for (int i = 0; i < n0 - 1; i++)
-+ {
-+ const char *s = ifd0[i].s && *ifd0[i].s ? ifd0[i].s : " ";
-+ int len = (int) strlen(s) + 1;
-+ W16(ifd0[i].tag); W16(2); W32(len);
-+ if (len <= 4) { memset(out + p, 0, 4); memcpy(out + p, s, len); p += 4; }
-+ else { W32(data); memcpy(out + data, s, len); data += (len + 1) & ~1; }
-+ }
-+ int exif_at = 8 + 2 + n0 * 12 + 4;
-+ W16(0x8769); W16(4); W32(1); W32(exif_at);
-+ W32(0);
-+ W16(n1); /* tags in ascending order */
-+ if (fnum > 0)
-+ {
-+ W16(0x829D); W16(5); W32(1); W32(data);
-+ int q = data;
-+ out[q] = (uint8_t) fnum; out[q + 1] = (uint8_t) (fnum >> 8); out[q + 2] = out[q + 3] = 0;
-+ out[q + 4] = 10; out[q + 5] = out[q + 6] = out[q + 7] = 0;
-+ data += 8;
-+ }
-+ W16(0x9003); W16(2); W32(20); W32(data);
-+ memcpy(out + data, date[0] ? date : " ", 20);
-+ data += 20;
-+ W32(0);
-+#undef W16
-+#undef W32
-+ return data;
-+}
-+
-+/* ---------------------------------------------------------------- the file */
-+
-+int fos_jpeg_write(const char *path, const uint8_t *rgb, int stride, int width, int height,
-+ int quality, const struct fos_jpeg_meta *meta)
-+{
-+ struct jw *w = fos_port_alloc(sizeof(struct jw));
-+ if (!w) return 0;
-+ memset(w, 0, sizeof(*w));
-+ w->ok = 1;
-+ int scale = quality < 50 ? 5000 / quality : 200 - quality * 2;
-+ for (int t = 0; t < 2; t++)
-+ {
-+ for (int i = 0; i < 64; i++)
-+ {
-+ int v = (std_q[t][zigzag[i]] * scale + 50) / 100;
-+ v = v < 1 ? 1 : v > 255 ? 255 : v;
-+ w->q[t][i] = (uint8_t) v;
-+ w->recip[t][i] = 65536 / (8 * v);
-+ }
-+ huff_codes(dc_bits[t], dc_vals, w->dc_code[t], w->dc_len[t]);
-+ huff_codes(ac_bits[t], ac_vals[t], w->ac_code[t], w->ac_len[t]);
-+ }
-+ w->f = fos_port_open(path, 1);
-+ if (!w->f) { fos_port_free(w); return 0; }
-+
-+ put16(w, 0xFFD8);
-+ /* JFIF */
-+ put16(w, 0xFFE0); put16(w, 16);
-+ static const uint8_t jfif[14] = { 'J', 'F', 'I', 'F', 0, 1, 1, 0, 0, 1, 0, 1, 0, 0 };
-+ for (int i = 0; i < 14; i++) put8(w, jfif[i]);
-+ /* EXIF */
-+ if (meta)
-+ {
-+ uint8_t ex[512];
-+ memset(ex, 0, sizeof(ex));
-+ int n = exif(ex, meta);
-+ put16(w, 0xFFE1); put16(w, n + 8);
-+ static const uint8_t tag[6] = { 'E', 'x', 'i', 'f', 0, 0 };
-+ for (int i = 0; i < 6; i++) put8(w, tag[i]);
-+ for (int i = 0; i < n; i++) put8(w, ex[i]);
-+ /* XMP: the film as the caption and as keywords, where photo apps
-+ * (Lightroom, Photos, Bridge) look for them; EXIF's ImageDescription
-+ * above is the same caption for the ones that read only EXIF */
-+ if (meta->desc && *meta->desc)
-+ {
-+ static char x[1024];
-+ int k = xmp(x, sizeof(x), meta->desc);
-+ static const char ns[] = "http://ns.adobe.com/xap/1.0/";
-+ put16(w, 0xFFE1); put16(w, 2 + (int) sizeof(ns) + k);
-+ for (int i = 0; i < (int) sizeof(ns); i++) put8(w, (uint8_t) ns[i]); /* with its 0 */
-+ for (int i = 0; i < k; i++) put8(w, (uint8_t) x[i]);
-+ }
-+ }
-+ /* quantisation, frame, Huffman tables */
-+ for (int t = 0; t < 2; t++)
-+ {
-+ put16(w, 0xFFDB); put16(w, 67); put8(w, t);
-+ for (int i = 0; i < 64; i++) put8(w, w->q[t][i]);
-+ }
-+ put16(w, 0xFFC0); put16(w, 17); put8(w, 8); put16(w, height); put16(w, width); put8(w, 3);
-+ put8(w, 1); put8(w, 0x22); put8(w, 0);
-+ put8(w, 2); put8(w, 0x11); put8(w, 1);
-+ put8(w, 3); put8(w, 0x11); put8(w, 1);
-+ for (int t = 0; t < 2; t++)
-+ {
-+ int nd = 0, na = 0;
-+ for (int i = 0; i < 16; i++) { nd += dc_bits[t][i]; na += ac_bits[t][i]; }
-+ put16(w, 0xFFC4); put16(w, 2 + 17 + nd + 17 + na);
-+ put8(w, t);
-+ for (int i = 0; i < 16; i++) put8(w, dc_bits[t][i]);
-+ for (int i = 0; i < nd; i++) put8(w, dc_vals[i]);
-+ put8(w, 0x10 | t);
-+ for (int i = 0; i < 16; i++) put8(w, ac_bits[t][i]);
-+ for (int i = 0; i < na; i++) put8(w, ac_vals[t][i]);
-+ }
-+ put16(w, 0xFFDA); put16(w, 12); put8(w, 3);
-+ put8(w, 1); put8(w, 0x00); put8(w, 2); put8(w, 0x11); put8(w, 3); put8(w, 0x11);
-+ put8(w, 0); put8(w, 63); put8(w, 0);
-+
-+ /* the picture, 16 x 16 at a time: four luma blocks, then Cb and Cr
-+ * from the means of 2 x 2 pixels; the edges repeat the last pixel */
-+ int dc[3] = { 0, 0, 0 };
-+ int32_t blk[64], cb[64], cr[64];
-+ for (int my = 0; my < height; my += 16)
-+ for (int mx = 0; mx < width; mx += 16)
-+ {
-+ memset(cb, 0, sizeof(cb));
-+ memset(cr, 0, sizeof(cr));
-+ for (int b = 0; b < 4; b++)
-+ {
-+ int bx = mx + (b & 1) * 8, by = my + (b >> 1) * 8;
-+ for (int y = 0; y < 8; y++)
-+ {
-+ const uint8_t *row = rgb + (by + y < height ? by + y : height - 1) * stride;
-+ for (int x = 0; x < 8; x++)
-+ {
-+ const uint8_t *px = row + 3 * (bx + x < width ? bx + x : width - 1);
-+ int r = px[0], g = px[1], bl = px[2];
-+ blk[y * 8 + x] = ((19595 * r + 38470 * g + 7471 * bl + 32768) >> 16) - 128;
-+ int k = ((b >> 1) * 4 + (y >> 1)) * 8 + (b & 1) * 4 + (x >> 1);
-+ cb[k] += -11059 * r - 21709 * g + 32768 * bl;
-+ cr[k] += 32768 * r - 27439 * g - 5329 * bl;
-+ }
-+ }
-+ block(w, blk, 0, &dc[0]);
-+ }
-+ for (int i = 0; i < 64; i++) { cb[i] = (cb[i] + 131072) >> 18; cr[i] = (cr[i] + 131072) >> 18; }
-+ block(w, cb, 1, &dc[1]);
-+ block(w, cr, 1, &dc[2]);
-+ }
-+ if (w->nbits) put_bits(w, 0x7F, 8 - w->nbits); /* pad with ones */
-+ put16(w, 0xFFD9);
-+ flush(w);
-+ fos_port_close(w->f);
-+ int ok = w->ok;
-+ fos_port_free(w);
-+ return ok;
-+}
-diff --git a/src/fos_jpeg.h b/src/fos_jpeg.h
-new file mode 100644
-index 000000000..ae60ddb83
---- /dev/null
-+++ b/src/fos_jpeg.h
-@@ -0,0 +1,19 @@
-+#ifndef _fos_jpeg_h_
-+#define _fos_jpeg_h_
-+
-+#include <stdint.h>
-+
-+/* what goes into the JPEG's EXIF (any may be NULL) */
-+struct fos_jpeg_meta
-+{
-+ const char *when; /* "2026-10-22 17:45" */
-+ const char *desc; /* the film */
-+ const char *fstop; /* "2.8" */
-+};
-+
-+/* width x height RGB pixels (rows stride bytes apart) as a baseline JPEG
-+ * at path; quality 1..100. 1 when written. */
-+int fos_jpeg_write(const char *path, const uint8_t *rgb, int stride, int width, int height,
-+ int quality, const struct fos_jpeg_meta *meta);
-+
-+#endif
-diff --git a/src/fos_lab.c b/src/fos_lab.c
-new file mode 100644
-index 000000000..85cbb827d
---- /dev/null
-+++ b/src/fos_lab.c
-@@ -0,0 +1,424 @@
-+/* fos_lab: the rolls on the card and their prints, for the darkroom.
-+ *
-+ * A roll is what its logs say: DCIM/xxxCANON/ROLL_nnn.TXT, written by the
-+ * camera frame by frame (a roll that ran into a new DCIM folder has a log
-+ * in each). Its prints are kept in ML/DARKROOM/Rnnn/, Fnn.BMP for frame nn
-+ * and SHEET.BMP for the contact sheet; a roll is developed when they are
-+ * all there.
-+ */
-+
-+#include "fos.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+#include <stdlib.h>
-+
-+#define LOG_MAX (16 * 1024)
-+
-+void fos_lab_print_path(char *buf, int size, int roll, int frame)
-+{
-+ if (frame) snprintf(buf, size, "%sML/DARKROOM/R%03d/F%02d.BMP", fos_port_card(), roll, frame);
-+ else snprintf(buf, size, "%sML/DARKROOM/R%03d/SHEET.BMP", fos_port_card(), roll);
-+}
-+
-+void fos_lab_cache_dir(char *buf, int size)
-+{
-+ snprintf(buf, size, "%sML/DARKROOM", fos_port_card());
-+}
-+
-+static int first_only(void *ctx, const char *name, int is_dir) { return 0; }
-+
-+static int dir_exists(const char *path)
-+{
-+ return fos_port_list(path, first_only, 0) >= 0;
-+}
-+
-+/* a folder of ours: it holds the roll's tag file */
-+static int tagged(const char *dir, int roll)
-+{
-+ char path[128];
-+ snprintf(path, sizeof(path), "%s/ROLL%03d.TXT", dir, roll);
-+ void *f = fos_port_open(path, 0);
-+ if (f) fos_port_close(f);
-+ return f != 0;
-+}
-+
-+static int make_tagged(const char *dir, int roll, int film)
-+{
-+ if (fos_port_mkdir(dir) < 0) return 0;
-+ char path[128], text[96];
-+ snprintf(path, sizeof(path), "%s/ROLL%03d.TXT", dir, roll);
-+ void *f = fos_port_open(path, 1);
-+ if (!f) return 0;
-+ int n = snprintf(text, sizeof(text), "roll = %03d\nfilm = %s\n", roll, fos_films[film].key);
-+ fos_port_write(f, text, n);
-+ fos_port_close(f);
-+ return 1;
-+}
-+
-+int fos_lab_dcim_dir(char *buf, int size, int roll, int film, const char *when)
-+{
-+ static const char *const months[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-+ int m = when && strlen(when) >= 10 ? atoi(when + 5) : 0, d = m ? atoi(when + 8) : 0;
-+ if (m < 1 || m > 12 || d < 1 || d > 31) return -1;
-+ film = fos_clamp(film, 0, fos_nfilms - 1);
-+ const char *film_name = fos_films[film].shortname ? fos_films[film].shortname : fos_films[film].key;
-+ /* "Sep0906 Portra400", "Sep0906 Portra400 2" for another roll that day */
-+ for (int k = 1; k < 10; k++)
-+ {
-+ if (k == 1) snprintf(buf, size, "%sDCIM/%s%02d%02d %s", fos_port_card(), months[m - 1], m, d, film_name);
-+ else snprintf(buf, size, "%sDCIM/%s%02d%02d %s %d", fos_port_card(), months[m - 1], m, d, film_name, k);
-+ if (dir_exists(buf)) { if (tagged(buf, roll)) return 0; continue; }
-+ if (make_tagged(buf, roll, film) && dir_exists(buf)) return 0;
-+ break; /* no long names on this card */
-+ }
-+ /* SEP0906, SEP0906B, ... */
-+ char up[4] = { months[m - 1][0], (char) (months[m - 1][1] - 32), (char) (months[m - 1][2] - 32), 0 };
-+ for (int k = 0; k < 26; k++)
-+ {
-+ char suffix[2] = { (char) (k ? 'A' + k : 0), 0 };
-+ snprintf(buf, size, "%sDCIM/%s%02d%02d%s", fos_port_card(), up, m, d, suffix);
-+ if (dir_exists(buf)) { if (tagged(buf, roll)) return 0; continue; }
-+ if (make_tagged(buf, roll, film)) return 0;
-+ return -1;
-+ }
-+ return -1;
-+}
-+
-+int fos_lab_prepare(int roll)
-+{
-+ char path[64];
-+ snprintf(path, sizeof(path), "%sML/DARKROOM", fos_port_card());
-+ if (fos_port_mkdir(path)) return -1;
-+ snprintf(path, sizeof(path), "%sML/DARKROOM/R%03d", fos_port_card(), roll);
-+ return fos_port_mkdir(path);
-+}
-+
-+static int film_index(const char *key)
-+{
-+ for (int i = 0; i < fos_nfilms; i++)
-+ if (!strcmp(fos_films[i].key, key)) return i;
-+ return 0;
-+}
-+
-+/* ---------------------------------------------------------------- reading logs */
-+
-+/* one log, a line at a time: header lines ("film = portra400") and
-+ * frames ("12 IMG_0012.CR2 2026-08-08 09:15:15 f/2.8") */
-+struct log_reader
-+{
-+ void (*header)(void *ctx, const char *key, const char *value);
-+ void (*frame)(void *ctx, int no, const char *file, const char *when, const char *fstop);
-+ void *ctx;
-+};
-+
-+static void read_log(const char *path, const struct log_reader *r)
-+{
-+ char *buf = fos_port_alloc(LOG_MAX + 1);
-+ if (!buf) return;
-+ void *f = fos_port_open(path, 0);
-+ int n = f ? fos_port_read(f, buf, LOG_MAX) : 0;
-+ if (f) fos_port_close(f);
-+ if (n <= 0)
-+ {
-+ char msg[96];
-+ snprintf(msg, sizeof(msg), "lab: can't read %s (%s)", path, f ? "read failed" : "can't open");
-+ fos_port_log(msg);
-+ }
-+ buf[n > 0 ? n : 0] = 0;
-+ for (char *line = buf; *line; )
-+ {
-+ char *next = strchr(line, '\n');
-+ if (next) *next++ = 0;
-+ else next = line + strlen(line);
-+ char *cr = strchr(line, '\r');
-+ if (cr) *cr = 0;
-+ while (*line == ' ') line++;
-+ char *eq = strchr(line, '=');
-+ if (*line == '#' || !*line) { line = next; continue; }
-+ if (eq && !(line[0] >= '0' && line[0] <= '9'))
-+ {
-+ char *k = line, *v = eq + 1, *e = eq;
-+ while (e > k && e[-1] == ' ') e--;
-+ *e = 0;
-+ while (*v == ' ') v++;
-+ if (r->header) r->header(r->ctx, k, v);
-+ }
-+ else if (line[0] >= '0' && line[0] <= '9')
-+ {
-+ char *tok[5];
-+ int nt = 0;
-+ for (char *p = line; *p && nt < 5; )
-+ {
-+ while (*p == ' ' || *p == '\t') p++;
-+ if (!*p) break;
-+ tok[nt++] = p;
-+ while (*p && *p != ' ' && *p != '\t') p++;
-+ if (*p) *p++ = 0;
-+ }
-+ if (nt >= 2 && r->frame)
-+ {
-+ char when[20] = "";
-+ char hm[6];
-+ if (nt >= 4) snprintf(when, sizeof(when), "%s %s", tok[2], fos_copy(hm, sizeof(hm), tok[3], 5));
-+ r->frame(r->ctx, atoi(tok[0]), tok[1], when, nt >= 5 && !strncmp(tok[4], "f/", 2) ? tok[4] + 2 : "");
-+ }
-+ }
-+ line = next;
-+ }
-+ fos_port_free(buf);
-+}
-+
-+/* every ROLL_nnn.TXT on the card: fn(ctx, folder, file name, roll number) */
-+struct each_log { void (*fn)(void *ctx, const char *folder, const char *name, int number); void *ctx; const char *folder; };
-+
-+static int log_entry(void *ctx, const char *name, int is_dir)
-+{
-+ struct each_log *e = ctx;
-+ if (!is_dir && !strncmp(name, "ROLL_", 5) && strlen(name) == 12
-+ && (!strcmp(name + 8, ".TXT") || !strcmp(name + 8, ".txt")))
-+ e->fn(e->ctx, e->folder, name, atoi(name + 5));
-+ return 1;
-+}
-+
-+static int folder_entry(void *ctx, const char *name, int is_dir)
-+{
-+ struct each_log *e = ctx;
-+ /* DCIM folders: three digits and five characters, "100CANON" */
-+ if (!is_dir || strlen(name) != 8 || name[0] < '1' || name[0] > '9') return 1;
-+ char dir[64];
-+ snprintf(dir, sizeof(dir), "%sDCIM/%s", fos_port_card(), name);
-+ struct each_log sub = *e;
-+ sub.folder = name;
-+ fos_port_list(dir, log_entry, &sub);
-+ return 1;
-+}
-+
-+static void each_log(void (*fn)(void *, const char *, const char *, int), void *ctx)
-+{
-+ char dir[64];
-+ snprintf(dir, sizeof(dir), "%sDCIM", fos_port_card());
-+ struct each_log e = { fn, ctx, 0 };
-+ fos_port_list(dir, folder_entry, &e);
-+}
-+
-+/* ---------------------------------------------------------------- the catalogue */
-+
-+struct scan { struct fos_lab_roll *rolls; int n, max; struct fos_lab_roll *cur; };
-+
-+static void scan_header(void *ctx, const char *k, const char *v)
-+{
-+ struct fos_lab_roll *r = ((struct scan *) ctx)->cur;
-+ if (!strcmp(k, "film")) r->film = film_index(v);
-+ else if (!strcmp(k, "exposures")) r->exposures = atoi(v);
-+ else if (!strcmp(k, "loaded") && (!r->loaded[0] || strncmp(v, r->loaded, 16) < 0))
-+ fos_copy(r->loaded, sizeof(r->loaded), v, 16);
-+}
-+
-+static void scan_frame(void *ctx, int no, const char *file, const char *when, const char *fstop)
-+{
-+ struct fos_lab_roll *r = ((struct scan *) ctx)->cur;
-+ if (no > r->shot) r->shot = no;
-+ if (strcmp(when, r->last) > 0) snprintf(r->last, sizeof(r->last), "%s", when);
-+}
-+
-+static void scan_log(void *ctx, const char *folder, const char *name, int number)
-+{
-+ struct scan *s = ctx;
-+ struct fos_lab_roll *r = 0;
-+ for (int i = 0; i < s->n; i++)
-+ if (s->rolls[i].number == number) r = &s->rolls[i];
-+ if (!r)
-+ {
-+ if (s->n >= s->max) return;
-+ r = &s->rolls[s->n++];
-+ memset(r, 0, sizeof(*r));
-+ r->number = number;
-+ r->exposures = 36;
-+ }
-+ char path[64];
-+ snprintf(path, sizeof(path), "%sDCIM/%s/%s", fos_port_card(), folder, name);
-+ s->cur = r;
-+ struct log_reader rd = { scan_header, scan_frame, s };
-+ read_log(path, &rd);
-+}
-+
-+static int print_entry(void *ctx, const char *name, int is_dir)
-+{
-+ struct fos_lab_roll *r = ctx;
-+ if (is_dir) return 1;
-+ if (!strcmp(name, "SHEET.BMP")) r->sheet = 1;
-+ else if (name[0] == 'F' && strlen(name) == 7 && !strcmp(name + 3, ".BMP"))
-+ {
-+ int no = atoi(name + 1);
-+ if (no >= 1 && no <= r->shot) r->developed++;
-+ }
-+ return 1;
-+}
-+
-+/* our folders in DCIM (not Canon's "100CANON"): which roll each holds, by
-+ * its tag file, and how many JPEGs */
-+struct jpeg_scan { struct fos_lab_roll *rolls; int n; int roll, count; };
-+
-+static int jpeg_file(void *ctx, const char *name, int is_dir)
-+{
-+ struct jpeg_scan *s = ctx;
-+ int len = (int) strlen(name);
-+ if (is_dir) return 1;
-+ if (len == 11 && !strncmp(name, "ROLL", 4) && !strcmp(name + 7, ".TXT")) s->roll = atoi(name + 4);
-+ else if (len > 4 && !strcmp(name + len - 4, ".JPG")) s->count++;
-+ return 1;
-+}
-+
-+static int jpeg_folder(void *ctx, const char *name, int is_dir)
-+{
-+ struct jpeg_scan *s = ctx;
-+ if (!is_dir || (strlen(name) == 8 && name[0] >= '1' && name[0] <= '9')) return 1;
-+ char dir[128];
-+ snprintf(dir, sizeof(dir), "%sDCIM/%s", fos_port_card(), name);
-+ s->roll = -1;
-+ s->count = 0;
-+ fos_port_list(dir, jpeg_file, s);
-+ for (int i = 0; i < s->n; i++)
-+ if (s->rolls[i].number == s->roll) s->rolls[i].jpegs += s->count;
-+ return 1;
-+}
-+
-+int fos_lab_scan(struct fos_lab_roll *rolls, int max)
-+{
-+ struct scan s = { rolls, 0, max, 0 };
-+ each_log(scan_log, &s);
-+ struct fos_roll cam;
-+ fos_port_roll(&cam);
-+ for (int i = 0; i < s.n; i++)
-+ {
-+ struct fos_lab_roll *r = &rolls[i];
-+ char dir[64];
-+ snprintf(dir, sizeof(dir), "%sML/DARKROOM/R%03d", fos_port_card(), r->number);
-+ fos_port_list(dir, print_entry, r);
-+ r->in_camera = cam.loaded && cam.number == r->number;
-+ }
-+ char dcim[64];
-+ snprintf(dcim, sizeof(dcim), "%sDCIM", fos_port_card());
-+ struct jpeg_scan js = { rolls, s.n, -1, 0 };
-+ fos_port_list(dcim, jpeg_folder, &js);
-+ /* newest first */
-+ for (int i = 1; i < s.n; i++)
-+ for (int j = i; j > 0; j--)
-+ {
-+ struct fos_lab_roll *a = &rolls[j - 1], *b = &rolls[j];
-+ int c = strcmp(a->loaded, b->loaded);
-+ if (c > 0 || (c == 0 && a->number > b->number)) break;
-+ struct fos_lab_roll t = *a; *a = *b; *b = t;
-+ }
-+ return s.n;
-+}
-+
-+/* ---------------------------------------------------------------- one roll's frames */
-+
-+struct frames { struct fos_lab_frame *frames; int max, roll; const char *folder; };
-+
-+static void frames_frame(void *ctx, int no, const char *file, const char *when, const char *fstop)
-+{
-+ struct frames *s = ctx;
-+ if (no < 1 || no > s->max) return;
-+ struct fos_lab_frame *f = &s->frames[no - 1];
-+ f->no = no;
-+ snprintf(f->cr2, sizeof(f->cr2), "%sDCIM/%s/%s", fos_port_card(), s->folder, file);
-+ snprintf(f->when, sizeof(f->when), "%s", when);
-+ snprintf(f->fstop, sizeof(f->fstop), "%s", fstop);
-+}
-+
-+static void frames_log(void *ctx, const char *folder, const char *name, int number)
-+{
-+ struct frames *s = ctx;
-+ if (number != s->roll) return;
-+ char path[64];
-+ snprintf(path, sizeof(path), "%sDCIM/%s/%s", fos_port_card(), folder, name);
-+ s->folder = folder;
-+ struct log_reader rd = { 0, frames_frame, s };
-+ read_log(path, &rd);
-+}
-+
-+/* open a frame's file (path: ...DCIM/100CANON/IMG_0012.CR2), by Canon's
-+ * name for it if that isn't the log's. The log's name is Magic Lantern's file
-+ * prefix and the file number, and Canon's name can differ:
-+ * - in Adobe RGB the prefix's first letter is '_' (IMG_0012 -> _MG_0012,
-+ * and a user prefix ABCD0012 -> _BCD0012);
-+ * - on the 5D Mark III the prefix is the user one (C59A) even while the
-+ * camera names its files IMG_ or _MG_ (#31).
-+ * So, keeping the number: the first letter '_', then Canon's own two. The
-+ * name that opens stays in path; when none does, path is as it was. */
-+static void *open_frame_file(char *path)
-+{
-+ void *f = fos_port_open(path, 0);
-+ if (f) return f;
-+ char *base = strrchr(path, '/');
-+ base = base ? base + 1 : path;
-+ if (strlen(base) != 12 || base[8] != '.') return 0; /* PPPPnnnn.CR2 */
-+ char was[4];
-+ memcpy(was, base, 4);
-+ const char *try[3] = { was, "IMG_", "_MG_" };
-+ for (int k = 0; k < 3 && !f; k++)
-+ {
-+ memcpy(base, try[k], 4);
-+ if (!k) base[0] = '_';
-+ if (k && !memcmp(base, was, 4)) continue; /* tried already */
-+ f = fos_port_open(path, 0);
-+ }
-+ if (!f) memcpy(base, was, 4);
-+ return f;
-+}
-+
-+int fos_lab_frames(int roll, struct fos_lab_frame *frames, int max)
-+{
-+ memset(frames, 0, sizeof(*frames) * max);
-+ struct frames s = { frames, max, roll, 0 };
-+ each_log(frames_log, &s);
-+ int n = 0;
-+ for (int i = 0; i < max; i++)
-+ {
-+ if (frames[i].no) n = i + 1;
-+ else frames[i].no = i + 1;
-+ }
-+ /* a frame whose file has gone (deleted on the camera, or never a RAW)
-+ * can't be developed */
-+ char seen[4] = ""; /* the prefix of Canon's names on this roll */
-+ for (int i = 0; i < n; i++)
-+ {
-+ if (!frames[i].cr2[0]) { frames[i].missing = 1; continue; }
-+ void *f = open_frame_file(frames[i].cr2);
-+ if (f)
-+ {
-+ fos_port_close(f);
-+ const char *base = strrchr(frames[i].cr2, '/');
-+ base = base ? base + 1 : frames[i].cr2;
-+ if (!seen[0] && strlen(base) == 12) memcpy(seen, base, 4);
-+ continue;
-+ }
-+ frames[i].missing = 1;
-+ /* shot with Image quality set to a JPEG one: Canon's .JPG of the
-+ * same name is there instead, and the darkroom can say so */
-+ char *ext = strrchr(frames[i].cr2, '.');
-+ if (!ext || strcmp(ext, ".CR2")) continue;
-+ memcpy(ext, ".JPG", 4);
-+ f = open_frame_file(frames[i].cr2);
-+ if (f)
-+ {
-+ fos_port_close(f);
-+ frames[i].jpeg = 1; /* cr2 names the JPEG now */
-+ }
-+ else memcpy(ext, ".CR2", 4);
-+ }
-+ /* a file that isn't there by any name is called by the roll's other
-+ * names, as the camera would have named it: _MG_0012.CR2 in Adobe RGB,
-+ * not the log's IMG_0012.CR2 (#17) */
-+ for (int i = 0; i < n && seen[0]; i++)
-+ {
-+ if (!frames[i].missing || frames[i].jpeg || !frames[i].cr2[0]) continue;
-+ char *base = strrchr(frames[i].cr2, '/');
-+ base = base ? base + 1 : frames[i].cr2;
-+ if (strlen(base) == 12 && base[8] == '.') memcpy(base, seen, 4);
-+ }
-+ return n;
-+}
-diff --git a/src/fos_looks.c b/src/fos_looks.c
-new file mode 100644
-index 000000000..c041267ef
---- /dev/null
-+++ b/src/fos_looks.c
-@@ -0,0 +1,49 @@
-+/* fos_looks: the film looks the camera develops with.
-+ * Generated from films/films.py by tools/genlooks.py: edit those, not this. */
-+
-+#include "fos_dev.h"
-+
-+const struct fos_look fos_looks[] =
-+{
-+ { "portra400", 5500, 0, 0.3f, 0.85f,
-+ { 0.165f, 0.17f, 0.158f }, { -0.15f, 0.0f, 0.1f }, { 0.03f, 0.026f, 0.028f }, { 0.97f, 0.955f, 0.92f },
-+ 3, { { 1, 0, 0.06f, 1.05f }, { 3, 2, 0.12f, 0.85f }, { 5, 4, 0.08f, 0.85f } },
-+ 1.0f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.018f, 1.1f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "cinestill800t", 3200, 0, 0.0f, 0.95f,
-+ { 0.18f, 0.18f, 0.172f }, { -0.05f, 0.0f, -0.05f }, { 0.02f, 0.032f, 0.045f }, { 0.97f, 0.96f, 0.95f },
-+ 2, { { 4, 5, 0.1f, 1.0f }, { 0, 1, 0.08f, 1.05f } },
-+ 6.0f, 0.6f, { 1.0f, 0.28f, 0.06f }, 0.026f, 1.4f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "ektar100", 5500, 0, 0.0f, 1.25f,
-+ { 0.19f, 0.19f, 0.186f }, { -0.05f, 0.0f, 0.05f }, { 0.025f, 0.02f, 0.025f }, { 0.98f, 0.97f, 0.95f },
-+ 2, { { 0, 6, 0.05f, 1.1f }, { 5, 5, 0.0f, 1.15f } },
-+ 0.6f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.009f, 0.8f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "gold200", 5500, 0, 0.2f, 1.08f,
-+ { 0.185f, 0.18f, 0.168f }, { -0.25f, -0.05f, 0.2f }, { 0.035f, 0.028f, 0.022f }, { 0.98f, 0.95f, 0.86f },
-+ 2, { { 2, 1, 0.1f, 1.1f }, { 3, 2, 0.15f, 0.9f } },
-+ 1.0f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.016f, 1.1f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "superia400", 5500, 0, 0.1f, 1.05f,
-+ { 0.18f, 0.183f, 0.178f }, { 0.05f, -0.1f, 0.0f }, { 0.022f, 0.036f, 0.032f }, { 0.96f, 0.97f, 0.95f },
-+ 3, { { 3, 4, 0.18f, 1.05f }, { 0, 6, 0.06f, 1.0f }, { 2, 3, 0.06f, 0.95f } },
-+ 1.0f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.02f, 1.2f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "velvia50", 5500, 1, -0.3f, 1.45f,
-+ { 0.25f, 0.25f, 0.25f }, { 0.0f, 0.0f, -0.05f }, { 0.01f, 0.01f, 0.015f }, { 0.98f, 0.98f, 0.98f },
-+ 3, { { 3, 3, 0.0f, 1.15f }, { 5, 6, 0.06f, 1.15f }, { 0, 6, 0.06f, 1.1f } },
-+ 0.3f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.007f, 0.7f,
-+ 0, { 0.0f, 0.0f, 0.0f } },
-+ { "hp5", 5500, 0, 0.2f, 1.0f,
-+ { 0.175f, 0.175f, 0.175f }, { 0.0f, 0.0f, 0.0f }, { 0.03f, 0.03f, 0.03f }, { 0.96f, 0.96f, 0.96f },
-+ 0, { { 0 } },
-+ 0.4f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.028f, 1.3f,
-+ 1, { 0.3f, 0.6f, 0.1f } },
-+ { "trix400", 5500, 0, 0.0f, 1.0f,
-+ { 0.205f, 0.205f, 0.205f }, { 0.1f, 0.1f, 0.1f }, { 0.02f, 0.02f, 0.02f }, { 0.97f, 0.97f, 0.97f },
-+ 0, { { 0 } },
-+ 0.4f, 0.75f, { 1.0f, 0.28f, 0.06f }, 0.036f, 1.3f,
-+ 1, { 0.42f, 0.48f, 0.1f } },
-+};
-+const int fos_nlooks = sizeof(fos_looks) / sizeof(fos_looks[0]);
-diff --git a/src/fos_nodark.c b/src/fos_nodark.c
-new file mode 100644
-index 000000000..595b475b0
---- /dev/null
-+++ b/src/fos_nodark.c
-@@ -0,0 +1,61 @@
-+/* fos_nodark: the darkroom's place in a build that leaves it out.
-+ *
-+ * Some cameras can't spare the memory the in-camera darkroom takes at boot
-+ * (fos_dark.c, fos_dev.c, fos_lab.c, fos_looks.c, fos_jpeg.c: about 60 KB).
-+ * Built with build_fork.sh --no-darkroom, those are replaced by this: the
-+ * Darkroom and Prints screens say where the rolls are developed instead
-+ * (Darkrooms, on a computer). The shelf's samples still show (fos_print.c).
-+ */
-+
-+#include "fos_ui.h"
-+#include "fos_dev.h"
-+
-+#define ND_X 24
-+
-+static void nd_bake()
-+{
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("DARKROOM");
-+ fos_text(cv, &fos_font_lg, ND_X, 82, "Darkroom", C_TEXT, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, ND_X, 120, "This camera's M" T_DOT "FILM has no darkroom of its own,", C_TEXT2, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, ND_X, 144, "to leave the camera the memory it needs.", C_TEXT2, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, ND_X, 184, "Your rolls are on the card, every frame in RAW:", C_TEXT3, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, ND_X, 208, "develop them with Darkrooms on a computer.", C_ACCENT2, OPAQUE, 0);
-+ ui_to_bg(0);
-+}
-+
-+static void nd_draw()
-+{
-+ if (!ui_clobbered) return;
-+ ui_clobbered = 0;
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ ui_damage_all();
-+ static const struct hint h[] = { { "MENU", "Back" } };
-+ ui_hints(h, 1);
-+}
-+
-+static void nd_key(int k)
-+{
-+ if (k == FK_MENU || k == FK_SET || k == FK_PLAY) ui_go(SCR_HOME, 2, GO_POP);
-+}
-+
-+void dark_enter(int arg) { nd_bake(); }
-+void dark_free() {}
-+void dark_key(int k) { nd_key(k); }
-+int dark_update(int dt) { return 0; }
-+void dark_draw() { nd_draw(); }
-+
-+void dark_queue_clear() {}
-+void dark_queue_add(int roll) {}
-+void develop_enter(int arg) { nd_bake(); }
-+void develop_leave() {}
-+void develop_key(int k) { nd_key(k); }
-+int develop_update(int dt) { return 0; }
-+void develop_draw() { nd_draw(); }
-+
-+void prints_enter(int arg) { nd_bake(); }
-+void prints_leave() {}
-+void prints_key(int k) { nd_key(k); }
-+int prints_update(int dt) { return 0; }
-+void prints_draw() { nd_draw(); }
-diff --git a/src/fos_pages.c b/src/fos_pages.c
-new file mode 100644
-index 000000000..b8436dd81
---- /dev/null
-+++ b/src/fos_pages.c
-@@ -0,0 +1,1129 @@
-+/* fos_pages: home, the settings pages and the roll in the camera.
-+ *
-+ * Home is the film OS's main menu: the roll you are shooting on the left
-+ * (its canister slowly turning), the places you can go on the right. The
-+ * settings pages replace the Magic Lantern menu; every row is a toggle,
-+ * a choice or an action, and the highlight glides between rows.
-+ */
-+
-+#include "fos_ui.h"
-+#include <string.h>
-+#include <math.h>
-+
-+static float absf(float v) { return v < 0 ? -v : v; }
-+
-+static int roll_active()
-+{
-+ return ui_roll.loaded && ui_roll.shot < ui_roll.exposures;
-+}
-+
-+/* the highlight behind the selected row of a list */
-+static void row_highlight(int x, int w, float y, int h)
-+{
-+ int yi = (int) (y + 0.5f);
-+ fos_rrect(cv, x, yi, w, h, 12, FC(RAMP_GRAY, 27), OPAQUE);
-+ fos_rrect(cv, x, yi + 10, 3, h - 20, 1, C_ACCENT, OPAQUE);
-+}
-+
-+/* ---------------------------------------------------------------- the film card */
-+
-+#define CARD_X 24
-+#define CARD_Y 52
-+#define CARD_W 268
-+#define CARD_H 378
-+
-+#define CAN_FLOOR (CARD_Y + 210)
-+#define CAN_SCALE 186
-+
-+/* the canister in the card, turning slowly (a turn every 24 s) */
-+static void card_canister(int t_ms)
-+{
-+ if (!ui_roll.loaded) return;
-+ struct fos_can *c = ui_can(ui_roll.film);
-+ struct fos_can_pose p = { (CARD_X + CARD_W / 2) * 256, CAN_FLOOR, CAN_SCALE, 0, 256, 256, 70, 0 };
-+ p.rot = (int) ((int64_t) t_ms * 65536 / 24000);
-+ fos_can_draw(cv, c, &p);
-+}
-+
-+/* the box the turning canister lives in */
-+static void card_canister_box(int *x0, int *y0, int *x1, int *y1)
-+{
-+ int cx = CARD_X + CARD_W / 2;
-+ int w = fos_can_width(CAN_SCALE), h = fos_can_height(CAN_SCALE);
-+ *x0 = cx - w / 2 - 50; *x1 = cx + w / 2 + 56;
-+ *y0 = CAN_FLOOR - h - 4; *y1 = CAN_FLOOR + 34;
-+}
-+
-+/* the roll in the camera, everything but the canister: a counter and a
-+ * strip of frames */
-+static void film_card()
-+{
-+ fos_rrect(cv, CARD_X, CARD_Y, CARD_W, CARD_H, 18, FC(RAMP_GRAY, 15), OPAQUE);
-+ int cx = CARD_X + CARD_W / 2;
-+ char b[64];
-+ if (!ui_roll.loaded)
-+ {
-+ /* an empty chamber */
-+ fos_rrect_line(cv, cx - 40, CARD_Y + 60, 80, 132, 14, 2, FC(RAMP_GRAY, 48), OPAQUE);
-+ fos_text_c(cv, &fos_font_lg, cx, CARD_Y + 240, "No film", C_TEXT, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_sm, cx, CARD_Y + 266, "Load a roll to start shooting", C_TEXT3, OPAQUE, 0);
-+ return;
-+ }
-+
-+ fos_text_c(cv, &fos_font_xs, cx, CARD_Y + 26, "IN CAMERA", C_TEXT3, OPAQUE, 48);
-+ int y = CARD_Y + 250;
-+ snprintf(b, sizeof(b), "ROLL %03d", ui_roll.number);
-+ fos_text_c(cv, &fos_font_xs, cx, y, b, C_ACCENT, OPAQUE, 64);
-+ fos_text_c(cv, &fos_font_lg, cx, y + 30, fos_films[ui_roll.film].name, C_TEXT, OPAQUE, 0);
-+
-+ /* frames as a strip: shot ones lit */
-+ int n = ui_roll.exposures, shot = ui_roll.shot;
-+ int fw = n > 24 ? 5 : n > 12 ? 7 : 12, gap = 1;
-+ int sw = n * (fw + gap) - gap;
-+ int sx = cx - sw / 2, sy = y + 46;
-+ fos_rrect(cv, sx - 6, sy - 6, sw + 12, 24, 4, FC(RAMP_GRAY, 8), OPAQUE);
-+ for (int i = 0; i < n; i++)
-+ fos_fill(cv, sx + i * (fw + gap), sy, fw, 12, i < shot ? C_ACCENT2 : FC(RAMP_GRAY, 30));
-+ if (shot < n)
-+ fos_fill(cv, sx + shot * (fw + gap), sy, fw, 12, C_ACCENT);
-+ int left = n - shot;
-+ if (left > 0)
-+ snprintf(b, sizeof(b), "%d shot " T_DOT " %d left", shot, left);
-+ else
-+ snprintf(b, sizeof(b), ui_realistic() ? "End of roll " T_DOT " rewind to load" : "End of roll " T_DOT " ready to develop");
-+ fos_text_c(cv, &fos_font_sm, cx, sy + 36, b, left > 0 ? C_TEXT2 : C_RED, OPAQUE, 0);
-+}
-+
-+/* ---------------------------------------------------------------- home */
-+
-+enum { H_FILM, H_ROLL, H_DARK, H_FINDER, H_LENS, H_SYSTEM, H_COUNT };
-+
-+static int home_sel;
-+static struct spring home_hl;
-+static int home_t, home_spun;
-+static int home_spin; /* the canister's turn is due */
-+static int home_full = 1; /* next frame redraws everything */
-+static int home_list = 1; /* ... the list on the right */
-+
-+#define LIST_X 312
-+#define LIST_W 384
-+#define LIST_Y 56
-+#define ROW_H 64
-+
-+static void home_bake()
-+{
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("HOME");
-+ struct hint h[] = { { "^v", "Select" }, { "SET", "Open" }, { "PLAY", "Prints" }, { "MENU", "Back to camera" } };
-+ ui_hints(h, 4);
-+ film_card();
-+ ui_to_bg(0);
-+}
-+
-+void home_enter(int arg)
-+{
-+ fos_port_roll(&ui_roll);
-+ if (arg >= 0 && arg < H_COUNT) home_sel = arg;
-+ home_hl.x = home_sel; home_hl.v = 0;
-+ home_t = home_spun = 0;
-+ home_full = 1;
-+ if (ui_roll.loaded) ui_can(ui_roll.film);
-+ home_bake();
-+}
-+
-+static void home_open(int i)
-+{
-+ switch (i)
-+ {
-+ case H_FILM: ui_go(SCR_SHELF, 1, GO_PUSH); break;
-+ case H_ROLL: ui_go(SCR_ROLL, 0, GO_PUSH); break;
-+ case H_DARK: ui_go(SCR_DARK, 0, GO_PUSH); break;
-+ case H_FINDER: ui_go(SCR_PAGE, 0, GO_PUSH); break;
-+ case H_LENS: ui_go(SCR_PAGE, 1, GO_PUSH); break;
-+ case H_SYSTEM: ui_go(SCR_PAGE, 2, GO_PUSH); break;
-+ }
-+}
-+
-+void home_key(int k)
-+{
-+ switch (k)
-+ {
-+ case FK_UP: case FK_WHEEL_L:
-+ home_sel = (home_sel + H_COUNT - 1) % H_COUNT;
-+ break;
-+ case FK_DOWN: case FK_WHEEL_R:
-+ home_sel = (home_sel + 1) % H_COUNT;
-+ break;
-+ case FK_SET: case FK_RIGHT:
-+ home_open(home_sel);
-+ break;
-+ case FK_MENU: case FK_HOME:
-+ ui_leave();
-+ break;
-+ case FK_PLAY:
-+ ui_go(SCR_PRINTS, 0, GO_FADE);
-+ break;
-+ }
-+ home_list = 1;
-+ ui_damage(LIST_Y, LIST_Y + H_COUNT * ROW_H);
-+}
-+
-+int home_update(int dt)
-+{
-+ int moving = 0;
-+ home_t += dt;
-+ if (spring_step(&home_hl, home_sel, dt, 3.4f, 0.82f))
-+ {
-+ home_list = 1;
-+ ui_damage(LIST_Y, LIST_Y + H_COUNT * ROW_H);
-+ moving = 1;
-+ }
-+ /* the canister keeps turning, slowly enough that a dozen frames a
-+ * second of only its corner of the screen look smooth */
-+ if (ui_roll.loaded && home_t - home_spun >= 80)
-+ {
-+ int x0, y0, x1, y1;
-+ card_canister_box(&x0, &y0, &x1, &y1);
-+ home_spun = home_t;
-+ home_spin = 1;
-+ ui_damage(y0, y1);
-+ moving = 1;
-+ }
-+ return moving;
-+}
-+
-+static void home_row(int i, int y, int selected)
-+{
-+ static const char *titles[H_COUNT] = { "Film", "Roll", "Darkroom", "Viewfinder", "Lens", "System" };
-+ static const int icons[H_COUNT] = { ICON_FILM, ICON_ROLL, ICON_PRINTS, ICON_FINDER, ICON_LENS, ICON_SYSTEM };
-+ char sub[80];
-+ char ap[8];
-+ switch (i)
-+ {
-+ case H_FILM:
-+ snprintf(sub, sizeof(sub), "%s", roll_active() ? (ui_realistic() ? "Change film (rewinds this roll)" : "Change film (finishes this roll)") : "Choose a stock and load a roll");
-+ break;
-+ case H_ROLL:
-+ if (ui_roll.loaded)
-+ snprintf(sub, sizeof(sub), "Roll %03d " T_DOT " %d of %d", ui_roll.number, ui_roll.shot, ui_roll.exposures);
-+ else
-+ snprintf(sub, sizeof(sub), "No film in the camera");
-+ break;
-+ case H_DARK:
-+ snprintf(sub, sizeof(sub), "Develop your rolls " T_DOT " your prints");
-+ break;
-+ case H_FINDER:
-+ snprintf(sub, sizeof(sub), "HUD %s " T_DOT " wind %s", fos_port_get(FS_HUD) ? "on" : "off",
-+ fos_port_get(FS_WIND) == 0 ? "off" : fos_port_get(FS_WIND) == 1 ? "reminder" : "locks shutter");
-+ break;
-+ case H_LENS:
-+ fos_format_fstop(ap, sizeof(ap), fos_port_get(FS_FSTOP));
-+ if (fos_port_lens_manual())
-+ snprintf(sub, sizeof(sub), "Manual lens " T_DOT " f/%s", ap);
-+ else
-+ snprintf(sub, sizeof(sub), "%s", fos_port_lens_name());
-+ break;
-+ case H_SYSTEM:
-+ snprintf(sub, sizeof(sub), "%s mode " T_DOT " screen colour " T_DOT " Canon menu", ui_realistic() ? "Realistic" : "Basic");
-+ break;
-+ }
-+ int x = LIST_X + 20;
-+ fcol ic = selected ? C_ACCENT : C_TEXT3;
-+ ui_icon(icons[i], x + 14, y + ROW_H / 2, ic, OPAQUE);
-+ fos_text(cv, &fos_font_mdb, x + 46, y + 28, titles[i], selected ? C_TEXT : C_TEXT2, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, x + 46, y + 49, sub, C_TEXT3, OPAQUE, 0);
-+ fos_tri(cv, LIST_X + LIST_W - 22, y + ROW_H / 2, 8, 0, selected ? C_TEXT2 : FC(RAMP_GRAY, 60), OPAQUE);
-+}
-+
-+void home_draw()
-+{
-+ int x0, y0, x1, y1;
-+ card_canister_box(&x0, &y0, &x1, &y1);
-+ if (ui_clobbered) home_full = 1;
-+ if (!home_full)
-+ {
-+ /* the card and the list sit side by side: each is redrawn alone */
-+ struct fos_canvas save = *cv;
-+ if (home_spin)
-+ {
-+ home_spin = 0;
-+ ui_bg_restore(x0, y0, x1 - x0, y1 - y0);
-+ fos_clip(cv, x0, y0, x1, y1);
-+ card_canister(home_t);
-+ *cv = save;
-+ ui_damage(y0, y1);
-+ }
-+ if (home_list)
-+ {
-+ int ly1 = LIST_Y + H_COUNT * ROW_H;
-+ ui_bg_restore(LIST_X, LIST_Y, LIST_W, ly1 - LIST_Y);
-+ fos_clip(cv, LIST_X, LIST_Y, LIST_X + LIST_W, ly1);
-+ row_highlight(LIST_X, LIST_W, LIST_Y + home_hl.x * ROW_H, ROW_H);
-+ for (int i = 0; i < H_COUNT; i++)
-+ home_row(i, LIST_Y + i * ROW_H, i == home_sel);
-+ *cv = save;
-+ ui_damage(LIST_Y, ly1);
-+ home_list = 0;
-+ }
-+ return;
-+ }
-+ home_full = 0;
-+ home_list = 0;
-+ home_spin = 0;
-+ ui_clobbered = 0;
-+ ui_damage_all();
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ card_canister(home_t);
-+ row_highlight(LIST_X, LIST_W, LIST_Y + home_hl.x * ROW_H, ROW_H);
-+ for (int i = 0; i < H_COUNT; i++)
-+ home_row(i, LIST_Y + i * ROW_H, i == home_sel);
-+}
-+
-+/* ---------------------------------------------------------------- settings pages */
-+
-+enum { IT_TOGGLE, IT_CHOICE, IT_FSTOP, IT_ACTION, IT_INFO, IT_LEVEL, IT_PAGE };
-+
-+#define PAGE_SYSTEM 2
-+#define PAGE_SCREEN 3
-+#define SYS_SCREEN_ROW 3 /* where Screen colour sits in System */
-+#define ACT_SCR_RESET 100 /* handled here, not by the port */
-+
-+struct item
-+{
-+ const char *label;
-+ int kind;
-+ int setting; /* FS_*, or FA_* for actions */
-+ const char *const *choices;
-+ int n;
-+ const char *help;
-+};
-+
-+static const char *const wind_choices[] = { "Off", "Reminder", "Locks shutter" };
-+static const char *const apkey_choices[] = { "Dial in Av", "Up / Down", "Menu only" };
-+static const char *const start_choices[] = { "Off", "When no film", "Always" };
-+static const char *const mode_choices[] = { "Basic", "Realistic" };
-+static const char *const flip_choices[] = { "Auto", "Normal", "Upside down", "Mirrored" };
-+
-+static const struct item finder_items[] =
-+{
-+ { "Viewfinder HUD", IT_TOGGLE, FS_HUD, 0, 0, "Meter and LEDs over LiveView; on a DSLR, a top plate on the back screen too." },
-+ { "LEDs on half-press", IT_TOGGLE, FS_LEDS, 0, 0, "Like a real SLR: the readout lights only while metering." },
-+ { "Focusing screen", IT_TOGGLE, FS_FOCUS, 0, 0, "A split-image circle and microprism collar (decoration only)." },
-+ { "Wind lever", IT_CHOICE, FS_WIND, wind_choices, 3, "After each frame press SET to wind on. Locking is experimental." },
-+};
-+
-+static const struct item lens_items[] =
-+{
-+ { "Lens", IT_INFO, -1, 0, 0, "Adapted manual lenses report no aperture: set it here." },
-+ { "Aperture", IT_FSTOP, FS_FSTOP, 0, 0, "The f-stop on the lens ring. Shown in the HUD, logged for the lab." },
-+ { "Widest aperture", IT_FSTOP, FS_LENS_WIDE, 0, 0, "Your manual lens' widest f-stop: the ring stops there." },
-+ { "Aperture control", IT_CHOICE, FS_APKEYS, apkey_choices, 3, "How to turn the aperture ring in LiveView." },
-+};
-+
-+static const struct item system_items[] =
-+{
-+ { "Film mode", IT_CHOICE, FS_MODE, mode_choices, 2, "Basic: a finished roll goes straight to the darkroom. Realistic: rewind it first." },
-+ { "Start screen", IT_CHOICE, FS_STARTUP, start_choices, 3, "The film shelf when the camera turns on." },
-+ { "Boot animation", IT_TOGGLE, FS_BOOTANIM, 0, 0, "The aperture opening on the name at power on." },
-+ { "Screen colour", IT_PAGE, PAGE_SCREEN, 0, 0, "Match these colours to what you see around you." },
-+ { "Screen orientation", IT_CHOICE, FS_SCR_FLIP, flip_choices, 4, "Auto follows the hinge. Set one if the screen shows the wrong way round." },
-+ { "PLAY shows prints only", IT_TOGGLE, FS_PLAYLOCK, 0, 0, "Canon's playback would show frames the darkroom hasn't developed." },
-+ { "Re-apply film settings", IT_ACTION, FA_REAPPLY, 0, 0, "After changing picture style, white balance or ISO by hand." },
-+ { "Canon menu", IT_ACTION, FA_CANON_MENU, 0, 0, "Leave and open the camera's own menu (format card, RAW...)." },
-+ { "Debug log", IT_TOGGLE, FS_DEBUG, 0, 0, "Writes ML/FILMROLL.LOG for troubleshooting." },
-+ { "Support " FOS_NAME, IT_INFO, -3, 0, 0, "Scan the code with your phone to buy the developer a coffee." },
-+ { "About", IT_INFO, -2, 0, 0, FOS_NAME " " T_DOT " Barlow typeface by Jeremy Tribby (SIL OFL)" },
-+};
-+
-+static const char *const std_choices[] = { "Canon", "Rec.709" };
-+
-+static const struct item screen_items[] =
-+{
-+ { "Conversion", IT_CHOICE, FS_SCR_STD, std_choices, 2, "How colours are sent to the screen. Canon's way suits the EOS M." },
-+ { "Colour", IT_LEVEL, FS_SCR_SAT, 0, 0, "Less or more saturated." },
-+ { "Warmth", IT_LEVEL, FS_SCR_WARM, 0, 0, "Towards blue or towards amber, white included." },
-+ { "Brightness", IT_LEVEL, FS_SCR_BRIGHT, 0, 0, "Deeper or lighter mid tones; black and white stay." },
-+ { "Reset", IT_ACTION, ACT_SCR_RESET, 0, 0, "Back to the colours as designed." },
-+};
-+
-+#define NITEMS(a) ((int) (sizeof(a) / sizeof((a)[0])))
-+
-+static struct { const char *title; const char *sub; const struct item *items; int n; } pages[] =
-+{
-+ { "Viewfinder", "What you see in LiveView while you shoot", finder_items, 4 },
-+ { "Lens", "Aperture for manual lenses", lens_items, 4 },
-+ { "System", "Film mode, screen colour, start up and the Canon menu", system_items, NITEMS(system_items) },
-+ { "Screen colour", "Live: the whole film OS changes as you go", screen_items, 5 },
-+};
-+
-+static int page, page_sel, page_top;
-+#define P_KNOBS 12 /* one per row: more rows than any page has */
-+static struct spring page_hl, page_scroll, knob[P_KNOBS];
-+
-+/* The System page without what this camera can't do (the port answers -1
-+ * for it: screen orientation on a fixed screen), worked out once. */
-+static struct item system_here[NITEMS(system_items)];
-+
-+static void pages_fit()
-+{
-+ static int done = 0;
-+ if (done) return;
-+ done = 1;
-+ int n = 0;
-+ for (int i = 0; i < NITEMS(system_items); i++)
-+ {
-+ const struct item *it = &system_items[i];
-+ if (it->kind == IT_CHOICE && fos_port_get(it->setting) < 0) continue;
-+ system_here[n++] = *it;
-+ }
-+ pages[PAGE_SYSTEM].items = system_here;
-+ pages[PAGE_SYSTEM].n = n;
-+}
-+static int help_fade; /* ms since the selection changed */
-+
-+#define P_LIST_Y 118
-+#define P_ROW_H 46
-+#define P_ROWS 6
-+#define P_X 24
-+#define P_W 404
-+
-+/* the preview panel beside the list */
-+#define PV_X 444
-+#define PV_Y P_LIST_Y
-+#define PV_W 252
-+#define PV_H (P_ROWS * P_ROW_H)
-+
-+static struct spring lens_open; /* the aperture in the lens preview, 0..1 */
-+
-+/* what the next frame redraws */
-+enum { D_LIST = 1, D_PREV = 2, D_HELP = 4, D_ALL = 8 };
-+static int pg_dirty = D_ALL;
-+#define LIST_RECT_Y0 (P_LIST_Y - 4)
-+#define LIST_RECT_Y1 (P_LIST_Y + P_ROWS * P_ROW_H + 16)
-+#define HELP_RECT_Y0 (HINTS_Y - 32)
-+
-+/* how open the blades look for fos_fstops[index]: a stop closes the
-+ * opening by a constant factor, slower than real so f/16 still shows */
-+static float fstop_open(int index)
-+{
-+ float stops = (index - 1) / 3.0f;
-+ return 0.94f * expf(-0.30f * stops);
-+}
-+
-+static void page_bake()
-+{
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("SETTINGS");
-+ fos_text(cv, &fos_font_lg, P_X + 4, 80, pages[page].title, C_TEXT, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, P_X + 4, 104, pages[page].sub, C_TEXT3, OPAQUE, 0);
-+ struct hint h[] = { { "^v", "Select" }, { "<>", "Change" }, { "SET", "Toggle" }, { "MENU", "Back" } };
-+ struct hint hs[] = { { "^v", "Select" }, { "<>", "Adjust" }, { "MENU", "Back" } };
-+ if (page == PAGE_SCREEN) ui_hints(hs, 3);
-+ else ui_hints(h, 4);
-+ fos_rrect(cv, PV_X, PV_Y, PV_W, PV_H, 16, FC(RAMP_GRAY, 15), OPAQUE);
-+ static const char *captions[] = { "LIVEVIEW PREVIEW", "APERTURE", 0, "TEST CHART" };
-+ if (captions[page]) /* System's panel captions itself */
-+ fos_text_c(cv, &fos_font_xs, PV_X + PV_W / 2, PV_Y + PV_H - 14, captions[page], C_TEXT3, OPAQUE, 48);
-+ ui_to_bg(0);
-+}
-+
-+static int item_value(const struct item *it)
-+{
-+ return it->setting >= 0 && it->kind != IT_ACTION && it->kind != IT_PAGE ? fos_port_get(it->setting) : 0;
-+}
-+
-+/* where an item's knob springs to: a switch 0 / 1, a slider its value */
-+static float knob_target(const struct item *it)
-+{
-+ if (it->kind == IT_LEVEL) return item_value(it);
-+ return it->kind == IT_TOGGLE && item_value(it) ? 1 : 0;
-+}
-+
-+void page_enter(int arg)
-+{
-+ pages_fit();
-+ /* from home: a page; between pages: page | row << 4 */
-+ if (ui_from() == SCR_HOME || ui_from() == SCR_PAGE)
-+ {
-+ page = fos_clamp(arg & 15, 0, PAGE_SCREEN);
-+ page_sel = fos_clamp(arg >> 4, 0, pages[page].n - 1);
-+ }
-+ page_top = page_sel >= P_ROWS ? page_sel - P_ROWS + 1 : 0;
-+ page_hl.x = page_sel; page_hl.v = 0;
-+ page_scroll.x = page_top; page_scroll.v = 0;
-+ for (int i = 0; i < pages[page].n && i < P_KNOBS; i++)
-+ {
-+ knob[i].x = knob_target(&pages[page].items[i]);
-+ knob[i].v = 0;
-+ }
-+ help_fade = 1000;
-+ lens_open.x = fstop_open(fos_port_get(FS_FSTOP)); lens_open.v = 0;
-+ pg_dirty = D_ALL;
-+ page_bake();
-+}
-+
-+static void change(const struct item *it, int dir)
-+{
-+ int v = fos_port_get(it->setting);
-+ switch (it->kind)
-+ {
-+ case IT_TOGGLE:
-+ fos_port_set(it->setting, !v);
-+ break;
-+ case IT_CHOICE:
-+ fos_port_set(it->setting, fos_clamp(v + dir, 0, it->n - 1));
-+ break;
-+ case IT_LEVEL:
-+ fos_port_set(it->setting, fos_clamp(v + dir, -FOS_SCR_STEPS, FOS_SCR_STEPS));
-+ break;
-+ case IT_FSTOP:
-+ {
-+ int lo = it->setting == FS_FSTOP ? fos_port_get(FS_LENS_WIDE) : 0;
-+ fos_port_set(it->setting, fos_clamp(v + dir, lo, fos_nfstops - 1));
-+ if (it->setting == FS_LENS_WIDE && fos_port_get(FS_FSTOP) < fos_port_get(FS_LENS_WIDE))
-+ fos_port_set(FS_FSTOP, fos_port_get(FS_LENS_WIDE));
-+ break;
-+ }
-+ }
-+}
-+
-+static void page_damage(int what)
-+{
-+ pg_dirty |= what;
-+ if (what & D_ALL) ui_damage_all();
-+ if (what & (D_LIST | D_PREV)) ui_damage(LIST_RECT_Y0, LIST_RECT_Y1);
-+ if (what & D_HELP) ui_damage(HELP_RECT_Y0, HINTS_Y);
-+}
-+
-+void page_key(int k)
-+{
-+ const struct item *items = pages[page].items;
-+ int n = pages[page].n;
-+ const struct item *it = &items[page_sel];
-+ /* moving the selection redraws the list and the help (and the lens,
-+ * which shows the selected f-stop); changing a value, list and preview */
-+ int dirty = k == FK_UP || k == FK_DOWN || k == FK_WHEEL_L || k == FK_WHEEL_R
-+ ? D_LIST | D_HELP | (page == 1 || page == PAGE_SYSTEM ? D_PREV : 0)
-+ : k == FK_LEFT || k == FK_RIGHT || k == FK_SET ? D_LIST | D_PREV : D_ALL;
-+ switch (k)
-+ {
-+ case FK_UP: case FK_WHEEL_L:
-+ if (page_sel > 0) { page_sel--; help_fade = 0; }
-+ break;
-+ case FK_DOWN: case FK_WHEEL_R:
-+ if (page_sel < n - 1) { page_sel++; help_fade = 0; }
-+ break;
-+ case FK_LEFT: case FK_RIGHT:
-+ if (it->kind == IT_TOGGLE) change(it, 0);
-+ else if (it->kind == IT_CHOICE || it->kind == IT_FSTOP || it->kind == IT_LEVEL)
-+ change(it, k == FK_RIGHT ? 1 : -1);
-+ else if (it->kind == IT_PAGE && k == FK_RIGHT)
-+ ui_go(SCR_PAGE, it->setting, GO_PUSH);
-+ break;
-+ case FK_SET:
-+ if (it->kind == IT_TOGGLE) change(it, 0);
-+ else if (it->kind == IT_CHOICE)
-+ fos_port_set(it->setting, (fos_port_get(it->setting) + 1) % it->n);
-+ else if (it->kind == IT_FSTOP) change(it, 1);
-+ else if (it->kind == IT_PAGE) ui_go(SCR_PAGE, it->setting, GO_PUSH);
-+ else if (it->kind == IT_ACTION && it->setting == ACT_SCR_RESET)
-+ {
-+ fos_port_set(FS_SCR_STD, 0);
-+ fos_port_set(FS_SCR_SAT, 0);
-+ fos_port_set(FS_SCR_WARM, 0);
-+ fos_port_set(FS_SCR_BRIGHT, 0);
-+ ui_toast("Screen colour as designed");
-+ }
-+ else if (it->kind == IT_ACTION)
-+ {
-+ fos_port_action(it->setting, 0, 0);
-+ if (it->setting == FA_CANON_MENU) ui_leave();
-+ if (it->setting == FA_REAPPLY)
-+ ui_toast(ui_roll.loaded ? "Film settings go in when you return to the camera" : "No film loaded");
-+ }
-+ break;
-+ case FK_MENU:
-+ if (page == PAGE_SCREEN) ui_go(SCR_PAGE, PAGE_SYSTEM | SYS_SCREEN_ROW << 4, GO_POP);
-+ else ui_go(SCR_HOME, page + H_FINDER, GO_POP);
-+ break;
-+ case FK_HOME: case FK_PLAY:
-+ ui_leave();
-+ break;
-+ }
-+ if (page_sel < page_top) page_top = page_sel;
-+ if (page_sel >= page_top + P_ROWS) page_top = page_sel - P_ROWS + 1;
-+ page_damage(dirty);
-+}
-+
-+int page_update(int dt)
-+{
-+ int dirty = 0;
-+ if (spring_step(&page_hl, page_sel, dt, 3.6f, 0.82f)) dirty |= D_LIST;
-+ if (spring_step(&page_scroll, page_top, dt, 3.0f, 0.95f)) dirty |= D_LIST;
-+ for (int i = 0; i < pages[page].n && i < P_KNOBS; i++)
-+ if (spring_step(&knob[i], knob_target(&pages[page].items[i]), dt, 4.0f, 0.75f))
-+ dirty |= D_LIST | (page == 0 ? D_PREV : 0); /* the viewfinder preview follows the switches */
-+ if (help_fade < 400) { help_fade += dt; dirty |= D_HELP; }
-+ if (page == 1)
-+ {
-+ const struct item *it = &pages[page].items[page_sel];
-+ int idx = it->setting == FS_LENS_WIDE ? fos_port_get(FS_LENS_WIDE) : fos_port_get(FS_FSTOP);
-+ if (spring_step(&lens_open, fstop_open(idx), dt, 2.6f, 0.72f)) dirty |= D_PREV;
-+ }
-+ page_damage(dirty);
-+ return dirty != 0;
-+}
-+
-+/* ---- the previews */
-+
-+/* a dusk scene through the viewfinder, with the HUD as set */
-+static void preview_finder()
-+{
-+ int sx = PV_X + 12, sy = PV_Y + 14, sw = PV_W - 24, sh = 152;
-+ int horizon = sy + sh * 64 / 100;
-+ fos_vgrad(cv, sx, sy, sw, horizon - sy, RAMP_AMBER, LV12(64), LV12(178));
-+ fos_vgrad(cv, sx, horizon, sw, sy + sh - horizon, RAMP_GRAY, LV12(16), LV12(8));
-+ fos_disc(cv, (sx + 74) * 256, (horizon - 26) * 256, 24 * 256, FC(RAMP_AMBER, 214), 110);
-+ fos_disc(cv, (sx + 74) * 256, (horizon - 26) * 256, 15 * 256, FC(RAMP_GRAY, 246), OPAQUE);
-+ /* hills */
-+ int hills[][6] = {
-+ { sx - 20, horizon + 8, sx + 70, horizon - 16, sx + 150, horizon + 8 },
-+ { sx + 90, horizon + 8, sx + 170, horizon - 28, sx + sw + 30, horizon + 8 },
-+ };
-+ for (int i = 0; i < 2; i++)
-+ {
-+ int q[6];
-+ for (int j = 0; j < 6; j++) q[j] = hills[i][j] * 256;
-+ fos_convex(cv, q, 3, FC(RAMP_GRAY, 12), OPAQUE);
-+ }
-+ fos_fill(cv, sx, horizon + 8, sw, sy + sh - horizon - 8, FC(RAMP_GRAY, 12));
-+
-+ float hud = knob[0].x, leds_half = knob[1].x, focus = knob[2].x;
-+ int wind = fos_port_get(FS_WIND);
-+ if (focus > 0.01f)
-+ {
-+ int cx = (sx + (sw - 20) / 2) * 256, cy = (sy + (sh - 14) / 2) * 256;
-+ fos_ring(cv, cx, cy, 21 * 256, 256, FC(RAMP_GRAY, 210), (int) (focus * 150));
-+ fos_ring(cv, cx, cy, 9 * 256, 300, FC(RAMP_GRAY, 250), (int) (focus * 230));
-+ fos_line(cv, cx - 9 * 256, cy, cx + 9 * 256, cy, 300, FC(RAMP_GRAY, 250), (int) (focus * 230));
-+ }
-+ if (hud > 0.01f)
-+ {
-+ int a = (int) (hud * 256);
-+ /* meter strip and LED strip, as on the camera but small */
-+ fos_blend(cv, sx + sw - 20, sy, 20, sh - 14, FC(RAMP_GRAY, 0), a);
-+ fos_blend(cv, sx, sy + sh - 14, sw, 14, FC(RAMP_GRAY, 0), a);
-+ for (int i = 0; i < 10; i++)
-+ fos_fill(cv, sx + sw - 12, sy + 8 + i * 12, 5, 1, FC(RAMP_GRAY, 120 * a / 256));
-+ fos_tri(cv, sx + sw - 16, sy + 8 + 5 * 12, 6, 0, FC(RAMP_RED, 150), a);
-+ int lit = (int) (150 - leds_half * 100);
-+ fos_text(cv, &fos_font_xs, sx + 50, sy + sh - 3, "125 f4 12", FC(RAMP_RED, lit), a, 16);
-+ if (wind)
-+ fos_text(cv, &fos_font_xs, sx + 6, sy + sh - 3, "WIND", FC(RAMP_RED, 150), a, 16);
-+ }
-+ /* what that means */
-+ const char *l1 = !fos_port_get(FS_HUD) ? "Canon's own screen only" :
-+ fos_port_get(FS_LEDS) ? "LEDs light on half-press" : "LEDs always lit";
-+ const char *l2 = wind == 0 ? "No wind lever" : wind == 1 ? "SET winds on after each frame" : "Shutter locked until you wind";
-+ fos_text_c(cv, &fos_font_sm, PV_X + PV_W / 2, sy + sh + 32, l1, C_TEXT2, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_sm, PV_X + PV_W / 2, sy + sh + 54, l2, C_TEXT3, OPAQUE, 0);
-+}
-+
-+static void preview_lens()
-+{
-+ int cx = PV_X + PV_W / 2, cy = PV_Y + 90;
-+ int open = (int) (clampf(lens_open.x, 0.02f, 1) * 4096);
-+ ui_aperture(cx, cy, 68, open, 3000 + (4096 - open) * 3);
-+ const struct item *it = &pages[page].items[page_sel];
-+ int idx = it->setting == FS_LENS_WIDE ? fos_port_get(FS_LENS_WIDE) : fos_port_get(FS_FSTOP);
-+ char ap[8], b[24];
-+ fos_format_fstop(ap, sizeof(ap), idx);
-+ snprintf(b, sizeof(b), "f/%s", ap);
-+ fos_text_c(cv, &fos_font_xl, cx, cy + 126, b, C_TEXT, OPAQUE, 0);
-+ if (it->setting == FS_LENS_WIDE)
-+ snprintf(b, sizeof(b), "WIDEST THE LENS OPENS");
-+ else
-+ snprintf(b, sizeof(b), "SET ON THE RING");
-+ fos_text_c(cv, &fos_font_xs, cx, cy + 148, b, C_ACCENT2, OPAQUE, 32);
-+}
-+
-+/* swatches of the labels' inks and a grey wedge: compare with the boxes */
-+static void preview_chart()
-+{
-+ static const struct { int ramp, level; const char *name; } inks[8] =
-+ {
-+ { RAMP_AMBER, 190, "GOLD" }, { RAMP_RED, 150, "RED" }, { RAMP_ORANGE, 160, "PORTRA" }, { RAMP_CRIMSON, 128, "EKTAR" },
-+ { RAMP_GREEN, 140, "FUJI" }, { RAMP_VIOLET, 118, "VELVIA" }, { RAMP_BLUE, 160, "ILFORD" }, { RAMP_LEADER, 120, "FILM" },
-+ };
-+ int x0 = PV_X + 14, y0 = PV_Y + 16, sw = 50, gap = 6;
-+ for (int i = 0; i < 8; i++)
-+ {
-+ int x = x0 + (i % 4) * (sw + gap), y = y0 + (i / 4) * 74;
-+ fos_rrect(cv, x, y, sw, 44, 8, FC(inks[i].ramp, inks[i].level), OPAQUE);
-+ fos_text_c(cv, &fos_font_xs, x + sw / 2, y + 60, inks[i].name, C_TEXT3, OPAQUE, 16);
-+ }
-+ /* eleven steps from black to white: the darkest two should still differ */
-+ int wy = y0 + 160, ww = PV_W - 28;
-+ for (int i = 0; i < 11; i++)
-+ {
-+ int xa = x0 + i * ww / 11, xb = x0 + (i + 1) * ww / 11;
-+ fos_fill(cv, xa, wy, xb - xa, 36, FC(RAMP_GRAY, i * 255 / 10));
-+ }
-+ fos_rrect_line(cv, x0 - 1, wy - 1, ww + 2, 38, 2, 1, FC(RAMP_GRAY, 60), OPAQUE);
-+ fos_text(cv, &fos_font_xs, x0, wy + 54, "0", C_TEXT3, OPAQUE, 0);
-+ fos_text_r(cv, &fos_font_xs, x0 + ww, wy + 54, "100%", C_TEXT3, OPAQUE, 0);
-+}
-+
-+/* the donation links as QR codes (ML/DATA/FOSQR.BIN, see tools/genqr.py),
-+ * read the first time they are shown */
-+struct qr { char label[48], url[80]; int n; const uint8_t *bits; };
-+static struct qr qrs[2];
-+static int nqr = -1;
-+
-+static void qr_load()
-+{
-+ char path[64];
-+ snprintf(path, sizeof(path), "%sML/DATA/FOSQR.BIN", fos_port_card());
-+ nqr = 0;
-+ void *f = fos_port_open(path, 0);
-+ if (!f) return;
-+ static uint8_t blob[1024];
-+ int size = fos_port_read(f, blob, sizeof(blob));
-+ fos_port_close(f);
-+ if (size < 8 || memcmp(blob, "FOSQ", 4)) return;
-+ int n = blob[4], p = 8;
-+ for (int i = 0; i < n && i < 2; i++)
-+ {
-+ if (p + 132 > size) break;
-+ struct qr *q = &qrs[nqr];
-+ memcpy(q->label, blob + p, 48); q->label[47] = 0;
-+ memcpy(q->url, blob + p + 48, 80); q->url[79] = 0;
-+ q->n = blob[p + 128] | blob[p + 129] << 8;
-+ q->bits = blob + p + 132;
-+ p += 132 + (q->n * q->n + 7) / 8;
-+ if (q->n < 21 || q->n > 61 || p > size) break;
-+ nqr++;
-+ }
-+}
-+
-+/* a code centred on (cx, cy), its label at base */
-+static void draw_qr(const struct qr *q, int cx, int cy, int mod, int base)
-+{
-+ int quiet = 2, side = (q->n + 2 * quiet) * mod, x0 = cx - side / 2, y = cy - side / 2;
-+ fos_fill(cv, x0, y, side, side, FC(RAMP_GRAY, 245));
-+ for (int r = 0; r < q->n; r++)
-+ for (int c = 0; c < q->n; c++)
-+ {
-+ int i = r * q->n + c;
-+ if (q->bits[i >> 3] >> (7 - (i & 7)) & 1)
-+ fos_fill(cv, x0 + (quiet + c) * mod, y + (quiet + r) * mod, mod, mod, FC(RAMP_GRAY, 8));
-+ }
-+ const struct fos_font *f = fos_text_w(&fos_font_mdb, q->label, 0) <= PV_W - 24 ? &fos_font_mdb : &fos_font_sm;
-+ fos_text_c(cv, f, cx, base, q->label, C_TEXT, OPAQUE, 0);
-+}
-+
-+static void preview_support()
-+{
-+ int cx = PV_X + PV_W / 2;
-+ if (nqr < 0) qr_load();
-+ if (nqr == 0)
-+ {
-+ ui_aperture(cx, PV_Y + 80, 40, 1700, 5000);
-+ fos_text_c(cv, &fos_font_lg, cx, PV_Y + 162, "Thank you", C_TEXT, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_sm, cx, PV_Y + 186, "for shooting film with " FOS_NAME, C_TEXT2, OPAQUE, 0);
-+ }
-+ else if (nqr == 1)
-+ draw_qr(&qrs[0], cx, PV_Y + 116, 200 / (qrs[0].n + 4), PV_Y + 238);
-+ else
-+ for (int i = 0; i < 2; i++)
-+ draw_qr(&qrs[i], cx + (i ? 62 : -62), PV_Y + 116, 112 / (qrs[i].n + 4), PV_Y + 190);
-+ fos_text_c(cv, &fos_font_xs, cx, PV_Y + PV_H - 14, "SUPPORT", C_TEXT3, OPAQUE, 48);
-+}
-+
-+static void preview_about()
-+{
-+ int cx = PV_X + PV_W / 2;
-+ fos_text_c(cv, &fos_font_xs, cx, PV_Y + PV_H - 14, "ABOUT", C_TEXT3, OPAQUE, 48);
-+ ui_aperture(cx, PV_Y + 64, 40, 1700, 5000);
-+ fos_text_c(cv, &fos_font_lg, cx, PV_Y + 142, FOS_NAME, C_TEXT, OPAQUE, 64);
-+ char m[48];
-+ snprintf(m, sizeof(m), "Film OS for the %s", fos_port_model());
-+ fos_text_c(cv, &fos_font_sm, cx, PV_Y + 166, m, C_TEXT2, OPAQUE, 0);
-+ char b[48];
-+ snprintf(b, sizeof(b), "VERSION %s " T_DOT " %s", fos_port_version(), __DATE__);
-+ fos_text_c(cv, &fos_font_xs, cx, PV_Y + 196, b, C_TEXT3, OPAQUE, 24);
-+ fos_text_c(cv, &fos_font_xs, cx, PV_Y + 214, "MAGIC LANTERN INSIDE", C_TEXT3, OPAQUE, 24);
-+ fos_text_c(cv, &fos_font_xs, cx, PV_Y + 232, "BARLOW TYPEFACE " T_DOT " SIL OFL", C_TEXT3, OPAQUE, 24);
-+}
-+
-+/* an on / off switch; k = 0..1 where the knob is */
-+static void toggle_switch(int rx, int cy, float k)
-+{
-+ int w = 44, h = 24;
-+ int x = rx - w, y = cy - h / 2;
-+ int on_lv = (int) (k * 186);
-+ fos_rrect(cv, x, y, w, h, h / 2, k > 0.5f ? FC(RAMP_AMBER, 40 + on_lv * 146 / 186) : FC(RAMP_GRAY, 40 + (int) ((1 - k) * 12)), OPAQUE);
-+ int kx = x + 12 + (int) (k * (w - 24));
-+ fos_disc(cv, kx * 256, cy * 256, 9 * 256, FC(RAMP_GRAY, 244), OPAQUE);
-+}
-+
-+/* a -6..6 slider ending at rx: notches, a knob at k, the value beside it */
-+static void level_slider(int rx, int cy, float k, int value, int selected)
-+{
-+ int w = 150, x0 = rx - w;
-+ fos_fill(cv, x0, cy, w, 2, FC(RAMP_GRAY, 40));
-+ for (int i = -FOS_SCR_STEPS; i <= FOS_SCR_STEPS; i++)
-+ {
-+ int x = x0 + (i + FOS_SCR_STEPS) * w / (2 * FOS_SCR_STEPS);
-+ int big = i == 0;
-+ fos_fill(cv, x, cy - (big ? 6 : 3), 1, big ? 13 : 7, FC(RAMP_GRAY, big ? 120 : 60));
-+ }
-+ /* from the middle to the knob, lit */
-+ int kx = x0 + (int) ((k + FOS_SCR_STEPS) * w / (2 * FOS_SCR_STEPS));
-+ int mid = x0 + w / 2;
-+ if (kx != mid)
-+ fos_fill(cv, kx < mid ? kx : mid, cy, kx < mid ? mid - kx : kx - mid, 2, selected ? C_ACCENT : C_ACCENT2);
-+ fos_disc(cv, kx * 256 + 128, cy * 256 + 128, 8 * 256, selected ? FC(RAMP_GRAY, 244) : FC(RAMP_GRAY, 170), OPAQUE);
-+ char b[16];
-+ if (value > 0) snprintf(b, sizeof(b), "+%d", value);
-+ else if (value < 0) snprintf(b, sizeof(b), T_NDASH "%d", -value);
-+ else snprintf(b, sizeof(b), "0");
-+ fos_text_r(cv, &fos_font_mdb, x0 - 16, cy + 7, b, selected ? C_TEXT : C_TEXT2, OPAQUE, 0);
-+}
-+
-+static void page_row(const struct item *it, int i, int y, int selected)
-+{
-+ int base = y + 30;
-+ fos_text(cv, &fos_font_md, P_X + 22, base, it->label, selected ? C_TEXT : C_TEXT2, OPAQUE, 0);
-+ int rx = P_X + P_W - 20;
-+ char b[48];
-+ switch (it->kind)
-+ {
-+ case IT_TOGGLE:
-+ toggle_switch(rx, y + P_ROW_H / 2, knob[i].x);
-+ break;
-+ case IT_CHOICE:
-+ case IT_FSTOP:
-+ {
-+ int v = fos_port_get(it->setting);
-+ if (it->kind == IT_CHOICE)
-+ snprintf(b, sizeof(b), "%s", it->choices[fos_clamp(v, 0, it->n - 1)]);
-+ else
-+ {
-+ char ap[8];
-+ fos_format_fstop(ap, sizeof(ap), v);
-+ snprintf(b, sizeof(b), "f/%s", ap);
-+ }
-+ int w = fos_text_w(&fos_font_mdb, b, 0);
-+ fcol vc = selected ? C_ACCENT : C_TEXT2;
-+ if (selected)
-+ {
-+ fos_tri(cv, rx - w - 18, y + P_ROW_H / 2 - 1, 7, 2, C_TEXT3, OPAQUE);
-+ fos_tri(cv, rx - 4, y + P_ROW_H / 2 - 1, 7, 0, C_TEXT3, OPAQUE);
-+ rx -= 14;
-+ }
-+ fos_text_r(cv, &fos_font_mdb, rx, base, b, vc, OPAQUE, 0);
-+ break;
-+ }
-+ case IT_ACTION:
-+ case IT_PAGE:
-+ fos_tri(cv, rx - 4, y + P_ROW_H / 2 - 1, 8, 0, selected ? C_ACCENT : C_TEXT3, OPAQUE);
-+ break;
-+ case IT_LEVEL:
-+ level_slider(rx, y + P_ROW_H / 2, knob[i].x, fos_port_get(it->setting), selected);
-+ break;
-+ case IT_INFO:
-+ if (it->setting == -1)
-+ snprintf(b, sizeof(b), "%s", fos_port_lens_manual() ? "Manual" : fos_port_lens_name());
-+ else if (it->setting == -3)
-+ {
-+ if (nqr < 0) qr_load();
-+ snprintf(b, sizeof(b), "%s", nqr > 0 ? "Scan the code" : "");
-+ }
-+ else
-+ snprintf(b, sizeof(b), "%s", fos_port_version());
-+ fos_text_r(cv, &fos_font_md, rx, base, b, C_TEXT3, OPAQUE, 0);
-+ break;
-+ }
-+}
-+
-+void page_draw()
-+{
-+ const struct item *items = pages[page].items;
-+ int n = pages[page].n;
-+ int what = ui_clobbered ? D_ALL : pg_dirty;
-+ pg_dirty = 0;
-+ struct fos_canvas save = *cv;
-+ if (what & D_ALL)
-+ {
-+ ui_clobbered = 0;
-+ ui_damage_all();
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ what = D_LIST | D_PREV | D_HELP;
-+ }
-+ else
-+ {
-+ /* only the parts that change, each from the background */
-+ if (what & D_LIST) ui_bg_restore(0, LIST_RECT_Y0, PV_X - 4, LIST_RECT_Y1 - LIST_RECT_Y0);
-+ if (what & D_PREV) ui_bg_restore(PV_X, PV_Y, PV_W, PV_H);
-+ if (what & D_HELP) ui_bg_restore(0, HELP_RECT_Y0, FOS_W, HINTS_Y - HELP_RECT_Y0);
-+ }
-+ if (what & D_PREV)
-+ {
-+ fos_clip(cv, PV_X, PV_Y, PV_X + PV_W, PV_Y + PV_H);
-+ if (page == 0) preview_finder();
-+ else if (page == 1) preview_lens();
-+ else if (page == PAGE_SCREEN) preview_chart();
-+ else if (items[page_sel].setting == -3 && items[page_sel].kind == IT_INFO) preview_support();
-+ else preview_about();
-+ *cv = save;
-+ }
-+ if (what & D_HELP)
-+ {
-+ /* help for the selected row, fading in */
-+ float a = clampf(help_fade / 260.0f, 0, 1);
-+ if (!ui_toast_up())
-+ fos_text(cv, &fos_font_sm, P_X + 22, HINTS_Y - 14, items[page_sel].help, C_TEXT3, (int) (ease_out(a) * 256), 0);
-+ }
-+ if (!(what & D_LIST)) return;
-+ fos_clip(cv, 0, P_LIST_Y - 2, PV_X - 4, P_LIST_Y + P_ROWS * P_ROW_H + 2);
-+ float top = page_scroll.x;
-+ row_highlight(P_X, P_W, P_LIST_Y + (page_hl.x - top) * P_ROW_H, P_ROW_H);
-+ for (int i = 0; i < n; i++)
-+ {
-+ float y = P_LIST_Y + (i - top) * P_ROW_H;
-+ if (y < P_LIST_Y - P_ROW_H || y > P_LIST_Y + P_ROWS * P_ROW_H) continue;
-+ page_row(&items[i], i, (int) (y + 0.5f), i == page_sel);
-+ if (i < n - 1 && i != page_sel && i + 1 != page_sel)
-+ fos_fill(cv, P_X + 22, (int) (y + 0.5f) + P_ROW_H, P_W - 44, 1, FC(RAMP_GRAY, 22));
-+ }
-+ *cv = save;
-+ /* more below / above */
-+ if (page_top + P_ROWS < n)
-+ fos_tri(cv, P_X + P_W / 2, P_LIST_Y + P_ROWS * P_ROW_H + 8, 8, 1, C_TEXT3, OPAQUE);
-+}
-+
-+/* ---------------------------------------------------------------- the roll */
-+
-+static struct spring dial; /* frames shown on the counter */
-+static int asking_rewind;
-+static struct spring sheet;
-+static int rewinding, rewind_t;
-+static int rewind_then; /* after rewinding: 1 develop it, 0 load a new roll */
-+static int rewind_number;
-+static int roll_sheet_drawn; /* the last frame had the sheet on it */
-+
-+#define DIAL_CX 176
-+#define DIAL_CY 244
-+#define DIAL_R 118
-+
-+static void roll_bake()
-+{
-+ ui_bg_plain();
-+ ui_to_bg(1);
-+ ui_status_bar("ROLL");
-+ struct hint h1[] = { { "SET", ui_realistic() ? "Rewind roll" : "Finish roll" }, { "MENU", "Back" } };
-+ struct hint h2[] = { { "SET", "Load film" }, { "MENU", "Back" } };
-+ if (ui_roll.loaded) ui_hints(h1, 2); else ui_hints(h2, 2);
-+ ui_to_bg(0);
-+}
-+
-+void roll_enter(int arg)
-+{
-+ fos_port_roll(&ui_roll);
-+ dial.x = -1.5f; dial.v = 0; /* from "S", like a fresh counter */
-+ roll_sheet_drawn = 0;
-+ asking_rewind = arg == 1 && ui_roll.loaded; /* the roll has just been finished */
-+ sheet.x = 0; sheet.v = 0;
-+ rewinding = 0;
-+ roll_bake();
-+}
-+
-+void roll_key(int k)
-+{
-+ if (rewinding) return;
-+ if (asking_rewind)
-+ {
-+ if (k == FK_SET || k == FK_INFO)
-+ {
-+ asking_rewind = 0;
-+ rewinding = 1;
-+ rewind_t = ui_realistic() ? 0 : 1500; /* Basic: no rewinding to watch */
-+ rewind_then = k == FK_SET;
-+ rewind_number = ui_roll.number;
-+ fos_port_action(FA_REWIND, 0, 0);
-+ }
-+ else if (k == FK_MENU) asking_rewind = 0;
-+ ui_damage_all();
-+ return;
-+ }
-+ switch (k)
-+ {
-+ case FK_SET:
-+ if (ui_roll.loaded) asking_rewind = 1;
-+ else ui_go(SCR_SHELF, 1, GO_PUSH);
-+ break;
-+ case FK_MENU:
-+ ui_go(SCR_HOME, H_ROLL, GO_POP);
-+ break;
-+ case FK_HOME: case FK_PLAY:
-+ ui_leave();
-+ break;
-+ }
-+ ui_damage_all();
-+}
-+
-+int roll_update(int dt)
-+{
-+ int moving = 0;
-+ float target = ui_roll.loaded ? ui_roll.shot : -1.5f;
-+ if (rewinding)
-+ {
-+ rewind_t += dt;
-+ target = -1.5f;
-+ moving = 1;
-+ if (rewind_t > 1500)
-+ {
-+ fos_port_roll(&ui_roll);
-+ if (rewind_then)
-+ {
-+ dark_queue_clear();
-+ dark_queue_add(rewind_number);
-+ ui_go(SCR_DEVELOP, 0, GO_FADE);
-+ }
-+ else ui_go(SCR_SHELF, 1, GO_PUSH);
-+ return 1;
-+ }
-+ }
-+ moving |= spring_step(&dial, target, dt, rewinding ? 1.2f : 0.9f, rewinding ? 1.0f : 0.78f);
-+ moving |= spring_step(&sheet, asking_rewind ? 1 : 0, dt, 3.0f, 0.95f);
-+ if (moving) ui_damage_all();
-+ return moving;
-+}
-+
-+/* the box the dial turns in */
-+#define DIAL_BOX_X0 (DIAL_CX - DIAL_R - 18)
-+#define DIAL_BOX_X1 (DIAL_CX + DIAL_R + 18)
-+#define DIAL_BOX_Y0 (DIAL_CY - DIAL_R - 22)
-+#define DIAL_BOX_Y1 (DIAL_CY + DIAL_R + 18)
-+
-+/* the frame counter: a dial of numbers turning under a fixed mark, like
-+ * the little window on top of a film camera */
-+static void counter_dial(float frames)
-+{
-+ int cx = DIAL_CX * 256, cy = DIAL_CY * 256;
-+ fos_disc(cv, cx, cy, (DIAL_R + 14) * 256, FC(RAMP_GRAY, 15), OPAQUE);
-+ fos_disc(cv, cx, cy, DIAL_R * 256, FC(RAMP_METAL, 26), OPAQUE);
-+ fos_ring(cv, cx, cy, DIAL_R * 256, 512, FC(RAMP_METAL, 60), OPAQUE);
-+ fos_ring(cv, cx, cy, (DIAL_R - 30) * 256, 256, FC(RAMP_METAL, 40), OPAQUE);
-+ /* 7.5 degrees a frame; frame "frames" sits at the top */
-+ const int per = 65536 * 75 / 3600;
-+ for (int f = -2; f <= 40; f++)
-+ {
-+ float rel = f - frames;
-+ if (absf(rel) > 22) continue;
-+ int a = -16384 + (int) (rel * per);
-+ int r = f % 2 == 0 || f < 0 ? DIAL_R - 16 : DIAL_R - 10;
-+ int x = cx + fos_cos(a) * r / 16, y = cy + fos_sin(a) * r / 16;
-+ float near = clampf(1 - absf(rel) / 3.0f, 0, 1);
-+ if (f == -2)
-+ fos_text_c(cv, &fos_font_mdb, x >> 8, (y >> 8) + 7, "S", FC(RAMP_RED, 140 + (int) (near * 40)), OPAQUE, 0);
-+ else if (f >= 0 && f % 2 == 0)
-+ {
-+ char b[4];
-+ snprintf(b, sizeof(b), "%d", f);
-+ fcol c = near > 0.5f ? C_TEXT : FC(RAMP_GRAY, 120 + (int) (near * 100));
-+ fos_text_c(cv, &fos_font_mdb, x >> 8, (y >> 8) + 7, b, c, OPAQUE, 0);
-+ }
-+ else if (f > 0)
-+ fos_disc(cv, x, y, 2 * 256, FC(RAMP_GRAY, 120), OPAQUE);
-+ int t0 = DIAL_R - 4, t1 = DIAL_R;
-+ fos_line(cv, cx + fos_cos(a) * t0 / 16, cy + fos_sin(a) * t0 / 16, cx + fos_cos(a) * t1 / 16,
-+ cy + fos_sin(a) * t1 / 16, 300, FC(RAMP_METAL, 90), OPAQUE);
-+ }
-+ /* the fixed mark */
-+ fos_tri(cv, DIAL_CX, DIAL_CY - DIAL_R - 6, 12, 1, C_ACCENT, OPAQUE);
-+ /* the middle: what the counter means */
-+ char b[16];
-+ int shown = (int) (frames + 0.5f);
-+ if (frames < -0.75f) snprintf(b, sizeof(b), "S");
-+ else snprintf(b, sizeof(b), "%d", shown < 0 ? 0 : shown);
-+ fos_text_c(cv, &fos_font_num, DIAL_CX, DIAL_CY + 26, b, C_TEXT, OPAQUE, 0);
-+ fos_text_c(cv, &fos_font_xs, DIAL_CX, DIAL_CY + 52, "FRAMES", C_TEXT3, OPAQUE, 48);
-+}
-+
-+void roll_draw()
-+{
-+ if (!ui_clobbered && sheet.x <= 0 && !roll_sheet_drawn && !rewinding)
-+ {
-+ /* only the dial turns */
-+ struct fos_canvas save = *cv;
-+ ui_bg_restore(DIAL_BOX_X0, DIAL_BOX_Y0, DIAL_BOX_X1 - DIAL_BOX_X0, DIAL_BOX_Y1 - DIAL_BOX_Y0);
-+ fos_clip(cv, DIAL_BOX_X0, DIAL_BOX_Y0, DIAL_BOX_X1, DIAL_BOX_Y1);
-+ counter_dial(dial.x);
-+ *cv = save;
-+ return;
-+ }
-+ ui_clobbered = 0;
-+ roll_sheet_drawn = sheet.x > 0;
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ counter_dial(dial.x);
-+ int x = 336;
-+ char b[96];
-+ if (!ui_roll.loaded)
-+ {
-+ fos_text(cv, &fos_font_xs, x, 96, "NO ROLL", C_ACCENT, OPAQUE, 64);
-+ fos_text(cv, &fos_font_lg, x, 132, "The camera is empty", C_TEXT, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, x, 160, "Load a roll from the film shelf.", C_TEXT3, OPAQUE, 0);
-+ return;
-+ }
-+ const struct fos_film *f = &fos_films[ui_roll.film];
-+ snprintf(b, sizeof(b), "ROLL %03d", ui_roll.number);
-+ fos_text(cv, &fos_font_xs, x, 96, b, C_ACCENT, OPAQUE, 64);
-+ fos_text(cv, &fos_font_lg, x, 132, f->name, C_TEXT, OPAQUE, 0);
-+ snprintf(b, sizeof(b), "%s " T_DOT " ISO %d " T_DOT " %d exposures", f->process, f->box_iso, ui_roll.exposures);
-+ fos_text(cv, &fos_font_sm, x, 158, b, C_TEXT2, OPAQUE, 0);
-+ if (ui_roll.loaded_at[0])
-+ {
-+ snprintf(b, sizeof(b), "Loaded %s", ui_roll.loaded_at);
-+ fos_text(cv, &fos_font_sm, x, 180, b, C_TEXT3, OPAQUE, 0);
-+ }
-+
-+ /* the last frames, newest first */
-+ int y = 220;
-+ fos_text(cv, &fos_font_xs, x, y, "LAST FRAMES", C_TEXT3, OPAQUE, 48);
-+ fos_fill(cv, x, y + 8, 340, 1, C_LINE);
-+ y += 34;
-+ if (!ui_roll.nrecent)
-+ fos_text(cv, &fos_font_sm, x, y, "Nothing shot yet " T_MDASH " the roll is fresh.", C_TEXT3, OPAQUE, 0);
-+ for (int i = 0; i < ui_roll.nrecent && i < FOS_RECENT; i++, y += 30)
-+ {
-+ snprintf(b, sizeof(b), "%d", ui_roll.recent[i].no);
-+ fos_text_r(cv, &fos_font_mdb, x + 30, y, b, i == 0 ? C_TEXT : C_TEXT2, OPAQUE, 0);
-+ fos_text(cv, &fos_font_md, x + 54, y, ui_roll.recent[i].time, C_TEXT2, OPAQUE, 0);
-+ snprintf(b, sizeof(b), "f/%s", ui_roll.recent[i].fstop);
-+ fos_text(cv, &fos_font_md, x + 140, y, b, C_TEXT3, OPAQUE, 0);
-+ }
-+
-+ if (rewinding && ui_realistic())
-+ {
-+ float t = clampf(rewind_t / 900.0f, 0, 1);
-+ fos_text_c(cv, &fos_font_lg, 360, 420, "Rewinding" T_ELLIPSIS, FC(RAMP_GRAY, (int) (240 * ease_out(t))), OPAQUE, 0);
-+ }
-+ char body[96];
-+ int left = ui_roll.exposures - ui_roll.shot;
-+ if (left > 0)
-+ {
-+ snprintf(b, sizeof(b), ui_realistic() ? "Rewind roll %03d?" : "Finish roll %03d?", ui_roll.number);
-+ snprintf(body, sizeof(body), "%d frames stay unexposed. Develop it now, or load a new roll first.", left);
-+ }
-+ else
-+ {
-+ snprintf(b, sizeof(b), "Roll %03d is finished", ui_roll.number);
-+ snprintf(body, sizeof(body), ui_realistic() ? "Rewind it, then develop it now or load a new roll first."
-+ : "Develop it now, or load a new roll first.");
-+ }
-+ ui_sheet3(sheet.x, b, body, "Develop now", "New roll", left > 0 ? "Cancel" : "Not now");
-+}
-diff --git a/src/fos_print.c b/src/fos_print.c
-new file mode 100644
-index 000000000..38c5d504a
---- /dev/null
-+++ b/src/fos_print.c
-@@ -0,0 +1,65 @@
-+/* fos_print: reading a print (the BMP the darkroom writes, fos_dev.c).
-+ *
-+ * Kept apart from the darkroom so every build can show prints: the shelf's
-+ * sample of each film is one, also in builds made --no-darkroom.
-+ */
-+
-+#include "fos.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+
-+static int u16le(const uint8_t *p) { return p[0] | p[1] << 8; }
-+static unsigned u32le(const uint8_t *p) { return p[0] | p[1] << 8 | p[2] << 16 | (unsigned) p[3] << 24; }
-+
-+static int is_print(const uint8_t *h)
-+{
-+ return h[0] == 'B' && h[1] == 'M' && u32le(h + 10) == FOS_BMP_PIXELS && u32le(h + 18) == FOS_PRINT_W
-+ && !memcmp(h + FOS_BMP_META, "FOP2", 4);
-+}
-+
-+int fos_print_thumb(const char *path, uint8_t *thumb)
-+{
-+ void *f = fos_port_open(path, 0);
-+ if (!f) return 0;
-+ static uint8_t h[FOS_BMP_PIXELS];
-+ int ok = fos_port_read(f, h, FOS_BMP_PIXELS) == FOS_BMP_PIXELS && is_print(h)
-+ && fos_port_seek(f, FOS_BMP_THUMB) >= 0 && fos_port_read(f, thumb, FOS_THUMB_SIZE) == FOS_THUMB_SIZE;
-+ fos_port_close(f);
-+ return ok;
-+}
-+
-+int fos_print_load(const char *path, struct fos_print *p)
-+{
-+ memset(p, 0, sizeof(*p));
-+ void *f = fos_port_open(path, 0);
-+ if (!f) return 0;
-+ static uint8_t h[FOS_BMP_PIXELS];
-+ int ok = fos_port_read(f, h, FOS_BMP_PIXELS) == FOS_BMP_PIXELS && is_print(h);
-+ if (ok)
-+ {
-+ const uint8_t *m = h + FOS_BMP_META;
-+ p->film = m[4];
-+ p->frame = u16le(m + 6);
-+ memcpy(p->when, m + 8, 19);
-+ memcpy(p->fstop, m + 28, 7);
-+ p->x0 = u16le(m + 36);
-+ p->w = u16le(m + 38);
-+ if (!p->w || p->x0 + p->w > FOS_PRINT_W) p->x0 = 0, p->w = FOS_PRINT_W;
-+ for (int i = 0; i < FOS_PRINT_COLOURS; i++)
-+ {
-+ const uint8_t *q = h + FOS_BMP_PAL + 4 * (i + 1);
-+ p->pal[i][0] = q[2]; p->pal[i][1] = q[1]; p->pal[i][2] = q[0];
-+ }
-+ p->px = fos_port_alloc(FOS_PRINT_W * FOS_PRINT_H);
-+ ok = p->px && fos_port_read(f, p->px, FOS_PRINT_W * FOS_PRINT_H) == FOS_PRINT_W * FOS_PRINT_H;
-+ }
-+ fos_port_close(f);
-+ if (!ok) fos_print_free(p);
-+ return ok;
-+}
-+
-+void fos_print_free(struct fos_print *p)
-+{
-+ fos_port_free(p->px);
-+ p->px = 0;
-+}
-diff --git a/src/fos_shelf.c b/src/fos_shelf.c
-new file mode 100644
-index 000000000..f6292051c
---- /dev/null
-+++ b/src/fos_shelf.c
-@@ -0,0 +1,914 @@
-+/* fos_shelf: the film shelf - the canisters on a dark stage, turning
-+ * towards you as they glide past - and loading a roll.
-+ *
-+ * The carousel position is a spring that chases the selected film, so
-+ * quick turns of the dial pile up into one smooth glide, and every
-+ * canister's place, size, light and turn follow from how far it is from
-+ * that position. The text below follows the same position: it slides out
-+ * with the film leaving the middle and in with the one arriving.
-+ *
-+ * The films stand on shelves by kind (colour, slide, B&W, cine): up and
-+ * down change shelf, and the canisters of the next one drop in.
-+ *
-+ * PLAY shows the film's sample: one photo developed with every film when
-+ * the card was made (ML/SAMPLES), full screen on its own palette.
-+ */
-+
-+#include "fos_ui.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+
-+#define FLOOR_Y 262
-+#define DOTS_Y 290
-+#define BRAND_Y 320
-+#define NAME_Y 366
-+#define DESC_Y 392
-+#define CHIPS_Y 406
-+
-+#define TABS_Y 56
-+#define MAX_CANS 10 /* labels painted at a time: the shelf's middle and a few around */
-+#define MAX_LIST 96 /* films on a shelf */
-+
-+/* everything that moves on the shelf is between these rows */
-+#define MOVING_Y0 (STATUS_H - 8)
-+#define MOVING_Y1 HINTS_Y
-+
-+static struct { int film; struct fos_can *c; unsigned used; } cans[MAX_CANS];
-+static unsigned can_clock;
-+static uint8_t *info_mask; /* the name block for fading, see info_build() */
-+static int info_film = -1, info_x0, info_x1;
-+static int16_t info_row0[128], info_row1[128]; /* inked span of each row */
-+
-+static struct spring pos; /* carousel, in places on the shelf */
-+static int target; /* the selected film's place on the shelf */
-+static int group; /* the shelf: FOS_GROUP_* */
-+static int list[MAX_LIST], nlist; /* its films */
-+static int group_at[FOS_NGROUPS]; /* the place last chosen on each shelf */
-+static struct spring drop; /* a new shelf's canisters dropping in, 1 -> 0 */
-+static int drop_dir;
-+static int exp_sel;
-+static struct spring exp_roll; /* the exposures chip rolls to the new number */
-+static int exp_prev;
-+static int nudge; /* bump at either end */
-+
-+/* rewind-and-load question */
-+static int asking;
-+static struct spring sheet;
-+
-+/* loading a roll */
-+static int loading, load_t;
-+
-+static int sheet_drawn; /* the last frame had the sheet on it */
-+
-+static char baked_clock[16];
-+static void bake();
-+
-+/* the sample, full screen; changing what is shown goes through black, as
-+ * the prints do (fos_dark.c) */
-+enum { SM_OFF, SM_WAIT, SM_IN, SM_SHOW, SM_OUT };
-+enum { SM_NEXT_LOAD, SM_NEXT_BACK, SM_NEXT_ROLL };
-+static int sm_state, sm_t, sm_next;
-+static int sm_black; /* the black before the picture is on screen */
-+static int has_samples; /* the card has them (made for this camera) */
-+static struct fos_print sm_print;
-+static int sm_have; /* sm_print holds the film's sample */
-+static int sm_info = 1; /* the film's details along the bottom */
-+static int sm_dirty;
-+#define SM_FADE_MS 180
-+#define SM_INFO_H 44
-+
-+static void sample_path(char *buf, int size, int film)
-+{
-+ snprintf(buf, size, "%sML/SAMPLES/F%03d.BMP", fos_port_card(), film);
-+}
-+
-+/* ---------------------------------------------------------------- canisters */
-+
-+/* a film's canister: kept painted for the last few asked for */
-+struct fos_can *ui_can(int film)
-+{
-+ if (film < 0 || film >= fos_nfilms) return 0;
-+ int slot = 0;
-+ for (int i = 0; i < MAX_CANS; i++)
-+ {
-+ if (cans[i].c && cans[i].film == film)
-+ {
-+ cans[i].used = ++can_clock;
-+ return cans[i].c;
-+ }
-+ if (!cans[i].c || (cans[slot].c && cans[i].used < cans[slot].used)) slot = i;
-+ }
-+ fos_can_free(cans[slot].c);
-+ cans[slot].c = fos_can_new(film, fos_exposure_choices[exp_sel]);
-+ cans[slot].film = film;
-+ cans[slot].used = ++can_clock;
-+ return cans[slot].c;
-+}
-+
-+void ui_cans_free()
-+{
-+ fos_port_free(info_mask);
-+ info_mask = 0;
-+ info_film = -1;
-+ for (int i = 0; i < MAX_CANS; i++)
-+ {
-+ fos_can_free(cans[i].c);
-+ cans[i].c = 0;
-+ }
-+}
-+
-+void ui_cans_exposures(int exposures)
-+{
-+ for (int i = 0; i < MAX_CANS; i++)
-+ if (cans[i].c) fos_can_set_exposures(cans[i].c, exposures);
-+}
-+
-+/* the films of shelf g, and the place of film on it (0 if not there) */
-+static int shelf_list(int g, int film)
-+{
-+ int at = 0;
-+ group = g;
-+ nlist = 0;
-+ for (int i = 0; i < fos_nfilms && nlist < MAX_LIST; i++)
-+ if (fos_films[i].group == g)
-+ {
-+ if (i == film) at = nlist;
-+ list[nlist++] = i;
-+ }
-+ return at;
-+}
-+
-+/* the labels the shelf will show first, painted now rather than mid-glide */
-+static void paint_around(int at)
-+{
-+ for (int d = 0; d <= 3; d++)
-+ {
-+ if (at + d < nlist) ui_can(list[at + d]);
-+ if (d && at - d >= 0) ui_can(list[at - d]);
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- the stage */
-+
-+static float absf(float v) { return v < 0 ? -v : v; }
-+
-+#ifndef ABS
-+#define ABS(v) ((v) < 0 ? -(v) : (v))
-+#endif
-+
-+/* the stage's light at (x, y), 12-bit */
-+static int stage_lv(int x, int y)
-+{
-+ int dx = x - 360;
-+ int lv;
-+ if (y < FLOOR_Y - 6)
-+ {
-+ /* backdrop: a soft spotlight behind the middle canister */
-+ int dy = (y - 150) * 3 / 2;
-+ int d2 = (dx * dx + dy * dy) >> 4;
-+ int spot = d2 < 9000 ? (9000 - d2) * (9000 - d2) / 9000 * LV12(20) / 9000 : 0;
-+ lv = LV12(10) + spot + (FLOOR_Y - y) * LV12(3) / FLOOR_Y;
-+ }
-+ else
-+ {
-+ /* floor: a lit ellipse under the canister fading into the dark */
-+ int dy = (y - (FLOOR_Y + 4)) * 5;
-+ int d2 = (dx * dx + dy * dy) >> 4;
-+ int pool = d2 < 7000 ? (7000 - d2) * LV12(13) / 7000 : 0;
-+ int fall = fos_clamp((y - FLOOR_Y) * LV12(6) / 60, 0, LV12(6));
-+ lv = LV12(13) + pool - fall;
-+ if (y > FLOOR_Y + 40) lv = lv * (FOS_H - y) / (FOS_H - FLOOR_Y - 40);
-+ lv = fos_clamp(lv, LV12(4), LV_MAX);
-+ }
-+ /* the seam between backdrop and floor, very soft */
-+ if (y >= FLOOR_Y - 6 && y < FLOOR_Y + 2)
-+ lv = lv * (256 - (4 - ABS(y - (FLOOR_Y - 2))) * 10) / 256;
-+ return lv;
-+}
-+
-+/* the stage: a backdrop lit from above, a floor, a pool of light in the
-+ * middle. The light changes slowly, so it is worked out every 8 px and
-+ * stepped in between; rows y0..y1-1 only */
-+static void stage_bg(int y0, int y1)
-+{
-+ const int mul = fos_ramp_mul[RAMP_GRAY];
-+ const int base = fos_ramp_base[RAMP_GRAY], last = fos_ramp_last[RAMP_GRAY];
-+ for (int y = y0; y < y1; y++)
-+ {
-+ uint8_t *row = &ui_bg[y * FOS_W];
-+ const uint8_t *bay = fos_bayer[y & 3];
-+ int p1 = stage_lv(0, y) * mul;
-+ for (int x = 0; x < FOS_W; x += 8)
-+ {
-+ int p0 = p1;
-+ p1 = stage_lv(x + 8, y) * mul;
-+ int p = p0, dp = (p1 - p0) >> 3;
-+ for (int i = 0; i < 8; i++, p += dp)
-+ {
-+ int q = ((p >> 16) + bay[i & 3]) >> 4;
-+ row[x + i] = base + (q > last ? last : q);
-+ }
-+ }
-+ }
-+}
-+
-+/* where film i stands for carousel offset d (films from the middle) */
-+static void pose_of(float d, struct fos_can_pose *p, float lift, float spread)
-+{
-+ float ad = absf(d);
-+ float n = clampf(ad, 0, 1), f = clampf(ad - 1, 0, 1.8f);
-+ float sx = d < 0 ? -1 : 1;
-+ float x = 360 + sx * (n * 192 + f * 122) * spread;
-+ float scale = 1.0f - n * 0.27f - f * 0.17f;
-+ float light = 1.0f - n * 0.42f - f * 0.30f;
-+ float rot = d * 0.085f; /* turns: faces the middle */
-+ p->cx8 = (int) (x * 256);
-+ p->floor_y = (int) (FLOOR_Y - n * 12 - f * 8 - lift);
-+ p->scale = (int) (scale * 256);
-+ p->rot = (int) (rot * 65536);
-+ p->light = (int) (clampf(light, 0, 1) * 256);
-+ p->leader = 256;
-+ p->fast = absf(pos.v) > 1.2f; /* films a second: too quick to see the fine print */
-+ /* the middle one is mirrored in the floor, fading as it leaves */
-+ p->reflect = (int) (64 * clampf(1.25f - absf(d), 0, 1));
-+}
-+
-+/* a soft contact shadow under a canister */
-+static void contact_shadow(int cx, int y, int rx, int ry, int strength)
-+{
-+ if (rx <= 0 || ry <= 0) return;
-+ int x0 = fos_clamp(cx - rx, cv->cx0, cv->cx1), x1 = fos_clamp(cx + rx, cv->cx0, cv->cx1);
-+ int y0 = fos_clamp(y - ry, cv->cy0, cv->cy1), y1 = fos_clamp(y + ry, cv->cy0, cv->cy1);
-+ int sx = 65536 / rx, sy = 65536 / ry; /* 1/256 of the radius per px */
-+ for (int j = y0; j < y1; j++)
-+ {
-+ int dy = ((j - y) * sy) >> 8;
-+ if (dy * dy >= 65536) continue;
-+ /* only the part of the row inside the ellipse */
-+ int half = (fos_isqrt(65536 - dy * dy) * rx >> 8) + 1;
-+ int xa = fos_clamp(cx - half, x0, x1), xb = fos_clamp(cx + half + 1, xa, x1);
-+ int dx8 = (xa - cx) * sx;
-+ uint8_t *p = &cv->px[j * cv->pitch + xa];
-+ for (int i = xa; i < xb; i++, p++, dx8 += sx)
-+ {
-+ int dx = dx8 >> 8;
-+ int d2 = (dx * dx + dy * dy) >> 8;
-+ if (d2 >= 256) continue;
-+ int k = 256 - ((strength * (((256 - d2) * (256 - d2)) >> 8)) >> 8);
-+ *p = fos_darken(*p, k, i, j);
-+ }
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- screen */
-+
-+void shelf_enter(int arg)
-+{
-+ exp_sel = fos_clamp(fos_port_get(FS_EXP), 0, FOS_NEXP - 1);
-+ exp_prev = exp_sel;
-+ exp_roll.x = 1; exp_roll.v = 0;
-+ int film = ui_roll.loaded && ui_roll.shot < ui_roll.exposures ? ui_roll.film : fos_port_get(FS_FILM);
-+ film = fos_clamp(film, 0, fos_nfilms - 1);
-+ target = shelf_list(fos_films[film].group, film);
-+ for (int g = 0; g < FOS_NGROUPS; g++) group_at[g] = 0;
-+ group_at[group] = target;
-+ drop.x = 0; drop.v = 0;
-+ pos.x = target; pos.v = 0;
-+ /* arriving from elsewhere: the shelf glides in from one film over */
-+ if (arg == 0) pos.x = target - 0.6f;
-+ nudge = 0;
-+ asking = 0;
-+ sheet.x = 0; sheet.v = 0;
-+ loading = 0;
-+ sheet_drawn = 0;
-+ sm_state = SM_OFF;
-+ sm_have = 0;
-+ char path[64];
-+ sample_path(path, sizeof(path), 0);
-+ void *f = fos_port_open(path, 0);
-+ has_samples = f != 0;
-+ if (f) fos_port_close(f);
-+ paint_around(target);
-+ ui_cans_exposures(fos_exposure_choices[exp_sel]);
-+ bake();
-+}
-+
-+void shelf_leave()
-+{
-+ if (sm_have) fos_print_free(&sm_print);
-+ sm_have = 0;
-+ if (sm_state != SM_OFF) fos_port_palette();
-+ sm_state = SM_OFF;
-+}
-+
-+static int roll_in_progress()
-+{
-+ return ui_roll.loaded && ui_roll.shot < ui_roll.exposures;
-+}
-+
-+static void start_loading()
-+{
-+ loading = 1;
-+ load_t = 0;
-+ asking = 0;
-+ bake();
-+ fos_port_set(FS_FILM, list[target]);
-+ fos_port_set(FS_EXP, exp_sel);
-+ fos_port_action(FA_LOAD, list[target], exp_sel);
-+ fos_port_roll(&ui_roll);
-+}
-+
-+/* what the next frame changes: the whole screen while the sheet or the
-+ * loading animation is up, else the band between status bar and hints */
-+static void shelf_damage()
-+{
-+ if (loading || asking || sheet.x > 0 || sheet_drawn || sm_state != SM_OFF) ui_damage_all();
-+ else ui_damage(MOVING_Y0, MOVING_Y1);
-+}
-+
-+/* ---------------------------------------------------------------- the sample */
-+
-+static void sm_load()
-+{
-+ char path[64];
-+ if (sm_have) fos_print_free(&sm_print);
-+ sm_have = 0;
-+ sample_path(path, sizeof(path), list[target]);
-+ sm_have = fos_print_load(path, &sm_print);
-+ /* made with another set of films: not this one's */
-+ if (sm_have && sm_print.film != list[target]) { fos_print_free(&sm_print); sm_have = 0; }
-+ if (!sm_have)
-+ {
-+ char msg[96];
-+ snprintf(msg, sizeof(msg), "shelf: no sample in %s", path);
-+ fos_port_log(msg);
-+ }
-+ sm_dirty = 1;
-+}
-+
-+static void sm_palette(int k)
-+{
-+ static const uint8_t black[1][3] = { { 0, 0, 0 } };
-+ if (sm_have) fos_port_photo((const uint8_t (*)[3]) sm_print.pal, FOS_PRINT_COLOURS, k);
-+ else fos_port_photo(black, 1, k);
-+}
-+
-+static void sm_go(int next)
-+{
-+ if (sm_state == SM_OUT) return;
-+ sm_next = next;
-+ sm_state = SM_OUT;
-+ sm_t = 0;
-+}
-+
-+static void sample_key(int k)
-+{
-+ if (sm_state != SM_SHOW) return;
-+ switch (k)
-+ {
-+ case FK_LEFT: case FK_WHEEL_L: case FK_RIGHT: case FK_WHEEL_R:
-+ {
-+ /* the next film on this shelf; the shelf follows */
-+ int to = target + (k == FK_LEFT || k == FK_WHEEL_L ? -1 : 1);
-+ if (to < 0 || to >= nlist) break;
-+ target = to;
-+ group_at[group] = target;
-+ sm_go(SM_NEXT_LOAD);
-+ break;
-+ }
-+ case FK_INFO:
-+ sm_info = !sm_info;
-+ sm_dirty = 1;
-+ break;
-+ case FK_SET:
-+ sm_go(SM_NEXT_ROLL);
-+ break;
-+ case FK_MENU: case FK_PLAY: case FK_HOME:
-+ sm_go(SM_NEXT_BACK);
-+ break;
-+ }
-+}
-+
-+static int sample_update(int dt)
-+{
-+ sm_t += dt;
-+ switch (sm_state)
-+ {
-+ case SM_WAIT:
-+ /* once the screen is black in the film OS's colours, the picture */
-+ if (!sm_black) return 1;
-+ sm_load();
-+ sm_palette(0);
-+ sm_state = SM_IN;
-+ sm_t = 0;
-+ return 1;
-+ case SM_IN:
-+ sm_palette(fos_clamp(sm_t * 256 / SM_FADE_MS, 0, 256));
-+ if (sm_t >= SM_FADE_MS) sm_state = SM_SHOW;
-+ return 1;
-+ case SM_OUT:
-+ sm_palette(fos_clamp(256 - sm_t * 256 / SM_FADE_MS, 0, 256));
-+ if (sm_t < SM_FADE_MS) return 1;
-+ if (sm_next == SM_NEXT_LOAD)
-+ {
-+ sm_load();
-+ sm_state = SM_IN;
-+ sm_t = 0;
-+ return 1;
-+ }
-+ /* back to the shelf's colours, on black, at the film shown last */
-+ sm_state = SM_OFF;
-+ if (sm_have) fos_print_free(&sm_print);
-+ sm_have = 0;
-+ memset(cv->px, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+ fos_port_present(cv->px, FOS_W, 0, FOS_H);
-+ fos_port_palette();
-+ pos.x = target; pos.v = 0;
-+ paint_around(target);
-+ ui_clobbered = 1;
-+ if (sm_next == SM_NEXT_ROLL)
-+ {
-+ if (roll_in_progress()) asking = 1;
-+ else start_loading();
-+ }
-+ shelf_damage();
-+ return 1;
-+ }
-+ return 0;
-+}
-+
-+static void sample_draw()
-+{
-+ if (sm_state == SM_WAIT)
-+ {
-+ memset(cv->px, fos_ix(FC(RAMP_GRAY, 0)), FOS_W * FOS_H);
-+ ui_clobbered = 0;
-+ ui_damage_all();
-+ sm_black = 1;
-+ return;
-+ }
-+ if (sm_state == SM_OUT) return; /* what is fading out stays as it was */
-+ if (!sm_dirty && !ui_clobbered) return;
-+ sm_dirty = 0;
-+ ui_clobbered = 0;
-+ const struct fos_film *f = &fos_films[list[target]];
-+ if (sm_have) memcpy(cv->px, sm_print.px, FOS_W * FOS_H);
-+ else
-+ {
-+ memset(cv->px, PX_BLACK, FOS_W * FOS_H);
-+ ui_photo_text(&fos_font_md, 360, 244, "No sample for this film", 0, 1);
-+ }
-+ if (sm_info)
-+ {
-+ char b[96];
-+ int y = FOS_H - SM_INFO_H;
-+ memset(&cv->px[y * cv->pitch], PX_PANEL, FOS_W * SM_INFO_H);
-+ memset(&cv->px[y * cv->pitch], PX_LINE, FOS_W);
-+ int x = 20 + ui_photo_text(&fos_font_xs, 20, y + 28, "SAMPLE", 1, 0);
-+ snprintf(b, sizeof(b), "%s %s " T_DOT " ISO %d " T_DOT " %s", f->brand, f->name, f->box_iso, f->process);
-+ ui_photo_text(&fos_font_sm, x + 14, y + 28, b, 0, 0);
-+ ui_photo_text(&fos_font_xs, FOS_W - 20, y + 28, "SET LOAD PLAY BACK", 0, 2);
-+ }
-+ ui_damage_all();
-+}
-+
-+/* ---------------------------------------------------------------- keys */
-+
-+void shelf_key(int k)
-+{
-+ if (loading) return;
-+ if (sm_state != SM_OFF)
-+ {
-+ sample_key(k);
-+ shelf_damage();
-+ return;
-+ }
-+ if (asking)
-+ {
-+ if (k == FK_SET) start_loading();
-+ else if (k == FK_MENU || k == FK_LEFT || k == FK_RIGHT || k == FK_WHEEL_L || k == FK_WHEEL_R)
-+ asking = 0;
-+ shelf_damage();
-+ return;
-+ }
-+ switch (k)
-+ {
-+ case FK_LEFT: case FK_WHEEL_L:
-+ if (target > 0) target--; else nudge = -1;
-+ break;
-+ case FK_RIGHT: case FK_WHEEL_R:
-+ if (target < nlist - 1) target++; else nudge = 1;
-+ break;
-+ case FK_UP: case FK_DOWN:
-+ {
-+ /* the next shelf (skipping empty ones), at the film last chosen there */
-+ int dir = k == FK_DOWN ? 1 : -1, from = group, g = group;
-+ group_at[group] = target;
-+ do
-+ {
-+ g = (g + dir + FOS_NGROUPS) % FOS_NGROUPS;
-+ shelf_list(g, -1);
-+ }
-+ while (!nlist && g != from);
-+ target = fos_clamp(group_at[g], 0, nlist - 1);
-+ pos.x = target; pos.v = 0;
-+ drop.x = 1; drop.v = 0;
-+ drop_dir = dir;
-+ paint_around(target);
-+ bake();
-+ ui_clobbered = 1;
-+ break;
-+ }
-+ case FK_INFO:
-+ exp_prev = exp_sel;
-+ exp_sel = (exp_sel + (k == FK_UP ? FOS_NEXP - 1 : 1)) % FOS_NEXP;
-+ exp_roll.x = 0; exp_roll.v = 0;
-+ ui_cans_exposures(fos_exposure_choices[exp_sel]);
-+ break;
-+ case FK_SET:
-+ if (roll_in_progress()) asking = 1;
-+ else start_loading();
-+ break;
-+ case FK_MENU:
-+ if (ui_from() == SCR_HOME) ui_go(SCR_HOME, 0, GO_POP);
-+ else ui_leave();
-+ break;
-+ case FK_PLAY:
-+ if (has_samples)
-+ {
-+ /* the canisters settle where they are going first */
-+ pos.x = target; pos.v = 0;
-+ sm_state = SM_WAIT;
-+ sm_t = 0;
-+ sm_black = 0;
-+ break;
-+ }
-+ ui_go(SCR_HOME, 0, GO_POP);
-+ break;
-+ case FK_HOME:
-+ ui_go(SCR_HOME, 0, GO_POP);
-+ break;
-+ }
-+ shelf_damage();
-+}
-+
-+int shelf_update(int dt)
-+{
-+ if (sm_state != SM_OFF) return sample_update(dt);
-+ int moving = 0;
-+ char clock[16];
-+ fos_port_clock(clock, sizeof(clock));
-+ if (strcmp(clock, baked_clock))
-+ {
-+ /* a new minute: only the status bar changes */
-+ stage_bg(0, STATUS_H);
-+ ui_to_bg(1);
-+ ui_status_bar("FILM");
-+ ui_to_bg(0);
-+ memcpy(baked_clock, clock, sizeof(baked_clock));
-+ ui_damage(0, STATUS_H);
-+ ui_clobbered = 1;
-+ }
-+ float goal = target + (nudge ? nudge * 0.18f : 0);
-+ moving |= spring_step(&pos, goal, dt, 2.1f, 0.86f);
-+ if (nudge && absf(pos.x - goal) < 0.05f) nudge = 0;
-+ moving |= spring_step(&exp_roll, 1, dt, 3.2f, 0.9f);
-+ moving |= spring_step(&sheet, asking ? 1 : 0, dt, 3.0f, 0.95f);
-+ moving |= spring_step(&drop, 0, dt, 2.6f, 0.9f);
-+ if (loading)
-+ {
-+ load_t += dt;
-+ moving = 1;
-+ if (load_t > 1900) ui_leave();
-+ }
-+ if (moving)
-+ shelf_damage();
-+ return moving;
-+}
-+
-+/* ---------------------------------------------------------------- drawing */
-+
-+static void draw_canisters(float lift_mid, float spread, float fade_sides, int leader_mid)
-+{
-+ int t0 = fos_port_ms();
-+ struct { int i; float d; } order[8];
-+ int n = 0;
-+ for (int i = 0; i < nlist && n < 8; i++)
-+ {
-+ float d = i - pos.x;
-+ if (absf(d) > 2.7f) continue;
-+ order[n].i = i; order[n].d = d; n++;
-+ }
-+ /* far ones first */
-+ for (int a = 0; a < n; a++)
-+ for (int b = a + 1; b < n; b++)
-+ if (absf(order[b].d) > absf(order[a].d))
-+ {
-+ int ti = order[a].i; float td = order[a].d;
-+ order[a] = order[b];
-+ order[b].i = ti; order[b].d = td;
-+ }
-+
-+ for (int k = 0; k < n; k++)
-+ {
-+ int i = list[order[k].i];
-+ float d = order[k].d;
-+ struct fos_can_pose p;
-+ int mid = absf(d) < 0.5f;
-+ pose_of(d, &p, mid ? lift_mid : 0, spread);
-+ if (!mid) p.light = (int) (p.light * (1 - fade_sides));
-+ if (drop.x > 0.002f)
-+ {
-+ /* a new shelf: its canisters drop in from above (or rise from below), the far ones a little later */
-+ float t = clampf(drop.x * (1 + absf(d) * 0.25f), 0, 1);
-+ p.floor_y -= (int) (t * 90 * drop_dir);
-+ p.light = (int) (p.light * (1 - t));
-+ p.reflect = (int) (p.reflect * (1 - t));
-+ }
-+ if (mid && leader_mid) p.leader = leader_mid;
-+ if (p.light <= 4) continue;
-+ struct fos_can *c = ui_can(i);
-+ int w = fos_can_width(p.scale);
-+ contact_shadow(p.cx8 >> 8, p.floor_y, w * 6 / 10, 7 * p.scale / 256 + 2, 150 * p.light / 256);
-+ fos_can_draw(cv, c, &p);
-+
-+ /* the film that is in the camera wears a tag */
-+ if (roll_in_progress() && i == ui_roll.film && !loading)
-+ {
-+ int cx = p.cx8 >> 8;
-+ int top = p.floor_y - fos_can_height(p.scale) - 14;
-+ int a = (int) (p.light * 1.0f);
-+ const char *t = "IN CAMERA";
-+ int tw = fos_text_w(&fos_font_xs, t, 24);
-+ fos_rrect(cv, cx - tw / 2 - 10, top - 13, tw + 20, 20, 10, FC(RAMP_AMBER, 186 * a / 256), OPAQUE);
-+ fos_text_c(cv, &fos_font_xs, cx, top + 2, t, FC(RAMP_GRAY, 14), OPAQUE, 24);
-+ }
-+ }
-+ ui_cans_ms += fos_port_ms() - t0;
-+}
-+
-+/* chips under the name: fixed sizes, so only the values change */
-+#define CHIP_H 26
-+static const char *chip_labels[3] = { "ISO", "PROCESS", "EXP" };
-+static const char *chip_widest[3] = { "800", "C-41", "36" };
-+static int chip_x[3], chip_w[3], chip_vx[3];
-+
-+static void chips_layout()
-+{
-+ int total = 0;
-+ for (int i = 0; i < 3; i++)
-+ {
-+ int lw = fos_text_w(&fos_font_xs, chip_labels[i], 24);
-+ int vw = fos_text_w(&fos_font_mdb, chip_widest[i], 0);
-+ chip_w[i] = lw + vw + 32;
-+ total += chip_w[i] + (i ? 10 : 0);
-+ }
-+ int x = 360 - total / 2;
-+ for (int i = 0; i < 3; i++)
-+ {
-+ chip_x[i] = x;
-+ chip_vx[i] = x + 12 + fos_text_w(&fos_font_xs, chip_labels[i], 24) + 8;
-+ x += chip_w[i] + 10;
-+ }
-+}
-+
-+static void draw_static(int alpha)
-+{
-+ struct hint h[] = { { "<>", "Film" }, { "^v", "Shelf" }, { "INFO", "Exposures" },
-+ { "SET", roll_in_progress() ? (ui_realistic() ? "Rewind & load" : "Finish & load") : "Load" }, { "MENU", "Back" },
-+ { "PLAY", "Sample" } };
-+ if (alpha >= OPAQUE) ui_hints(h, has_samples ? 6 : 5);
-+ /* the shelves, this one lit */
-+ int tw = 0;
-+ for (int g = 0; g < FOS_NGROUPS; g++) tw += fos_text_w(&fos_font_xs, fos_group_names[g], 64) + (g ? 30 : 0);
-+ int tx = 360 - tw / 2;
-+ for (int g = 0; g < FOS_NGROUPS; g++)
-+ {
-+ int w = fos_text_w(&fos_font_xs, fos_group_names[g], 64);
-+ fos_text(cv, &fos_font_xs, tx, TABS_Y, fos_group_names[g], g == group ? C_ACCENT : C_TEXT3, alpha, 64);
-+ if (g == group) fos_rrect(cv, tx + w / 2 - 8, TABS_Y + 6, 16, 3, 1, C_ACCENT, alpha);
-+ tx += w + 30;
-+ }
-+ for (int i = 0; i < 3; i++)
-+ {
-+ int exp = i == 2;
-+ fos_rrect(cv, chip_x[i], CHIPS_Y, chip_w[i], CHIP_H, CHIP_H / 2, exp ? FC(RAMP_GRAY, 24) : FC(RAMP_GRAY, 17), alpha);
-+ fos_rrect_line(cv, chip_x[i], CHIPS_Y, chip_w[i], CHIP_H, CHIP_H / 2, 1, exp ? C_ACCENT2 : FC(RAMP_GRAY, 46), alpha);
-+ fos_text(cv, &fos_font_xs, chip_x[i] + 12, CHIPS_Y + 18, chip_labels[i], C_TEXT3, alpha, 24);
-+ }
-+ int n = nlist, x0 = 360 - n * 6;
-+ for (int i = 0; i < n; i++)
-+ fos_disc(cv, (x0 + i * 12 + 6) * 256, DOTS_Y * 256, 2 * 256, FC(RAMP_GRAY, 60), alpha);
-+}
-+
-+/* the stage and everything that doesn't move, drawn once; while a roll
-+ * loads, only the stage stays */
-+static void bake()
-+{
-+ stage_bg(0, FOS_H);
-+ ui_to_bg(1);
-+ ui_status_bar("FILM");
-+ chips_layout();
-+ if (!loading) draw_static(OPAQUE);
-+ ui_to_bg(0);
-+ fos_port_clock(baked_clock, sizeof(baked_clock));
-+}
-+
-+static void draw_dot_marker()
-+{
-+ /* the current film: a short amber bar sliding with the carousel */
-+ int x0 = 360 - nlist * 6;
-+ float px = x0 + clampf(pos.x, 0, nlist - 1) * 12 + 6;
-+ fos_rrect(cv, (int) px - 7, DOTS_Y - 2, 14, 4, 2, C_ACCENT, OPAQUE);
-+}
-+
-+/* The film's name block, kept for fading: per pixel its ink (high
-+ * nibble) and coverage (low nibble), so a frame of the glide blends the
-+ * pixels without decoding the glyphs again. */
-+#define INFO_Y0 (BRAND_Y - 16)
-+#define INFO_Y1 (DESC_Y + 8)
-+#define INFO_H (INFO_Y1 - INFO_Y0)
-+
-+static void info_build(int film)
-+{
-+ const struct fos_film *f = &fos_films[film];
-+ const struct { const struct fos_font *font; int y; const char *s; int track; } part[3] =
-+ {
-+ { &fos_font_xs, BRAND_Y, f->brand, 64 },
-+ { &fos_font_xl, NAME_Y, f->name, 0 },
-+ { &fos_font_sm, DESC_Y, f->desc, 0 },
-+ };
-+ memset(info_mask, 0, FOS_W * INFO_H);
-+ info_x0 = FOS_W; info_x1 = 0;
-+ for (int i = 0; i < 3; i++)
-+ {
-+ uint8_t map[16];
-+ map[0] = 0;
-+ for (int v = 1; v < 16; v++) map[v] = (i + 1) << 4 | v;
-+ int w = fos_text_w(part[i].font, part[i].s, part[i].track);
-+ int x = 360 - w / 2;
-+ fos_text_map(info_mask, FOS_W, FOS_W, INFO_H, part[i].font, x, part[i].y - INFO_Y0, part[i].s, map, part[i].track);
-+ if (x - 4 < info_x0) info_x0 = fos_clamp(x - 4, 0, FOS_W);
-+ if (x + w + 4 > info_x1) info_x1 = fos_clamp(x + w + 4, 0, FOS_W);
-+ }
-+ for (int j = 0; j < INFO_H; j++)
-+ {
-+ const uint8_t *m = &info_mask[j * FOS_W];
-+ int a = info_x0, b = info_x1;
-+ while (a < b && !m[a]) a++;
-+ while (b > a && !m[b - 1]) b--;
-+ info_row0[j] = a; info_row1[j] = b;
-+ }
-+ info_film = film;
-+}
-+
-+/* the block at opacity alpha, moved xo px. Grey ink over the grey stage
-+ * blends as levels of one ramp, which is cheap; the few pixels of the
-+ * amber brand take the full blend. */
-+static void info_fade(int alpha, int xo)
-+{
-+ const fcol inks[4] = { 0, C_ACCENT, C_TEXT, C_TEXT2 };
-+ int ink_lv[4];
-+ for (int i = 1; i < 4; i++)
-+ ink_lv[i] = FC_RAMP(inks[i]) == RAMP_GRAY ? LV12(FC_LEVEL(inks[i])) : -1;
-+ const int mul = fos_ramp_mul[RAMP_GRAY], base = fos_ramp_base[RAMP_GRAY], last = fos_ramp_last[RAMP_GRAY];
-+ int ka = alpha * 17; /* coverage 15 at full opacity -> 255 */
-+ for (int j = 0; j < INFO_H; j++)
-+ {
-+ int y = INFO_Y0 + j;
-+ if (y < cv->cy0 || y >= cv->cy1) continue;
-+ int xa = fos_clamp(info_row0[j], cv->cx0 - xo, cv->cx1 - xo), xb = fos_clamp(info_row1[j], xa, cv->cx1 - xo);
-+ const uint8_t *m = &info_mask[j * FOS_W];
-+ uint8_t *row = &cv->px[y * cv->pitch + xo];
-+ uint8_t bay[4];
-+ for (int k = 0; k < 4; k++)
-+ bay[k] = fos_bayer[y & 3][(k + xo) & 3];
-+ for (int x = xa; x < xb; x++)
-+ {
-+ int v = m[x];
-+ if (!v) continue;
-+ int op = ((v & 15) * ka) >> 8;
-+ int k = v >> 4, d = row[x];
-+ if (ink_lv[k] >= 0 && fos_rev_ramp[d] == RAMP_GRAY)
-+ {
-+ int lv = fos_rev_lv[d] + (((ink_lv[k] - fos_rev_lv[d]) * op) >> 8);
-+ int q = (((lv * mul) >> 16) + bay[x & 3]) >> 4;
-+ row[x] = base + (q > last ? last : q);
-+ }
-+ else
-+ row[x] = fos_mix(d, FC_RAMP(inks[k]), LV12(FC_LEVEL(inks[k])), op);
-+ }
-+ }
-+}
-+
-+static void draw_info()
-+{
-+ int place = (int) (pos.x + 100.5f) - 100;
-+ place = fos_clamp(place, 0, nlist - 1);
-+ int ni = list[place];
-+ float frac = pos.x - place;
-+ float a = clampf(1 - absf(frac) * 2.2f, 0, 1) * (1 - drop.x);
-+ a = a * a * (3 - 2 * a);
-+ int alpha = (int) (a * 256);
-+ int xo = (int) (-frac * 70);
-+ const struct fos_film *f = &fos_films[ni];
-+
-+ if (alpha > 0)
-+ {
-+ if (!info_mask) info_mask = fos_port_alloc(FOS_W * INFO_H);
-+ if (alpha < OPAQUE && info_mask)
-+ {
-+ if (info_film != ni) info_build(ni);
-+ info_fade(alpha, xo);
-+ }
-+ else
-+ {
-+ fos_text_c(cv, &fos_font_xs, 360 + xo, BRAND_Y, f->brand, C_ACCENT, alpha, 64);
-+ fos_text_c(cv, &fos_font_xl, 360 + xo, NAME_Y, f->name, C_TEXT, alpha, 0);
-+ fos_text_c(cv, &fos_font_sm, 360 + xo, DESC_Y, f->desc, C_TEXT2, alpha, 0);
-+ }
-+ char b[16];
-+ snprintf(b, sizeof(b), "%d", f->box_iso);
-+ fos_text(cv, &fos_font_mdb, chip_vx[0], CHIPS_Y + 19, b, C_TEXT, alpha, 0);
-+ fos_text(cv, &fos_font_mdb, chip_vx[1], CHIPS_Y + 19, f->process, C_TEXT, alpha, 0);
-+ }
-+
-+ /* exposures: the number rolls up or down when it changes */
-+ struct fos_canvas save = *cv;
-+ fos_clip(cv, chip_vx[2] - 4, CHIPS_Y + 3, chip_x[2] + chip_w[2] - 8, CHIPS_Y + CHIP_H - 3);
-+ char nb[8], ob[8];
-+ snprintf(nb, sizeof(nb), "%d", fos_exposure_choices[exp_sel]);
-+ snprintf(ob, sizeof(ob), "%d", fos_exposure_choices[exp_prev]);
-+ int dy = (int) ((1 - exp_roll.x) * 20);
-+ fos_text(cv, &fos_font_mdb, chip_vx[2], CHIPS_Y + 19 + dy, nb, C_ACCENT, OPAQUE, 0);
-+ if (exp_roll.x < 1)
-+ fos_text(cv, &fos_font_mdb, chip_vx[2], CHIPS_Y + 19 + dy - 20, ob, C_ACCENT, OPAQUE, 0);
-+ *cv = save;
-+}
-+
-+static void draw_sheet()
-+{
-+ char t[48], b[96];
-+ snprintf(t, sizeof(t), ui_realistic() ? "Rewind roll %03d?" : "Finish roll %03d?", ui_roll.number);
-+ snprintf(b, sizeof(b), "%d of %d frames on %s are still unexposed. They will be lost.",
-+ ui_roll.exposures - ui_roll.shot, ui_roll.exposures, fos_films[ui_roll.film].name);
-+ ui_sheet(sheet.x, t, b, ui_realistic() ? "Rewind and load" : "Finish and load", "Keep shooting");
-+}
-+
-+/* SET: the leader is drawn out of the canister across the stage, the
-+ * other stocks step aside, and the roll number is stamped */
-+static void draw_loading()
-+{
-+ float t = load_t;
-+ float aside = ease_in_out(clampf(t / 450.0f, 0, 1));
-+ float lift = 10 * ease_out(clampf(t / 400.0f, 0, 1));
-+ float pull = ease_in_out(clampf((t - 250) / 850.0f, 0, 1));
-+ int leader = 256 + (int) (pull * 256 * 7);
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ /* the chips and dots fade away with the other stocks */
-+ if (aside < 1) draw_static((int) (256 * (1 - aside)));
-+ draw_canisters(lift, 1 + aside * 0.8f, aside, leader);
-+
-+ float ta = ease_out(clampf((t - 900) / 450.0f, 0, 1));
-+ if (ta > 0)
-+ {
-+ int a = (int) (ta * 256);
-+ char b[48];
-+ snprintf(b, sizeof(b), "ROLL %03d", ui_roll.number);
-+ fos_text_c(cv, &fos_font_xs, 360, BRAND_Y + 8, b, C_ACCENT, a, 64);
-+ fos_text_c(cv, &fos_font_xl, 360, NAME_Y + 8 - (int) ((1 - ta) * 12), "Loaded", C_TEXT, a, 0);
-+ snprintf(b, sizeof(b), "%s " T_DOT " %d exposures", fos_films[list[target]].name, fos_exposure_choices[exp_sel]);
-+ fos_text_c(cv, &fos_font_sm, 360, DESC_Y + 8, b, C_TEXT2, a, 0);
-+ }
-+}
-+
-+void shelf_draw()
-+{
-+ if (sm_state != SM_OFF)
-+ {
-+ sample_draw();
-+ return;
-+ }
-+ if (loading)
-+ {
-+ draw_loading();
-+ return;
-+ }
-+ if (ui_clobbered || sheet.x > 0 || sheet_drawn)
-+ {
-+ ui_clobbered = 0;
-+ ui_damage_all();
-+ ui_bg_restore(0, 0, FOS_W, FOS_H);
-+ }
-+ else
-+ {
-+ /* the status bar and the key hints never move here */
-+ ui_bg_restore(0, MOVING_Y0, FOS_W, MOVING_Y1 - MOVING_Y0);
-+ ui_damage(MOVING_Y0, MOVING_Y1);
-+ }
-+ draw_canisters(0, 1, 0, 0);
-+ draw_dot_marker();
-+ draw_info();
-+ draw_sheet();
-+ sheet_drawn = sheet.x > 0;
-+}
-diff --git a/src/fos_ui.c b/src/fos_ui.c
-new file mode 100644
-index 000000000..03cf98f4c
---- /dev/null
-+++ b/src/fos_ui.c
-@@ -0,0 +1,942 @@
-+/* fos_ui: the loop, navigation, transitions and shared widgets of the
-+ * film OS. The screens themselves are in fos_shelf.c and fos_pages.c.
-+ *
-+ * One loop reads keys, steps every animation by the time that really
-+ * passed and redraws only while something moves, so a quiet screen costs
-+ * nothing. Screens draw into our own canvas; the port copies the rows
-+ * that changed to the camera's bitmap overlay.
-+ */
-+
-+#include "fos_ui.h"
-+#include "fos_dev.h"
-+#include <string.h>
-+
-+struct fos_canvas *cv;
-+uint8_t *ui_bg;
-+int ui_now;
-+struct fos_roll ui_roll;
-+int ui_clobbered = 1;
-+int ui_cans_ms;
-+
-+static struct fos_canvas canvas;
-+static uint8_t *buf_cv, *buf_bg, *buf_snap;
-+
-+static int screen, screen_from;
-+static int dmg_y0 = FOS_H, dmg_y1 = 0;
-+
-+/* screen change in progress */
-+static int tr_how, tr_t, tr_len; /* tr_t counts up to tr_len (ms) */
-+static int leaving; /* 1 while the shutter opens on LiveView */
-+static int leave_t;
-+static int quit;
-+static int boot_then_leave;
-+
-+/* opening: the shutter closes over LiveView, then opens on us */
-+static int enter_t;
-+#define ENTER_LEN 420
-+#define LEAVE_LEN 380
-+
-+/* the toast */
-+static char toast_msg[80];
-+static int toast_t = 100000;
-+#define TOAST_LEN 1800
-+
-+/* held keys repeat */
-+static int held_key, held_since, held_last;
-+
-+/* ---------------------------------------------------------------- animation */
-+
-+float clampf(float v, float lo, float hi) { return v < lo ? lo : v > hi ? hi : v; }
-+
-+float ease_out(float t)
-+{
-+ t = clampf(t, 0, 1);
-+ float u = 1 - t;
-+ return 1 - u * u * u;
-+}
-+
-+float ease_in_out(float t)
-+{
-+ t = clampf(t, 0, 1);
-+ return t < 0.5f ? 4 * t * t * t : 1 - (-2 * t + 2) * (-2 * t + 2) * (-2 * t + 2) / 2;
-+}
-+
-+int spring_step(struct spring *s, float target, int dt, float hz, float zeta)
-+{
-+ float w = 6.2831853f * hz;
-+ while (dt > 0)
-+ {
-+ float h = (dt > 8 ? 8 : dt) / 1000.0f;
-+ float a = w * w * (target - s->x) - 2 * zeta * w * s->v;
-+ s->v += a * h;
-+ s->x += s->v * h;
-+ dt -= 8;
-+ }
-+ float d = target - s->x;
-+ if (d < 0.0015f && d > -0.0015f && s->v < 0.02f && s->v > -0.02f)
-+ {
-+ s->x = target;
-+ s->v = 0;
-+ return 0;
-+ }
-+ return 1;
-+}
-+
-+/* ---------------------------------------------------------------- damage */
-+
-+void ui_damage(int y0, int y1)
-+{
-+ if (y0 < dmg_y0) dmg_y0 = fos_clamp(y0, 0, FOS_H);
-+ if (y1 > dmg_y1) dmg_y1 = fos_clamp(y1, 0, FOS_H);
-+}
-+
-+void ui_damage_all()
-+{
-+ ui_damage(0, FOS_H);
-+}
-+
-+void fos_ui_overdrawn()
-+{
-+ ui_clobbered = 1;
-+ ui_damage_all();
-+}
-+
-+/* ---------------------------------------------------------------- widgets */
-+
-+void ui_bg_restore(int x, int y, int w, int h)
-+{
-+ x = fos_clamp(x, 0, FOS_W); y = fos_clamp(y, 0, FOS_H);
-+ w = fos_clamp(w, 0, FOS_W - x); h = fos_clamp(h, 0, FOS_H - y);
-+ for (int j = y; j < y + h; j++)
-+ memcpy(&cv->px[j * cv->pitch + x], &ui_bg[j * FOS_W + x], w);
-+}
-+
-+/* static parts of a screen are drawn once into its background */
-+void ui_to_bg(int on)
-+{
-+ static struct fos_canvas bgcv, *saved;
-+ if (on && cv != &bgcv)
-+ {
-+ saved = cv;
-+ fos_canvas_init(&bgcv, ui_bg, FOS_W, FOS_W, FOS_H);
-+ cv = &bgcv;
-+ }
-+ else if (!on && cv == &bgcv)
-+ cv = saved;
-+}
-+
-+/* a dark backdrop with a little light from above */
-+static int plain_lv(int x, int y)
-+{
-+ int dx = (x - 360) * 2 / 3, dy = y - 40;
-+ int d2 = (dx * dx + dy * dy) >> 6; /* soft pool of light */
-+ return LV12(9) + (d2 < 2400 ? (2400 - d2) * LV12(9) / 2400 : 0);
-+}
-+
-+static uint8_t *buf_plain; /* the backdrop, worked out once a session */
-+
-+void ui_bg_plain()
-+{
-+ if (buf_plain)
-+ {
-+ memcpy(ui_bg, buf_plain, FOS_W * FOS_H);
-+ return;
-+ }
-+ /* the light changes slowly: worked out on an 8 px grid, stepped between */
-+ const int mul = fos_ramp_mul[RAMP_GRAY];
-+ const int base = fos_ramp_base[RAMP_GRAY], last = fos_ramp_last[RAMP_GRAY];
-+ static int grid[2][FOS_W / 8 + 1];
-+ for (int i = 0; i <= FOS_W / 8; i++)
-+ grid[1][i] = plain_lv(i * 8, 0) * mul;
-+ for (int y = 0; y < FOS_H; y++)
-+ {
-+ if (!(y & 7))
-+ for (int i = 0; i <= FOS_W / 8; i++)
-+ {
-+ grid[0][i] = grid[1][i];
-+ grid[1][i] = plain_lv(i * 8, y + 8) * mul;
-+ }
-+ int fy = y & 7;
-+ uint8_t *row = &ui_bg[y * FOS_W];
-+ const uint8_t *bay = fos_bayer[y & 3];
-+ for (int x = 0, i = 0; x < FOS_W; x += 8, i++)
-+ {
-+ int p0 = grid[0][i] + ((grid[1][i] - grid[0][i]) >> 3) * fy;
-+ int p1 = grid[0][i + 1] + ((grid[1][i + 1] - grid[0][i + 1]) >> 3) * fy;
-+ int p = p0, dp = (p1 - p0) >> 3;
-+ for (int k = 0; k < 8; k++, p += dp)
-+ {
-+ int q = ((p >> 16) + bay[k & 3]) >> 4;
-+ row[x + k] = base + (q > last ? last : q);
-+ }
-+ }
-+ }
-+ /* keep it for the next page, if there is room */
-+ buf_plain = fos_port_alloc(FOS_W * FOS_H);
-+ if (buf_plain) memcpy(buf_plain, ui_bg, FOS_W * FOS_H);
-+}
-+
-+void ui_status_bar(const char *title)
-+{
-+ /* wordmark: a small aperture and the name */
-+ int y = 24;
-+ for (int i = 0; i < 6; i++)
-+ {
-+ int a = i * 65536 / 6 + 3000;
-+ int x0 = 26 * 256 + fos_cos(a) * 7 / 16, y0 = 18 * 256 + fos_sin(a) * 7 / 16;
-+ int x1 = 26 * 256 + fos_cos(a + 65536 / 6) * 7 / 16, y1 = 18 * 256 + fos_sin(a + 65536 / 6) * 7 / 16;
-+ fos_line(cv, x0, y0, x1, y1, 400, C_ACCENT, OPAQUE);
-+ }
-+ int x = fos_text(cv, &fos_font_xs, 42, y, FOS_NAME, C_TEXT2, OPAQUE, 40) + 42;
-+ if (title && *title)
-+ {
-+ fos_fill(cv, x + 12, 12, 1, 14, C_LINE);
-+ fos_text(cv, &fos_font_xs, x + 25, y, title, C_TEXT3, OPAQUE, 40);
-+ }
-+
-+ /* right: the roll in the camera and the time */
-+ char clock[16], buf[48];
-+ fos_port_clock(clock, sizeof(clock));
-+ int rx = FOS_W - 24;
-+ rx -= fos_text_r(cv, &fos_font_mdb, rx, y + 1, clock, C_TEXT, OPAQUE, 0) + 18;
-+ if (ui_roll.loaded)
-+ {
-+ int left = ui_roll.exposures - ui_roll.shot;
-+ if (left > 0)
-+ snprintf(buf, sizeof(buf), "%s %d/%d", fos_films[ui_roll.film].name, ui_roll.shot, ui_roll.exposures);
-+ else
-+ snprintf(buf, sizeof(buf), "%s END OF ROLL", fos_films[ui_roll.film].name);
-+ int w = fos_text_w(&fos_font_xs, buf, 16);
-+ fos_rrect(cv, rx - w - 24, 9, w + 24, 20, 10, C_PANEL, OPAQUE);
-+ fos_disc(cv, (rx - w - 14) * 256, 19 * 256, 3 * 256, left > 0 ? C_ACCENT : C_RED, OPAQUE);
-+ fos_text(cv, &fos_font_xs, rx - w - 6, y - 1, buf, C_TEXT2, OPAQUE, 16);
-+ }
-+}
-+
-+int ui_keycap(int x, int base, const char *key)
-+{
-+ /* arrows are drawn, words are written */
-+ int w;
-+ if (!strcmp(key, "<>") || !strcmp(key, "^v"))
-+ {
-+ w = 34;
-+ fos_rrect_line(cv, x, base - 15, w, 20, 6, 1, FC(RAMP_GRAY, 90), OPAQUE);
-+ int vert = key[0] == '^';
-+ fos_tri(cv, x + 11, base - 5, 7, vert ? 3 : 2, C_TEXT2, OPAQUE);
-+ fos_tri(cv, x + 23, base - 5, 7, vert ? 1 : 0, C_TEXT2, OPAQUE);
-+ return w;
-+ }
-+ w = fos_text_w(&fos_font_xs, key, 16) + 14;
-+ fos_rrect_line(cv, x, base - 15, w, 20, 6, 1, FC(RAMP_GRAY, 90), OPAQUE);
-+ fos_text(cv, &fos_font_xs, x + 7, base - 1, key, C_TEXT2, OPAQUE, 16);
-+ return w;
-+}
-+
-+static int keycap_w(const char *key)
-+{
-+ return !strcmp(key, "<>") || !strcmp(key, "^v") ? 34 : fos_text_w(&fos_font_xs, key, 16) + 14;
-+}
-+
-+void ui_hints(const struct hint *h, int n)
-+{
-+ int base = HINTS_Y + 23;
-+ /* the gap between hints closes up so the row fits the screen: with a
-+ * roll in progress the shelf's six ran off the right edge (#43) */
-+ int need = 0;
-+ for (int i = 0; i < n; i++)
-+ need += keycap_w(h[i].key) + 8 + fos_text_w(&fos_font_sm, h[i].label, 0);
-+ int gap = 22, room = FOS_W - 48 - need;
-+ if (n > 1 && room < gap * (n - 1)) gap = room / (n - 1);
-+ if (gap < 8) gap = 8;
-+ int x = 24;
-+ for (int i = 0; i < n; i++)
-+ {
-+ x += ui_keycap(x, base, h[i].key) + 8;
-+ x += fos_text(cv, &fos_font_sm, x, base - 1, h[i].label, C_TEXT3, OPAQUE, 0) + gap;
-+ }
-+}
-+
-+/* overlay text: coverage onto the panel greys, or the accent */
-+int ui_photo_text(const struct fos_font *f, int x, int y, const char *s, int accent, int align)
-+{
-+ static const uint8_t grey[16] = { 0, PX_G1, PX_G1, PX_G2, PX_G2, PX_G3, PX_G3, PX_G3, PX_G4, PX_G4,
-+ PX_G5, PX_G5, PX_G5, PX_WHITE, PX_WHITE, PX_WHITE };
-+ static const uint8_t amber[16] = { 0, PX_G1, PX_G1, PX_G2, PX_AMBER2, PX_AMBER2, PX_AMBER2, PX_AMBER2,
-+ PX_AMBER, PX_AMBER, PX_AMBER, PX_AMBER, PX_AMBER, PX_AMBER, PX_AMBER, PX_AMBER };
-+ int w = fos_text_w(f, s, accent ? 40 : 0);
-+ if (align == 1) x -= w / 2;
-+ else if (align == 2) x -= w;
-+ fos_text_map(cv->px, cv->pitch, FOS_W, FOS_H, f, x, y, s, accent ? amber : grey, accent ? 40 : 0);
-+ return w;
-+}
-+
-+void ui_dots(int x, int y, int n, int filled, fcol on)
-+{
-+ for (int i = 0; i < n; i++)
-+ {
-+ if (i < filled)
-+ fos_rrect(cv, x + i * 13, y, 10, 4, 2, on, OPAQUE);
-+ else
-+ fos_rrect(cv, x + i * 13, y, 10, 4, 2, FC(RAMP_GRAY, 46), OPAQUE);
-+ }
-+}
-+
-+void ui_toast(const char *msg)
-+{
-+ snprintf(toast_msg, sizeof(toast_msg), "%s", msg);
-+ toast_t = 0;
-+}
-+
-+int ui_toast_up()
-+{
-+ return toast_t < TOAST_LEN;
-+}
-+
-+static void toast_draw()
-+{
-+ if (toast_t >= TOAST_LEN) return;
-+ float in = clampf(toast_t / 180.0f, 0, 1), out = clampf((TOAST_LEN - toast_t) / 300.0f, 0, 1);
-+ float k = ease_out(in) * out;
-+ int a = (int) (k * 256);
-+ int w = fos_text_w(&fos_font_sm, toast_msg, 0) + 36;
-+ int y = HINTS_Y - 38 + (int) ((1 - ease_out(in)) * 10);
-+ fos_rrect(cv, 360 - w / 2, y, w, 32, 16, FC(RAMP_GRAY, 34), a);
-+ fos_rrect_line(cv, 360 - w / 2, y, w, 32, 16, 1, FC(RAMP_GRAY, 58), a);
-+ fos_text_c(cv, &fos_font_sm, 360, y + 21, toast_msg, C_TEXT, a, 0);
-+}
-+
-+void ui_sheet(float s, const char *title, const char *body, const char *yes, const char *no)
-+{
-+ ui_sheet3(s, title, body, yes, 0, no);
-+}
-+
-+void ui_sheet3(float s, const char *title, const char *body, const char *yes, const char *alt, const char *no)
-+{
-+ if (s <= 0.002f) return;
-+ int sh = 150;
-+ int y = FOS_H - (int) (sh * ease_out(s)) + 6;
-+ fos_scale_levels(cv, 0, 0, FOS_W, y + 18, (int) (256 - s * 130)); /* what shows above it */
-+ fos_rrect(cv, 12, y, FOS_W - 24, sh + 20, 18, FC(RAMP_GRAY, 24), OPAQUE);
-+ fos_rrect_line(cv, 12, y, FOS_W - 24, sh + 20, 18, 1, FC(RAMP_GRAY, 48), OPAQUE);
-+ fos_text(cv, &fos_font_lg, 40, y + 44, title, C_TEXT, OPAQUE, 0);
-+ fos_text(cv, &fos_font_sm, 40, y + 74, body, C_TEXT2, OPAQUE, 0);
-+ int base = y + 118;
-+ int x = 40;
-+ x += ui_keycap(x, base, "SET") + 8;
-+ x += fos_text(cv, &fos_font_md, x, base, yes, C_ACCENT, OPAQUE, 0) + 28;
-+ if (alt)
-+ {
-+ x += ui_keycap(x, base, "INFO") + 8;
-+ x += fos_text(cv, &fos_font_md, x, base, alt, C_TEXT, OPAQUE, 0) + 28;
-+ }
-+ x += ui_keycap(x, base, "MENU") + 8;
-+ fos_text(cv, &fos_font_md, x, base, no, C_TEXT2, OPAQUE, 0);
-+}
-+
-+/* small line icons, about 26 px */
-+void ui_icon(int kind, int cx, int cy, fcol c, int a)
-+{
-+ int X = cx * 256, Y = cy * 256;
-+ int w = 2 * 256;
-+ switch (kind)
-+ {
-+ case ICON_FILM: /* a canister from the side, leader out */
-+ fos_rrect_line(cv, cx - 8, cy - 10, 13, 21, 3, 2, c, a);
-+ fos_fill(cv, cx - 5, cy - 13, 7, 3, c);
-+ fos_rrect(cv, cx + 5, cy - 4, 8, 9, 1, c, a);
-+ break;
-+ case ICON_ROLL: /* a strip of two frames */
-+ fos_rrect_line(cv, cx - 12, cy - 9, 24, 18, 2, 2, c, a);
-+ for (int i = 0; i < 4; i++)
-+ {
-+ fos_fill(cv, cx - 9 + i * 6, cy - 7, 3, 2, c);
-+ fos_fill(cv, cx - 9 + i * 6, cy + 5, 3, 2, c);
-+ }
-+ fos_fill(cv, cx - 1, cy - 4, 2, 8, c);
-+ break;
-+ case ICON_FINDER: /* the focusing screen */
-+ fos_rrect_line(cv, cx - 12, cy - 9, 24, 18, 2, 2, c, a);
-+ fos_ring(cv, X, Y, 5 * 256, w, c, a);
-+ fos_line(cv, X - 5 * 256, Y, X + 5 * 256, Y, 300, c, a);
-+ break;
-+ case ICON_LENS: /* an aperture */
-+ for (int i = 0; i < 6; i++)
-+ {
-+ int t = i * 65536 / 6 + 4000;
-+ fos_line(cv, X + fos_cos(t) * 11 / 16, Y + fos_sin(t) * 11 / 16,
-+ X + fos_cos(t + 65536 / 6) * 11 / 16, Y + fos_sin(t + 65536 / 6) * 11 / 16, w, c, a);
-+ fos_line(cv, X + fos_cos(t) * 11 / 16, Y + fos_sin(t) * 11 / 16,
-+ X + fos_cos(t + 65536 / 3) * 5 / 16, Y + fos_sin(t + 65536 / 3) * 5 / 16, 350, c, a);
-+ }
-+ break;
-+ case ICON_PRINTS: /* two prints, the front one with a hill and a sun */
-+ fos_fill(cv, cx - 13, cy - 11, 2, 14, c);
-+ fos_fill(cv, cx - 13, cy - 11, 18, 2, c);
-+ fos_rrect_line(cv, cx - 8, cy - 6, 21, 16, 2, 2, c, a);
-+ fos_tri(cv, cx + 1, cy + 5, 7, 3, c, a);
-+ fos_disc(cv, (cx + 8) * 256, (cy - 1) * 256, 2 * 256, c, a);
-+ break;
-+ case ICON_SYSTEM: /* a gear */
-+ fos_ring(cv, X, Y, 7 * 256, 3 * 256, c, a);
-+ for (int i = 0; i < 8; i++)
-+ {
-+ int t = i * 65536 / 8;
-+ fos_line(cv, X + fos_cos(t) * 8 / 16, Y + fos_sin(t) * 8 / 16,
-+ X + fos_cos(t) * 12 / 16, Y + fos_sin(t) * 12 / 16, 3 * 256, c, a);
-+ }
-+ break;
-+ }
-+}
-+
-+/* ---------------------------------------------------------------- the aperture */
-+
-+#define BLADES 7
-+
-+/* the blades around an opening of radius r px centred on (cx8, cy8):
-+ * each blade is the region beyond one edge of the opening, wedged between
-+ * the extended edges of its neighbours */
-+static void blades(int cx8, int cy8, int r, int angle, int reach, int shade0)
-+{
-+ int vx[BLADES], vy[BLADES], dx[BLADES], dy[BLADES];
-+ for (int k = 0; k < BLADES; k++)
-+ {
-+ int a = angle + k * 65536 / BLADES;
-+ vx[k] = cx8 + fos_cos(a) * r / 16;
-+ vy[k] = cy8 + fos_sin(a) * r / 16;
-+ }
-+ for (int k = 0; k < BLADES; k++)
-+ {
-+ int j = (k + 1) % BLADES;
-+ int ex = (vx[j] - vx[k]) >> 8, ey = (vy[j] - vy[k]) >> 8;
-+ int len = fos_isqrt((unsigned) (ex * ex + ey * ey));
-+ if (!len)
-+ {
-+ /* fully closed: edge directions from the angle alone */
-+ int a = angle + k * 65536 / BLADES + 65536 / 4 + 65536 / (2 * BLADES);
-+ dx[k] = fos_cos(a); dy[k] = fos_sin(a);
-+ }
-+ else { dx[k] = ex * 4096 / len; dy[k] = ey * 4096 / len; }
-+ }
-+ for (int k = 0; k < BLADES; k++)
-+ {
-+ int p = (k + BLADES - 1) % BLADES;
-+ int pts[6] = {
-+ vx[k], vy[k],
-+ vx[k] + dx[k] * reach / 16, vy[k] + dy[k] * reach / 16,
-+ vx[k] + dx[p] * reach / 16, vy[k] + dy[p] * reach / 16,
-+ };
-+ int shade = shade0 + (k * 37 % 7) * 2;
-+ fos_convex(cv, pts, 3, FC(RAMP_METAL, shade), OPAQUE);
-+ }
-+ /* a lit edge on every blade, and a shadow where blades overlap */
-+ for (int k = 0; k < BLADES; k++)
-+ {
-+ int j = (k + 1) % BLADES;
-+ int p = (k + BLADES - 1) % BLADES;
-+ if (r > 2)
-+ fos_line(cv, vx[k], vy[k], vx[j], vy[j], 384, FC(RAMP_METAL, shade0 + 72), OPAQUE);
-+ /* the shadow fades into the blades: only near the opening */
-+ int sl = reach < 2 * r + 60 ? reach : 2 * r + 60;
-+ fos_line(cv, vx[k], vy[k], vx[k] + dx[p] * sl / 16, vy[k] + dy[p] * sl / 16,
-+ 300, FC(RAMP_METAL, shade0 / 3), OPAQUE);
-+ }
-+}
-+
-+void ui_iris(int open, int angle)
-+{
-+ if (open >= 4096) return;
-+ /* opening radius: 0 .. a bit past the corners */
-+ blades(360 * 256, 240 * 256, (int) ((int64_t) 450 * open / 4096), angle, 1400, 20);
-+}
-+
-+void ui_aperture(int cx, int cy, int R, int open, int angle)
-+{
-+ struct fos_canvas save = *cv;
-+ fos_clip(cv, cx - R - 2, cy - R - 2, cx + R + 3, cy + R + 3);
-+ blades(cx * 256 + 128, cy * 256 + 128, R * open / 4096, angle, 2 * R + 24, 24);
-+ /* outside the barrel the background comes back, with a soft edge */
-+ int in = (R * 16 - 8) * (R * 16 - 8), out = (R * 16 + 8) * (R * 16 + 8);
-+ for (int y = cv->cy0; y < cv->cy1; y++)
-+ {
-+ int dy = (y - cy) * 16;
-+ /* |x - cx| <= xi: inside the opening; >= xo: background only */
-+ int xi = dy * dy < in ? fos_isqrt(in - dy * dy) >> 4 : -1;
-+ int xo = dy * dy < out ? (fos_isqrt(out - dy * dy) >> 4) + 1 : 0;
-+ for (int x = cv->cx0; x < cv->cx1; x++)
-+ {
-+ int ax = x < cx ? cx - x : x - cx;
-+ if (ax <= xi) { x = cx + xi; continue; }
-+ if (ax >= xo) { cv->px[y * cv->pitch + x] = ui_bg[y * FOS_W + x]; continue; }
-+ int dx = (x - cx) * 16;
-+ int d2 = dx * dx + dy * dy;
-+ if (d2 <= in) continue;
-+ int d = fos_isqrt(d2) - R * 16; /* 1/16 px outside */
-+ int a = fos_clamp(128 + d * 16, 0, 256);
-+ uint8_t bg = ui_bg[y * FOS_W + x];
-+ uint8_t *p = &cv->px[y * cv->pitch + x];
-+ if (a >= 256) *p = bg;
-+ else
-+ {
-+ fcol c = fos_colour_of(bg);
-+ *p = fos_mix(*p, FC_RAMP(c), LV12(FC_LEVEL(c)), a);
-+ }
-+ }
-+ }
-+ *cv = save;
-+ /* the barrel */
-+ fos_ring(cv, cx * 256 + 128, cy * 256 + 128, R * 256 + 256, 3 * 256, FC(RAMP_METAL, 70), OPAQUE);
-+ fos_ring(cv, cx * 256 + 128, cy * 256 + 128, R * 256 + 3 * 256, 2 * 256, FC(RAMP_METAL, 28), OPAQUE);
-+}
-+
-+/* ---------------------------------------------------------------- boot */
-+
-+/* power on: a lens aperture opens on the name */
-+static void boot_draw(int t)
-+{
-+ if (t <= 40)
-+ memset(ui_bg, fos_ix(FC(RAMP_GRAY, 6)), FOS_W * FOS_H);
-+ fos_fill(cv, 0, 0, FOS_W, FOS_H, FC(RAMP_GRAY, 6));
-+ float k = clampf((t - 150) / 900.0f, 0, 1);
-+ float e = ease_out(k);
-+ int open = (int) (60 + e * 2200);
-+ ui_aperture(360, 186, 50, open, 2000 + (int) (e * 7000));
-+ /* a warm glint through the opening */
-+ fos_disc(cv, 360 * 256, 186 * 256, (int) (open * 50 / 4096) * 200, C_ACCENT, (int) (e * 120));
-+ float tk = clampf((t - 450) / 700.0f, 0, 1);
-+ int a = (int) (ease_out(tk) * 256);
-+ int track = (int) (160 - 96 * ease_out(tk));
-+ fos_text_c(cv, &fos_font_lg, 360, 290, FOS_NAME, C_TEXT, a, track);
-+ fos_text_c(cv, &fos_font_xs, 360, 318, "35 MM FILM SYSTEM", C_TEXT3, (int) (ease_out(clampf((t - 750) / 600.0f, 0, 1)) * 256), 48);
-+ ui_damage_all();
-+}
-+
-+/* ---------------------------------------------------------------- navigation */
-+
-+void ui_go(int to, int arg, int how)
-+{
-+ /* keep what is on screen now; the new screen slides over it */
-+ memcpy(buf_snap, cv->px, FOS_W * FOS_H);
-+ screen_from = screen;
-+ if (screen == SCR_SHELF) shelf_leave();
-+ if (screen == SCR_DEVELOP) develop_leave();
-+ if (screen == SCR_PRINTS) prints_leave();
-+ screen = to;
-+ tr_how = how;
-+ tr_t = 0;
-+ tr_len = how == GO_FADE ? 520 : 340;
-+ ui_clobbered = 1; /* the new screen starts from nothing */
-+ switch (to)
-+ {
-+ case SCR_SHELF: shelf_enter(arg); break;
-+ case SCR_HOME: home_enter(arg); break;
-+ case SCR_PAGE: page_enter(arg); break;
-+ case SCR_ROLL: roll_enter(arg); break;
-+ case SCR_DARK: dark_enter(arg); break;
-+ case SCR_DEVELOP: develop_enter(arg); break;
-+ case SCR_PRINTS: prints_enter(arg); break;
-+ }
-+ ui_damage_all();
-+}
-+
-+int ui_settled()
-+{
-+ return !(tr_len && tr_t < tr_len) && !leaving && enter_t >= ENTER_LEN;
-+}
-+
-+int ui_from()
-+{
-+ return screen_from;
-+}
-+
-+void ui_leave()
-+{
-+ if (leaving) return;
-+ leaving = 1;
-+ leave_t = 0;
-+}
-+
-+/* ---------------------------------------------------------------- the loop */
-+
-+static void screen_key(int k)
-+{
-+ switch (screen)
-+ {
-+ case SCR_BOOT:
-+ if (boot_then_leave) ui_leave();
-+ else ui_go(SCR_SHELF, 0, GO_FADE);
-+ break;
-+ case SCR_SHELF: shelf_key(k); break;
-+ case SCR_HOME: home_key(k); break;
-+ case SCR_PAGE: page_key(k); break;
-+ case SCR_ROLL: roll_key(k); break;
-+ case SCR_DARK: dark_key(k); break;
-+ case SCR_DEVELOP: develop_key(k); break;
-+ case SCR_PRINTS: prints_key(k); break;
-+ }
-+}
-+
-+static int screen_update(int dt)
-+{
-+ switch (screen)
-+ {
-+ case SCR_SHELF: return shelf_update(dt);
-+ case SCR_HOME: return home_update(dt);
-+ case SCR_PAGE: return page_update(dt);
-+ case SCR_ROLL: return roll_update(dt);
-+ case SCR_DARK: return dark_update(dt);
-+ case SCR_DEVELOP: return develop_update(dt);
-+ case SCR_PRINTS: return prints_update(dt);
-+ }
-+ return 0;
-+}
-+
-+static void screen_draw()
-+{
-+ switch (screen)
-+ {
-+ case SCR_SHELF: shelf_draw(); break;
-+ case SCR_HOME: home_draw(); break;
-+ case SCR_PAGE: page_draw(); break;
-+ case SCR_ROLL: roll_draw(); break;
-+ case SCR_DARK: dark_draw(); break;
-+ case SCR_DEVELOP: develop_draw(); break;
-+ case SCR_PRINTS: prints_draw(); break;
-+ }
-+}
-+
-+/* the screen change: the old frame (snapshot) and the new one, composed a
-+ * row at a time straight into the presented rows */
-+static uint8_t row_buf[FOS_W];
-+static uint8_t dim_lut[256];
-+
-+/* row_buf[x0..x1): the dimmed layer where it has pixels (u0..u1), else bg */
-+static void dim_run(uint8_t *row, const uint8_t *urow, int x0, int x1, int u0, int u1, uint8_t bg)
-+{
-+ int a = fos_clamp(u0, x0, x1), b = fos_clamp(u1, a, x1);
-+ memset(row + x0, bg, a - x0);
-+ int x = a;
-+ for (; x + 4 <= b; x += 4)
-+ {
-+ row[x] = dim_lut[urow[x]];
-+ row[x + 1] = dim_lut[urow[x + 1]];
-+ row[x + 2] = dim_lut[urow[x + 2]];
-+ row[x + 3] = dim_lut[urow[x + 3]];
-+ }
-+ for (; x < b; x++)
-+ row[x] = dim_lut[urow[x]];
-+ memset(row + b, bg, x1 - b);
-+}
-+
-+static void present_transition(float t)
-+{
-+ float e = ease_out(t);
-+ int how = tr_how;
-+ int shift_new, shift_old, dim;
-+ if (how == GO_PUSH) { shift_new = (int) ((1 - e) * FOS_W); shift_old = -(int) (e * FOS_W * 0.3f); dim = (int) (256 - e * 150); }
-+ else if (how == GO_POP) { shift_new = -(int) ((1 - e) * FOS_W * 0.3f); shift_old = (int) (e * FOS_W); dim = (int) (106 + e * 150); }
-+ else { shift_new = 0; shift_old = 0; dim = 0; }
-+
-+ if (how == GO_FADE)
-+ {
-+ /* dip: the old screen sinks into the dark, the new one rises from it */
-+ int k = t < 0.45f ? (int) ((1 - t / 0.45f) * 256) : (int) (ease_out((t - 0.45f) / 0.55f) * 256);
-+ const uint8_t *src = t < 0.45f ? buf_snap : cv->px;
-+ for (int i = 0; i < 256; i++)
-+ {
-+ fcol c = fos_colour_of(i);
-+ dim_lut[i] = fos_ix(FC(FC_RAMP(c), FC_LEVEL(c) * k / 256));
-+ }
-+ for (int y = 0; y < FOS_H; y++)
-+ {
-+ for (int x = 0; x < FOS_W; x++)
-+ row_buf[x] = dim_lut[src[y * FOS_W + x]];
-+ fos_port_present(row_buf, FOS_W, y, y + 1);
-+ }
-+ return;
-+ }
-+
-+ for (int i = 0; i < 256; i++)
-+ {
-+ fcol c = fos_colour_of(i);
-+ dim_lut[i] = fos_ix(FC(FC_RAMP(c), FC_LEVEL(c) * dim / 256));
-+ }
-+ const uint8_t *top = how == GO_PUSH ? cv->px : buf_snap; /* the sliding layer */
-+ const uint8_t *under = how == GO_PUSH ? buf_snap : cv->px;
-+ int shift_top = how == GO_PUSH ? shift_new : shift_old;
-+ int shift_under = how == GO_PUSH ? shift_old : shift_new;
-+ uint8_t bg = fos_ix(C_BG);
-+ /* the sliding layer covers [t0, t1); the dimmed one shows elsewhere
-+ * where it has pixels, [u0, u1) */
-+ int t0 = fos_clamp(shift_top, 0, FOS_W), t1 = fos_clamp(shift_top + FOS_W, 0, FOS_W);
-+ int u0 = fos_clamp(shift_under, 0, FOS_W), u1 = fos_clamp(shift_under + FOS_W, 0, FOS_W);
-+ for (int y = 0; y < FOS_H; y++)
-+ {
-+ const uint8_t *trow = top + y * FOS_W, *urow = under + y * FOS_W - shift_under;
-+ dim_run(row_buf, urow, 0, t0, u0, u1, bg);
-+ dim_run(row_buf, urow, t1, FOS_W, u0, u1, bg);
-+ if (t1 > t0)
-+ memcpy(row_buf + t0, trow + (t0 - shift_top), t1 - t0);
-+ /* a soft shadow on the edge of the sliding layer */
-+ for (int s = 1; s <= 10; s++)
-+ {
-+ int x = shift_top - s;
-+ if (x >= 0 && x < FOS_W)
-+ {
-+ fcol c = fos_colour_of(row_buf[x]);
-+ row_buf[x] = fos_ix(FC(FC_RAMP(c), FC_LEVEL(c) * (156 + s * 10) / 256));
-+ }
-+ }
-+ fos_port_present(row_buf, FOS_W, y, y + 1);
-+ }
-+}
-+
-+static int ui_alloc()
-+{
-+ buf_cv = fos_port_alloc(FOS_W * FOS_H);
-+ buf_bg = fos_port_alloc(FOS_W * FOS_H);
-+ buf_snap = fos_port_alloc(FOS_W * FOS_H);
-+ if (!buf_cv || !buf_bg || !buf_snap)
-+ {
-+ fos_port_free(buf_cv); fos_port_free(buf_bg); fos_port_free(buf_snap);
-+ buf_cv = buf_bg = buf_snap = 0;
-+ return 0;
-+ }
-+ fos_canvas_init(&canvas, buf_cv, FOS_W, FOS_W, FOS_H);
-+ cv = &canvas;
-+ ui_bg = buf_bg;
-+ return 1;
-+}
-+
-+static void ui_free()
-+{
-+ ui_cans_free();
-+ fos_port_free(buf_plain);
-+ buf_plain = 0;
-+ fos_port_free(buf_cv); fos_port_free(buf_bg); fos_port_free(buf_snap);
-+ buf_cv = buf_bg = buf_snap = 0;
-+}
-+
-+void fos_ui_init()
-+{
-+ fos_gfx_init();
-+}
-+
-+/* how long frames take: drawing, copying to the screen, and the rest
-+ * between them. A slow camera gets simpler canisters rather than a
-+ * stuttering shelf. */
-+static struct fos_stat stat;
-+static int stat_since, frame_end;
-+
-+static void frame_stats(int draw_ms, int present_ms)
-+{
-+ static int slow, quick;
-+ stat.frames++;
-+ stat.cans_ms += ui_cans_ms;
-+ ui_cans_ms = 0;
-+ stat.draw_ms += draw_ms;
-+ stat.present_ms += present_ms;
-+ if (draw_ms + present_ms > stat.worst_ms) stat.worst_ms = draw_ms + present_ms;
-+ frame_end = fos_port_ms();
-+ if (ui_now - stat_since < 1000) return;
-+ fos_port_stat(&stat);
-+ int avg = (stat.draw_ms + stat.present_ms) / stat.frames;
-+ if (avg > 50) { slow++; quick = 0; }
-+ else if (avg < 26) { quick++; slow = 0; }
-+ else slow = quick = 0;
-+ if (slow >= 1 && fos_can_quality > 0) { fos_can_quality--; slow = 0; }
-+ if (quick >= 3 && fos_can_quality < 2) { fos_can_quality++; quick = 0; }
-+ memset(&stat, 0, sizeof(stat));
-+ stat_since = ui_now;
-+}
-+
-+/* while animating: rest what is left of a frame (about 35 a second), but
-+ * always a little, so the camera's own tasks get to run */
-+#define FRAME_PERIOD 28
-+static int frame_rest(int frame_start)
-+{
-+ return fos_clamp(FRAME_PERIOD - (fos_port_ms() - frame_start), 1, 10);
-+}
-+
-+static int is_repeating(int k)
-+{
-+ return k == FK_LEFT || k == FK_RIGHT || k == FK_UP || k == FK_DOWN;
-+}
-+
-+void fos_ui_run(int open)
-+{
-+ int t_open = fos_port_ms();
-+ if (!ui_alloc())
-+ return;
-+ fos_port_roll(&ui_roll);
-+ quit = 0;
-+ leaving = 0;
-+ held_key = 0;
-+ toast_t = TOAST_LEN;
-+ screen = SCR_NONE;
-+ screen_from = SCR_NONE;
-+ enter_t = 0;
-+
-+ /* what is under the shutter while it closes: LiveView */
-+ memset(buf_cv, IX_CLEAR, FOS_W * FOS_H);
-+ ui_clobbered = 1;
-+ fos_port_palette();
-+
-+ boot_then_leave = open == FOS_OPEN_BOOT_LV;
-+ if (open == FOS_OPEN_BOOT || open == FOS_OPEN_BOOT_LV)
-+ screen = SCR_BOOT, enter_t = ENTER_LEN;
-+ else
-+ {
-+ switch (open)
-+ {
-+ case FOS_OPEN_HOME: screen = SCR_HOME; home_enter(0); break;
-+ case FOS_OPEN_PRINTS: screen = SCR_PRINTS; prints_enter(PRINTS_ALONE); break;
-+ case FOS_OPEN_END: screen = SCR_ROLL; roll_enter(1); break;
-+ case FOS_OPEN_DARKROOM: screen = SCR_DARK; dark_enter(0); break;
-+ default: screen = SCR_SHELF; shelf_enter(0); break;
-+ }
-+ }
-+ tr_how = 0; tr_t = tr_len = 0;
-+
-+ int last = fos_port_ms();
-+ int boot_t = 0;
-+ int opened = 0;
-+ memset(&stat, 0, sizeof(stat));
-+ stat_since = frame_end = 0;
-+ while (!quit)
-+ {
-+ int now = fos_port_ms();
-+ int dt = fos_clamp(now - last, 0, 60);
-+ last = now;
-+ /* the rest after the last animated frame, slept or taken by others */
-+ if (frame_end) { stat.rest_ms += now - frame_end; frame_end = 0; }
-+ ui_now = now;
-+
-+ if (fos_port_abort())
-+ break;
-+
-+ /* keys, with auto-repeat for held arrows */
-+ int k;
-+ while ((k = fos_port_key()) != FK_NONE)
-+ {
-+ if (k & FK_RELEASE)
-+ {
-+ if ((k & 0xFF) == held_key) held_key = 0;
-+ continue;
-+ }
-+ if (is_repeating(k)) { held_key = k; held_since = now; held_last = now; }
-+ if (leaving || enter_t < ENTER_LEN) continue;
-+ screen_key(k);
-+ }
-+ /* a release that never came must not scroll forever */
-+ if (held_key && now - held_since > 3000)
-+ held_key = 0;
-+ if (held_key && now - held_since > 420 && now - held_last > 95 && !leaving)
-+ {
-+ held_last = now;
-+ screen_key(held_key);
-+ }
-+
-+ int moving = 0;
-+ if (screen == SCR_BOOT)
-+ {
-+ boot_t += dt;
-+ boot_draw(boot_t);
-+ moving = 1;
-+ if (boot_t > 1700 && boot_then_leave)
-+ {
-+ ui_leave();
-+ boot_t = -100000; /* once */
-+ }
-+ else if (boot_t > 1700)
-+ ui_go(SCR_SHELF, 0, GO_FADE);
-+ }
-+ else
-+ {
-+ moving |= screen_update(dt);
-+ if (tr_len && tr_t < tr_len) { tr_t += dt; moving = 1; }
-+ }
-+
-+ int in_tr = tr_len && tr_t < tr_len;
-+ int t_draw = fos_port_ms();
-+ if (enter_t < ENTER_LEN || leaving)
-+ {
-+ /* the shutter: closes over LiveView, opens on us (and the
-+ * reverse when leaving) */
-+ int t;
-+ if (leaving) { leave_t += dt; t = leave_t; }
-+ else { enter_t += dt; t = enter_t; }
-+ if (screen != SCR_BOOT) screen_draw();
-+ int open_k;
-+ int ang = (int) (t * 9);
-+ if (leaving)
-+ {
-+ float f = clampf((float) t / LEAVE_LEN, 0, 1);
-+ if (f < 0.35f) open_k = (int) ((1 - ease_out(f / 0.35f)) * 4096);
-+ else
-+ {
-+ memset(buf_cv, IX_CLEAR, FOS_W * FOS_H);
-+ open_k = (int) (ease_out((f - 0.35f) / 0.65f) * 4096);
-+ }
-+ if (t >= LEAVE_LEN) quit = 1;
-+ }
-+ else
-+ {
-+ float f = clampf((float) t / ENTER_LEN, 0, 1);
-+ if (f < 0.4f)
-+ {
-+ memset(buf_cv, IX_CLEAR, FOS_W * FOS_H);
-+ open_k = (int) ((1 - ease_out(f / 0.4f)) * 4096);
-+ }
-+ else open_k = (int) (ease_out((f - 0.4f) / 0.6f) * 4096);
-+ }
-+ ui_iris(open_k, ang);
-+ ui_clobbered = 1;
-+ fos_port_present(cv->px, FOS_W, 0, FOS_H);
-+ if (!opened) { opened = 1; stat.open_ms = fos_port_ms() - t_open; }
-+ dmg_y0 = FOS_H; dmg_y1 = 0;
-+ fos_port_sleep(frame_rest(now));
-+ continue;
-+ }
-+
-+ int t_present;
-+ if (in_tr)
-+ {
-+ screen_draw();
-+ t_present = fos_port_ms();
-+ present_transition((float) tr_t / tr_len);
-+ ui_clobbered = 1; /* the screen only reached the panel composed */
-+ dmg_y0 = FOS_H; dmg_y1 = 0;
-+ }
-+ else
-+ {
-+ if (toast_t < TOAST_LEN)
-+ {
-+ toast_t += dt;
-+ moving = 1;
-+ ui_damage(HINTS_Y - 50, HINTS_Y);
-+ ui_clobbered = 1; /* the screen must paint under it again */
-+ }
-+ if (screen != SCR_BOOT && (dmg_y1 > dmg_y0 || moving))
-+ {
-+ screen_draw();
-+ toast_draw();
-+ }
-+ t_present = fos_port_ms();
-+ if (dmg_y1 > dmg_y0)
-+ {
-+ fos_port_present(cv->px + dmg_y0 * FOS_W, FOS_W, dmg_y0, dmg_y1);
-+ if (!opened) { opened = 1; stat.open_ms = fos_port_ms() - t_open; }
-+ }
-+ dmg_y0 = FOS_H; dmg_y1 = 0;
-+ }
-+ if (moving || in_tr)
-+ frame_stats(t_present - t_draw, fos_port_ms() - t_present);
-+ fos_port_sleep(moving || in_tr ? frame_rest(now) : 40);
-+ }
-+ if (stat.frames || stat.open_ms) fos_port_stat(&stat); /* the last part second */
-+ if (screen == SCR_SHELF) shelf_leave();
-+ if (screen == SCR_DEVELOP) develop_leave();
-+ if (screen == SCR_PRINTS) prints_leave();
-+ dark_free();
-+ ui_free();
-+}
-diff --git a/src/fos_ui.h b/src/fos_ui.h
-new file mode 100644
-index 000000000..0b55b62e8
---- /dev/null
-+++ b/src/fos_ui.h
-@@ -0,0 +1,155 @@
-+/* fos_ui.h: shared between the film OS screens (fos_ui.c, fos_shelf.c,
-+ * fos_pages.c). Not used by the camera glue. */
-+
-+#ifndef _fos_ui_h_
-+#define _fos_ui_h_
-+
-+#include "fos.h"
-+
-+/* ---------------------------------------------------------------- style */
-+
-+#define C_BG FC(RAMP_GRAY, 11)
-+#define C_PANEL FC(RAMP_GRAY, 21)
-+#define C_PANEL_HI FC(RAMP_GRAY, 32)
-+#define C_LINE FC(RAMP_GRAY, 40)
-+#define C_TEXT FC(RAMP_GRAY, 240)
-+#define C_TEXT2 FC(RAMP_GRAY, 170)
-+#define C_TEXT3 FC(RAMP_GRAY, 112)
-+#define C_ACCENT FC(RAMP_AMBER, 186)
-+#define C_ACCENT2 FC(RAMP_AMBER, 120)
-+#define C_RED FC(RAMP_RED, 150)
-+
-+#define STATUS_H 36
-+#define HINTS_Y 444
-+
-+/* ---------------------------------------------------------------- shared state */
-+
-+extern struct fos_canvas *cv; /* what the screens draw into */
-+extern uint8_t *ui_bg; /* background of the current screen, same layout */
-+extern int ui_now; /* ms */
-+extern struct fos_roll ui_roll;
-+
-+/* film mode (System > Film mode): Realistic rewinds a roll before it can be developed, like a film
-+ * camera; Basic just finishes it (the same in the roll's log), with no rewind to explain */
-+#define ui_realistic() (fos_port_get(FS_MODE) == 1)
-+
-+/* set when something else drew over the canvas (the shutter, a screen
-+ * change): screens that redraw only what moved must redraw it all */
-+extern int ui_clobbered;
-+
-+/* rows that changed this frame (the loop presents them) */
-+void ui_damage(int y0, int y1);
-+void ui_damage_all();
-+
-+/* ---------------------------------------------------------------- animation */
-+
-+struct spring { float x, v; };
-+
-+/* steps towards target; returns 1 while still moving */
-+int spring_step(struct spring *s, float target, int dt, float hz, float zeta);
-+float ease_out(float t); /* cubic */
-+float ease_in_out(float t);
-+float clampf(float v, float lo, float hi);
-+
-+/* ---------------------------------------------------------------- navigation */
-+
-+enum { SCR_NONE, SCR_BOOT, SCR_SHELF, SCR_HOME, SCR_PAGE, SCR_ROLL, SCR_DARK, SCR_DEVELOP, SCR_PRINTS };
-+enum { GO_PUSH = 1, GO_POP = -1, GO_FADE = 0 };
-+
-+void ui_go(int screen, int arg, int how);
-+void ui_leave(); /* back to LiveView, shutter opening on it */
-+int ui_from(); /* screen we came from */
-+int ui_settled(); /* no screen change, shutter or iris under way */
-+
-+/* ---------------------------------------------------------------- widgets */
-+
-+void ui_bg_restore(int x, int y, int w, int h);
-+void ui_to_bg(int on); /* widgets draw into ui_bg instead of the screen */
-+void ui_bg_plain(); /* the usual dark backdrop into ui_bg */
-+void ui_status_bar(const char *title);
-+
-+struct hint { const char *key; const char *label; };
-+void ui_hints(const struct hint *h, int n);
-+int ui_keycap(int x, int base, const char *key); /* returns width */
-+
-+void ui_dots(int x, int y, int n, int filled, fcol on); /* 1..5 rating */
-+
-+/* text over a photograph (its palette up, fos_port_photo): coverage onto
-+ * the fixed greys, or the amber; align 0 left, 1 centred, 2 right of x.
-+ * Returns the width. */
-+int ui_photo_text(const struct fos_font *f, int x, int y, const char *s, int accent, int align);
-+
-+/* a short message in a pill above the hints, fading after a moment */
-+void ui_toast(const char *msg);
-+int ui_toast_up(); /* 1 while one is showing */
-+
-+/* a question sliding up from the bottom; s = 0..1 how far it is in */
-+void ui_sheet(float s, const char *title, const char *body, const char *yes, const char *no);
-+/* the same with a third answer on INFO */
-+void ui_sheet3(float s, const char *title, const char *body, const char *yes, const char *alt, const char *no);
-+
-+enum { ICON_FILM, ICON_ROLL, ICON_FINDER, ICON_LENS, ICON_SYSTEM, ICON_PRINTS };
-+void ui_icon(int kind, int cx, int cy, fcol c, int alpha);
-+
-+/* the aperture over the whole screen: 0 = closed, 4096 = gone; the
-+ * opening shows what is already on the canvas */
-+void ui_iris(int open, int angle);
-+
-+/* a lens aperture inside a barrel of radius R px (same blades, smaller) */
-+void ui_aperture(int cx, int cy, int R, int open, int angle);
-+
-+/* ---------------------------------------------------------------- screens */
-+
-+void shelf_enter(int arg);
-+void shelf_leave();
-+void shelf_key(int key);
-+int shelf_update(int dt);
-+void shelf_draw();
-+
-+void home_enter(int arg);
-+void home_key(int key);
-+int home_update(int dt);
-+void home_draw();
-+
-+void page_enter(int arg);
-+void page_key(int key);
-+int page_update(int dt);
-+void page_draw();
-+
-+void roll_enter(int arg);
-+void roll_key(int key);
-+int roll_update(int dt);
-+void roll_draw();
-+
-+/* the darkroom (fos_dark.c): arg is a roll number, 0 for the newest */
-+void dark_enter(int arg);
-+void dark_free(); /* its memory, when the film OS closes */
-+void dark_key(int key);
-+int dark_update(int dt);
-+void dark_draw();
-+
-+/* developing the rolls queued with dark_queue (arg unused) */
-+void dark_queue_clear();
-+void dark_queue_add(int roll);
-+void develop_enter(int arg);
-+void develop_leave();
-+void develop_key(int key);
-+int develop_update(int dt);
-+void develop_draw();
-+
-+/* prints: arg is a roll number (0: the newest developed); PRINTS_ALONE
-+ * or-ed in when opened by PLAY from the camera */
-+#define PRINTS_ALONE 0x10000
-+void prints_enter(int arg);
-+void prints_leave();
-+void prints_key(int key);
-+int prints_update(int dt);
-+void prints_draw();
-+
-+/* the canisters, kept while the UI is open (fos_shelf.c) */
-+struct fos_can *ui_can(int film);
-+void ui_cans_free();
-+extern int ui_cans_ms; /* time spent drawing canisters, for the frame stats */
-+void ui_cans_exposures(int exposures);
-+
-+#endif
-diff --git a/src/gui-common.c b/src/gui-common.c
-index 992e8f692..13f631291 100644
---- a/src/gui-common.c
-+++ b/src/gui-common.c
-@@ -8,6 +8,7 @@
- #include <boot-hack.h>
- #include <fps.h>
- #include <zebra.h>
-+#include <filmroll.h>
- #include <lens.h>
- #include <config.h>
- #include <lvinfo.h>
-@@ -505,6 +506,9 @@ int handle_common_events_by_feature(struct event * event)
- if (handle_zoom_overlay(event) == 0) return 0;
- #endif
-
-+#ifdef FEATURE_FILMROLL
-+ if (handle_filmroll_keys(event) == 0) return 0;
-+#endif
- if (handle_module_keys(event) == 0) return 0;
- if (handle_flexinfo_keys(event) == 0) return 0;
-
-diff --git a/src/menu.c b/src/menu.c
-index a83f43e1b..a139f9128 100755
---- a/src/menu.c
-+++ b/src/menu.c
-@@ -39,6 +39,7 @@
- #include "debug.h"
- #include "lvinfo.h"
- #include "powersave.h"
-+#include "filmroll.h"
-
- #define CONFIG_MENU_ICONS
- //~ #define CONFIG_MENU_DIM_HACKS
-@@ -5648,6 +5649,15 @@ static void close_canon_menu()
-
- static void menu_open()
- {
-+#ifdef FEATURE_FILMROLL
-+#ifdef FEATURE_FILMOS_MODULE
-+ if (filmroll_menu_requested()) /* 0: the module isn't loaded, ML's menu opens */
-+ return;
-+#else
-+ filmroll_menu_requested();
-+ return;
-+#endif
-+#endif
- if (menu_shown)
- return;
-
-diff --git a/src/zebra.c b/src/zebra.c
-index ee713a6ca..9b74b2e6e 100644
---- a/src/zebra.c
-+++ b/src/zebra.c
-@@ -23,6 +23,7 @@
- */
-
- #include "zebra.h"
-+#include "filmroll.h"
- #include "vectorscope.h"
- #include "electronic_level.h"
- #include "dryos.h"
-@@ -408,6 +409,9 @@ extern int idle_globaldraw_disable;
-
- int get_global_draw() // menu setting, or off if
- {
-+#ifdef FEATURE_FILMROLL
-+ if (filmroll_overlays_active()) return 0;
-+#endif
- #ifdef FEATURE_GLOBAL_DRAW
-
- #ifdef LV_OVERLAYS_MODE
diff --git a/ml-dev/install_fork.ps1 b/ml-dev/install_fork.ps1
index b0f2e23..de11783 100644
--- a/ml-dev/install_fork.ps1
+++ b/ml-dev/install_fork.ps1
@@ -2,12 +2,16 @@
# powershell -File install_fork.ps1 -Card G:
# First run backs up the official ML (autoexec.bin + ML\MODULES) to
# ml-dev\card_backup\official\ so restore_official.ps1 can put it back.
+# Every run also keeps the build it replaces in ml-dev\card_backup\previous\,
+# unless the card already has this one (restore_official.ps1 -Previous puts
+# that build back).
param([Parameter(Mandatory = $true)][string]$Card)
$ErrorActionPreference = "Stop"
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$fork = Join-Path $here "out\fork"
$backup = Join-Path $here "card_backup\official"
+$prev = Join-Path $here "card_backup\previous"
$card = $Card.TrimEnd('\') + '\'
if (-not (Test-Path (Join-Path $card "autoexec.bin"))) { throw "No autoexec.bin on $card - is this the camera card?" }
@@ -21,6 +25,31 @@ if (-not (Test-Path (Join-Path $backup "autoexec.bin"))) {
Write-Output "Backed up official ML to $backup"
}
+# what this install replaces, so the build on the card now can come back if
+# the new one fails; not when the card already has this build (that would
+# put the last good one out of reach)
+$onCard = (Get-FileHash (Join-Path $card "autoexec.bin")).Hash
+if ($onCard -ne (Get-FileHash (Join-Path $fork "autoexec.bin")).Hash) {
+ $tmp = "$prev.new"
+ if (Test-Path $tmp) { Remove-Item $tmp -Recurse -Force }
+ New-Item -ItemType Directory -Force (Join-Path $tmp "ML") | Out-Null
+ Copy-Item (Join-Path $card "autoexec.bin") $tmp
+ foreach ($d in "MODULES", "DATA", "SAMPLES") {
+ $p = Join-Path $card "ML\$d"
+ if (Test-Path $p) { Copy-Item $p (Join-Path $tmp "ML") -Recurse }
+ }
+ # only the colour tables: the prints in ML\DARKROOM stay on the card
+ $looks = Join-Path $card "ML\DARKROOM\LOOK*.LUT"
+ if (Test-Path $looks) {
+ New-Item -ItemType Directory -Force (Join-Path $tmp "ML\DARKROOM") | Out-Null
+ Copy-Item $looks (Join-Path $tmp "ML\DARKROOM")
+ }
+ # the copy is whole before the last one goes
+ if (Test-Path $prev) { Remove-Item $prev -Recurse -Force }
+ Rename-Item $tmp (Split-Path -Leaf $prev)
+ Write-Output "Kept the build that was on the card in $prev"
+}
+
# the fork's core and the modules/symbols built against it
Copy-Item (Join-Path $fork "autoexec.bin") $card -Force
Copy-Item (Join-Path $fork "ML\modules\*") (Join-Path $card "ML\MODULES") -Force
diff --git a/ml-dev/restore_official.ps1 b/ml-dev/restore_official.ps1
index 86d24f6..ad80d7b 100644
--- a/ml-dev/restore_official.ps1
+++ b/ml-dev/restore_official.ps1
@@ -1,12 +1,29 @@
# Put the official ML (backed up by install_fork.ps1) back on the card.
# powershell -File restore_official.ps1 -Card G:
-param([Parameter(Mandatory = $true)][string]$Card)
+# Or the build that was on the card before the last install_fork.ps1:
+# powershell -File restore_official.ps1 -Card G: -Previous
+param([Parameter(Mandatory = $true)][string]$Card, [switch]$Previous)
$ErrorActionPreference = "Stop"
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
-$backup = Join-Path $here "card_backup\official"
$card = $Card.TrimEnd('\') + '\'
+if ($Previous) {
+ $prev = Join-Path $here "card_backup\previous"
+ if (-not (Test-Path (Join-Path $prev "autoexec.bin"))) { throw "No backup in $prev" }
+ Copy-Item (Join-Path $prev "autoexec.bin") $card -Force
+ foreach ($d in "MODULES", "DATA", "SAMPLES", "DARKROOM") {
+ $p = Join-Path $prev "ML\$d"
+ if (Test-Path $p) {
+ New-Item -ItemType Directory -Force (Join-Path $card "ML\$d") | Out-Null
+ Copy-Item (Join-Path $p "*") (Join-Path $card "ML\$d") -Force
+ }
+ }
+ Write-Output "The previous build is back on $card"
+ return
+}
+
+$backup = Join-Path $here "card_backup\official"
if (-not (Test-Path (Join-Path $backup "autoexec.bin"))) { throw "No backup in $backup" }
Copy-Item (Join-Path $backup "autoexec.bin") $card -Force
diff --git a/ml-dev/setup_wsl.sh b/ml-dev/setup_wsl.sh
index 298b51a..4dc81ac 100644
--- a/ml-dev/setup_wsl.sh
+++ b/ml-dev/setup_wsl.sh
@@ -10,8 +10,13 @@ SRC="$HOME/ml/magiclantern_simplified"
echo "== Installing packages (asks for your Ubuntu password) =="
sudo apt-get update
-sudo apt-get install -y build-essential make git zip python3 \
- gcc-arm-none-eabi binutils-arm-none-eabi
+# the compiler, and what build_fork.sh needs (it checks before it builds): ML's module help
+# text (docutils; distutils, from setuptools), the films' colour tables (numpy), the donation
+# QR codes (segno), the card files (unzip) and the film OS module's link test (newlib,
+# qemu-user), as CI has them. Ubuntu's python3 has no pip, so the Python modules come from apt.
+sudo apt-get install -y build-essential make git zip unzip python3 \
+ gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi qemu-user \
+ python3-docutils python3-setuptools python3-numpy python3-segno
echo "== Getting Magic Lantern source =="
mkdir -p "$HOME/ml"