mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-02-16 10:40:46 +00:00
add an ugly launcher reference
idk how else to do it.
This commit is contained in:
@@ -54,8 +54,9 @@ void ClientNetwork::run() {
|
||||
} while (!*m_shutdown);
|
||||
}
|
||||
|
||||
ClientNetwork::ClientNetwork(uint16_t port)
|
||||
: m_listen_port(port) {
|
||||
ClientNetwork::ClientNetwork(Launcher& launcher, uint16_t port)
|
||||
: m_listen_port(port)
|
||||
, launcher(launcher) {
|
||||
spdlog::debug("Client network created");
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace boost::asio;
|
||||
|
||||
class ClientNetwork {
|
||||
public:
|
||||
ClientNetwork(uint16_t port);
|
||||
ClientNetwork(Launcher& launcher, uint16_t port);
|
||||
|
||||
~ClientNetwork();
|
||||
|
||||
@@ -56,4 +56,6 @@ private:
|
||||
ip::tcp::socket m_game_socket { m_io };
|
||||
Sync<bool> m_shutdown { false };
|
||||
bmp::ClientState m_client_state;
|
||||
|
||||
Launcher& launcher;
|
||||
};
|
||||
|
||||
@@ -22,11 +22,7 @@ using namespace boost::asio;
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
Launcher::Launcher()
|
||||
: m_game_socket(m_io)
|
||||
, m_core_socket(m_io)
|
||||
, m_tcp_socket(m_io)
|
||||
, m_udp_socket(m_io) {
|
||||
Launcher::Launcher() {
|
||||
spdlog::debug("Launcher startup");
|
||||
m_config = Config {};
|
||||
if (!m_config->is_valid) {
|
||||
@@ -194,7 +190,7 @@ void Launcher::pre_game() {
|
||||
|
||||
if (FileHash != LatestHash) {
|
||||
spdlog::info("Downloading BeamMP Update " + LatestHash);
|
||||
HTTP::Download(fmt::format("https://backend.beammp.com/builds/client?download=true&pk={}&branch={}", m_identity->PublicKey, m_config->branch), ZipPath.generic_string());
|
||||
HTTP::Download(fmt::format("https://backend.beammp.com/builds/client?download=true&pk={}&branch={}", identity->PublicKey, m_config->branch), ZipPath.generic_string());
|
||||
}
|
||||
|
||||
auto Target = std::filesystem::path(m_config->game_dir) / "mods/unpacked/beammp";
|
||||
|
||||
@@ -52,27 +52,11 @@ private:
|
||||
|
||||
boost::scoped_thread<> m_proxy_thread { &Launcher::proxy_main, this };
|
||||
boost::scoped_thread<> m_game_thread;
|
||||
boost::scoped_thread<> m_client_thread;
|
||||
boost::scoped_thread<> m_tcp_game_thread;
|
||||
boost::scoped_thread<> m_udp_thread;
|
||||
boost::scoped_thread<> m_ping_thread;
|
||||
boost::scoped_thread<> m_client_network_thread;
|
||||
boost::scoped_thread<> m_server_network_thread;
|
||||
|
||||
Sync<std::string> m_exe_name;
|
||||
Sync<std::filesystem::path> m_exe_path;
|
||||
boost::asio::io_context m_io {};
|
||||
boost::asio::ip::tcp::socket m_game_socket;
|
||||
boost::asio::ip::tcp::socket m_core_socket;
|
||||
boost::asio::ip::tcp::socket m_tcp_socket;
|
||||
boost::asio::ip::udp::socket m_udp_socket;
|
||||
boost::asio::ip::udp::endpoint m_udp_endpoint;
|
||||
Sync<bool> m_shutdown { false };
|
||||
Sync<std::chrono::high_resolution_clock::time_point> m_ping_start;
|
||||
Sync<std::chrono::high_resolution_clock::time_point> m_ping_end;
|
||||
|
||||
Sync<std::string> m_m_status {};
|
||||
Sync<std::string> m_ul_status {};
|
||||
|
||||
Sync<std::set<std::string>> m_conf_list;
|
||||
|
||||
Sync<std::string> m_list_of_mods {};
|
||||
};
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
ServerNetwork::ServerNetwork(const ip::tcp::endpoint& ep)
|
||||
: m_tcp_ep(ep) {
|
||||
ServerNetwork::ServerNetwork(Launcher& launcher, const ip::tcp::endpoint& ep)
|
||||
: m_tcp_ep(ep)
|
||||
, launcher(launcher) {
|
||||
spdlog::debug("Server network created");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Launcher;
|
||||
|
||||
class ServerNetwork {
|
||||
public:
|
||||
ServerNetwork(const ip::tcp::endpoint& ep);
|
||||
ServerNetwork(Launcher& launcher, const ip::tcp::endpoint& ep);
|
||||
~ServerNetwork();
|
||||
|
||||
/// Starts and runs the connection to the server.
|
||||
@@ -46,4 +46,6 @@ private:
|
||||
|
||||
ip::tcp::endpoint m_tcp_ep;
|
||||
ip::udp::endpoint m_udp_ep;
|
||||
|
||||
Launcher& launcher;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user