mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
feeced81d2
* window: auto-hide the cursor over the game window Hide the cursor when the game window is created and whenever the mouse has been idle for two seconds; any mouse motion, button or wheel event shows it again. Games that draw their own cursor (e.g. Blue Prince) no longer show the host pointer on top of it. Only real mouse input counts as activity: synthetic touch/pen mouse events and zero-delta motion (sent by some platforms on focus or cursor visibility changes) are ignored. The event loop only waits with a timeout while the cursor is visible, so it still blocks indefinitely once the cursor is hidden. The cursor is restored on shutdown. Uses SDL_HideCursor/SDL_ShowCursor, which SDL implements for X11, Wayland, Cocoa and Win32 and which only affect the cursor over the emulator window. Closes #282 * window: make cursor auto-hide optional in CLI and launcher Co-authored-by: Anatolii Kucheruk <anatolii.kucheruk01@gmail.com> --------- Co-authored-by: nmzik <Nmzik@mail.ru> Co-authored-by: Anatolii Kucheruk <anatolii.kucheruk01@gmail.com>
174 lines
3.3 KiB
C++
174 lines
3.3 KiB
C++
#include "common/emulatorConfig.h"
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include <algorithm>
|
|
#include <memory>
|
|
|
|
namespace Config {
|
|
|
|
static std::unique_ptr<ConfigOptions> g_config;
|
|
|
|
void Initialize() {
|
|
EXIT_IF(g_config != nullptr);
|
|
|
|
g_config = std::make_unique<ConfigOptions>();
|
|
}
|
|
|
|
void Shutdown() {
|
|
g_config.reset();
|
|
}
|
|
|
|
void Load(const ConfigOptions& cfg) {
|
|
EXIT_IF(g_config == nullptr);
|
|
EXIT_IF(cfg.user_name.empty() || cfg.user_name.size() > MAX_USER_NAME_LENGTH);
|
|
EXIT_IF(!IsConfiguredUserIdValid(cfg.user_id));
|
|
EXIT_IF(cfg.controller_speaker_volume > 100 || cfg.controller_vibration_intensity > 100);
|
|
|
|
*g_config = cfg;
|
|
}
|
|
|
|
uint32_t GetScreenWidth() {
|
|
return g_config->screen_width;
|
|
}
|
|
|
|
uint32_t GetScreenHeight() {
|
|
return g_config->screen_height;
|
|
}
|
|
|
|
const std::string& GetUserName() {
|
|
return g_config->user_name;
|
|
}
|
|
|
|
int32_t GetUserId() {
|
|
return g_config->user_id;
|
|
}
|
|
|
|
const std::string& GetAudioInputDevice() {
|
|
return g_config->audio_input_device;
|
|
}
|
|
|
|
const std::optional<ControllerColor>& GetControllerColor() {
|
|
return g_config->controller_color;
|
|
}
|
|
|
|
uint32_t GetControllerSpeakerVolume() {
|
|
return g_config->controller_speaker_volume;
|
|
}
|
|
|
|
uint32_t GetControllerVibrationIntensity() {
|
|
return g_config->controller_vibration_intensity;
|
|
}
|
|
|
|
PresentMode GetPresentMode() {
|
|
return g_config->present_mode;
|
|
}
|
|
|
|
int32_t GetGpuIndex() {
|
|
return g_config->gpu_index;
|
|
}
|
|
|
|
bool FullscreenEnabled() {
|
|
return g_config->fullscreen_enabled;
|
|
}
|
|
|
|
bool HideCursorEnabled() {
|
|
return g_config->hide_cursor_enabled;
|
|
}
|
|
|
|
bool VrEnabled() {
|
|
return g_config->vr_enabled;
|
|
}
|
|
|
|
bool AmdCpuEnabled() {
|
|
return g_config->amd_cpu_enabled;
|
|
}
|
|
|
|
uint32_t GetVblankFrequency() {
|
|
return std::clamp(g_config->vblank_frequency, 30u, 360u);
|
|
}
|
|
|
|
uint32_t GetConsoleLanguage() {
|
|
return g_config->console_language;
|
|
}
|
|
|
|
bool VulkanValidationEnabled() {
|
|
return g_config->vulkan_validation_enabled;
|
|
}
|
|
|
|
bool ShaderValidationEnabled() {
|
|
return g_config->shader_validation_enabled;
|
|
}
|
|
|
|
ShaderOptimizationType GetShaderOptimizationType() {
|
|
return g_config->shader_optimization_type;
|
|
}
|
|
|
|
LogDirection GetShaderLogDirection() {
|
|
return g_config->shader_log_direction;
|
|
}
|
|
|
|
std::filesystem::path GetShaderLogFolder() {
|
|
return g_config->shader_log_folder;
|
|
}
|
|
|
|
bool CommandBufferDumpEnabled() {
|
|
return g_config->command_buffer_dump_enabled;
|
|
}
|
|
|
|
std::filesystem::path GetCommandBufferDumpFolder() {
|
|
return g_config->command_buffer_dump_folder;
|
|
}
|
|
|
|
bool GraphicsDebugDumpEnabled() {
|
|
return g_config->graphics_debug_dump_enabled;
|
|
}
|
|
|
|
LogDirection GetPrintfDirection() {
|
|
return g_config->printf_direction;
|
|
}
|
|
|
|
std::filesystem::path GetPrintfOutputFile() {
|
|
return g_config->printf_output_file;
|
|
}
|
|
|
|
bool ProfilerEnabled() {
|
|
return g_config->profiler_enabled;
|
|
}
|
|
|
|
bool SpirvDebugPrintfEnabled() {
|
|
return g_config->spirv_debug_printf_enabled;
|
|
}
|
|
|
|
bool GpuAssistedValidationEnabled() {
|
|
return g_config->gpu_assisted_validation_enabled && g_config->vulkan_validation_enabled;
|
|
}
|
|
|
|
bool RenderDocEnabled() {
|
|
return g_config->renderdoc_enabled;
|
|
}
|
|
|
|
bool ReadbackLinearImagesEnabled() {
|
|
return g_config->readback_linear_images;
|
|
}
|
|
|
|
bool TessellationEnabled() {
|
|
return g_config->tessellation_enabled;
|
|
}
|
|
|
|
bool PlayGoHackEnabled() {
|
|
return g_config->playgo_hack_enabled;
|
|
}
|
|
|
|
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
|
bool RedZoneProtectionEnabled() {
|
|
return g_config->red_zone_protection_enabled;
|
|
}
|
|
#endif
|
|
|
|
const Keymap& GetKeymap() {
|
|
return g_config->keymap;
|
|
}
|
|
|
|
} // namespace Config
|