mirror of
https://github.com/open-goal/jak-project
synced 2026-06-27 10:52:59 -04:00
tools: Add cutscene player / subtitle editor window (#1429)
* 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
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#include "XSocketClient.h"
|
||||
|
||||
#include "common/cross_sockets/XSocket.h"
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include <WinSock2.h>
|
||||
#include <WS2tcpip.h>
|
||||
#endif
|
||||
#include "common/nrepl/ReplServer.h"
|
||||
#include "third-party/fmt/core.h"
|
||||
|
||||
XSocketClient::XSocketClient(int _tcp_port) {
|
||||
tcp_port = _tcp_port;
|
||||
}
|
||||
|
||||
XSocketClient::~XSocketClient() {
|
||||
disconnect();
|
||||
client_socket = -1;
|
||||
}
|
||||
|
||||
void XSocketClient::disconnect() {
|
||||
close_socket(client_socket);
|
||||
client_socket = -1;
|
||||
}
|
||||
|
||||
bool XSocketClient::connect() {
|
||||
// Open Socket
|
||||
client_socket = open_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (client_socket < 0) {
|
||||
// TODO - log
|
||||
disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
addr.sin_port = htons(tcp_port);
|
||||
|
||||
// Connect to server
|
||||
int result = connect_socket(client_socket, (sockaddr*)&addr, sizeof(addr));
|
||||
if (result == -1) {
|
||||
// TODO - log and close
|
||||
disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user