diff --git a/Moose Development/Debugger/MissionScripting.lua b/Moose Development/Debugger/MissionScripting.lua new file mode 100644 index 000000000..f6cc7f68f --- /dev/null +++ b/Moose Development/Debugger/MissionScripting.lua @@ -0,0 +1,37 @@ +--Initialization script for the Mission lua Environment (SSE) + +dofile('Scripts/ScriptingSystem.lua') + +-- Add LuaSocket to the LUAPATH, so that it can be found. +package.path = package.path..";.\\LuaSocket\\?.lua;" + +-- Connect to the debugger, first require it. +local initconnection = require("debugger") + +-- Now make the connection.. +-- "127.0.0.1" is the localhost. +-- 10000 is the port. If you wanna use another port in LDT, change this number too! +-- "dcsserver" is the name of the server. If you wanna use another name, change the name here too! +-- nil (is for transport protocol, but not using this) +-- "win" don't touch. But is important to indicate that we are in a windows environment to the debugger script. +initconnection( "127.0.0.1", 10000, "dcsserver", nil, "win", "" ) + + +--Sanitize Mission Scripting environment +--This makes unavailable some unsecure functions. +--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions. +--You can remove the code below and make availble these functions at your own risk. + +local function sanitizeModule(name) + _G[name] = nil + package.loaded[name] = nil +end + + +do + sanitizeModule('os') + --sanitizeModule('io') + sanitizeModule('lfs') + require = nil + loadlib = nil +end \ No newline at end of file diff --git a/Moose Development/Debugger/connect.lua b/Moose Development/Debugger/READ.ME similarity index 100% rename from Moose Development/Debugger/connect.lua rename to Moose Development/Debugger/READ.ME diff --git a/docs/Interactive_Debug_Guide.md b/docs/Interactive_Debug_Guide.md index d2fccdb58..96424935d 100644 --- a/docs/Interactive_Debug_Guide.md +++ b/docs/Interactive_Debug_Guide.md @@ -78,10 +78,16 @@ Thats it on the LDT side. This process is essential. -Within the MOOSE repository, there are two files that you need to consider. -These files are located +Within the MOOSE repository, there are two important files that you need to consider. +These files are located in the MOOSE repository [here](https://github.com/FlightControl-Master/MOOSE/tree/master/Moose%20Development/Debugger). +Download the MOOSE repository or the files on your disk, and read further ... +You should have at least on your disk: + + * debugger.lua + * READ.ME + * MissionScripting.lua ### 3.1. debugger.lua. @@ -90,11 +96,11 @@ You need to copy this file to the root directory of your DCS World installation ![](Debugging/DEBUG_debugger.JPG) -The location of debugger.lua is here on my DCS World installation. +By example, the location of debugger.lua is here on my DCS World installation PC. ### 3.2. Modify the MissionScripting.lua file. -The connect.lua file is a file that contains an explanation of how to modify the MissionScripting.lua. +The READ.ME file is a file that contains an explanation of how to modify the MissionScripting.lua. But for clarity reasons, I've also attached my version of the MissionScripting.lua. @@ -158,7 +164,7 @@ The io module has been de-sanitized because the debugger.lua needs to use the io When you run a mission in single player in DCS World, a couple of things are happening. 1. The .miz (mission) file that was selected to run, is unzipped in a temp folder on your drive. - 2. Each lua file that is included in a DO SCRIPT FILE, is **RENAMED** to a file structure like ~mis__nnnnn___.lua. + 2. Each lua file that is included in a DO SCRIPT FILE, is **RENAMED** to a file structure like ~mis__nnnnn__.lua. This is very bad. Because this prevents you from settings breakpoints at the source file and ensure that the debugger recognizes the source during run and the location of the breakpoint!