Files
jak-project/common/nrepl/ReplClient.cpp
T
Tyler Wilding 9fdf0bbc2f 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
2022-06-11 16:32:27 +01:00

35 lines
802 B
C++

#include "ReplClient.h"
#include "common/cross_sockets/XSocket.h"
#include "third-party/fmt/core.h"
#include "common/versions.h"
#ifdef _WIN32
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <WinSock2.h>
#include <WS2tcpip.h>
#endif
void ReplClient::eval(std::string form) {
if (!is_connected()) {
return;
}
// TODO - split this up into two writes
u32 dataLength = form.length();
ReplServerHeader header = {dataLength, ReplServerMessageType::EVAL};
auto const ptr = reinterpret_cast<char*>(&header);
std::vector<char> buffer(ptr, ptr + sizeof header);
buffer.insert(buffer.end(), form.begin(), form.end());
int result = write_to_socket(client_socket, buffer.data(), buffer.size());
if (result == -1) {
// TODO - log
disconnect();
}
}