mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-14 05:35:58 +00:00
Ugly solution to working with ImGUI
This commit is contained in:
parent
b677255a1b
commit
336e8a7563
4 changed files with 24 additions and 15 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "core/debug_state.h"
|
#include "core/debug_state.h"
|
||||||
#include "imgui_impl_sdl3.h"
|
#include "imgui_impl_sdl3.h"
|
||||||
|
#include "sdl_window.h"
|
||||||
|
|
||||||
// SDL
|
// SDL
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
@ -730,21 +731,25 @@ static void UpdateGamepads() {
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
SdlData* bd = GetBackendData();
|
SdlData* bd = GetBackendData();
|
||||||
|
|
||||||
/*
|
SDL_Gamepad* SDLGamepad = Input::m_gamepad;
|
||||||
// Update list of gamepads to use
|
if (SDLGamepad) {
|
||||||
if (bd->want_update_gamepads_list && bd->gamepad_mode != ImGui_ImplSDL3_GamepadMode_Manual) {
|
bd->gamepads.push_back(SDLGamepad);
|
||||||
CloseGamepads();
|
} else {
|
||||||
int sdl_gamepads_count = 0;
|
// Update list of gamepads to use
|
||||||
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
if (bd->want_update_gamepads_list &&
|
||||||
for (int n = 0; n < sdl_gamepads_count; n++)
|
bd->gamepad_mode != ImGui_ImplSDL3_GamepadMode_Manual) {
|
||||||
if (SDL_Gamepad* gamepad = SDL_OpenGamepad(sdl_gamepads[n])) {
|
CloseGamepads();
|
||||||
bd->gamepads.push_back(gamepad);
|
int sdl_gamepads_count = 0;
|
||||||
if (bd->gamepad_mode == ImGui_ImplSDL3_GamepadMode_AutoFirst)
|
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
||||||
break;
|
for (int n = 0; n < sdl_gamepads_count; n++)
|
||||||
}
|
if (SDL_Gamepad* gamepad = SDL_OpenGamepad(sdl_gamepads[n])) {
|
||||||
|
bd->gamepads.push_back(gamepad);
|
||||||
|
if (bd->gamepad_mode == ImGui_ImplSDL3_GamepadMode_AutoFirst)
|
||||||
|
break;
|
||||||
|
}
|
||||||
bd->want_update_gamepads_list = false;
|
bd->want_update_gamepads_list = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
// FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later -->
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ControlSettings</class>
|
<class>ControlSettings</class>
|
||||||
<widget class="QDialog" name="ControlSettings">
|
<widget class="QDialog" name="ControlSettings">
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
namespace Input {
|
namespace Input {
|
||||||
|
|
||||||
|
SDL_Gamepad* m_gamepad = nullptr;
|
||||||
|
|
||||||
using Libraries::Pad::OrbisPadButtonDataOffset;
|
using Libraries::Pad::OrbisPadButtonDataOffset;
|
||||||
|
|
||||||
static OrbisPadButtonDataOffset SDLGamepadToOrbisButton(u8 button) {
|
static OrbisPadButtonDataOffset SDLGamepadToOrbisButton(u8 button) {
|
||||||
|
|
|
@ -17,6 +17,8 @@ union SDL_Event;
|
||||||
|
|
||||||
namespace Input {
|
namespace Input {
|
||||||
|
|
||||||
|
extern SDL_Gamepad* m_gamepad;
|
||||||
|
|
||||||
class SDLInputEngine : public Engine {
|
class SDLInputEngine : public Engine {
|
||||||
public:
|
public:
|
||||||
~SDLInputEngine() override;
|
~SDLInputEngine() override;
|
||||||
|
@ -28,8 +30,6 @@ public:
|
||||||
State ReadState() override;
|
State ReadState() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Gamepad* m_gamepad = nullptr;
|
|
||||||
|
|
||||||
float m_gyro_poll_rate = 0.0f;
|
float m_gyro_poll_rate = 0.0f;
|
||||||
float m_accel_poll_rate = 0.0f;
|
float m_accel_poll_rate = 0.0f;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue