Skip to content
Permalink
Browse files

Merge pull request #1586 from RadWolfie/ds-globalfocus-option

DirectSound unfocus audible option + minor fixes
  • Loading branch information...
LukeUsher committed Apr 13, 2019
2 parents 8f50a2c + 82909b9 commit 670d90651c25a6a2c1cbc2d87f13745c4cd0d7a4
@@ -92,7 +92,6 @@
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>Include\Win32\Cxbx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d9.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr9.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx9.lib;dbghelp.lib;comctl32.lib;XINPUT9_1_0.LIB;tomcryptd.lib;tommath.lib;wpcap.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -163,7 +162,6 @@
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>Include\Win32\Cxbx;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalDependencies>legacy_stdio_definitions.lib;d3d9.lib;dinput8.lib;dxguid.lib;odbc32.lib;odbccp32.lib;Shlwapi.lib;dxerr9.lib;ws2_32.lib;dsound.lib;winmm.lib;ddraw.lib;d3dx9.lib;dbghelp.lib;comctl32.lib;XINPUT9_1_0.LIB;tomcrypt.lib;tommath.lib;wpcap.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -344,12 +342,7 @@
<None Include="..\..\src\devices\video\EmuNV2A_USER.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\resource\Cxbx.rc">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\cxbx\git\cxbx-ds\resource;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\cxbx\git\cxbx-ds\resource;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<ResourceCompile Include="..\..\resource\Cxbx.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\common\crypto\EmuDes.cpp" />
@@ -578,4 +571,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
@@ -54,12 +54,12 @@ BEGIN
IDD_AUDIO_CFG, DIALOG
BEGIN
END

IDD_NETWORK_CFG, DIALOG
BEGIN
BOTTOMMARGIN, 74
BOTTOMMARGIN, 74
END

IDD_EEPROM_CFG, DIALOG
BEGIN
END
@@ -282,8 +282,8 @@ BEGIN
COMBOBOX IDC_VC_DISPLAY_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_VC_D3D_DEVICE,76,31,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_VC_VIDEO_RESOLUTION,76,49,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Use Hardware Video Mode",IDC_CV_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,71,98,10
CONTROL "Force VSync",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,182,71,65,10
CONTROL "Use Exclusive Fullscreen Mode",IDC_CV_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,71,112,10
CONTROL "Force VSync",IDC_CV_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,193,71,58,10
PUSHBUTTON "Cancel",IDC_VC_CANCEL,146,102,50,14,BS_FLAT
PUSHBUTTON "Accept",IDC_VC_ACCEPT,206,102,50,14,BS_FLAT
GROUPBOX "Direct3D Configuration",IDC_STATIC,4,1,250,98,BS_CENTER
@@ -300,26 +300,28 @@ CAPTION "Cxbx-Reloaded : Audio Configuration"
FONT 8, "Verdana", 0, 0, 0x1
BEGIN
COMBOBOX IDC_AC_AUDIO_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable PCM",IDC_AC_PCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,36,54,10
CONTROL "Enable XADPCM",IDC_AC_XADPCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,48,69,10
CONTROL "Enable Unknown Codec",IDC_AC_UNKNOWN_CODEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,93,10
CONTROL "Enable PCM",IDC_AC_PCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,34,54,10
CONTROL "Enable XADPCM",IDC_AC_XADPCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,34,69,10
CONTROL "Enable Unknown Codec",IDC_AC_UNKNOWN_CODEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,45,93,10
PUSHBUTTON "Cancel",IDC_AC_CANCEL,146,102,50,14,BS_FLAT
PUSHBUTTON "Accept",IDC_AC_ACCEPT,206,102,50,14,BS_FLAT
GROUPBOX "DirectSound Configuration",IDC_STATIC,4,1,250,98,BS_CENTER
LTEXT "Audio Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT
LTEXT "Codec Options:",IDC_STATIC,13,34,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,60,57,8,0,WS_EX_RIGHT
CONTROL "Disable mute on unfocus",IDC_AC_MUTE_ON_UNFOCUS_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,97,10
END

IDD_NETWORK_CFG DIALOGEX 0, 0, 404, 76
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Network Configuration"
FONT 8, "Verdana", 0, 0, 0x1
BEGIN
PUSHBUTTON "Cancel", IDC_AC_CANCEL, 285, 51, 50, 14, BS_FLAT
PUSHBUTTON "Accept", IDC_AC_ACCEPT, 339, 51, 50, 14, BS_FLAT
GROUPBOX "Network Configuration", -1, 4, 1, 396, 69, BS_CENTER
LTEXT "Network Adapter", -1, 13, 14, 57, 8, 0, WS_EX_RIGHT
COMBOBOX IDC_NETWORK_ADAPTER, 14, 28, 374, 30, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Network Configuration"
FONT 8, "Verdana", 0, 0, 0x1
BEGIN
PUSHBUTTON "Cancel",IDC_AC_CANCEL,285,51,50,14,BS_FLAT
PUSHBUTTON "Accept",IDC_AC_ACCEPT,339,51,50,14,BS_FLAT
GROUPBOX "Network Configuration",-1,4,1,396,69,BS_CENTER
LTEXT "Network Adapter",-1,13,14,57,8,0,WS_EX_RIGHT
COMBOBOX IDC_NETWORK_ADAPTER,14,28,374,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END

