reverting to classic ui due to lot of issues, as much as I hate reverting some else code (nw)

This commit is contained in:
Miodrag Milanovic 2014-04-17 06:27:03 +00:00
parent 7b75f417f7
commit 452df5037b
36 changed files with 1015 additions and 2579 deletions

8
.gitattributes vendored
View File

@ -3075,18 +3075,18 @@ src/emu/timer.h svneol=native#text/plain
src/emu/ui/barcode.c svneol=native#text/plain
src/emu/ui/barcode.h svneol=native#text/plain
src/emu/ui/devctrl.h svneol=native#text/plain
src/emu/ui/emenubar.c svneol=native#text/plain
src/emu/ui/emenubar.h svneol=native#text/plain
src/emu/ui/filemngr.c svneol=native#text/plain
src/emu/ui/filemngr.h svneol=native#text/plain
src/emu/ui/filesel.c svneol=native#text/plain
src/emu/ui/filesel.h svneol=native#text/plain
src/emu/ui/imgcntrl.c svneol=native#text/plain
src/emu/ui/imgcntrl.h svneol=native#text/plain
src/emu/ui/imginfo.c svneol=native#text/plain
src/emu/ui/imginfo.h svneol=native#text/plain
src/emu/ui/mainmenu.c svneol=native#text/plain
src/emu/ui/mainmenu.h svneol=native#text/plain
src/emu/ui/menu.c svneol=native#text/plain
src/emu/ui/menu.h svneol=native#text/plain
src/emu/ui/menubar.c svneol=native#text/plain
src/emu/ui/menubar.h svneol=native#text/plain
src/emu/ui/miscmenu.c svneol=native#text/plain
src/emu/ui/miscmenu.h svneol=native#text/plain
src/emu/ui/selgame.c svneol=native#text/plain

View File

@ -116,10 +116,10 @@ EMUOBJS = \
$(EMUOBJ)/ui/ui.o \
$(EMUOBJ)/ui/swlist.o \
$(EMUOBJ)/ui/menu.o \
$(EMUOBJ)/ui/menubar.o \
$(EMUOBJ)/ui/emenubar.o \
$(EMUOBJ)/ui/mainmenu.o \
$(EMUOBJ)/ui/miscmenu.o \
$(EMUOBJ)/ui/selgame.o \
$(EMUOBJ)/ui/filemngr.o \
$(EMUOBJ)/ui/filesel.o \
$(EMUOBJ)/ui/imgcntrl.o \
$(EMUOBJ)/ui/imginfo.o \

View File

