From 5d973b2dec17d4326cf37b14d36c0b1b50567b0a Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Fri, 12 Apr 2019 13:44:07 -0500 Subject: [PATCH 1/4] fix Visual Studio resource generated files --- build/win32/Cxbx.vcxproj | 11 ++--------- resource/Cxbx.rc | 33 +++++++++++++++++---------------- src/gui/ResCxbx.h | 10 +++++----- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/build/win32/Cxbx.vcxproj b/build/win32/Cxbx.vcxproj index 181711879..8d3245e60 100644 --- a/build/win32/Cxbx.vcxproj +++ b/build/win32/Cxbx.vcxproj @@ -92,7 +92,6 @@ _DEBUG;%(PreprocessorDefinitions) 0x0409 - Include\Win32\Cxbx;%(AdditionalIncludeDirectories) 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) @@ -163,7 +162,6 @@ NDEBUG;%(PreprocessorDefinitions) 0x0409 - Include\Win32\Cxbx;%(AdditionalIncludeDirectories) 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) @@ -344,12 +342,7 @@ - - %(PreprocessorDefinitions) - \cxbx\git\cxbx-ds\resource;%(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - \cxbx\git\cxbx-ds\resource;%(AdditionalIncludeDirectories) - + @@ -578,4 +571,4 @@ - + \ No newline at end of file diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index d7558cc52..b5f3ab74a 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -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 @@ -311,15 +311,15 @@ BEGIN 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 +445,7 @@ END // // AFX_DIALOG_LAYOUT // + IDD_NETWORK_CFG AFX_DIALOG_LAYOUT BEGIN 0 @@ -592,7 +593,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 +602,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 diff --git a/src/gui/ResCxbx.h b/src/gui/ResCxbx.h index 7beaf5a7a..b8d01bfc4 100644 --- a/src/gui/ResCxbx.h +++ b/src/gui/ResCxbx.h @@ -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 @@ -296,6 +297,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 +352,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 +366,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 From 9d58043d414428dee09c10ce8b1c645a36d5685b Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Fri, 12 Apr 2019 15:01:53 -0500 Subject: [PATCH 2/4] fix generated resource file to use correct file path Thanks to ergo720 for bring it up. I may had not find the cause at all. --- resource/Cxbx.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index b5f3ab74a..1b98d67d9 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -495,7 +495,7 @@ IDI_CXBX ICON "Cxbx-R.ico" 1 TEXTINCLUDE BEGIN - "..\\src\\Cxbx\\ResCxbx.h\0" + "..\\src\\gui\\ResCxbx.h\0" END 2 TEXTINCLUDE From b19fc40ff1eaa2805b0032822aeecf392107d2d7 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Fri, 12 Apr 2019 15:25:28 -0500 Subject: [PATCH 3/4] rename Hardware Video to Exclusive Fullscreen --- resource/Cxbx.rc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index 1b98d67d9..f6ec0a41f 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -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 @@ -476,6 +476,11 @@ BEGIN 0 END +IDD_VIDEO_CFG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + ///////////////////////////////////////////////////////////////////////////// // From 82909b939ff002e101b12b737c92c7794439ba22 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Fri, 12 Apr 2019 16:00:11 -0500 Subject: [PATCH 4/4] add "Disable mute on unfocus" option to audio settings --- resource/Cxbx.rc | 10 ++++++---- src/common/Settings.cpp | 6 +++++- src/common/Settings.hpp | 2 +- src/core/hle/DSOUND/DirectSound/DirectSound.cpp | 6 ++++-- src/gui/DlgAudioConfig.cpp | 6 ++++++ src/gui/ResCxbx.h | 1 + 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index f6ec0a41f..19de88bef 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -300,14 +300,16 @@ 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 diff --git a/src/common/Settings.cpp b/src/common/Settings.cpp index 663c428f3..8d6c53301 100644 --- a/src/common/Settings.cpp +++ b/src/common/Settings.cpp @@ -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 =========== diff --git a/src/common/Settings.hpp b/src/common/Settings.hpp index 29c4a9fdd..8a747af42 100644 --- a/src/common/Settings.hpp +++ b/src/common/Settings.hpp @@ -170,7 +170,7 @@ public: bool codec_pcm ; bool codec_xadpcm; bool codec_unknown; - bool Reserved4 = 0; + bool mute_on_unfocus; int Reserved99[14] = { 0 }; } m_audio; diff --git a/src/core/hle/DSOUND/DirectSound/DirectSound.cpp b/src/core/hle/DSOUND/DirectSound/DirectSound.cpp index 8dc705e7f..01e26ac5c 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSound.cpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSound.cpp @@ -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; diff --git a/src/gui/DlgAudioConfig.cpp b/src/gui/DlgAudioConfig.cpp index 8554dd821..7f7b72f6c 100644 --- a/src/gui/DlgAudioConfig.cpp +++ b/src/gui/DlgAudioConfig.cpp @@ -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 */ diff --git a/src/gui/ResCxbx.h b/src/gui/ResCxbx.h index b8d01bfc4..5ee2bcaee 100644 --- a/src/gui/ResCxbx.h +++ b/src/gui/ResCxbx.h @@ -186,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