From e6a5f4965e3305fe135feb89c401d66ffe168828 Mon Sep 17 00:00:00 2001 From: kosmik641 Date: Thu, 23 Feb 2023 23:52:27 +0300 Subject: [PATCH] =?UTF-8?q?Turbostroi=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B2=20ffi=20=D0=BD=D0=B0=20Linux=20=D1=81=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=B5=D0=BC=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/sv_turbostroi_v2.lua | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lua/metrostroi/sv_turbostroi_v2.lua b/lua/metrostroi/sv_turbostroi_v2.lua index 243cea4..0e291f8 100644 --- a/lua/metrostroi/sv_turbostroi_v2.lua +++ b/lua/metrostroi/sv_turbostroi_v2.lua @@ -201,6 +201,17 @@ end -- Turbostroi scripts -------------------------------------------------------------------------------- -- NEW API +local OSes = { + Windows = "win32", + Windows64 = "win64", + Linux = "linux", + Linux64 = "linux64", + BSD = "linux", + POSIX = "linux", + OSX = "osx", +} +local dllPath = "./garrysmod/lua/bin/gmsv_turbostroi_"..(OSes[jit.os] or "").."%s.dll" + local ffi = require("ffi") ffi.cdef[[ bool ThreadSendMessage(void *p, int message, const char* system_name, const char* name, double index, double value); @@ -215,22 +226,7 @@ typedef struct { thread_msg ThreadRecvMessage(void* p); ]] -local OSName = "gmsv_turbostroi_" - -if jit.os == "Windows" then - OSName = OSName.."win" -elseif jit.os == "Linux" then - OSName = OSName.."linux" -end - -if jit.arch == "x86" then - OSName = OSName.."32" -else - OSName = OSName.."64" -end - - -local TS = ffi.load(OSName) +local TS = ffi.load(dllPath) Metrostroi = {} local dataCache = {wires = {},wiresW = {},wiresL = {}}