IDD_EEPROM_CFG DIALOGEX 0, 0, 259, 279
@@ -445,6 +447,7 @@ END
//
// AFX_DIALOG_LAYOUT
//

IDD_NETWORK_CFG AFX_DIALOG_LAYOUT
BEGIN
0
@@ -475,6 +478,11 @@ BEGIN
0
END

IDD_VIDEO_CFG AFX_DIALOG_LAYOUT
BEGIN
0
END


/////////////////////////////////////////////////////////////////////////////
//
@@ -494,7 +502,7 @@ IDI_CXBX ICON "Cxbx-R.ico"

1 TEXTINCLUDE
BEGIN
"..\\src\\Cxbx\\ResCxbx.h\0"
"..\\src\\gui\\ResCxbx.h\0"
END

2 TEXTINCLUDE
@@ -592,7 +600,7 @@ BEGIN
MENUITEM MFT_SEPARATOR
MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Audio...", ID_SETTINGS_CONFIG_AUDIO,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Network...", ID_SETTINGS_CONFIG_NETWORK, MFT_STRING, MFS_ENABLED
MENUITEM "Config &Network...", ID_SETTINGS_CONFIG_NETWORK,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Eeprom...", ID_SETTINGS_CONFIG_EEPROM,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Logging...", ID_SETTINGS_CONFIG_LOGGING,MFT_STRING,MFS_ENABLED
POPUP "Config &Data Location...", 65535,MFT_STRING,MFS_ENABLED
@@ -601,10 +609,10 @@ BEGIN
MENUITEM "Store with Executable", ID_SETTINGS_CONFIG_DLOCEXECDIR,MFT_STRING,MFS_ENABLED
MENUITEM "Custom", ID_SETTINGS_CONFIG_DLOCCUSTOM,MFT_STRING,MFS_ENABLED
END
POPUP "&Symbol Cache", 65535,MFT_STRING,MFS_ENABLED
POPUP "&Symbol Cache", 65535,MFT_STRING,MFS_ENABLED
BEGIN
MENUITEM "&Clear entire Symbol Cache", ID_CACHE_CLEARHLECACHE_ALL,MFT_STRING,MFS_ENABLED
MENUITEM "&Rescan title Symbol Cache", ID_CACHE_CLEARHLECACHE_CURRENT,MFT_STRING,MFS_ENABLED
MENUITEM "&Clear entire Symbol Cache", ID_CACHE_CLEARHLECACHE_ALL,MFT_STRING,MFS_ENABLED
MENUITEM "&Rescan title Symbol Cache", ID_CACHE_CLEARHLECACHE_CURRENT,MFT_STRING,MFS_ENABLED
END
MENUITEM MFT_SEPARATOR
POPUP "&LLE (Experimental)", 65535,MFT_STRING,MFS_ENABLED
@@ -93,6 +93,7 @@ static struct {
const char* codec_pcm = "PCM";
const char* codec_xadpcm = "XADPCM";
const char* codec_unknown = "UnknownCodec";
const char* mute_on_unfocus = "MuteOnUnfocus";
} sect_audio_keys;

static const char* section_network = "network";
@@ -424,7 +425,9 @@ bool Settings::LoadConfig()

m_audio.codec_pcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_pcm, /*Default=*/true, nullptr);
m_audio.codec_xadpcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, /*Default=*/true, nullptr);
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);

m_audio.mute_on_unfocus = m_si.GetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, /*Default=*/true, nullptr);

// ==== Audio End ===========

@@ -574,6 +577,7 @@ bool Settings::Save(std::string file_path)
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_pcm, m_audio.codec_pcm, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, m_audio.codec_xadpcm, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_unknown, m_audio.codec_unknown, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, m_audio.mute_on_unfocus, nullptr, true);

// ==== Audio End ===========

@@ -170,7 +170,7 @@ class Settings
bool codec_pcm ;
bool codec_xadpcm;
bool codec_unknown;
bool Reserved4 = 0;
bool mute_on_unfocus;
int Reserved99[14] = { 0 };
} m_audio;

