Test code[edit | edit source]


Dialog codes[edit | edit source]

Codes are camera-specific. We have to find (by trial and error) these combinations (only for interesting templates, of course):

  • template ID
  • valid string IDs (displayed as 1,2,3... etc)
  • correct palette

API[edit | edit source]

int test_dialog_btn_handler(void * dialog, int tmpl, gui_event_t event, int arg3, int arg4, int arg5, int arg6, int code); // similar to menu_handler, but different signature
test_dialog = CreateDialogBox(0, 0, test_dialog_btn_handler, template);
dialog_set_property_str(test_dialog, i, s);

Event handling[edit | edit source]

This seems to be common to most dialog handlers:

int NotifyBox_handler(void * dialog, int tmpl, gui_event_t event, int arg3, int arg4, int arg5, int arg6, int code) 
        notify_box_dlg = NULL; // don't destroy the dialog here!
        return 1;

        if (notify_box_dlg) DeleteDialogBox(notify_box_dlg); // not sure if I have to delete it here or not
        notify_box_dlg = NULL; 
        return dialog != arg4;
    return 1;

Locking mechanism[edit | edit source]

Work in progress. Calling dialog API from ML causes crashes.

  • Almost all CreateDialogBox are done from IDLEHandler, and they are surrounded by calls like this (with Indy's naming):
winsys_struct_1e774_set_0x30();  // lock winsys maybe (sets a boolean variable)
dialog_something_1();            // this takes and gives a semaphore (sync something)

dlg = CreateDialogBox(...)  // or Start***App()

winsys_struct_1e774_clr_0x30();  // unlock winsys maybe
AJ_KerRLock_n_WindowSig(dlg);    // this one is not called always
struct_1e774_0x40_something();   // that calls our old redraw!
  • Almost all boxes are destroyed from their dialog handler. When this is done, no locking mechanism is needed.
  • Some boxes are destroyed from outside the handler. In this case, the DeleteDialogBox call should be surrounded by:



(see for example the call to StopShootOlcInfoApp from handleDispsensorCtrl, at FF2134D8 in 550D)

Stubs[edit | edit source]

550D 109:
NSTUB(0xFF2B5EEC, CreateDialogBox)
NSTUB(0xFF2B5890, DeleteDialogBox) // aka dialog_destroy
NSTUB(0xFF2B67F4, dialog_redraw) // aka dialog_draw
NSTUB(0xFF31CDF8, dialog_set_property_str) // aka gui_draw_text_maybe

in the firmware[edit | edit source]

in 5dm2 2.1.1 dialog number 0xEC is the Factory Menu, so how looks like the code ?

ROM:FFBFB8D0                 MOV     R3, #0
ROM:FFBFB8D4                 STR     R3, [SP,#0x18+var_18]
ROM:FFBFB8D8                 MOV     R3, #0xEC
ROM:FFBFB8DC                 ADR     R2, factory_menu_handler
ROM:FFBFB8E0                 MOV     R1, #0
ROM:FFBFB8E4                 MOV     R0, #0
ROM:FFBFB8E8                 BL      CreateDialogBox

based on GUI_Resources format, we can locate related dialog data.

dialog 0xEC offset is 0x1c517c (base = 0xFF010000), and dialog data contains "Factory Menu":

0x0017e8d4: 0x000000ec 0x00047004 delta=0x017c 0x1c517c
0x1c51d0:  2c002d00 5c012800 00070210 46616374    ,.-.\.(.....Fact
0x1c51e0:  6f727920 4d656e75 00000000 000a0304    ory Menu........
0x1c51f0:  01000040 0d000303 22005900 8c020400    ...@....".Y.....

decoding on progress...

Refs[edit | edit source]

Community content is available under CC-BY-SA unless otherwise noted.