~ubuntu-branches/ubuntu/lucid/sdlmame/lucid

« back to all changes in this revision

Viewing changes to src/emu/uimenu.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Falco
  • Date: 2009-11-03 17:10:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091103171015-6hop4ory5lxnumpn
Tags: 0.135-0ubuntu1
* New upstream release - Closes (LP: #403212)
* debian/watch: unstable releases are no longer detected
* mame.ini: added the cheat subdirectories to cheatpath so zipped
  cheatfiles will be searched too
* renamed crsshair subdirectory to crosshair to reflect upstream change
* mame.ini: renamed references to crosshair subdirectory (see above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#define UI_MENU_POOL_SIZE               65536
34
34
#define UI_MENU_ALLOC_ITEMS             256
35
35
 
36
 
#define MENU_TEXTCOLOR                  ARGB_WHITE
37
 
#define MENU_SELECTCOLOR                MAKE_ARGB(0xff,0xff,0xff,0x00)
38
 
#define MENU_UNAVAILABLECOLOR   MAKE_ARGB(0xff,0x40,0x40,0x40)
39
 
 
40
36
#define VISIBLE_GAMES_IN_LIST   15
41
37
 
42
38
#define MAX_PHYSICAL_DIPS               10
242
238
static const char backtext[] = "Return to " CAPSTARTGAMENOUN;
243
239
static const char exittext[] = "Exit";
244
240
 
245
 
static const rgb_t text_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0xff);
246
 
static const rgb_t text_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x80);
247
 
static const rgb_t sel_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x00);
248
 
static const rgb_t sel_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x00);
249
 
static const rgb_t mouseover_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
250
 
static const rgb_t mouseover_bgcolor = MAKE_ARGB(0x70,0x40,0x40,0x00);
251
 
static const rgb_t mousedown_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
252
 
static const rgb_t mousedown_bgcolor = MAKE_ARGB(0xB0,0x60,0x60,0x00);
253
 
 
254
241
 
255
242
 
256
243
/***************************************************************************
278
265
static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate);
279
266
static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state);
280
267
static int CLIB_DECL menu_input_compare_items(const void *i1, const void *i2);
281
 
static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
 
268
static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
282
269
static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state);
283
270
static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state);
284
271
static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state);
815
802
        x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
816
803
        y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER;
817
804
        if (!customonly)
818
 
                ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
 
805
                ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
819
806
 
820
807
        /* determine the first visible line based on the current selection */
821
808
        top_line = menu->selected - visible_lines / 2;
848
835
                        int itemnum = top_line + linenum;
849
836
                        const ui_menu_item *item = &menu->item[itemnum];
850
837
                        const char *itemtext = item->text;
851
 
                        rgb_t fgcolor = text_fgcolor;
852
 
                        rgb_t bgcolor = text_bgcolor;
 
838
                        rgb_t fgcolor = UI_TEXT_COLOR;
 
839
                        rgb_t bgcolor = UI_TEXT_BG_COLOR;
 
840
                        rgb_t fgcolor2 = UI_SUBITEM_COLOR;
 
841
                        rgb_t fgcolor3 = UI_CLONE_COLOR;
853
842
                        float line_x0 = x1 + 0.5f * UI_LINE_WIDTH;
854
843
                        float line_y0 = line_y;
855
844
                        float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
862
851
                        /* if we're selected, draw with a different background */
863
852
                        if (itemnum == menu->selected)
864
853
                        {
865
 
                                fgcolor = sel_fgcolor;
866
 
                                bgcolor = sel_bgcolor;
 
854
                                fgcolor = UI_SELECTED_COLOR;
 
855
                                bgcolor = UI_SELECTED_BG_COLOR;
 
856
                                fgcolor2 = UI_SELECTED_COLOR;
 
857
                                fgcolor3 = UI_SELECTED_COLOR;
867
858
                        }
868
859
 
