From 0a42b24f09f8e4df76a74d33e46cd23e10eadfb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 31 Aug 2024 22:48:36 +0200 Subject: [PATCH] Add support for headless --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 224925c..a671673 100644 --- a/main.go +++ b/main.go @@ -159,14 +159,17 @@ var worldLock sync.Mutex var totalRenderTime, totalGameLogicCatchUp, totalNormalGameLogic, totalTicking, totalScalingTime, totalRemotePlayerUpdate, tickCount, totalFrameTime, frameCount uint64 func main() { - initializeSDL() - defer sdl.Quit() configX, err := loadOrCreateConfig("config.json") if err != nil { log.Fatal(err) } serverConfig = configX.ServerConfig config = configX + + if !(config.Server && !config.DoKeymapPlayer && !config.DoJoyStickPlayers && !config.DoAllKeymapsPlayers && !config.MapWindow) { + initializeSDL() + defer sdl.Quit() + } if config.ProfilerOn { f, err := os.Create("cpuprofile") if err != nil {