diff options
| author | 2008-05-15 16:25:03 +0000 | |
|---|---|---|
| committer | 2008-05-15 16:25:03 +0000 | |
| commit | 096331c8562467a67fb5674f46dbb26bb032d2a6 (patch) | |
| tree | 1f9329631b6fb62a81f4bdd894403389d2f70759 /src/osd | |
| parent | bc4b470ebbee405c6f48253acc225451f52a9b70 (diff) | |
Restructured input port internals and cleaned up inptport.c:
* Input ports are now maintained hierarchically. At the top
level are input ports, which contain a list of fields. Each
field represents one or more bits of the port. Certain fields
such as DIP switches and configuration switches contain a
list of settings, which can be selected. DIP switch fields
can also contain a list of DIP switch locations.
* Normalized behavior of port overrides (via PORT_INCLUDE or
by defining multiple overlapping bits). All fields within a
port are kept in strict increasing bit order, so altered DIP
switches are now kept in the appropriate order. This addresses
MAMETesters bug 01671.
* Live port state is now fully separate from configured
state. This is manifested in a similar way to devices, where
a const list of ports can be managed either offline or live.
Each port has a pointer to an opaque set of live state which
is NULL when offline or valid when live. Each port also has
a running_machine * which is also NULL when offline.
* Because of this new arrangement, the conversion from tokens
to a list of ports now requires reasonably complex memory
allocation, so these port lists must be explicitly allocated
and freed (they are not mantained by automatic resource
allocation).
* Custom and changed callbacks now take a pointer to a field
config instead of a running machine. This provides more
information about what field triggered the change notification.
The machine can be found by referenced field->port->machine.
* The inptport.c module has been cleaned up and many
ambiguities resolved. Most of this is internal, though it did
result in osd_customize_inputport_list() being changed to
osd_customize_input_type_list(). The parameter to this function
is now a linked list instead of an array, and the structures
referenced have been reorganized somewhat.
* Updated config.c to pass machine parameters to its callbacks.
* Updated validity checks, XML output, and UI system to handle
the new structures.
* Moved large table of default input settings to a separate
include file inpttype.h.
* Removed gross hacks in trackfld and hyperspt NVRAM. These
may be broken as a result.
Diffstat (limited to 'src/osd')
| -rw-r--r-- | src/osd/osdepend.h | 3 | ||||
| -rw-r--r-- | src/osd/windows/debugwin.c | 4 | ||||
| -rw-r--r-- | src/osd/windows/input.c | 30 | ||||
| -rw-r--r-- | src/osd/windows/video.c | 10 |
4 files changed, 24 insertions, 23 deletions
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index 7687ee49752..0daddb4be82 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -40,6 +40,7 @@ #include "mamecore.h" #include "osdcore.h" +#include "inptport.h" #include "timer.h" @@ -145,7 +146,7 @@ void osd_set_mastervolume(int attenuation); This function is called on startup, before reading the configuration from disk. Scan the list, and change the keys/joysticks you want. */ -void osd_customize_inputport_list(input_port_default_entry *defaults); +void osd_customize_input_type_list(input_type_desc *typelist); diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c index a33d5687ae0..f23c2a8f899 100644 --- a/src/osd/windows/debugwin.c +++ b/src/osd/windows/debugwin.c @@ -427,7 +427,7 @@ void debugwin_update_during_game(void) { // see if the interrupt key is pressed and break if it is temporarily_fake_that_we_are_not_visible = TRUE; - if (input_ui_pressed(IPT_UI_DEBUG_BREAK)) + if (input_ui_pressed(Machine, IPT_UI_DEBUG_BREAK)) { debugwin_info *info; HWND focuswnd = GetFocus(); @@ -2891,7 +2891,7 @@ static int global_handle_key(debugwin_info *info, WPARAM wparam, LPARAM lparam) int ignoreme; /* ignore any keys that are received while the debug key is down */ - ignoreme = input_ui_pressed(IPT_UI_DEBUG_BREAK); + ignoreme = input_ui_pressed(Machine, IPT_UI_DEBUG_BREAK); if (ignoreme) return 1; diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index a6a89eda717..619877ad22b 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -699,42 +699,42 @@ BOOL wininput_handle_raw(HANDLE device) //============================================================ -// osd_customize_inputport_list +// osd_customize_mapping_list //============================================================ -void osd_customize_inputport_list(input_port_default_entry *defaults) +void osd_customize_input_type_list(input_type_desc *typelist) { - input_port_default_entry *idef = defaults; - - // loop over all the defaults - for (idef = defaults; idef->type != IPT_END; idef++) - switch (idef->type) + input_type_desc *typedesc; + + // loop over the defaults + for (typedesc = typelist; typedesc != NULL; typedesc = typedesc->next) + switch (typedesc->type) { // disable the config menu if the ALT key is down // (allows ALT-TAB to switch between windows apps) case IPT_UI_CONFIGURE: - input_seq_set_5(&idef->defaultseq, KEYCODE_TAB, SEQCODE_NOT, KEYCODE_LALT, SEQCODE_NOT, KEYCODE_RALT); + input_seq_set_5(&typedesc->seq[SEQ_TYPE_STANDARD], KEYCODE_TAB, SEQCODE_NOT, KEYCODE_LALT, SEQCODE_NOT, KEYCODE_RALT); break; // alt-enter for fullscreen case IPT_OSD_1: - idef->token = "TOGGLE_FULLSCREEN"; - idef->name = "Toggle Fullscreen"; - input_seq_set_2(&idef->defaultseq, KEYCODE_LALT, KEYCODE_ENTER); + typedesc->token = "TOGGLE_FULLSCREEN"; + typedesc->name = "Toggle Fullscreen"; + input_seq_set_2(&typedesc->seq[SEQ_TYPE_STANDARD], KEYCODE_LALT, KEYCODE_ENTER); break; #ifdef MESS case IPT_OSD_2: if (mess_use_new_ui()) { - idef->token = "TOGGLE_MENUBAR"; - idef->name = "Toggle Menubar"; - input_seq_set_1 (&idef->defaultseq, KEYCODE_SCRLOCK); + typedesc->token = "TOGGLE_MENUBAR"; + typedesc->name = "Toggle Menubar"; + input_seq_set_1 (&typedesc->seq[SEQ_TYPE_STANDARD], KEYCODE_SCRLOCK); } break; case IPT_UI_THROTTLE: - input_seq_set_0(&idef->defaultseq); + input_seq_set_0(&typedesc->seq[SEQ_TYPE_STANDARD]); break; #endif /* MESS */ } diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c index 944f9cbdb0c..c180da0587c 100644 --- a/src/osd/windows/video.c +++ b/src/osd/windows/video.c @@ -71,7 +71,7 @@ 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(int index); -static void check_osd_inputs(void); +static void check_osd_inputs(running_machine *machine); static void extract_video_config(running_machine *machine); static void load_effect_overlay(running_machine *machine, const char *filename); @@ -211,7 +211,7 @@ void osd_update(running_machine *machine, int skip_redraw) // poll the joystick values here winwindow_process_events(machine, TRUE); wininput_poll(machine); - check_osd_inputs(); + check_osd_inputs(machine); } @@ -352,15 +352,15 @@ finishit: // check_osd_inputs //============================================================ -static void check_osd_inputs(void) +static void check_osd_inputs(running_machine *machine) { // check for toggling fullscreen mode - if (input_ui_pressed(IPT_OSD_1)) + if (input_ui_pressed(machine, IPT_OSD_1)) winwindow_toggle_full_screen(); #ifdef MESS // check for toggling menu bar - if (input_ui_pressed(IPT_OSD_2)) + if (input_ui_pressed(machine, IPT_OSD_2)) win_toggle_menubar(); #endif } |
