Browse Source

fix input finally

eden-orbis-ps4
lizzie 3 weeks ago
parent
commit
f81da34ef1
  1. 4
      .ci/ps4/build.sh
  2. 2
      src/common/fiber.cpp
  3. 17
      src/input_common/drivers/sdl_driver.cpp
  4. 41
      src/yuzu_cmd/yuzu.cpp

4
.ci/ps4/build.sh

@ -10,8 +10,8 @@ set(CMAKE_SYSROOT "$OO_PS4_TOOLCHAIN")
set(CMAKE_STAGING_PREFIX "$OO_PS4_TOOLCHAIN")
set(CMAKE_SYSTEM_NAME "OpenOrbis")
set(CMAKE_C_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables")
set(CMAKE_CXX_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables")
set(CMAKE_C_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables -femulated-tls")
set(CMAKE_CXX_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables -femulated-tls")
set(CMAKE_EXE_LINKER_FLAGS "-m elf_x86_64 -pie -T $OO_PS4_TOOLCHAIN/link.x --eh-frame-hdr -L$OO_PS4_TOOLCHAIN/lib")
set(CMAKE_C_LINK_FLAGS "-m elf_x86_64 -pie -T $OO_PS4_TOOLCHAIN/link.x --eh-frame-hdr -L$OO_PS4_TOOLCHAIN/lib")

2
src/common/fiber.cpp

@ -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

17
src/input_common/drivers/sdl_driver.cpp

@ -1026,27 +1026,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;
}

41
src/yuzu_cmd/yuzu.cpp

@ -12,6 +12,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"
@ -27,6 +28,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"
@ -57,6 +60,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" {
@ -372,7 +376,7 @@ int main(int argc, char** argv) {
// Apply the command line arguments
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));
std::unique_ptr<EmuWindow_SDL3> emu_window;
switch (Settings::values.renderer_backend.GetValue()) {
@ -453,6 +457,41 @@ int main(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)
system.GPU().Start();
system.GetCpuManager().OnGpuReady();

Loading…
Cancel
Save