@ -167,7 +167,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" },
{ OPTION_UI_FONT, "default", OPTION_STRING, "specify a font to use" },
{ OPTION_RAMSIZE ";ram", NULL, OPTION_STRING, "size of RAM (if supported by driver)" },
{ OPTION_CONFIRM_QUIT, "1", OPTION_BOOLEAN, "display confirm quit screen on exit" },
{ OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" },
{ OPTION_UI_MOUSE, "0", OPTION_BOOLEAN, "display ui mouse cursor" },
{ OPTION_AUTOBOOT_COMMAND ";ab", NULL, OPTION_STRING, "command to execute after machine boot" },
{ OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },

View File

@ -709,72 +709,66 @@ void construct_core_types_keypad(simple_list<input_type_entry> &typelist)
INPUT_PORT_DIGITAL_TYPE( 0, OTHER, KEYBOARD, "Keyboard", input_seq() )
}
void construct_core_types_ui_general(simple_list<input_type_entry> &typelist)
void construct_core_types_UI(simple_list<input_type_entry> &typelist)
{
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_CONFIGURE, "Config Menu", input_seq(KEYCODE_TAB) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_DOWN, "UI Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_LEFT, "UI Left", input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_RIGHT, "UI Right", input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_HOME, "UI Home", input_seq(KEYCODE_HOME) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_END, "UI End", input_seq(KEYCODE_END) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_PAGE_UP, "UI Page Up", input_seq(KEYCODE_PGUP) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_PAGE_DOWN, "UI Page Down", input_seq(KEYCODE_PGDN) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_SELECT, "UI Select", input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_CANCEL, "UI Cancel", input_seq(KEYCODE_ESC) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_DISPLAY_COMMENT, "UI Display Comment", input_seq(KEYCODE_SPACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_CLEAR, "UI Clear", input_seq(KEYCODE_DEL) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_ZOOM_IN, "UI Zoom In", input_seq(KEYCODE_EQUALS) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_ZOOM_OUT, "UI Zoom Out", input_seq(KEYCODE_MINUS) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_PREV_GROUP, "UI Previous Group", input_seq(KEYCODE_OPENBRACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, UI_NEXT_GROUP, "UI Next Group", input_seq(KEYCODE_CLOSEBRACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ON_SCREEN_DISPLAY,"On Screen Display", input_seq(KEYCODE_TILDE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DEBUG_BREAK, "Break in Debugger", input_seq(KEYCODE_TILDE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CONFIGURE, "Config Menu", input_seq(KEYCODE_TAB) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAUSE, "Pause", input_seq(KEYCODE_P) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RESET_MACHINE, "Reset Game", input_seq(KEYCODE_F3, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SOFT_RESET, "Soft Reset", input_seq(KEYCODE_F3, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_GFX, "Show Gfx", input_seq(KEYCODE_F4) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FRAMESKIP_DEC, "Frameskip Dec", input_seq(KEYCODE_F8) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FRAMESKIP_INC, "Frameskip Inc", input_seq(KEYCODE_F9) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_THROTTLE, "Throttle", input_seq(KEYCODE_F10) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_FAST_FORWARD, "Fast Forward", input_seq(KEYCODE_INSERT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_FPS, "Show FPS", input_seq(KEYCODE_F11, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SNAPSHOT, "Save Snapshot", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RECORD_MOVIE, "Record Movie", input_seq(KEYCODE_F12, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_CHEAT, "Toggle Cheat", input_seq(KEYCODE_F6) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_UP, "UI Up", input_seq(KEYCODE_UP, input_seq::or_code, JOYCODE_Y_UP_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DOWN, "UI Down", input_seq(KEYCODE_DOWN, input_seq::or_code, JOYCODE_Y_DOWN_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LEFT, "UI Left", input_seq(KEYCODE_LEFT, input_seq::or_code, JOYCODE_X_LEFT_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_RIGHT, "UI Right", input_seq(KEYCODE_RIGHT, input_seq::or_code, JOYCODE_X_RIGHT_SWITCH_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_HOME, "UI Home", input_seq(KEYCODE_HOME) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_END, "UI End", input_seq(KEYCODE_END) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_UP, "UI Page Up", input_seq(KEYCODE_PGUP) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PAGE_DOWN, "UI Page Down", input_seq(KEYCODE_PGDN) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SELECT, "UI Select", input_seq(KEYCODE_ENTER, input_seq::or_code, JOYCODE_BUTTON1_INDEXED(0)) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CANCEL, "UI Cancel", input_seq(KEYCODE_ESC) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_DISPLAY_COMMENT, "UI Display Comment", input_seq(KEYCODE_SPACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_CLEAR, "UI Clear", input_seq(KEYCODE_DEL) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ZOOM_IN, "UI Zoom In", input_seq(KEYCODE_EQUALS) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ZOOM_OUT, "UI Zoom Out", input_seq(KEYCODE_MINUS) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PREV_GROUP, "UI Previous Group", input_seq(KEYCODE_OPENBRACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_NEXT_GROUP, "UI Next Group", input_seq(KEYCODE_CLOSEBRACE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_ROTATE, "UI Rotate", input_seq(KEYCODE_R) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SHOW_PROFILER, "Show Profiler", input_seq(KEYCODE_F11, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_UI, "UI Toggle", input_seq(KEYCODE_SCRLOCK, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_PASTE, "UI Paste Text", input_seq(KEYCODE_SCRLOCK, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_TOGGLE_DEBUG, "Toggle Debugger", input_seq(KEYCODE_F5) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_SAVE_STATE, "Save State", input_seq(KEYCODE_F7, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI, UI_LOAD_STATE, "Load State", input_seq(KEYCODE_F7, input_seq::not_code, KEYCODE_LSHIFT) )
}
void construct_core_types_ui_shortcuts(simple_list<input_type_entry> &typelist)
{
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_ON_SCREEN_DISPLAY,"On Screen Display", input_seq(KEYCODE_TILDE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_DEBUG_BREAK, "Break in Debugger", input_seq(KEYCODE_TILDE) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_PAUSE, "Pause", input_seq(KEYCODE_P, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_RSHIFT ) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SINGLE_STEP, "Single Step", input_seq(KEYCODE_P, KEYCODE_LSHIFT, input_seq::or_code, KEYCODE_P, KEYCODE_RSHIFT ) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_RESET_MACHINE, "Reset Game", input_seq(KEYCODE_F3, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SOFT_RESET, "Soft Reset", input_seq(KEYCODE_F3, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_EXIT, "Exit", input_seq(KEYCODE_ESC) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SHOW_GFX, "Show Gfx", input_seq(KEYCODE_F4) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_FRAMESKIP_DEC, "Frameskip Dec", input_seq(KEYCODE_F8) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_FRAMESKIP_INC, "Frameskip Inc", input_seq(KEYCODE_F9) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_THROTTLE, "Throttle", input_seq(KEYCODE_F10) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_FAST_FORWARD, "Fast Forward", input_seq(KEYCODE_INSERT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SHOW_FPS, "Show FPS", input_seq(KEYCODE_F11, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SNAPSHOT, "Save Snapshot", input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_RECORD_MOVIE, "Record Movie", input_seq(KEYCODE_F12, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_TOGGLE_CHEAT, "Toggle Cheat", input_seq(KEYCODE_F6) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_ROTATE, "UI Rotate", input_seq(KEYCODE_R) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SHOW_PROFILER, "Show Profiler", input_seq(KEYCODE_F11, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_PASTE, "UI Paste Text", input_seq(KEYCODE_SCRLOCK, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_TOGGLE_DEBUG, "Toggle Debugger", input_seq(KEYCODE_F5) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SAVE_STATE, "Save State", input_seq(KEYCODE_F7, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_LOAD_STATE, "Load State", input_seq(KEYCODE_F7, input_seq::not_code, KEYCODE_LSHIFT) )
INPUT_PORT_DIGITAL_TYPE( 0, UI_SHORTCUT, UI_SHORTCUTS_ENABLED,"Enable Shortcuts", input_seq(KEYCODE_SCRLOCK) )
}
void construct_core_types_OSD(simple_list<input_type_entry> &typelist)
{
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_1, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_2, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_3, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_4, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_5, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_6, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_7, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_8, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_9, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_10, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_11, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_12, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_13, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_14, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_15, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI_GENERAL, OSD_16, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_1, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_2, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_3, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_4, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_5, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_6, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_7, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_8, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_9, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_10, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_11, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_12, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_13, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_14, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_15, NULL, input_seq() )
INPUT_PORT_DIGITAL_TYPE( 0, UI, OSD_16, NULL, input_seq() )
}
void construct_core_types_invalid(simple_list<input_type_entry> &typelist)
@ -829,8 +823,7 @@ void construct_core_types(simple_list<input_type_entry> &typelist)
construct_core_types_mouse_X(typelist);
construct_core_types_mouse_Y(typelist);
construct_core_types_keypad(typelist);
construct_core_types_ui_general(typelist);
construct_core_types_ui_shortcuts(typelist);
construct_core_types_UI(typelist);
construct_core_types_OSD(typelist);
construct_core_types_invalid(typelist);
}

View File

@ -123,7 +123,6 @@
const int SPACE_COUNT = 3;
const int KEY_BUFFER_SIZE = 4096;
const unicode_char INVALID_CHAR = '?';
const bool KEYBOARD_TRUMPS_UI_SHORTCUTS = false;
@ -2478,10 +2477,6 @@ time_t ioport_manager::initialize()
osd_printf_error("Input port errors:\n%s", errors.cstr());
}
// do we have a keyboard? if so, we may need to change default UI keys in response
if (KEYBOARD_TRUMPS_UI_SHORTCUTS && has_keyboard())
adjust_ui_seqs_for_keyboard();
// renumber player numbers for controller ports
int player_offset = 0;
for (device_t *device = iter.first(); device != NULL; device = iter.next())
@ -2642,87 +2637,6 @@ void ioport_manager::init_autoselect_devices(int type1, int type2, int type3, co
}
//-------------------------------------------------
// adjust_ui_seqs_for_keyboard - make adjustments
// to UI seqs in response to the existence of a
// keyboard
//-------------------------------------------------
void ioport_manager::adjust_ui_seqs_for_keyboard()
{
// track used keys in a bool array
bool used_keys[ITEM_ID_MAXIMUM];
memset(used_keys, 0, sizeof(used_keys));
// iterate over ports and fields
for (ioport_port *port = first_port(); port != NULL; port = port->next())
{
for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
{
// if we are at init, check IPT_KEYBOARD
if (field->type() == IPT_KEYBOARD && (!m_safe_to_read || field->enabled()))
{
const input_seq &defseq = field->defseq();
for (int codenum = 0; defseq[codenum] != input_seq::end_code; codenum++)
{
input_code code = defseq[codenum];
if (!code.internal() && !is_modifier_item_id(code.item_id()))
used_keys[code.item_id()] = true;
}
}
}
}
// now that we know which keys are used by keyboards, lets take a look at the UI
// shortcuts
for (input_type_entry *curtype = first_type(); curtype != NULL; curtype = curtype->next())
{
// we're only interested in "shortcut" UI keys
if (curtype->group() == IPG_UI_SHORTCUT)
{
const input_seq &defseq = curtype->defseq();
for (int codenum = 0; defseq[codenum] != input_seq::end_code; codenum++)
{
input_code code = defseq[codenum];
if (!code.internal() && !is_modifier_item_id(code.item_id()) && used_keys[code.item_id()])
{
// this shortcut is used by the keyboard; clear it
curtype->defseq().set();
curtype->restore_default_seq();
break;
}
}
}
// special case - change UI_CONFIGURE to be ScrLk on computers
if (curtype->type() == IPT_UI_CONFIGURE)
{
curtype->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_SCRLOCK);
curtype->restore_default_seq();
}
}
}
//-------------------------------------------------
// is_modifier_item_id - do we consider this input
// item id a modifier?
//-------------------------------------------------
bool ioport_manager::is_modifier_item_id(input_item_id item_id)
{
return (item_id == ITEM_ID_LSHIFT)
|| (item_id == ITEM_ID_LSHIFT)
|| (item_id == ITEM_ID_RSHIFT)
|| (item_id == ITEM_ID_LCONTROL)
|| (item_id == ITEM_ID_RCONTROL)
|| (item_id == ITEM_ID_LALT)
|| (item_id == ITEM_ID_RALT)
|| (item_id == ITEM_ID_LWIN)
|| (item_id == ITEM_ID_RWIN);
}
//-------------------------------------------------
// exit - exit callback to ensure we clean up
// and close our files

View File

@ -72,8 +72,7 @@ enum crosshair_axis_t
// groups for input ports
enum ioport_group
{
IPG_UI_GENERAL = 0,
IPG_UI_SHORTCUT,
IPG_UI = 0,
IPG_PLAYER1,
IPG_PLAYER2,
IPG_PLAYER3,
@ -334,7 +333,6 @@ enum ioport_type
IPT_UI_ON_SCREEN_DISPLAY,
IPT_UI_DEBUG_BREAK,
IPT_UI_PAUSE,
IPT_UI_SINGLE_STEP,
IPT_UI_RESET_MACHINE,
IPT_UI_SOFT_RESET,
IPT_UI_SHOW_GFX,
@ -364,18 +362,11 @@ enum ioport_type
IPT_UI_NEXT_GROUP,
IPT_UI_ROTATE,
IPT_UI_SHOW_PROFILER,
IPT_UI_EXIT,
IPT_UI_TOGGLE_UI,
IPT_UI_TOGGLE_DEBUG,
IPT_UI_PASTE,
IPT_UI_SAVE_STATE,
IPT_UI_LOAD_STATE,
IPT_UI_SHORTCUTS_ENABLED,
// dummy slots that will likely be filled soon (putting these in as a temporary convenience)
IPT_UI_DUMMY1,
IPT_UI_DUMMY2,
IPT_UI_DUMMY3,
IPT_UI_DUMMY4,
// additional OSD-specified UI port types (up to 16)
IPT_OSD_1,
@ -1400,8 +1391,6 @@ public:
private:
// internal helpers
void init_port_types();
void adjust_ui_seqs_for_keyboard();
static bool is_modifier_item_id(input_item_id item_id);
void init_autoselect_devices(int type1, int type2, int type3, const char *option, const char *ananame);
void frame_update_callback();

View File

@ -80,7 +80,6 @@
#include "crsshair.h"
#include "validity.h"
#include "unzip.h"
#include "ui/selgame.h"
#include "debug/debugcon.h"
#include "debug/debugvw.h"

View File

@ -1,659 +0,0 @@
/***************************************************************************
emenubar.c
Internal MAME menu bar for the user interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#include "emu.h"
#include "ui/emenubar.h"
#include "ui/selgame.h"
#include "ui/miscmenu.h"
#include "ui/filesel.h"
#include "ui/imginfo.h"
#include "ui/tapectrl.h"
#include "ui/swlist.h"
#include "ui/viewgfx.h"
#include "ui/barcode.h"
#include "softlist.h"
#include "cheat.h"
#include "debugger.h"
//**************************************************************************
// CONSTANTS
//**************************************************************************
#ifdef MAME_PROFILER
#define HAS_PROFILER 1
#else // !MAME_PROFILER
#define HAS_PROFILER 0
#endif // MAME_PROFILER
//**************************************************************************
// MENUBAR IMPLEMENTATION
//**************************************************************************
astring ui_emu_menubar::s_softlist_result;
device_image_interface *ui_emu_menubar::s_softlist_image;
//-------------------------------------------------
// ctor
//-------------------------------------------------
ui_emu_menubar::ui_emu_menubar(running_machine &machine)
: ui_menubar(machine)
{
}
//-------------------------------------------------
// handle
//-------------------------------------------------
void ui_emu_menubar::handle(render_container *container)
{
// check to see if we have a softlist selection
if (s_softlist_result.len() > 0)
{
// do the load
s_softlist_image->load(s_softlist_result);
// clear out state
s_softlist_image = NULL;
s_softlist_result.reset();
}
// call inherited method
ui_menubar::handle(container);
}
//-------------------------------------------------
// start_menu
//-------------------------------------------------
void ui_emu_menubar::start_menu(ui_menu *menu)
{
machine().ui().set_handler(ui_menu::ui_handler, 0);
ui_menu::stack_push(menu);
}
//-------------------------------------------------
// start_menu
//-------------------------------------------------
template<class _Menu>
void ui_emu_menubar::start_menu()
{
start_menu(auto_alloc_clear(machine(), _Menu(machine(), container())));
}
//-------------------------------------------------
// menubar_draw_ui_elements
//-------------------------------------------------
void ui_emu_menubar::menubar_draw_ui_elements()
{
// first draw the FPS counter
if (machine().ui().show_fps_counter())
{
astring tempstring;
machine().ui().draw_text_full(container(), machine().video().speed_text(tempstring), 0.0f, 0.0f, 1.0f,
JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
// draw the profiler if visible
if (machine().ui().show_profiler())
{
const char *text = g_profiler.text(machine());
machine().ui().draw_text_full(container(), text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
// if we're single-stepping, pause now
if (machine().ui().single_step())
{
machine().pause();
machine().ui().set_single_step(false);
}
// check for fast forward
if (machine().ioport().type_pressed(IPT_UI_FAST_FORWARD))
{
machine().video().set_fastforward(true);
machine().ui().show_fps_temp(0.5);
}
else
machine().video().set_fastforward(false);
}
//-------------------------------------------------
// menubar_build_menus
//-------------------------------------------------
void ui_emu_menubar::menubar_build_menus()
{
// build normal menus
build_file_menu();
if (has_images())
build_images_menu();
build_options_menu();
build_settings_menu();
build_help_menu();
// and customize them
machine().osd().customize_menubar(*this);
}
//-------------------------------------------------
// build_file_menu
//-------------------------------------------------
void ui_emu_menubar::build_file_menu()
{
astring menu_text;
menu_item &file_menu = root_menu().append("File");
// show gfx
if (ui_gfx_is_relevant(machine()))
file_menu.append("Show Graphics/Palette...", &ui_emu_menubar::set_ui_handler, *this, ui_gfx_ui_handler, (UINT32) machine().paused(), IPT_UI_SHOW_GFX);
// save screen snapshot
file_menu.append("Save Screen Snapshot(s)", &video_manager::save_active_screen_snapshots, machine().video(), IPT_UI_SNAPSHOT);
// record movie
menu_item &record_movie_menu = file_menu.append("Record Movie", &video_manager::toggle_record_movie, machine().video(), IPT_UI_RECORD_MOVIE);
record_movie_menu.set_checked(machine().video().is_recording());
// save state
file_menu.append("Save State...", &ui_emu_menubar::set_ui_handler, *this, ui_manager::ui_handler_load_save, (UINT32) LOADSAVE_SAVE, IPT_UI_SAVE_STATE);
// load state
file_menu.append("Load State...", &ui_emu_menubar::set_ui_handler, *this, ui_manager::ui_handler_load_save, (UINT32) LOADSAVE_LOAD, IPT_UI_LOAD_STATE);
// separator
file_menu.append_separator();
// paste
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
{
menu_item &paste_menu = file_menu.append("Paste", &ui_manager::paste, machine().ui(), IPT_UI_PASTE);
paste_menu.set_enabled(machine().ui().can_paste());
}
// debug
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
file_menu.append("Break into debugger", &ui_emu_menubar::debugger_break, *this, IPT_UI_TOGGLE_DEBUG);
// pause
menu_item &pause_menu = file_menu.append("Pause", &running_machine::toggle_pause, machine(), IPT_UI_PAUSE);
pause_menu.set_checked(machine().paused());
// single step
file_menu.append("Single Step", &ui_manager::do_single_step, machine().ui(), IPT_UI_SINGLE_STEP);
// reset
menu_item &reset_menu = file_menu.append("Reset");
reset_menu.append("Hard", &running_machine::schedule_hard_reset, machine(), IPT_UI_RESET_MACHINE);
reset_menu.append("Soft", &running_machine::schedule_soft_reset, machine(), IPT_UI_SOFT_RESET);
// separator
file_menu.append_separator();
// select new game
menu_text.printf("Select New %s...", emulator_info::get_capstartgamenoun());
file_menu.append(menu_text, &ui_emu_menubar::select_new_game, *this);
// exit
file_menu.append("Exit", &ui_manager::request_quit, machine().ui(), IPT_UI_EXIT);
}
//-------------------------------------------------
// build_images_menu
//-------------------------------------------------
void ui_emu_menubar::build_images_menu()
{
// add the root "Images" menu
menu_item &images_menu = root_menu().append("Images");
// loop through all devices
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
{
bool is_loaded = image->basename() != NULL;
astring buffer;
buffer.printf("%s (%s): \t%s",
image->device().name(),
image->brief_instance_name(),
is_loaded ? image->basename() : "[empty]");
// append the menu item for this device
menu_item &menu = images_menu.append(buffer);
// software list
if (image->image_interface() != NULL)
{
if (build_software_list_menus(menu, image))
menu.append_separator();
}
// load
menu.append("Load...", &ui_emu_menubar::load, *this, image);
// unload
menu_item &unload_menu = menu.append("Unload", &device_image_interface::unload, *image);
unload_menu.set_enabled(is_loaded);
// tape control
cassette_image_device *cassette = dynamic_cast<cassette_image_device *>(image);
if (cassette != NULL)
{
menu_item &control_menu = menu.append("Tape Control...", &ui_emu_menubar::tape_control, *this, cassette);
control_menu.set_enabled(is_loaded);
}
}
}
//-------------------------------------------------
// build_software_list_menus
//-------------------------------------------------
bool ui_emu_menubar::build_software_list_menus(menu_item &menu, device_image_interface *image)
{
int item_count = 0;
menu_item *last_menu_item = NULL;
astring description;
softlist_type types[] = { SOFTWARE_LIST_ORIGINAL_SYSTEM, SOFTWARE_LIST_COMPATIBLE_SYSTEM };
software_list_device_iterator softlist_iter(machine().config().root_device());
// first do "original system" softlists, then do compatible ones
for (int typenum = 0; typenum < ARRAY_LENGTH(types); typenum++)
{
for (software_list_device *swlist = softlist_iter.first(); swlist != NULL; swlist = softlist_iter.next())
{
if ((swlist->list_type() == types[typenum]) && is_softlist_relevant(swlist, image->image_interface(), description))
{
// we've found a softlist; append the menu item
last_menu_item = &menu.append(description, &ui_emu_menubar::select_from_software_list, *this, image, swlist);
item_count++;
}
}
}
// if we only had one list, lets use a generic name
if (last_menu_item != NULL && (item_count == 1))
last_menu_item->set_text("Software list...");
return item_count > 0;
}
//-------------------------------------------------
// build_options_menu
//-------------------------------------------------
void ui_emu_menubar::build_options_menu()
{
astring menu_text;
menu_item &options_menu = root_menu().append("Options");
// throttle
float throttle_rates[] = { 10.0f, 5.0f, 2.0f, 1.0f, 0.5f, 0.2f, 0.1f, 0.0f };
float current_throttle_rate = machine().video().throttled()
? machine().video().throttle_rate()
: 0.0f;
menu_item &throttle_menu = options_menu.append("Throttle");
for (int i = 0; i < ARRAY_LENGTH(throttle_rates); i++)
{
const char *item = "Unthrottled";
if (throttle_rates[i] != 0)
{
menu_text.printf("%d%%", (int) (throttle_rates[i] * 100));
item = menu_text;
}
menu_item &menu = throttle_menu.append(item, &ui_emu_menubar::set_throttle_rate, *this, throttle_rates[i]);
menu.set_checked(current_throttle_rate == throttle_rates[i]);
}
// frame skip
menu_item &frameskip_menu = options_menu.append("Frame Skip");
for (int i = -1; i <= MAX_FRAMESKIP; i++)
{
const char *item = "Auto";
if (i >= 0)
{
menu_text.printf("%d", i);
item = menu_text;
}
menu_item &menu = frameskip_menu.append(item, &video_manager::set_frameskip, machine().video(), i);
menu.set_checked(machine().video().frameskip() == i);
}
// separator
frameskip_menu.append_separator();
// increase
frameskip_menu.append("Increase", &ui_manager::increase_frameskip, machine().ui(), IPT_UI_FRAMESKIP_INC);
// decrease
frameskip_menu.append("Decrease", &ui_manager::decrease_frameskip, machine().ui(), IPT_UI_FRAMESKIP_DEC);
// show fps
options_menu.append("Show Frames Per Second", &ui_manager::set_show_fps, &ui_manager::show_fps, machine().ui(), IPT_UI_SHOW_FPS);
// show profiler
if (HAS_PROFILER)
options_menu.append("Show Profiler", &ui_manager::set_show_profiler, &ui_manager::show_profiler, machine().ui(), IPT_UI_SHOW_PROFILER);
// video
// do different things if we actually have multiple render targets
menu_item &video_menu = options_menu.append("Video");
if (machine().render().target_by_index(1) != NULL)
{
// multiple targets
int targetnum = 0;
render_target *target;
while((target = machine().render().target_by_index(targetnum)) != NULL)
{
astring buffer;
buffer.printf("Screen #%d", targetnum++);
menu_item &target_menu = options_menu.append(buffer);
build_video_target_menu(target_menu, *target);
}
}
else
{
// single target
build_video_target_menu(video_menu, *machine().render().first_target());
}
// separator
options_menu.append_separator();
// slot devices
slot_interface_iterator slotiter(machine().root_device());
if (slotiter.first() != NULL)
options_menu.append<ui_emu_menubar>("Slot Devices...", &ui_emu_menubar::start_menu<ui_menu_slot_devices>, *this);
// barcode reader
barcode_reader_device_iterator bcriter(machine().root_device());
if (bcriter.first() != NULL)
options_menu.append<ui_emu_menubar>("Barcode Reader...", &ui_emu_menubar::start_menu<ui_menu_barcode_reader>, *this);
// network devices
network_interface_iterator netiter(machine().root_device());
if (netiter.first() != NULL)
options_menu.append<ui_emu_menubar>("Network Devices...", &ui_emu_menubar::start_menu<ui_menu_network_devices>, *this);
// keyboard
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
{
menu_item &keyboard_menu = options_menu.append("Keyboard");
keyboard_menu.append("Emulated", &ui_manager::set_use_natural_keyboard, &ui_manager::use_natural_keyboard, machine().ui(), false);
keyboard_menu.append("Natural", &ui_manager::set_use_natural_keyboard, &ui_manager::use_natural_keyboard, machine().ui(), true);
}
// crosshair options
if (crosshair_get_usage(machine()))
options_menu.append<ui_emu_menubar>("Crosshair Options...", &ui_emu_menubar::start_menu<ui_menu_crosshair>, *this);
// memory card
if (machine().config().m_memcard_handler != NULL)
options_menu.append<ui_emu_menubar>("Memory Card...", &ui_emu_menubar::start_menu<ui_menu_memory_card>, *this);
// shortcuts enabled
menu_item &shortcuts_enabled_item = options_menu.append<ui_manager>("Menu Shorcuts Enabled", &ui_manager::set_shortcuts_enabled, &ui_manager::shortcuts_enabled, machine().ui(), IPT_UI_SHORTCUTS_ENABLED);
shortcuts_enabled_item.set_shortcut_always_enabled(true);
// cheat
if (machine().options().cheat() && machine().cheat().first() != NULL)
{
options_menu.append_separator();
options_menu.append("Cheats enabled", &cheat_manager::set_enable, &cheat_manager::enabled, machine().cheat(), IPT_UI_TOGGLE_CHEAT);
options_menu.append<ui_emu_menubar>("Cheat...", &ui_emu_menubar::start_menu<ui_menu_cheat>, *this);
}
}
//-------------------------------------------------
// build_video_target_menu
//-------------------------------------------------
void ui_emu_menubar::build_video_target_menu(menu_item &target_menu, render_target &target)
{
astring tempstring;
const char *view_name;
// add the menu items for each view
for(int viewnum = 0; (view_name = target.view_name(viewnum)) != NULL; viewnum++)
{
// replace spaces with underscores
tempstring.cpy(view_name).replace(0, "_", " ");
// append the menu
target_menu.append(tempstring, &render_target::set_view, &render_target::view, target, viewnum);
}
// separator
target_menu.append_separator();
// rotation
menu_item &rotation_menu = target_menu.append("Rotation");
rotation_menu.append("None", &render_target::set_orientation, &render_target::orientation, target, ROT0);
rotation_menu.append("Clockwise 90", &render_target::set_orientation, &render_target::orientation, target, ROT90);
rotation_menu.append("180", &render_target::set_orientation, &render_target::orientation, target, ROT180);
rotation_menu.append("Counterclockwise 90", &render_target::set_orientation, &render_target::orientation, target, ROT270);
// show backdrops
target_menu.append("Show Backdrops", &render_target::set_backdrops_enabled, &render_target::backdrops_enabled, target);
// show overlay
target_menu.append("Show Overlays", &render_target::set_overlays_enabled, &render_target::overlays_enabled, target);
// show bezel
target_menu.append("Show Bezels", &render_target::set_bezels_enabled, &render_target::bezels_enabled, target);
// show cpanel
target_menu.append("Show CPanels", &render_target::set_cpanels_enabled, &render_target::cpanels_enabled, target);
// show marquee
target_menu.append("Show Marquees", &render_target::set_marquees_enabled, &render_target::marquees_enabled, target);
// view
menu_item &view_menu = target_menu.append("View");
view_menu.append("Cropped", &render_target::set_zoom_to_screen, &render_target::zoom_to_screen, target, true);
view_menu.append("Full", &render_target::set_zoom_to_screen, &render_target::zoom_to_screen, target, false);
}
//-------------------------------------------------
// build_settings_menu
//-------------------------------------------------
void ui_emu_menubar::build_settings_menu()
{
astring menu_text;
menu_item &settings_menu = root_menu().append("Settings");
// general input
// TODO - BREAK THIS APART?
settings_menu.append<ui_emu_menubar>("General Input...", &ui_emu_menubar::start_menu<ui_menu_input_groups>, *this);
// game input
menu_text.printf("%s Input...", emulator_info::get_capstartgamenoun());
settings_menu.append<ui_emu_menubar>(menu_text, &ui_emu_menubar::start_menu<ui_menu_input_specific>, *this);
// analog controls
if (machine().ioport().has_analog())
settings_menu.append<ui_emu_menubar>("Analog Controls...", &ui_emu_menubar::start_menu<ui_menu_analog>, *this);
// dip switches
if (machine().ioport().has_dips())
settings_menu.append<ui_emu_menubar>("Dip Switches...", &ui_emu_menubar::start_menu<ui_menu_settings_dip_switches>, *this);
// driver configuration
if (machine().ioport().has_configs())
{
menu_text.printf("%s Configuration...", emulator_info::get_capstartgamenoun());
settings_menu.append<ui_emu_menubar>(menu_text, &ui_emu_menubar::start_menu<ui_menu_settings_driver_config>, *this);
}
// bios selection
if (machine().ioport().has_bioses())
settings_menu.append<ui_emu_menubar>("Bios Selection...", &ui_emu_menubar::start_menu<ui_menu_bios_selection>, *this);
// sliders
settings_menu.append<ui_emu_menubar>("Sliders...", &ui_emu_menubar::start_menu<ui_menu_sliders>, *this, IPT_UI_ON_SCREEN_DISPLAY);
}
//-------------------------------------------------
// build_help_menu
//-------------------------------------------------
void ui_emu_menubar::build_help_menu()
{
astring menu_text;
menu_item &help_menu = root_menu().append("Help");
// bookkeeping info
help_menu.append<ui_emu_menubar>("Bookkeeping info...", &ui_emu_menubar::start_menu<ui_menu_bookkeeping>, *this);
// game info
menu_text.printf("%s Information...", emulator_info::get_capstartgamenoun());
help_menu.append<ui_emu_menubar>(menu_text, &ui_emu_menubar::start_menu<ui_menu_game_info>, *this);
// image information
image_interface_iterator imgiter(machine().root_device());
if (imgiter.first() != NULL)
help_menu.append<ui_emu_menubar>("Image Information...", &ui_emu_menubar::start_menu<ui_menu_image_info>, *this);
}
//-------------------------------------------------
// is_softlist_relevant
//-------------------------------------------------
bool ui_emu_menubar::is_softlist_relevant(software_list_device *swlist, const char *interface, astring &list_description)
{
bool result = false;
for (software_info *swinfo = swlist->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
{
software_part *part = swinfo->find_part(NULL, NULL);
if (part->matches_interface(interface))
{
list_description.printf("%s...", swlist->description());
result = true;
break;
}
}
return result;
}
//-------------------------------------------------
// set_ui_handler
//-------------------------------------------------
void ui_emu_menubar::set_ui_handler(ui_callback callback, UINT32 param)
{
// first pause
machine().pause();
// and transfer control
machine().ui().set_handler(callback, param);
}
//-------------------------------------------------
// select_new_game
//-------------------------------------------------
void ui_emu_menubar::select_new_game()
{
start_menu(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container(), machine().system().name)));
}
//-------------------------------------------------
// select_from_software_list
//-------------------------------------------------
void ui_emu_menubar::select_from_software_list(device_image_interface *image, software_list_device *swlist)
{
s_softlist_image = image;
start_menu(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container(), swlist, image->image_interface(), s_softlist_result)));
}
//-------------------------------------------------
// tape_control
//-------------------------------------------------
void ui_emu_menubar::tape_control(cassette_image_device *image)
{
start_menu(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container(), image)));
}
//-------------------------------------------------
// load
//-------------------------------------------------
void ui_emu_menubar::load(device_image_interface *image)
{
start_menu(image->get_selection_menu(machine(), container()));
}
//-------------------------------------------------
// has_images
//-------------------------------------------------
bool ui_emu_menubar::has_images()
{
image_interface_iterator iter(machine().root_device());
return iter.first() != NULL;
}
//-------------------------------------------------
// set_throttle_rate
//-------------------------------------------------
void ui_emu_menubar::set_throttle_rate(float throttle_rate)
{
machine().video().set_throttled(throttle_rate != 0.0);
if (throttle_rate != 0.0)
machine().video().set_throttle_rate(throttle_rate);
}
//-------------------------------------------------
// debugger_break
//-------------------------------------------------
void ui_emu_menubar::debugger_break()
{
::debugger_break(machine());
}

View File

@ -1,64 +0,0 @@
/***************************************************************************
emenubar.h
Internal MAME menu bar for the user interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __UI_EMENUBAR_H__
#define __UI_EMENUBAR_H__
#include "ui/menubar.h"
#include "imagedev/cassette.h"
#include "imagedev/bitbngr.h"
class ui_emu_menubar : public ui_menubar
{
public:
ui_emu_menubar(running_machine &machine);
virtual void handle(render_container *container);
protected:
virtual void menubar_build_menus();
virtual void menubar_draw_ui_elements();
private:
// variables
static device_image_interface *s_softlist_image;
static astring s_softlist_result;
// menubar building
void build_file_menu();
void build_images_menu();
bool build_software_list_menus(menu_item &menu, device_image_interface *image);
void build_options_menu();
void build_video_target_menu(menu_item &target_menu, render_target &target);
void build_settings_menu();
void build_help_menu();
// miscellaneous
bool is_softlist_relevant(software_list_device *swlist, const char *interface, astring &list_description);
void set_ui_handler(UINT32 (*callback)(running_machine &, render_container *, UINT32), UINT32 param);
void select_new_game();
void select_from_software_list(device_image_interface *image, software_list_device *swlist);
void tape_control(cassette_image_device *image);
void load(device_image_interface *image);
bool has_images();
void set_throttle_rate(float throttle_rate);
void start_menu(ui_menu *menu);
void debugger_break();
// template methods
template<class _Menu>
void start_menu();
};
#endif // __UI_EMENUBAR_H__

136
src/emu/ui/filemngr.c Normal file
View File

@ -0,0 +1,136 @@
/*********************************************************************
ui/filemngr.c
MESS's clunky built-in file manager
TODO
- Restrict directory listing by file extension
- Support file manager invocation from the main menu for
required images
*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include "emu.h"
#include "ui/ui.h"
#include "ui/swlist.h"
#include "ui/filemngr.h"
#include "ui/filesel.h"
/***************************************************************************
FILE MANAGER
***************************************************************************/
//-------------------------------------------------
// ctor
//-------------------------------------------------
ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
//-------------------------------------------------
// dtor
//-------------------------------------------------
ui_menu_file_manager::~ui_menu_file_manager()
{
}
//-------------------------------------------------
// custom_render - perform our special rendering
//-------------------------------------------------
void ui_menu_file_manager::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
const char *path;
// access the path
path = selected_device ? selected_device->filename() : NULL;
extra_text_render(container, top, bottom,
origx1, origy1, origx2, origy2, NULL, path);
}
//-------------------------------------------------
// populate
//-------------------------------------------------
void ui_menu_file_manager::populate()
{
astring buffer;
astring tmp_name;
// cycle through all devices for this system
image_interface_iterator iter(machine().root_device());
for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
{
// get the image type/id
buffer.printf(
"%s (%s)",
image->device().name(), image->brief_instance_name());
// get the base name
if (image->basename() != NULL)
{
tmp_name.cpy(image->basename());
// if the image has been loaded through softlist, also show the loaded part
if (image->part_entry() != NULL)
{
const software_part *tmp = image->part_entry();
if (tmp->name() != NULL)
{
tmp_name.cat(" (");
tmp_name.cat(tmp->name());
// also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.), and in case display it
if (image->get_feature("part_id") != NULL)
{
tmp_name.cat(": ");
tmp_name.cat(image->get_feature("part_id"));
}
tmp_name.cat(")");
}
}
}
else
tmp_name.cpy("---");
// record the menu item
item_append(buffer, tmp_name.cstr(), 0, (void *) image);
}
custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
}
//-------------------------------------------------
// handle
//-------------------------------------------------
void ui_menu_file_manager::handle()
{
// update the selected device
selected_device = (device_image_interface *) get_selection();
// process the menu
const ui_menu_event *event = process(0);
if (event != NULL && event->iptkey == IPT_UI_SELECT)
{
selected_device = (device_image_interface *) event->itemref;
if (selected_device != NULL)
{
ui_menu::stack_push(selected_device->get_selection_menu(machine(), container));
// reset the existing menu
reset(UI_MENU_RESET_REMEMBER_POSITION);
}
}
}

30
src/emu/ui/filemngr.h Normal file
View File

@ -0,0 +1,30 @@
/***************************************************************************
ui/filemngr.h
MESS's clunky built-in file manager
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __UI_FILEMNGR_H__
#define __UI_FILEMNGR_H__
class ui_menu_file_manager : public ui_menu {
public:
astring current_directory;
astring current_file;
device_image_interface *selected_device;
ui_menu_file_manager(running_machine &machine, render_container *container);
virtual ~ui_menu_file_manager();
virtual void populate();
virtual void handle();
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
};
#endif /* __UI_FILEMNGR_H__ */

View File

@ -342,13 +342,14 @@ void ui_menu_file_create::handle()
// ctor
//-------------------------------------------------
ui_menu_file_selector::ui_menu_file_selector(running_machine &machine, render_container *container, device_image_interface *image, astring &current_directory, astring &current_file, bool has_empty, bool has_create, int *result)
: ui_menu(machine, container),
m_current_directory(current_directory),
m_current_file(current_file)
ui_menu_file_selector::ui_menu_file_selector(running_machine &machine, render_container *container, device_image_interface *image, astring &current_directory, astring &current_file, bool has_empty, bool has_softlist, bool has_create, int *result)
: ui_menu(machine, container),
m_current_directory(current_directory),
m_current_file(current_file)
{
m_image = image;
m_has_empty = has_empty;
m_has_softlist = has_softlist;
m_has_create = has_create;
m_result = result;
}
@ -505,6 +506,10 @@ void ui_menu_file_selector::append_entry_menu_item(const file_selector_entry *en
text = "[create]";
break;
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
text = "[software list]";
break;
case SELECTOR_ENTRY_TYPE_DRIVE:
text = entry->basename;
subtext = "[DRIVE]";
@ -559,6 +564,12 @@ void ui_menu_file_selector::populate()
append_entry(SELECTOR_ENTRY_TYPE_CREATE, NULL, NULL);
}
if (m_has_softlist)
{
// add the "[software list]" entry
append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, NULL, NULL);
}
// add the drives
i = 0;
while((volume_name = osd_get_volume_name(i))!=NULL)
@ -636,6 +647,11 @@ void ui_menu_file_selector::handle()
ui_menu::stack_pop(machine());
break;
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
*m_result = R_SOFTLIST;
ui_menu::stack_pop(machine());
break;
case SELECTOR_ENTRY_TYPE_DRIVE:
case SELECTOR_ENTRY_TYPE_DIRECTORY:
// drive/directory - first check the path

View File

@ -54,8 +54,8 @@ private:
class ui_menu_file_selector : public ui_menu
{
public:
enum { R_EMPTY, R_CREATE, R_FILE };
ui_menu_file_selector(running_machine &machine, render_container *container, device_image_interface *image, astring &current_directory, astring &current_file, bool has_empty, bool has_create, int *result);
enum { R_EMPTY, R_SOFTLIST, R_CREATE, R_FILE };
ui_menu_file_selector(running_machine &machine, render_container *container, device_image_interface *image, astring &current_directory, astring &current_file, bool has_empty, bool has_softlist, bool has_create, int *result);
virtual ~ui_menu_file_selector();
virtual void populate();
virtual void handle();
@ -66,6 +66,7 @@ private:
{
SELECTOR_ENTRY_TYPE_EMPTY,
SELECTOR_ENTRY_TYPE_CREATE,
SELECTOR_ENTRY_TYPE_SOFTWARE_LIST,
SELECTOR_ENTRY_TYPE_DRIVE,
SELECTOR_ENTRY_TYPE_DIRECTORY,
SELECTOR_ENTRY_TYPE_FILE
@ -85,7 +86,7 @@ private:
astring & m_current_directory;
astring & m_current_file;
bool m_has_empty;
// bool m_has_softlist;
bool m_has_softlist;
bool m_has_create;
int * m_result;
file_selector_entry * m_entrylist;

View File

@ -173,11 +173,48 @@ void ui_menu_control_device_image::handle()
zippath_closedir(directory);
}
submenu_result = -1;
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_selector(machine(), container, image, current_directory, current_file, true, can_create, &submenu_result)));
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_selector(machine(), container, image, current_directory, current_file, true, image->image_interface()!=NULL, can_create, &submenu_result)));
state = SELECT_FILE;
break;
}
case START_SOFTLIST:
sld = 0;
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software(machine(), container, image->image_interface(), &sld)));
state = SELECT_SOFTLIST;
break;
case START_OTHER_PART: {
submenu_result = -1;
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, swi, swp->interface(), &swp, true, &submenu_result)));
state = SELECT_OTHER_PART;
break;
}
case SELECT_SOFTLIST:
if(!sld) {
ui_menu::stack_pop(machine());
break;
}
software_info_name = "";
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, sld, image->image_interface(), software_info_name)));
state = SELECT_PARTLIST;
break;
case SELECT_PARTLIST:
swi = sld->find(software_info_name);
if(swi->has_multiple_parts(image->image_interface())) {
submenu_result = -1;
swp = 0;
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_parts(machine(), container, swi, image->image_interface(), &swp, false, &submenu_result)));
state = SELECT_ONE_PART;
} else {
swp = swi->first_part();
load_software_part();
ui_menu::stack_pop(machine());
}
break;
case SELECT_ONE_PART:
switch(submenu_result) {
case ui_menu_software_parts::T_ENTRY: {
@ -228,6 +265,11 @@ void ui_menu_control_device_image::handle()
state = CREATE_FILE;
break;
case ui_menu_file_selector::R_SOFTLIST:
state = START_SOFTLIST;
handle();
break;
case -1: // return to system
ui_menu::stack_pop(machine());
break;

248
src/emu/ui/mainmenu.c Normal file
View File

@ -0,0 +1,248 @@
/*********************************************************************
ui/mainmenu.c
Internal MAME menus for the user interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
*********************************************************************/
#include "emu.h"
#include "osdnet.h"
#include "emuopts.h"
#include "ui/ui.h"
#include "rendutil.h"
#include "cheat.h"
#include "uiinput.h"
#include "ui/filemngr.h"
#include "ui/filesel.h"
#include "ui/barcode.h"
#include "ui/tapectrl.h"
#include "ui/mainmenu.h"
#include "ui/miscmenu.h"
#include "ui/imginfo.h"
#include "ui/selgame.h"
#include "audit.h"
#include "crsshair.h"
#include <ctype.h>
#include "imagedev/cassette.h"
#include "imagedev/bitbngr.h"
#include "machine/bcreader.h"
/***************************************************************************
MENU HANDLERS
***************************************************************************/
/*-------------------------------------------------
ui_menu_main constructor - populate the main menu
-------------------------------------------------*/
ui_menu_main::ui_menu_main(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
void ui_menu_main::populate()
{
astring menu_text;
/* add input menu items */
item_append("Input (general)", NULL, 0, (void *)INPUT_GROUPS);
menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun());
item_append(menu_text.cstr(), NULL, 0, (void *)INPUT_SPECIFIC);
/* add optional input-related menus */
if (machine().ioport().has_analog())
item_append("Analog Controls", NULL, 0, (void *)ANALOG);
if (machine().ioport().has_dips())
item_append("Dip Switches", NULL, 0, (void *)SETTINGS_DIP_SWITCHES);
if (machine().ioport().has_configs())
{
menu_text.printf("%s Configuration",emulator_info::get_capstartgamenoun());
item_append(menu_text.cstr(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG);
}
/* add bookkeeping menu */
item_append("Bookkeeping Info", NULL, 0, (void *)BOOKKEEPING);
/* add game info menu */
menu_text.printf("%s Information",emulator_info::get_capstartgamenoun());
item_append(menu_text.cstr(), NULL, 0, (void *)GAME_INFO);
image_interface_iterator imgiter(machine().root_device());
if (imgiter.first() != NULL)
{
/* add image info menu */
item_append("Image Information", NULL, 0, (void *)IMAGE_MENU_IMAGE_INFO);
/* add file manager menu */
item_append("File Manager", NULL, 0, (void *)IMAGE_MENU_FILE_MANAGER);
/* add tape control menu */
cassette_device_iterator cassiter(machine().root_device());
if (cassiter.first() != NULL)
item_append("Tape Control", NULL, 0, (void *)MESS_MENU_TAPE_CONTROL);
}
if (machine().ioport().has_bioses())
item_append("Bios Selection", NULL, 0, (void *)BIOS_SELECTION);
slot_interface_iterator slotiter(machine().root_device());
if (slotiter.first() != NULL)
{
/* add slot info menu */
item_append("Slot Devices", NULL, 0, (void *)SLOT_DEVICES);
}
barcode_reader_device_iterator bcriter(machine().root_device());
if (bcriter.first() != NULL)
{
/* add slot info menu */
item_append("Barcode Reader", NULL, 0, (void *)BARCODE_READ);
}
network_interface_iterator netiter(machine().root_device());
if (netiter.first() != NULL)
{
/* add image info menu */
item_append("Network Devices", NULL, 0, (void*)NETWORK_DEVICES);
}
/* add keyboard mode menu */
if (machine().ioport().has_keyboard() && machine().ioport().natkeyboard().can_post())
item_append("Keyboard Mode", NULL, 0, (void *)KEYBOARD_MODE);
/* add sliders menu */
item_append("Slider Controls", NULL, 0, (void *)SLIDERS);
/* add video options menu */
item_append("Video Options", NULL, 0, (machine().render().target_by_index(1) != NULL) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
/* add crosshair options menu */
if (crosshair_get_usage(machine()))
item_append("Crosshair Options", NULL, 0, (void *)CROSSHAIR);
/* add cheat menu */
if (machine().options().cheat() && machine().cheat().first() != NULL)
item_append("Cheat", NULL, 0, (void *)CHEAT);
/* add memory card menu */
if (machine().config().m_memcard_handler != NULL)
item_append("Memory Card", NULL, 0, (void *)MEMORY_CARD);
/* add reset and exit menus */
menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun());
item_append(menu_text.cstr(), NULL, 0, (void *)SELECT_GAME);
}
ui_menu_main::~ui_menu_main()
{
}
/*-------------------------------------------------
menu_main - handle the main menu
-------------------------------------------------*/
void ui_menu_main::handle()
{
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
switch((long long)(menu_event->itemref)) {
case INPUT_GROUPS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
break;
case INPUT_SPECIFIC:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_specific(machine(), container)));
break;
case SETTINGS_DIP_SWITCHES:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_dip_switches(machine(), container)));
break;
case SETTINGS_DRIVER_CONFIG:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_settings_driver_config(machine(), container)));
break;
case ANALOG:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_analog(machine(), container)));
break;
case BOOKKEEPING:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bookkeeping(machine(), container)));
break;
case GAME_INFO:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_game_info(machine(), container)));
break;
case IMAGE_MENU_IMAGE_INFO:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_image_info(machine(), container)));
break;
case IMAGE_MENU_FILE_MANAGER:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
break;
case MESS_MENU_TAPE_CONTROL:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container, NULL)));
break;
case SLOT_DEVICES:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_slot_devices(machine(), container)));
break;
case NETWORK_DEVICES:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_network_devices(machine(), container)));
break;
case KEYBOARD_MODE:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_keyboard_mode(machine(), container)));
break;
case SLIDERS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_sliders(machine(), container, false)));
break;
case VIDEO_TARGETS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_targets(machine(), container)));
break;
case VIDEO_OPTIONS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_video_options(machine(), container, machine().render().first_target())));
break;
case CROSSHAIR:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_crosshair(machine(), container)));
break;
case CHEAT:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_cheat(machine(), container)));
break;
case MEMORY_CARD:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_memory_card(machine(), container)));
break;
case SELECT_GAME:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_select_game(machine(), container, 0)));
break;
case BIOS_SELECTION:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_bios_selection(machine(), container)));
break;
case BARCODE_READ:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_barcode_reader(machine(), container)));
break;
default:
fatalerror("ui_menu_main::handle - unknown reference\n");
}
}
}

