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.
C analog-photographycamera-firmwarecanoncanon-5d-mark-ivcanon-5dmark2canon-6dcanon-eoscr2darkroomeos-mfilm-emulationfilm-lookfilm-photographyfilm-simulationfujifilm-recipeskodak-portralutmagic-lanternphotographyraw
Darkroom: find the RAWs when the roll log's prefix isn't the file's (5D Mark III)
Claude646152cb42c1
diff --git a/ml-dev/filmos/fos_lab.c b/ml-dev/filmos/fos_lab.cindex bee53ac..7e07e04 100644--- a/ml-dev/filmos/fos_lab.c+++ b/ml-dev/filmos/fos_lab.c@@ -359,17 +359,29 @@ int fos_lab_frames(int roll, struct fos_lab_frame *frames, int max)void *f = fos_port_open(frames[i].cr2, 0);if (!f){- /* in Adobe RGB, Canon names the file _MG_0012.CR2, while the log- * (Magic Lantern's file prefix) says IMG_0012.CR2: the name's first- * letter becomes '_' */+ /* The log's name may not be the file's: it is Magic Lantern's file+ * prefix and the file number, and Canon's name differs:+ * - 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 cr2. */char *base = strrchr(frames[i].cr2, '/');base = base ? base + 1 : frames[i].cr2;- if (*base && *base != '_')+ if (strlen(base) == 12 && base[8] == '.') /* PPPPnnnn.CR2 */{- char was = *base;- *base = '_';- f = fos_port_open(frames[i].cr2, 0);- if (!f) *base = was;+ 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(frames[i].cr2, 0);+ }+ if (!f) memcpy(base, was, 4);}}if (f) fos_port_close(f);diff --git a/ml-dev/fork/film-mode.patch b/ml-dev/fork/film-mode.patchindex 4ffb6ad..9fa15a6 100644--- a/ml-dev/fork/film-mode.patch+++ b/ml-dev/fork/film-mode.patch@@ -13320,7 +13320,7 @@ new file mode 100644index 000000000..bee53acdc--- /dev/null+++ b/src/fos_lab.c-@@ -0,0 +1,379 @@+@@ -0,0 +1,391 @@+/* 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@@ -13682,17 +13682,29 @@ index 000000000..bee53acdc+ void *f = fos_port_open(frames[i].cr2, 0);+ if (!f)+ {-+ /* in Adobe RGB, Canon names the file _MG_0012.CR2, while the log-+ * (Magic Lantern's file prefix) says IMG_0012.CR2: the name's first-+ * letter becomes '_' */++ /* The log's name may not be the file's: it is Magic Lantern's file++ * prefix and the file number, and Canon's name differs:++ * - 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 cr2. */+ char *base = strrchr(frames[i].cr2, '/');+ base = base ? base + 1 : frames[i].cr2;-+ if (*base && *base != '_')++ if (strlen(base) == 12 && base[8] == '.') /* PPPPnnnn.CR2 */+ {-+ char was = *base;-+ *base = '_';-+ f = fos_port_open(frames[i].cr2, 0);-+ if (!f) *base = was;++ 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(frames[i].cr2, 0);++ }++ if (!f) memcpy(base, was, 4);+ }+ }+ if (f) fos_port_close(f);