From 26e9aba0b40ae51bc8c11a2e9ac6ef690e33f272 Mon Sep 17 00:00:00 2001 From: Emery Hemingway <ehmry@posteo.net> Date: Sat, 7 Apr 2018 15:18:24 +0200 Subject: [PATCH] Share keyboard port with mouse --- libretro/libretro.cpp | 11 ++++------- libretro/mapper.cpp | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 93e1c85..9ed5bea 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -108,9 +108,9 @@ void retro_set_environment(retro_environment_t cb) static const struct retro_controller_description pads[] = { - { "Gamepad", RETRO_DEVICE_JOYPAD }, - { "Joystick", RETRO_DEVICE_JOYSTICK }, - { "Keyboard", RETRO_DEVICE_MAPPER }, + { "Gamepad", RETRO_DEVICE_JOYPAD }, + { "Joystick", RETRO_DEVICE_JOYSTICK }, + { "Keyboard+Mouse", RETRO_DEVICE_MAPPER }, { 0 }, }; @@ -265,7 +265,6 @@ void check_variables() if(update_cycles) { int cycles = cycles_0 + cycles_1 + cycles_2 + cycles_3; - char cycles_val[16]; CPU_CycleMax=cycles; } @@ -356,7 +355,6 @@ static void retro_start_emulator(void) CommandLine com_line(loadPath.empty() ? 1 : 2, argv); Config myconf(&com_line); control=&myconf; - bool ret; check_variables(); /* Init the configuration system and add default values */ @@ -364,7 +362,7 @@ static void retro_start_emulator(void) /* Load config */ if(!configPath.empty()) - ret = control->ParseConfigFile(configPath.c_str()); + control->ParseConfigFile(configPath.c_str()); /* Init all the sections */ control->Init(); @@ -522,7 +520,6 @@ char slash; } else if(configPath.empty()) { - const char* systemDir = 0; configPath = normalizePath(retro_system_directory + slash + "DOSbox" + slash + "dosbox-libretro.conf"); log_cb(RETRO_LOG_INFO, "Loading default configuration %s\n", configPath.c_str()); } diff --git a/libretro/mapper.cpp b/libretro/mapper.cpp index cb12a6c..89523bd 100644 --- a/libretro/mapper.cpp +++ b/libretro/mapper.cpp @@ -127,7 +127,7 @@ struct MouseButton : public Processable MouseButton(unsigned retro, unsigned dosbox) : retroButton(retro), dosboxButton(dosbox) { } - void process() { item.process(*this, input_cb(1, RDEV(MOUSE), 0, retroButton)); } + void process() { item.process(*this, input_cb(0, RDEV(MOUSE), 0, retroButton)); } void press() const { Mouse_ButtonPressed(dosboxButton); } void release() const { Mouse_ButtonReleased(dosboxButton); } }; @@ -539,8 +539,8 @@ void MAPPER_Run(bool pressed) poll_cb(); // Mouse movement - int16_t mouseX = input_cb(1, RDEV(MOUSE), 0, RDID(MOUSE_X)); - int16_t mouseY = input_cb(1, RDEV(MOUSE), 0, RDID(MOUSE_Y)); + int16_t mouseX = input_cb(0, RDEV(MOUSE), 0, RDID(MOUSE_X)); + int16_t mouseY = input_cb(0, RDEV(MOUSE), 0, RDID(MOUSE_Y)); const int deadzone = 30; const int speed = 8; -- GitLab