Beispiel #1
0
        /*-------------------------------------------------
        *   menu_main - handle the main menu
        *  -------------------------------------------------*/
        protected override void handle(event_ ev)
        {
            if (ev != null && (ev.iptkey == (int)ioport_type.IPT_UI_SELECT))
            {
                throw new emu_unimplemented();
#if false
#endif
            }
        }
Beispiel #2
0
 protected override void handle(event_ ev)
 {
     throw new emu_unimplemented();
 }
Beispiel #3
0
        /*-------------------------------------------------
        *   menu_sliders - handle the sliders menu
        *  -------------------------------------------------*/
        protected override void handle(event_ ev)
        {
            // process the menu
            if (ev != null)
            {
                if (ev.iptkey == (int)ioport_type.IPT_UI_ON_SCREEN_DISPLAY)
                {
                    // toggle visibility
                    if (m_menuless_mode)
                    {
                        stack_pop();
                    }
                    else
                    {
                        m_hidden = !m_hidden;
                        set_process_flags(PROCESS_LR_REPEAT | (m_hidden ? PROCESS_CUSTOM_ONLY : 0));
                    }
                }
                else if (ev.itemref != null && (ev.item.type() == menu_item_type.SLIDER))
                {
                    // handle keys if there is a valid item selected
                    slider_state slider        = (slider_state)ev.itemref;
                    int          curvalue      = slider.update(out _, slider_state.SLIDER_NOCHANGE);
                    int          increment     = 0;
                    bool         alt_pressed   = machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT);
                    bool         ctrl_pressed  = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
                    bool         shift_pressed = machine().input().code_pressed(KEYCODE_LSHIFT) || machine().input().code_pressed(KEYCODE_RSHIFT);

                    switch (ev.iptkey)
                    {
                    // decrease value
                    case (int)ioport_type.IPT_UI_LEFT:
                        if (alt_pressed && shift_pressed)
                        {
                            increment = -1;
                        }
                        else if (alt_pressed)
                        {
                            increment = -(curvalue - slider.minval);
                        }
                        else if (shift_pressed)
                        {
                            increment = (slider.incval > 10) ? -(slider.incval / 10) : -1;
                        }
                        else if (ctrl_pressed)
                        {
                            increment = -slider.incval * 10;
                        }
                        else
                        {
                            increment = -slider.incval;
                        }
                        break;

                    // increase value
                    case (int)ioport_type.IPT_UI_RIGHT:
                        if (alt_pressed && shift_pressed)
                        {
                            increment = 1;
                        }
                        else if (alt_pressed)
                        {
                            increment = slider.maxval - curvalue;
                        }
                        else if (shift_pressed)
                        {
                            increment = (slider.incval > 10) ? (slider.incval / 10) : 1;
                        }
                        else if (ctrl_pressed)
                        {
                            increment = slider.incval * 10;
                        }
                        else
                        {
                            increment = slider.incval;
                        }
                        break;

                    // restore default
                    case (int)ioport_type.IPT_UI_SELECT:
                    case (int)ioport_type.IPT_UI_CLEAR:
                        increment = slider.defval - curvalue;
                        break;
                    }

                    // handle any changes
                    if (increment != 0)
                    {
                        int32_t newvalue = curvalue + increment;

                        // clamp within bounds
                        if (newvalue < slider.minval)
                        {
                            newvalue = slider.minval;
                        }
                        if (newvalue > slider.maxval)
                        {
                            newvalue = slider.maxval;
                        }

                        /* update the slider and recompute the menu */
                        slider.update(out _, newvalue);
                        if (m_menuless_mode)
                        {
                            ui().get_session_data(typeof(menu_sliders), () => { return(ev.itemref); });  //ui().get_session_data<menu_sliders, void *>(nullptr) = ev->itemref;
                        }
                        reset(reset_options.REMEMBER_REF);
                    }
                }
                else if (m_hidden)
                {
                    // if we are selecting an invalid item and we are hidden, skip to the next one
                    if (ev.iptkey == (int)ioport_type.IPT_UI_UP || ev.iptkey == (int)ioport_type.IPT_UI_PAGE_UP)
                    {
                        // if we got here via up or page up, select the previous item
                        if (is_first_selected())
                        {
                            select_last_item();
                        }
                        else
                        {
                            set_selected_index(selected_index() - 1);
                            validate_selection(-1);
                        }
                    }
                    else if (ev.iptkey == (int)ioport_type.IPT_UI_DOWN || ev.iptkey == (int)ioport_type.IPT_UI_PAGE_DOWN)
                    {
                        // otherwise select the next item
                        if (is_last_selected())
                        {
                            select_first_item();
                        }
                        else
                        {
                            set_selected_index(selected_index() + 1);
                            validate_selection(1);
                        }
                    }
                }
            }
        }