869
860
                        /* else if the mouse is over this item, draw with a different background */
870
861
                        else if (itemnum == menu->hover)
871
862
                        {
872
 
                                fgcolor = mouseover_fgcolor;
873
 
                                bgcolor = mouseover_bgcolor;
 
863
                                fgcolor = UI_MOUSEOVER_COLOR;
 
864
                                bgcolor = UI_MOUSEOVER_BG_COLOR;
 
865
                                fgcolor2 = UI_MOUSEOVER_COLOR;
 
866
                                fgcolor3 = UI_MOUSEOVER_COLOR;
874
867
                        }
875
868
 
876
869
                        /* if we have some background hilighting to do, add a quad behind everything else */
877
 
                        if (bgcolor != text_bgcolor)
 
870
                        if (bgcolor != UI_TEXT_BG_COLOR)
878
871
                                render_ui_add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
879
872
                                                                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
880
873
 
908
901
 
909
902
                        /* if we're just a divider, draw a line */
910
903
                        else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
911
 
                                render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
904
                                render_ui_add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
912
905
 
913
906
                        /* if we don't have a subitem, just draw the string centered */
914
907
                        else if (item->subtext == NULL)
939
932
 
940
933
                                /* draw the subitem right-justified */
941
934
                                ui_draw_text_full(subitem_text, effective_left + item_width, line_y, effective_width - item_width,
942
 
                                                        JUSTIFY_RIGHT, WRAP_TRUNCATE, subitem_invert ? DRAW_OPAQUE : DRAW_NORMAL, fgcolor, bgcolor, &subitem_width, NULL);
 
935
                                                        JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, NULL);
943
936
 
944
937
                                /* apply arrows */
945
938
                                if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW))
989
982
                ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER,
990
983
                                                 target_y - UI_BOX_TB_BORDER,
991
984
                                                 target_x + target_width + UI_BOX_LR_BORDER,
992
 
                                                 target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? sel_bgcolor : UI_FILLCOLOR);
 
985
                                                 target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR);
993
986
                ui_draw_text_full(item->subtext, target_x, target_y, target_width,
994
 
                                        JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, sel_fgcolor, sel_bgcolor, NULL, NULL);
 
987
                                        JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
995
988
        }
996
989
 
997
 
        /* if there is somthing special to add, do it by calling the passed routine */
 
990
        /* if there is something special to add, do it by calling the passed routine */
998
991
        if (menu->custom != NULL)
999
992
        {
1000
993
                void *selectedref = (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL;
1051
1044
        ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER - gutter_width,
1052
1045
                                         target_y - UI_BOX_TB_BORDER,
1053
1046
                                         target_x + target_width + gutter_width + UI_BOX_LR_BORDER,
1054
 
                                         target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ?  UI_REDCOLOR : UI_FILLCOLOR);
 
1047
                                         target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ?  UI_RED_COLOR : UI_BACKGROUND_COLOR);