54
src/emu/ui/mainmenu.h Normal file
View File

@ -0,0 +1,54 @@
/***************************************************************************
ui/mainmenu.h
Internal MAME menus for the user interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __UI_MAINMENU_H__
#define __UI_MAINMENU_H__
#include "crsshair.h"
#include "drivenum.h"
class ui_menu_main : public ui_menu {
public:
ui_menu_main(running_machine &machine, render_container *container);
virtual ~ui_menu_main();
virtual void populate();
virtual void handle();
private:
enum {
INPUT_GROUPS,
INPUT_SPECIFIC,
SETTINGS_DIP_SWITCHES,
SETTINGS_DRIVER_CONFIG,
ANALOG,
BOOKKEEPING,
GAME_INFO,
IMAGE_MENU_IMAGE_INFO,
IMAGE_MENU_FILE_MANAGER,
MESS_MENU_TAPE_CONTROL,
SLOT_DEVICES,
NETWORK_DEVICES,
KEYBOARD_MODE,
SLIDERS,
VIDEO_TARGETS,
VIDEO_OPTIONS,
CROSSHAIR,
CHEAT,
MEMORY_CARD,
SELECT_GAME,
BIOS_SELECTION,
BARCODE_READ,
};
};
#endif /* __UI_MAINMENU_H__ */

