diff --git a/.gitignore b/.gitignore index 38430d132..170eeefe1 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ local.properties ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +.vscode + # User-specific files *.suo *.user diff --git a/docs/advanced/desanitize-dcs.md b/docs/advanced/desanitize-dcs.md new file mode 100644 index 000000000..91fad46d1 --- /dev/null +++ b/docs/advanced/desanitize-dcs.md @@ -0,0 +1,93 @@ +--- +title: De-Sanitize DCS +parent: Advanced +nav_order: 2 +--- +# De-Sanitize the DCS scripting environment +{: .no_toc } + +1. Table of contents +{:toc} + +De-Sanitize is the a modification performed by the user which disables some +security features of DCS. Without de-sanitizing not all functions of Moose +are available. Let's take a closer look and explain the details: + +- In the File-Explorer, navigate to your DCS main [installation folder]. +- Navigate to the folder `Scripts` and open the file `MissionScripting.lua` with + a good editor like [Notepad++]{:target="_blank"}. + +The original file should look like this: + +```lua +--Initialization script for the Mission lua Environment (SSE) + +dofile('Scripts/ScriptingSystem.lua') + +-- 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') + _G['require'] = nil + _G['loadlib'] = nil + _G['package'] = nil +end +``` + +In line 17, 18 and 19 the method `sanitizeModule` disables the modules `os`, `io` and `lfs`. + +{: .warning } +> This is a security feature to avoid harmfull actions to be executed from +> inside a mission. +> +> ***Disable this on your own risk!*** + +If the lines will be disabled the lua code inside of missions can use the +following functionality again: + +- `os` (at line 17): + - Execution of commands from the operation system is allowed again. + This is needed by some Classes when using [Text-To-Speech] with [SRS]{:target="_blank"}. + But in theory it can also run harmful commands. + +- `io` and `lfs` (at line 18 & 19): + - Different libraries to access files on your hard disk or do other io + operations. This is needed by some clases if you want to save and/or + read data. Like persistance for CSAR. + But it may be abused to access or modify sensitive files owned by the user. + +If you put two dashes (`--`) in front of each of the lines 17 - 19 the +protection is disabled and the lower part of the file should look this: + +```lua +do + --sanitizeModule('os') + --sanitizeModule('io') + --sanitizeModule('lfs') + _G['require'] = nil + _G['loadlib'] = nil + _G['package'] = nil +end +``` + +Save the file and it will enable the DCS Lua sandbox to access stuff on your computer. + +{: .note } +> After each update of DCS you need to repeat this because each update will +> overwrite this file by default. + +[installation folder]: ../beginner/tipps-and-tricks.md#find-the-installation-folder-of-dcs +[Notepad++]: https://notepad-plus-plus.org/downloads/ +[Text-To-Speech]: text-to-speech.md +[SRS]: https://github.com/ciribob/DCS-SimpleRadioStandalone/releases/latest diff --git a/docs/advanced/text-to-speech.md b/docs/advanced/text-to-speech.md new file mode 100644 index 000000000..129039708 --- /dev/null +++ b/docs/advanced/text-to-speech.md @@ -0,0 +1,159 @@ +--- +parent: Advanced +nav_order: 2 +--- +# Text to Speech +{: .no_toc } + +1. Table of contents +{:toc} + +This guide describes how to configure and use [Text-To-Speech{:target="_blank"} +(or TTS) with MOOSE. We use [DCS Simple Radio Standalone] (DCS-SRS) to generate +the audio and send it to the client. SRS is a well known VOIP client simulating +a radio in DCS. + +{: .note } +> Only clients which uses SRS are able to hear the generated radio calls. +> This is not compatible with the in game VOIP audio system from Eagle Dynamics! + +## Prerequisites + +- Download and install [DCS Simple Radio Standalone]{:target="_blank"} (DCS-SRS). +- Use a good text editor like [Notepad++]{:target="_blank"}. +- Create a simple test mission with Moose included and a "... from parking hot" + airplane or helicopter. +- [De-Sanitize the DCS scripting environment]. + +## Start SR-Server and connect the client + +- Navigate to the install directory of SRS. + - As default it should be located here: `C:\Program Files\DCS-SimpleRadio-Standalone` + +- We are interested in the executable files: + + ![srs-executables](../images/install/text-to-speech/srs-executables.png) + +- Start the server by double click on `SR-Server.exe`.
+ It should looks like this: + + ![srs-server](../images/install/text-to-speech/srs-server.png) + +- Start the `SR-ClientRadio.exe`. + +- Connect to the local server: + - Use the port shown in the server window (default is 5002). + - Use the ip of the windows loopback device (which is 127.0.0.1). + - Example: `127.0.0.1:5002` + + ![srs-client](../images/install/text-to-speech/srs-client.png) + +- If asked if you want to allow changes to your PC, say yes. + +- After you clicked on Connect and some seconds the status should look like this: + + ![srs-status-1](../images/install/text-to-speech/srs-status-1.png) + +- Your server UI now shows 1 connected client. + +- Click on „toggle radio overlay“ on the client. A small grey window will pop-up. + +## Start DCS World and your test mission + +- Jump into a plane or helicopter. + +- The connection status on the client UI and overlay should be changing + and shows the available radios of the module and it's frequencies: + + ![srs-overlay](../images/install/text-to-speech/srs-overlay.png) + +- The third green connector on the client UI should be green now: + + ![srs-status-2](../images/install/text-to-speech/srs-status-2.png) + +## Command line test with Power Shell + +- Use the search icon in windows to locate and start `PowerShell`, you’ll get a + blue terminal window: + + ![powershell-1](../images/install/text-to-speech/powershell-1.png) + +- Now navigate in PowerShell to the SRS install folderwith the following command: + + `cd 'C:\Program Files\DCS-SimpleRadio-Standalone\'` + + {: .note } + > Change the path if you choose another installation directory for SRS. + +- Type `dir` and press enter to get a listing of all files in the directory. + - `DCS-SR-ExternalAudio.exe` should be amongst them. + + ![powershell-2](../images/install/text-to-speech/powershell-2.png) + +- Now we are going to create a text-to-speech command which should be sent to + the radio on your airplane or helicopter. + - The parameter `-t` will define the text to send. + - The frequency will be defined with `-f`. Adopt it to match the frequency of + your airplane or helicopter! For example 251. + - And the modulation is set by `-m`. For example AM. + - Define the coalition with `-c`. 0 is Spectator, 1 is Red, 2 is Blue. + + `.\DCS-SR-ExternalAudio.exe -t "Hello Moosers" -f 251 -m AM -c 2` + + - The console output should look like this: + + ![powershell-3](../images/install/text-to-speech/powershell-3.png) + +**If you can hear the voice on the cockpit radio, you are done!** + +If you get UpnP/Network errors, you need to allow DCS-SR-ExternalAudio.exe to +traverse your firewall. + +{: .note } +> You can raun `DCS-SR-ExternalAudio.exe` without any parameters to get help. + +## Firewall Setup + +- On Windows search, type Firewall and open „Firewall- and Network Protection“. + Click on „Extended Setting“ (you need admin rights to do that). + +- You will need two incoming and two outgoing rules (4 overall), right-click on + incoming/outgoing rules to create new rules. + +- Give the rule a nice name: + +- Protocols and Services – you need to create ONE rule for TCP and another one + for UDP. Select TCP from the drop down: + +- On Programs and Services, enable 'this program' and use search to locate and + select DCS-SR-ExternalAudio.exe: + +- Click „ok“ to save and close the rule. + +- Repeat for UDP. + +- Repeat twice for outgoing, one for TCP and one for UDP. + +- You’re done and can return to 'Command line test'. + +## Google TTS + +- For Google TTS you need to have a Google Cloud Account (a testing one will do). + +- You can start here: + +- You need to create a projekt and enable the 'Cloud Text-To-Speech API' in it. + +- You also need to create a service-account and create a `.json` key file for it. + +There’s a lot of supporting information on the Google Cloud Site to help you +with that. Similar to 'Command line test', you can test your setup on the +command line. Here is an example that assumed your .json key file resides in the +SRS directory: + +`.\DCS-SR-ExternalAudio.exe -t "Hello Moosers" -f 251 -m AM -c 2 -z -G .\yourgoogleaccount.json` + +[Text-To-Speech]: https://en.wikipedia.org/wiki/Speech_synthesis +[DCS Simple Radio Standalone]: https://github.com/ciribob/DCS-SimpleRadioStandalone/releases/latest +[De-Sanitize the DCS scripting environment]: desanitize-dcs.md +[Notepad++]: https://notepad-plus-plus.org/downloads/ diff --git a/docs/beginner/index.md b/docs/beginner/index.md index a637bcc37..12d3a0f2b 100644 --- a/docs/beginner/index.md +++ b/docs/beginner/index.md @@ -1,5 +1,5 @@ --- -has_children: false +has_children: true nav_order: 2 --- diff --git a/docs/beginner/tipps-and-tricks.md b/docs/beginner/tipps-and-tricks.md new file mode 100644 index 000000000..3fa2d8bc2 --- /dev/null +++ b/docs/beginner/tipps-and-tricks.md @@ -0,0 +1,29 @@ +--- +parent: Beginner +nav_order: 99 +--- +# Tipps and tricks +{: .no_toc } + +1. Table of contents +{:toc} + +This section we put a lot of usefull informations needed by beginners. + +## Find the installation folder of DCS + +It depends on the platform and the version you choosed to install: + +- [DCS World Steam Edition]{:target="_blank"} from Steam. + - To find the folder right click on the game in Steam. + - Open Properties / Installed Files / Browse + +- [DCS World Standalone installer]{:target="_blank"} from Eagle Dynamics website. + - Default installation locations: + - Stable: C:\Program Files\Eagle Dynamics\DCS World + - OpenBeta: C:\Program Files\Eagle Dynamics\DCS World.Openbeta + - If you changed the installation folder of the Standalone version, right + click on the game icon, open Properties and click on `Open File Location`. + +[DCS World Steam Edition]: https://store.steampowered.com/app/223750/DCS_World_Steam_Edition/ +[DCS World Standalone installer]: https://www.digitalcombatsimulator.com/en/downloads/world/ diff --git a/docs/images/install/text-to-speech/powershell-1.png b/docs/images/install/text-to-speech/powershell-1.png new file mode 100644 index 000000000..cf7410c62 Binary files /dev/null and b/docs/images/install/text-to-speech/powershell-1.png differ diff --git a/docs/images/install/text-to-speech/powershell-2.png b/docs/images/install/text-to-speech/powershell-2.png new file mode 100644 index 000000000..7a9984bac Binary files /dev/null and b/docs/images/install/text-to-speech/powershell-2.png differ diff --git a/docs/images/install/text-to-speech/powershell-3.png b/docs/images/install/text-to-speech/powershell-3.png new file mode 100644 index 000000000..be27d5cfe Binary files /dev/null and b/docs/images/install/text-to-speech/powershell-3.png differ diff --git a/docs/images/install/text-to-speech/srs-client.png b/docs/images/install/text-to-speech/srs-client.png new file mode 100644 index 000000000..ce651bfeb Binary files /dev/null and b/docs/images/install/text-to-speech/srs-client.png differ diff --git a/docs/images/install/text-to-speech/srs-executables.png b/docs/images/install/text-to-speech/srs-executables.png new file mode 100644 index 000000000..c8f8541a7 Binary files /dev/null and b/docs/images/install/text-to-speech/srs-executables.png differ diff --git a/docs/images/install/text-to-speech/srs-overlay.png b/docs/images/install/text-to-speech/srs-overlay.png new file mode 100644 index 000000000..1da30bcc1 Binary files /dev/null and b/docs/images/install/text-to-speech/srs-overlay.png differ diff --git a/docs/images/install/text-to-speech/srs-server.png b/docs/images/install/text-to-speech/srs-server.png new file mode 100644 index 000000000..c28db354f Binary files /dev/null and b/docs/images/install/text-to-speech/srs-server.png differ diff --git a/docs/images/install/text-to-speech/srs-status-1.png b/docs/images/install/text-to-speech/srs-status-1.png new file mode 100644 index 000000000..08fbea678 Binary files /dev/null and b/docs/images/install/text-to-speech/srs-status-1.png differ diff --git a/docs/images/install/text-to-speech/srs-status-2.png b/docs/images/install/text-to-speech/srs-status-2.png new file mode 100644 index 000000000..400dc9402 Binary files /dev/null and b/docs/images/install/text-to-speech/srs-status-2.png differ