From b1650eb503fee4b5343853c6f3313cff50e3ed47 Mon Sep 17 00:00:00 2001 From: RedDevilus <24227051+RedDevilus@users.noreply.github.com> Date: Fri, 5 Nov 2021 15:30:52 +0100 Subject: [PATCH] PCSX2-GUI: Fix Groupboxes to align correctly Make things look more symmetrical and structured. Affects Audio Settings (SPU2) , Gamepad Settings (PAD) + Network and HDD Settings (DEV9). For audio settings the slider will no longer do 0.5 steps when you change from TimeStretch. Reduce max audio latency from 750 to 200 (less is better if your PC can handle it). Windows SPU2 codebase is in dire need of a rehaul on how it handles this behaviour (not convert it multiple times). --- pcsx2/PAD/Windows/PAD.rc | 60 +++++++++++++++++------------------ pcsx2/SPU2/Linux/Config.cpp | 2 +- pcsx2/SPU2/Linux/Config.h | 4 +-- pcsx2/SPU2/Windows/Config.cpp | 26 +++++++-------- pcsx2/SPU2/Windows/SPU2.rc | 43 +++++++++++++------------ 5 files changed, 68 insertions(+), 67 deletions(-) diff --git a/pcsx2/PAD/Windows/PAD.rc b/pcsx2/PAD/Windows/PAD.rc index 55b910772a..d4e157d048 100644 --- a/pcsx2/PAD/Windows/PAD.rc +++ b/pcsx2/PAD/Windows/PAD.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Anglais (�tats-Unis) resources +// English (United States) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -444,34 +444,35 @@ IDD_GENERAL DIALOGEX 0, 0, 424, 283 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Input APIs",IDC_STATIC,7,6,410,133 - GROUPBOX "Keyboard API",IDC_STATIC,16,16,192,51 + GROUPBOX "Input APIs",IDC_STATIC,7,0,410,133 + GROUPBOX "Keyboard API",IDC_STATIC,16,16,192,39 CONTROL "Windows messaging (Recommended)",IDC_KB_WM,"Button",BS_AUTORADIOBUTTON | WS_GROUP,22,28,137,10 CONTROL "Raw input",IDC_KB_RAW,"Button",BS_AUTORADIOBUTTON,22,40,112,10 - GROUPBOX "Game Device APIs",IDC_STATIC,16,70,191,62 - CONTROL "DirectInput (Legacy)",IDC_G_DI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,82,100,10 - CONTROL "XInput (Modern)",IDC_G_XI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,94,100,10 - CONTROL "DualShock 3 native mode (Requires libusb)",IDC_G_DS3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,106,155,10 - CONTROL "Monitor when in background",IDC_BACKGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,118,107,10 - GROUPBOX "Mouse API", IDC_STATIC, 216, 16, 192, 58 - CONTROL "Windows messaging (Recommended)", IDC_M_WM, "Button", BS_AUTORADIOBUTTON | WS_GROUP, 223, 27, 137, 10 - CONTROL "Raw input", IDC_M_RAW, "Button", BS_AUTORADIOBUTTON, 223, 39, 112, 10 - CONTROL "Disable", IDC_M_DISABLE, "Button", BS_AUTORADIOBUTTON, 223, 51, 39, 10 - CONTROL "Start without mouse focus", IDC_MOUSE_UNFOCUS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 223, 63, 98, 10 - GROUPBOX "Pads", IDC_STATIC, 7, 142, 410, 62 - CONTROL "Port 1 Multitap", IDC_MULTITAP1, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 152, 63, 10 - CONTROL "Port 2 Multitap", IDC_MULTITAP2, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 164, 63, 10 - CONTROL "Multiple bindings", IDC_MULTIPLE_BINDING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 176, 66, 10 - CONTROL "", IDC_PAD_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_TABSTOP, 81, 151, 183, 48, WS_EX_CLIENTEDGE - COMBOBOX IDC_PAD_TYPE, 270, 151, 140, 118, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Device Diagnostics", IDC_STATIC, 78, 206, 264, 74 - CONTROL "", IDC_DIAG_LIST, "SysListView32", LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 84, 217, 252, 57, WS_EX_CLIENTEDGE - GROUPBOX "Hacks and advanced features", IDC_STATIC, 216, 75, 192, 57 - CONTROL "Enable logging", IDC_DEBUG_FILE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 223, 88, 79, 10 - CONTROL "Guitar Hero 2 Hack", IDC_GH2_HACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 223, 100, 79, 10 - PUSHBUTTON "Restore Defaults", ID_RESTORE_DEFAULTS, 306, 168, 62, 15 - PUSHBUTTON "Load Bindings", ID_LOAD, 271, 186, 62, 15 - PUSHBUTTON "Save Bindings", ID_SAVE, 345, 186, 62, 15 + GROUPBOX "Game Device APIs",IDC_STATIC,16,59,191,62 + CONTROL "DirectInput (Legacy)",IDC_G_DI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,71,100,10 + CONTROL "XInput (Modern)",IDC_G_XI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,82,100,10 + CONTROL "DualShock 3 native mode (Requires libusb)",IDC_G_DS3, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,94,155,10 + CONTROL "Monitor when in background",IDC_BACKGROUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,105,107,10 + GROUPBOX "Mouse API",IDC_STATIC,216,16,192,61 + CONTROL "Windows messaging (Recommended)",IDC_M_WM,"Button",BS_AUTORADIOBUTTON | WS_GROUP,223,27,137,10 + CONTROL "Raw input",IDC_M_RAW,"Button",BS_AUTORADIOBUTTON,223,39,112,10 + CONTROL "Disable",IDC_M_DISABLE,"Button",BS_AUTORADIOBUTTON,223,51,39,10 + CONTROL "Start without mouse focus",IDC_MOUSE_UNFOCUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,63,98,10 + GROUPBOX "Pads",IDC_STATIC,7,142,410,62 + CONTROL "Port 1 Multitap",IDC_MULTITAP1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,152,63,10 + CONTROL "Port 2 Multitap",IDC_MULTITAP2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,164,63,10 + CONTROL "Multiple bindings",IDC_MULTIPLE_BINDING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,176,66,10 + CONTROL "",IDC_PAD_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_TABSTOP,81,151,183,48,WS_EX_CLIENTEDGE + COMBOBOX IDC_PAD_TYPE,270,151,140,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Device Diagnostics",IDC_STATIC,78,206,264,74 + CONTROL "",IDC_DIAG_LIST,"SysListView32",LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,84,217,252,57,WS_EX_CLIENTEDGE + GROUPBOX "Hacks and advanced features",IDC_STATIC,216,82,192,39 + CONTROL "Enable logging",IDC_DEBUG_FILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,94,79,10 + CONTROL "Guitar Hero 2 Hack",IDC_GH2_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,223,106,79,10 + PUSHBUTTON "Restore Defaults",ID_RESTORE_DEFAULTS,306,168,62,15 + PUSHBUTTON "Load Bindings",ID_LOAD,271,186,62,15 + PUSHBUTTON "Save Bindings",ID_SAVE,345,186,62,15 END IDD_DIAG DIALOGEX 0, 0, 190, 178 @@ -560,7 +561,7 @@ IDR_INI1 RCDATA "Default.ini" // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -#endif // Anglais (�tats-Unis) resources +#endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// @@ -573,5 +574,4 @@ IDR_INI1 RCDATA "Default.ini" ///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +#endif // not APSTUDIO_INVOKED \ No newline at end of file diff --git a/pcsx2/SPU2/Linux/Config.cpp b/pcsx2/SPU2/Linux/Config.cpp index 6b6aeb649b..9b149e9492 100644 --- a/pcsx2/SPU2/Linux/Config.cpp +++ b/pcsx2/SPU2/Linux/Config.cpp @@ -183,7 +183,7 @@ void WriteSettings() } CfgWriteInt(L"MIXING", L"Interpolation", Interpolation); - CfgWriteInt(L"MIXING", L"FinalVolume", (int)(FinalVolume * 100 + 0.5f)); + CfgWriteInt(L"MIXING", L"FinalVolume", (int)(FinalVolume * 100)); CfgWriteBool(L"MIXING", L"AdvancedVolumeControl", AdvancedVolumeControl); CfgWriteFloat(L"MIXING", L"VolumeAdjustC(dB)", VolumeAdjustCdb); diff --git a/pcsx2/SPU2/Linux/Config.h b/pcsx2/SPU2/Linux/Config.h index f2cb68eb5d..aa080fc9cd 100644 --- a/pcsx2/SPU2/Linux/Config.h +++ b/pcsx2/SPU2/Linux/Config.h @@ -1,5 +1,5 @@ /* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2020 PCSX2 Dev Team + * Copyright (C) 2002-2021 PCSX2 Dev Team * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- @@ -86,7 +86,7 @@ extern u32 SdlOutputAPI; #ifdef PCSX2_DEVBUILD const int LATENCY_MAX = 3000; #else -const int LATENCY_MAX = 750; +const int LATENCY_MAX = 200; #endif const int LATENCY_MIN = 3; diff --git a/pcsx2/SPU2/Windows/Config.cpp b/pcsx2/SPU2/Windows/Config.cpp index 55e9a7d0a6..bf46cb3855 100644 --- a/pcsx2/SPU2/Windows/Config.cpp +++ b/pcsx2/SPU2/Windows/Config.cpp @@ -20,7 +20,7 @@ #ifdef PCSX2_DEVBUILD static const int LATENCY_MAX = 3000; #else -static const int LATENCY_MAX = 750; +static const int LATENCY_MAX = 200; #endif static const int LATENCY_MIN = 3; @@ -151,7 +151,7 @@ void WriteSettings() { CfgWriteInt(L"MIXING", L"Interpolation", Interpolation); - CfgWriteInt(L"MIXING", L"FinalVolume", (int)(FinalVolume * 100 + 0.5f)); + CfgWriteInt(L"MIXING", L"FinalVolume", (int)(FinalVolume * 100)); CfgWriteBool(L"MIXING", L"AdvancedVolumeControl", AdvancedVolumeControl); CfgWriteFloat(L"MIXING", L"VolumeAdjustC(dB)", VolumeAdjustCdb); @@ -236,16 +236,16 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } SendDialogMsg(hWnd, IDC_OUTPUT, CB_SETCURSEL, OutputModule, 0); - double minlat = (SynchMode == 0) ? LATENCY_MIN_TS : LATENCY_MIN; + float minlat = (SynchMode == 0) ? LATENCY_MIN_TS : LATENCY_MIN; int minexp = (int)(pow(minlat + 1, 1.0 / 3.0) * 128.0); - int maxexp = (int)(pow((double)LATENCY_MAX + 2, 1.0 / 3.0) * 128.0); - INIT_SLIDER(IDC_LATENCY_SLIDER, minexp, maxexp, 200, 13, 15); + int maxexp = (int)(pow((float)LATENCY_MAX + 1, 1.0 / 3.0) * 128.0); + INIT_SLIDER(IDC_LATENCY_SLIDER, minexp, maxexp, 54, 10, 11); - SendDialogMsg(hWnd, IDC_LATENCY_SLIDER, TBM_SETPOS, TRUE, (int)((pow((double)SndOutLatencyMS, 1.0 / 3.0) * 128.0) + 1)); + SendDialogMsg(hWnd, IDC_LATENCY_SLIDER, TBM_SETPOS, TRUE, (int)((pow((float)SndOutLatencyMS, 1.0 / 3.0) * 128.0) + 1)); swprintf_s(temp, L"%d ms (avg)", SndOutLatencyMS); SetWindowText(GetDlgItem(hWnd, IDC_LATENCY_LABEL), temp); - int configvol = (int)(FinalVolume * 100 + 0.5f); + int configvol = (int)(FinalVolume * 100); INIT_SLIDER(IDC_VOLUME_SLIDER, 0, 100, 10, 5, 1); SendDialogMsg(hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, configvol); @@ -270,7 +270,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { case IDOK: { - double res = ((int)SendDialogMsg(hWnd, IDC_LATENCY_SLIDER, TBM_GETPOS, 0, 0)) / 128.0; + float res = ((int)SendDialogMsg(hWnd, IDC_LATENCY_SLIDER, TBM_GETPOS, 0, 0)) / 128.0; SndOutLatencyMS = (int)pow(res, 3.0); Clampify(SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX); FinalVolume = (float)(SendDialogMsg(hWnd, IDC_VOLUME_SLIDER, TBM_GETPOS, 0, 0)) / 100; @@ -320,13 +320,13 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (wmEvent == CBN_SELCHANGE) { int sMode = (int)SendDialogMsg(hWnd, IDC_SYNCHMODE, CB_GETCURSEL, 0, 0); - double minlat = (sMode == 0) ? LATENCY_MIN_TS : LATENCY_MIN; + float minlat = (sMode == 0) ? LATENCY_MIN_TS : LATENCY_MIN; int minexp = (int)(pow(minlat + 1, 1.0 / 3.0) * 128.0); - int maxexp = (int)(pow((double)LATENCY_MAX + 2, 1.0 / 3.0) * 128.0); - INIT_SLIDER(IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 1); + int maxexp = (int)(pow((float)LATENCY_MAX + 1, 1.0 / 3.0) * 128.0); + INIT_SLIDER(IDC_LATENCY_SLIDER, minexp, maxexp, 54, 10, 11); int curpos = (int)SendMessage(GetDlgItem(hWnd, IDC_LATENCY_SLIDER), TBM_GETPOS, 0, 0); - double res = pow(curpos / 128.0, 3.0); + float res = pow(curpos / 128.0, 3.0); curpos = (int)res; swprintf_s(temp, L"%d ms (avg)", curpos); SetDlgItemText(hWnd, IDC_LATENCY_LABEL, temp); @@ -379,7 +379,7 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (hwndDlg == GetDlgItem(hWnd, IDC_LATENCY_SLIDER)) { - double res = pow(curpos / 128.0, 3.0); + float res = pow(curpos / 128.0, 3.0); curpos = (int)res; swprintf_s(temp, L"%d ms (avg)", curpos); SetDlgItemText(hWnd, IDC_LATENCY_LABEL, temp); diff --git a/pcsx2/SPU2/Windows/SPU2.rc b/pcsx2/SPU2/Windows/SPU2.rc index ec76abd78f..00e1d2f62f 100644 --- a/pcsx2/SPU2/Windows/SPU2.rc +++ b/pcsx2/SPU2/Windows/SPU2.rc @@ -24,36 +24,36 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog // -IDD_CONFIG DIALOGEX 0, 0, 311, 194 +IDD_CONFIG DIALOGEX 0, 0, 325, 195 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Audio Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN - PUSHBUTTON "OK",IDOK,102,174,50,14,NOT WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,156,174,50,14,NOT WS_TABSTOP - GROUPBOX "Mixing Settings",IDC_STATIC,6,5,151,115 + PUSHBUTTON "OK",IDOK,113,174,50,14,NOT WS_TABSTOP + PUSHBUTTON "Cancel",IDCANCEL,173,174,50,14,NOT WS_TABSTOP + GROUPBOX "Mixing Settings",IDC_STATIC,6,5,157,115 LTEXT "Interpolation:",IDC_STATIC,12,16,61,10,NOT WS_GROUP COMBOBOX IDC_INTERPOLATE,12,26,142,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_STATIC,3,124,154,45 + GROUPBOX "",IDC_STATIC,6,124,157,45 CHECKBOX "Enable Debug Options",IDC_DEBUG_ENABLE,11,135,118,10,NOT WS_TABSTOP PUSHBUTTON "Configure...",IDC_OPEN_CONFIG_DEBUG,11,147,52,13 - GROUPBOX "Output Settings",IDC_STATIC,165,5,141,164 - LTEXT "Module:",IDC_STATIC,171,16,50,9,NOT WS_GROUP - COMBOBOX IDC_OUTPUT,173,26,130,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_OUTCONF,173,42,52,13 - LTEXT "Volume:",IDC_STATIC,200,61,27,8,NOT WS_GROUP - CTEXT "100%",IDC_VOLUME_LABEL,234,61,58,9 - CONTROL "",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,170,72,129,10 - LTEXT "Latency:",IDC_STATIC,196,86,29,8,NOT WS_GROUP - CTEXT "100 ms (avg)",IDC_LATENCY_LABEL,233,86,58,9 - CONTROL "Slider2",IDC_LATENCY_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,173,96,129,10 + GROUPBOX "Output Settings",IDC_STATIC,173,5,145,164 + LTEXT "Module:",IDC_STATIC,179,16,50,9,NOT WS_GROUP + COMBOBOX IDC_OUTPUT,179,26,130,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_OUTCONF,179,42,52,13 + LTEXT "Volume:",IDC_STATIC,204,61,27,8,NOT WS_GROUP + CTEXT "100%",IDC_VOLUME_LABEL,242,61,58,9 + CONTROL "",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,181,72,129,10 + LTEXT "Latency:",IDC_STATIC,204,86,29,8,NOT WS_GROUP + CTEXT "100 ms (avg)",IDC_LATENCY_LABEL,241,86,58,9 + CONTROL "Slider2",IDC_LATENCY_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,181,96,129,10 CONTROL "Synchronizing Mode:",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,12,42,133,8 - COMBOBOX IDC_SYNCHMODE,12,54,129,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SYNCHMODE,12,54,142,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Advanced...",IDC_OPEN_CONFIG_SOUNDTOUCH,12,72,52,13 LTEXT "Audio Expansion Mode:",IDC_SPEAKERS_TEXT,12,90,137,10,NOT WS_GROUP - COMBOBOX IDC_SPEAKERS,12,102,129,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Use a Winamp DSP plugin",IDC_DSP_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,173,110,129,11 - LTEXT "(currently requires manual configuration via the ini file)",IDC_STATIC,185,122,100,20 + COMBOBOX IDC_SPEAKERS,12,102,142,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Use a Winamp DSP plugin",IDC_DSP_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,110,129,11 + LTEXT "(currently requires manual configuration via the ini file)",IDC_STATIC,193,122,100,20 END IDD_DEBUG DIALOGEX 0, 0, 303, 473 @@ -127,9 +127,10 @@ BEGIN IDD_CONFIG, DIALOG BEGIN LEFTMARGIN, 6 - RIGHTMARGIN, 310 + RIGHTMARGIN, 324 VERTGUIDE, 218 VERTGUIDE, 282 + BOTTOMMARGIN, 194 END IDD_DEBUG, DIALOG @@ -139,7 +140,7 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 465 END - + IDD_CONFIG_SOUNDTOUCH, DIALOG BEGIN LEFTMARGIN, 5