View File

@ -15,7 +15,7 @@
#include "rendutil.h"
#include "uiinput.h"
#include "cheat.h"
#include "ui/emenubar.h"
#include "ui/mainmenu.h"
#include "ui/miscmenu.h"
#include <ctype.h>
@ -1038,8 +1038,9 @@ void ui_menu::do_handle()
UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container, UINT32 state)
{
// if we have no menus stacked up, we have to have something
assert(menu_stack != NULL);
// if we have no menus stacked up, start with the main menu
if (menu_stack == NULL)
stack_push(auto_alloc_clear(machine, ui_menu_main(machine, container)));
// update the menu state
if (menu_stack != NULL)

File diff suppressed because it is too large Load Diff

View File

@ -1,261 +0,0 @@
/***************************************************************************
menubar.h
Internal MAME menu bar for the user interface.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#pragma once
#ifndef __UI_MENUBAR_H__
#define __UI_MENUBAR_H__
#include "render.h"
//**************************************************************************
// MENU BAR
//**************************************************************************
class ui_menubar
{
public:
ui_menubar(running_machine &machine);
virtual ~ui_menubar();
// menu item
class menu_item
{
public:
menu_item(ui_menubar &menubar, const char *text = NULL, menu_item *parent = NULL, bool is_invokable = false, int shortcut = 0);
virtual ~menu_item();
// methods
menu_item &append(const char *text);
void append_separator();
bool is_child_of(menu_item *that) const;
virtual void invoke();
void clear_area_recursive();
menu_item *find_point(float x, float y);
menu_item &find_child(const char *target);
const char *shortcut_text();
float shortcut_text_width();
void sensible_seq_name(astring &text, const input_seq &seq);
// template methods; look I tried to use delegate.h but I got humbled...
template<class _Target> menu_item &append(const char *text, void (_Target::*callback)(), _Target &obj, int shortcut = 0)
{
menu_item *child = new invokable_menu_item<_Target>(m_menubar, text, this, callback, obj, shortcut);
initialize(*child);
return *child;
}
template<class _Target, typename _Arg> menu_item &append(const char *text, void (_Target::*callback)(_Arg), _Target &obj, _Arg arg, int shortcut = 0)
{
menu_item *child = new arg_invokable_menu_item<_Target, _Arg>(m_menubar, text, this, callback, obj, arg, shortcut);
initialize(*child);
return *child;
}
template<class _Target, typename _Arg1, typename _Arg2> menu_item &append(const char *text, void (_Target::*callback)(_Arg1, _Arg2), _Target &obj, _Arg1 arg1, _Arg2 arg2, int shortcut = 0)
{
menu_item *child = new arg2_invokable_menu_item<_Target, _Arg1, _Arg2>(m_menubar, text, this, callback, obj, arg1, arg2, shortcut);
initialize(*child);
return *child;
}
template<class _Target> menu_item &append(const char *text, void (_Target::*set_callback)(bool), bool (_Target::*get_callback)() const, _Target &obj, int shortcut = 0)
{
// tailored for a toggle
bool current_value = ((obj).*(get_callback))();
menu_item &menu = append(text, set_callback, obj, !current_value, shortcut);
menu.set_checked(current_value);
return menu;
}
template<class _Target, typename _Arg> menu_item &append(const char *text, void (_Target::*set_callback)(_Arg), _Arg (_Target::*get_callback)() const, _Target &obj, _Arg arg, int shortcut = 0)
{
// tailored for a set operation
_Arg current_value = ((obj).*(get_callback))();
menu_item &menu = append(text, set_callback, obj, arg, shortcut);
menu.set_checked(current_value == arg);
return menu;
}
// getters
bool is_empty() const { return !m_first_child; }
bool is_invokable() const { return m_is_invokable; }
bool is_checked() const { return m_is_checked; }
bool is_enabled() const { return m_is_enabled; }
bool is_separator() const { return m_is_separator; }
bool has_children() const { return m_first_child ? true : false; }
bool is_shortcut_always_enabled() const { return m_is_shortcut_always_enabled; }
int shortcut() const { return m_shortcut; }
const astring &text() const { return m_text; }
menu_item *parent() { return m_parent; }
menu_item *child() { return m_first_child; }
menu_item *last_child() { return m_last_child; }
menu_item *previous() { return m_previous; }
menu_item *next() { return m_next; }
menu_item *next_with_shortcut() { return m_next_with_shortcut; }
bool is_sub_menu() const { return m_parent && m_parent->m_parent; }
// setters
void set_area(float x0, float y0, float x1, float y1);
void clear_area() { set_area(-1, -1, -1, -1); }
void set_checked(bool checked) { m_is_checked = checked; }
void set_enabled(bool enabled) { m_is_enabled = enabled; }
void set_text(const char *text) { m_text.cpy(text); }
void set_next_with_shortcut(menu_item *item) { m_next_with_shortcut = item; }
void set_shortcut_always_enabled(bool shortcut_always_enabled) { m_is_shortcut_always_enabled = shortcut_always_enabled; }
private:
// private variables
ui_menubar & m_menubar;
astring m_text;
int m_shortcut;
astring m_shortcut_text;
float m_shortcut_text_width;
bool m_is_invokable;
bool m_is_checked;
bool m_is_enabled;
bool m_is_separator;
bool m_is_shortcut_always_enabled;
menu_item * m_parent;
menu_item * m_first_child;
menu_item * m_last_child;
menu_item * m_previous;
menu_item * m_next;
menu_item * m_next_with_shortcut;
float m_x0;
float m_y0;
float m_x1;
float m_y1;
// private methods
void initialize(menu_item &child);
menu_item *find_child_internal(const char *target);
};
// methods
virtual void reset();
virtual void handle(render_container *container);
// getters
bool is_visible() const { return m_menubar_visibility != MENUBAR_VISIBILITY_INVISIBLE; }
bool has_selection() const { return m_selected_item != NULL; }
menu_item &root_menu() { return m_menus; }
protected:
// implemented by child classes
virtual void menubar_build_menus() = 0;
virtual void menubar_draw_ui_elements() = 0;
// accessors
running_machine &machine() { return m_machine; }
render_container *container() { return m_container; }
private:
// classes
template<class _Target>
class invokable_menu_item : public menu_item
{
public:
invokable_menu_item(ui_menubar &menubar, const char *name, menu_item *parent, void (_Target::*callback)(), _Target &obj, int shortcut)
: menu_item(menubar, name, parent, true, shortcut), m_callback(callback), m_obj(obj)
{
}
virtual void invoke() { ((m_obj).*(m_callback))(); }
private:
void (_Target::*m_callback)();
_Target &m_obj;
};
template<class _Target, typename _Arg>
class arg_invokable_menu_item : public menu_item
{
public:
arg_invokable_menu_item(ui_menubar &menubar, const char *name, menu_item *parent, void (_Target::*callback)(_Arg), _Target &obj, _Arg arg, int shortcut)
: menu_item(menubar, name, parent, true, shortcut), m_callback(callback), m_obj(obj), m_arg(arg)
{
}
virtual void invoke() { ((m_obj).*(m_callback))(m_arg); }
private:
void (_Target::*m_callback)(_Arg);
_Target &m_obj;
_Arg m_arg;
};
template<class _Target, typename _Arg1, typename _Arg2>
class arg2_invokable_menu_item : public menu_item
{
public:
arg2_invokable_menu_item(ui_menubar &menubar, const char *name, menu_item *parent, void (_Target::*callback)(_Arg1, _Arg2), _Target &obj, _Arg1 arg1, _Arg2 arg2, int shortcut)
: menu_item(menubar, name, parent, true, shortcut), m_callback(callback), m_obj(obj), m_arg1(arg1), m_arg2(arg2)
{
}
virtual void invoke() { ((m_obj).*(m_callback))(m_arg1, m_arg2); }
private:
void (_Target::*m_callback)(_Arg1, _Arg2);
_Target &m_obj;
_Arg1 m_arg1;
_Arg2 m_arg2;
};
// menubar visibility
enum menubar_visibility_t
{
MENUBAR_VISIBILITY_INVISIBLE,
MENUBAR_VISIBILITY_TRANSLUCENT,
MENUBAR_VISIBILITY_VISIBLE
};
// instance variables
running_machine & m_machine;
render_container * m_container;
menu_item m_menus; // the root menu item
menu_item * m_shortcuted_menu_items; // list of menu items with shortcuts
menu_item * m_selected_item; // current selection
menu_item * m_active_item; // active menu item
bool m_dragged; // have we dragged over at least one item?
float m_mouse_x, m_mouse_y;
bool m_mouse_button;
float m_checkmark_width;
osd_ticks_t m_last_mouse_move;
menubar_visibility_t m_menubar_visibility;
bool m_first_time;
//bool m_shortcuts_enabled;
// selection walking
bool walk_selection_previous();
bool walk_selection_next();
bool walk_selection_child();
bool walk_selection_parent();
bool walk_selection_escape();
bool walk_selection_previous_sub_menu();
bool walk_selection_next_sub_menu();
// miscellaneous
void draw_child_menu(menu_item *menu, float x, float y);
bool is_child_menu_visible(menu_item *menu) const;
void draw_menu_item_text(menu_item *mi, float x0, float y0, float x1, float y1, bool decorations, const float *column_widths = NULL);
bool is_highlighted_selection(menu_item *mi);
bool event_loop();
bool poll_navigation_keys();
bool poll_shortcut_keys(bool swallow);
bool input_pressed_safe(int key);
void toggle_selection();
void invoke(menu_item *menu);
bool find_mouse(float &mouse_x, float &mouse_y, bool &mouse_button);
menubar_visibility_t get_menubar_visibility();
rgb_t adjust_color(rgb_t color);
};
#endif /* __UI_MENUBAR_H__ */

View File

@ -16,11 +16,11 @@
#include "rendutil.h"
#include "cheat.h"
#include "uiinput.h"
#include "ui/filemngr.h"
#include "ui/miscmenu.h"
#include "audit.h"
#include "crsshair.h"
#include <ctype.h>
#include "ui/selgame.h"
#include "imagedev/cassette.h"
#include "imagedev/bitbngr.h"
@ -73,6 +73,42 @@ UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *c
MENU HANDLERS
***************************************************************************/
/*-------------------------------------------------
ui_menu_keyboard_mode - menu that
-------------------------------------------------*/
ui_menu_keyboard_mode::ui_menu_keyboard_mode(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
}
void ui_menu_keyboard_mode::populate()
{
bool natural = machine().ui().use_natural_keyboard();
item_append("Keyboard Mode:", natural ? "Natural" : "Emulated", natural ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, NULL);
}
ui_menu_keyboard_mode::~ui_menu_keyboard_mode()
{
}
void ui_menu_keyboard_mode::handle()
{
bool natural = machine().ui().use_natural_keyboard();
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL)
{
if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
{
machine().ui().set_use_natural_keyboard(natural ^ true);
reset(UI_MENU_RESET_REMEMBER_REF);
}
}
}
/*-------------------------------------------------
ui_slot_get_current_option - returns
-------------------------------------------------*/
@ -397,8 +433,7 @@ void ui_menu_input_groups::populate()
int player;
/* build up the menu */
item_append("User Interface", NULL, 0, (void *)(IPG_UI_GENERAL + 1));
item_append("Shortcuts", NULL, 0, (void *)(IPG_UI_SHORTCUT + 1));
item_append("User Interface", NULL, 0, (void *)(IPG_UI + 1));
for (player = 0; player < MAX_PLAYERS; player++)
{
char buffer[40];

View File

@ -17,6 +17,14 @@
#include "crsshair.h"
#include "drivenum.h"
class ui_menu_keyboard_mode : public ui_menu {
public:
ui_menu_keyboard_mode(running_machine &machine, render_container *container);
virtual ~ui_menu_keyboard_mode();
virtual void populate();
virtual void handle();
};
class ui_menu_slot_devices : public ui_menu {
public:
ui_menu_slot_devices(running_machine &machine, render_container *container);

View File

@ -357,3 +357,87 @@ void ui_menu_software_list::handle()
}
}
/***************************************************************************
SOFTWARE MENU - list of available software lists - i.e. cartridges,
floppies
***************************************************************************/
//-------------------------------------------------
// ctor
//-------------------------------------------------
ui_menu_software::ui_menu_software(running_machine &machine, render_container *container, const char *interface, software_list_device **result)
: ui_menu(machine, container)
{
m_interface = interface;
m_result = result;
}
//-------------------------------------------------
// dtor
//-------------------------------------------------
ui_menu_software::~ui_menu_software()
{
}
//-------------------------------------------------
// populate
//-------------------------------------------------
void ui_menu_software::populate()
{
bool have_compatible = false;
// Add original software lists for this system
software_list_device_iterator iter(machine().config().root_device());
for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
if (swlistdev->list_type() == SOFTWARE_LIST_ORIGINAL_SYSTEM)
if (swlistdev->first_software_info() != NULL && m_interface != NULL)
{
bool found = false;
for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
if (swinfo->first_part()->matches_interface(m_interface))
found = true;
if (found)
item_append(swlistdev->description(), NULL, 0, (void *)swlistdev);
}
// add compatible software lists for this system
for (software_list_device *swlistdev = iter.first(); swlistdev != NULL; swlistdev = iter.next())
if (swlistdev->list_type() == SOFTWARE_LIST_COMPATIBLE_SYSTEM)
if (swlistdev->first_software_info() != NULL && m_interface != NULL)
{
bool found = false;
for (const software_info *swinfo = swlistdev->first_software_info(); swinfo != NULL; swinfo = swinfo->next())
if (swinfo->first_part()->matches_interface(m_interface))
found = true;
if (found)
{
if (!have_compatible)
item_append("[compatible lists]", NULL, MENU_FLAG_DISABLE, NULL);
item_append(swlistdev->description(), NULL, 0, (void *)swlistdev);
}
have_compatible = true;
}
}
//-------------------------------------------------
// handle
//-------------------------------------------------
void ui_menu_software::handle()
{
// process the menu
const ui_menu_event *event = process(0);
if (event != NULL && event->iptkey == IPT_UI_SELECT) {
// ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_software_list(machine(), container, (software_list_config *)event->itemref, image)));
*m_result = (software_list_device *)event->itemref;
ui_menu::stack_pop(machine());
}
}

