Bardzo fajny programik na Androida, można export-ować CDU na ekran tebleciku. Po drobnej poprawce pliku Export.lua udało mi się go uruchomić razem z DCS-Bios.
https://www.digitalcombatsimulator.com/en/files/2132690/?sphrase_id=5010560 W pliku Export.lua linijkę os.setlocale("ISO-8559-1", "numeric") trzeba poprawić na --os.setlocale("ISO-8559-1", "numeric"), dokładnie chodzi o te dwa "--" na początku linijki. Teraz na tableciku jest piękny CDU, wszystko działa i co najważniejsze nie obciąża tak procesora jak "Virtual Cockpit Server for DCS World".
Jeśli chcesz by działał też DCS-Bios, trzeba dać jego wpis o exporcie na końcu pliku a nie na początku. U mnie to wygląda tak:
--CDU START--
gExportInterval = 0.067
--os.setlocale("ISO-8559-1", "numeric")
function LuaExportStart()
-- default_output_file = io.open(require('lfs').writedir().."Temp\\export.log", "w")
-- default_output_file:write("server start\n")
-- Works once just before mission start.
-- 2) Setup udp sockets to talk to helios
package.path = package.path..";.\\LuaSocket\\?.lua"
package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
socket = require("socket")
c = socket.udp()
c:setsockname("*", 0)
c:setoption('broadcast', true)
c:settimeout(.001) -- set the timeout for reading the socket
end
function LuaExportBeforeNextFrame()
ProcessInput()
end
function LuaExportAfterNextFrame()
end
function LuaExportStop()
c:close()
-- if default_output_file then
-- default_output_file:close()
-- default_output_file = nil
-- end
end
function ProcessInput()
local lInput = c:receive()
local lCommand, lCommandArgs, lDevice, lArgument, lLastValue
if lInput then
-- default_output_file:write(lInput..'\n')
lCommand = string.sub(lInput,1,1)
if lCommand == "R" then
ResetChangeValues()
end
if (lCommand == "C") then
lCommandArgs = StrSplit(string.sub(lInput,2),",")
lDevice = GetDevice(lCommandArgs[1])
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
end
end
end
function LuaExportActivityNextEvent(t)
t = t + gExportInterval
sendCDUData()
return t
end
-- Helper Functions
function StrSplit(str, delim, maxNb)
-- Eliminate bad cases...
if string.find(str, delim) == nil then
return { str }
end
if maxNb == nil or maxNb < 1 then
maxNb = 0 -- No limit
end
local result = {}
local pat = "(.-)" .. delim .. "()"
local nb = 0
local lastPos
for part, pos in string.gfind(str, pat) do
nb = nb + 1
result[nb] = part
lastPos = pos
if nb == maxNb then break end
end
-- Handle the last field
if nb ~= maxNb then
result[nb + 1] = string.sub(str, lastPos)
end
return result
end
--dofile(require('lfs').writedir().."Scripts\\libCDU.lua")
--////// CDU APP CONFIG //////
function checkPlayerAircraft()
local PlayerPlaneInfo = LoGetObjectById(LoGetPlayerPlaneId());
local playerAircraft
if ( PlayerPlaneInfo ) then
-- default_output_file:write("info1 : "..playerAircraft..'\n')
if PlayerPlaneInfo.Name == "A-10C" then
-- if playerAircraft then
-- default_output_file:write("info2 : "..playerAircraft..'\n')
-- end
return 0
end
end
-- if playerAircraft then
-- default_output_file:write("info2 : "..playerAircraft..'\n')
-- end
return 1
end
function sendCDUData()
if checkPlayerAircraft() == 1 then
-- default_output_file:write("this plane is not a-10\n")
return
end
-- default_output_file:write("this plane is a-10\n")
getIndicatorData(3)
sendAAP()
sendCDUEcho()
sendCDUMasterCaution()
end
nextCDUEchoTime = 0
function sendCDUEcho()
local curTime = LoGetModelTime()
if curTime >= nextCDUEchoTime then
nextCDUEchoTime = curTime + 10
sendCduData("DCSECHO", cduAppHost, cduAppPort)
-- socket.try(c:sendto("DCSECHO", cduAppHost, cduAppPort))
end
end
nextCDUMCTime = 0
nextCDUMVwarn = 0
function sendCDUMasterCaution()
local curTime = LoGetModelTime()
if curTime >= nextCDUMCTime then
nextCDUMCTime = curTime + 1
local mwarn = GetDevice(0):get_argument_value(404)
if nextCDUMVwarn > mwarn or nextCDUMVwarn < mwarn then
nextCDUMVwarn = mwarn
sendCduData("404:"..nextCDUMVwarn, cduAppHost, cduAppPort)
-- socket.try(c:sendto("404:"..nextCDUMVwarn, cduAppHost, cduAppPort))
end
end
end
nextAAPTime = 0
function sendAAP()
local curTime = LoGetModelTime()
if curTime >= nextAAPTime then
nextAAPTime = curTime + .15
local mstpt = string.format("%d", string.format("%0.1f", GetDevice(0):get_argument_value(473))*10)
sendCduData("473:"..mstpt, cduAppHost, cduAppPort)
local mpage = string.format("%d", string.format("%0.1f", GetDevice(0):get_argument_value(475))*10)
sendCduData("475:"..mpage, cduAppHost, cduAppPort)
local cdupw = string.format("%d", GetDevice(0):get_argument_value(476))
sendCduData("476:"..cdupw, cduAppHost, cduAppPort)
local egipw = string.format("%d", GetDevice(0):get_argument_value(477))
sendCduData("477:"..egipw, cduAppHost, cduAppPort)
end
end
nextCDUIndicatorTime = 0
function getIndicatorData(indicator_number)
local pairData = ""
local curTime = LoGetModelTime()
if curTime >= nextCDUIndicatorTime then
nextCDUIndicatorTime = curTime + .15
local indicator = list_indication(indicator_number)
if indicator ~= "" then
for brace in indicator:gmatch("%b{}") do
local lines = string.gsub(string.gsub(brace,"[{}]",""),"---+","")
for data in lines:gmatch("[%w_]+\n[^\n]+") do
pairData = pairData..string.gsub(data, "\n", "<==>")..'\n'
end
end
sendCduData(pairData, cduAppHost, cduAppPort)
end
end
end
function sendCduData( message, appIpList, appPort )
if message and appIpList and appPort then
for appIp in string.gmatch(appIpList, "([0-9]+.[0-9]+.[0-9]+.[0-9]+)") do
socket.try(c:sendto(message, appIp, appPort))
-- default_output_file:write(appIp..":"..appPort..'\n')
end
end
end;
--////// ANDROID NETWORK CONFIG //////
--multi ip enable example : 192.168.1.128 192.168.1.129 192.168.1.130
cduAppHost = "192.168.0.100"
cduAppPort = 9089
--////// CDU APP CONFIG //////
dofile(lfs.writedir()..[[Scripts\DCS-BIOS\BIOS.lua]])
dofile(".\\A10VCServer\\Main.lua") --A10VCHook