Previous 199869 Revisions Next

r34812 Monday 2nd February, 2015 at 23:35:04 UTC by Couriersud
Fixed natural keyboard input on all platforms for SDL2 builds. (nw)
[hash]uzebox.xml
[src/mess/drivers]uzebox.c
[src/osd/sdl]input.c testkeys.c

trunk/hash/uzebox.xml
r243323r243324
7373      </part>
7474   </software>
7575
76   <software name="calc">
76   <software name="calc" supported="no">
77      <!-- required mouse emulation -->
7778      <description>Calculator Demo</description>
7879      <year>2010</year>
7980      <publisher>Belogic</publisher>
trunk/src/mess/drivers/uzebox.c
r243323r243324
99    TODO:
1010    - Sound
1111    - SDCard
12    - Mouse
1213
1314****************************************************************************/
1415
r243323r243324
1718#include "sound/dac.h"
1819#include "bus/generic/slot.h"
1920#include "bus/generic/carts.h"
20#include "bus/snes_ctrl/ctrl.h"
2121
2222// overclocked to 8 * NTSC burst frequency
2323#define MASTER_CLOCK 28618180
r243323r243324
3030   uzebox_state(const machine_config &mconfig, device_type type, const char *tag)
3131      : driver_device(mconfig, type, tag),
3232      m_maincpu(*this, "maincpu"),
33      m_cart(*this, "cartslot"),
34      m_ctrl1(*this, "ctrl1"),
35      m_ctrl2(*this, "ctrl2")
33      m_cart(*this, "cartslot")
3634   { }
3735
3836   required_device<avr8_device> m_maincpu;
3937   required_device<generic_slot_device> m_cart;
40   required_device<snes_control_port_device> m_ctrl1;
41   required_device<snes_control_port_device> m_ctrl2;
4238
4339   DECLARE_READ8_MEMBER(port_a_r);
4440   DECLARE_WRITE8_MEMBER(port_a_w);
r243323r243324
6359   UINT8           m_port_b;
6460   UINT8           m_port_c;
6561   UINT8           m_port_d;
62   UINT16          m_joy_data[2];
6663   bitmap_rgb32    m_bitmap;
6764};
6865
r243323r243324
8380   m_port_b = 0;
8481   m_port_c = 0;
8582   m_port_d = 0;
83   m_joy_data[0] = m_joy_data[1] = 0;
8684}
8785
8886
r243323r243324
9492   //  ---- --x-   SNES controller P2 data
9593   //  ---- ---x   SNES controller P1 data
9694
97   m_ctrl1->write_strobe(BIT(data, 2));
98   m_ctrl2->write_strobe(BIT(data, 2));
95   UINT8 changed = m_port_a ^ data;
9996
100   UINT8 changed = m_port_a ^ data;
101   if ((changed & data & 0x08) || (changed & (~data) & 0x04))
97   if (changed & data & 0x04)
10298   {
103      m_port_a &= ~0x03;
104      m_port_a |= m_ctrl1->read_pin4() ? 0 : 0x01;
105      m_port_a |= m_ctrl2->read_pin4() ? 0 : 0x02;
99      m_joy_data[0] = ioport("P1")->read();
100      m_joy_data[1] = ioport("P2")->read();
106101   }
102   else if (changed & 0x08)
103   {
104      if (changed & data & 0x08)
105      {
106         m_joy_data[0] >>= 1;
107         m_joy_data[1] >>= 1;
108      }
107109
110      m_port_a = (m_joy_data[0] & 0x01) | ((m_joy_data[1] & 0x01) << 1);
111   }
112
108113   m_port_a = (data & 0x0c) | (m_port_a & 0x03);
109114}
110115
r243323r243324
202207\****************************************************/
203208
204209static INPUT_PORTS_START( uzebox )
210   PORT_START( "P1" )
211   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1)
212   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1)
213   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P1 Select") PORT_PLAYER(1)
214   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 Start") PORT_PLAYER(1)
215   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
216   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
217   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
218   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
219   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1)
220   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Button X") PORT_PLAYER(1)
221   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Button L") PORT_PLAYER(1)
222   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Button R") PORT_PLAYER(1)
223   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
224
225   PORT_START( "P2" )
226   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2)
227   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2)
228   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SELECT ) PORT_NAME("P2 Select") PORT_PLAYER(2)
229   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Start")
230   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
231   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
232   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
233   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
234   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Button A") PORT_PLAYER(2)
235   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Button X") PORT_PLAYER(2)
236   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Button L") PORT_PLAYER(2)
237   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Button R") PORT_PLAYER(2)
238   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
239
205240   PORT_START("AD725_CE")
206241   PORT_CONFNAME( 0x01, 0x00, "AD725 CE" )
207242   PORT_CONFSETTING( 0x00, "VCC" )
r243323r243324
289324   MCFG_GENERIC_MANDATORY
290325   MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart)
291326
292   MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad")
293   MCFG_SNES_CONTROL_PORT_ADD("ctrl2", snes_control_port_devices, "joypad")
294
295327   MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox")
296328MACHINE_CONFIG_END
297329
trunk/src/osd/sdl/input.c
r243323r243324
17581758         devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[0]);
17591759#endif
17601760         devinfo->keyboard.state[OSD_SDL_INDEX_KEYSYM(&event.key.keysym)] = 0x80;
1761#if (!SDLMAME_SDL2)
1761#if (SDLMAME_SDL2)
1762         if (event.key.keysym.sym < 0x20)
1763            ui_input_push_char_event(machine, sdl_window_list->m_target, event.key.keysym.sym);
1764#else
17621765         ui_input_push_char_event(machine, sdl_window_list->m_target, (unicode_char) event.key.keysym.unicode);
17631766#endif
17641767         break;
r243323r243324
18591862            int cx, cy;
18601863            osd_ticks_t click = osd_ticks() * 1000 / osd_ticks_per_second();
18611864            sdl_window_info *window = GET_FOCUS_WINDOW(&event.button);
1862            if (window != NULL && window->renderer().xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
1865            if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
18631866            {
18641867               ui_input_push_mouse_down_event(machine, window->m_target, cx, cy);
18651868               // FIXME Parameter ?
r243323r243324
18931896            int cx, cy;
18941897            sdl_window_info *window = GET_FOCUS_WINDOW(&event.button);
18951898
1896            if (window != NULL && window->renderer().xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
1899            if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
18971900            {
18981901               ui_input_push_mouse_up_event(machine, window->m_target, cx, cy);
18991902            }
r243323r243324
19181921            int cx=-1, cy=-1;
19191922            sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion);
19201923
1921            if (window != NULL && window->renderer().xy_to_render_target(event.motion.x, event.motion.y, &cx, &cy) )
1924            if (window != NULL && window->xy_to_render_target(event.motion.x, event.motion.y, &cx, &cy) )
19221925               ui_input_push_mouse_move_event(machine, window->m_target, cx, cy);
19231926         }
19241927         break;
r243323r243324
19471950      case SDL_TEXTINPUT:
19481951         if (*event.text.text)
19491952         {
1953            printf("char %c\n", *event.text.text);
19501954            sdl_window_info *window = GET_FOCUS_WINDOW(&event.text);
19511955            unicode_char result;
19521956            if (window != NULL )
trunk/src/osd/sdl/testkeys.c
r243323r243324
146146            printf("ITEM_ID_XY %s 0x%x 0x%x %s\n",
147147               lookup_key_name(sdl_lookup, event.key.keysym.scancode),
148148               (int) event.key.keysym.scancode,
149               0, //(int) event.key.keysym.unicode,
149               (int) event.key.keysym.sym,
150150               "");
151151            lasttext[0] = 0;
152152#else
r243323r243324
165165         printf("ITEM_ID_XY %s 0x%x 0x%x %s\n",
166166               lookup_key_name(sdl_lookup, event.key.keysym.scancode),
167167               (int) event.key.keysym.scancode,
168               0, //(int) event.key.keysym.unicode,
168               (int) event.key.keysym.sym,
169169               lasttext);
170170#else
171171         memset(buf, 0, 19);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team