View File

@ -68,5 +68,18 @@ private:
};
// ======================> ui_menu_software
class ui_menu_software : public ui_menu {
public:
ui_menu_software(running_machine &machine, render_container *container, const char *interface, software_list_device **result);
virtual ~ui_menu_software();
virtual void populate();
virtual void handle();
private:
const char * m_interface;
software_list_device ** m_result;
};
#endif /* __UI_SWLIST_H__ */

View File

@ -18,11 +18,24 @@
#include "rendfont.h"
#include "ui/ui.h"
#include "uiinput.h"
#include "ui/mainmenu.h"
#include "ui/miscmenu.h"
#include "ui/viewgfx.h"
#include <ctype.h>
/***************************************************************************
CONSTANTS
***************************************************************************/
enum
{
LOADSAVE_NONE,
LOADSAVE_LOAD,
LOADSAVE_SAVE
};
/***************************************************************************
LOCAL VARIABLES
***************************************************************************/
@ -213,7 +226,6 @@ ui_manager::ui_manager(running_machine &machine)
ui_gfx_init(machine);
// reset instance variables
m_menubar = NULL;
m_font = NULL;
m_handler_callback = NULL;
m_handler_param = 0;
@ -224,7 +236,6 @@ ui_manager::ui_manager(running_machine &machine)
m_popup_text_end = 0;
m_use_natural_keyboard = false;
m_mouse_arrow_texture = NULL;
m_shortcuts_enabled = true;
// more initialization
set_handler(handler_messagebox, 0);
@ -349,6 +360,10 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
// loop while we have a handler
while (m_handler_callback != handler_ingame && !machine().scheduled_event_pending() && !ui_menu::stack_has_special_main_menu())
machine().video().frame_update();
// clear the handler and force an update
set_handler(handler_ingame, 0);
machine().video().frame_update();
}
// if we're the empty driver, force the menus on
@ -459,17 +474,15 @@ float ui_manager::get_line_height()
{
INT32 raw_font_pixel_height = get_font()->pixel_height();
render_target &ui_target = machine().render().ui_target();
INT32 target_pixel_width = ui_target.width();
INT32 target_pixel_height = ui_target.height();
float one_to_one_line_height;
float scale_factor;
// compute the font pixel width/height at the nominal size
float one_to_one_line_width = (float)raw_font_pixel_height / (float)target_pixel_width;
float one_to_one_line_height = (float)raw_font_pixel_height / (float)target_pixel_height;
// compute the font pixel height at the nominal size
one_to_one_line_height = (float)raw_font_pixel_height / (float)target_pixel_height;
// determine the scale factor
float scale_factor = MIN(
UI_TARGET_FONT_WIDTH / one_to_one_line_width,
UI_TARGET_FONT_HEIGHT / one_to_one_line_height);
scale_factor = UI_TARGET_FONT_HEIGHT / one_to_one_line_height;
// if our font is small-ish, do integral scaling
if (raw_font_pixel_height < 24)
@ -940,17 +953,6 @@ void ui_manager::show_mouse(bool status)
}
//-------------------------------------------------
// set_shortcuts_enabled
//-------------------------------------------------
void ui_manager::set_shortcuts_enabled(bool shortcuts_enabled)
{
m_shortcuts_enabled = shortcuts_enabled;
popmessage("Menu shortcuts %s", shortcuts_enabled ? "enabled" : "disabled");
}
//-------------------------------------------------
// is_menu_active - return true if the menu
// UI handler is active
@ -958,8 +960,7 @@ void ui_manager::set_shortcuts_enabled(bool shortcuts_enabled)
bool ui_manager::is_menu_active(void)
{
return (m_handler_callback == ui_menu::ui_handler)
|| (m_handler_callback == handler_ingame && m_menubar != NULL && m_menubar->has_selection());
return (m_handler_callback == ui_menu::ui_handler);
}
@ -1447,46 +1448,187 @@ void ui_manager::image_handler_ingame()
UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *container, UINT32 state)
{
return machine.ui().handler_ingame_method(container, state);
bool is_paused = machine.paused();
// first draw the FPS counter
if (machine.ui().show_fps_counter())
{
astring tempstring;
machine.ui().draw_text_full(container, machine.video().speed_text(tempstring), 0.0f, 0.0f, 1.0f,
JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
// draw the profiler if visible
if (machine.ui().show_profiler())
{
const char *text = g_profiler.text(machine);
machine.ui().draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
}
// if we're single-stepping, pause now
if (machine.ui().single_step())
{
machine.pause();
machine.ui().set_single_step(false);
}
// determine if we should disable the rest of the UI
bool ui_disabled = (machine.ioport().has_keyboard() && !machine.ui_active());
// is ScrLk UI toggling applicable here?
if (machine.ioport().has_keyboard())
{
// are we toggling the UI with ScrLk?
if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI))
{
// toggle the UI
machine.set_ui_active(!machine.ui_active());
// display a popup indicating the new status
if (machine.ui_active())
{
machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: PARTIAL Emulation",
"UI: Enabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
else
{
machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
"Keyboard Emulation Status",
"-------------------------",
"Mode: FULL Emulation",
"UI: Disabled",
"-------------------------",
"**Use ScrLock to toggle**");
}
}
}
// is the natural keyboard enabled?
if (machine.ui().use_natural_keyboard() && (machine.phase() == MACHINE_PHASE_RUNNING))
machine.ui().process_natural_keyboard();
if (!ui_disabled)
{
// paste command
if (ui_input_pressed(machine, IPT_UI_PASTE))
machine.ui().paste();
}
machine.ui().image_handler_ingame();
if (ui_disabled) return ui_disabled;
if (ui_input_pressed(machine, IPT_UI_CANCEL))
{
machine.ui().request_quit();
return 0;
}
// turn on menus if requested
if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
return machine.ui().set_handler(ui_menu::ui_handler, 0);
// if the on-screen display isn't up and the user has toggled it, turn it on
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
return machine.ui().set_handler(ui_menu_sliders::ui_handler, 1);
// handle a reset request
if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
machine.schedule_hard_reset();
if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
machine.schedule_soft_reset();
// handle a request to display graphics/palette
if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
{
if (!is_paused)
machine.pause();
return machine.ui().set_handler(ui_gfx_ui_handler, is_paused);
}
// handle a save state request
if (ui_input_pressed(machine, IPT_UI_SAVE_STATE))
{
machine.pause();
return machine.ui().set_handler(handler_load_save, LOADSAVE_SAVE);
}
// handle a load state request
if (ui_input_pressed(machine, IPT_UI_LOAD_STATE))
{
machine.pause();
return machine.ui().set_handler(handler_load_save, LOADSAVE_LOAD);
}
// handle a save snapshot request
if (ui_input_pressed(machine, IPT_UI_SNAPSHOT))
machine.video().save_active_screen_snapshots();
// toggle pause
if (ui_input_pressed(machine, IPT_UI_PAUSE))
{
// with a shift key, it is single step
if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT)))
{
machine.ui().set_single_step(true);
machine.resume();
}
else
machine.toggle_pause();
}
// handle a toggle cheats request
if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT))
machine.cheat().set_enable(!machine.cheat().enabled());
// toggle movie recording
if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE))
machine.video().toggle_record_movie();
// toggle profiler display
if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER))
machine.ui().set_show_profiler(!machine.ui().show_profiler());
// toggle FPS display
if (ui_input_pressed(machine, IPT_UI_SHOW_FPS))
machine.ui().set_show_fps(!machine.ui().show_fps());
// increment frameskip?
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC))
machine.ui().increase_frameskip();
// decrement frameskip?
if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC))
machine.ui().decrease_frameskip();
// toggle throttle?
if (ui_input_pressed(machine, IPT_UI_THROTTLE))
machine.video().toggle_throttle();
// check for fast forward
if (machine.ioport().type_pressed(IPT_UI_FAST_FORWARD))
{
machine.video().set_fastforward(true);
machine.ui().show_fps_temp(0.5);
}
else
machine.video().set_fastforward(false);
return 0;
}
//-------------------------------------------------
// handler_ingame_method - in-game handler takes
// care of the standard keypresses
//-------------------------------------------------
UINT32 ui_manager::handler_ingame_method(render_container *container, UINT32 state)
{
// no menubar? create it
if (m_menubar == NULL)
m_menubar = auto_alloc(machine(), ui_emu_menubar(machine()));
// handle!
m_menubar->handle(container);
// did we change out the handler?
if (m_handler_callback != handler_ingame)
{
// if so, flush the menubar...
auto_free(machine(), m_menubar);
m_menubar = NULL;
// ...and then check to see if this is just a "refresh"
if (m_handler_callback == NULL)
m_handler_callback = handler_ingame;
}
return m_handler_param;
}
//-------------------------------------------------
// ui_handler_load_save - leads the user through
// handler_load_save - leads the user through
// specifying a game to save or load
//-------------------------------------------------
UINT32 ui_manager::ui_handler_load_save(running_machine &machine, render_container *container, UINT32 state)
UINT32 ui_manager::handler_load_save(running_machine &machine, render_container *container, UINT32 state)
{
char filename[20];
input_code code;
@ -1563,17 +1705,6 @@ void ui_manager::request_quit()
}
//-------------------------------------------------
// do_single_step
//-------------------------------------------------
void ui_manager::do_single_step()
{
set_single_step(true);
machine().resume();
}
//-------------------------------------------------
// handler_confirm_quit - leads the user through
// confirming quit emulation

