Bitmap VRAM (8-bit, palette)
Double-buffered.
- Display buffer: bmp_vram_info[1].vram2
- Draft buffer: (uintptr_t)(bmp_vram_info[1].vram2) ^ 0x80000;
How Canon drawing works[]
- dialog_draw is called
- this redraws current dialog box to draft buffer
- then, draft buffer is copied to display buffer, either normal or reversed (i.e. flipped horizontally)
Q: When does the firmware decide when to draw normal and when to draw reversed?[]
DebugMsg(4, 2, 'refresh whole fReverseScreen=%d', *(0x1e7ac))
A: when MEM(0x1e7ac) (in winsys_struct) is nonzero, it draws reversed.
Q: Can we prevent Canon graphics from updating the display buffer, but let them update the draft buffer?[]
A: Yes!
if *(0x1e7a0) == 0: if *(0x1e7ac) == 0: sub_FF2CA694(*(0x1e778), arg0 + MEM(124804), arg1, *(0x1e774)) if *(0x1e7ac) != 0: sub_FF2CA8B4(*(0x1e778), arg0 + MEM(124804), arg1, *(0x1e774)) DebugMsg(4, 2, msg='refresh partly x=%d y=%d w=%d h=%d', arg0, arg1, arg2, arg3, arg3, ...)
=>
MEM(0x1e7a0) = 1 is all we need :)
#define WINSYS_BMP_DIRTY_BIT_NEG MEM(0x1e7a0)
Q: So what?[]
A: We can do arbitrary transformations on BMP overlay!
e.g. flipping it upside down, rescaling it (hint: HDMI monitors), erasing Canon GUI elements...
... all with 0% flicker :)