add math gates, fix 32-bit shifters
This commit is contained in:
@@ -18,6 +18,7 @@ end
|
||||
Simulation = {}
|
||||
|
||||
local queue_max = 65536
|
||||
local cb_queue_max = 256
|
||||
|
||||
function Simulation.new(sim)
|
||||
local o = {
|
||||
@@ -349,9 +350,37 @@ end
|
||||
-- sim.groupfxqueue[group] = group
|
||||
--end
|
||||
|
||||
function Simulation.queuecallback(sim, gate, ...)
|
||||
-- Callbacks
|
||||
|
||||
function Simulation.setcallback(sim, gate, arg)
|
||||
sim.callbacks = sim.callbacks or {}
|
||||
sim.callbacks[gate.objref] = {...}
|
||||
sim.callbacks[gate.objref] = { arg }
|
||||
end
|
||||
|
||||
function Simulation.queuecallback(sim, gate, arg, limit)
|
||||
sim.callbacks = sim.callbacks or {}
|
||||
sim.callbacks[gate.objref] = sim.callbacks[gate.objref] or {}
|
||||
if #sim.callbacks[gate.objref] < limit then
|
||||
table.insert(sim.callbacks[gate.objref], arg)
|
||||
end
|
||||
end
|
||||
|
||||
function Simulation.sendcallbacks(sim)
|
||||
if sim.callbacks ~= nil then
|
||||
local data = "CB"
|
||||
|
||||
for objref, args in pairs(sim.callbacks) do
|
||||
local escargs = {}
|
||||
for argidx, argv in ipairs(args) do
|
||||
table.insert(escargs, expandescape(tostring(argv)))
|
||||
end
|
||||
local argstr = table.concat(escargs, "\t")
|
||||
data = data .. "\t" .. objref .. "\t" .. #escargs .. (#escargs>0 and ("\t"..argstr) or "")
|
||||
end
|
||||
|
||||
network_send(data .. "\n")
|
||||
sim.callbacks = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- Logic Critical
|
||||
@@ -401,6 +430,8 @@ function Simulation.tickinput(sim)
|
||||
end
|
||||
end
|
||||
|
||||
-- FX
|
||||
|
||||
function Simulation.sendfxupdate(sim)
|
||||
--for k, group in pairs(sim.groupfxqueue) do
|
||||
for k, group in pairs(sim.nets) do
|
||||
@@ -420,23 +451,6 @@ function Simulation.sendfxupdate(sim)
|
||||
--sim.groupfxqueue = {}
|
||||
end
|
||||
|
||||
function Simulation.sendcallbacks(sim)
|
||||
if sim.callbacks ~= nil then
|
||||
local data = "CB"
|
||||
|
||||
for objref, args in pairs(sim.callbacks) do
|
||||
local escargs = {}
|
||||
for argidx, argv in ipairs(args) do
|
||||
table.insert(escargs, expandescape(tostring(argv)))
|
||||
end
|
||||
data = data .. "\t" .. objref .. "\t"..(#escargs)..(#escargs>0 and ("\t"..table.concat(escargs, "\t")) or "")
|
||||
end
|
||||
|
||||
network_send(data .. "\n")
|
||||
sim.callbacks = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Simulation.add_net(sim, net)
|
||||
sim.nets[net.id] = net
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user