Skip to content

Linux migration#359

Merged
skittles1 merged 11 commits into
OpenMeridian105:developfrom
Arantis:linux-migration
Apr 10, 2026
Merged

Linux migration#359
skittles1 merged 11 commits into
OpenMeridian105:developfrom
Arantis:linux-migration

Conversation

@Arantis
Copy link
Copy Markdown

@Arantis Arantis commented Apr 2, 2026

Branch to get the server migrated to build on linux. Build on Windows still works.

Arantis added 11 commits March 27, 2026 17:06
Server:
- Single-threaded epoll architecture (based on vanilla Meridian59)
- osd_linux.c/h, osd_epoll.c: OS abstraction layer
- main.c: Unified Windows/Linux with #ifdef
- Admin commands via maintenance port (TCP 9998)
- Shutdown command + SIGTERM signal handler
- PostgreSQL database support (replaces MySQL on Linux)
  - database_pg.c/h: Full implementation with 46 tables
  - Async writer thread with queue
  - Docker compose for PostgreSQL + pgAdmin
- A* pathfinding parallelized with OpenMP
- UDP protocol support via epoll

Build system:
- KOD compilation with directory mode (bc -R) for identical
  resource IDs between Windows and Linux builds
- All makefiles updated for Linux (blakserv, blakcomp, util, kod)
- blakcomp: dircompile.c ported for Linux path handling

Bug fixes (both platforms):
- Fixed trailing whitespace in helmet/bergrm makefiles
- Fixed corn.bgf -> corn.bof typo in food makefile
- Fixed spinebeastbosst.kod -> .bof in trestype makefile
- Fixed jixa_smith.kod wrong resource variable names
- Fixed case-sensitive file renames for Linux filesystem
…race condition fix

- sendmsg.c: Reset message_depth to 0 when corrupt at SendTopLevelBlakodMessage
  entry/exit, preventing cascading interpreter errors (realtime.bof)
- interface_linux.c: Rebuilt console interface - fixed getline newline bug,
  use SetQuit() for clean shutdown, session counting, admin response output
- main.c: Added -i flag for interactive mode with blakadm console,
  daemon mode (fork) without -i, startup status messages
- osd_linux.c/osd_linux.h: Removed interface stubs, now provided by interface_linux.c
- blakserv.h: Include interface_linux.h on Linux instead of stubs
- makefile.linux: Added interface_linux.obj to build
- osd_epoll.c: Added ServerLock around AsyncSocketAccept (race condition fix)
- garbage.c: GC now resets all statistics fields (object_id, message_id, time, posts)
- user.c: Fixed %I64i format specifier to %llu on Linux
- Strip \r\n after fgets in all text file parsers for Windows line ending
  compatibility: loadall.c, loadacco.c, config.c, kodbase.c, dllist.c,
  admincons.c, block.c, adminfn.c (enables loading Windows savegames on Linux)
- Strip \r\n in blakod compiler: dircompile.c, kodbase.c (ensures identical
  BOF/kodbase output regardless of platform)
- Handle \0 as line terminator in dircompile.c makefile parser
- Case-insensitive file sort in files.c and rscmerge.c to match NTFS ordering
- Call MySQLEnd() in MainExitServer for clean database thread shutdown
The custom line parser in LoadKodbase uses \n as a token terminator.
The previous strcspn fix removed both \r and \n, breaking the parser
and causing 10M+ SetObjectPropertyByName errors when loading Windows
savegames. Now replaces \r with \n to maintain parser compatibility
while handling Windows line endings.
The LoadKodbase custom line parser uses \n as token terminator and
strtol ignores \r at end of numbers. No \r stripping needed - both
strcspn and strchr fixes caused Bad class entry errors when loading
Windows kodbase files.
- Remove -m32 flags from blakserv and blakcomp makefiles
- Fix DWORD/LPARAM typedefs to uint32_t (unsigned long is 8 bytes on 64-bit)
- Fix UINT4 in md5.h to uint32_t (fixes RSB hash mismatch with clients)
- Fix pointer-to-int casts in blakcomp with intptr_t (kodbase.c, codegen.c)
- Update install-build-deps.sh for native 64-bit packages

All binary formats (savegames, BOFs, client protocol) use explicit 4-byte
integers and remain fully compatible between 32-bit and 64-bit builds.
Tested with production savegame (5063 accounts, 0 errors).
@skittles1 skittles1 merged commit 4545003 into OpenMeridian105:develop Apr 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants