mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
13533bd053
* cli: add --gpu <index> to select a Vulkan physical device Select the Vulkan physical device by enumeration index, defaulting to automatic selection (-1). Invalid or out-of-range indices fall back to automatic selection with a clear message, and the selected device is logged. Co-Authored-By: Claude <noreply@anthropic.com> * cli: reject invalid --gpu index, translate comments, apply clang-format An invalid --gpu index now prints an error and exits with code 1 (usage), matching --user-id / --present-mode / --console-language. The automatic fallback is kept only for out-of-range indices detected at runtime. Comments translated to English and the touched files brought in line with clang-format (pre-commit v22.1.3). Co-Authored-By: Claude <noreply@anthropic.com> * cli: simplify Vulkan device selection --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: nmzik <Nmzik@mail.ru>
141 lines
2.7 KiB
C++
141 lines
2.7 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));
|
|
|
|
*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;
|
|
}
|
|
|
|
PresentMode GetPresentMode() {
|
|
return g_config->present_mode;
|
|
}
|
|
|
|
int32_t GetGpuIndex() {
|
|
return g_config->gpu_index;
|
|
}
|
|
|
|
bool FullscreenEnabled() {
|
|
return g_config->fullscreen_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;
|
|
}
|
|
|
|
ShaderLogDirection 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;
|
|
}
|
|
|
|
OutputDirection GetPrintfDirection() {
|
|
return g_config->printf_direction;
|
|
}
|
|
|
|
std::filesystem::path GetPrintfOutputFile() {
|
|
return g_config->printf_output_file;
|
|
}
|
|
|
|
ProfilerDirection GetProfilerDirection() {
|
|
return g_config->profiler_direction;
|
|
}
|
|
|
|
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 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
|