Commit Graph
13 Commits
Author SHA1 Message Date
92thmsandClaude Sonnet 5 764fcb3b3f Port server to Linux and add Docker Compose deployment
Rebuilds (not Wine) the login/char/world servers natively for Linux via
CMake, and ships a single Docker image plus docker-compose stack (MariaDB +
3 servers) with all settings configurable via .env.

Linux portability:
- Src/Common/compat.h shims MSVC-only CRT calls (fopen_s, _strdup,
  strncpy_s, sprintf_s, SYSTEMTIME/GetLocalTime, WSAGetLastError, __cdecl)
  and adds a case-insensitive/backslash-tolerant path resolver for the
  Windows-authored STB/AIP data file paths.
- Fixed case-sensitive header includes and filenames (charserver.h vs
  CharServer.h, worldserver.h vs WorldServer.h, ../common vs ../Common).
- rose_inet_addr() resolves hostnames (not just literal IPs) for the
  server-to-server links, so docker-compose service names work.

Fixed three real bugs that only crashed on 64-bit Linux (silently tolerated
on 32-bit Windows):
- CIntStb::LoadSTB had an inverted fopen success/failure check, so STB game
  data (zones, items, etc.) was never actually loaded.
- GenerateCryptTables allocated its pointer table with sizeof(unsigned)
  instead of sizeof(unsigned*) -- a 1x vs 2x-size heap overflow on 64-bit.
- Crypto bit-twiddling relies throughout on signed-overflow-as-wraparound,
  which is UB in C++; GCC's -O3 exploited it and miscompiled
  GenerateCryptTables (Release-only crash). Fixed via -fwrapv.
Plus smaller fixes: off-by-one array bounds (inventory/storage/sell data),
SO_REUSEADDR on server sockets (containers restarting in the same netns hit
TIME_WAIT otherwise), and a va_list reused across multiple vprintf/vfprintf
calls in Log() that garbled every formatted log line on the Linux ABI.

Docker:
- CMakeLists.txt builds all three servers + shared Common code.
- Dockerfile: multi-stage build, one runtime image for all three servers,
  server role selected via `command: [login|char|world]`.
- docker-compose.yml: MariaDB (auto-imports database sql files/ on first
  run) + login/char/world (single channel), config rendered from
  docker/conf/*.conf.tmpl via envsubst at container start.
- .env.example documents every setting (ports, server names, rates,
  inter-server passwords, PUBLIC_HOST for internet-facing deployments).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 06:32:39 +00:00
purpleyouko a320bbe470 Modified packet logging to include server name and save both in and out to the same file 2025-12-26 14:28:59 -06:00
purpleyouko 4a149c8621 added some files that were apparently missing 2025-09-12 13:26:48 -05:00
purpleyouko a5d1f662b1 bit of clean up 2025-08-28 12:53:07 -05:00
purpleyouko 8fd034ef97 added stb editor 2025-08-11 11:12:14 -05:00
purpleyouko cfdc19df45 added source folders 2025-08-11 11:09:09 -05:00
purpleyouko f23521f720 added database files 2025-08-11 11:05:24 -05:00
purpleyouko 6b82755825 added servers folder 2025-08-11 11:04:46 -05:00
purpleyouko 26d2931118 added worldmap.cpp 2025-08-11 11:03:59 -05:00
purpleyouko d4969dcbbc added loginclient.cpp 2025-08-11 11:03:30 -05:00
purpleyouko 943dd7b729 added charserver folder and vcxproj files 2025-08-11 11:02:41 -05:00
purpleyouko 51ea1fbacb added clanmark folder 2025-08-11 11:01:21 -05:00
purpleyouko 4cd053de0b added Binary folder and 3DData/AI/AAJU-AQUAGUARD.AIP 2025-08-11 10:58:30 -05:00