View File

@ -15,7 +15,6 @@
#define __USRINTRF_H__
#include "render.h"
#include "emenubar.h"
/***************************************************************************
@ -23,9 +22,7 @@
***************************************************************************/
/* preferred font height; use ui_get_line_height() to get actual height */
#define UI_TARGET_FONT_COLUMNS (25)
#define UI_TARGET_FONT_ROWS (25)
#define UI_TARGET_FONT_WIDTH (1.0f / (float)UI_TARGET_FONT_COLUMNS)
#define UI_TARGET_FONT_HEIGHT (1.0f / (float)UI_TARGET_FONT_ROWS)
#define UI_MAX_FONT_HEIGHT (1.0f / 15.0f)
@ -86,14 +83,6 @@ enum
DRAW_OPAQUE
};
enum
{
LOADSAVE_NONE,
LOADSAVE_LOAD,
LOADSAVE_SAVE
};
#define SLIDER_NOCHANGE 0x12345678
@ -130,7 +119,6 @@ public:
// getters
running_machine &machine() const { return m_machine; }
bool single_step() const { return m_single_step; }
bool menubar_visible() { return m_menubar && m_menubar->is_visible(); }
// setters
void set_single_step(bool single_step) { m_single_step = single_step; }
@ -170,13 +158,6 @@ public:
void increase_frameskip();
void decrease_frameskip();
void request_quit();
void do_single_step();
bool shortcuts_enabled() const { return m_shortcuts_enabled; }
void set_shortcuts_enabled(bool shortcuts_enabled);
// UI handlers
static UINT32 ui_handler_load_save(running_machine &machine, render_container *container, UINT32 state);
UINT32 handler_ingame_method(render_container *container, UINT32 state);
// print the game info string into a buffer
astring &game_info_astring(astring &string);
@ -202,8 +183,6 @@ private:
UINT8 * m_non_char_keys_down;
render_texture * m_mouse_arrow_texture;
bool m_mouse_show;
ui_menubar * m_menubar;
bool m_shortcuts_enabled;
// text generators
astring &disclaimer_string(astring &buffer);
@ -214,6 +193,7 @@ private:
static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state);
static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state);
static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state);
static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state);
static UINT32 handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state);
// private methods

View File

@ -110,6 +110,7 @@ INLINE void ui_input_push_mouse_move_event(running_machine &machine, render_targ
ui_input_push_mouse_leave_event - pushes a
mouse leave event to the specified render_target
-------------------------------------------------*/
INLINE void ui_input_push_mouse_leave_event(running_machine &machine, render_target *target)
{
ui_event event = { UI_EVENT_NONE };

View File

@ -179,15 +179,6 @@ void osd_interface::customize_input_type_list(simple_list<input_type_entry> &typ
}
//============================================================
// customize_menubar
//============================================================
void osd_interface::customize_menubar(ui_menubar &menu_bar)
{
}
//-------------------------------------------------
// font_open - attempt to "open" a handle to the
// font with the given name

View File

@ -25,7 +25,6 @@
// forward references
class input_type_entry;
class device_t;
class ui_menubar;
typedef void *osd_font;
@ -56,7 +55,6 @@ public:
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
virtual void customize_menubar(ui_menubar &menubar);
// font overridables
virtual osd_font font_open(const char *name, int &height);

View File

@ -2083,6 +2083,25 @@ void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry>
{
switch (entry->type())
{
// configurable UI mode switch
case IPT_UI_TOGGLE_UI:
uimode = downcast<sdl_options &>(machine().options()).ui_mode_key();
if(!strcmp(uimode,"auto"))
{
#if defined(__APPLE__) && defined(__MACH__)
mameid_code = lookup_mame_code("ITEM_ID_INSERT");
#else
mameid_code = lookup_mame_code("ITEM_ID_SCRLOCK");
#endif
}
else
{
snprintf(fullmode, 63, "ITEM_ID_%s", uimode);
mameid_code = lookup_mame_code(fullmode);
}
ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code));
entry->defseq(SEQ_TYPE_STANDARD).set(ui_code);
break;
// alt-enter for fullscreen
case IPT_OSD_1:
entry->configure_osd("TOGGLE_FULLSCREEN", "Toggle Fullscreen");
@ -2163,23 +2182,7 @@ void sdl_osd_interface::customize_input_type_list(simple_list<input_type_entry>
// disable the config menu if the ALT key is down
// (allows ALT-TAB to switch between apps)
case IPT_UI_CONFIGURE:
// configurable UI mode switch
uimode = downcast<sdl_options &>(machine().options()).ui_mode_key();
if(!strcmp(uimode,"auto"))
{
#if defined(__APPLE__) && defined(__MACH__)
mameid_code = lookup_mame_code("ITEM_ID_INSERT");
#else
mameid_code = lookup_mame_code("ITEM_ID_SCRLOCK");
#endif
}
else
{
snprintf(fullmode, 63, "ITEM_ID_%s", uimode);
mameid_code = lookup_mame_code(fullmode);
}
ui_code = input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, input_item_id(mameid_code));
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT, input_seq::or_code, ui_code);
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_TAB, input_seq::not_code, KEYCODE_LALT, input_seq::not_code, KEYCODE_RALT);
break;
// leave everything else alone

