1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

Merge pull request #571 from metrostroi-repo/turbostroi_fix

This commit is contained in:
CrIcKeT98
2025-07-12 16:14:26 +03:00
committed by GitHub

View File

@@ -201,6 +201,45 @@ end
-- Turbostroi scripts -- Turbostroi scripts
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- NEW API -- NEW API
local OSes = {
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 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") local ffi = require("ffi")
ffi.cdef[[ ffi.cdef[[
bool ThreadSendMessage(void *p, int message, const char* system_name, const char* name, double index, double value); bool ThreadSendMessage(void *p, int message, const char* system_name, const char* name, double index, double value);
@@ -215,22 +254,7 @@ typedef struct {
thread_msg ThreadRecvMessage(void* p); thread_msg ThreadRecvMessage(void* p);
]] ]]
local OSName = "gmsv_turbostroi_" local TS = ffi.load(dllPath)
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)
Metrostroi = {} Metrostroi = {}
local dataCache = {wires = {},wiresW = {},wiresL = {}} local dataCache = {wires = {},wiresW = {},wiresL = {}}