@@ -920,7 +920,8 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer)
}

DSBufferDesc.dwSize = sizeof(DSBUFFERDESC);
DSBufferDesc.dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLFREQUENCY;
DSBufferDesc.dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLFREQUENCY |
(g_XBAudio.mute_on_unfocus ? 0 : DSBCAPS_GLOBALFOCUS);

// TODO: Garbage Collection
*ppBuffer = new X_CDirectSoundBuffer();
@@ -1714,7 +1715,8 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream)
}
DSBufferDesc.dwSize = sizeof(DSBUFFERDESC);
//DSBufferDesc->dwFlags = (pdssd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2;
DSBufferDesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GETCURRENTPOSITION2; //aka DSBCAPS_DEFAULT + control position
DSBufferDesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GETCURRENTPOSITION2 | //aka DSBCAPS_DEFAULT + control position
(g_XBAudio.mute_on_unfocus ? 0 : DSBCAPS_GLOBALFOCUS);

if ((pdssd->dwFlags & DSBCAPS_CTRL3D) > 0) {
DSBufferDesc.dwFlags |= DSBCAPS_CTRL3D;
@@ -112,6 +112,8 @@ INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(GetDlgItem(hWndDlg, IDC_AC_XADPCM), BM_SETCHECK, (WPARAM)g_XBAudio.codec_xadpcm, 0);

SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_SETCHECK, (WPARAM)g_XBAudio.codec_unknown, 0);

SendMessage(GetDlgItem(hWndDlg, IDC_AC_MUTE_ON_UNFOCUS_DISABLE), BM_SETCHECK, (WPARAM)g_XBAudio.mute_on_unfocus==0, 0);
}
}
break;
@@ -165,6 +167,10 @@ INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_GETCHECK, 0, 0);

g_XBAudio.codec_unknown = (lRet == BST_CHECKED);

lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_MUTE_ON_UNFOCUS_DISABLE), BM_GETCHECK, 0, 0);

g_XBAudio.mute_on_unfocus = (lRet != BST_CHECKED);
}

/*! save audio configuration */
@@ -20,6 +20,7 @@
#define IDS_UEM 123
#define IDD_CONTROLLER_HOST_MAPPING 131
#define IDD_VIRTUAL_SBC_FEEDBACK 133
#define IDD_NETWORK_CFG 134
#define IDC_LOG_CANCEL 892
#define IDC_LOG_ACCEPT 893
#define IDC_LOG_ENABLE_GENERAL 894
@@ -185,6 +186,7 @@
#define ID_GUI_STATUS_LLE_FLAGS 1097
#define ID_GUI_STATUS_XBOX_LED_COLOUR 1098
#define ID_GUI_STATUS_LOG_ENABLED 1099
#define IDC_AC_MUTE_ON_UNFOCUS_DISABLE 1100
#define IDC_XBOX_PORT_0 1158
#define IDC_HOST_NOTCONNECT_0_0 1159
#define IDC_HOST_XINPUT_0_0 1160
@@ -296,6 +298,7 @@
#define IDC_EVENT_LV 1273
#define IDC_CXBXR_EVENTS 1274
#define IDC_KERNEL_EVENTS 1275
#define IDC_NETWORK_ADAPTER 1276
#define ID_FILE_EXIT 40005
#define ID_HELP_ABOUT 40008
#define ID_EMULATION_START 40009
@@ -350,14 +353,12 @@
#define ID_HACKS_SPEEDHACKS 40103
#define ID_SETTINGS_CONFIG_DLOCCUSTOM 40104
#define ID_SETTINGS_CONFIG_DLOCAPPDATA 40105
#define ID_SETTINGS_CONFIG_DLOCEXECDIR 40106
#define ID_SETTINGS_CONFIG_DLOCEXECDIR 40106
#define ID_SETTINGS_ALLOWADMINPRIVILEGE 40107
#define ID_SETTINGS_CONFIG_LOGGING 40108
#define ID_SYNC_CONFIG_LOGGING 40109
#define ID_LOG 40110
#define ID_SETTINGS_CONFIG_NETWORK 40111
#define IDC_NETWORK_ADAPTER 1276
#define IDD_NETWORK_CFG 40112
#define IDC_STATIC -1

// Next default values for new objects
@@ -366,7 +367,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 135
#define _APS_NEXT_COMMAND_VALUE 40113
#define _APS_NEXT_CONTROL_VALUE 1257
#define _APS_NEXT_SYMED_VALUE 104
#define _APS_NEXT_CONTROL_VALUE 1277
#define _APS_NEXT_SYMED_VALUE 109
#endif
#endif

0 comments on commit 670d906

Please sign in to comment.
You can’t perform that action at this time.