Beispiel #4
0
        // handlers

        //-------------------------------------------------
        //  handle select key event
        //-------------------------------------------------
        void inkey_select(event_ menu_event)
        {
            var system    = (ui_system_info)menu_event.itemref;
            int driverint = menu_event.itemref is int?(int)menu_event.itemref : -1;

            if (driverint == CONF_OPTS)
            {
                // special case for configure options

                throw new emu_unimplemented();
#if false
#endif
            }
            else if (driverint == CONF_MACHINE)
            {
                // special case for configure machine

                throw new emu_unimplemented();
#if false
#endif
            }
            else
            {
                // anything else is a driver

                driver_enumerator enumerator = new driver_enumerator(machine().options(), system.driver);
                enumerator.next();

                // if there are software entries, show a software selection menu
                foreach (software_list_device swlistdev in new software_list_device_enumerator(enumerator.config().root_device()))
                {
                    if (!swlistdev.get_info().empty())
                    {
                        throw new emu_unimplemented();
#if false
#endif
                    }
                }

                // audit the system ROMs first to see if we're going to work
                media_auditor         auditor = new media_auditor(enumerator);
                media_auditor.summary summary = auditor.audit_media(media_auditor.AUDIT_VALIDATE_FAST);


                // MCS - always pass audit
                //throw new emu_unimplemented();
                summary = media_auditor.summary.CORRECT;


                // if everything looks good, schedule the new driver
                if (audit_passed(summary))
                {
                    if (!select_bios(system.driver, false))
                    {
                        launch_system(system.driver);
                    }
                }
                else
                {
                    // otherwise, display an error
                    set_error(reset_options.REMEMBER_REF, make_system_audit_fail_text(auditor, summary));
                }
            }
        }
Beispiel #5
0
        //-------------------------------------------------
        //  handle
        //-------------------------------------------------
        protected override void handle(event_ ev)
        {
            if (m_prev_selected != null)
            {
                m_prev_selected = item(0).ref_();
            }

            // if I have to reselect a software, force software list submenu
            if (reselect_last.get())
            {
                // FIXME: this is never hit, need a better way to return to software selection if necessary

                ui_system_info   system;
                ui_software_info software;
                get_selection(out software, out system);

                throw new emu_unimplemented();
#if false
                menu::stack_push <menu_select_software>(ui(), container(), *system);
#endif
                return;
            }

            // FIXME: everything above here used to run before events were processed

            // process the menu
            if (ev != null)
            {
                if (dismiss_error())
                {
                    // reset the error on any subsequent menu event
                }
                else
                {
                    switch (ev.iptkey)
                    {
                    case (int)ioport_type.IPT_UI_UP:
                        if ((get_focus() == focused_menu.LEFT) && ((int)machine_filter.type.FIRST < m_filter_highlight))
                        {
                            --m_filter_highlight;
                        }
                        break;

                    case (int)ioport_type.IPT_UI_DOWN:
                        if ((get_focus() == focused_menu.LEFT) && ((int)machine_filter.type.LAST > m_filter_highlight))
                        {
                            m_filter_highlight++;
                        }
                        break;

                    case (int)ioport_type.IPT_UI_HOME:
                        if (get_focus() == focused_menu.LEFT)
                        {
                            m_filter_highlight = (int)machine_filter.type.FIRST;
                        }
                        break;

                    case (int)ioport_type.IPT_UI_END:
                        if (get_focus() == focused_menu.LEFT)
                        {
                            m_filter_highlight = (int)machine_filter.type.LAST;
                        }
                        break;

                    case (int)ioport_type.IPT_UI_EXPORT:
                        inkey_export();
                        break;

                    case (int)ioport_type.IPT_UI_DATS:
                        inkey_dats();
                        break;

                    default:
                        if (ev.itemref != null)
                        {
                            switch (ev.iptkey)
                            {
                            case (int)ioport_type.IPT_UI_SELECT:
                                if (get_focus() == focused_menu.MAIN)
                                {
                                    if (m_populated_favorites)
                                    {
                                        inkey_select_favorite(ev);
                                    }
                                    else
                                    {
                                        inkey_select(ev);
                                    }
                                }
                                break;

                            case (int)ioport_type.IPT_CUSTOM:
                                // handle IPT_CUSTOM (mouse right click)
                                if (!m_populated_favorites)
                                {
                                    throw new emu_unimplemented();
#if false
#endif
                                }
                                else
                                {
                                    throw new emu_unimplemented();
#if false
#endif
                                }
                                break;

                            case (int)ioport_type.IPT_UI_LEFT:
                                if (ui_globals.rpanel == RP_IMAGES)
                                {
                                    // Images
                                    previous_image_view();
                                }
                                else if (ui_globals.rpanel == RP_INFOS)
                                {
                                    // Infos
                                    change_info_pane(-1);
                                }
                                break;

                            case (int)ioport_type.IPT_UI_RIGHT:
                                if (ui_globals.rpanel == RP_IMAGES)
                                {
                                    // Images
                                    next_image_view();
                                }
                                else if (ui_globals.rpanel == RP_INFOS)
                                {
                                    // Infos
                                    change_info_pane(1);
                                }
                                break;

                            case (int)ioport_type.IPT_UI_FAVORITES:
                                throw new emu_unimplemented();
#if false
#endif
                                break;

                            case (int)ioport_type.IPT_UI_AUDIT:
                                throw new emu_unimplemented();
#if false
#endif
                                break;
                            }
                        }
                        break;
                    }
                }
            }

            // if we're in an error state, overlay an error message
            draw_error_text();
        }
