summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/fs/fs_util.cpp4
-rw-r--r--src/common/fs/fs_util.h11
-rw-r--r--src/common/settings.h11
3 files changed, 23 insertions, 3 deletions
diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp
index 357cf5855..9f8671982 100644
--- a/src/common/fs/fs_util.cpp
+++ b/src/common/fs/fs_util.cpp
@@ -20,6 +20,10 @@ std::string ToUTF8String(std::u8string_view u8_string) {
20 return std::string{u8_string.begin(), u8_string.end()}; 20 return std::string{u8_string.begin(), u8_string.end()};
21} 21}
22 22
23std::string BufferToUTF8String(std::span<const u8> buffer) {
24 return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})};
25}
26
23std::string PathToUTF8String(const std::filesystem::path& path) { 27std::string PathToUTF8String(const std::filesystem::path& path) {
24 return ToUTF8String(path.u8string()); 28 return ToUTF8String(path.u8string());
25} 29}
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h
index ec9950ee7..1ec82eb35 100644
--- a/src/common/fs/fs_util.h
+++ b/src/common/fs/fs_util.h
@@ -47,6 +47,17 @@ concept IsChar = std::same_as<T, char>;
47[[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string); 47[[nodiscard]] std::string ToUTF8String(std::u8string_view u8_string);
48 48
49/** 49/**
50 * Converts a buffer of bytes to a UTF8-encoded std::string.
51 * This converts from the start of the buffer until the first encountered null-terminator.
52 * If no null-terminator is found, this converts the entire buffer instead.
53 *
54 * @param buffer Buffer of bytes
55 *
56 * @returns UTF-8 encoded std::string.
57 */
58[[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer);
59
60/**
50 * Converts a filesystem path to a UTF-8 encoded std::string. 61 * Converts a filesystem path to a UTF-8 encoded std::string.
51 * 62 *
52 * @param path Filesystem path 63 * @param path Filesystem path
diff --git a/src/common/settings.h b/src/common/settings.h
index d8730f515..cfc1ab46f 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -42,6 +42,11 @@ enum class CPUAccuracy : u32 {
42 Unsafe = 2, 42 Unsafe = 2,
43}; 43};
44 44
45enum class FullscreenMode : u32 {
46 Borderless = 0,
47 Exclusive = 1,
48};
49
45/** The BasicSetting class is a simple resource manager. It defines a label and default value 50/** The BasicSetting class is a simple resource manager. It defines a label and default value
46 * alongside the actual value of the setting for simpler and less-error prone use with frontend 51 * alongside the actual value of the setting for simpler and less-error prone use with frontend
47 * configurations. Setting a default value and label is required, though subclasses may deviate from 52 * configurations. Setting a default value and label is required, though subclasses may deviate from
@@ -322,11 +327,11 @@ struct Values {
322 Setting<u16> resolution_factor{1, "resolution_factor"}; 327 Setting<u16> resolution_factor{1, "resolution_factor"};
323 // *nix platforms may have issues with the borderless windowed fullscreen mode. 328 // *nix platforms may have issues with the borderless windowed fullscreen mode.
324 // Default to exclusive fullscreen on these platforms for now. 329 // Default to exclusive fullscreen on these platforms for now.
325 Setting<int> fullscreen_mode{ 330 Setting<FullscreenMode> fullscreen_mode{
326#ifdef _WIN32 331#ifdef _WIN32
327 0, 332 FullscreenMode::Borderless,
328#else 333#else
329 1, 334 FullscreenMode::Exclusive,
330#endif 335#endif
331 "fullscreen_mode"}; 336 "fullscreen_mode"};
332 Setting<int> aspect_ratio{0, "aspect_ratio"}; 337 Setting<int> aspect_ratio{0, "aspect_ratio"};