src/emu/inptport.c
| r2406 | r2407 | |
| 2814 | 2814 | /* (MESS-specific) check for disabled keyboard */ |
| 2815 | 2815 | if (portentry->type == IPT_KEYBOARD && osd_keyboard_disabled()) |
| 2816 | 2816 | continue; |
| 2817 | | #endif |
| 2817 | #endif /* MESS */ |
| 2818 | 2818 | /* skip locked-out coin inputs */ |
| 2819 | 2819 | if (portentry->type >= IPT_COIN1 && portentry->type <= IPT_COIN8 && coinlockedout[portentry->type - IPT_COIN1]) |
| 2820 | 2820 | { |
| r2406 | r2407 | |
| 2886 | 2886 | /* note that analog ports are handled instantaneously at port read time */ |
| 2887 | 2887 | } |
| 2888 | 2888 | |
| 2889 | #ifdef MESS |
| 2890 | /* hook for MESS's natural keyboard support */ |
| 2891 | mess_input_port_update_hook(portnum, &portinfo->digital); |
| 2892 | #endif /* MESS */ |
| 2893 | |
| 2889 | 2894 | /* call changed handlers */ |
| 2890 | 2895 | for (changed = portinfo->changedinfo; changed; changed = changed->next) |
| 2891 | 2896 | if (input_port_condition(changed->portentry)) |
| r2406 | r2407 | |
| 2903 | 2908 | } |
| 2904 | 2909 | } |
| 2905 | 2910 | |
| 2906 | | #ifdef MESS |
| 2907 | | /* less MESS to MESSy things */ |
| 2908 | | inputx_update(machine); |
| 2909 | | #endif |
| 2910 | | |
| 2911 | 2911 | /* handle playback/record */ |
| 2912 | 2912 | for (portnum = 0; portnum < MAX_INPUT_PORTS; portnum++) |
| 2913 | 2913 | { |
| r2406 | r2407 | |
| 3347 | 3347 | |
| 3348 | 3348 | /************************************* |
| 3349 | 3349 | * |
| 3350 | | * Input port writing |
| 3351 | | * |
| 3352 | | *************************************/ |
| 3353 | | |
| 3354 | | void input_port_set_digital_value(running_machine *machine, int port_num, UINT32 value, UINT32 mask) |
| 3355 | | { |
| 3356 | | /* used by MESS for natural keyboard input */ |
| 3357 | | input_port_info *portinfo = &port_info[port_num]; |
| 3358 | | portinfo->digital &= ~mask; |
| 3359 | | portinfo->digital |= value; |
| 3360 | | } |
| 3361 | | |
| 3362 | | |
| 3363 | | |
| 3364 | | /************************************* |
| 3365 | | * |
| 3366 | 3350 | * Return position of crosshair axis |
| 3367 | 3351 | * |
| 3368 | 3352 | *************************************/ |
src/mess/inputx.c
| r2406 | r2407 | |
| 17 | 17 | #include "debug/debugcon.h" |
| 18 | 18 | #endif /* ENABLE_DEBUGGER */ |
| 19 | 19 | |
| 20 | |
| 21 | |
| 22 | /*************************************************************************** |
| 23 | CONSTANTS |
| 24 | ***************************************************************************/ |
| 25 | |
| 20 | 26 | #define NUM_SIMUL_KEYS (UCHAR_SHIFT_END - UCHAR_SHIFT_BEGIN + 1) |
| 21 | 27 | #define LOG_INPUTX 0 |
| 22 | 28 | #define DUMP_CODES 0 |
| 23 | 29 | #define SPACE_COUNT 3 |
| 24 | 30 | |
| 31 | |
| 32 | |
| 33 | /*************************************************************************** |
| 34 | TYPE DEFINITIONS |
| 35 | ***************************************************************************/ |
| 36 | |
| 25 | 37 | typedef struct _mess_input_code mess_input_code; |
| 26 | 38 | struct _mess_input_code |
| 27 | 39 | { |
| r2406 | r2407 | |
| 47 | 59 | const char *alternate; /* alternative string, in UTF-8 */ |
| 48 | 60 | }; |
| 49 | 61 | |
| 62 | |
| 63 | |
| 64 | /*************************************************************************** |
| 65 | GLOBAL VARIABLES |
| 66 | ***************************************************************************/ |
| 67 | |
| 50 | 68 | static const char_info charinfo[] = |
| 51 | 69 | { |
| 52 | 70 | { 0x0008, "Backspace", NULL }, /* Backspace */ |
| r2406 | r2407 | |
| 323 | 341 | { UCHAR_MAMEKEY(CANCEL), "Break", NULL } /* Break/Pause key */ |
| 324 | 342 | }; |
| 325 | 343 | |
| 344 | |
| 345 | |
| 326 | 346 | #define INVALID_CHAR '?' |
| 327 | 347 | |
| 328 | 348 | /*************************************************************************** |
| r2406 | r2407 | |
| 923 | 943 | |
| 924 | 944 | |
| 925 | 945 | |
| 926 | | void inputx_update(running_machine *machine) |
| 946 | /*------------------------------------------------- |
| 947 | mess_input_port_update_hook - hook function |
| 948 | called from core to allow for natural keyboard |
| 949 | -------------------------------------------------*/ |
| 950 | |
| 951 | void mess_input_port_update_hook(int portnum, UINT32 *digital) |
| 927 | 952 | { |
| 928 | 953 | const key_buffer *keybuf; |
| 929 | 954 | const mess_input_code *code; |
| r2406 | r2407 | |
| 943 | 968 | code = find_code(ch); |
| 944 | 969 | |
| 945 | 970 | /* loop through this character's component codes */ |
| 946 | | if (code) |
| 971 | if (code != NULL) |
| 947 | 972 | { |
| 948 | | for (i = 0; i < ARRAY_LENGTH(code->ipt) && code->ipt[i]; i++) |
| 973 | for (i = 0; i < ARRAY_LENGTH(code->ipt) && (code->ipt[i] != NULL); i++) |
| 949 | 974 | { |
| 950 | | value = code->ipt[i]->mask; |
| 951 | | input_port_set_digital_value(machine, code->port[i], value, value); |
| 975 | if (code->port[i] == portnum) |
| 976 | { |
| 977 | value = code->ipt[i]->mask; |
| 978 | *digital |= value; |
| 979 | } |
| 952 | 980 | } |
| 953 | 981 | } |
| 954 | 982 | } |
src/mess/inputx.h
| r2406 | r2407 | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | | #ifndef INPUTX_H |
| 10 | | #define INPUTX_H |
| 9 | #ifndef __INPUTX_H__ |
| 10 | #define __INPUTX_H__ |
| 11 | 11 | |
| 12 | 12 | #include "mame.h" |
| 13 | 13 | #include "driver.h" |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /*************************************************************************** |
| 17 | | |
| 18 | | Constants |
| 19 | | |
| 17 | CONSTANTS |
| 20 | 18 | ***************************************************************************/ |
| 21 | 19 | |
| 22 | 20 | /* input classes */ |
| r2406 | r2407 | |
| 31 | 29 | INPUT_CLASS_MISC |
| 32 | 30 | }; |
| 33 | 31 | |
| 34 | | /*************************************************************************** |
| 35 | | |
| 36 | | Macros |
| 37 | | |
| 38 | | ***************************************************************************/ |
| 39 | | |
| 40 | 32 | /* MESS uses Supplementary private use B to represent code points |
| 41 | 33 | * corresponding to MAME keycodes and shift keys. The nice thing about |
| 42 | 34 | * supplemental private use B is that it is higher than any possible code |
| r2406 | r2407 | |
| 54 | 46 | |
| 55 | 47 | |
| 56 | 48 | /*************************************************************************** |
| 57 | | |
| 58 | | Prototypes |
| 59 | | |
| 49 | FUNCTION PROTOTYPES |
| 60 | 50 | ***************************************************************************/ |
| 61 | 51 | |
| 62 | 52 | /* these are called by the core; they should not be called from FEs */ |
| 63 | 53 | void inputx_init(running_machine *machine); |
| 64 | | void inputx_update(running_machine *machine); |
| 54 | void mess_input_port_update_hook(int portnum, UINT32 *digital); |
| 65 | 55 | void inputx_handle_mess_extensions(input_port_entry *ipt); |
| 66 | 56 | |
| 67 | 57 | /* called by drivers to setup natural keyboard support */ |