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

Commit

Permalink
Bug fix for Radio FX on windows 7
Browse files Browse the repository at this point in the history
Bug fix for Windows 7 Radio FX
Added FM/AM Switch for Mi-8 R-863
  • Loading branch information
Ciaran Fisher committed Nov 19, 2015
1 parent a9da59a commit 73087c6
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Installer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
31 changes: 15 additions & 16 deletions Plugin/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions Plugin/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace SimpleRadio
void start();
LPCWSTR getConfigPath();
void readSettings();
void configureRadioFXMenu();
void writeUnicastSetting(bool unicast);
void writeFilterSetting(bool filterSetting);
void stop();
Expand Down
Binary file modified Plugin/Plugin.rc
Binary file not shown.
41 changes: 41 additions & 0 deletions Plugin/RegHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)&reg_value, &dw) == ERROR_SUCCESS)
{
int regVal = (int)reg_value;

radio = regVal > 0;
}

RegCloseKey(hKey);
}


return radio;

}
4 changes: 4 additions & 0 deletions Plugin/RegHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ class RegHelper

std::string readSRPath();

void writeRadioFXPreference(bool radioFX);

bool readRadioFXPreference();

};

4 changes: 2 additions & 2 deletions RadioGui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
11 changes: 9 additions & 2 deletions Scripts/DCS-SimpleRadio/SimpleRadioInit.lua
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 73087c6

Please sign in to comment.