diff --git a/Makefile.common b/Makefile.common index 633ce00251..b3da454d30 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1888,8 +1888,7 @@ ifneq ($(findstring DOS,$(OS)),) gfx/drivers_font/vga_font.o \ input/drivers/dos_input.o \ input/drivers_joypad/dos_joypad.o \ - frontend/drivers/platform_dos.o \ - input/drivers_keyboard/keyboard_event_dos.o + frontend/drivers/platform_dos.o ifeq ($(HAVE_MENU_COMMON), 1) OBJ += menu/drivers_display/menu_display_vga.o diff --git a/input/drivers/dos_input.c b/input/drivers/dos_input.c index 520d924dfd..e7e700c40f 100644 --- a/input/drivers/dos_input.c +++ b/input/drivers/dos_input.c @@ -1,6 +1,7 @@ /* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2019 - Brad Parker * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- @@ -17,6 +18,8 @@ #include #include +#include + #include "../input_driver.h" #include "../input_keymaps.h" #include "../drivers_keyboard/keyboard_event_dos.h" @@ -29,6 +32,33 @@ typedef struct dos_input const input_device_driver_t *joypad; } dos_input_t; +#define MAX_KEYS LAST_KEYCODE + 1 + +/* First ports are used to keeping track of gamepad states. Last port is used for keyboard state */ +static uint16_t dos_key_state[MAX_PADS+1][MAX_KEYS]; + +static bool dos_keyboard_port_input_pressed( + const struct retro_keybind *binds, unsigned id) +{ + if (id < RARCH_BIND_LIST_END) + return dos_key_state[DOS_KEYBOARD_PORT][rarch_keysym_lut[&binds[id].key]]; + return false; +} + +uint16_t *dos_keyboard_state_get(unsigned port) +{ + return dos_key_state[port]; +} + +static void dos_keyboard_free(void) +{ + unsigned i, j; + + for (i = 0; i < MAX_PADS; i++) + for (j = 0; j < MAX_KEYS; j++) + dos_key_state[i][j] = 0; +} + static void dos_input_poll(void *data) { dos_input_t *dos = (dos_input_t*)data; diff --git a/input/drivers_keyboard/keyboard_event_dos.c b/input/drivers_keyboard/keyboard_event_dos.c deleted file mode 100644 index eb85e3a425..0000000000 --- a/input/drivers_keyboard/keyboard_event_dos.c +++ /dev/null @@ -1,56 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2016-2019 - Brad Parker - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#include - -#include "keyboard_event_dos.h" -#include "../input_keymaps.h" - -#define MAX_KEYS LAST_KEYCODE + 1 - -// First ports are used to keeping track of gamepad states. Last port is used for keyboard state -static uint16_t dos_key_state[MAX_PADS+1][MAX_KEYS]; - -bool dos_keyboard_port_input_pressed(const struct retro_keybind *binds, unsigned id) -{ - if (id < RARCH_BIND_LIST_END) - { - const struct retro_keybind *bind = &binds[id]; - unsigned key = rarch_keysym_lut[bind->key]; - return dos_key_state[DOS_KEYBOARD_PORT][key]; - } - return false; -} - -bool dos_keyboard_input_pressed(unsigned key) -{ - unsigned keysym = rarch_keysym_lut[key]; - return dos_key_state[DOS_KEYBOARD_PORT][keysym]; -} - -uint16_t *dos_keyboard_state_get(unsigned port) -{ - return dos_key_state[port]; -} - -void dos_keyboard_free(void) -{ - unsigned i, j; - - for (i = 0; i < MAX_PADS; i++) - for (j = 0; j < MAX_KEYS; j++) - dos_key_state[i][j] = 0; -} diff --git a/input/drivers_keyboard/keyboard_event_dos.h b/input/drivers_keyboard/keyboard_event_dos.h index 91d64b6fa4..d1d2cd68ff 100644 --- a/input/drivers_keyboard/keyboard_event_dos.h +++ b/input/drivers_keyboard/keyboard_event_dos.h @@ -124,14 +124,6 @@ enum { #define DOS_KEYBOARD_PORT MAX_PADS -bool dos_keyboard_port_input_pressed(const struct retro_keybind *binds, unsigned id); - -bool dos_keyboard_input_pressed(unsigned key); - uint16_t *dos_keyboard_state_get(unsigned port); -void dos_keyboard_init(void); - -void dos_keyboard_free(void); - #endif