From c640e5c48043fe0fedad1440edc2531758d67d28 Mon Sep 17 00:00:00 2001 From: "Jules.A" Date: Thu, 1 Nov 2018 21:40:14 +0800 Subject: [PATCH] Winport wifi cleanups after 9d05935. Removes interface for setting wifi mode along with removing redundant code. --- desmume/src/frontend/windows/main.cpp | 27 ----------------------- desmume/src/frontend/windows/resource.h | 2 -- desmume/src/frontend/windows/resources.rc | 23 +++++++++---------- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index 9d1a0813c..947083e9d 100755 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -2234,7 +2234,6 @@ int _main() Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false; Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false; - CommonSettings.wifi.mode = (WifiCommInterfaceID)GetPrivateProfileInt("Wifi", "Mode", WifiCommInterfaceID_AdHoc, IniName); CommonSettings.wifi.infraBridgeAdapter = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName); osd = new OSDCLASS(-1); @@ -6210,8 +6209,6 @@ LRESULT CALLBACK MicrophoneSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - const bool isSocketsSupported = wifiHandler->IsSocketsSupported(); - const bool isPCapSupported = wifiHandler->IsPCapSupported(); const WifiEmulationLevel emulationLevel = wifiHandler->GetSelectedEmulationLevel(); switch(uMsg) @@ -6235,12 +6232,6 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hDlg, IDC_WIFI_ENABLED), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_WIFI_COMPAT), FALSE); #endif - if (isSocketsSupported && isPCapSupported) - CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE0 + CommonSettings.wifi.mode); - else if(isSocketsSupported) - CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE0); - else - CheckRadioButton(hDlg, IDC_WIFIMODE0, IDC_WIFIMODE1, IDC_WIFIMODE1); HWND deviceMenu = GetDlgItem(hDlg, IDC_BRIDGEADAPTER); int menuItemCount = ComboBox_GetCount(deviceMenu); @@ -6251,15 +6242,6 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM { ComboBox_DeleteString(deviceMenu, 0); } - - if (isPCapSupported) - { - deviceCount = wifiHandler->GetBridgeDeviceList(&deviceStringList); - } - else - { - SetDlgItemText(hDlg, IDC_WIFIMODE1, "Infrastructure (winpcap not loaded)"); - } if (deviceCount < 0) { @@ -6283,9 +6265,6 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM ComboBox_SetCurSel(deviceMenu, CommonSettings.wifi.infraBridgeAdapter); EnableWindow(deviceMenu, TRUE); } - - if (!isSocketsSupported) - EnableWindow(GetDlgItem(hDlg, IDC_WIFIMODE0), FALSE); } return TRUE; @@ -6318,12 +6297,6 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM wifiHandler->SetEmulationLevel(WifiEmulationLevel_Off); #endif - if (IsDlgButtonChecked(hDlg, IDC_WIFIMODE0)) - CommonSettings.wifi.mode = WifiCommInterfaceID_AdHoc; - else - CommonSettings.wifi.mode = WifiCommInterfaceID_Infrastructure; - WritePrivateProfileInt("Wifi", "Mode", CommonSettings.wifi.mode, IniName); - cur = GetDlgItem(hDlg, IDC_BRIDGEADAPTER); CommonSettings.wifi.infraBridgeAdapter = ComboBox_GetCurSel(cur); wifiHandler->SetBridgeDeviceIndex(CommonSettings.wifi.infraBridgeAdapter); diff --git a/desmume/src/frontend/windows/resource.h b/desmume/src/frontend/windows/resource.h index 6a5aee82a..17f478bd1 100644 --- a/desmume/src/frontend/windows/resource.h +++ b/desmume/src/frontend/windows/resource.h @@ -320,10 +320,8 @@ #define IDC_GGREEN 1005 #define IDC_ROTATE270 1006 #define IDC_GRED 1006 -#define IDC_WIFIMODE0 1006 #define IDC_ARM7BIOSBROWSE 1007 #define IDC_GYELLOW 1007 -#define IDC_WIFIMODE1 1007 #define IDC_MEMVIEWBOX 1008 #define IDC_GBLUE 1008 #define IDC_ADHOC_SERVER 1008 diff --git a/desmume/src/frontend/windows/resources.rc b/desmume/src/frontend/windows/resources.rc index 3d72208f0..3a0451311 100644 --- a/desmume/src/frontend/windows/resources.rc +++ b/desmume/src/frontend/windows/resources.rc @@ -142,7 +142,7 @@ BEGIN CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,71,79,10 CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,160,75,10 LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,13,85,165,11 - CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,200,34,98,10 + CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,200,34,98,10 CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,200,44,98,10 CONTROL "GPU Color Depth 15 bit",IDC_GPU_15BPP,"Button",BS_AUTORADIOBUTTON,200,54,98,10 COMBOBOX IDC_MULTISAMPLE_SIZE,95,144,84,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -1237,21 +1237,18 @@ BEGIN LTEXT "frames",IDC_STATIC,428,167,16,8 END -IDD_WIFISETTINGS DIALOGEX 0, 0, 331, 158 +IDD_WIFISETTINGS DIALOGEX 0, 0, 331, 114 STYLE DS_SETFONT | DS_CENTER | WS_CAPTION | WS_SYSMENU CAPTION "Wifi settings" FONT 8, "Ms Shell Dlg", 0, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,222,136,50,14 - PUSHBUTTON "Cancel",IDCANCEL,276,136,50,14 - GROUPBOX "Infrastructure settings",IDC_STATIC,6,76,319,54 - LTEXT "Bridge network adapter:",IDC_STATIC,12,94,306,8 - COMBOBOX IDC_BRIDGEADAPTER,12,106,306,45,CBS_DROPDOWNLIST | CBS_HASSTRINGS - GROUPBOX "Wifi mode",IDC_STATIC,6,22,318,48 - CONTROL "Ad-hoc",IDC_WIFIMODE0,"Button",BS_AUTORADIOBUTTON,12,40,306,10 - CONTROL "Infrastructure",IDC_WIFIMODE1,"Button",BS_AUTORADIOBUTTON,12,52,306,10 - CONTROL "Enable WiFi Emulation",IDC_WIFI_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,150,10 - CONTROL "Compatibility Mode",IDC_WIFI_COMPAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,6,150,10 + DEFPUSHBUTTON "OK",IDOK,220,93,50,14 + PUSHBUTTON "Cancel",IDCANCEL,275,93,50,14 + GROUPBOX "Infrastructure settings",IDC_STATIC,6,33,319,55 + LTEXT "Bridge network adapter:",IDC_STATIC,12,52,306,8 + COMBOBOX IDC_BRIDGEADAPTER,12,68,306,45,CBS_DROPDOWNLIST | CBS_HASSTRINGS + CONTROL "Enable WiFi Emulation",IDC_WIFI_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,13,84,10 + CONTROL "Compatibility Mode",IDC_WIFI_COMPAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,13,84,10 END IDD_INPUTCONFIG DIALOGEX 0, 0, 339, 148 @@ -1923,7 +1920,7 @@ BEGIN IDD_WIFISETTINGS, DIALOG BEGIN - BOTTOMMARGIN, 156 + BOTTOMMARGIN, 112 END IDD_INPUTCONFIG, DIALOG