cpp: fixes for windows

This commit is contained in:
DH
2025-08-28 16:15:57 +03:00
parent 3656f692f3
commit 93a640cc3b
2 changed files with 14 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ string(TOLOWER "${CMAKE_SYSTEM_NAME}" EXTENSION_TRIPLE_OS)
if("${EXTENSION_TRIPLE_OS}" STREQUAL "windows")
set(EXTENSION_TRIPLE_FORMAT "pe")
set(EXTENSION_TRIPLE_OS "win32")
else()
set(EXTENSION_TRIPLE_FORMAT "elf")
endif()

View File

@@ -15,10 +15,23 @@
#include <unordered_map>
#include <utility>
#ifdef _WIN32
#include <fcntl.h>
#include <io.h>
#endif
using namespace rpcsx::ui;
using namespace nlohmann;
struct StdioTransport : Transport {
#ifdef _WIN32
StdioTransport() {
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
}
#endif
void write(std::span<const std::byte> bytes) override {
while (true) {
auto count = std::fwrite(bytes.data(), 1, bytes.size(), stdout);