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.

RAW+JPEG counts as RAW at loading; missing files by Canon's name; a darkroom test in CI; 600D and 70D as testers found them

Claudea736420f51a2
diff --git a/.github/workflows/camera.yml b/.github/workflows/camera.yml
index 38e746d..f44c2ce 100644
--- a/.github/workflows/camera.yml
+++ b/.github/workflows/camera.yml
@@ -24,6 +24,18 @@ permissions:
contents: write
jobs:
+ # the darkroom on the PC simulator, on a card of rolls it has to find or explain: shot as JPEG,
+ # Adobe RGB with a file deleted, across the IMG_9999 wrap (ml-dev/filmos/sim/cardtest.sh)
+ darkroom:
+ runs-on: ubuntu-24.04
+ name: darkroom (simulator)
+ steps:
+ - uses: actions/checkout@v4
+ - name: Build the simulator
+ run: make -C ml-dev/filmos/sim out/sim
+ - name: Develop the problem rolls
+ run: bash ml-dev/filmos/sim/cardtest.sh
+
camera:
strategy:
fail-fast: false
@@ -157,7 +169,7 @@ jobs:
if-no-files-found: error
release:
- needs: [camera, camera-module]
+ needs: [darkroom, camera, camera-module]
if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.tag != '' }}
runs-on: ubuntu-latest
steps:
diff --git a/PORTING.md b/PORTING.md
index 61b816c..514ba4a 100644
--- a/PORTING.md
+++ b/PORTING.md
@@ -34,7 +34,8 @@ fos_port_roll, get, set, action, clock, lens_*, photo, ... camera state
```
Two implementations exist: the camera's (`ml-dev/fork/src/filmroll.c`) and the simulator's
-(`ml-dev/filmos/sim/`, runs on a PC and writes PNGs: `make -C ml-dev/filmos/sim`). A new camera
+(`ml-dev/filmos/sim/`, runs on a PC and writes PNGs: `make -C ml-dev/filmos/sim`; its `cardtest.sh`
+checks the darkroom on rolls it has to find or explain, and runs in CI). A new camera
needs a new `filmroll.c`-like file; the screens stay as they are. Things to check per camera:
- **Screen.** 720 × 480 is Magic Lantern's bitmap size on every camera it supports, so layouts carry
diff --git a/README.md b/README.md
index 28b3649..8267977 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ The camera side is free and open, for everyone.
[![Buy the developer a coffee](https://img.shields.io/badge/Buy%20the%20developer%20a%20coffee-ffdd00?style=for-the-badge&logo=buymeacoffee&logoColor=black)](https://buy.stripe.com/7sY14p8d93QE5Ny5M58so02)
[![License GPL-2.0](https://img.shields.io/badge/license-GPL--2.0-3b352f)](LICENSE)
-[![Cameras](https://img.shields.io/badge/cameras-9%20work%20%C2%B7%205%20with%20a%20problem%20%C2%B7%201%20in%20testing-3b352f)](#cameras)
+[![Cameras](https://img.shields.io/badge/cameras-8%20work%20%C2%B7%206%20with%20a%20problem%20%C2%B7%201%20in%20testing-3b352f)](#cameras)
[![Films](https://img.shields.io/badge/films-72-3b352f)](FILMS.md)
**English** · [ภาษาไทย](README.th.md) · [Films](#72-films) · [Cameras](#cameras) · [Darkrooms](#develop-on-your-computer-darkrooms) · [Take it further](PORTING.md)
@@ -155,11 +155,11 @@ still wrong. If you have one marked *needs a tester*, you can help: [TESTING.md]
| Canon EOS 650D / Rebel T4i / Kiss X6i | 1.0.4 | ⚠️ Without the in-camera darkroom (develop with Darkrooms) | The full build gives a black screen ([#34](../../issues/34)); a tester's 650D starts without the darkroom. Released that way since 0.1.3: develop on a computer. | `M-Film-camera-650D.104.zip` (to test: `-module.zip`) |
| Canon EOS 700D / Rebel T5i / Kiss X7i | 1.1.5 | ⚠️ Without the in-camera darkroom (develop with Darkrooms) | The full build gives a black screen ([#19](../../issues/19)). Released without the darkroom since 0.1.3, as for the 650D: waiting for a tester. | `M-Film-camera-700D.115.zip` (to test: `-module.zip`) |
| Canon EOS 6D | 1.1.6 | ✅ **Works** | Works since 0.1.2 ([#17](../../issues/17), [#22](../../issues/22)). | `M-Film-camera-6D.116.zip` (to test: `-module.zip`) |
-| Canon EOS 70D | 1.1.2 | ✅ **Works** | Works, with the film OS as a module ([#40](../../issues/40)). | `M-Film-camera-70D.112.zip` |
+| Canon EOS 70D | 1.1.2 | ⚠️ Tried, known problem | 0.1.5 works on a tester's 70D, with the film OS as a module ([#40](../../issues/40)); on another, Magic Lantern installs but the camera then starts Canon's own firmware ([#58](../../issues/58)): more reports wanted. | `M-Film-camera-70D.112.zip` |
| Canon EOS 5D Mark III (firmware 1.1.3) | 1.1.3 | ⚠️ Tried, known problem | Starts and shoots; the in-camera darkroom couldn't find the RAWs ([#31](../../issues/31)): fixed in 0.1.3. | `M-Film-camera-5D3.113.zip` (to test: `-module.zip`) |
| Canon EOS 5D Mark III (firmware 1.2.3) | 1.2.3 | ⚠️ Tried, known problem | Starts and shoots; the in-camera darkroom couldn't find the RAWs ([#16](../../issues/16), [#37](../../issues/37)): fixed in 0.1.3. | `M-Film-camera-5D3.123.zip` (to test: `-module.zip`) |
| Canon EOS 550D / Rebel T2i / Kiss X4 | 1.0.9 | ✅ **Works** | Works since 0.1.5, the film OS as a module, darkroom included ([#48](../../issues/48), [#50](../../issues/50)). | `M-Film-camera-550D.109.zip` |
-| Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | ✅ **Works** | Works since 0.1.5, the film OS as a module ([#46](../../issues/46)). | `M-Film-camera-600D.102.zip` |
+| Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | ✅ **Works** | Starts and shoots since 0.1.5, the film OS as a module ([#46](../../issues/46)). The in-camera darkroom isn't confirmed on it yet; shoot with Image quality RAW. | `M-Film-camera-600D.102.zip` |
| Canon EOS 60D | 1.1.1 | ✅ **Works** | Works since 0.1.3 ([#25](../../issues/25)). 0.1.5: Screen orientation for a broken hinge switch ([#49](../../issues/49)). | `M-Film-camera-60D.111.zip` (to test: `-module.zip`) |
| Canon EOS 1100D / Rebel T3 / Kiss X50 | 1.0.5 | 🧪 Builds, needs a tester | The film OS as a module fits its boot memory (493,056 of 524,032 bytes). Needs a first tester. | `M-Film-camera-1100D.105.zip` |
| Canon EOS 500D / Rebel T1i / Kiss X3 | 1.1.1 | ✅ **Works** | Works ([#44](../../issues/44)). 0.1.5 repaints when Canon draws over the plate. | `M-Film-camera-500D.111.zip` (to test: `-module.zip`) |
@@ -178,7 +178,9 @@ notes in [PORTING.md](PORTING.md).
1. The camera needs exactly the Canon firmware in the table (MENU → last settings tab → *Firmware ver.*).
2. Unzip the card files for your camera onto an SD card, put it in the camera and run *Firmware ver.* →
update once. From then on M-Film starts with the camera from that card.
-3. Full steps, and how to go back: [TESTING.md](TESTING.md). Building it yourself:
+3. In Canon's menu set **Image quality** to **RAW** (RAW+JPEG works too) and **Image review** to **Off**.
+ The darkroom develops the RAWs: a frame shot as JPEG can't be developed.
+4. Full steps, and how to go back: [TESTING.md](TESTING.md). Building it yourself:
`ml-dev/build_fork.sh <camera>`.
### Updating to a new version
diff --git a/README.th.md b/README.th.md
index db8522a..12e5353 100644
--- a/README.th.md
+++ b/README.th.md
@@ -14,7 +14,7 @@
[![เลี้ยงกาแฟผู้พัฒนา](https://img.shields.io/badge/%E0%B9%80%E0%B8%A5%E0%B8%B5%E0%B9%89%E0%B8%A2%E0%B8%87%E0%B8%81%E0%B8%B2%E0%B9%81%E0%B8%9F%E0%B8%9C%E0%B8%B9%E0%B9%89%E0%B8%9E%E0%B8%B1%E0%B8%92%E0%B8%99%E0%B8%B2-ffdd00?style=for-the-badge&logo=buymeacoffee&logoColor=black)](https://buy.stripe.com/7sY14p8d93QE5Ny5M58so02)
[![License GPL-2.0](https://img.shields.io/badge/license-GPL--2.0-3b352f)](LICENSE)
-[![Cameras](https://img.shields.io/badge/cameras-9%20work%20%C2%B7%205%20with%20a%20problem%20%C2%B7%201%20in%20testing-3b352f)](#กล้องที่รองรับ)
+[![Cameras](https://img.shields.io/badge/cameras-8%20work%20%C2%B7%206%20with%20a%20problem%20%C2%B7%201%20in%20testing-3b352f)](#กล้องที่รองรับ)
[![Films](https://img.shields.io/badge/films-72-3b352f)](FILMS.md)
[English](README.md) · **ภาษาไทย** · [ฟิล์ม](#ฟิล์ม-72-แบบ) · [กล้องที่รองรับ](#กล้องที่รองรับ) · [Darkrooms](#ล้างบนคอม-darkrooms) · [คู่มือในกล้อง](docs/MANUAL.th.md) · [ทำต่อยอด](PORTING.md)
@@ -155,11 +155,11 @@ M-Film ทำบน EOS M และใช้ได้จริงบนรุ่
| Canon EOS 650D / Rebel T4i / Kiss X6i | 1.0.4 | ⚠️ ไม่มีห้องมืดในกล้อง (ล้างด้วย Darkrooms) | build เต็มจอดำ ([#34](../../issues/34)) ผู้ทดสอบลองแบบไม่มีห้องมืดแล้วเปิดได้ ตั้งแต่ 0.1.3 ออกแบบนั้น ล้างบนคอม | `M-Film-camera-650D.104.zip` (ทดสอบ: `-module.zip`) |
| Canon EOS 700D / Rebel T5i / Kiss X7i | 1.1.5 | ⚠️ ไม่มีห้องมืดในกล้อง (ล้างด้วย Darkrooms) | build เต็มจอดำ ([#19](../../issues/19)) ตั้งแต่ 0.1.3 ออกแบบไม่มีห้องมืด เหมือน 650D รอคนลอง | `M-Film-camera-700D.115.zip` (ทดสอบ: `-module.zip`) |
| Canon EOS 6D | 1.1.6 | ✅ **ใช้ได้** | ใช้ได้ตั้งแต่ 0.1.2 ([#17](../../issues/17), [#22](../../issues/22)) | `M-Film-camera-6D.116.zip` (ทดสอบ: `-module.zip`) |
-| Canon EOS 70D | 1.1.2 | ✅ **ใช้ได้** | ใช้ได้ แบบ film OS เป็นโมดูล ([#40](../../issues/40)) | `M-Film-camera-70D.112.zip` |
+| Canon EOS 70D | 1.1.2 | ⚠️ ลองแล้ว ยังมีปัญหา | 0.1.5 ใช้ได้บน 70D ของผู้ทดสอบคนหนึ่ง แบบ film OS เป็นโมดูล ([#40](../../issues/40)) อีกคนติดตั้ง Magic Lantern ได้ แต่เปิดเครื่องแล้วเข้า firmware ของ Canon ([#58](../../issues/58)) ต้องการรายงานเพิ่ม | `M-Film-camera-70D.112.zip` |
| Canon EOS 5D Mark III (firmware 1.1.3) | 1.1.3 | ⚠️ ลองแล้ว ยังมีปัญหา | เปิดและถ่ายได้ ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ ([#31](../../issues/31)) แก้แล้วใน 0.1.3 | `M-Film-camera-5D3.113.zip` (ทดสอบ: `-module.zip`) |
| Canon EOS 5D Mark III (firmware 1.2.3) | 1.2.3 | ⚠️ ลองแล้ว ยังมีปัญหา | เปิดและถ่ายได้ ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ ([#16](../../issues/16), [#37](../../issues/37)) แก้แล้วใน 0.1.3 | `M-Film-camera-5D3.123.zip` (ทดสอบ: `-module.zip`) |
| Canon EOS 550D / Rebel T2i / Kiss X4 | 1.0.9 | ✅ **ใช้ได้** | ใช้ได้ตั้งแต่ 0.1.5 แบบโมดูล ห้องมืดในกล้องครบ ([#48](../../issues/48), [#50](../../issues/50)) | `M-Film-camera-550D.109.zip` |
-| Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | ✅ **ใช้ได้** | ใช้ได้ตั้งแต่ 0.1.5 แบบโมดูล ([#46](../../issues/46)) | `M-Film-camera-600D.102.zip` |
+| Canon EOS 600D / Rebel T3i / Kiss X5 | 1.0.2 | ✅ **ใช้ได้** | เปิดและถ่ายได้ตั้งแต่ 0.1.5 แบบโมดูล ([#46](../../issues/46)) ห้องมืดในกล้องยังไม่มีคนยืนยัน ให้ตั้ง Image quality เป็น RAW | `M-Film-camera-600D.102.zip` |
| Canon EOS 60D | 1.1.1 | ✅ **ใช้ได้** | ใช้ได้ตั้งแต่ 0.1.3 ([#25](../../issues/25)) 0.1.5 ตั้งการหมุนจอเองได้ ([#49](../../issues/49)) | `M-Film-camera-60D.111.zip` (ทดสอบ: `-module.zip`) |
| Canon EOS 1100D / Rebel T3 / Kiss X50 | 1.0.5 | 🧪 build ได้แล้ว รอคนทดสอบ | film OS แบบโมดูลพอดีหน่วยความจำตอนบูต (493,056 จาก 524,032 ไบต์) รอคนลองเป็นคนแรก | `M-Film-camera-1100D.105.zip` |
| Canon EOS 500D / Rebel T1i / Kiss X3 | 1.1.1 | ✅ **ใช้ได้** | ใช้ได้ ([#44](../../issues/44)) 0.1.5 วาดจอใหม่เมื่อ Canon วาดทับ | `M-Film-camera-500D.111.zip` (ทดสอบ: `-module.zip`) |
@@ -177,7 +177,9 @@ M-Film ทำบน EOS M และใช้ได้จริงบนรุ่
1. เฟิร์มแวร์ Canon ต้องตรงกับในตารางเป๊ะๆ (MENU → แท็บตั้งค่าแท็บสุดท้าย → *Firmware ver.*)
2. แตกไฟล์ลงการ์ดของรุ่นคุณลงการ์ด SD ใส่การ์ดในกล้อง แล้วกด *Firmware ver.* → update ครั้งเดียว
หลังจากนั้นเปิดกล้องด้วยการ์ดใบนั้น M-Film จะเปิดขึ้นมาพร้อมกล้องเลย
-3. ขั้นตอนเต็มและวิธีถอดออก: [TESTING.md](TESTING.md) จะ build เอง: `ml-dev/build_fork.sh <กล้อง>`
+3. ในเมนู Canon ตั้ง **Image quality** (คุณภาพของภาพ) เป็น **RAW** (RAW+JPEG ก็ได้) และ **Image review** เป็น **Off**
+ ห้องมืดล้างจากไฟล์ RAW รูปที่ถ่ายเป็น JPEG ล้างไม่ได้
+4. ขั้นตอนเต็มและวิธีถอดออก: [TESTING.md](TESTING.md) จะ build เอง: `ml-dev/build_fork.sh <กล้อง>`
### อัปเดตเป็นเวอร์ชันใหม่
diff --git a/TESTING.md b/TESTING.md
index c98cda1..aa91cb4 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -51,6 +51,8 @@ instead, the module didn't load: its line in the *Modules* tab says why. Tell us
2. Camera off, card in, camera on. MENU → *Firmware ver.* → update (first time only: this lets the
camera start Magic Lantern from the card).
3. Switch the camera off and on.
+4. In Canon's menu set **Image quality** to **RAW** (RAW+JPEG works too) and **Image review** to
+ **Off**. The in-camera darkroom develops the RAWs: frames shot as JPEG can't be developed.
## 3. What to try, and what to tell us
diff --git a/ml-dev/cameras.txt b/ml-dev/cameras.txt
index faf861a..07a1fa6 100644
--- a/ml-dev/cameras.txt
+++ b/ml-dev/cameras.txt
@@ -22,11 +22,11 @@ EOSM.202 working 727072 Canon EOS M
650D.104 nodark 689664 Canon EOS 650D / Rebel T4i / Kiss X6i | The full build gives a black screen (#34); a tester's 650D starts without the darkroom. Released that way since 0.1.3: develop on a computer. | build เต็มจอดำ (#34) ผู้ทดสอบลองแบบไม่มีห้องมืดแล้วเปิดได้ ตั้งแต่ 0.1.3 ออกแบบนั้น ล้างบนคอม
700D.115 nodark - Canon EOS 700D / Rebel T5i / Kiss X7i | The full build gives a black screen (#19). Released without the darkroom since 0.1.3, as for the 650D: waiting for a tester. | build เต็มจอดำ (#19) ตั้งแต่ 0.1.3 ออกแบบไม่มีห้องมืด เหมือน 650D รอคนลอง
6D.116 working 868096 Canon EOS 6D | Works since 0.1.2 (#17, #22). | ใช้ได้ตั้งแต่ 0.1.2 (#17, #22)
-70D.112 working:module 605952 Canon EOS 70D | Works, with the film OS as a module (#40). | ใช้ได้ แบบ film OS เป็นโมดูล (#40)
+70D.112 issues:module 605952 Canon EOS 70D | 0.1.5 works on a tester's 70D, with the film OS as a module (#40); on another, Magic Lantern installs but the camera then starts Canon's own firmware (#58): more reports wanted. | 0.1.5 ใช้ได้บน 70D ของผู้ทดสอบคนหนึ่ง แบบ film OS เป็นโมดูล (#40) อีกคนติดตั้ง Magic Lantern ได้ แต่เปิดเครื่องแล้วเข้า firmware ของ Canon (#58) ต้องการรายงานเพิ่ม
5D3.113 issues - Canon EOS 5D Mark III (firmware 1.1.3) | Starts and shoots; the in-camera darkroom couldn't find the RAWs (#31): fixed in 0.1.3. | เปิดและถ่ายได้ ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ (#31) แก้แล้วใน 0.1.3
5D3.123 issues - Canon EOS 5D Mark III (firmware 1.2.3) | Starts and shoots; the in-camera darkroom couldn't find the RAWs (#16, #37): fixed in 0.1.3. | เปิดและถ่ายได้ ห้องมืดในกล้องหาไฟล์ RAW ไม่เจอ (#16, #37) แก้แล้วใน 0.1.3
550D.109 working:module 589568 Canon EOS 550D / Rebel T2i / Kiss X4 | Works since 0.1.5, the film OS as a module, darkroom included (#48, #50). | ใช้ได้ตั้งแต่ 0.1.5 แบบโมดูล ห้องมืดในกล้องครบ (#48, #50)
-600D.102 working:module 589824 Canon EOS 600D / Rebel T3i / Kiss X5 | Works since 0.1.5, the film OS as a module (#46). | ใช้ได้ตั้งแต่ 0.1.5 แบบโมดูล (#46)
+600D.102 working:module 589824 Canon EOS 600D / Rebel T3i / Kiss X5 | Starts and shoots since 0.1.5, the film OS as a module (#46). The in-camera darkroom isn't confirmed on it yet; shoot with Image quality RAW. | เปิดและถ่ายได้ตั้งแต่ 0.1.5 แบบโมดูล (#46) ห้องมืดในกล้องยังไม่มีคนยืนยัน ให้ตั้ง Image quality เป็น RAW
60D.111 working - Canon EOS 60D | Works since 0.1.3 (#25). 0.1.5: Screen orientation for a broken hinge switch (#49). | ใช้ได้ตั้งแต่ 0.1.3 (#25) 0.1.5 ตั้งการหมุนจอเองได้ (#49)
1100D.105 testing:module 524032 Canon EOS 1100D / Rebel T3 / Kiss X50 | The film OS as a module fits its boot memory (493,056 of 524,032 bytes). Needs a first tester. | film OS แบบโมดูลพอดีหน่วยความจำตอนบูต (493,056 จาก 524,032 ไบต์) รอคนลองเป็นคนแรก
500D.111 working - Canon EOS 500D / Rebel T1i / Kiss X3 | Works (#44). 0.1.5 repaints when Canon draws over the plate. | ใช้ได้ (#44) 0.1.5 วาดจอใหม่เมื่อ Canon วาดทับ
diff --git a/ml-dev/filmos/fos_lab.c b/ml-dev/filmos/fos_lab.c
index e0668e7..85cbb82 100644
--- a/ml-dev/filmos/fos_lab.c
+++ b/ml-dev/filmos/fos_lab.c
@@ -383,11 +383,19 @@ int fos_lab_frames(int roll, struct fos_lab_frame *frames, int max)
}
/* 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); continue; }
+ 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 */
@@ -402,5 +410,15 @@ int fos_lab_frames(int roll, struct fos_lab_frame *frames, int max)
}
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/ml-dev/filmos/sim/cardtest.sh b/ml-dev/filmos/sim/cardtest.sh
new file mode 100755
index 0000000..4095e82
--- /dev/null
+++ b/ml-dev/filmos/sim/cardtest.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# The darkroom on a card of problem rolls (mkcard.sh --problems): it develops
+# what it can, and says why it can't the rest. Fails if a line is missing.
+# make && ./cardtest.sh
+set -euo pipefail
+cd "$(dirname "$0")"
+CARD=out/cardp ./mkcard.sh --problems >/dev/null
+rm -rf out/frames/problems && mkdir -p out/frames/problems
+log=out/cardtest.log
+FOS_CARD=out/cardp/ ./out/sim scenes/darkroom_problems.txt out/frames/problems > "$log" 2>&1
+
+fail=0
+expect() {
+ if grep -qF -- "$2" "$log"; then echo "ok $1"
+ else echo "FAIL $1: no \"$2\""; fail=1; fi
+}
+reject() { # an extended regex
+ if grep -qE -- "$2" "$log"; then echo "FAIL $1: \"$2\""; fail=1
+ else echo "ok $1"; fi
+}
+
+# a roll shot as JPEG: each frame says so, and names the JPEG
+expect "JPEG roll: frame 1 is a JPEG" "roll 006 frame 1: shot as JPEG, no RAW: out/cardp/DCIM/100CANON/IMG_0501.JPG"
+expect "JPEG roll: frame 4 is a JPEG" "roll 006 frame 4: shot as JPEG, no RAW: out/cardp/DCIM/100CANON/IMG_0504.JPG"
+# Adobe RGB (_MG_): found by Canon's name; the deleted one is named that way too
+expect "Adobe RGB: frame 1 found" "roll 007 frame 1 developed"
+expect "Adobe RGB: deleted, by Canon's name" "roll 007 frame 2: no RAW file out/cardp/DCIM/100CANON/_MG_0506.CR2"
+expect "Adobe RGB: frame 4 found" "roll 007 frame 4 developed"
+# across IMG_9999 -> IMG_0001: each frame in its own folder's log
+expect "9999 wrap: all four RAWs" "roll 008 (gold200): 4 frames, 4 RAW files"
+reject "9999 wrap: nothing missing" "roll 008 frame [0-9]+: (no RAW|shot as JPEG)"
+for f in 1 2 3 4; do expect "9999 wrap: frame $f developed" "roll 008 frame $f developed"; done
+
+[ $fail = 0 ] && echo "cardtest: all passed" || { echo "cardtest: failed (log: sim/$log)"; exit 1; }
diff --git a/ml-dev/filmos/sim/mkcard.sh b/ml-dev/filmos/sim/mkcard.sh
index 7a3bfe7..2995761 100755
--- a/ml-dev/filmos/sim/mkcard.sh
+++ b/ml-dev/filmos/sim/mkcard.sh
@@ -4,20 +4,26 @@
# ./mkcard.sh
# PHOTOS=dir ./mkcard.sh the frames are the photos in dir (*.pfm: linear sRGB, 0.18 = mid grey,
# taller than wide = shot on its side), in turn, instead of test scenes
+# CARD=out/cardp ./mkcard.sh --problems
+# instead, the rolls the darkroom has to find or explain (cardtest.sh):
+# shot as JPEG, Adobe RGB with a file deleted, across the IMG_9999 wrap
set -euo pipefail
cd "$(dirname "$0")"
mkdir -p out
gcc -O2 -o out/mkcr2 tools/mkcr2.c -lm
-CARD=out/card
+CARD=${CARD:-out/card}
rm -rf "$CARD" && mkdir -p "$CARD/DCIM/100CANON" "$CARD/ML"
DIR="$CARD/DCIM/100CANON"
file=100
photos=()
[ -n "${PHOTOS:-}" ] && photos=("$PHOTOS"/*.pfm)
-# roll <number> <film> <exposures> <frames> <loaded> [nofiles]
+# roll <number> <film> <exposures> <frames> <loaded> [nofiles|jpeg|adobe]
+# nofiles the log only (the roll in the camera)
+# jpeg shot with a JPEG image quality: IMG_nnnn.JPG on the card, no CR2
+# adobe in Adobe RGB: the log says IMG_nnnn.CR2, Canon wrote _MG_nnnn.CR2
roll() {
- local n=$1 film=$2 exp=$3 frames=$4 loaded=$5 nofiles=${6:-} log
+ local n=$1 film=$2 exp=$3 frames=$4 loaded=$5 mode=${6:-} log
log="$DIR/ROLL_$(printf %03d "$n").TXT"
printf '# ML film mode roll log (filmroll module)\nroll = %03d\nfilm = %s\nexposures = %d\nloaded = %s:00\n\n' \
"$n" "$film" "$exp" "$loaded" > "$log"
@@ -34,7 +40,12 @@ roll() {
[ "$(head -c 64 "$p" | sed -n 2p | awk '{ print ($2 > $1) }')" = 1 ] && extra="--portrait"
scene="chart --image $p"
fi
- [ -z "$nofiles" ] && out/mkcr2 "$DIR/$name" --half --scene $scene $extra --ev "$ev" --seed $((n * 100 + i)) 2>/dev/null
+ case "$mode" in
+ nofiles) ;;
+ jpeg) printf 'not a CR2\n' > "$DIR/${name%.CR2}.JPG" ;;
+ adobe) out/mkcr2 "$DIR/_${name:1}" --half --scene $scene $extra --ev "$ev" --seed $((n * 100 + i)) 2>/dev/null ;;
+ *) out/mkcr2 "$DIR/$name" --half --scene $scene $extra --ev "$ev" --seed $((n * 100 + i)) 2>/dev/null ;;
+ esac
local t; t=$(printf '%02d:%02d:%02d' $((9 + i / 4)) $(((i * 7) % 60)) $(((i * 13) % 60)))
printf '%d %s %s %s f/%s\n' "$i" "$name" "${loaded%% *}" "$t" "$( ((i % 3)) && echo 2.8 || echo 5.6)" >> "$log"
done
@@ -42,8 +53,33 @@ roll() {
return 0
}
-roll 9 ektar100 12 12 "2026-10-12 08:30"
-roll 10 portra400 12 12 "2026-10-18 10:05"
-roll 11 gold200 12 8 "2026-10-20 19:40"
-roll 12 cinestill800t 36 14 "2026-10-21 18:02" nofiles # the one in the camera
+# a roll that ran past IMG_9999: Canon went on in 101CANON from IMG_0001, and
+# the camera started a log there too; IMG_9998 and IMG_9999 stay in 100CANON (#17)
+wrap_roll() {
+ local n=$1 film=$2 loaded=$3 i=0 name dir log note=""
+ for f in 100CANON:9998 100CANON:9999 101CANON:1 101CANON:2; do
+ i=$((i + 1)); dir="$CARD/DCIM/${f%%:*}"; name=$(printf IMG_%04d.CR2 "${f##*:}")
+ log="$dir/ROLL_$(printf %03d "$n").TXT"
+ mkdir -p "$dir"
+ [ "${f%%:*}" = 100CANON ] || note=" - continued from the previous DCIM folder"
+ [ -f "$log" ] || printf '# ML film mode roll log (filmroll module)%s\nroll = %03d\nfilm = %s\nexposures = 12\nloaded = %s:00\n\n' \
+ "$note" "$n" "$film" "$loaded" > "$log"
+ out/mkcr2 "$dir/$name" --half --scene chart --seed $((n * 100 + i)) 2>/dev/null
+ printf '%d %s %s 10:%02d:00 f/2.8\n' "$i" "$name" "${loaded%% *}" "$i" >> "$log"
+ done
+ printf '\n# rewound %s after 4 of 12 frames\n' "$loaded" >> "$log"
+}
+
+if [ "${1:-}" = "--problems" ]; then
+ file=500
+ roll 6 portra400 12 4 "2026-10-01 09:00" jpeg
+ roll 7 ektar100 12 4 "2026-10-02 09:00" adobe
+ rm "$DIR/_MG_0506.CR2" # frame 2: deleted on the camera
+ wrap_roll 8 gold200 "2026-10-03 09:00"
+else
+ roll 9 ektar100 12 12 "2026-10-12 08:30"
+ roll 10 portra400 12 12 "2026-10-18 10:05"
+ roll 11 gold200 12 8 "2026-10-20 19:40"
+ roll 12 cinestill800t 36 14 "2026-10-21 18:02" nofiles # the one in the camera
+fi
echo "card: $(find "$CARD" -name '*.CR2' | wc -l) CR2 files, $(du -sh "$CARD" | cut -f1)"
diff --git a/ml-dev/filmos/sim/scenes/darkroom_problems.txt b/ml-dev/filmos/sim/scenes/darkroom_problems.txt
new file mode 100644
index 0000000..c31405b
--- /dev/null
+++ b/ml-dev/filmos/sim/scenes/darkroom_problems.txt
@@ -0,0 +1,5 @@
+# the darkroom on the card of problem rolls (mkcard.sh --problems, cardtest.sh): develop all
+noroll
+open darkroom
+1500 info
+45000 end
diff --git a/ml-dev/fork/film-mode.patch b/ml-dev/fork/film-mode.patch
index 9229e19..5c7d9af 100644
--- a/ml-dev/fork/film-mode.patch
+++ b/ml-dev/fork/film-mode.patch
@@ -736,7 +736,7 @@ index 000000000..808a82ba0
+
diff --git a/src/filmroll.c b/src/filmroll.c
new file mode 100644
-index 000000000..e09bf2bbd
+index 000000000..60362f5f5
--- /dev/null
+++ b/src/filmroll.c
@@ -0,0 +1,1711 @@
@@ -1031,10 +1031,6 @@ index 000000000..e09bf2bbd
+ lens_set_rawiso(iso_to_raw(f->iso));
+}
+
-+/* 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. */
+/* 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()
@@ -1042,10 +1038,14 @@ index 000000000..e09bf2bbd
+ 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 = (pic_quality & 0xFE00FF) == (PICQ_RAW & 0xFE00FF);
++ 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);
@@ -13847,10 +13847,10 @@ index 000000000..ae60ddb83
+#endif
diff --git a/src/fos_lab.c b/src/fos_lab.c
new file mode 100644
-index 000000000..e0668e7db
+index 000000000..85cbb827d
--- /dev/null
+++ b/src/fos_lab.c
-@@ -0,0 +1,406 @@
+@@ -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
@@ -14236,11 +14236,19 @@ index 000000000..e0668e7db
+ }
+ /* 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); continue; }
++ 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 */
@@ -14255,6 +14263,16 @@ index 000000000..e0668e7db
+ }
+ 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
diff --git a/ml-dev/fork/src/filmroll.c b/ml-dev/fork/src/filmroll.c
index e09bf2b..60362f5 100644
--- a/ml-dev/fork/src/filmroll.c
+++ b/ml-dev/fork/src/filmroll.c
@@ -289,10 +289,6 @@ static void apply_film(int index)
lens_set_rawiso(iso_to_raw(f->iso));
}
-/* 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. */
/* 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()
@@ -300,10 +296,14 @@ 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 = (pic_quality & 0xFE00FF) == (PICQ_RAW & 0xFE00FF);
+ 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);