Skip to content

Commit

Permalink
win fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzyhau committed Aug 10, 2023
1 parent 64d5917 commit 8df2a16
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
28 changes: 28 additions & 0 deletions src/Features/Tas/TasProtocol.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
// This *has* to come first because <winsock2> doesn't like being
// imported after <windows>. I fucking hate this platform
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <sys/socket.h>
# include <sys/select.h>
# include <arpa/inet.h>
# include <netinet/in.h>
# include <unistd.h>
#endif

#ifndef _WIN32
# define SOCKET int
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
# define closesocket close
# define WSACleanup() (void)0
#endif

#include "TasProtocol.hpp"
#include "TasPlayer.hpp"
#include "Event.hpp"
Expand All @@ -21,6 +42,13 @@ using namespace TasProtocol;

Variable sar_tas_protocol("sar_tas_protocol", "0", 0, "Enable the remote TAS controller connection protocol. Value higher than 1 replaces port to listen for connections on (6555 by default).\n");

namespace TasProtocol {
// Has to be defined here because something something MVSC suck my dick
struct ConnectionData {
SOCKET sock;
std::deque<uint8_t> cmdbuf;
};
}


static SOCKET g_listen_sock = INVALID_SOCKET;
Expand Down
26 changes: 0 additions & 26 deletions src/Features/Tas/TasProtocol.hpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
#pragma once

// This *has* to come first because <winsock2> doesn't like being
// imported after <windows>. I fucking hate this platform
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <sys/socket.h>
# include <sys/select.h>
# include <arpa/inet.h>
# include <netinet/in.h>
# include <unistd.h>
#endif

#ifndef _WIN32
# define SOCKET int
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
# define closesocket close
# define WSACleanup() (void)0
#endif

#include <string>
#include <cstdint>
#include <deque>
Expand Down Expand Up @@ -59,11 +38,6 @@ namespace TasProtocol {
SEND_GAME_LOCATION = 255
};

struct ConnectionData {
SOCKET sock;
std::deque<uint8_t> cmdbuf;
};

struct Status {
bool active;
std::string tas_path[2];
Expand Down

0 comments on commit 8df2a16

Please sign in to comment.