Beispiel #6
0
        //-------------------------------------------------
        //  handle select key event for favorites menu
        //-------------------------------------------------
        void inkey_select_favorite(event_ menu_event)
        {
            ui_software_info ui_swinfo = (ui_software_info)menu_event.itemref;
            int ui_swinfoint           = (int)menu_event.itemref;

            if (ui_swinfoint == CONF_OPTS)
            {
                throw new emu_unimplemented();
#if false
#endif
            }
            else if (ui_swinfoint == CONF_MACHINE)
            {
                // special case for configure machine
                if (m_prev_selected != null)
                {
                    ui_software_info swinfo = (ui_software_info)m_prev_selected;

                    throw new emu_unimplemented();
#if false
#endif
                }
                return;
            }
            else if (ui_swinfo.startempty == 1)
            {
                driver_enumerator enumerator = new driver_enumerator(machine().options(), ui_swinfo.driver);
                enumerator.next();

                // if there are software entries, show a software selection menu
                foreach (software_list_device swlistdev in new software_list_device_enumerator(enumerator.config().root_device()))
                {
                    if (!swlistdev.get_info().empty())
                    {
                        throw new emu_unimplemented();
#if false
#endif
                    }
                }

                // audit the system ROMs first to see if we're going to work
                media_auditor         auditor = new media_auditor(enumerator);
                media_auditor.summary summary = auditor.audit_media(media_auditor.AUDIT_VALIDATE_FAST);

                if (audit_passed(summary))
                {
                    // if everything looks good, schedule the new driver
                    if (!select_bios(ui_swinfo.driver, false))
                    {
                        reselect_last.reselect(true);
                        launch_system(ui_swinfo.driver);
                    }
                }
                else
                {
                    // otherwise, display an error
                    set_error(reset_options.REMEMBER_REF, make_system_audit_fail_text(auditor, summary));
                }
            }
            else
            {
                // first audit the system ROMs
                driver_enumerator drv     = new driver_enumerator(machine().options(), ui_swinfo.driver);
                media_auditor     auditor = new media_auditor(drv);
                drv.next();

                media_auditor.summary sysaudit = auditor.audit_media(media_auditor.AUDIT_VALIDATE_FAST);
                if (!audit_passed(sysaudit))
                {
                    set_error(reset_options.REMEMBER_REF, make_system_audit_fail_text(auditor, sysaudit));
                }
                else
                {
                    // now audit the software
                    software_list_device swlist = software_list_device.find_by_name(drv.config(), ui_swinfo.listname);
                    software_info        swinfo = swlist.find(ui_swinfo.shortname);

                    media_auditor.summary swaudit = auditor.audit_software(swlist, swinfo, media_auditor.AUDIT_VALIDATE_FAST);

                    if (audit_passed(swaudit))
                    {
                        throw new emu_unimplemented();
#if false
#endif
                    }
                    else
                    {
                        // otherwise, display an error
                        set_error(reset_options.REMEMBER_REF, make_software_audit_fail_text(auditor, swaudit));
                    }
                }
            }
        }