diff --git a/programs/cmm/lib/gui/menu.h b/programs/cmm/lib/gui/menu.h index 09be90fa42..5f74100912 100644 --- a/programs/cmm/lib/gui/menu.h +++ b/programs/cmm/lib/gui/menu.h @@ -97,9 +97,11 @@ :dword get_menu_click() { - dword res = ESDWORD[shared_mem]; - ESDWORD[shared_mem] = 0; - return res; + //dword res = ESDWORD[shared_mem]; + char res[2]; + ReadFile(0, 2, #res, "/tmp0/1/menu.tmp"); + //ESDWORD[shared_mem] = 0; + return res[0]; } #endif \ No newline at end of file diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index 80acfd4a8c..6e7f824f7e 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -35,9 +35,9 @@ int GetNextParam() void GetWindowPosition() { int position, rez; - shared_mem = memopen(#shared_name, 20, SHM_WRITE); - win_x = ESDWORD[shared_mem + 4]; - win_y = ESDWORD[shared_mem + 8]; + shared_mem = memopen(#shared_name, 20, SHM_READ); + win_x = ESDWORD[shared_mem + 4]; + win_y = ESDWORD[shared_mem + 8]; position = ESDWORD[shared_mem + 12]; selected = ESDWORD[shared_mem + 16]; if (position==2) win_x -= menu1.w; @@ -75,17 +75,12 @@ void main() { proc_info Form; - if (!param) - die( -"'This is a menu component used in Eolite, WebView, etc... -Please forget it if you are not a developer ;)' -I"); + if (!param) die("'Menu component is for developers only' -I"); GetMenuItems(#param); max_name_len = strlen(names.get(0)) * 6; max_hotkey_len = strlen(hotkeys.get(0)) * 6; - //selected = ESDWORD[shared_mem]; - menu1.count = names.count; menu1.SetFont(6, 9, 0x80); menu1.SetSizes(2,2, max_name_len + max_hotkey_len + 23, menu1.count*ITEM_H, ITEM_H); @@ -174,12 +169,17 @@ void draw_list() void click() { - ESDWORD[shared_mem] = menu1.cur_y + 1; + char res[2]; + res[0] = menu1.cur_y + 1; + res[1] = '\0'; + //ESDWORD[shared_mem] = menu1.cur_y + 1; + CreateFile(2, #res, "/tmp0/1/menu.tmp"); ExitProcess(); } void exit() { - ESDWORD[shared_mem] = 0; + //ESDWORD[shared_mem] = 0; + CreateFile(2, 0, "/tmp0/1/menu.tmp"); ExitProcess(); }