mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-24 19:10:20 +00:00
Declare all namespace-scope constants as inline
This is the idiomatic way since C++17
This commit is contained in:
parent
69da2df8e9
commit
a34aee68a7
@ -8,7 +8,7 @@
|
|||||||
// From https://github.com/nicolausYes/easing-functions/blob/master/src/easing.cpp
|
// From https://github.com/nicolausYes/easing-functions/blob/master/src/easing.cpp
|
||||||
|
|
||||||
namespace Easing {
|
namespace Easing {
|
||||||
static constexpr float pi = 3.1415926545f;
|
inline constexpr float pi = 3.1415926545f;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ALWAYS_INLINE_RELEASE static T InSine(T t)
|
ALWAYS_INLINE_RELEASE static T InSine(T t)
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Only currently using 128-bit vectors at max.
|
/// Only currently using 128-bit vectors at max.
|
||||||
static constexpr u32 VECTOR_ALIGNMENT = 16;
|
inline constexpr u32 VECTOR_ALIGNMENT = 16;
|
||||||
|
|
||||||
/// Aligns allocation/pitch size to preferred host size.
|
/// Aligns allocation/pitch size to preferred host size.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -444,7 +444,7 @@ ALWAYS_INLINE std::optional<std::string_view> GetNextToken(std::string_view& car
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Unicode replacement character.
|
/// Unicode replacement character.
|
||||||
static constexpr char32_t UNICODE_REPLACEMENT_CHARACTER = 0xFFFD;
|
inline constexpr char32_t UNICODE_REPLACEMENT_CHARACTER = 0xFFFD;
|
||||||
|
|
||||||
/// Appends a UTF-16/UTF-32 codepoint to a UTF-8 string.
|
/// Appends a UTF-16/UTF-32 codepoint to a UTF-8 string.
|
||||||
void EncodeAndAppendUTF8(std::string& s, char32_t ch);
|
void EncodeAndAppendUTF8(std::string& s, char32_t ch);
|
||||||
|
6
src/common/thirdparty/aes.h
vendored
6
src/common/thirdparty/aes.h
vendored
@ -13,8 +13,8 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/****************************** MACROS ******************************/
|
/****************************** MACROS ******************************/
|
||||||
static constexpr uint32_t AES_BLOCK_SIZE = 16; // AES operates on 16 bytes at a time
|
inline constexpr uint32_t AES_BLOCK_SIZE = 16; // AES operates on 16 bytes at a time
|
||||||
static constexpr uint32_t AES_KEY_SCHEDULE_SIZE = 60;
|
inline constexpr uint32_t AES_KEY_SCHEDULE_SIZE = 60;
|
||||||
|
|
||||||
/*********************** FUNCTION DECLARATIONS **********************/
|
/*********************** FUNCTION DECLARATIONS **********************/
|
||||||
///////////////////
|
///////////////////
|
||||||
@ -119,4 +119,4 @@ bool aes_decrypt_ccm(
|
|||||||
// authentication.
|
// authentication.
|
||||||
const uint8_t key[], // IN - The AES key for decryption.
|
const uint8_t key[], // IN - The AES key for decryption.
|
||||||
int keysize); // IN - The length of the key in BITS. Valid values are 128, 192, 256.
|
int keysize); // IN - The length of the key in BITS. Valid values are 128, 192, 256.
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,29 +212,29 @@ extern const u32 HOST_PAGE_MASK;
|
|||||||
extern const u32 HOST_PAGE_SHIFT;
|
extern const u32 HOST_PAGE_SHIFT;
|
||||||
#else
|
#else
|
||||||
#if defined(OVERRIDE_HOST_PAGE_SIZE)
|
#if defined(OVERRIDE_HOST_PAGE_SIZE)
|
||||||
static constexpr u32 HOST_PAGE_SIZE = OVERRIDE_HOST_PAGE_SIZE;
|
inline constexpr u32 HOST_PAGE_SIZE = OVERRIDE_HOST_PAGE_SIZE;
|
||||||
static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
||||||
static constexpr u32 HOST_PAGE_SHIFT = std::bit_width(HOST_PAGE_MASK);
|
inline constexpr u32 HOST_PAGE_SHIFT = std::bit_width(HOST_PAGE_MASK);
|
||||||
#elif defined(__APPLE__) && defined(__aarch64__)
|
#elif defined(__APPLE__) && defined(__aarch64__)
|
||||||
static constexpr u32 HOST_PAGE_SIZE = 0x4000;
|
inline constexpr u32 HOST_PAGE_SIZE = 0x4000;
|
||||||
static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
||||||
static constexpr u32 HOST_PAGE_SHIFT = 14;
|
inline constexpr u32 HOST_PAGE_SHIFT = 14;
|
||||||
#else
|
#else
|
||||||
static constexpr u32 HOST_PAGE_SIZE = 0x1000;
|
inline constexpr u32 HOST_PAGE_SIZE = 0x1000;
|
||||||
static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
inline constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
||||||
static constexpr u32 HOST_PAGE_SHIFT = 12;
|
inline constexpr u32 HOST_PAGE_SHIFT = 12;
|
||||||
#endif
|
#endif
|
||||||
static constexpr u32 MIN_HOST_PAGE_SIZE = HOST_PAGE_SIZE;
|
inline constexpr u32 MIN_HOST_PAGE_SIZE = HOST_PAGE_SIZE;
|
||||||
static constexpr u32 MAX_HOST_PAGE_SIZE = HOST_PAGE_SIZE;
|
inline constexpr u32 MAX_HOST_PAGE_SIZE = HOST_PAGE_SIZE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Host cache line sizes.
|
// Host cache line sizes.
|
||||||
#if defined(OVERRIDE_HOST_CACHE_LINE_SIZE)
|
#if defined(OVERRIDE_HOST_CACHE_LINE_SIZE)
|
||||||
static constexpr u32 HOST_CACHE_LINE_SIZE = OVERRIDE_HOST_CACHE_LINE_SIZE;
|
inline constexpr u32 HOST_CACHE_LINE_SIZE = OVERRIDE_HOST_CACHE_LINE_SIZE;
|
||||||
#elif defined(__APPLE__) && defined(__aarch64__)
|
#elif defined(__APPLE__) && defined(__aarch64__)
|
||||||
static constexpr u32 HOST_CACHE_LINE_SIZE = 128; // Apple Silicon uses 128b cache lines.
|
inline constexpr u32 HOST_CACHE_LINE_SIZE = 128; // Apple Silicon uses 128b cache lines.
|
||||||
#else
|
#else
|
||||||
static constexpr u32 HOST_CACHE_LINE_SIZE = 64; // Everything else is 64b.
|
inline constexpr u32 HOST_CACHE_LINE_SIZE = 64; // Everything else is 64b.
|
||||||
#endif
|
#endif
|
||||||
#define ALIGN_TO_CACHE_LINE alignas(HOST_CACHE_LINE_SIZE)
|
#define ALIGN_TO_CACHE_LINE alignas(HOST_CACHE_LINE_SIZE)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ enum class LoginRequestReason
|
|||||||
TokenInvalid,
|
TokenInvalid,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t GAME_HASH_LENGTH = 16;
|
inline constexpr size_t GAME_HASH_LENGTH = 16;
|
||||||
using GameHash = std::array<u8, GAME_HASH_LENGTH>;
|
using GameHash = std::array<u8, GAME_HASH_LENGTH>;
|
||||||
|
|
||||||
struct HashDatabaseEntry
|
struct HashDatabaseEntry
|
||||||
|
@ -80,7 +80,7 @@ static_assert(sizeof(PSEXEHeader) == 0x800);
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
// .cpe files
|
// .cpe files
|
||||||
static constexpr u32 CPE_MAGIC = 0x01455043;
|
inline constexpr u32 CPE_MAGIC = 0x01455043;
|
||||||
|
|
||||||
std::optional<Image> LoadImageFromFile(const char* filename, Error* error);
|
std::optional<Image> LoadImageFromFile(const char* filename, Error* error);
|
||||||
|
|
||||||
@ -105,4 +105,4 @@ std::vector<std::pair<std::string, const BIOS::ImageInfo*>> FindBIOSImagesInDire
|
|||||||
|
|
||||||
/// Returns true if any BIOS images are found in the configured BIOS directory.
|
/// Returns true if any BIOS images are found in the configured BIOS directory.
|
||||||
bool HasAnyBIOSImages();
|
bool HasAnyBIOSImages();
|
||||||
} // namespace BIOS
|
} // namespace BIOS
|
||||||
|
@ -109,7 +109,7 @@ enum : u32
|
|||||||
|
|
||||||
#ifdef ENABLE_MMAP_FASTMEM
|
#ifdef ENABLE_MMAP_FASTMEM
|
||||||
// Fastmem region size is 4GB to cover the entire 32-bit address space.
|
// Fastmem region size is 4GB to cover the entire 32-bit address space.
|
||||||
static constexpr size_t FASTMEM_ARENA_SIZE = UINT64_C(0x100000000);
|
inline constexpr size_t FASTMEM_ARENA_SIZE = UINT64_C(0x100000000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool AllocateMemory(bool export_shared_memory, Error* error);
|
bool AllocateMemory(bool export_shared_memory, Error* error);
|
||||||
|
@ -253,7 +253,7 @@ struct DebuggerRegisterListEntry
|
|||||||
u32* value_ptr;
|
u32* value_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr u32 NUM_DEBUGGER_REGISTER_LIST_ENTRIES = 103;
|
inline constexpr u32 NUM_DEBUGGER_REGISTER_LIST_ENTRIES = 103;
|
||||||
extern const std::array<DebuggerRegisterListEntry, NUM_DEBUGGER_REGISTER_LIST_ENTRIES> g_debugger_register_list;
|
extern const std::array<DebuggerRegisterListEntry, NUM_DEBUGGER_REGISTER_LIST_ENTRIES> g_debugger_register_list;
|
||||||
|
|
||||||
} // namespace CPU
|
} // namespace CPU
|
||||||
|
@ -48,9 +48,9 @@ void SetTheme();
|
|||||||
void UpdateRunIdleState();
|
void UpdateRunIdleState();
|
||||||
void UpdateTransitionState();
|
void UpdateTransitionState();
|
||||||
|
|
||||||
static constexpr float SHORT_TRANSITION_TIME = 0.08f;
|
inline constexpr float SHORT_TRANSITION_TIME = 0.08f;
|
||||||
static constexpr float DEFAULT_TRANSITION_TIME = 0.15f;
|
inline constexpr float DEFAULT_TRANSITION_TIME = 0.15f;
|
||||||
static constexpr float LONG_TRANSITION_TIME = 0.3f;
|
inline constexpr float LONG_TRANSITION_TIME = 0.3f;
|
||||||
|
|
||||||
enum class TransitionState : u8
|
enum class TransitionState : u8
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ enum class PacketType : u8
|
|||||||
Comment = 0x12,
|
Comment = 0x12,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr u32 MAX_PACKET_LENGTH = ((1u << 24) - 1); // 3 bytes for packet size
|
inline constexpr u32 MAX_PACKET_LENGTH = ((1u << 24) - 1); // 3 bytes for packet size
|
||||||
|
|
||||||
union PacketHeader
|
union PacketHeader
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@ class GPU_HW;
|
|||||||
namespace GPUTextureCache {
|
namespace GPUTextureCache {
|
||||||
|
|
||||||
/// 4 pages in C16 mode, 2+4 pages in P8 mode, 1+1 pages in P4 mode.
|
/// 4 pages in C16 mode, 2+4 pages in P8 mode, 1+1 pages in P4 mode.
|
||||||
static constexpr u32 MAX_PAGE_REFS_PER_SOURCE = 6;
|
inline constexpr u32 MAX_PAGE_REFS_PER_SOURCE = 6;
|
||||||
|
|
||||||
static constexpr u32 MAX_PAGE_REFS_PER_WRITE = 32;
|
inline constexpr u32 MAX_PAGE_REFS_PER_WRITE = 32;
|
||||||
|
|
||||||
enum class PaletteRecordFlags : u32
|
enum class PaletteRecordFlags : u32
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
namespace GPU_SW_Rasterizer {
|
namespace GPU_SW_Rasterizer {
|
||||||
|
|
||||||
// this is actually (31 * 255) >> 4) == 494, but to simplify addressing we use the next power of two (512)
|
// this is actually (31 * 255) >> 4) == 494, but to simplify addressing we use the next power of two (512)
|
||||||
static constexpr u32 DITHER_LUT_SIZE = 512;
|
inline constexpr u32 DITHER_LUT_SIZE = 512;
|
||||||
using DitherLUT = std::array<std::array<std::array<u8, DITHER_LUT_SIZE>, DITHER_MATRIX_SIZE>, DITHER_MATRIX_SIZE>;
|
using DitherLUT = std::array<std::array<std::array<u8, DITHER_LUT_SIZE>, DITHER_MATRIX_SIZE>, DITHER_MATRIX_SIZE>;
|
||||||
extern const DitherLUT g_dither_lut;
|
extern const DitherLUT g_dither_lut;
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ ALWAYS_INLINE static constexpr GSVector4i GetPaletteRect(GPUTexturePaletteReg pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4x4 dither matrix.
|
// 4x4 dither matrix.
|
||||||
static constexpr s32 DITHER_MATRIX[DITHER_MATRIX_SIZE][DITHER_MATRIX_SIZE] = {{-4, +0, -3, +1}, // row 0
|
inline constexpr s32 DITHER_MATRIX[DITHER_MATRIX_SIZE][DITHER_MATRIX_SIZE] = {{-4, +0, -3, +1}, // row 0
|
||||||
{+2, -2, +3, -1}, // row 1
|
{+2, -2, +3, -1}, // row 1
|
||||||
{-3, +1, -4, +0}, // row 2
|
{-3, +1, -4, +0}, // row 2
|
||||||
{+3, -1, +2, -2}}; // row 3
|
{+3, -1, +2, -2}}; // row 3
|
||||||
|
@ -13,7 +13,7 @@ class GPUBackend;
|
|||||||
|
|
||||||
namespace ImGuiManager {
|
namespace ImGuiManager {
|
||||||
|
|
||||||
static constexpr const char* LOGO_IMAGE_NAME = "images/duck.png";
|
inline constexpr const char* LOGO_IMAGE_NAME = "images/duck.png";
|
||||||
|
|
||||||
void UpdateInputOverlay();
|
void UpdateInputOverlay();
|
||||||
void RenderTextOverlays(const GPUBackend* gpu);
|
void RenderTextOverlays(const GPUBackend* gpu);
|
||||||
@ -30,7 +30,7 @@ void DestroyOverlayTextures();
|
|||||||
|
|
||||||
namespace SaveStateSelectorUI {
|
namespace SaveStateSelectorUI {
|
||||||
|
|
||||||
static constexpr float DEFAULT_OPEN_TIME = 7.5f;
|
inline constexpr float DEFAULT_OPEN_TIME = 7.5f;
|
||||||
|
|
||||||
bool IsOpen();
|
bool IsOpen();
|
||||||
void Open(float open_time = DEFAULT_OPEN_TIME);
|
void Open(float open_time = DEFAULT_OPEN_TIME);
|
||||||
|
@ -8,7 +8,7 @@ class StateWrapper;
|
|||||||
|
|
||||||
namespace InterruptController {
|
namespace InterruptController {
|
||||||
|
|
||||||
static constexpr u32 NUM_IRQS = 11;
|
inline constexpr u32 NUM_IRQS = 11;
|
||||||
|
|
||||||
enum class IRQ : u32
|
enum class IRQ : u32
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ class GPUBackend;
|
|||||||
|
|
||||||
namespace PerformanceCounters
|
namespace PerformanceCounters
|
||||||
{
|
{
|
||||||
static constexpr u32 NUM_FRAME_TIME_SAMPLES = 150;
|
inline constexpr u32 NUM_FRAME_TIME_SAMPLES = 150;
|
||||||
using FrameTimeHistory = std::array<float, NUM_FRAME_TIME_SAMPLES>;
|
using FrameTimeHistory = std::array<float, NUM_FRAME_TIME_SAMPLES>;
|
||||||
|
|
||||||
float GetFPS();
|
float GetFPS();
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
static constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
|
inline constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
|
||||||
static constexpr u32 SAVE_STATE_VERSION = 82;
|
inline constexpr u32 SAVE_STATE_VERSION = 82;
|
||||||
static constexpr u32 SAVE_STATE_MINIMUM_VERSION = 42;
|
inline constexpr u32 SAVE_STATE_MINIMUM_VERSION = 42;
|
||||||
|
|
||||||
static_assert(SAVE_STATE_VERSION >= SAVE_STATE_MINIMUM_VERSION);
|
static_assert(SAVE_STATE_VERSION >= SAVE_STATE_MINIMUM_VERSION);
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ struct SAVE_STATE_HEADER
|
|||||||
u32 media_path_length;
|
u32 media_path_length;
|
||||||
u32 offset_to_media_path;
|
u32 offset_to_media_path;
|
||||||
u32 media_subimage_index;
|
u32 media_subimage_index;
|
||||||
|
|
||||||
// Screenshot compression added in version 69.
|
// Screenshot compression added in version 69.
|
||||||
// Uncompressed size not stored, it can be inferred from width/height.
|
// Uncompressed size not stored, it can be inferred from width/height.
|
||||||
u32 screenshot_compression_type;
|
u32 screenshot_compression_type;
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
static constexpr u32 SHADER_CACHE_VERSION = 33;
|
inline constexpr u32 SHADER_CACHE_VERSION = 33;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@ -15,7 +14,7 @@
|
|||||||
|
|
||||||
namespace SDLKeyNames {
|
namespace SDLKeyNames {
|
||||||
|
|
||||||
static const std::map<int, const char*> s_sdl_key_names = {
|
inline const std::map<int, const char*> s_sdl_key_names = {
|
||||||
{SDLK_RETURN, "Return"},
|
{SDLK_RETURN, "Return"},
|
||||||
{SDLK_ESCAPE, "Escape"},
|
{SDLK_ESCAPE, "Escape"},
|
||||||
{SDLK_BACKSPACE, "Backspace"},
|
{SDLK_BACKSPACE, "Backspace"},
|
||||||
@ -246,13 +245,13 @@ static const std::map<int, const char*> s_sdl_key_names = {
|
|||||||
{SDLK_SLEEP, "Sleep"},
|
{SDLK_SLEEP, "Sleep"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* GetKeyName(u32 key)
|
inline const char* GetKeyName(u32 key)
|
||||||
{
|
{
|
||||||
const auto it = s_sdl_key_names.find(key);
|
const auto it = s_sdl_key_names.find(key);
|
||||||
return it == s_sdl_key_names.end() ? nullptr : it->second;
|
return it == s_sdl_key_names.end() ? nullptr : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::optional<u32> GetKeyCodeForName(const std::string_view& key_name)
|
inline std::optional<u32> GetKeyCodeForName(const std::string_view key_name)
|
||||||
{
|
{
|
||||||
for (const auto& it : s_sdl_key_names)
|
for (const auto& it : s_sdl_key_names)
|
||||||
{
|
{
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace SettingWidgetBinder {
|
namespace SettingWidgetBinder {
|
||||||
static constexpr const char* NULLABLE_PROPERTY = "SettingWidgetBinder_isNullable";
|
inline constexpr const char* NULLABLE_PROPERTY = "SettingWidgetBinder_isNullable";
|
||||||
static constexpr const char* IS_NULL_PROPERTY = "SettingWidgetBinder_isNull";
|
inline constexpr const char* IS_NULL_PROPERTY = "SettingWidgetBinder_isNull";
|
||||||
static constexpr const char* GLOBAL_VALUE_PROPERTY = "SettingWidgetBinder_globalValue";
|
inline constexpr const char* GLOBAL_VALUE_PROPERTY = "SettingWidgetBinder_globalValue";
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct SettingAccessor
|
struct SettingAccessor
|
||||||
|
@ -36,31 +36,31 @@ namespace ImGuiFullscreen {
|
|||||||
// end_ptr() for string_view
|
// end_ptr() for string_view
|
||||||
#define IMSTR_START_END(sv) (sv).data(), (sv).data() + (sv).length()
|
#define IMSTR_START_END(sv) (sv).data(), (sv).data() + (sv).length()
|
||||||
|
|
||||||
static constexpr float LAYOUT_SCREEN_WIDTH = 1280.0f;
|
inline constexpr float LAYOUT_SCREEN_WIDTH = 1280.0f;
|
||||||
static constexpr float LAYOUT_SCREEN_HEIGHT = 720.0f;
|
inline constexpr float LAYOUT_SCREEN_HEIGHT = 720.0f;
|
||||||
static constexpr float LAYOUT_LARGE_FONT_SIZE = 26.0f;
|
inline constexpr float LAYOUT_LARGE_FONT_SIZE = 26.0f;
|
||||||
static constexpr float LAYOUT_MEDIUM_FONT_SIZE = 16.0f;
|
inline constexpr float LAYOUT_MEDIUM_FONT_SIZE = 16.0f;
|
||||||
static constexpr float LAYOUT_MEDIUM_LARGE_FONT_SIZE = 21.0f;
|
inline constexpr float LAYOUT_MEDIUM_LARGE_FONT_SIZE = 21.0f;
|
||||||
static constexpr float LAYOUT_SMALL_FONT_SIZE = 10.0f;
|
inline constexpr float LAYOUT_SMALL_FONT_SIZE = 10.0f;
|
||||||
static constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f;
|
inline constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f;
|
||||||
static constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f;
|
inline constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f;
|
||||||
static constexpr float LAYOUT_MENU_BUTTON_SPACING = 6.0f;
|
inline constexpr float LAYOUT_MENU_BUTTON_SPACING = 6.0f;
|
||||||
static constexpr float LAYOUT_MENU_WINDOW_X_PADDING = 12.0f;
|
inline constexpr float LAYOUT_MENU_WINDOW_X_PADDING = 12.0f;
|
||||||
static constexpr float LAYOUT_MENU_WINDOW_Y_PADDING = 12.0f;
|
inline constexpr float LAYOUT_MENU_WINDOW_Y_PADDING = 12.0f;
|
||||||
static constexpr float LAYOUT_MENU_ITEM_TITLE_SUMMARY_SPACING = 6.0f;
|
inline constexpr float LAYOUT_MENU_ITEM_TITLE_SUMMARY_SPACING = 6.0f;
|
||||||
static constexpr float LAYOUT_MENU_ITEM_EXTRA_HEIGHT = 2.0f;
|
inline constexpr float LAYOUT_MENU_ITEM_EXTRA_HEIGHT = 2.0f;
|
||||||
static constexpr float LAYOUT_FOOTER_PADDING = 10.0f;
|
inline constexpr float LAYOUT_FOOTER_PADDING = 10.0f;
|
||||||
static constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f;
|
inline constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f;
|
||||||
static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
inline constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
||||||
static constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f;
|
inline constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f;
|
||||||
static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f;
|
inline constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f;
|
||||||
static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE = 150.0f;
|
inline constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_IMAGE_SIZE = 150.0f;
|
||||||
static constexpr float LAYOUT_SHADOW_OFFSET = 1.0f;
|
inline constexpr float LAYOUT_SHADOW_OFFSET = 1.0f;
|
||||||
static constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f;
|
inline constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f;
|
||||||
static constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f;
|
inline constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f;
|
||||||
static constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f;
|
inline constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f;
|
||||||
static constexpr float LAYOUT_WIDGET_FRAME_ROUNDING = 20.0f;
|
inline constexpr float LAYOUT_WIDGET_FRAME_ROUNDING = 20.0f;
|
||||||
static constexpr ImVec2 LAYOUT_CENTER_ALIGN_TEXT = ImVec2(0.5f, 0.0f);
|
inline constexpr ImVec2 LAYOUT_CENTER_ALIGN_TEXT = ImVec2(0.5f, 0.0f);
|
||||||
|
|
||||||
struct ALIGN_TO_CACHE_LINE UIStyles
|
struct ALIGN_TO_CACHE_LINE UIStyles
|
||||||
{
|
{
|
||||||
|
@ -71,9 +71,9 @@ using TextFontOrder = std::array<TextFont, static_cast<size_t>(TextFont::MaxCoun
|
|||||||
|
|
||||||
/// Default size for screen margins.
|
/// Default size for screen margins.
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
static constexpr float DEFAULT_SCREEN_MARGIN = 10.0f;
|
inline constexpr float DEFAULT_SCREEN_MARGIN = 10.0f;
|
||||||
#else
|
#else
|
||||||
static constexpr float DEFAULT_SCREEN_MARGIN = 16.0f;
|
inline constexpr float DEFAULT_SCREEN_MARGIN = 16.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Sets the order for text fonts.
|
/// Sets the order for text fonts.
|
||||||
@ -223,11 +223,11 @@ void ProcessAuxiliaryRenderWindowInputEvent(Host::AuxiliaryRenderWindowUserData
|
|||||||
namespace Host {
|
namespace Host {
|
||||||
|
|
||||||
/// Typical durations for OSD messages.
|
/// Typical durations for OSD messages.
|
||||||
static constexpr float OSD_CRITICAL_ERROR_DURATION = 20.0f;
|
inline constexpr float OSD_CRITICAL_ERROR_DURATION = 20.0f;
|
||||||
static constexpr float OSD_ERROR_DURATION = 15.0f;
|
inline constexpr float OSD_ERROR_DURATION = 15.0f;
|
||||||
static constexpr float OSD_WARNING_DURATION = 10.0f;
|
inline constexpr float OSD_WARNING_DURATION = 10.0f;
|
||||||
static constexpr float OSD_INFO_DURATION = 5.0f;
|
inline constexpr float OSD_INFO_DURATION = 5.0f;
|
||||||
static constexpr float OSD_QUICK_DURATION = 2.5f;
|
inline constexpr float OSD_QUICK_DURATION = 2.5f;
|
||||||
|
|
||||||
/// Adds OSD messages, duration is in seconds.
|
/// Adds OSD messages, duration is in seconds.
|
||||||
void AddOSDMessage(std::string message, float duration = 2.0f);
|
void AddOSDMessage(std::string message, float duration = 2.0f);
|
||||||
|
@ -191,24 +191,24 @@ public:
|
|||||||
namespace InputManager {
|
namespace InputManager {
|
||||||
|
|
||||||
/// Maximum number of buttons that can be part of a chord.
|
/// Maximum number of buttons that can be part of a chord.
|
||||||
static constexpr u32 MAX_KEYS_PER_BINDING = 4;
|
inline constexpr u32 MAX_KEYS_PER_BINDING = 4;
|
||||||
|
|
||||||
/// Maximum number of output vibration motors per pad.
|
/// Maximum number of output vibration motors per pad.
|
||||||
static constexpr u32 MAX_MOTORS_PER_PAD = 2;
|
inline constexpr u32 MAX_MOTORS_PER_PAD = 2;
|
||||||
|
|
||||||
/// Minimum interval between vibration updates when the effect is continuous.
|
/// Minimum interval between vibration updates when the effect is continuous.
|
||||||
static constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms
|
inline constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms
|
||||||
|
|
||||||
/// Maximum number of host mouse devices.
|
/// Maximum number of host mouse devices.
|
||||||
static constexpr u32 MAX_POINTER_DEVICES = 8;
|
inline constexpr u32 MAX_POINTER_DEVICES = 8;
|
||||||
static constexpr u32 MAX_POINTER_BUTTONS = 3;
|
inline constexpr u32 MAX_POINTER_BUTTONS = 3;
|
||||||
|
|
||||||
/// Maximum number of software cursors. We allocate an extra two for controllers with
|
/// Maximum number of software cursors. We allocate an extra two for controllers with
|
||||||
/// positioning data from the controller instead of a mouse.
|
/// positioning data from the controller instead of a mouse.
|
||||||
static constexpr u32 MAX_SOFTWARE_CURSORS = MAX_POINTER_DEVICES + 2;
|
inline constexpr u32 MAX_SOFTWARE_CURSORS = MAX_POINTER_DEVICES + 2;
|
||||||
|
|
||||||
/// Number of macro buttons per controller.
|
/// Number of macro buttons per controller.
|
||||||
static constexpr u32 NUM_MACRO_BUTTONS_PER_CONTROLLER = 4;
|
inline constexpr u32 NUM_MACRO_BUTTONS_PER_CONTROLLER = 4;
|
||||||
|
|
||||||
/// Returns a pointer to the external input source class, if present.
|
/// Returns a pointer to the external input source class, if present.
|
||||||
InputSource* GetInputSourceInterface(InputSourceType type);
|
InputSource* GetInputSourceInterface(InputSourceType type);
|
||||||
|
@ -93,8 +93,8 @@ struct ShaderOption
|
|||||||
};
|
};
|
||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
static constexpr const char* DISPLAY_CHAIN_SECTION = "PostProcessing";
|
inline constexpr const char* DISPLAY_CHAIN_SECTION = "PostProcessing";
|
||||||
static constexpr const char* INTERNAL_CHAIN_SECTION = "InternalPostProcessing";
|
inline constexpr const char* INTERNAL_CHAIN_SECTION = "InternalPostProcessing";
|
||||||
|
|
||||||
bool IsEnabled(const SettingsInterface& si, const char* section);
|
bool IsEnabled(const SettingsInterface& si, const char* section);
|
||||||
u32 GetStageCount(const SettingsInterface& si, const char* section);
|
u32 GetStageCount(const SettingsInterface& si, const char* section);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user