Remove detail namespaces. (#137)

This commit is contained in:
Skyth (Asilkan) 2025-01-19 21:09:47 +03:00 committed by GitHub
parent d10f4bac3c
commit 312f913a92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 99 additions and 231 deletions

View file

@ -87,16 +87,8 @@ set(SWA_LOCALE_CXX_SOURCES
"locale/locale.cpp" "locale/locale.cpp"
) )
set(SWA_OS_CXX_SOURCES
"os/logger.cpp"
"os/media.cpp"
"os/process.cpp"
"os/user.cpp"
"os/version.cpp"
)
if (WIN32) if (WIN32)
list(APPEND SWA_OS_CXX_SOURCES set(SWA_OS_CXX_SOURCES
"os/win32/logger_win32.cpp" "os/win32/logger_win32.cpp"
"os/win32/media_win32.cpp" "os/win32/media_win32.cpp"
"os/win32/process_win32.cpp" "os/win32/process_win32.cpp"
@ -104,7 +96,7 @@ if (WIN32)
"os/win32/version_win32.cpp" "os/win32/version_win32.cpp"
) )
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND SWA_OS_CXX_SOURCES set(SWA_OS_CXX_SOURCES
"os/linux/logger_linux.cpp" "os/linux/logger_linux.cpp"
"os/linux/media_linux.cpp" "os/linux/media_linux.cpp"
"os/linux/process_linux.cpp" "os/linux/process_linux.cpp"

View file

@ -10,7 +10,7 @@
#include <decompressor.h> #include <decompressor.h>
#include <kernel/function.h> #include <kernel/function.h>
#include <kernel/heap.h> #include <kernel/heap.h>
#include <hid/hid_detail.h> #include <hid/hid.h>
#include <kernel/memory.h> #include <kernel/memory.h>
#include <kernel/xdbf.h> #include <kernel/xdbf.h>
#include <res/bc_diff/button_bc_diff.bin.h> #include <res/bc_diff/button_bc_diff.bin.h>
@ -3017,7 +3017,7 @@ static void SetTexture(GuestDevice* device, uint32_t index, GuestTexture* textur
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::detail::g_inputDeviceController == hid::detail::EInputDevice::PlayStation; isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation;
if (isPlayStation && texture != nullptr && texture->patchedTexture != nullptr) if (isPlayStation && texture != nullptr && texture->patchedTexture != nullptr)
texture = texture->patchedTexture.get(); texture = texture->patchedTexture.get();

View file

@ -1,7 +1,7 @@
#include <stdafx.h> #include <stdafx.h>
#include <SDL.h> #include <SDL.h>
#include <user/config.h> #include <user/config.h>
#include <hid/hid_detail.h> #include <hid/hid.h>
#include <ui/game_window.h> #include <ui/game_window.h>
#include <kernel/xdm.h> #include <kernel/xdm.h>
#include <app.h> #include <app.h>
@ -40,17 +40,17 @@ public:
return SDL_GameControllerTypeForIndex(index); return SDL_GameControllerTypeForIndex(index);
} }
hid::detail::EInputDevice GetInputDevice() const hid::EInputDevice GetInputDevice() const
{ {
switch (GetControllerType()) switch (GetControllerType())
{ {
case SDL_CONTROLLER_TYPE_PS3: case SDL_CONTROLLER_TYPE_PS3:
case SDL_CONTROLLER_TYPE_PS4: case SDL_CONTROLLER_TYPE_PS4:
case SDL_CONTROLLER_TYPE_PS5: case SDL_CONTROLLER_TYPE_PS5:
return hid::detail::EInputDevice::PlayStation; return hid::EInputDevice::PlayStation;
} }
return hid::detail::EInputDevice::Xbox; return hid::EInputDevice::Xbox;
} }
void Close() void Close()
@ -168,8 +168,8 @@ static void SetControllerInputDevice(Controller* controller)
if (App::s_isLoading) if (App::s_isLoading)
return; return;
hid::detail::g_inputDevice = controller->GetInputDevice(); hid::g_inputDevice = controller->GetInputDevice();
hid::detail::g_inputDeviceController = hid::detail::g_inputDevice; hid::g_inputDeviceController = hid::g_inputDevice;
} }
int HID_OnSDLEvent(void*, SDL_Event* event) int HID_OnSDLEvent(void*, SDL_Event* event)
@ -224,13 +224,13 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
hid::detail::g_inputDevice = hid::detail::EInputDevice::Keyboard; hid::g_inputDevice = hid::EInputDevice::Keyboard;
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
hid::detail::g_inputDevice = hid::detail::EInputDevice::Mouse; hid::g_inputDevice = hid::EInputDevice::Mouse;
break; break;
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
@ -266,7 +266,7 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
return 0; return 0;
} }
void hid::detail::Init() void hid::Init()
{ {
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS3, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS3, "1");
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4, "1");
@ -282,7 +282,7 @@ void hid::detail::Init()
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);
} }
uint32_t hid::detail::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState) uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
{ {
static uint32_t packet; static uint32_t packet;
@ -301,7 +301,7 @@ uint32_t hid::detail::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
uint32_t hid::detail::SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration) uint32_t hid::SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration)
{ {
if (!pVibration) if (!pVibration)
return ERROR_BAD_ARGUMENTS; return ERROR_BAD_ARGUMENTS;
@ -314,7 +314,7 @@ uint32_t hid::detail::SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibrat
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
uint32_t hid::detail::GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps) uint32_t hid::GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps)
{ {
if (!pCaps) if (!pCaps)
return ERROR_BAD_ARGUMENTS; return ERROR_BAD_ARGUMENTS;

View file

@ -1,39 +1,17 @@
#include <stdafx.h>
#include "hid.h" #include "hid.h"
#include "hid_detail.h"
hid::detail::EInputDevice hid::detail::g_inputDevice; hid::EInputDevice hid::g_inputDevice;
hid::detail::EInputDevice hid::detail::g_inputDeviceController; hid::EInputDevice hid::g_inputDeviceController;
uint16_t hid::detail::g_prohibitedButtons; uint16_t hid::g_prohibitedButtons;
void hid::Init()
{
detail::Init();
}
void hid::SetProhibitedButtons(uint16_t wButtons) void hid::SetProhibitedButtons(uint16_t wButtons)
{ {
hid::detail::g_prohibitedButtons = wButtons; hid::g_prohibitedButtons = wButtons;
} }
uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState) bool hid::IsInputDeviceController()
{ {
return detail::GetState(dwUserIndex, pState); return hid::g_inputDevice != hid::EInputDevice::Keyboard &&
} hid::g_inputDevice != hid::EInputDevice::Mouse;
uint32_t hid::SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration)
{
return detail::SetState(dwUserIndex, pVibration);
}
uint32_t hid::GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps)
{
return detail::GetCapabilities(dwUserIndex, pCaps);
}
bool hid::detail::IsInputDeviceController()
{
return hid::detail::g_inputDevice != hid::detail::EInputDevice::Keyboard &&
hid::detail::g_inputDevice != hid::detail::EInputDevice::Mouse;
} }

View file

@ -1,13 +1,26 @@
#pragma once #pragma once
union SDL_Event;
namespace hid namespace hid
{ {
enum class EInputDevice
{
Keyboard,
Mouse,
Xbox,
PlayStation
};
extern EInputDevice g_inputDevice;
extern EInputDevice g_inputDeviceController;
extern uint16_t g_prohibitedButtons;
void Init(); void Init();
void SetProhibitedButtons(uint16_t wButtons); void SetProhibitedButtons(uint16_t wButtons);
uint32_t GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState); uint32_t GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState);
uint32_t SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration); uint32_t SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration);
uint32_t GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps); uint32_t GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps);
bool IsInputDeviceController();
} }

View file

@ -1,25 +0,0 @@
#pragma once
namespace hid::detail
{
enum class EInputDevice
{
Keyboard,
Mouse,
Xbox,
PlayStation
};
extern EInputDevice g_inputDevice;
extern EInputDevice g_inputDeviceController;
extern uint16_t g_prohibitedButtons;
void Init();
uint32_t GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState);
uint32_t SetState(uint32_t dwUserIndex, XAMINPUT_VIBRATION* pVibration);
uint32_t GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps);
bool IsInputDeviceController();
}

View file

@ -2,7 +2,6 @@
#include "xam.h" #include "xam.h"
#include "xdm.h" #include "xdm.h"
#include <hid/hid.h> #include <hid/hid.h>
#include <hid/hid_detail.h>
#include <ui/game_window.h> #include <ui/game_window.h>
#include <cpu/guest_thread.h> #include <cpu/guest_thread.h>
#include <ranges> #include <ranges>
@ -455,7 +454,7 @@ uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_STATE* st
state->Gamepad.wButtons |= XAMINPUT_GAMEPAD_Y; state->Gamepad.wButtons |= XAMINPUT_GAMEPAD_Y;
} }
state->Gamepad.wButtons &= ~hid::detail::g_prohibitedButtons; state->Gamepad.wButtons &= ~hid::g_prohibitedButtons;
ByteSwapInplace(state->Gamepad.wButtons); ByteSwapInplace(state->Gamepad.wButtons);
ByteSwapInplace(state->Gamepad.sThumbLX); ByteSwapInplace(state->Gamepad.sThumbLX);
@ -468,7 +467,7 @@ uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_STATE* st
uint32_t XamInputSetState(uint32_t userIndex, uint32_t flags, XAMINPUT_VIBRATION* vibration) uint32_t XamInputSetState(uint32_t userIndex, uint32_t flags, XAMINPUT_VIBRATION* vibration)
{ {
if (!hid::detail::IsInputDeviceController() || !Config::Vibration) if (!hid::IsInputDeviceController() || !Config::Vibration)
return ERROR_SUCCESS; return ERROR_SUCCESS;
ByteSwapInplace(vibration->wLeftMotorSpeed); ByteSwapInplace(vibration->wLeftMotorSpeed);

View file

@ -1,10 +1,10 @@
#include <os/logger_detail.h> #include <os/logger.h>
void os::logger::detail::Init() void os::logger::Init()
{ {
} }
void os::logger::detail::Log(const std::string_view str, detail::ELogType type, const char* func) void os::logger::Log(const std::string_view str, ELogType type, const char* func)
{ {
if (func) if (func)
{ {

View file

@ -1,6 +1,6 @@
#include <os/media_detail.h> #include <os/media.h>
bool os::media::detail::IsExternalMediaPlaying() bool os::media::IsExternalMediaPlaying()
{ {
// This functionality is not supported in Linux. // This functionality is not supported in Linux.
return false; return false;

View file

@ -1,8 +1,8 @@
#include <os/process_detail.h> #include <os/process.h>
#include <signal.h> #include <signal.h>
std::filesystem::path os::process::detail::GetExecutablePath() std::filesystem::path os::process::GetExecutablePath()
{ {
char exePath[PATH_MAX] = {}; char exePath[PATH_MAX] = {};
if (readlink("/proc/self/exe", exePath, PATH_MAX) > 0) if (readlink("/proc/self/exe", exePath, PATH_MAX) > 0)
@ -15,7 +15,7 @@ std::filesystem::path os::process::detail::GetExecutablePath()
} }
} }
std::filesystem::path os::process::detail::GetWorkingDirectory() std::filesystem::path os::process::GetWorkingDirectory()
{ {
char cwd[PATH_MAX] = {}; char cwd[PATH_MAX] = {};
char *res = getcwd(cwd, sizeof(cwd)); char *res = getcwd(cwd, sizeof(cwd));
@ -29,7 +29,7 @@ std::filesystem::path os::process::detail::GetWorkingDirectory()
} }
} }
bool os::process::detail::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work) bool os::process::StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work)
{ {
pid_t pid = fork(); pid_t pid = fork();
if (pid < 0) if (pid < 0)

View file

@ -1,6 +1,6 @@
#include <os/user_detail.h> #include <os/user.h>
bool os::user::detail::IsDarkTheme() bool os::user::IsDarkTheme()
{ {
return false; return false;
} }

View file

@ -1,7 +1,7 @@
#include <os/version_detail.h> #include <os/version.h>
os::version::detail::OSVersion os::version::detail::GetOSVersion() os::version::OSVersion os::version::GetOSVersion()
{ {
assert(false && "Unimplemented."); assert(false && "Unimplemented.");
return os::version::detail::OSVersion(); return os::version::OSVersion();
} }

View file

@ -1,12 +0,0 @@
#include <os/logger.h>
#include <os/logger_detail.h>
void os::logger::Init()
{
detail::Init();
}
void os::logger::Log(const std::string_view str, detail::ELogType type, const char* func)
{
detail::Log(str, type, func);
}

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
#include <os/logger_detail.h> #include <source_location>
#define LOG_IMPL(type, func, str) os::logger::Log(str, os::logger::detail::ELogType::type, func) #define LOG_IMPL(type, func, str) os::logger::Log(str, os::logger::ELogType::type, func)
#define LOGF_IMPL(type, func, str, ...) os::logger::Log(fmt::format(str, __VA_ARGS__), os::logger::detail::ELogType::type, func) #define LOGF_IMPL(type, func, str, ...) os::logger::Log(fmt::format(str, __VA_ARGS__), os::logger::ELogType::type, func)
// Function-specific logging. // Function-specific logging.
@ -51,6 +51,14 @@
namespace os::logger namespace os::logger
{ {
enum class ELogType
{
None,
Utility,
Warning,
Error
};
void Init(); void Init();
void Log(const std::string_view str, detail::ELogType type = detail::ELogType::None, const char* func = nullptr); void Log(const std::string_view str, ELogType type = ELogType::None, const char* func = nullptr);
} }

View file

@ -1,17 +0,0 @@
#pragma once
#include <source_location>
namespace os::logger::detail
{
enum class ELogType
{
None,
Utility,
Warning,
Error
};
void Init();
void Log(const std::string_view str, ELogType type = ELogType::None, const char* func = nullptr);
}

View file

@ -1,7 +0,0 @@
#include <os/media.h>
#include <os/media_detail.h>
bool os::media::IsExternalMediaPlaying()
{
return detail::IsExternalMediaPlaying();
}

View file

@ -1,6 +0,0 @@
#pragma once
namespace os::media::detail
{
bool IsExternalMediaPlaying();
}

View file

@ -1,17 +0,0 @@
#include <os/process.h>
#include <os/process_detail.h>
std::filesystem::path os::process::GetExecutablePath()
{
return detail::GetExecutablePath();
}
std::filesystem::path os::process::GetWorkingDirectory()
{
return detail::GetWorkingDirectory();
}
bool os::process::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work)
{
return detail::StartProcess(path, args, work);
}

View file

@ -4,5 +4,5 @@ namespace os::process
{ {
std::filesystem::path GetExecutablePath(); std::filesystem::path GetExecutablePath();
std::filesystem::path GetWorkingDirectory(); std::filesystem::path GetWorkingDirectory();
bool StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work = {}); bool StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work = {});
} }

View file

@ -1,8 +0,0 @@
#pragma once
namespace os::process::detail
{
std::filesystem::path GetExecutablePath();
std::filesystem::path GetWorkingDirectory();
bool StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work = {});
}