1055
1048
        ui_draw_text_full(text, target_x, target_y, target_width,
1056
 
                                JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
 
1049
                                JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
1057
1050
 
1058
1051
        /* draw the "return to prior menu" text with a hilight behind it */
1059
1052
        render_ui_add_quad(     target_x + 0.5f * UI_LINE_WIDTH,
1060
1053
                                                target_y + target_height - line_height,
1061
1054
                                                target_x + target_width - 0.5f * UI_LINE_WIDTH,
1062
1055
                                                target_y + target_height,
1063
 
                                                sel_bgcolor,
 
1056
                                                UI_SELECTED_BG_COLOR,
1064
1057
                                                hilight_texture,
1065
1058
                                                PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
1066
1059
        ui_draw_text_full(backtext, target_x, target_y + target_height - line_height, target_width,
1067
 
                                JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, sel_fgcolor, sel_bgcolor, NULL, NULL);
 
1060
                                JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
1068
1061
 
1069
1062
        /* artificially set the hover to the last item so a double-click exits */
1070
1063
        menu->hover = menu->numitems - 1;
1228
1221
        if (!ignorepause && exclusive_input_pressed(menu, IPT_UI_PAUSE, 0))
1229
1222
                mame_pause(menu->machine, !mame_is_paused(menu->machine));
1230
1223
 
 
1224
        /* handle a toggle cheats request */
 
1225
        if (ui_input_pressed_repeat(menu->machine, IPT_UI_TOGGLE_CHEAT, 0))
 
1226
                cheat_set_global_enable(menu->machine, !cheat_get_global_enable(menu->machine));
 
1227
 
1231
1228
        /* see if any other UI keys are pressed */
1232
1229
        if (menu->event.iptkey == IPT_INVALID)
1233
1230
                for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
1629
1626
                }
1630
1627
 
1631
1628
        /* sort and populate the menu in a standard fashion */
1632
 
        menu_input_populate_and_sort(menu, itemlist, menustate);
 
1629
        menu_input_populate_and_sort(machine, menu, itemlist, menustate);
1633
1630
        astring_free(tempstring);
1634
1631
}
1635
1632
 
1709
1706
                }
1710
1707
 
1711
1708
        /* sort and populate the menu in a standard fashion */
1712
 
        menu_input_populate_and_sort(menu, itemlist, menustate);
 
1709
        menu_input_populate_and_sort(machine, menu, itemlist, menustate);
1713
1710
        astring_free(tempstring);
1714
1711
}
1715
1712
 
1758
1755
                }
1759
1756
 
1760
1757
                /* poll again; if finished, update the sequence */
1761
 
                if (input_seq_poll(&newseq))
 
1758
                if (input_seq_poll(machine, &newseq))
1762
1759
                {
1763
1760
                        menustate->pollingitem = NULL;
1764
1761
                        menustate->record_next = TRUE;
1778
1775
                                menustate->pollingitem = item;
1779
1776
                                menustate->last_sortorder = item->sortorder;
1780
1777
                                menustate->starting_seq = item->seq;
1781
 
                                input_seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
 
1778
                                input_seq_poll_start(machine, (item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
1782
1779
                                invalidate = TRUE;
1783
1780
                                break;
1784
1781
 
1854
1851
    menu from them
1855
1852
-------------------------------------------------*/
1856
1853
 
1857
 
static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate)
 
1854
static void menu_input_populate_and_sort(running_machine *machine, ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate)
1858
1855
{
1859
1856
        const char *nameformat[INPUT_TYPE_TOTAL] = { 0 };
1860
1857
        input_item_data **itemarray, *item;
1900
1897
                /* otherwise, generate the sequence name and invert it if different from the default */
1901
1898
                else
1902
1899
                {
1903
 
                        input_seq_name(subtext, &item->seq);
 
1900
                        input_seq_name(machine, subtext, &item->seq);
1904
1901
                        flags |= input_seq_cmp(&item->seq, item->defseq) ? MENU_FLAG_INVERT : 0;
1905
1902
                }
1906
1903
 
2104
2101
        y2 = y1 + bottom;
2105
2102
 
2106
2103
        /* draw extra menu area */
2107
 
        ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
 
2104
        ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
2108
2105
        y1 += (float)DIP_SWITCH_SPACING;
2109
2106
 
2110
2107
        /* iterate over DIP switches */
2153
2150
                                                JUSTIFY_RIGHT,
2154
2151
                                                WRAP_NEVER,
2155
2152
                                                DRAW_NORMAL,
2156
 
                                                ARGB_WHITE,
 
2153
                                                UI_TEXT_COLOR,
2157
2154
                                                PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA),
2158
2155
                                                NULL ,
2159
2156
                                                NULL);
2169
2166
                float innerx1;
2170
2167
 
2171
2168
                /* first outline the switch */
2172
 
                ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_FILLCOLOR);
 
2169
                ui_draw_outlined_box(x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR);
2173
2170
 
2174
2171
                /* compute x1/x2 for the inner filled in switch */
2175
2172
                innerx1 = x1 + (switch_field_width - switch_width) / 2;
2179
2176
                {
2180
2177
                        float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
2181
2178
                        render_ui_add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
2182
 
                                                           (selectedmask & (1 << toggle)) ? MENU_SELECTCOLOR : ARGB_WHITE,
 
2179
                                                           (selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR,
2183
2180
                                                           PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2184
2181
                }
2185
2182
                else
2186
2183
                {
2187
2184
                        render_ui_add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
2188
 
                                                           MENU_UNAVAILABLECOLOR,
 
2185
                                                           UI_UNAVAILABLE_COLOR,
2189
2186
                                                           PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2190
2187
                }
2191
2188
 
2225
2222
 
2226
2223
                        /* left decrements */
2227
2224
                        case IPT_UI_LEFT:
2228
 
                                newval -= input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
 
2225
                                newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
2229
2226
                                break;
2230
2227
 
2231
2228
                        /* right increments */
2232
2229
                        case IPT_UI_RIGHT:
2233
 
                                newval += input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
 
2230
                                newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
2234
2231
                                break;
2235
2232
                }
2236
2233
 
2494
2491
        {
2495
2492
                int changed = FALSE;
2496
2493
 
2497
 
                /* handle reset all */
2498
 
                if ((FPTR)event->itemref == 1 && event->iptkey == IPT_UI_SELECT)
 
2494
                /* clear cheat comment on any movement or keypress */
 
2495
                popmessage(NULL);
 
2496
 
 
2497
                /* handle reset all + reset all cheats for reload all option */
 
2498
                if ((FPTR)event->itemref < 3 && event->iptkey == IPT_UI_SELECT)
2499
2499
                {
2500
2500
                        void *curcheat;
2501
2501
                        for (curcheat = cheat_get_next_menu_entry(machine, NULL, NULL, NULL, NULL);
2506
2506
                        }
2507
2507
                }
2508
2508
 
 
2509
 
2509
2510
                /* handle individual cheats */
2510
 
                else if ((FPTR)event->itemref > 1)
 
2511
                else if ((FPTR)event->itemref > 2)
2511
2512
                {
2512
2513
                        switch (event->iptkey)
2513
2514
                        {
2530
2531
                                case IPT_UI_RIGHT:
2531
2532
                                        changed = cheat_select_next_state(machine, event->itemref);
2532
2533
                                        break;
 
2534
 
 
2535
                                /* bring up display comment if one exists */
 
2536
                                case IPT_UI_DISPLAY_COMMENT:
 
2537
                                case IPT_UI_UP:
 
2538
                                case IPT_UI_DOWN:
 
2539
                                        if (cheat_get_comment(event->itemref) != NULL)
 
2540
                                                popmessage("Cheat Comment:\n%s", astring_c(cheat_get_comment(event->itemref)));
 
2541
                                        break;
2533
2542
                        }
2534
2543
                }
2535
2544
 
 
2545
                /* handle reload all  */
 
2546
                if ((FPTR)event->itemref == 2 && event->iptkey == IPT_UI_SELECT)
 
2547
                {
 
2548
                        /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */
 
2549
                        cheat_reload(machine);
 
2550
 
 
2551
                        /* display the reloaded cheats */
 
2552
                        ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
 
2553
                        popmessage("All cheats reloaded");
 
2554
                }
 
2555
 
2536
2556
                /* if things changed, update */
2537
2557
                if (changed)
2538
2558
                        ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
2563
2583
 
2564
2584
        /* add a reset all option */
2565
2585
        ui_menu_item_append(menu, "Reset All", NULL, 0, (void *)1);
 
2586
 
 
2587
        /* add a reload all cheats option */
 
2588
        ui_menu_item_append(menu, "Reload All", NULL, 0, (void *)2);
2566
2589
}
2567
2590
 
