I noticed function SetCDSGainStep associated with the string "SetCDSGainApex %d" (
again ) which sounds a lot like setting gain using sv96 units.
Investigating on sx710
It only works if the registration eventprocs 'FA.Create' and 'InitializeAdjustmentSystem' have been called. Calling the function directly (with appropriate pass by reference for the value) has no effect, likely because it depends on other stuff being initialized.
It sets the live view / video gain in sv96 units, relative to GetCurrentDriveBaseSvValue.
It appears to at least mostly work in AE modes, effectively locking live view AE. However, I did get a few "ASSERT!! BrtMthd.c Line 3927" crashes while messing with it. In AE modes, it updates the get_current_exp deletasv value. If AE is locked, it doesn't. It appears to work while recording video.
This suggests that videoexp3.lua could be made to work in proper ISO values by replacing
call_event_proc("SetCDSGain",sv96)
with
call_event_proc("SetCDSGainStep",sv96 - call_event_proc("GetCurrentDriveBaseSvValue"))
GetCurrentDriveBaseSvValue is only an eventproc on newer cameras (starting with DryOS 49), although the underlying function appears to exist back to digic 2 vxworks. The eventproc is also not present on the EOS M cameras.
Some other notes:
I did some testing sx160 (digic 4 + CCD)
GetCurrentDriveBaseSvValue seems to always be 795 (ISO market 1600),
although I've only tested with indoor lighting (edit: tested in direct sun, same).
Gain appears to be 167 per sv96 stop, although the first stop from ISO 100 to 200 was was only 112 gain and 64 sv96 (we've seen the first stop being wonky in manual ISO before). In both cases it works out to roughly 1.75 gain units per sv96 unit.
This puts 0 gain at about ISO 270.
In the sx160 firmware GetCdsPreGainReg is equivalent to GetSensorPreGain(0). I tried passing 0-10 to GetSensorPreGain, and it always returned 6.
I verified that get_current_tv96() + get_current_av96() - (deltasv + GetCurrentDriveBaseSvValue()) is roughly equal to the reported Bv in half press, for both sx160 and sx710.
The sx160 ISO values seem high, but the shutter speeds are correspondingly high going to to 1/10000 looking directly at a light. I suspect the live view mode is heavily binned.
It would be interesting to know how much of the difference between sx160 and sx710 is CCD vs CMOS or digic 4 vs digic 6. I suspect mostly the former, but all my digic 6 cams are CMOS and all my earlier ones are CCD.
Older cameras (through DryOS 23) have ImgGainTool.* eventprocs, which appear to provide some related functionality. In particular ImgGainTool.GetUserGainLimit and GetDeltaGainLimit might show us how to get acceptable ranges.