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.

A 6D build without the in-camera darkroom, for the tester on #3

Claude8d948be01d56
diff --git a/.github/workflows/camera.yml b/.github/workflows/camera.yml
index dbd081d..92985f5 100644
--- a/.github/workflows/camera.yml
+++ b/.github/workflows/camera.yml
@@ -63,6 +63,47 @@ jobs:
path: M-Film-camera-${{ matrix.platform }}.zip
if-no-files-found: error
+ # builds for testers, not for releases: cameras where the full one may not fit (see the issue that
+ # asked for it). Their artifacts are named test-..., which the release leaves out.
+ camera-test:
+ strategy:
+ fail-fast: false
+ matrix:
+ platform: [6D.116] # built --no-darkroom
+ runs-on: ubuntu-24.04
+ name: camera ${{ matrix.platform }} (no darkroom, for testing)
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.11" # ML's module build still imports distutils (gone in 3.12)
+ - name: Toolchain and Magic Lantern (the commit the fork is made against)
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y -qq gcc-arm-none-eabi binutils-arm-none-eabi zip
+ python -m pip install -q numpy scipy pillow segno docutils
+ git clone -q --filter=blob:none https://github.com/reticulatedpines/magiclantern_simplified.git "$HOME/ml/magiclantern_simplified"
+ git -C "$HOME/ml/magiclantern_simplified" checkout -q ed3e7c0dfacfdeaf3349dee73edf9e3621217462
+ arm-none-eabi-gcc --version | head -1
+ - name: Build
+ run: bash ml-dev/build_fork.sh ${{ matrix.platform }} --no-darkroom
+ - name: Zip
+ run: |
+ p=${{ matrix.platform }}
+ d=ml-dev/out/fork-$p-nodark
+ cp ml-dev/CAMERA-README.txt "$d/M-FILM-README.txt"
+ # the licence and the notices travel with the binaries (GPL-2.0 section 1; the MIT notice of
+ # Film-Luts, whose LUTs the colour tables and samples in ML/ are made from)
+ cp LICENSE "$d/LICENSE.txt"
+ cp THIRD_PARTY.md "$d/THIRD_PARTY.txt"
+ (cd "$d" && zip -qr "$GITHUB_WORKSPACE/M-Film-camera-$p-nodark.zip" .)
+ ls -la M-Film-camera-$p-nodark.zip
+ - uses: actions/upload-artifact@v4
+ with:
+ name: test-M-Film-camera-${{ matrix.platform }}-nodark
+ path: M-Film-camera-${{ matrix.platform }}-nodark.zip
+ if-no-files-found: error
+
release:
needs: [camera]
if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.tag != '' }}
@@ -76,6 +117,7 @@ jobs:
[ "$tag" = "$want" ] || { echo "tag $tag but VERSION says $want: change one of them"; exit 1; }
- uses: actions/download-artifact@v4
with:
+ pattern: M-Film-camera-* # not the test-... builds
path: zips
merge-multiple: true
- uses: softprops/action-gh-release@v2
diff --git a/ml-dev/build_fork.sh b/ml-dev/build_fork.sh
index bb9a220..bf134d0 100644
--- a/ml-dev/build_fork.sh
+++ b/ml-dev/build_fork.sh
@@ -4,6 +4,9 @@
#
# build_fork.sh EOS M -> ml-dev/out/fork/
# build_fork.sh 650D.104 another camera -> ml-dev/out/fork-650D.104/
+# build_fork.sh 6D.116 --no-darkroom
+# without the in-camera darkroom (~60 KB less at boot, for cameras
+# that can't spare it) -> ml-dev/out/fork-6D.116-nodark/
#
# The cameras are the folders under platform/ in magiclantern_simplified; the
# ones M-Film knows are listed in CAMERAS (ml-dev/cameras.txt).
@@ -12,8 +15,10 @@ set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
SRC="${ML_SRC:-$HOME/ml/magiclantern_simplified}"
PLAT="${1:-EOSM.202}"
-if [ "$PLAT" = "EOSM.202" ]; then OUT="$HERE/out/fork"; else OUT="$HERE/out/fork-$PLAT"; fi
-LOG="${LOG:-$HOME/ml/build_fork_$PLAT.log}"
+NODARK=""
+[ "${2:-}" = "--no-darkroom" ] && NODARK="--no-darkroom"
+if [ "$PLAT" = "EOSM.202" ] && [ -z "$NODARK" ]; then OUT="$HERE/out/fork"; else OUT="$HERE/out/fork-$PLAT${NODARK:+-nodark}"; fi
+LOG="${LOG:-$HOME/ml/build_fork_$PLAT${NODARK:+-nodark}.log}"
cp "$HERE"/fork/src/filmroll.{c,h} "$HERE"/filmos/fos*.{c,h} "$SRC/src/"
sed -i 's/\r$//' "$SRC"/src/filmroll.{c,h} "$SRC"/src/fos*.{c,h}
@@ -21,7 +26,7 @@ sed -i 's/\r$//' "$SRC"/src/filmroll.{c,h} "$SRC"/src/fos*.{c,h}
VERSION=$(tr -d ' \r\n' < "$HERE/../VERSION")
printf '#define MFILM_VERSION "%s"\n' "$VERSION" > "$SRC/src/fos_version.h"
echo "M-Film $VERSION"
-python3 "$HERE/fork/apply_fork.py" "$SRC" "$PLAT"
+python3 "$HERE/fork/apply_fork.py" "$SRC" "$PLAT" $NODARK
cd "$SRC/platform/$PLAT"
make clean >/dev/null
@@ -53,7 +58,7 @@ if [ -n "$LIMIT" ] && [ "$LIMIT" != "-" ]; then
else
echo "ML takes $USED bytes at boot (no limit known for $PLAT yet: if the camera hangs at power on, it is too big)"
fi
-mkdir -p "$HERE/out" && echo "$USED" > "$HERE/out/.size-$PLAT"
+mkdir -p "$HERE/out" && echo "$USED" > "$HERE/out/.size-$PLAT${NODARK:+-nodark}"
rm -rf "$OUT" && mkdir -p "$OUT"
(cd "$OUT" && unzip -q "$SRC/platform/$PLAT/$ZIP")
@@ -71,6 +76,13 @@ python3 "$F/tools/genfilms.py" "$OUT/ML/data/FOSFILMS.BIN"
python3 -c "import segno" 2>/dev/null || pip install -q segno
python3 "$F/tools/genqr.py" "$HERE/donate.txt" "$OUT/ML/data/FOSQR.BIN"
+# with no darkroom, nothing below is used: the card is done
+if [ -n "$NODARK" ]; then
+ echo "== card files in $OUT (no darkroom) =="
+ (cd "$OUT" && find . -maxdepth 3 | sort | head -60)
+ exit 0
+fi
+
# every film's colour table, so the darkroom never spends its first
# develop of a film mixing one (the camera checks they match its looks):
# mixed from the look, then baked from the film's LUT where it has one
diff --git a/ml-dev/filmos/fos_dev.c b/ml-dev/filmos/fos_dev.c
index 83672d7..936e65d 100644
--- a/ml-dev/filmos/fos_dev.c
+++ b/ml-dev/filmos/fos_dev.c
@@ -1397,15 +1397,6 @@ static __attribute__((noinline)) int nearest(struct fos_dev *d, int cell)
/* ---------------------------------------------------------------- files */
-/* the overlay's colours over a photograph: 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 },
-};
-
/* 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. */
diff --git a/ml-dev/filmos/fos_gfx.c b/ml-dev/filmos/fos_gfx.c
index a4e0f3a..4c4bbbc 100644
--- a/ml-dev/filmos/fos_gfx.c
+++ b/ml-dev/filmos/fos_gfx.c
@@ -3,6 +3,7 @@
* one-time palette build. */
#include "fos_gfx.h"
+#include "fos_dev.h"
#include <string.h>
/* ---------------------------------------------------------------- ramps */
@@ -957,3 +958,13 @@ int fos_text_map(uint8_t *px, int pitch, int w, int h, const struct fos_font *f,
}
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/ml-dev/filmos/fos_nodark.c b/ml-dev/filmos/fos_nodark.c
new file mode 100644
index 0000000..c84a054
--- /dev/null
+++ b/ml-dev/filmos/fos_nodark.c
@@ -0,0 +1,65 @@
+/* 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), and the shelf has no sample prints.
+ */
+
+#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(); }
+
+/* the shelf's sample prints are made by the darkroom's code */
+int fos_print_load(const char *path, struct fos_print *p) { return 0; }
+void fos_print_free(struct fos_print *p) {}
diff --git a/ml-dev/fork/apply_fork.py b/ml-dev/fork/apply_fork.py
index 89c8971..7dd119f 100644
--- a/ml-dev/fork/apply_fork.py
+++ b/ml-dev/fork/apply_fork.py
@@ -15,7 +15,9 @@ import sys
from pathlib import Path
root = Path(sys.argv[1])
-PLATFORMS = sys.argv[2:] or ["EOSM.202"]
+# --no-darkroom: the film OS without its in-camera darkroom (fos_nodark.c in its place), ~60 KB less at boot
+NO_DARKROOM = "--no-darkroom" in sys.argv[2:]
+PLATFORMS = [a for a in sys.argv[2:] if not a.startswith("--")] or ["EOSM.202"]
def edit(rel, old, new, marker):
@@ -93,8 +95,8 @@ def platform(name):
# our objects. Rewritten every time (older versions of this fork
# listed only filmroll.o), so the list always matches the sources.
# (no fos_font: the fonts go on the card as ML/DATA/FOSFONT.BIN, see fos_gfx.h)
- FOS_OBJS = ["filmroll", "fos_gfx", "fos_film", "fos_ui", "fos_shelf", "fos_pages", "fos_hud",
- "fos_dark", "fos_dev", "fos_lab", "fos_looks", "fos_jpeg"]
+ FOS_OBJS = ["filmroll", "fos_gfx", "fos_film", "fos_ui", "fos_shelf", "fos_pages", "fos_hud"]
+ FOS_OBJS += ["fos_nodark"] if NO_DARKROOM else ["fos_dark", "fos_dev", "fos_lab", "fos_looks", "fos_jpeg"]
p = root / f"platform/{name}/Makefile"
lines = p.read_text().split("\n")
out, skip = [], False