Magic Lantern Firmware Wiki


328pages on
this wiki
Add New Page
Talk0 Share


We can replace firmware functions with our own.

Replacing tasksEdit

TASK_OVERRIDE( gui_main_task, my_gui_main_task );

Replacing GUI event handlersEdit

Our custom handler:

int my_handler(void * dialog, int tmpl, gui_event_t event, int arg3, void* arg4, int arg5, int arg6, int code) 
    // handle your events here
    int ans = original_handler(dialog, tmpl, event, arg3, arg4, arg5, arg6, code);
    // ... or here
    return ans;

How to setup it (put this on "don't click me" for example):

// call this from gui_main_task to avoid race condition when setting our own handler
extern thunk original_handler;
struct gui_task * current = gui_task_list.current;
struct dialog * dialog = current->priv;
if ( dialog->handler == &original_handler)
    dialog->handler = my_handler;


// how to find the original handler in the firmware
CreateDialogBox(0, 0, 0xFF123456 /*original_handler*/, template);
NSTUB(0xff123456, original_handler)

Replacing interrupt handlersEdit

register_interrupt('MREQ_ISR', 0x50, my_MREQ_ISR, 0);

Replacing functions from state objectsEdit


Replacing CBR (CallBack Routines)Edit

TODO (straightforward)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki