mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 08:13:05 +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>
177 lines
6.7 KiB
C++
177 lines
6.7 KiB
C++
#ifndef KYTY_COMMON_EMULATOR_CONFIG_H_
|
|
#define KYTY_COMMON_EMULATOR_CONFIG_H_
|
|
|
|
#include "common/common.h"
|
|
|
|
#include <cstddef>
|
|
#include <array>
|
|
#include <filesystem>
|
|
#include <limits>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace Config {
|
|
|
|
void Initialize();
|
|
void Shutdown();
|
|
|
|
struct Lifecycle {
|
|
static constexpr const char* name = "Config";
|
|
static constexpr auto initialize = Config::Initialize;
|
|
static constexpr auto shutdown = Config::Shutdown;
|
|
};
|
|
|
|
enum class ShaderOptimizationType { None, Size, Performance };
|
|
|
|
enum class LogDirection { Silent, Console, File };
|
|
|
|
enum class PresentMode { Fifo, Mailbox, Immediate };
|
|
|
|
using Keymap = std::vector<std::string>;
|
|
using ControllerColor = std::array<uint8_t, 3>;
|
|
|
|
constexpr uint32_t DEFAULT_CONSOLE_LANGUAGE = 1;
|
|
constexpr uint32_t MAX_CONSOLE_LANGUAGE = 29;
|
|
constexpr std::size_t MAX_USER_NAME_LENGTH = 16;
|
|
constexpr int32_t DEFAULT_USER_ID = 1000;
|
|
|
|
constexpr int MAX_PLAYERS = 4;
|
|
constexpr int32_t PLAYER_USER_ID_STEP = 0x100;
|
|
constexpr int32_t MAX_USER_ID =
|
|
std::numeric_limits<int32_t>::max() - (MAX_PLAYERS - 1) * PLAYER_USER_ID_STEP;
|
|
|
|
constexpr bool IsConfiguredUserIdValid(int32_t user_id) {
|
|
constexpr int32_t USER_ID_EVERYONE = 0xfe;
|
|
constexpr int32_t USER_ID_SYSTEM = 0xff;
|
|
return user_id >= 0 && user_id <= MAX_USER_ID && user_id != USER_ID_EVERYONE &&
|
|
user_id != USER_ID_SYSTEM;
|
|
}
|
|
|
|
struct ConfigOptions {
|
|
uint32_t screen_width = 1280;
|
|
uint32_t screen_height = 720;
|
|
std::string user_name = "Kyty";
|
|
int32_t user_id = DEFAULT_USER_ID;
|
|
std::string audio_input_device;
|
|
std::optional<ControllerColor> controller_color;
|
|
uint32_t controller_speaker_volume = 50;
|
|
uint32_t controller_vibration_intensity = 100;
|
|
// 0 shares player 1 with the first gamepad; 1..MAX_PLAYERS dedicates that player to the keyboard.
|
|
uint32_t keyboard_player = 0;
|
|
PresentMode present_mode = PresentMode::Mailbox;
|
|
int32_t gpu_index = -1;
|
|
bool fullscreen_enabled = false;
|
|
bool hdr_enabled = false;
|
|
bool hide_cursor_enabled = false;
|
|
bool stretch_enabled = false;
|
|
bool splash_enabled = true;
|
|
bool vr_enabled = false;
|
|
bool amd_cpu_enabled = false;
|
|
bool network_connected = false;
|
|
uint32_t vblank_frequency = 60;
|
|
uint32_t console_language = DEFAULT_CONSOLE_LANGUAGE;
|
|
bool vulkan_validation_enabled = false;
|
|
bool shader_validation_enabled = false;
|
|
bool shader_cache_enabled = false;
|
|
ShaderOptimizationType shader_optimization_type = ShaderOptimizationType::None;
|
|
LogDirection shader_log_direction = LogDirection::Silent;
|
|
std::filesystem::path shader_log_folder = "_Shaders";
|
|
bool command_buffer_dump_enabled = false;
|
|
std::filesystem::path command_buffer_dump_folder = "_Buffers";
|
|
bool graphics_debug_dump_enabled = false;
|
|
LogDirection printf_direction = LogDirection::Silent;
|
|
std::filesystem::path printf_output_file = "_kyty.txt";
|
|
bool profiler_enabled = false;
|
|
bool spirv_debug_printf_enabled = false;
|
|
bool gpu_assisted_validation_enabled = false;
|
|
bool renderdoc_enabled = false;
|
|
bool readback_linear_images = false;
|
|
bool readback_tiled_images = false;
|
|
bool sync_raw_image_buffers = false;
|
|
bool tessellation_enabled = false;
|
|
bool occlusion_queries_enabled = false;
|
|
bool trophy_enabled = true;
|
|
uint32_t trophy_duration_seconds = 6;
|
|
bool perf_overlay_enabled = false;
|
|
bool playgo_hack_enabled = false;
|
|
bool skip_notice_screen = false;
|
|
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
|
bool red_zone_protection_enabled = false;
|
|
#endif
|
|
Keymap keymap;
|
|
// Ordinary boots need a non-null argv[0]; --guest-exec supplies the caller's arguments.
|
|
std::vector<std::string> guest_arguments {""};
|
|
};
|
|
|
|
void Load(const ConfigOptions& cfg);
|
|
|
|
uint32_t GetScreenWidth();
|
|
uint32_t GetScreenHeight();
|
|
const std::string& GetUserName();
|
|
int32_t GetUserId();
|
|
const std::string& GetAudioInputDevice();
|
|
const std::optional<ControllerColor>& GetControllerColor();
|
|
uint32_t GetControllerSpeakerVolume();
|
|
uint32_t GetControllerVibrationIntensity();
|
|
uint32_t GetKeyboardPlayer();
|
|
// Player 0 is the configured user; later players derive their IDs from it.
|
|
int32_t GetPlayerUserId(int player);
|
|
// Returns -1 when the user ID does not belong to any player.
|
|
int GetPlayerFromUserId(int32_t user_id);
|
|
// Players after the first are guests: they have no profile, trophies or NP account.
|
|
bool IsGuestUserId(int32_t user_id);
|
|
PresentMode GetPresentMode();
|
|
int32_t GetGpuIndex();
|
|
bool FullscreenEnabled();
|
|
bool HdrEnabled();
|
|
bool HideCursorEnabled();
|
|
bool StretchEnabled();
|
|
bool VrEnabled();
|
|
bool AmdCpuEnabled();
|
|
bool IsNetworkConnected();
|
|
uint32_t GetVblankFrequency();
|
|
uint32_t GetConsoleLanguage();
|
|
bool VulkanValidationEnabled();
|
|
|
|
bool ShaderValidationEnabled();
|
|
bool ShaderCacheEnabled();
|
|
ShaderOptimizationType GetShaderOptimizationType();
|
|
LogDirection GetShaderLogDirection();
|
|
std::filesystem::path GetShaderLogFolder();
|
|
|
|
bool CommandBufferDumpEnabled();
|
|
std::filesystem::path GetCommandBufferDumpFolder();
|
|
|
|
bool GraphicsDebugDumpEnabled();
|
|
|
|
LogDirection GetPrintfDirection();
|
|
std::filesystem::path GetPrintfOutputFile();
|
|
|
|
bool ProfilerEnabled();
|
|
|
|
bool SpirvDebugPrintfEnabled();
|
|
|
|
bool GpuAssistedValidationEnabled();
|
|
|
|
bool RenderDocEnabled();
|
|
bool ReadbackLinearImagesEnabled();
|
|
bool ReadbackTiledImagesEnabled();
|
|
bool SyncRawImageBuffersEnabled();
|
|
bool TessellationEnabled();
|
|
bool OcclusionQueriesEnabled();
|
|
bool TrophyEnabled();
|
|
uint32_t GetTrophyDurationSeconds();
|
|
bool PlayGoHackEnabled();
|
|
bool SkipNoticeScreen();
|
|
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
|
bool RedZoneProtectionEnabled();
|
|
#endif
|
|
|
|
const Keymap& GetKeymap();
|
|
const std::vector<std::string>& GetGuestArguments();
|
|
|
|
} // namespace Config
|
|
|
|
#endif /* KYTY_COMMON_EMULATOR_CONFIG_H_ */
|