src/emu/ui.c
| r7195 | r7196 | |
| 14 | 14 | #include "video/vector.h" |
| 15 | 15 | #include "machine/laserdsc.h" |
| 16 | 16 | #include "profiler.h" |
| 17 | | #include "cheat.h" |
| 18 | 17 | #include "render.h" |
| 18 | #include "cheat.h" |
| 19 | 19 | #include "rendfont.h" |
| 20 | 20 | #include "ui.h" |
| 21 | 21 | #include "uiinput.h" |
| r7195 | r7196 | |
| 54 | 54 | static render_font *ui_font; |
| 55 | 55 | |
| 56 | 56 | /* current UI handler */ |
| 57 | | static UINT32 (*ui_handler_callback)(running_machine *, UINT32); |
| 57 | static UINT32 (*ui_handler_callback)(running_machine *, render_container *, UINT32); |
| 58 | 58 | static UINT32 ui_handler_param; |
| 59 | 59 | |
| 60 | 60 | /* flag to track single stepping */ |
| r7195 | r7196 | |
| 91 | 91 | static astring &warnings_string(running_machine *machine, astring &buffer); |
| 92 | 92 | |
| 93 | 93 | /* UI handlers */ |
| 94 | | static UINT32 handler_messagebox(running_machine *machine, UINT32 state); |
| 95 | | static UINT32 handler_messagebox_ok(running_machine *machine, UINT32 state); |
| 96 | | static UINT32 handler_messagebox_anykey(running_machine *machine, UINT32 state); |
| 97 | | static UINT32 handler_ingame(running_machine *machine, UINT32 state); |
| 98 | | static UINT32 handler_load_save(running_machine *machine, UINT32 state); |
| 94 | static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state); |
| 95 | static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state); |
| 96 | static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state); |
| 97 | static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state); |
| 98 | static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state); |
| 99 | 99 | |
| 100 | 100 | /* slider controls */ |
| 101 | 101 | static slider_state *slider_alloc(running_machine *machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); |
| r7195 | r7196 | |
| 118 | 118 | static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *string, INT32 newval); |
| 119 | 119 | static INT32 slider_flicker(running_machine *machine, void *arg, astring *string, INT32 newval); |
| 120 | 120 | static INT32 slider_beam(running_machine *machine, void *arg, astring *string, INT32 newval); |
| 121 | | static char *slider_get_screen_desc(const device_config *screen); |
| 122 | | static char *slider_get_laserdisc_desc(const device_config *screen); |
| 121 | static char *slider_get_screen_desc(running_device *screen); |
| 122 | static char *slider_get_laserdisc_desc(running_device *screen); |
| 123 | 123 | #ifdef MAME_DEBUG |
| 124 | 124 | static INT32 slider_crossscale(running_machine *machine, void *arg, astring *string, INT32 newval); |
| 125 | 125 | static INT32 slider_crossoffset(running_machine *machine, void *arg, astring *string, INT32 newval); |
| r7195 | r7196 | |
| 135 | 135 | pair for the current UI handler |
| 136 | 136 | -------------------------------------------------*/ |
| 137 | 137 | |
| 138 | | INLINE UINT32 ui_set_handler(UINT32 (*callback)(running_machine *, UINT32), UINT32 param) |
| 138 | INLINE UINT32 ui_set_handler(UINT32 (*callback)(running_machine *, render_container *, UINT32), UINT32 param) |
| 139 | 139 | { |
| 140 | 140 | ui_handler_callback = callback; |
| 141 | 141 | ui_handler_param = param; |
| r7195 | r7196 | |
| 340 | 340 | render it; called by video.c |
| 341 | 341 | -------------------------------------------------*/ |
| 342 | 342 | |
| 343 | | void ui_update_and_render(running_machine *machine) |
| 343 | void ui_update_and_render(running_machine *machine, render_container *container) |
| 344 | 344 | { |
| 345 | 345 | /* always start clean */ |
| 346 | | render_container_empty(render_container_get_ui()); |
| 346 | render_container_empty(container); |
| 347 | 347 | |
| 348 | 348 | /* if we're paused, dim the whole screen */ |
| 349 | 349 | if (mame_get_phase(machine) >= MAME_PHASE_RESET && (single_step || mame_is_paused(machine))) |
| r7195 | r7196 | |
| 354 | 354 | if (alpha > 255) |
| 355 | 355 | alpha = 255; |
| 356 | 356 | if (alpha >= 0) |
| 357 | | render_ui_add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 357 | render_container_add_rect(container, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /* render any cheat stuff at the bottom */ |
| 361 | | cheat_render_text(machine); |
| 361 | cheat_render_text(machine, container); |
| 362 | 362 | |
| 363 | 363 | /* call the current UI handler */ |
| 364 | 364 | assert(ui_handler_callback != NULL); |
| 365 | | ui_handler_param = (*ui_handler_callback)(machine, ui_handler_param); |
| 365 | ui_handler_param = (*ui_handler_callback)(machine, container, ui_handler_param); |
| 366 | 366 | |
| 367 | 367 | /* display any popup messages */ |
| 368 | 368 | if (osd_ticks() < popup_text_end) |
| 369 | | ui_draw_text_box(messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor); |
| 369 | ui_draw_text_box(container, messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor); |
| 370 | 370 | else |
| 371 | 371 | popup_text_end = 0; |
| 372 | 372 | |
| r7195 | r7196 | |
| 462 | 462 | color |
| 463 | 463 | -------------------------------------------------*/ |
| 464 | 464 | |
| 465 | | void ui_draw_outlined_box(float x0, float y0, float x1, float y1, rgb_t backcolor) |
| 465 | void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor) |
| 466 | 466 | { |
| 467 | | render_ui_add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 468 | | render_ui_add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 469 | | render_ui_add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 470 | | render_ui_add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 471 | | render_ui_add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 467 | render_container_add_rect(container, x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 468 | render_container_add_line(container, x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 469 | render_container_add_line(container, x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 470 | render_container_add_line(container, x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 471 | render_container_add_line(container, x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | |
| r7195 | r7196 | |
| 476 | 476 | ui_draw_text - simple text renderer |
| 477 | 477 | -------------------------------------------------*/ |
| 478 | 478 | |
| 479 | | void ui_draw_text(const char *buf, float x, float y) |
| 479 | void ui_draw_text(render_container *container, const char *buf, float x, float y) |
| 480 | 480 | { |
| 481 | | ui_draw_text_full(buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 481 | ui_draw_text_full(container, buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | |
| r7195 | r7196 | |
| 488 | 488 | and full size computation |
| 489 | 489 | -------------------------------------------------*/ |
| 490 | 490 | |
| 491 | | void ui_draw_text_full(const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight) |
| 491 | void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight) |
| 492 | 492 | { |
| 493 | 493 | float lineheight = ui_get_line_height(); |
| 494 | 494 | const char *ends = origs + strlen(origs); |
| r7195 | r7196 | |
| 625 | 625 | |
| 626 | 626 | /* if opaque, add a black box */ |
| 627 | 627 | if (draw == DRAW_OPAQUE) |
| 628 | | render_ui_add_rect(curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 628 | render_container_add_rect(container, curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 629 | 629 | |
| 630 | 630 | /* loop from the line start and add the characters */ |
| 631 | 631 | while (linestart < s) |
| r7195 | r7196 | |
| 638 | 638 | |
| 639 | 639 | if (draw != DRAW_NONE) |
| 640 | 640 | { |
| 641 | | render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar); |
| 641 | render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar); |
| 642 | 642 | curx += ui_get_char_width(linechar); |
| 643 | 643 | } |
| 644 | 644 | linestart += linecharcount; |
| r7195 | r7196 | |
| 647 | 647 | /* append ellipses if needed */ |
| 648 | 648 | if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE) |
| 649 | 649 | { |
| 650 | | render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 650 | render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 651 | 651 | curx += ui_get_char_width('.'); |
| 652 | | render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 652 | render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 653 | 653 | curx += ui_get_char_width('.'); |
| 654 | | render_ui_add_char(curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 654 | render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); |
| 655 | 655 | curx += ui_get_char_width('.'); |
| 656 | 656 | } |
| 657 | 657 | |
| r7195 | r7196 | |
| 692 | 692 | message with a box around it |
| 693 | 693 | -------------------------------------------------*/ |
| 694 | 694 | |
| 695 | | void ui_draw_text_box(const char *text, int justify, float xpos, float ypos, rgb_t backcolor) |
| 695 | void ui_draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor) |
| 696 | 696 | { |
| 697 | 697 | float target_width, target_height; |
| 698 | 698 | float target_x, target_y; |
| 699 | 699 | |
| 700 | 700 | /* compute the multi-line target width/height */ |
| 701 | | ui_draw_text_full(text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER, |
| 701 | ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER, |
| 702 | 702 | justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); |
| 703 | 703 | if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) |
| 704 | 704 | target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height(); |
| r7195 | r7196 | |
| 718 | 718 | target_y = 1.0f - UI_BOX_TB_BORDER - target_height; |
| 719 | 719 | |
| 720 | 720 | /* add a box around that */ |
| 721 | | ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER, |
| 721 | ui_draw_outlined_box(container, target_x - UI_BOX_LR_BORDER, |
| 722 | 722 | target_y - UI_BOX_TB_BORDER, |
| 723 | 723 | target_x + target_width + UI_BOX_LR_BORDER, |
| 724 | 724 | target_y + target_height + UI_BOX_TB_BORDER, backcolor); |
| 725 | | ui_draw_text_full(text, target_x, target_y, target_width, |
| 725 | ui_draw_text_full(container, text, target_x, target_y, target_width, |
| 726 | 726 | justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); |
| 727 | 727 | } |
| 728 | 728 | |
| r7195 | r7196 | |
| 969 | 969 | astring &game_info_astring(running_machine *machine, astring &string) |
| 970 | 970 | { |
| 971 | 971 | int scrcount = video_screen_count(machine->config); |
| 972 | | const device_config *scandevice; |
| 973 | | const device_config *device; |
| 972 | running_device *scandevice; |
| 973 | running_device *device; |
| 974 | 974 | int found_sound = FALSE; |
| 975 | 975 | int count; |
| 976 | 976 | |
| r7195 | r7196 | |
| 985 | 985 | |
| 986 | 986 | /* count how many identical CPUs we have */ |
| 987 | 987 | count = 1; |
| 988 | | for (scandevice = device->typenext; scandevice != NULL; scandevice = scandevice->typenext) |
| 988 | for (scandevice = device->typenext(); scandevice != NULL; scandevice = scandevice->typenext()) |
| 989 | 989 | { |
| 990 | 990 | if (cpu_get_type(device) != cpu_get_type(scandevice) || device->clock != scandevice->clock) |
| 991 | 991 | break; |
| r7195 | r7196 | |
| 995 | 995 | /* if more than one, prepend a #x in front of the CPU name */ |
| 996 | 996 | if (count > 1) |
| 997 | 997 | string.catprintf("%d" UTF8_MULTIPLY, count); |
| 998 | | string.cat(cpu_get_name(device)); |
| 998 | string.cat(device->name()); |
| 999 | 999 | |
| 1000 | 1000 | /* display clock in kHz or MHz */ |
| 1001 | 1001 | if (clock >= 1000000) |
| r7195 | r7196 | |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | /* loop over all sound chips */ |
| 1008 | | for (device = sound_first(machine->config); device != NULL; device = scandevice) |
| 1008 | for (device = sound_first(machine); device != NULL; device = scandevice) |
| 1009 | 1009 | { |
| 1010 | 1010 | /* append the Sound: string */ |
| 1011 | 1011 | if (!found_sound) |
| r7195 | r7196 | |
| 1014 | 1014 | |
| 1015 | 1015 | /* count how many identical sound chips we have */ |
| 1016 | 1016 | count = 1; |
| 1017 | | for (scandevice = device->typenext; scandevice != NULL; scandevice = scandevice->typenext) |
| 1017 | for (scandevice = device->typenext(); scandevice != NULL; scandevice = scandevice->typenext()) |
| 1018 | 1018 | { |
| 1019 | 1019 | if (sound_get_type(device) != sound_get_type(scandevice) || device->clock != scandevice->clock) |
| 1020 | 1020 | break; |
| r7195 | r7196 | |
| 1024 | 1024 | /* if more than one, prepend a #x in front of the CPU name */ |
| 1025 | 1025 | if (count > 1) |
| 1026 | 1026 | string.catprintf("%d" UTF8_MULTIPLY, count); |
| 1027 | | string.cat(device_get_name(device)); |
| 1027 | string.cat(device->name()); |
| 1028 | 1028 | |
| 1029 | 1029 | /* display clock in kHz or MHz */ |
| 1030 | 1030 | if (device->clock >= 1000000) |
| r7195 | r7196 | |
| 1041 | 1041 | string.cat("None\n"); |
| 1042 | 1042 | else |
| 1043 | 1043 | { |
| 1044 | | const device_config *screen; |
| 1045 | | |
| 1046 | | for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen)) |
| 1044 | for (running_device *screen = video_screen_first(machine); screen != NULL; screen = video_screen_next(screen)) |
| 1047 | 1045 | { |
| 1048 | | const screen_config *scrconfig = (const screen_config *)screen->inline_config; |
| 1046 | const screen_config *scrconfig = (const screen_config *)screen->baseconfig().inline_config; |
| 1049 | 1047 | |
| 1050 | 1048 | if (scrcount > 1) |
| 1051 | 1049 | { |
| r7195 | r7196 | |
| 1082 | 1080 | messagebox_text string but handles no input |
| 1083 | 1081 | -------------------------------------------------*/ |
| 1084 | 1082 | |
| 1085 | | static UINT32 handler_messagebox(running_machine *machine, UINT32 state) |
| 1083 | static UINT32 handler_messagebox(running_machine *machine, render_container *container, UINT32 state) |
| 1086 | 1084 | { |
| 1087 | | ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1085 | ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1088 | 1086 | return 0; |
| 1089 | 1087 | } |
| 1090 | 1088 | |
| r7195 | r7196 | |
| 1094 | 1092 | messagebox_text string and waits for an OK |
| 1095 | 1093 | -------------------------------------------------*/ |
| 1096 | 1094 | |
| 1097 | | static UINT32 handler_messagebox_ok(running_machine *machine, UINT32 state) |
| 1095 | static UINT32 handler_messagebox_ok(running_machine *machine, render_container *container, UINT32 state) |
| 1098 | 1096 | { |
| 1099 | 1097 | /* draw a standard message window */ |
| 1100 | | ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1098 | ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1101 | 1099 | |
| 1102 | 1100 | /* an 'O' or left joystick kicks us to the next state */ |
| 1103 | 1101 | if (state == 0 && (input_code_pressed_once(machine, KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT))) |
| r7195 | r7196 | |
| 1124 | 1122 | any keypress |
| 1125 | 1123 | -------------------------------------------------*/ |
| 1126 | 1124 | |
| 1127 | | static UINT32 handler_messagebox_anykey(running_machine *machine, UINT32 state) |
| 1125 | static UINT32 handler_messagebox_anykey(running_machine *machine, render_container *container, UINT32 state) |
| 1128 | 1126 | { |
| 1129 | 1127 | /* draw a standard message window */ |
| 1130 | | ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1128 | ui_draw_text_box(container, messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); |
| 1131 | 1129 | |
| 1132 | 1130 | /* if the user cancels, exit out completely */ |
| 1133 | 1131 | if (ui_input_pressed(machine, IPT_UI_CANCEL)) |
| r7195 | r7196 | |
| 1149 | 1147 | of the standard keypresses |
| 1150 | 1148 | -------------------------------------------------*/ |
| 1151 | 1149 | |
| 1152 | | static UINT32 handler_ingame(running_machine *machine, UINT32 state) |
| 1150 | static UINT32 handler_ingame(running_machine *machine, render_container *container, UINT32 state) |
| 1153 | 1151 | { |
| 1154 | 1152 | int is_paused = mame_is_paused(machine); |
| 1155 | 1153 | |
| 1156 | 1154 | /* first draw the FPS counter */ |
| 1157 | 1155 | if (showfps || osd_ticks() < showfps_end) |
| 1158 | 1156 | { |
| 1159 | | ui_draw_text_full(video_get_speed_text(machine), 0.0f, 0.0f, 1.0f, |
| 1157 | ui_draw_text_full(container, video_get_speed_text(machine), 0.0f, 0.0f, 1.0f, |
| 1160 | 1158 | JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); |
| 1161 | 1159 | } |
| 1162 | 1160 | else |
| r7195 | r7196 | |
| 1167 | 1165 | { |
| 1168 | 1166 | astring profilertext; |
| 1169 | 1167 | profiler_get_text(machine, profilertext); |
| 1170 | | ui_draw_text_full(profilertext, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); |
| 1168 | ui_draw_text_full(container, profilertext, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); |
| 1171 | 1169 | } |
| 1172 | 1170 | |
| 1173 | 1171 | /* if we're single-stepping, pause now */ |
| r7195 | r7196 | |
| 1314 | 1312 | specifying a game to save or load |
| 1315 | 1313 | -------------------------------------------------*/ |
| 1316 | 1314 | |
| 1317 | | static UINT32 handler_load_save(running_machine *machine, UINT32 state) |
| 1315 | static UINT32 handler_load_save(running_machine *machine, render_container *container, UINT32 state) |
| 1318 | 1316 | { |
| 1319 | 1317 | char filename[20]; |
| 1320 | 1318 | input_code code; |
| r7195 | r7196 | |
| 1326 | 1324 | |
| 1327 | 1325 | /* okay, we're waiting for a key to select a slot; display a message */ |
| 1328 | 1326 | if (state == LOADSAVE_SAVE) |
| 1329 | | ui_draw_message_window("Select position to save to"); |
| 1327 | ui_draw_message_window(container, "Select position to save to"); |
| 1330 | 1328 | else |
| 1331 | | ui_draw_message_window("Select position to load from"); |
| 1329 | ui_draw_message_window(container, "Select position to load from"); |
| 1332 | 1330 | |
| 1333 | 1331 | /* check for cancel key */ |
| 1334 | 1332 | if (ui_input_pressed(machine, IPT_UI_CANCEL)) |
| r7195 | r7196 | |
| 1423 | 1421 | { |
| 1424 | 1422 | const input_field_config *field; |
| 1425 | 1423 | const input_port_config *port; |
| 1426 | | const device_config *device; |
| 1424 | running_device *device; |
| 1427 | 1425 | slider_state *listhead = NULL; |
| 1428 | 1426 | slider_state **tailptr = &listhead; |
| 1429 | 1427 | astring string; |
| r7195 | r7196 | |
| 1449 | 1447 | } |
| 1450 | 1448 | |
| 1451 | 1449 | /* add analog adjusters */ |
| 1452 | | for (port = machine->portlist.head; port != NULL; port = port->next) |
| 1450 | for (port = machine->portlist.first(); port != NULL; port = port->next) |
| 1453 | 1451 | for (field = port->fieldlist; field != NULL; field = field->next) |
| 1454 | 1452 | if (field->type == IPT_ADJUSTER) |
| 1455 | 1453 | { |
| r7195 | r7196 | |
| 1471 | 1469 | } |
| 1472 | 1470 | |
| 1473 | 1471 | /* add screen parameters */ |
| 1474 | | for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) |
| 1472 | for (device = video_screen_first(machine); device != NULL; device = video_screen_next(device)) |
| 1475 | 1473 | { |
| 1476 | | const screen_config *scrconfig = (const screen_config *)device->inline_config; |
| 1474 | const screen_config *scrconfig = (const screen_config *)device->baseconfig().inline_config; |
| 1477 | 1475 | int defxscale = floor(scrconfig->xscale * 1000.0f + 0.5f); |
| 1478 | 1476 | int defyscale = floor(scrconfig->yscale * 1000.0f + 0.5f); |
| 1479 | 1477 | int defxoffset = floor(scrconfig->xoffset * 1000.0f + 0.5f); |
| r7195 | r7196 | |
| 1514 | 1512 | tailptr = &(*tailptr)->next; |
| 1515 | 1513 | } |
| 1516 | 1514 | |
| 1517 | | for (device = device_list_first(&machine->config->devicelist, LASERDISC); device != NULL; device = device_list_next(device, LASERDISC)) |
| 1515 | for (device = machine->devicelist.first(LASERDISC); device != NULL; device = device->typenext()) |
| 1518 | 1516 | { |
| 1519 | | const laserdisc_config *config = (const laserdisc_config *)device->inline_config; |
| 1517 | const laserdisc_config *config = (const laserdisc_config *)device->baseconfig().inline_config; |
| 1520 | 1518 | if (config->overupdate != NULL) |
| 1521 | 1519 | { |
| 1522 | 1520 | int defxscale = floor(config->overscalex * 1000.0f + 0.5f); |
| r7195 | r7196 | |
| 1541 | 1539 | } |
| 1542 | 1540 | } |
| 1543 | 1541 | |
| 1544 | | for (device = video_screen_first(machine->config); device != NULL; device = video_screen_next(device)) |
| 1542 | for (device = video_screen_first(machine); device != NULL; device = video_screen_next(device)) |
| 1545 | 1543 | { |
| 1546 | | const screen_config *scrconfig = (const screen_config *)device->inline_config; |
| 1544 | const screen_config *scrconfig = (const screen_config *)device->baseconfig().inline_config; |
| 1547 | 1545 | if (scrconfig->type == SCREEN_TYPE_VECTOR) |
| 1548 | 1546 | { |
| 1549 | 1547 | /* add flicker control */ |
| r7195 | r7196 | |
| 1557 | 1555 | |
| 1558 | 1556 | #ifdef MAME_DEBUG |
| 1559 | 1557 | /* add crosshair adjusters */ |
| 1560 | | for (port = machine->portlist.head; port != NULL; port = port->next) |
| 1558 | for (port = machine->portlist.first(); port != NULL; port = port->next) |
| 1561 | 1559 | for (field = port->fieldlist; field != NULL; field = field->next) |
| 1562 | 1560 | if (field->crossaxis != CROSSHAIR_AXIS_NONE && field->player == 0) |
| 1563 | 1561 | { |
| r7195 | r7196 | |
| 1634 | 1632 | |
| 1635 | 1633 | static INT32 slider_overclock(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1636 | 1634 | { |
| 1637 | | const device_config *cpu = (const device_config *)arg; |
| 1635 | running_device *cpu = (running_device *)arg; |
| 1638 | 1636 | if (newval != SLIDER_NOCHANGE) |
| 1639 | 1637 | cpu_set_clockscale(cpu, (float)newval * 0.001f); |
| 1640 | 1638 | if (string != NULL) |
| r7195 | r7196 | |
| 1649 | 1647 | |
| 1650 | 1648 | static INT32 slider_refresh(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1651 | 1649 | { |
| 1652 | | const device_config *screen = (const device_config *)arg; |
| 1653 | | const screen_config *scrconfig = (const screen_config *)screen->inline_config; |
| 1650 | running_device *screen = (running_device *)arg; |
| 1651 | const screen_config *scrconfig = (const screen_config *)screen->baseconfig().inline_config; |
| 1654 | 1652 | double defrefresh = ATTOSECONDS_TO_HZ(scrconfig->refresh); |
| 1655 | 1653 | double refresh; |
| 1656 | 1654 | |
| r7195 | r7196 | |
| 1676 | 1674 | |
| 1677 | 1675 | static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1678 | 1676 | { |
| 1679 | | const device_config *screen = (const device_config *)arg; |
| 1677 | running_device *screen = (running_device *)arg; |
| 1680 | 1678 | render_container *container = render_container_get_screen(screen); |
| 1681 | 1679 | render_container_user_settings settings; |
| 1682 | 1680 | |
| r7195 | r7196 | |
| 1699 | 1697 | |
| 1700 | 1698 | static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1701 | 1699 | { |
| 1702 | | const device_config *screen = (const device_config *)arg; |
| 1700 | running_device *screen = (running_device *)arg; |
| 1703 | 1701 | render_container *container = render_container_get_screen(screen); |
| 1704 | 1702 | render_container_user_settings settings; |
| 1705 | 1703 | |
| r7195 | r7196 | |
| 1721 | 1719 | |
| 1722 | 1720 | static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1723 | 1721 | { |
| 1724 | | const device_config *screen = (const device_config *)arg; |
| 1722 | running_device *screen = (running_device *)arg; |
| 1725 | 1723 | render_container *container = render_container_get_screen(screen); |
| 1726 | 1724 | render_container_user_settings settings; |
| 1727 | 1725 | |
| r7195 | r7196 | |
| 1744 | 1742 | |
| 1745 | 1743 | static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1746 | 1744 | { |
| 1747 | | const device_config *screen = (const device_config *)arg; |
| 1745 | running_device *screen = (running_device *)arg; |
| 1748 | 1746 | render_container *container = render_container_get_screen(screen); |
| 1749 | 1747 | render_container_user_settings settings; |
| 1750 | 1748 | |
| r7195 | r7196 | |
| 1767 | 1765 | |
| 1768 | 1766 | static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1769 | 1767 | { |
| 1770 | | const device_config *screen = (const device_config *)arg; |
| 1768 | running_device *screen = (running_device *)arg; |
| 1771 | 1769 | render_container *container = render_container_get_screen(screen); |
| 1772 | 1770 | render_container_user_settings settings; |
| 1773 | 1771 | |
| r7195 | r7196 | |
| 1790 | 1788 | |
| 1791 | 1789 | static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1792 | 1790 | { |
| 1793 | | const device_config *screen = (const device_config *)arg; |
| 1791 | running_device *screen = (running_device *)arg; |
| 1794 | 1792 | render_container *container = render_container_get_screen(screen); |
| 1795 | 1793 | render_container_user_settings settings; |
| 1796 | 1794 | |
| r7195 | r7196 | |
| 1813 | 1811 | |
| 1814 | 1812 | static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1815 | 1813 | { |
| 1816 | | const device_config *screen = (const device_config *)arg; |
| 1814 | running_device *screen = (running_device *)arg; |
| 1817 | 1815 | render_container *container = render_container_get_screen(screen); |
| 1818 | 1816 | render_container_user_settings settings; |
| 1819 | 1817 | |
| r7195 | r7196 | |
| 1836 | 1834 | |
| 1837 | 1835 | static INT32 slider_overxscale(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1838 | 1836 | { |
| 1839 | | const device_config *laserdisc = (const device_config *)arg; |
| 1837 | running_device *laserdisc = (running_device *)arg; |
| 1840 | 1838 | laserdisc_config settings; |
| 1841 | 1839 | |
| 1842 | 1840 | laserdisc_get_config(laserdisc, &settings); |
| r7195 | r7196 | |
| 1858 | 1856 | |
| 1859 | 1857 | static INT32 slider_overyscale(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1860 | 1858 | { |
| 1861 | | const device_config *laserdisc = (const device_config *)arg; |
| 1859 | running_device *laserdisc = (running_device *)arg; |
| 1862 | 1860 | laserdisc_config settings; |
| 1863 | 1861 | |
| 1864 | 1862 | laserdisc_get_config(laserdisc, &settings); |
| r7195 | r7196 | |
| 1880 | 1878 | |
| 1881 | 1879 | static INT32 slider_overxoffset(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1882 | 1880 | { |
| 1883 | | const device_config *laserdisc = (const device_config *)arg; |
| 1881 | running_device *laserdisc = (running_device *)arg; |
| 1884 | 1882 | laserdisc_config settings; |
| 1885 | 1883 | |
| 1886 | 1884 | laserdisc_get_config(laserdisc, &settings); |
| r7195 | r7196 | |
| 1902 | 1900 | |
| 1903 | 1901 | static INT32 slider_overyoffset(running_machine *machine, void *arg, astring *string, INT32 newval) |
| 1904 | 1902 | { |
| 1905 | | const device_config *laserdisc = (const device_config *)arg; |
| 1903 | running_device *laserdisc = (running_device *)arg; |
| 1906 | 1904 | laserdisc_config settings; |
| 1907 | 1905 | |
| 1908 | 1906 | laserdisc_get_config(laserdisc, &settings); |
| r7195 | r7196 | |
| 1952 | 1950 | description for a given screen |
| 1953 | 1951 | -------------------------------------------------*/ |
| 1954 | 1952 | |
| 1955 | | static char *slider_get_screen_desc(const device_config *screen) |
| 1953 | static char *slider_get_screen_desc(running_device *screen) |
| 1956 | 1954 | { |
| 1957 | 1955 | int screen_count = video_screen_count(screen->machine->config); |
| 1958 | 1956 | static char descbuf[256]; |
| r7195 | r7196 | |
| 1971 | 1969 | description for a given laseridsc |
| 1972 | 1970 | -------------------------------------------------*/ |
| 1973 | 1971 | |
| 1974 | | static char *slider_get_laserdisc_desc(const device_config *laserdisc) |
| 1972 | static char *slider_get_laserdisc_desc(running_device *laserdisc) |
| 1975 | 1973 | { |
| 1976 | | int ldcount = device_list_items(&laserdisc->machine->config->devicelist, LASERDISC); |
| 1974 | int ldcount = laserdisc->machine->devicelist.count(LASERDISC); |
| 1977 | 1975 | static char descbuf[256]; |
| 1978 | 1976 | |
| 1979 | 1977 | if (ldcount > 1) |