mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 00:12:40 +00:00
* launcher: add minimize and maximize buttons to the main window
The main window is a QDialog, which on Windows only gets a close button.
* graphics: keep the game's aspect ratio when presenting to the window
The guest frame was blitted across the whole swapchain image, so a window
or fullscreen display whose shape differs from the frame stretched the
picture. Fit the frame inside the window instead and clear the remaining
bars to black. The video-out overlay layer is drawn into the same
rectangle so it stays aligned with the frame underneath.
* launcher: accept custom screen resolutions such as 21:9
The resolution was a fixed enum of four 16:9 sizes. Make the combo box
editable so any WIDTHxHEIGHT between 320 and 16384 can be entered, and
add ultrawide presets (2560x1080, 3440x1440, 3840x1600, 5120x2160).
Settings saved by older launchers stored the enum key ("R1920X1080");
NormalizeResolution still accepts that form, so they load unchanged.
* launcher: add a Stretch to window option
Presentation now keeps the game's aspect ratio with black bars. Add
--stretch to fill the whole window as before, exposed in the launcher as
a "Stretch to window" checkbox under General, off by default.
* launcher: make the settings dialog resizable and its tabs scrollable
The dialog had no maximize button and pinned its minimum width to its
initial 900 px, and without scroll areas it could not be made shorter
than its content. Add a maximize button (not minimize, since the dialog
is modal), drop the width pin, and wrap each tab page in a frameless
scroll area.
With the scroll areas the layout's minimum size no longer forces the
dialog open, so size it explicitly: grow it to fit the largest tab,
capped at the available screen, when there is no saved geometry and
whenever the global settings add the game folders panel.
* launcher: simplify display options and preserve saved settings
---------
Co-authored-by: nmzik <Nmzik@mail.ru>
243 lines
4.8 KiB
C++
243 lines
4.8 KiB
C++
#include "common/emulatorConfig.h"
|
|
|
|
#include "common/assert.h"
|
|
#include "common/debugCounters.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() {
|
|
Common::DebugCounters::SetEnabled(false);
|
|
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);
|
|
EXIT_IF(cfg.keyboard_player > static_cast<uint32_t>(MAX_PLAYERS));
|
|
|
|
*g_config = cfg;
|
|
Common::DebugCounters::SetEnabled(cfg.perf_overlay_enabled);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
uint32_t GetKeyboardPlayer() {
|
|
return g_config->keyboard_player;
|
|
}
|
|
|
|
int32_t GetPlayerUserId(int player) {
|
|
return g_config->user_id + player * PLAYER_USER_ID_STEP;
|
|
}
|
|
|
|
int GetPlayerFromUserId(int32_t user_id) {
|
|
for (int player = 0; player < MAX_PLAYERS; player++) {
|
|
if (user_id == GetPlayerUserId(player)) {
|
|
return player;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
bool IsGuestUserId(int32_t user_id) {
|
|
return GetPlayerFromUserId(user_id) > 0;
|
|
}
|
|
|
|
PresentMode GetPresentMode() {
|
|
return g_config->present_mode;
|
|
}
|
|
|
|
int32_t GetGpuIndex() {
|
|
return g_config->gpu_index;
|
|
}
|
|
|
|
bool FullscreenEnabled() {
|
|
return g_config->fullscreen_enabled;
|
|
}
|
|
|
|
bool HdrEnabled() {
|
|
return g_config->hdr_enabled;
|
|
}
|
|
|
|
bool HideCursorEnabled() {
|
|
return g_config->hide_cursor_enabled;
|
|
}
|
|
|
|
bool StretchEnabled() {
|
|
return g_config->stretch_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 IsNetworkConnected() {
|
|
return g_config->network_connected;
|
|
}
|
|
|
|
bool ShaderValidationEnabled() {
|
|
return g_config->shader_validation_enabled;
|
|
}
|
|
|
|
bool ShaderCacheEnabled() {
|
|
return g_config->shader_cache_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 ReadbackTiledImagesEnabled() {
|
|
return g_config->readback_tiled_images;
|
|
}
|
|
|
|
bool SyncRawImageBuffersEnabled() {
|
|
return g_config->sync_raw_image_buffers;
|
|
}
|
|
|
|
bool TessellationEnabled() {
|
|
return g_config->tessellation_enabled;
|
|
}
|
|
|
|
bool OcclusionQueriesEnabled() {
|
|
return g_config->occlusion_queries_enabled;
|
|
}
|
|
|
|
bool TrophyEnabled() {
|
|
return g_config->trophy_enabled;
|
|
}
|
|
|
|
uint32_t GetTrophyDurationSeconds() {
|
|
return std::clamp(g_config->trophy_duration_seconds, 5u, 10u);
|
|
}
|
|
|
|
bool PlayGoHackEnabled() {
|
|
return g_config->playgo_hack_enabled;
|
|
}
|
|
|
|
bool SkipNoticeScreen() {
|
|
return g_config->skip_notice_screen;
|
|
}
|
|
|
|
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
|
bool RedZoneProtectionEnabled() {
|
|
return g_config->red_zone_protection_enabled;
|
|
}
|
|
#endif
|
|
|
|
const Keymap& GetKeymap() {
|
|
return g_config->keymap;
|
|
}
|
|
|
|
const std::vector<std::string>& GetGuestArguments() {
|
|
return g_config->guest_arguments;
|
|
}
|
|
|
|
} // namespace Config
|