View file

@ -1,7 +0,0 @@
#include <os/user.h>
#include <os/user_detail.h>
bool os::user::IsDarkTheme()
{
return detail::IsDarkTheme();
}

View file

@ -1,6 +0,0 @@
#pragma once
namespace os::user::detail
{
bool IsDarkTheme();
}

View file

@ -1,7 +0,0 @@
#include <os/version.h>
#include <os/version_detail.h>
os::version::detail::OSVersion os::version::GetOSVersion()
{
return detail::GetOSVersion();
}

View file

@ -1,8 +1,13 @@
#pragma once #pragma once
#include <os/version_detail.h>
namespace os::version namespace os::version
{ {
detail::OSVersion GetOSVersion(); struct OSVersion
{
uint32_t Major{};
uint32_t Minor{};
uint32_t Build{};
};
OSVersion GetOSVersion();
} }

View file

@ -1,13 +0,0 @@
#pragma once
namespace os::version::detail
{
struct OSVersion
{
uint32_t Major{};
uint32_t Minor{};
uint32_t Build{};
};
OSVersion GetOSVersion();
}

View file

@ -1,17 +1,16 @@
#include <os/logger_detail.h> #include <os/logger.h>
#include <print>
#define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) #define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
#define FOREGROUND_YELLOW (FOREGROUND_RED | FOREGROUND_GREEN) #define FOREGROUND_YELLOW (FOREGROUND_RED | FOREGROUND_GREEN)
HANDLE g_hStandardOutput; HANDLE g_hStandardOutput;
void os::logger::detail::Init() void os::logger::Init()
{ {
g_hStandardOutput = GetStdHandle(STD_OUTPUT_HANDLE); g_hStandardOutput = GetStdHandle(STD_OUTPUT_HANDLE);
} }
void os::logger::detail::Log(const std::string_view str, detail::ELogType type, const char* func) void os::logger::Log(const std::string_view str, ELogType type, const char* func)
{ {
switch (type) switch (type)
{ {

View file

@ -1,4 +1,4 @@
#include <os/media_detail.h> #include <os/media.h>
#include <os/logger.h> #include <os/logger.h>
#include <winrt/Windows.Foundation.h> #include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Media.Control.h> #include <winrt/Windows.Media.Control.h>
@ -62,7 +62,7 @@ static GlobalSystemMediaTransportControlsSessionPlaybackInfo GetPlaybackInfo()
} }
} }
bool os::media::detail::IsExternalMediaPlaying() bool os::media::IsExternalMediaPlaying()
{ {
auto playbackInfo = GetPlaybackInfo(); auto playbackInfo = GetPlaybackInfo();

View file

@ -1,6 +1,6 @@
#include <os/process_detail.h> #include <os/process.h>
std::filesystem::path os::process::detail::GetExecutablePath() std::filesystem::path os::process::GetExecutablePath()
{ {
WCHAR exePath[MAX_PATH]; WCHAR exePath[MAX_PATH];
@ -10,7 +10,7 @@ std::filesystem::path os::process::detail::GetExecutablePath()
return std::filesystem::path(exePath); return std::filesystem::path(exePath);
} }
std::filesystem::path os::process::detail::GetWorkingDirectory() std::filesystem::path os::process::GetWorkingDirectory()
{ {
WCHAR workPath[MAX_PATH]; WCHAR workPath[MAX_PATH];
@ -20,7 +20,7 @@ std::filesystem::path os::process::detail::GetWorkingDirectory()
return std::filesystem::path(workPath); return std::filesystem::path(workPath);
} }
bool os::process::detail::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work) bool os::process::StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work)
{ {
if (path.empty()) if (path.empty())
return false; return false;

View file

@ -1,6 +1,6 @@
#include <os/user_detail.h> #include <os/user.h>
bool os::user::detail::IsDarkTheme() bool os::user::IsDarkTheme()
{ {
HKEY hKey; HKEY hKey;

View file

@ -1,10 +1,10 @@
#include <os/version_detail.h> #include <os/version.h>
LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW); LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW);
os::version::detail::OSVersion os::version::detail::GetOSVersion() os::version::OSVersion os::version::GetOSVersion()
{ {
auto result = os::version::detail::OSVersion{}; auto result = os::version::OSVersion{};
OSVERSIONINFOEXW osvi = { 0 }; OSVERSIONINFOEXW osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);

View file

@ -2,7 +2,7 @@
#include <user/config.h> #include <user/config.h>
#include <api/SWA.h> #include <api/SWA.h>
#include <os/logger.h> #include <os/logger.h>
#include <hid/hid_detail.h> #include <hid/hid.h>
#include <app.h> #include <app.h>
bool m_isSavedAchievementData = false; bool m_isSavedAchievementData = false;
@ -133,7 +133,7 @@ void LoadingScreenControllerMidAsmHook()
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::detail::g_inputDeviceController == hid::detail::EInputDevice::PlayStation; isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation;
const char* prefix = isPlayStation ? "ps3" : "360"; const char* prefix = isPlayStation ? "ps3" : "360";

View file

@ -2,7 +2,7 @@
#include "imgui_utils.h" #include "imgui_utils.h"
#include <gpu/imgui/imgui_snapshot.h> #include <gpu/imgui/imgui_snapshot.h>
#include <gpu/video.h> #include <gpu/video.h>
#include <hid/hid_detail.h> #include <hid/hid.h>
#include <user/config.h> #include <user/config.h>
#include <app.h> #include <app.h>
#include <decompressor.h> #include <decompressor.h>
@ -63,7 +63,7 @@ std::tuple<std::tuple<ImVec2, ImVec2>, GuestTexture*> GetButtonIcon(EButtonIcon
GuestTexture* texture; GuestTexture* texture;
auto isPlayStation = Config::ControllerIcons == EControllerIcons::Auto auto isPlayStation = Config::ControllerIcons == EControllerIcons::Auto
? hid::detail::g_inputDeviceController == hid::detail::EInputDevice::PlayStation ? hid::g_inputDeviceController == hid::EInputDevice::PlayStation
: Config::ControllerIcons == EControllerIcons::PlayStation; : Config::ControllerIcons == EControllerIcons::PlayStation;
auto yOffsetCmn = isPlayStation ? 42 : 0; auto yOffsetCmn = isPlayStation ? 42 : 0;

View file

@ -7,7 +7,6 @@
#include <gpu/video.h> #include <gpu/video.h>
#include <gpu/imgui/imgui_snapshot.h> #include <gpu/imgui/imgui_snapshot.h>
#include <hid/hid.h> #include <hid/hid.h>
#include <hid/hid_detail.h>
#include <locale/locale.h> #include <locale/locale.h>
#include <patches/aspect_ratio_patches.h> #include <patches/aspect_ratio_patches.h>
#include <ui/imgui_utils.h> #include <ui/imgui_utils.h>
@ -729,9 +728,9 @@ static void DrawDescriptionContainer()
if (g_currentPage != WizardPage::Installing && textAlpha >= 1.0) if (g_currentPage != WizardPage::Installing && textAlpha >= 1.0)
{ {
auto icon = hid::detail::IsInputDeviceController() auto icon = hid::IsInputDeviceController()
? EButtonIcon::A ? EButtonIcon::A
: hid::detail::g_inputDevice == hid::detail::EInputDevice::Keyboard : hid::g_inputDevice == hid::EInputDevice::Keyboard
? EButtonIcon::Enter ? EButtonIcon::Enter
: EButtonIcon::LMB; : EButtonIcon::LMB;

View file

@ -2,7 +2,7 @@
#include "imgui_utils.h" #include "imgui_utils.h"
#include <api/SWA.h> #include <api/SWA.h>
#include <gpu/video.h> #include <gpu/video.h>
#include <hid/hid_detail.h> #include <hid/hid.h>
#include <locale/locale.h> #include <locale/locale.h>
#include <ui/button_guide.h> #include <ui/button_guide.h>
#include <ui/sdl_listener.h> #include <ui/sdl_listener.h>
@ -257,7 +257,7 @@ static void ResetSelection()
{ {
/* Always use -1 for mouse input to prevent the selection /* Always use -1 for mouse input to prevent the selection
cursor from erroneously appearing where it shouldn't. */ cursor from erroneously appearing where it shouldn't. */
g_selectedRowIndex = hid::detail::g_inputDevice == hid::detail::EInputDevice::Mouse g_selectedRowIndex = hid::g_inputDevice == hid::EInputDevice::Mouse
? -1 ? -1
: g_defaultButtonIndex; : g_defaultButtonIndex;
@ -294,8 +294,8 @@ void MessageWindow::Draw()
auto textMarginX = Scale(37); auto textMarginX = Scale(37);
auto textMarginY = Scale(45); auto textMarginY = Scale(45);
bool isController = hid::detail::IsInputDeviceController(); bool isController = hid::IsInputDeviceController();
bool isKeyboard = hid::detail::g_inputDevice == hid::detail::EInputDevice::Keyboard; bool isKeyboard = hid::g_inputDevice == hid::EInputDevice::Keyboard;
// Handle controller input when the game is booted. // Handle controller input when the game is booted.
if (App::s_isInit) if (App::s_isInit)