From e6a5f4965e3305fe135feb89c401d66ffe168828 Mon Sep 17 00:00:00 2001 From: kosmik641 Date: Thu, 23 Feb 2023 23:52:27 +0300 Subject: [PATCH 1/3] =?UTF-8?q?Turbostroi=20=D0=A4=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B2=20ffi=20=D0=BD=D0=B0=20Linux=20=D1=81?= =?UTF-8?q?=D0=B8=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 = {}} From 7b1211e0e92a40cd382fac27b7487698614320dc Mon Sep 17 00:00:00 2001 From: kosmik641 Date: Sat, 25 Feb 2023 19:14:11 +0300 Subject: [PATCH 2/3] =?UTF-8?q?Turbostroi=20=D0=A3=D0=B1=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=BE=D1=81=D1=82=D0=B0=D1=82=D0=BA=D0=B8=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BA=D0=B8=20=D0=B4=D0=BB=D1=8F=20Format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/sv_turbostroi_v2.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/metrostroi/sv_turbostroi_v2.lua b/lua/metrostroi/sv_turbostroi_v2.lua index 0e291f8..567b2d5 100644 --- a/lua/metrostroi/sv_turbostroi_v2.lua +++ b/lua/metrostroi/sv_turbostroi_v2.lua @@ -210,7 +210,7 @@ local OSes = { POSIX = "linux", OSX = "osx", } -local dllPath = "./garrysmod/lua/bin/gmsv_turbostroi_"..(OSes[jit.os] or "").."%s.dll" +local dllPath = "./garrysmod/lua/bin/gmsv_turbostroi_"..(OSes[jit.os] or "win32")..".dll" local ffi = require("ffi") ffi.cdef[[ From 075ea9be5e9d9f4c43020a0cf8dcaae90813437f Mon Sep 17 00:00:00 2001 From: kosmik641 Date: Thu, 21 Nov 2024 20:21:53 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=20DLL=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=B0=D1=80=D1=85=D0=B8=D1=82=D0=B5=D0=BA=D1=82=D1=83?= =?UTF-8?q?=D1=80=D1=8B,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=9E=D0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/metrostroi/sv_turbostroi_v2.lua | 44 +++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/lua/metrostroi/sv_turbostroi_v2.lua b/lua/metrostroi/sv_turbostroi_v2.lua index 567b2d5..7a5a176 100644 --- a/lua/metrostroi/sv_turbostroi_v2.lua +++ b/lua/metrostroi/sv_turbostroi_v2.lua @@ -202,15 +202,43 @@ end -------------------------------------------------------------------------------- -- NEW API local OSes = { - Windows = "win32", - Windows64 = "win64", - Linux = "linux", - Linux64 = "linux64", - BSD = "linux", - POSIX = "linux", - OSX = "osx", + Windows = { + x86 = "win32", + x64 = "win64" + }, + Linux = { + x86 = "linux", + x64 = "linux64" + }, + BSD = { + x86 = "linux", + x64 = "linux64" + }, + POSIX = { + x86 = "linux", + x64 = "linux64" + }, + OSX = { + x86 = "osx", + x64 = "osx" + }, + Other = { + x86 = "linux", + x64 = "linux64" + } } -local dllPath = "./garrysmod/lua/bin/gmsv_turbostroi_"..(OSes[jit.os] or "win32")..".dll" + +local postfix +if OSes[jit.os] then + postfix = OSes[jit.os][jit.arch] +end + +if postfix == nil then + print("Can't find gm_turbostroi DLL") + return +end + +local dllPath = "./garrysmod/lua/bin/gmsv_turbostroi_"..postfix..".dll" local ffi = require("ffi") ffi.cdef[[