Add Windows cross-platform support alongside Linux

Replace POSIX-specific socket and process APIs with portable
abstractions so the project builds on both Windows and Linux.

- Add include/network/net_platform.hpp: Winsock2/POSIX socket
  abstraction (socket types, non-blocking, error handling,
  WSAStartup lifecycle)
- Add include/platform/process.hpp: CreateProcess/fork+exec
  abstraction for spawning ffplay subprocesses
- Update network module (tcp_socket, world_socket) to use
  portable socket helpers instead of raw POSIX calls
- Update audio module (music_manager, footstep_manager,
  activity_sound_manager) to use portable process helpers
  instead of fork/exec/kill/waitpid
- Replace hardcoded /tmp/ paths with std::filesystem::temp_directory_path()
- Link ws2_32 and SDL2main on Windows in CMakeLists.txt
This commit is contained in:
Kelsi 2026-02-03 22:24:17 -08:00
parent dd126c6e4b
commit 6bf3fa4ed4
14 changed files with 416 additions and 186 deletions

View file

@ -27,6 +27,7 @@
#include <glm/gtx/quaternion.hpp>
#include <algorithm>
#include <cmath>
#include <filesystem>
namespace wowee {
namespace rendering {
@ -317,7 +318,7 @@ GLuint CharacterRenderer::compositeTextures(const std::vector<std::string>& laye
// Debug: save overlay to disk
{
std::string fname = "/tmp/overlay_debug_" + std::to_string(layer) + ".rgba";
std::string fname = (std::filesystem::temp_directory_path() / ("overlay_debug_" + std::to_string(layer) + ".rgba")).string();
FILE* f = fopen(fname.c_str(), "wb");
if (f) {
fwrite(&overlay.width, 4, 1, f);
@ -394,14 +395,15 @@ GLuint CharacterRenderer::compositeTextures(const std::vector<std::string>& laye
// Debug: save composite as raw RGBA file
{
FILE* f = fopen("/tmp/composite_debug.rgba", "wb");
std::string dbgPath = (std::filesystem::temp_directory_path() / "composite_debug.rgba").string();
FILE* f = fopen(dbgPath.c_str(), "wb");
if (f) {
// Write width, height as 4 bytes each, then pixel data
fwrite(&width, 4, 1, f);
fwrite(&height, 4, 1, f);
fwrite(composite.data(), 1, composite.size(), f);
fclose(f);
core::Logger::getInstance().info("DEBUG: saved composite to /tmp/composite_debug.rgba");
core::Logger::getInstance().info("DEBUG: saved composite to ", dbgPath);
}
}