trunk/src/mess/drivers/uzebox.c
| r243323 | r243324 | |
| 9 | 9 | TODO: |
| 10 | 10 | - Sound |
| 11 | 11 | - SDCard |
| 12 | - Mouse |
| 12 | 13 | |
| 13 | 14 | ****************************************************************************/ |
| 14 | 15 | |
| r243323 | r243324 | |
| 17 | 18 | #include "sound/dac.h" |
| 18 | 19 | #include "bus/generic/slot.h" |
| 19 | 20 | #include "bus/generic/carts.h" |
| 20 | | #include "bus/snes_ctrl/ctrl.h" |
| 21 | 21 | |
| 22 | 22 | // overclocked to 8 * NTSC burst frequency |
| 23 | 23 | #define MASTER_CLOCK 28618180 |
| r243323 | r243324 | |
| 30 | 30 | uzebox_state(const machine_config &mconfig, device_type type, const char *tag) |
| 31 | 31 | : driver_device(mconfig, type, tag), |
| 32 | 32 | m_maincpu(*this, "maincpu"), |
| 33 | | m_cart(*this, "cartslot"), |
| 34 | | m_ctrl1(*this, "ctrl1"), |
| 35 | | m_ctrl2(*this, "ctrl2") |
| 33 | m_cart(*this, "cartslot") |
| 36 | 34 | { } |
| 37 | 35 | |
| 38 | 36 | required_device<avr8_device> m_maincpu; |
| 39 | 37 | 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; |
| 42 | 38 | |
| 43 | 39 | DECLARE_READ8_MEMBER(port_a_r); |
| 44 | 40 | DECLARE_WRITE8_MEMBER(port_a_w); |
| r243323 | r243324 | |
| 63 | 59 | UINT8 m_port_b; |
| 64 | 60 | UINT8 m_port_c; |
| 65 | 61 | UINT8 m_port_d; |
| 62 | UINT16 m_joy_data[2]; |
| 66 | 63 | bitmap_rgb32 m_bitmap; |
| 67 | 64 | }; |
| 68 | 65 | |
| r243323 | r243324 | |
| 83 | 80 | m_port_b = 0; |
| 84 | 81 | m_port_c = 0; |
| 85 | 82 | m_port_d = 0; |
| 83 | m_joy_data[0] = m_joy_data[1] = 0; |
| 86 | 84 | } |
| 87 | 85 | |
| 88 | 86 | |
| r243323 | r243324 | |
| 94 | 92 | // ---- --x- SNES controller P2 data |
| 95 | 93 | // ---- ---x SNES controller P1 data |
| 96 | 94 | |
| 97 | | m_ctrl1->write_strobe(BIT(data, 2)); |
| 98 | | m_ctrl2->write_strobe(BIT(data, 2)); |
| 95 | UINT8 changed = m_port_a ^ data; |
| 99 | 96 | |
| 100 | | UINT8 changed = m_port_a ^ data; |
| 101 | | if ((changed & data & 0x08) || (changed & (~data) & 0x04)) |
| 97 | if (changed & data & 0x04) |
| 102 | 98 | { |
| 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(); |
| 106 | 101 | } |
| 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 | } |
| 107 | 109 | |
| 110 | m_port_a = (m_joy_data[0] & 0x01) | ((m_joy_data[1] & 0x01) << 1); |
| 111 | } |
| 112 | |
| 108 | 113 | m_port_a = (data & 0x0c) | (m_port_a & 0x03); |
| 109 | 114 | } |
| 110 | 115 | |
| r243323 | r243324 | |
| 202 | 207 | \****************************************************/ |
| 203 | 208 | |
| 204 | 209 | static 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 | |
| 205 | 240 | PORT_START("AD725_CE") |
| 206 | 241 | PORT_CONFNAME( 0x01, 0x00, "AD725 CE" ) |
| 207 | 242 | PORT_CONFSETTING( 0x00, "VCC" ) |
| r243323 | r243324 | |
| 289 | 324 | MCFG_GENERIC_MANDATORY |
| 290 | 325 | MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart) |
| 291 | 326 | |
| 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 | | |
| 295 | 327 | MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox") |
| 296 | 328 | MACHINE_CONFIG_END |
| 297 | 329 | |
trunk/src/osd/sdl/input.c
| r243323 | r243324 | |
| 1758 | 1758 | devinfo = generic_device_find_index( keyboard_list, keyboard_map.logical[0]); |
| 1759 | 1759 | #endif |
| 1760 | 1760 | 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 |
| 1762 | 1765 | ui_input_push_char_event(machine, sdl_window_list->m_target, (unicode_char) event.key.keysym.unicode); |
| 1763 | 1766 | #endif |
| 1764 | 1767 | break; |
| r243323 | r243324 | |
| 1859 | 1862 | int cx, cy; |
| 1860 | 1863 | osd_ticks_t click = osd_ticks() * 1000 / osd_ticks_per_second(); |
| 1861 | 1864 | 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) ) |
| 1863 | 1866 | { |
| 1864 | 1867 | ui_input_push_mouse_down_event(machine, window->m_target, cx, cy); |
| 1865 | 1868 | // FIXME Parameter ? |
| r243323 | r243324 | |
| 1893 | 1896 | int cx, cy; |
| 1894 | 1897 | sdl_window_info *window = GET_FOCUS_WINDOW(&event.button); |
| 1895 | 1898 | |
| 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) ) |
| 1897 | 1900 | { |
| 1898 | 1901 | ui_input_push_mouse_up_event(machine, window->m_target, cx, cy); |
| 1899 | 1902 | } |
| r243323 | r243324 | |
| 1918 | 1921 | int cx=-1, cy=-1; |
| 1919 | 1922 | sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion); |
| 1920 | 1923 | |
| 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) ) |
| 1922 | 1925 | ui_input_push_mouse_move_event(machine, window->m_target, cx, cy); |
| 1923 | 1926 | } |
| 1924 | 1927 | break; |
| r243323 | r243324 | |
| 1947 | 1950 | case SDL_TEXTINPUT: |
| 1948 | 1951 | if (*event.text.text) |
| 1949 | 1952 | { |
| 1953 | printf("char %c\n", *event.text.text); |
| 1950 | 1954 | sdl_window_info *window = GET_FOCUS_WINDOW(&event.text); |
| 1951 | 1955 | unicode_char result; |
| 1952 | 1956 | if (window != NULL ) |