early-access version 2906

This commit is contained in:
pineappleEA
2022-08-16 22:55:47 +02:00
parent b9013ce839
commit 443f6fe526
38 changed files with 1471 additions and 551 deletions

View File

@@ -128,6 +128,7 @@ add_library(common STATIC
settings.h
settings_input.cpp
settings_input.h
socket_types.h
spin_lock.cpp
spin_lock.h
stream.cpp

View File

@@ -8,12 +8,11 @@
#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};
@@ -24,7 +23,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 +74,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;

51
src/common/socket_types.h Executable file
View File

@@ -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