mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-19 22:47:10 +00:00
fix input finally
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
namespace Common {
|
||||
|
||||
#ifdef __OPENORBIS__
|
||||
constexpr size_t DEFAULT_STACK_SIZE = 64 * 4096;
|
||||
constexpr size_t DEFAULT_STACK_SIZE = 128 * 4096;
|
||||
#else
|
||||
constexpr size_t DEFAULT_STACK_SIZE = 512 * 4096;
|
||||
#endif
|
||||
|
||||
@@ -1033,27 +1033,20 @@ ButtonBindings SDLDriver::GetDefaultButtonBinding(
|
||||
};
|
||||
}
|
||||
|
||||
ButtonMapping SDLDriver::GetSingleControllerMapping(
|
||||
const std::shared_ptr<SDLJoystick>& joystick, const ButtonBindings& switch_to_sdl_button,
|
||||
const ZButtonBindings& switch_to_sdl_axis) const {
|
||||
ButtonMapping SDLDriver::GetSingleControllerMapping(const std::shared_ptr<SDLJoystick>& joystick, const ButtonBindings& switch_to_sdl_button, const ZButtonBindings& switch_to_sdl_axis) const {
|
||||
ButtonMapping mapping;
|
||||
mapping.reserve(switch_to_sdl_button.size() + switch_to_sdl_axis.size());
|
||||
auto* controller = joystick->GetSDLGameController();
|
||||
if (auto* controller = joystick->GetSDLGameController(); controller) {
|
||||
const auto bindings = GetBindings(controller);
|
||||
|
||||
for (const auto& [switch_button, sdl_button] : switch_to_sdl_button) {
|
||||
const auto binding = GetBindingForButton(bindings, sdl_button);
|
||||
mapping.insert_or_assign(
|
||||
switch_button,
|
||||
BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding));
|
||||
mapping.insert_or_assign(switch_button, BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding));
|
||||
}
|
||||
for (const auto& [switch_button, sdl_axis] : switch_to_sdl_axis) {
|
||||
const auto binding = GetBindingForAxis(bindings, sdl_axis);
|
||||
mapping.insert_or_assign(
|
||||
switch_button,
|
||||
BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding));
|
||||
mapping.insert_or_assign(switch_button, BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding));
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
|
||||
+40
-1
@@ -18,6 +18,7 @@
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
#include "common/logging.h"
|
||||
#include "common/param_package.h"
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/settings_enums.h"
|
||||
@@ -33,6 +34,8 @@
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/loader.h"
|
||||
#include "frontend_common/config.h"
|
||||
#include "hid_core/frontend/emulated_controller.h"
|
||||
#include "hid_core/hid_core.h"
|
||||
#include "input_common/main.h"
|
||||
#include "network/network.h"
|
||||
#include "sdl_config.h"
|
||||
@@ -61,6 +64,7 @@
|
||||
#include <orbis/libkernel.h>
|
||||
#include <orbis/SystemService.h>
|
||||
#include <orbis/AudioOut.h>
|
||||
#include <orbis/Pad.h>
|
||||
#include <orbis/UserService.h>
|
||||
#elif defined(_WIN32)
|
||||
extern "C" {
|
||||
@@ -404,7 +408,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
|
||||
// Apply the command line arguments
|
||||
state->system.ApplySettings();
|
||||
Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Null);
|
||||
Common::Log::SetGlobalFilter(Common::Log::Filter(Common::Log::Level::Trace));
|
||||
Common::Log::SetGlobalFilter(Common::Log::Filter(Common::Log::Level::Info));
|
||||
|
||||
switch (Settings::values.renderer_backend.GetValue()) {
|
||||
#ifdef HAS_OPENGL
|
||||
@@ -479,6 +483,41 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto emulated_controller = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||
auto const input_devices = input_subsystem.GetInputDevices();
|
||||
for (const auto& e : input_devices) {
|
||||
LOG_INFO(Input, "FOUND=Device -> {} {}", e.Get("display", "Unknown"), e.Serialize());
|
||||
}
|
||||
auto const& device = input_devices[3];
|
||||
LOG_INFO(Input, "selected? {}", device.Serialize());
|
||||
auto const button_mappings = input_subsystem.GetButtonMappingForDevice(device);
|
||||
auto const analog_mappings = input_subsystem.GetAnalogMappingForDevice(device);
|
||||
auto const motion_mappings = input_subsystem.GetMotionMappingForDevice(device);
|
||||
for (const auto& pair : button_mappings)
|
||||
emulated_controller->SetButtonParam(pair.first, pair.second);
|
||||
for (const auto& pair : analog_mappings)
|
||||
emulated_controller->SetStickParam(pair.first, pair.second);
|
||||
for (const auto& pair : motion_mappings)
|
||||
emulated_controller->SetMotionParam(pair.first, pair.second);
|
||||
|
||||
for (const auto& pair : button_mappings)
|
||||
LOG_INFO(Input, "btn:{}:{}", pair.first, pair.second.Serialize());
|
||||
for (const auto& pair : analog_mappings)
|
||||
LOG_INFO(Input, "ang:{}:{}", pair.first, pair.second.Serialize());
|
||||
for (const auto& pair : motion_mappings)
|
||||
LOG_INFO(Input, "mot:{}:{}", pair.first, pair.second.Serialize());
|
||||
|
||||
emulated_controller->SaveCurrentConfig();
|
||||
emulated_controller->ReloadFromSettings();
|
||||
|
||||
auto const mapped_devices = emulated_controller->GetMappedDevices();
|
||||
LOG_INFO(Input, "AND SO, WHAT MAPPED DEVICES WE GOT?");
|
||||
for (const auto& e : mapped_devices) {
|
||||
LOG_INFO(Input, "Mapped=Device? -> {}", e.Get("display", "Unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
// Core is loaded, start the GPU (makes the GPU contexts current to this thread)
|
||||
state->system.GPU().Start();
|
||||
state->system.GetCpuManager().OnGpuReady();
|
||||
|
||||
Reference in New Issue
Block a user