Added installer and missing scripts

This commit is contained in:
Pax1601 2022-11-20 12:49:56 +01:00
parent 3aa1cfe104
commit ed193b6c78
5 changed files with 139 additions and 0 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ core.user
core.vcxproj.user
.vscode
*.user
Output

23
installer/DCSOlympus.iss Normal file
View File

@ -0,0 +1,23 @@
[Setup]
AppName=DCS Olympus
AppVerName=DCS Olympus Alpha v0.0.1
DefaultDirName={usersavedgames}\DCS.openbeta
DefaultGroupName=DCSOlympus
OutputBaseFilename=DCSOlympus
[Tasks]
; NOTE: The following entry contains English phrases ("Create a desktop icon" and "Additional icons"). You are free to translate them into another language if required.
[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "..\scripts\OlympusExport.lua"; DestDir: "{app}\Scripts"; Flags: ignoreversion
Source: "..\scripts\OlympusHook.lua"; DestDir: "{app}\Scripts\Hooks"; Flags: ignoreversion
Source: "..\scripts\OlympusCommand.lua"; DestDir: "{app}\Mods\Services\Olympus\Scripts"; Flags: ignoreversion
Source: "..\scripts\OlympusMission.lua"; DestDir: "{app}\Mods\Services\Olympus\Scripts"; Flags: ignoreversion
Source: "..\bin\x64\Release\*.dll"; DestDir: "{app}\Mods\Services\Olympus\bin"; Flags: ignoreversion;
[Code]
procedure AppendExportString();
begin
SaveStringToFile(ExpandConstant('{app}\Scripts\Export.lua'), #13#10 + 'local Olympuslfs=require(''lfs'');dofile(Olympuslfs.writedir()..''Scripts/OlympusExport.lua'')' + #13#10, True);
end;

1
scripts/Export.lua Normal file
View File

@ -0,0 +1 @@
local Olympuslfs=require('lfs');dofile(Olympuslfs.writedir()..'Scripts/OlympusExport.lua')

44
scripts/OlympusExport.lua Normal file
View File

@ -0,0 +1,44 @@
Olympus = {}
Olympus.OlympusDLL = nil
Olympus.cppRESTDLL = nil
Olympus.DLLsloaded = false
Olympus.debug = true
if Olympus.debug then
Olympus.OlympusModPath = "C:\\Users\\dpass\\Documents\\Olympus\\bin\\x64\\Debug\\"
else
Olympus.OlympusModPath = "C:\\Users\\dpass\\Doczuments\\Olympus\\bin\\x64\\Release\\"
end
log.write('Olympus.EXPORT.LUA', log.INFO,'Executing OlympusExport.lua')
function Olympus.loadDLLs()
-- Add the .dll paths
package.cpath = package.cpath..';'..Olympus.OlympusModPath..'?.dll;'
if Olympus.debug then
log.write('Olympus.EXPORT.LUA', log.INFO, 'Loading cpprest_2_10d.dll from ['..Olympus.OlympusModPath..']')
pcall(require, 'cpprest_2_10d')
else
log.write('Olympus.EXPORT.LUA', log.INFO, 'Loading cpprest_2_10.dll from ['..Olympus.OlympusModPath..']')
pcall(require, 'cpprest_2_10')
end
log.write('Olympus.EXPORT.LUA', log.INFO, 'Loading Olympus.dll from ['..Olympus.OlympusModPath..']')
local status
status, Olympus.OlympusDLL = pcall(require, 'Olympus')
if not status then
return false
end
return true
end
do
if isOlympusModuleInitialized~=true then
local OlympusName = 'Olympus 0.0.1 C++ module'
isOlympusModuleInitialized=true;
Olympus.loadDLLs()
log.write('Olympus.EXPORT.LUA', log.INFO, OlympusName..' successfully loaded.')
else
log.write('Olympus.EXPORT.LUA', log.INFO, 'Olympus.dll already initialized')
end
end

70
scripts/OlympusHook.lua Normal file
View File

@ -0,0 +1,70 @@
Olympus = {}
Olympus.OlympusDLL = nil
Olympus.cppRESTDLL = nil
Olympus.DLLsloaded = false
Olympus.debug = true
if Olympus.debug then
Olympus.OlympusModPath = "C:\\Users\\dpass\\Documents\\Olympus\\bin\\x64\\Debug\\"
else
Olympus.OlympusModPath = "C:\\Users\\dpass\\Doczuments\\Olympus\\bin\\x64\\Release\\"
end
log.write('Olympus.HOOKS.LUA', log.INFO,'Executing OlympusHook.lua')
function loadDLLs()
-- Add the .dll paths
package.cpath = package.cpath..';'..Olympus.OlympusModPath..'?.dll;'
if Olympus.debug then
log.write('Olympus.HOOKS.LUA', log.INFO, 'Loading cpprest_2_10d.dll from ['..Olympus.OlympusModPath..']')
pcall(require, 'cpprest_2_10d')
else
log.write('Olympus.HOOKS.LUA', log.INFO, 'Loading cpprest_2_10.dll from ['..Olympus.OlympusModPath..']')
pcall(require, 'cpprest_2_10')
end
log.write('Olympus.HOOKS.LUA', log.INFO, 'Loading Olympus.dll from ['..Olympus.OlympusModPath..']')
local status
status, Olympus.OlympusDLL = pcall(require, 'Olympus')
if not status then
return false
end
return true
end
do
if isOlympusModuleInitialized~=true then
local OlympusName = 'Olympus 0.0.1 C++ module';
-- Register callbacks
local OlympusCallbacks = {}
function OlympusCallbacks.onSimulationStart()
log.write('Olympus.HOOKS.LUA', log.INFO,OlympusName..' onSimulationStart')
if DCS.isServer() then
Olympus.DLLsloaded = loadDLLs()
if Olympus.DLLsloaded then
Olympus.OlympusDLL.onSimulationStart()
log.write('Olympus.HOOKS.LUA', log.INFO, OlympusName..' successfully loaded.')
else
log.write('Olympus.HOOKS.LUA', log.ERROR, 'Failed to load '..OlympusName..'.')
end
end
end
function OlympusCallbacks.onSimulationFrame()
if DCS.isServer() and Olympus.DLLsloaded then
Olympus.OlympusDLL.onSimulationFrame()
end
end
function OlympusCallbacks.onSimulationStop()
if DCS.isServer() and Olympus.DLLsloaded then
Olympus.OlympusDLL.onSimulationStop()
end
end
DCS.setUserCallbacks(OlympusCallbacks)
log.write('Olympus.HOOKS.LUA', log.INFO, OlympusName..' callbacks registered correctly.')
isOlympusModuleInitialized=true;
end
end