Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit 73087c6

Browse files
author
Ciaran Fisher
committed
Bug fix for Radio FX on windows 7
Bug fix for Windows 7 Radio FX Added FM/AM Switch for Mi-8 R-863
1 parent a9da59a commit 73087c6

File tree

8 files changed

+73
-21
lines changed

8 files changed

+73
-21
lines changed

Installer/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public partial class MainWindow
2727
{
2828
const string REG_PATH = "HKEY_CURRENT_USER\\SOFTWARE\\DCS-SimpleRadio";
2929

30-
const string version = "1.2.2";
30+
const string version = "1.2.3";
3131

3232
string currentPath;
3333
string currentDirectory;

Plugin/Plugin.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static SimpleRadio::Plugin plugin;
4141
namespace SimpleRadio
4242
{
4343
const char* Plugin::NAME = "DCS-SimpleRadio";
44-
const char* Plugin::VERSION = "1.2.2";
44+
const char* Plugin::VERSION = "1.2.3";
4545
const char* Plugin::AUTHOR = "Ciribob - GitHub.com/ciribob";
4646
const char* Plugin::DESCRIPTION = "DCS-SimpleRadio ";
4747
const char* Plugin::COMMAND_KEYWORD = "sr";
@@ -118,18 +118,14 @@ namespace SimpleRadio
118118
{
119119
this->switchToUnicast = false;
120120
}
121+
RegHelper helper;
122+
this->filter = helper.readRadioFXPreference();
121123

122-
int useFilters = GetPrivateProfileInt(_T("FILTERS"), _T("filter"), 0, this->getConfigPath());
123-
124-
if (useFilters == 1)
125-
{
126-
this->filter = true;
127-
}
128-
else
129-
{
130-
this->filter = false;
131-
}
124+
this->configureRadioFXMenu();
125+
}
132126

127+
void Plugin::configureRadioFXMenu()
128+
{
133129
if (this->filter)
134130
{
135131
this->disableMenuItem(3);
@@ -159,20 +155,23 @@ namespace SimpleRadio
159155

160156
}
161157

162-
void Plugin::writeFilterSetting(bool filterSetting) {
163-
if (filterSetting == 1)
158+
void Plugin::writeFilterSetting(bool filterSetting) {\
159+
RegHelper helper;
160+
if (filterSetting)
164161
{
165-
WritePrivateProfileString(_T("FILTERS"), _T("filter"), _T("1"), this->getConfigPath());
162+
helper.writeRadioFXPreference(filterSetting);
166163
this->teamspeak.printMessageToCurrentTab("Radio Effects Enabled");
167164
}
168165
else
169166
{
170-
WritePrivateProfileString(_T("FILTERS"), _T("filter"), _T("0"), this->getConfigPath());
167+
helper.writeRadioFXPreference(filterSetting);
171168
this->teamspeak.printMessageToCurrentTab("Radio Effects Disabled");
172169
}
173170

171+
this->filter = filterSetting;
172+
174173
//refresh after writing
175-
this->readSettings();
174+
this->configureRadioFXMenu();
176175
}
177176

178177
void Plugin::stop()

Plugin/Plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace SimpleRadio
4141
void start();
4242
LPCWSTR getConfigPath();
4343
void readSettings();
44+
void configureRadioFXMenu();
4445
void writeUnicastSetting(bool unicast);
4546
void writeFilterSetting(bool filterSetting);
4647
void stop();

Plugin/Plugin.rc

0 Bytes
Binary file not shown.

Plugin/RegHelper.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,44 @@ std::string RegHelper::readSRPath()
4949
return "";
5050

5151
}
52+
53+
void RegHelper::writeRadioFXPreference(bool radioFX)
54+
{
55+
HKEY hKey = 0;
56+
if (RegOpenKey(HKEY_CURRENT_USER, L"SOFTWARE\\DCS-SimpleRadio", &hKey) == ERROR_SUCCESS)
57+
{
58+
DWORD val = radioFX;
59+
60+
if (RegSetValueEx(hKey, L"RadioFX", 0, REG_DWORD, (PBYTE)&val, sizeof(DWORD)) != ERROR_SUCCESS)
61+
{
62+
63+
}
64+
65+
RegCloseKey(hKey);
66+
}
67+
}
68+
69+
70+
bool RegHelper::readRadioFXPreference()
71+
{
72+
bool radio = false;
73+
HKEY hKey = 0;
74+
if (RegOpenKey(HKEY_CURRENT_USER, L"SOFTWARE\\DCS-SimpleRadio", &hKey) == ERROR_SUCCESS)
75+
{
76+
DWORD dwType = REG_DWORD;
77+
DWORD reg_value, dw;
78+
79+
if (RegQueryValueEx(hKey, L"RadioFX", 0, &dwType, (LPBYTE)&reg_value, &dw) == ERROR_SUCCESS)
80+
{
81+
int regVal = (int)reg_value;
82+
83+
radio = regVal > 0;
84+
}
85+
86+
RegCloseKey(hKey);
87+
}
88+
89+
90+
return radio;
91+
92+
}

Plugin/RegHelper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ class RegHelper
1414

1515
std::string readSRPath();
1616

17+
void writeRadioFXPreference(bool radioFX);
18+
19+
bool readRadioFXPreference();
20+
1721
};
1822

RadioGui/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.2.2.0")]
55-
[assembly: AssemblyFileVersion("1.2.2.0")]
54+
[assembly: AssemblyVersion("1.2.3.0")]
55+
[assembly: AssemblyFileVersion("1.2.3.0")]

Scripts/DCS-SimpleRadio/SimpleRadioInit.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Version 1.2.2
1+
-- Version 1.2.3
22
SR = {}
33

44
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)
271271

272272
_data.radios[1].name = "R-863"
273273
_data.radios[1].frequency = SR.getRadioFrequency(38)
274-
_data.radios[1].modulation = 0
274+
275+
local _modulation = GetDevice(0):get_argument_value(369)
276+
if _modulation > 0.5 then
277+
_data.radios[1].modulation = 1
278+
else
279+
_data.radios[1].modulation = 0
280+
end
281+
275282
_data.radios[1].volume = SR.getRadioVolume(0, 156,{0.0,1.0},false)
276283

277284
_data.radios[2].name = "R-828"

0 commit comments

Comments
 (0)