View File

@ -185,7 +185,6 @@ static render_primitive_list *drawd3d_window_get_primitives(win_window_info *win
static void drawd3d_window_save(win_window_info *window);
static void drawd3d_window_record(win_window_info *window);
static void drawd3d_window_toggle_fsfx(win_window_info *window);
static bool drawd3d_window_fsfx_enabled(win_window_info *window);
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
@ -225,12 +224,6 @@ static void drawd3d_window_toggle_fsfx(win_window_info *window)
d3d->set_restarting(true);
}
static bool drawd3d_window_fsfx_enabled(win_window_info *window)
{
d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
return d3d->get_shaders() != NULL && d3d->get_shaders()->enabled();
}
static void drawd3d_window_record(win_window_info *window)
{
d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
@ -308,7 +301,6 @@ int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
callbacks->window_save = drawd3d_window_save;
callbacks->window_record = drawd3d_window_record;
callbacks->window_toggle_fsfx = drawd3d_window_toggle_fsfx;
callbacks->window_fsfx_enabled = drawd3d_window_fsfx_enabled;
callbacks->window_destroy = drawd3d_window_destroy;
return 0;
}

View File

@ -173,7 +173,6 @@ static bool input_enabled;
static osd_lock * input_lock;
static bool input_paused;
static DWORD last_poll;
static bool menubar_visible;
// DirectInput variables
static LPDIRECTINPUT dinput;
@ -533,9 +532,6 @@ void wininput_poll(running_machine &machine)
{
bool hasfocus = winwindow_has_focus() && input_enabled;
// check menubar
menubar_visible = (machine.phase() > MACHINE_PHASE_INIT) && machine.ui().menubar_visible();
// ignore if not enabled
if (input_enabled)
{
@ -576,7 +572,7 @@ void wininput_poll(running_machine &machine)
bool wininput_should_hide_mouse(void)
{
// if we are paused or disabled, no
if (input_paused || !input_enabled || menubar_visible)
if (input_paused || !input_enabled)
return false;
// if neither mice nor lightguns enabled in the core, then no
@ -752,7 +748,6 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
entry->configure_osd("RENDER_SNAP", "Take Rendered Snapshot");
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LALT, input_seq::not_code, KEYCODE_LSHIFT);
break;
// add a NOT-lalt to our default F12
case IPT_UI_SNAPSHOT: // emu/input.c: input_seq(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT)
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, input_seq::not_code, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
@ -763,7 +758,6 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
entry->configure_osd("RENDER_AVI", "Record Rendered Video");
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, KEYCODE_LALT);
break;
// add a NOT-lalt to our default shift-F12
case IPT_UI_RECORD_MOVIE: // emu/input.c: input_seq(KEYCODE_F12, KEYCODE_LSHIFT)
entry->defseq(SEQ_TYPE_STANDARD).set(KEYCODE_F12, KEYCODE_LSHIFT, input_seq::not_code, KEYCODE_LALT);
@ -786,36 +780,6 @@ void windows_osd_interface::customize_input_type_list(simple_list<input_type_ent
}
//============================================================
// customize_menubar
//============================================================
void windows_osd_interface::customize_menubar(ui_menubar &menu_bar)
{
// find existing menus
ui_menubar::menu_item &root_menu = menu_bar.root_menu();
ui_menubar::menu_item &options_menu = root_menu.find_child("Options");
// Fullscreen
ui_menubar::menu_item &fullscreen_menu = options_menu.append("Fullscreen", &windows_osd_interface::toggle_full_screen, *this, IPT_OSD_1);
fullscreen_menu.set_checked(video_config.windowed ? false : true);
// HLSL
ui_menubar::menu_item &hlsl_menu = options_menu.append("HLSL");
// enable HLSL
ui_menubar::menu_item &enable_hlsl_menu = hlsl_menu.append("Enable HLSL", &windows_osd_interface::toggle_fsfx, *this, IPT_OSD_4);
enable_hlsl_menu.set_enabled(winwindow_can_toggle_fsfx());
enable_hlsl_menu.set_checked(winwindow_is_fsfx_enabled());
// take rendered snapshot
hlsl_menu.append("Take Rendered Snapshot", &windows_osd_interface::take_snap, *this, IPT_OSD_2).set_enabled(winwindow_can_take_snap());
// record rendered video
hlsl_menu.append("Record Rendered Video", &windows_osd_interface::take_video, *this, IPT_OSD_3).set_enabled(winwindow_can_take_video());
}
//============================================================
// device_list_poll_devices
//============================================================

View File

@ -56,6 +56,8 @@ static void init_monitors(void);
static BOOL CALLBACK monitor_enum_callback(HMONITOR handle, HDC dc, LPRECT rect, LPARAM data);
static win_monitor_info *pick_monitor(windows_options &options, int index);
static void check_osd_inputs(running_machine &machine);
static void extract_video_config(running_machine &machine);
static float get_aspect(const char *defdata, const char *data, int report_error);
static void get_resolution(const char *defdata, const char *data, win_window_config *config, int report_error);
@ -183,6 +185,7 @@ void windows_osd_interface::update(bool skip_redraw)
// poll the joystick values here
winwindow_process_events(machine(), TRUE, FALSE);
wininput_poll(machine());
check_osd_inputs(machine());
}
@ -316,6 +319,31 @@ finishit:
//============================================================
// check_osd_inputs
//============================================================
static void check_osd_inputs(running_machine &machine)
{
// check for toggling fullscreen mode
if (ui_input_pressed(machine, IPT_OSD_1))
winwindow_toggle_full_screen();
// check for taking fullscreen snap
if (ui_input_pressed(machine, IPT_OSD_2))
winwindow_take_snap();
// check for taking fullscreen video
if (ui_input_pressed(machine, IPT_OSD_3))
winwindow_take_video();
// check for taking fullscreen video
if (ui_input_pressed(machine, IPT_OSD_4))
winwindow_toggle_fsfx();
}
//============================================================
// extract_video_config
//============================================================

View File

@ -463,18 +463,6 @@ void winwindow_dispatch_message(running_machine &machine, MSG *message)
//============================================================
// winwindow_can_take_snap
// (main thread)
//============================================================
bool winwindow_can_take_snap(void)
{
return draw.window_record != NULL;
}
//============================================================
// winwindow_take_snap
// (main thread)
@ -498,30 +486,6 @@ void winwindow_take_snap(void)
//============================================================
// winwindow_can_toggle_fsfx
// (main thread)
//============================================================
bool winwindow_can_toggle_fsfx(void)
{
return draw.window_toggle_fsfx != NULL;
}
//============================================================
// winwindow_is_fsfx_enabled
// (main thread)
//============================================================
bool winwindow_is_fsfx_enabled(void)
{
return draw.window_fsfx_enabled != NULL && draw.window_fsfx_enabled(win_window_list);
}
//============================================================
// winwindow_toggle_fsfx
// (main thread)
@ -545,18 +509,6 @@ void winwindow_toggle_fsfx(void)
//============================================================
// winwindow_can_take_video
// (main thread)
//============================================================
bool winwindow_can_take_video(void)
{
return draw.window_record != NULL;
}
//============================================================
// winwindow_take_video
// (main thread)
@ -1320,41 +1272,37 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
// input events
case WM_MOUSEMOVE:
if (!wininput_should_hide_mouse())
ui_input_push_mouse_move_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
ui_input_push_mouse_move_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
break;
case WM_MOUSELEAVE:
if (!wininput_should_hide_mouse())
ui_input_push_mouse_leave_event(window->machine(), window->target);
ui_input_push_mouse_leave_event(window->machine(), window->target);
break;
case WM_LBUTTONDOWN:
if (!wininput_should_hide_mouse())
{
DWORD ticks = GetTickCount();
ui_input_push_mouse_down_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
{
DWORD ticks = GetTickCount();
ui_input_push_mouse_down_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
// check for a double-click
if (ticks - window->lastclicktime < GetDoubleClickTime() &&
GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
{
window->lastclicktime = 0;
ui_input_push_mouse_double_click_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
}
else
{
window->lastclicktime = ticks;
window->lastclickx = GET_X_LPARAM(lparam);
window->lastclicky = GET_Y_LPARAM(lparam);
}
// check for a double-click
if (ticks - window->lastclicktime < GetDoubleClickTime() &&
GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
{
window->lastclicktime = 0;
ui_input_push_mouse_double_click_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
}
else
{
window->lastclicktime = ticks;
window->lastclickx = GET_X_LPARAM(lparam);
window->lastclicky = GET_Y_LPARAM(lparam);
}
break;
}
case WM_LBUTTONUP:
if (!wininput_should_hide_mouse())
ui_input_push_mouse_up_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
ui_input_push_mouse_up_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
break;
case WM_CHAR:

View File

@ -92,7 +92,6 @@ struct win_draw_callbacks
void (*window_save)(win_window_info *window);
void (*window_record)(win_window_info *window);
void (*window_toggle_fsfx)(win_window_info *window);
bool (*window_fsfx_enabled)(win_window_info *window);
void (*window_destroy)(win_window_info *window);
};
@ -126,14 +125,8 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
extern LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
void winwindow_toggle_full_screen(void);
// HLSL
bool winwindow_can_take_snap(void);
void winwindow_take_snap(void);
bool winwindow_can_take_video(void);
void winwindow_take_video(void);
bool winwindow_can_toggle_fsfx(void);
bool winwindow_is_fsfx_enabled(void);
void winwindow_toggle_fsfx(void);
void winwindow_process_events_periodic(running_machine &machine);

View File

@ -965,46 +965,6 @@ bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, b
}
//-------------------------------------------------
// toggle_full_screen
//-------------------------------------------------
void windows_osd_interface::toggle_full_screen()
{
winwindow_toggle_full_screen();
}
//-------------------------------------------------
// take_snap
//-------------------------------------------------
void windows_osd_interface::take_snap()
{
winwindow_take_snap();
}
//-------------------------------------------------
// take_video
//-------------------------------------------------
void windows_osd_interface::take_video()
{
winwindow_take_video();
}
//-------------------------------------------------
// toggle_fsfx
//-------------------------------------------------
void windows_osd_interface::toggle_fsfx()
{
winwindow_toggle_fsfx();
}
//============================================================
// winmain_dump_stack
//============================================================

View File

@ -308,7 +308,6 @@ public:
// input overridables
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
virtual void customize_menubar(ui_menubar &menubar);
// font overridables
virtual osd_font font_open(const char *name, int &height);
@ -319,12 +318,6 @@ private:
static void osd_exit(running_machine &machine);
static const int DEFAULT_FONT_HEIGHT = 200;
// trampolines to support menu bar
void toggle_full_screen();
void take_snap();
void take_video();
void toggle_fsfx();
};