/** \file * Magic Lantern GUI main task. * * Overrides the DryOS gui_main_task() to be able to re-map events. *//* * Copyright (C) 2009 Trammell Hudson <hudson+ml@osresearch.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */#include "dryos.h"volatileintgui_show_menu;structgui_main_struct{void*obj;// off_0x00;uint32_tcounter;// off_0x04;uint32_toff_0x08;uint32_toff_0x0c;uint32_toff_0x10;uint32_toff_0x14;uint32_toff_0x18;uint32_toff_0x1c;uint32_toff_0x20;uint32_toff_0x24;uint32_toff_0x28;uint32_toff_0x2c;uint32_toff_0x30;structmsg_queue*msg_queue;// off_0x34;uint32_toff_0x38;uint32_toff_0x3c;};externstructgui_main_structgui_main_struct;structgui_timer_struct{void*obj;// off_0x00};externstructgui_timer_structgui_timer_struct;// Replaces the gui_main_taskstaticvoidmy_gui_main_task(void){gui_init_end();uint32_t*obj=0;gui_show_menu=0;while(1){structevent*event;msg_queue_receive(gui_main_struct.msg_queue,&event,0);if(!event)gotoevent_loop_bottom;#if 1if(event->type!=4&&(event->type!=2&&event->param!=0x16)&&(event->type!=2&&event->param!=0x31)){DebugMsg(DM_MAGIC,3,"Event: %x, %x, %x, %x",event->type,event->param,event->obj,event->arg);}#endifswitch(event->type){case0:if(gui_main_struct.obj!=obj&&event->param!=0x25&&event->param!=0x26&&event->param!=0x27&&event->param!=0x28&&event->param!=0x29&&event->param!=0x2A&&event->param!=0x1F&&event->param!=0x2B&&event->param!=0x23&&event->param!=0x2C&&event->param!=0x2D&&event->param!=0x2E&&event->param!=0x2F&&event->param!=0x30&&event->param!=0x31&&event->param!=0x32&&event->param!=0x3B)gotoqueue_clear;// Change the picture style button to show our menuif(event->param==0x13){gui_show_menu=!gui_show_menu;DebugMsg(DM_MAGIC,3,"gui_show_menu=%d",gui_show_menu);break;}DebugMsg(DM_MAGIC,2,"GUI_CONTROL:%d",event->param);gui_massive_event_loop(event->param,event->obj,event->arg);break;case1:if(gui_main_struct.obj!=obj&&event->param!=0x00&&event->param!=0x07&&event->param!=0x05)gotoqueue_clear;DebugMsg(0x84,2,"GUI_CHANGE_MODE:%d",event->param);if(event->param==0){gui_local_post(0x12,0,0);if(gui_timer_struct.obj)gui_timer_something(gui_timer_struct.obj,4);}gui_change_mode(event->param);break;case2:if(gui_main_struct.obj!=obj&&event->param!=0x17&&event->param!=0x18&&event->param!=0x14&&event->param!=0x1B&&event->param!=0x30&&event->param!=0x31)gotoqueue_clear;gui_local_post(event->param,event->obj,event->arg);break;case3:if(event->param==0x11){DebugMsg(0x84,2,"GUIOTHER_CANCEL_ALL_EVENT");obj=event->obj;break;}if(gui_main_struct.obj!=obj&&event->param!=0x00&&event->param!=0x03&&event->param!=0x01&&event->param!=0x12&&event->param!=0x13&&event->param!=0x14)gotoqueue_clear;DebugMsg(0x84,2,"GUI_OTHEREVENT:%d",event->param);gui_other_post(event->param,event->obj,event->arg);break;case4:gui_post_10000085(event->param,event->obj,event->arg);break;case5:gui_init_event(event->obj);break;case6:DebugMsg(0x84,2,"GUI_CHANGE_SHOOT_TYPE:%d",event->param);gui_change_shoot_type_post(event->param);break;case7:DebugMsg(0x84,2,"GUI_CHANGE_LCD_STATE:%d",event->param);gui_change_lcd_state_post(event->param);break;default:break;}event_loop_bottom:gui_main_struct.counter--;continue;queue_clear:DebugMsg(0x84,3,"**** Queue Clear **** event(%d) param(%d)",event->type,event->param);gotoevent_loop_bottom;}}TASK_OVERRIDE(gui_main_task,my_gui_main_task);