mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
9fdf0bbc2f
* stash * temp * tools: subtitle tool works! just gotta fill out the db / polish UX * tools: added configuration for every subtitle we have so far * tools: add some colors to the editor, time for repl controls and make it run the code! * tools: continuing polish of tool, getting very close * tools: finished UX polish, just need to write deserializers * tools: added deserializer for subtitle data * tools: exported subtitle files, all data appears intact * tools: more UX polish and test all the cutscenes, majority work * assets: update subtitle files * lint: formatting and cleanup * lint: codacy lints
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
#pragma once
|
|
|
|
/*!
|
|
* @file XSocket.h
|
|
* Cross platform socket library used for the listener.
|
|
*/
|
|
|
|
#ifdef __linux
|
|
#include <sys/socket.h>
|
|
#include <netinet/tcp.h>
|
|
#include <unistd.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#elif _WIN32
|
|
#define NOMINMAX
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <Windows.h>
|
|
#include <WinSock2.h>
|
|
#endif
|
|
|
|
#ifdef __linux
|
|
const int TCP_SOCKET_LEVEL = SOL_TCP;
|
|
#elif _WIN32
|
|
const int TCP_SOCKET_LEVEL = IPPROTO_TCP;
|
|
#endif
|
|
|
|
int open_socket(int af, int type, int protocol);
|
|
int connect_socket(int socket, sockaddr* addr, int nameLen);
|
|
#ifdef __linux
|
|
int accept_socket(int socket, sockaddr* addr, socklen_t* addrLen);
|
|
int select_and_accept_socket(int socket, sockaddr* addr, socklen_t* addrLen, int microSeconds);
|
|
#elif _WIN32
|
|
int accept_socket(int socket, sockaddr* addr, int* addrLen);
|
|
int select_and_accept_socket(int socket, sockaddr* addr, int* addrLen, int microSeconds);
|
|
#endif
|
|
void close_socket(int sock);
|
|
int set_socket_option(int socket, int level, int optname, const void* optval, int optlen);
|
|
int set_socket_timeout(int socket, long microSeconds);
|
|
int write_to_socket(int socket, const char* buf, int len);
|
|
int read_from_socket(int socket, char* buf, int len);
|
|
bool socket_timed_out();
|