diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/common/announce_multiplayer_room.h | 11 | ||||
-rw-r--r-- | src/common/input.h | 5 | ||||
-rw-r--r-- | src/common/microprofile.h | 9 | ||||
-rw-r--r-- | src/common/parent_of_member.h | 2 | ||||
-rw-r--r-- | src/common/settings.cpp | 3 | ||||
-rw-r--r-- | src/common/settings.h | 3 | ||||
-rw-r--r-- | src/common/socket_types.h | 51 | ||||
-rw-r--r-- | src/common/uint128.h | 1 |
9 files changed, 68 insertions, 21 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index a6dc31b53..b1e0ba6cc 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -124,6 +124,7 @@ add_library(common STATIC settings.h settings_input.cpp settings_input.h + socket_types.h spin_lock.cpp spin_lock.h stream.cpp @@ -165,6 +166,7 @@ if(ARCHITECTURE_x86_64) x64/xbyak_abi.h x64/xbyak_util.h ) + target_link_libraries(common PRIVATE xbyak) endif() if (MSVC) @@ -188,7 +190,7 @@ endif() create_target_directory_groups(common) target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) -target_link_libraries(common PRIVATE lz4::lz4 xbyak) +target_link_libraries(common PRIVATE lz4::lz4) if (TARGET zstd::zstd) target_link_libraries(common PRIVATE zstd::zstd) else() diff --git a/src/common/announce_multiplayer_room.h b/src/common/announce_multiplayer_room.h index 0ad9da2be..4a3100fa4 100644 --- a/src/common/announce_multiplayer_room.h +++ b/src/common/announce_multiplayer_room.h @@ -8,15 +8,15 @@ #include <string> #include <vector> #include "common/common_types.h" +#include "common/socket_types.h" #include "web_service/web_result.h" namespace AnnounceMultiplayerRoom { -using MacAddress = std::array<u8, 6>; - struct GameInfo { std::string name{""}; u64 id{0}; + std::string version{""}; }; struct Member { @@ -24,7 +24,7 @@ struct Member { std::string nickname; std::string display_name; std::string avatar_url; - MacAddress mac_address; + Network::IPv4Address fake_ip; GameInfo game; }; @@ -75,10 +75,7 @@ public: const bool has_password, const GameInfo& preferred_game) = 0; /** * Adds a player information to the data that gets announced - * @param nickname The nickname of the player - * @param mac_address The MAC Address of the player - * @param game_id The title id of the game the player plays - * @param game_name The name of the game the player plays + * @param member The player to add */ virtual void AddPlayer(const Member& member) = 0; diff --git a/src/common/input.h b/src/common/input.h index 213aa2384..825b0d650 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -102,6 +102,8 @@ struct AnalogProperties { float offset{}; // Invert direction of the sensor data bool inverted{}; + // Press once to activate, press again to release + bool toggle{}; }; // Single analog sensor data @@ -115,8 +117,11 @@ struct AnalogStatus { struct ButtonStatus { Common::UUID uuid{}; bool value{}; + // Invert value of the button bool inverted{}; + // Press once to activate, press again to release bool toggle{}; + // Internal lock for the toggle status bool locked{}; }; diff --git a/src/common/microprofile.h b/src/common/microprofile.h index 91d14d5e1..56ef0a2dc 100644 --- a/src/common/microprofile.h +++ b/src/common/microprofile.h @@ -22,12 +22,3 @@ typedef void* HANDLE; #include <microprofile.h> #define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0) - -// On OS X, some Mach header included by MicroProfile defines these as macros, conflicting with -// identifiers we use. -#ifdef PAGE_SIZE -#undef PAGE_SIZE -#endif -#ifdef PAGE_MASK -#undef PAGE_MASK -#endif diff --git a/src/common/parent_of_member.h b/src/common/parent_of_member.h index 70b1c5624..8e03f17d8 100644 --- a/src/common/parent_of_member.h +++ b/src/common/parent_of_member.h @@ -11,7 +11,7 @@ namespace Common { namespace detail { template <typename T, size_t Size, size_t Align> struct TypedStorageImpl { - std::aligned_storage_t<Size, Align> storage_; + alignas(Align) u8 storage_[Size]; }; } // namespace detail diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 1c7b6dfae..0a560ebb7 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -105,7 +105,7 @@ float Volume() { if (values.audio_muted) { return 0.0f; } - return values.volume.GetValue() / 100.0f; + return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault()); } void UpdateRescalingInfo() { @@ -195,6 +195,7 @@ void RestoreGlobalState(bool is_powered_on) { values.shader_backend.SetGlobal(true); values.use_asynchronous_shaders.SetGlobal(true); values.use_fast_gpu_time.SetGlobal(true); + values.use_pessimistic_flushes.SetGlobal(true); values.bg_red.SetGlobal(true); values.bg_green.SetGlobal(true); values.bg_blue.SetGlobal(true); diff --git a/src/common/settings.h b/src/common/settings.h index 1079cf8cb..13651de57 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -374,7 +374,7 @@ struct Values { Setting<std::string> audio_output_device_id{"auto", "output_device"}; Setting<std::string> audio_input_device_id{"auto", "input_device"}; Setting<bool> audio_muted{false, "audio_muted"}; - SwitchableSetting<u8, true> volume{100, 0, 100, "volume"}; + SwitchableSetting<u8, true> volume{100, 0, 200, "volume"}; Setting<bool> dump_audio_commands{false, "dump_audio_commands"}; // Core @@ -446,6 +446,7 @@ struct Values { ShaderBackend::SPIRV, "shader_backend"}; SwitchableSetting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; SwitchableSetting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; + SwitchableSetting<bool> use_pessimistic_flushes{false, "use_pessimistic_flushes"}; SwitchableSetting<u8> bg_red{0, "bg_red"}; SwitchableSetting<u8> bg_green{0, "bg_green"}; diff --git a/src/common/socket_types.h b/src/common/socket_types.h new file mode 100644 index 000000000..0a801a443 --- /dev/null +++ b/src/common/socket_types.h @@ -0,0 +1,51 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/common_types.h" + +namespace Network { + +/// Address families +enum class Domain : u8 { + INET, ///< Address family for IPv4 +}; + +/// Socket types +enum class Type { + STREAM, + DGRAM, + RAW, + SEQPACKET, +}; + +/// Protocol values for sockets +enum class Protocol : u8 { + ICMP, + TCP, + UDP, +}; + +/// Shutdown mode +enum class ShutdownHow { + RD, + WR, + RDWR, +}; + +/// Array of IPv4 address +using IPv4Address = std::array<u8, 4>; + +/// Cross-platform sockaddr structure +struct SockAddrIn { + Domain family; + IPv4Address ip; + u16 portno; +}; + +constexpr u32 FLAG_MSG_PEEK = 0x2; +constexpr u32 FLAG_MSG_DONTWAIT = 0x80; +constexpr u32 FLAG_O_NONBLOCK = 0x800; + +} // namespace Network diff --git a/src/common/uint128.h b/src/common/uint128.h index f890ffec2..f450a6db9 100644 --- a/src/common/uint128.h +++ b/src/common/uint128.h @@ -12,7 +12,6 @@ #pragma intrinsic(_udiv128) #else #include <cstring> -#include <x86intrin.h> #endif #include "common/common_types.h" |