mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-13 13:15:59 +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 "core/debug_state.h"
|
||||
#include "imgui_impl_sdl3.h"
|
||||
#include "sdl_window.h"
|
||||
|
||||
// SDL
|
||||
#include <SDL3/SDL.h>
|
||||
|
@ -730,21 +731,25 @@ static void UpdateGamepads() {
|
|||
ImGuiIO& io = ImGui::GetIO();
|
||||
SdlData* bd = GetBackendData();
|
||||
|
||||
/*
|
||||
// Update list of gamepads to use
|
||||
if (bd->want_update_gamepads_list && bd->gamepad_mode != ImGui_ImplSDL3_GamepadMode_Manual) {
|
||||
CloseGamepads();
|
||||
int sdl_gamepads_count = 0;
|
||||
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
||||
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;
|
||||
}
|
||||
SDL_Gamepad* SDLGamepad = Input::m_gamepad;
|
||||
if (SDLGamepad) {
|
||||
bd->gamepads.push_back(SDLGamepad);
|
||||
} else {
|
||||
// Update list of gamepads to use
|
||||
if (bd->want_update_gamepads_list &&
|
||||
bd->gamepad_mode != ImGui_ImplSDL3_GamepadMode_Manual) {
|
||||
CloseGamepads();
|
||||
int sdl_gamepads_count = 0;
|
||||
const SDL_JoystickID* sdl_gamepads = SDL_GetGamepads(&sdl_gamepads_count);
|
||||
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;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?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">
|
||||
<class>ControlSettings</class>
|
||||
<widget class="QDialog" name="ControlSettings">
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
namespace Input {
|
||||
|
||||
SDL_Gamepad* m_gamepad = nullptr;
|
||||
|
||||
using Libraries::Pad::OrbisPadButtonDataOffset;
|
||||
|
||||
static OrbisPadButtonDataOffset SDLGamepadToOrbisButton(u8 button) {
|
||||
|
|
|
@ -17,6 +17,8 @@ union SDL_Event;
|
|||
|
||||
namespace Input {
|
||||
|
||||
extern SDL_Gamepad* m_gamepad;
|
||||
|
||||
class SDLInputEngine : public Engine {
|
||||
public:
|
||||
~SDLInputEngine() override;
|
||||
|
@ -28,8 +30,6 @@ public:
|
|||
State ReadState() override;
|
||||
|
||||
private:
|
||||
SDL_Gamepad* m_gamepad = nullptr;
|
||||
|
||||
float m_gyro_poll_rate = 0.0f;
|
||||
float m_accel_poll_rate = 0.0f;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue