diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/announce_multiplayer_room.h | 10 | ||||
| -rw-r--r-- | src/common/microprofile.h | 9 | ||||
| -rw-r--r-- | src/common/settings.cpp | 2 | ||||
| -rw-r--r-- | src/common/settings.h | 2 | ||||
| -rw-r--r-- | src/common/socket_types.h | 51 | ||||
| -rw-r--r-- | src/common/uint128.h | 1 |
7 files changed, 57 insertions, 19 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index a6dc31b53..635fb85c8 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -124,6 +124,7 @@ add_library(common STATIC | |||
| 124 | settings.h | 124 | settings.h |
| 125 | settings_input.cpp | 125 | settings_input.cpp |
| 126 | settings_input.h | 126 | settings_input.h |
| 127 | socket_types.h | ||
| 127 | spin_lock.cpp | 128 | spin_lock.cpp |
| 128 | spin_lock.h | 129 | spin_lock.h |
| 129 | stream.cpp | 130 | stream.cpp |
diff --git a/src/common/announce_multiplayer_room.h b/src/common/announce_multiplayer_room.h index 0ad9da2be..cb004e0eb 100644 --- a/src/common/announce_multiplayer_room.h +++ b/src/common/announce_multiplayer_room.h | |||
| @@ -8,12 +8,11 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/socket_types.h" | ||
| 11 | #include "web_service/web_result.h" | 12 | #include "web_service/web_result.h" |
| 12 | 13 | ||
| 13 | namespace AnnounceMultiplayerRoom { | 14 | namespace AnnounceMultiplayerRoom { |
| 14 | 15 | ||
| 15 | using MacAddress = std::array<u8, 6>; | ||
| 16 | |||
| 17 | struct GameInfo { | 16 | struct GameInfo { |
| 18 | std::string name{""}; | 17 | std::string name{""}; |
| 19 | u64 id{0}; | 18 | u64 id{0}; |
| @@ -24,7 +23,7 @@ struct Member { | |||
| 24 | std::string nickname; | 23 | std::string nickname; |
| 25 | std::string display_name; | 24 | std::string display_name; |
| 26 | std::string avatar_url; | 25 | std::string avatar_url; |
| 27 | MacAddress mac_address; | 26 | Network::IPv4Address fake_ip; |
| 28 | GameInfo game; | 27 | GameInfo game; |
| 29 | }; | 28 | }; |
| 30 | 29 | ||
| @@ -75,10 +74,7 @@ public: | |||
| 75 | const bool has_password, const GameInfo& preferred_game) = 0; | 74 | const bool has_password, const GameInfo& preferred_game) = 0; |
| 76 | /** | 75 | /** |
| 77 | * Adds a player information to the data that gets announced | 76 | * Adds a player information to the data that gets announced |
| 78 | * @param nickname The nickname of the player | 77 | * @param member The player to add |
| 79 | * @param mac_address The MAC Address of the player | ||
| 80 | * @param game_id The title id of the game the player plays | ||
| 81 | * @param game_name The name of the game the player plays | ||
| 82 | */ | 78 | */ |
| 83 | virtual void AddPlayer(const Member& member) = 0; | 79 | virtual void AddPlayer(const Member& member) = 0; |
| 84 | 80 | ||
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; | |||
| 22 | #include <microprofile.h> | 22 | #include <microprofile.h> |
| 23 | 23 | ||
| 24 | #define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0) | 24 | #define MP_RGB(r, g, b) ((r) << 16 | (g) << 8 | (b) << 0) |
| 25 | |||
| 26 | // On OS X, some Mach header included by MicroProfile defines these as macros, conflicting with | ||
| 27 | // identifiers we use. | ||
| 28 | #ifdef PAGE_SIZE | ||
| 29 | #undef PAGE_SIZE | ||
| 30 | #endif | ||
| 31 | #ifdef PAGE_MASK | ||
| 32 | #undef PAGE_MASK | ||
| 33 | #endif | ||
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 1c7b6dfae..7282a45d3 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -105,7 +105,7 @@ float Volume() { | |||
| 105 | if (values.audio_muted) { | 105 | if (values.audio_muted) { |
| 106 | return 0.0f; | 106 | return 0.0f; |
| 107 | } | 107 | } |
| 108 | return values.volume.GetValue() / 100.0f; | 108 | return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault()); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | void UpdateRescalingInfo() { | 111 | void UpdateRescalingInfo() { |
diff --git a/src/common/settings.h b/src/common/settings.h index 1079cf8cb..14ed9b237 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -374,7 +374,7 @@ struct Values { | |||
| 374 | Setting<std::string> audio_output_device_id{"auto", "output_device"}; | 374 | Setting<std::string> audio_output_device_id{"auto", "output_device"}; |
| 375 | Setting<std::string> audio_input_device_id{"auto", "input_device"}; | 375 | Setting<std::string> audio_input_device_id{"auto", "input_device"}; |
| 376 | Setting<bool> audio_muted{false, "audio_muted"}; | 376 | Setting<bool> audio_muted{false, "audio_muted"}; |
| 377 | SwitchableSetting<u8, true> volume{100, 0, 100, "volume"}; | 377 | SwitchableSetting<u8, true> volume{100, 0, 200, "volume"}; |
| 378 | Setting<bool> dump_audio_commands{false, "dump_audio_commands"}; | 378 | Setting<bool> dump_audio_commands{false, "dump_audio_commands"}; |
| 379 | 379 | ||
| 380 | // Core | 380 | // Core |
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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "common/common_types.h" | ||
| 7 | |||
| 8 | namespace Network { | ||
| 9 | |||
| 10 | /// Address families | ||
| 11 | enum class Domain : u8 { | ||
| 12 | INET, ///< Address family for IPv4 | ||
| 13 | }; | ||
| 14 | |||
| 15 | /// Socket types | ||
| 16 | enum class Type { | ||
| 17 | STREAM, | ||
| 18 | DGRAM, | ||
| 19 | RAW, | ||
| 20 | SEQPACKET, | ||
| 21 | }; | ||
| 22 | |||
| 23 | /// Protocol values for sockets | ||
| 24 | enum class Protocol : u8 { | ||
| 25 | ICMP, | ||
| 26 | TCP, | ||
| 27 | UDP, | ||
| 28 | }; | ||
| 29 | |||
| 30 | /// Shutdown mode | ||
| 31 | enum class ShutdownHow { | ||
| 32 | RD, | ||
| 33 | WR, | ||
| 34 | RDWR, | ||
| 35 | }; | ||
| 36 | |||
| 37 | /// Array of IPv4 address | ||
| 38 | using IPv4Address = std::array<u8, 4>; | ||
| 39 | |||
| 40 | /// Cross-platform sockaddr structure | ||
| 41 | struct SockAddrIn { | ||
| 42 | Domain family; | ||
| 43 | IPv4Address ip; | ||
| 44 | u16 portno; | ||
| 45 | }; | ||
| 46 | |||
| 47 | constexpr u32 FLAG_MSG_PEEK = 0x2; | ||
| 48 | constexpr u32 FLAG_MSG_DONTWAIT = 0x80; | ||
| 49 | constexpr u32 FLAG_O_NONBLOCK = 0x800; | ||
| 50 | |||
| 51 | } // 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 @@ | |||
| 12 | #pragma intrinsic(_udiv128) | 12 | #pragma intrinsic(_udiv128) |
| 13 | #else | 13 | #else |
| 14 | #include <cstring> | 14 | #include <cstring> |
| 15 | #include <x86intrin.h> | ||
| 16 | #endif | 15 | #endif |
| 17 | 16 | ||
| 18 | #include "common/common_types.h" | 17 | #include "common/common_types.h" |