BBA/HLE: Make network_ref into a class

This commit is contained in:
Sepalani 2024-02-03 11:18:40 +04:00
parent d3073353a7
commit e915f990bb
2 changed files with 19 additions and 2 deletions

View File

@ -92,3 +92,21 @@ struct StackRef
BbaTcpSocket tcp_socket; BbaTcpSocket tcp_socket;
u64 poke_time; u64 poke_time;
}; };
// Max 10 at same time, I think most gc game had a
// limit of 8 in the GC framework
using StackRefs = std::array<StackRef, 10>;
class NetworkRef
{
public:
StackRefs& data() { return m_stacks; }
const StackRefs& data() const { return m_stacks; }
auto begin() { return m_stacks.begin(); }
auto begin() const { return m_stacks.cbegin(); }
auto end() { return m_stacks.end(); }
auto end() const { return m_stacks.cend(); }
private:
StackRefs m_stacks;
};

View File

@ -456,8 +456,7 @@ private:
sf::TcpListener m_upnp_httpd; sf::TcpListener m_upnp_httpd;
#if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ #if defined(WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
std::array<StackRef, 10> network_ref{}; // max 10 at same time, i think most gc game had a NetworkRef network_ref;
// limit of 8 in the gc framework
std::thread m_read_thread; std::thread m_read_thread;
Common::Flag m_read_enabled; Common::Flag m_read_enabled;
Common::Flag m_read_thread_shutdown; Common::Flag m_read_thread_shutdown;