diff --git a/lua/autorun/gmod_integration.lua b/lua/autorun/gmod_integration.lua index 591ff4f..4de405d 100644 --- a/lua/autorun/gmod_integration.lua +++ b/lua/autorun/gmod_integration.lua @@ -1,7 +1,24 @@ if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end local alreadyLoadGMI = gmInte + +local function detectOS() + if system.IsWindows() then + return "win" .. (jit && jit.arch == "x64" && "64" || "") + elseif system.IsLinux() then + return "linux" .. (jit && jit.arch == "x64" && "64" || "") + else + return "unknown" + end +end + local function dllInstalled() - return file.Exists("lua/bin/gmsv_gmod_integration_loader_linux.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_linux64.dll", "GAME") || file.Exists("lua/bin/gmsv_gmod_integration_loader_win32.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_win64.dll", "GAME") + local fileName = "gmsv_gmod_integration_loader_" .. detectOS() .. ".dll" + if detectOS() == "unknown" then + gmInte.logError("Unknown OS detected, cannot check for DLL installation.") + return false + end + + return file.Exists("lua/bin/" .. fileName, "GAME") end local isLatest = debug.getinfo(1, "S").source == "@addons/_gmod_integration_latest/lua/autorun/_gmod_integration_latest.lua" @@ -35,6 +52,7 @@ gmInte.version = "5.0.28" // This will be automatically updated by GitHub Action gmInte.config = {} gmInte.useDataConfig = true gmInte.dllInstalled = dllInstalled +gmInte.detectOS = detectOS function gmInte.log(msg, onlyOndebug) if onlyOndebug && !gmInte.config.debug then return end print(" | " .. os.date(gmInte.config.logTimestamp || "%Y-%m-%d %H:%M:%S") .. " | Gmod Integration | " .. msg) diff --git a/lua/gmod_integration/core/utils/sv_main.lua b/lua/gmod_integration/core/utils/sv_main.lua index 9b0a417..c25d215 100644 --- a/lua/gmod_integration/core/utils/sv_main.lua +++ b/lua/gmod_integration/core/utils/sv_main.lua @@ -1,13 +1,3 @@ -function gmInte.detectOS() - if system.IsWindows() then - return "win" .. (jit && jit.arch == "x64" && "64" || "") - elseif system.IsLinux() then - return "linux" .. (jit && jit.arch == "x64" && "64" || "") - else - return "unknown" - end -end - timer.Create("gmInte:CheckDLL", 30, 0, function() if gmInte.dllInstalled() || gmInte.config.debug then return end print(" ")