2568
2591
 
2716
2739
 
2717
2740
                                /* decrease value */
2718
2741
                                case IPT_UI_LEFT:
2719
 
                                        if (input_code_pressed(KEYCODE_LALT) || input_code_pressed(KEYCODE_RALT))
 
2742
                                        if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
2720
2743
                                                increment = -1;
2721
 
                                        else if (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT))
 
2744
                                        else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
2722
2745
                                                increment = (slider->incval > 10) ? -(slider->incval / 10) : -1;
2723
 
                                        else if (input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL))
 
2746
                                        else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
2724
2747
                                                increment = -slider->incval * 10;
2725
2748
                                        else
2726
2749
                                                increment = -slider->incval;
2728
2751
 
2729
2752
                                /* increase value */
2730
2753
                                case IPT_UI_RIGHT:
2731
 
                                        if (input_code_pressed(KEYCODE_LALT) || input_code_pressed(KEYCODE_RALT))
 
2754
                                        if (input_code_pressed(machine, KEYCODE_LALT) || input_code_pressed(machine, KEYCODE_RALT))
2732
2755
                                                increment = 1;
2733
 
                                        else if (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT))
 
2756
                                        else if (input_code_pressed(machine, KEYCODE_LSHIFT) || input_code_pressed(machine, KEYCODE_RSHIFT))
2734
2757
                                                increment = (slider->incval > 10) ? (slider->incval / 10) : 1;
2735
 
                                        else if (input_code_pressed(KEYCODE_LCONTROL) || input_code_pressed(KEYCODE_RCONTROL))
 
2758
                                        else if (input_code_pressed(machine, KEYCODE_LCONTROL) || input_code_pressed(machine, KEYCODE_RCONTROL))
2736
2759
                                                increment = slider->incval * 10;
2737
2760
                                        else
2738
2761
                                                increment = slider->incval;
2847
2870
                x2 = 1.0f - UI_BOX_LR_BORDER;
2848
2871
 
2849
2872
                /* draw extra menu area */
2850
 
                ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
 
2873
                ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
2851
2874
                y1 += UI_BOX_TB_BORDER;
2852
2875
 
2853
2876
                /* determine the text height */
2867
2890
                current_x = bar_left + bar_width * percentage;
2868
2891
 
2869
2892
                /* fill in the percentage */
2870
 
                render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
2893
                render_ui_add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2871
2894
 
2872
2895
                /* draw the top and bottom lines */
2873
 
                render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2874
 
                render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
2896
                render_ui_add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
2897
                render_ui_add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2875
2898
 
2876
2899
                /* draw default marker */
2877
 
                render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2878
 
                render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
2900
                render_ui_add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
 
2901
                render_ui_add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2879
2902
 
2880
2903
                /* draw the actual text */
2881
2904
                ui_draw_text_full(astring_c(tempstring), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
2882
 
                                        JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, &text_height);
 
2905
                                        JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, &text_height);
2883
2906
 
2884
2907
                astring_free(tempstring);
2885
2908
        }
3095
3118
 
3096
3119
                        /* left decrements */
3097
3120
                        case IPT_UI_LEFT:
3098
 
                                newval -= input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
 
3121
                                newval -= input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
3099
3122
                                break;
3100
3123
 
3101
3124
                        /* right increments */
3102
3125
                        case IPT_UI_RIGHT:
3103
 
                                newval += input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
 
3126
                                newval += input_code_pressed(machine, KEYCODE_LSHIFT) ? 10 : 1;
3104
3127
                                break;
3105
3128
                }
3106
3129
 
3221
3244
                        /* search for crosshair graphics */
3222
3245
 
3223
3246
                        /* open a path to the crosshairs */
3224
 
                        path = mame_openpath(mame_options(), OPTION_CRSSHAIRPATH);
 
3247
                        path = mame_openpath(mame_options(), OPTION_CROSSHAIRPATH);
3225
3248
                        if (path != NULL)
3226
3249
                        {
3227
3250
                                const osd_directory_entry *dir;
3244
3267
                                        /* look for files ending in .png with a name not larger then 9 chars*/
3245
3268
                                        if ((length > 4) && (length <= CROSSHAIR_PIC_NAME_LENGTH + 4) &&
3246
3269
                                                dir->name[length - 4] == '.' &&
3247
 
                                                tolower(dir->name[length - 3]) == 'p' &&
3248
 
                                                tolower(dir->name[length - 2]) == 'n' &&
3249
 
                                                tolower(dir->name[length - 1]) == 'g')
 
3270
                                                tolower((UINT8)dir->name[length - 3]) == 'p' &&
 
3271
                                                tolower((UINT8)dir->name[length - 2]) == 'n' &&
 
3272
                                                tolower((UINT8)dir->name[length - 1]) == 'g')
3250
3273
 
3251
3274
                                        {
3252
3275
                                                /* remove .png from length */
3443
3466
        if (menustate->error)
3444
3467
                ui_draw_text_box("The selected game is missing one or more required ROM or CHD images. "
3445
3468
                                 "Please select a different game.\n\nPress any key to continue.",
3446
 
                                 JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR);
 
3469
                                 JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
3447
3470
}
3448
3471
 
3449
3472
 
3557
3580
 
3558
3581
                        /* build a name for it */
3559
3582
                        for (src = dir->name; *src != 0 && *src != '.' && dst < &drivername[ARRAY_LENGTH(drivername) - 1]; src++)
3560
 
                                *dst++ = tolower(*src);
 
3583
                                *dst++ = tolower((UINT8)*src);
3561
3584
                        *dst = 0;
3562
3585
 
3563
3586
                        /* find it in the array */
3619
3642
        y2 = origy1 - UI_BOX_TB_BORDER;
3620
3643
 
3621
3644
        /* draw a box */
3622
 
        ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
 
3645
        ui_draw_outlined_box(x1, y1, x2, y2, UI_BACKGROUND_COLOR);
3623
3646
 
3624
3647
        /* take off the borders */
3625
3648
        x1 += UI_BOX_LR_BORDER;
3629
3652
 
3630
3653
        /* draw the text within it */
3631
3654
        ui_draw_text_full(&tempbuf[0][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
3632
 
                                          DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
 
3655
                                          DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
3633
3656
 
3634
3657
        /* determine the text to render below */
3635
3658
        driver = ((FPTR)selectedref > 1) ? (const game_driver *)selectedref : NULL;
3708
3731
        y2 = origy2 + bottom;
3709
3732
 
3710
3733
        /* draw a box */
3711
 
        color = UI_FILLCOLOR;
 
3734
        color = UI_BACKGROUND_COLOR;
 
3735
        if (driver != NULL)
 
3736
                color = UI_GREEN_COLOR;
3712
3737
        if (driver != NULL && (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_NO_SOUND | GAME_IMPERFECT_SOUND)) != 0)
3713
 
                color = UI_YELLOWCOLOR;
 
3738
                color = UI_YELLOW_COLOR;
3714
3739
        if (driver != NULL && (driver->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION)) != 0)
3715
 
                color = UI_REDCOLOR;
 
3740
                color = UI_RED_COLOR;
3716
3741
        ui_draw_outlined_box(x1, y1, x2, y2, color);
3717
3742
 
3718
3743
        /* take off the borders */
3725
3750
        for (line = 0; line < 4; line++)
3726
3751
        {
3727
3752
                ui_draw_text_full(&tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
3728
 
                                                  DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
 
3753
                                                  DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
3729
3754
                y1 += ui_get_line_height();
3730
3755
        }
3731
3756
}