diff --git a/Installer/MainWindow.xaml.cs b/Installer/MainWindow.xaml.cs index 2a95140..ca55b4a 100644 --- a/Installer/MainWindow.xaml.cs +++ b/Installer/MainWindow.xaml.cs @@ -27,7 +27,7 @@ public partial class MainWindow { const string REG_PATH = "HKEY_CURRENT_USER\\SOFTWARE\\DCS-SimpleRadio"; - const string version = "1.2.2"; + const string version = "1.2.3"; string currentPath; string currentDirectory; diff --git a/Plugin/Plugin.cpp b/Plugin/Plugin.cpp index 6fb3c3e..b8873aa 100644 --- a/Plugin/Plugin.cpp +++ b/Plugin/Plugin.cpp @@ -41,7 +41,7 @@ static SimpleRadio::Plugin plugin; namespace SimpleRadio { const char* Plugin::NAME = "DCS-SimpleRadio"; - const char* Plugin::VERSION = "1.2.2"; + const char* Plugin::VERSION = "1.2.3"; const char* Plugin::AUTHOR = "Ciribob - GitHub.com/ciribob"; const char* Plugin::DESCRIPTION = "DCS-SimpleRadio "; const char* Plugin::COMMAND_KEYWORD = "sr"; @@ -118,18 +118,14 @@ namespace SimpleRadio { this->switchToUnicast = false; } + RegHelper helper; + this->filter = helper.readRadioFXPreference(); - int useFilters = GetPrivateProfileInt(_T("FILTERS"), _T("filter"), 0, this->getConfigPath()); - - if (useFilters == 1) - { - this->filter = true; - } - else - { - this->filter = false; - } + this->configureRadioFXMenu(); + } + void Plugin::configureRadioFXMenu() + { if (this->filter) { this->disableMenuItem(3); @@ -159,20 +155,23 @@ namespace SimpleRadio } - void Plugin::writeFilterSetting(bool filterSetting) { - if (filterSetting == 1) + void Plugin::writeFilterSetting(bool filterSetting) {\ + RegHelper helper; + if (filterSetting) { - WritePrivateProfileString(_T("FILTERS"), _T("filter"), _T("1"), this->getConfigPath()); + helper.writeRadioFXPreference(filterSetting); this->teamspeak.printMessageToCurrentTab("Radio Effects Enabled"); } else { - WritePrivateProfileString(_T("FILTERS"), _T("filter"), _T("0"), this->getConfigPath()); + helper.writeRadioFXPreference(filterSetting); this->teamspeak.printMessageToCurrentTab("Radio Effects Disabled"); } + this->filter = filterSetting; + //refresh after writing - this->readSettings(); + this->configureRadioFXMenu(); } void Plugin::stop() diff --git a/Plugin/Plugin.h b/Plugin/Plugin.h index 58a78a0..2634f2d 100644 --- a/Plugin/Plugin.h +++ b/Plugin/Plugin.h @@ -41,6 +41,7 @@ namespace SimpleRadio void start(); LPCWSTR getConfigPath(); void readSettings(); + void configureRadioFXMenu(); void writeUnicastSetting(bool unicast); void writeFilterSetting(bool filterSetting); void stop(); diff --git a/Plugin/Plugin.rc b/Plugin/Plugin.rc index cb54477..caa973c 100644 Binary files a/Plugin/Plugin.rc and b/Plugin/Plugin.rc differ diff --git a/Plugin/RegHelper.cpp b/Plugin/RegHelper.cpp index 5c38d46..c47f49b 100644 --- a/Plugin/RegHelper.cpp +++ b/Plugin/RegHelper.cpp @@ -49,3 +49,44 @@ std::string RegHelper::readSRPath() return ""; } + +void RegHelper::writeRadioFXPreference(bool radioFX) +{ + HKEY hKey = 0; + if (RegOpenKey(HKEY_CURRENT_USER, L"SOFTWARE\\DCS-SimpleRadio", &hKey) == ERROR_SUCCESS) + { + DWORD val = radioFX; + + if (RegSetValueEx(hKey, L"RadioFX", 0, REG_DWORD, (PBYTE)&val, sizeof(DWORD)) != ERROR_SUCCESS) + { + + } + + RegCloseKey(hKey); + } +} + + +bool RegHelper::readRadioFXPreference() +{ + bool radio = false; + HKEY hKey = 0; + if (RegOpenKey(HKEY_CURRENT_USER, L"SOFTWARE\\DCS-SimpleRadio", &hKey) == ERROR_SUCCESS) + { + DWORD dwType = REG_DWORD; + DWORD reg_value, dw; + + if (RegQueryValueEx(hKey, L"RadioFX", 0, &dwType, (LPBYTE)®_value, &dw) == ERROR_SUCCESS) + { + int regVal = (int)reg_value; + + radio = regVal > 0; + } + + RegCloseKey(hKey); + } + + + return radio; + +} \ No newline at end of file diff --git a/Plugin/RegHelper.h b/Plugin/RegHelper.h index 62e649f..5ef432f 100644 --- a/Plugin/RegHelper.h +++ b/Plugin/RegHelper.h @@ -14,5 +14,9 @@ class RegHelper std::string readSRPath(); + void writeRadioFXPreference(bool radioFX); + + bool readRadioFXPreference(); + }; diff --git a/RadioGui/Properties/AssemblyInfo.cs b/RadioGui/Properties/AssemblyInfo.cs index 29c3938..3dbc460 100644 --- a/RadioGui/Properties/AssemblyInfo.cs +++ b/RadioGui/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.2.0")] -[assembly: AssemblyFileVersion("1.2.2.0")] +[assembly: AssemblyVersion("1.2.3.0")] +[assembly: AssemblyFileVersion("1.2.3.0")] diff --git a/Scripts/DCS-SimpleRadio/SimpleRadioInit.lua b/Scripts/DCS-SimpleRadio/SimpleRadioInit.lua index 50d775e..a6b60ac 100644 --- a/Scripts/DCS-SimpleRadio/SimpleRadioInit.lua +++ b/Scripts/DCS-SimpleRadio/SimpleRadioInit.lua @@ -1,4 +1,4 @@ --- Version 1.2.2 +-- Version 1.2.3 SR = {} SR.unicast = false -- if you've setup DCS Correctly and the plugin isn't talking to DCS, @@ -271,7 +271,14 @@ function SR.exportRadioMI8(_data) _data.radios[1].name = "R-863" _data.radios[1].frequency = SR.getRadioFrequency(38) - _data.radios[1].modulation = 0 + + local _modulation = GetDevice(0):get_argument_value(369) + if _modulation > 0.5 then + _data.radios[1].modulation = 1 + else + _data.radios[1].modulation = 0 + end + _data.radios[1].volume = SR.getRadioVolume(0, 156,{0.0,1.0},false) _data.radios[2].name = "R-828"