Finally started working on this, which has been on my TODO list for while.
Currently, the only thing that sort of knows about Canon raw is conf.c is_raw_exception. This checks PROPCASE_RESOLUTION == 5, which was RAW on old propset 2 and 3 cams. Later cams uses a separate propcase, and on some the resolution value 5 is re-used for a jpeg size, making this quite broken.
Some other cases where it would be useful for CHDK to be aware of Canon raw:
Remote shoot
The filewrite stuff works with Canon raw files, but for full functionality it needs to know how many files to expect, and getting the extension right would be nice too.
Script
It's nice for scripts to be able to know which formats are enabled, and set them differently from whatever you have set for manual shooting.
Background details:
Native raw cams, with OS and propset
g9 dry23, ps2
g10 dry31, ps2
sx1 dry31, ps2
g11 dry39, ps3
s90 dry39, ps3
s95 dry45, ps4
g12 dry45, ps4
g1x dry49, ps4
s100 dry49, ps4
s110 dry51, ps5
g15 dry51, ps5
sx50hs dry51, ps5
g16 dry52, ps6
s120 dry52, ps6? (no port yet)
g7x dry55p6, ps7
sx60hs dry55p6, ps8
m3 dry55p6, ps9
m10 dry57, ps10
All supported cams appear to use the CR2 image format. I thought the very earliest might be CRW, but the G9 manual specifically lists CR2. AFAIK none support the "sRAW" or "mRAW" formats found on some DSLRs. We don't yet support anything with the new CR3 format.
propset 2-3 enable raw by setting PROPCASE_RESOLUTION to 5. I expect just setting the propcase is sufficient, since it is for other resolutions. A separate propcase controls raw+jpeg, but it's unclear whether this can be controlled through propcases alone. (
https://chdk.fandom.com/wiki/PropertyCase mentions 280 on propset 2, both 214 or 284 for propset 3)
propset 4 and later cams use PROPCASE_IMAGE_FORMAT (0=raw, 1=jpeg, 2=both). This propcase can be found from the function UIFS_GetStillShotableNumber. It appears in the function regardless of whether the camera supports raw.
Setting PROPCASE_IMAGE_FORMAT is sufficient to change what is saved. On G7 X at least, it is possible to enable Canon raw in some modes where the camera does not normally support it, like portrait, toy camera etc. However, multi-shot modes like HDR crash. Setting it to non-jpeg values on cameras without raw support crashes.
to be continued...