DEV9: Switch Windows config dialog to wx

This commit is contained in:
TellowKrinkle 2021-05-06 20:08:15 -05:00 committed by tellowkrinkle
parent 85bc4f1027
commit e068d24920
10 changed files with 11 additions and 746 deletions

View File

@ -77,7 +77,6 @@ if(WIN32)
GS/GS.rc
PAD/Windows/PAD.rc
SPU2/Windows/SPU2.rc
DEV9/Win32/DEV9ghzdrk.rc
USB/usb-pad/dx/versionproxy.rc
USB/usb-pad/raw/raw-config.rc
windows/wxResources.rc
@ -346,6 +345,7 @@ set(pcsx2DEV9Sources
DEV9/PacketReader/IP/IP_Packet.cpp
DEV9/PacketReader/EthernetFrame.cpp
DEV9/PacketReader/NetLib.cpp
DEV9/ConfigUI.cpp
DEV9/smap.cpp
DEV9/DEV9.cpp
DEV9/DEV9Config.cpp
@ -755,11 +755,9 @@ if(WIN32)
DEV9/Win32/DEV9WinConfig.cpp
DEV9/Win32/pcap_io_win32.cpp
DEV9/Win32/tap-win32.cpp
DEV9/Win32/Win32.cpp
)
list(APPEND pcsx2DEV9Headers
DEV9/Win32/pcap_io_win32_funcs.h
DEV9/Win32/resource.h
DEV9/Win32/tap.h
)
@ -833,7 +831,6 @@ else(WIN32)
list(APPEND pcsx2DEV9Sources
DEV9/Linux/Config.cpp
DEV9/Linux/Linux.cpp
)
list(APPEND pcsx2USBSources

View File

@ -27,15 +27,14 @@
#include <wx/spinctrl.h>
#include <wx/gbsizer.h>
#include "DEV9/Config.h"
#include "DEV9/DEV9.h"
#include "pcap.h"
#include "DEV9/pcap_io.h"
#include "DEV9/net.h"
#include "DEV9/PacketReader/IP/IP_Address.h"
#include "Config.h"
#include "DEV9.h"
#include "pcap_io.h"
#include "net.h"
#include "PacketReader/IP/IP_Address.h"
#include "gui/AppCoreThread.h"
#include "DEV9/ATA/HddCreate.h"
#include "ATA/HddCreate.h"
using PacketReader::IP::IP_Address;

View File

@ -160,11 +160,6 @@ EXTERN int ThreadRun;
extern std::string s_strIniPath;
extern std::string s_strLogPath;
#ifdef _WIN32
//Use own SysMessage for narrow char support
void SysMessage(char* fmt, ...);
#endif
#define DEV9_R_REV 0x1f80146e

View File

@ -1,143 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Spanish (Argentina) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS)
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_ARGENTINA
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONFIG DIALOGEX 0, 0, 291, 320
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Network and HDD Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,92,300,50,14
PUSHBUTTON "Cancel",IDCANCEL,148,300,50,14
LTEXT "DEV9 Type:",IDC_STATIC,15,10,41,11,SS_CENTERIMAGE
COMBOBOX IDC_BAYTYPE,61,8,223,47,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED
GROUPBOX "Ethernet",IDC_STATIC,7,30,277,164
CONTROL "Enabled",IDC_ETHENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,45,42,8
LTEXT "Ethernet Device:",IDC_STATIC,26,60,60,8,SS_CENTERIMAGE
COMBOBOX IDC_ETHDEV,94,58,182,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Hard Disk Drive",IDC_STATIC,7,205,277,85
CONTROL "Enabled",IDC_HDDENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,220,42,8
LTEXT "HDD File:",IDC_STATIC,26,235,60,8,SS_CENTERIMAGE
EDITTEXT IDC_HDDFILE,94,233,130,13,ES_AUTOHSCROLL
CONTROL "",IDC_HDDSIZE_SLIDER,"msctls_trackbar32",WS_TABSTOP,90,256,150,15
LTEXT "HDD Size (GiB):",IDC_STATIC,26,258,60,8,SS_CENTERIMAGE
EDITTEXT IDC_HDDSIZE_TEXT,240,256,25,13,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_HDDSIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,265,256,11,13
LTEXT "40 GiB",IDC_STATIC,86,273,21,8
LTEXT "120 GiB",IDC_STATIC,219,272,25,8,0,WS_EX_RIGHT
PUSHBUTTON "Browse",IDC_BROWSE,226,232,50,15
CONTROL "",IDC_IPADDRESS_IP,"SysIPAddress32",WS_TABSTOP,95,91,100,14
LTEXT "Intercept DHCP:",IDC_STATIC,26,77,60,8,SS_CENTERIMAGE
LTEXT "PS2 Address:",IDC_STATIC,26,89,60,16,SS_CENTERIMAGE
CONTROL "Enabled",IDC_CHECK_DHCP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,77,41,10
CONTROL "",IDC_IPADDRESS_SUBNET,"SysIPAddress32",WS_TABSTOP,95,111,100,14
LTEXT "Subnet Mask:",IDC_STATIC,26,109,60,16,SS_CENTERIMAGE
CONTROL "",IDC_IPADDRESS_GATEWAY,"SysIPAddress32",WS_TABSTOP,95,130,100,14
LTEXT "Gateway Address:",IDC_STATIC,26,128,60,16,SS_CENTERIMAGE
CONTROL "",IDC_IPADDRESS_DNS1,"SysIPAddress32",WS_TABSTOP,95,149,100,14
LTEXT "DNS1 Address:",IDC_STATIC,26,147,60,16,SS_CENTERIMAGE
CONTROL "",IDC_IPADDRESS_DNS2,"SysIPAddress32",WS_TABSTOP,95,168,100,14
LTEXT "DNS2 Address:",IDC_STATIC,26,166,60,16,SS_CENTERIMAGE
CONTROL "Auto",IDC_CHECK_SUBNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,109,31,16
CONTROL "Auto",IDC_CHECK_GATEWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,128,31,16
CONTROL "Auto",IDC_CHECK_DNS1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,147,31,16
CONTROL "Auto",IDC_CHECK_DNS2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,166,31,16
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_CONFIG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 285
TOPMARGIN, 7
BOTTOMMARGIN, 314
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// AFX_DIALOG_LAYOUT
//
IDD_CONFIG AFX_DIALOG_LAYOUT
BEGIN
0
END
#endif // Spanish (Argentina) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,520 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2020 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-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "PrecompiledHeader.h"
#include <stdio.h>
#include <commdlg.h>
#include <commctrl.h>
#include <string>
#include "ghc/filesystem.h"
#include "fmt/format.h"
#include "DEV9/Config.h"
#include "resource.h"
#include "DEV9/DEV9.h"
#include "DEV9/pcap_io.h"
#include "DEV9/net.h"
#include "DEV9/PacketReader\IP\IP_Address.h"
#include "tap.h"
#include "gui/AppCoreThread.h"
#include "DEV9/ATA/HddCreate.h"
using PacketReader::IP::IP_Address;
extern HINSTANCE hInst;
//HANDLE handleDEV9Thread = NULL;
//DWORD dwThreadId, dwThrdParam;
std::vector<AdapterEntry> adapters;
void SysMessage(char* fmt, ...)
{
va_list list;
char tmp[512];
va_start(list, fmt);
vsprintf(tmp, fmt, list);
va_end(list);
MessageBoxA(0, tmp, "Dev9 Msg", 0);
}
void IPControl_SetValue(HWND hwndCtl, IP_Address value)
{
int tmp = MAKEIPADDRESS(value.bytes[0], value.bytes[1], value.bytes[2], value.bytes[3]);
SendMessage(hwndCtl, IPM_SETADDRESS, (WPARAM)0, (LPARAM)tmp);
}
IP_Address IPControl_GetValue(HWND hwndCtl)
{
int tmp;
SendMessage(hwndCtl, IPM_GETADDRESS, (WPARAM)0, (LPARAM)&tmp);
IP_Address ret;
ret.bytes[0] = FIRST_IPADDRESS(tmp);
ret.bytes[1] = SECOND_IPADDRESS(tmp);
ret.bytes[2] = THIRD_IPADDRESS(tmp);
ret.bytes[3] = FOURTH_IPADDRESS(tmp);
return ret;
}
void IPControl_Enable(HWND hwndCtl, bool enabled, IP_Address value)
{
if (enabled)
{
EnableWindow(hwndCtl, true);
IPControl_SetValue(hwndCtl, value);
}
else
{
EnableWindow(hwndCtl, false);
IPControl_SetValue(hwndCtl, {0});
}
}
void AutoMaskChanged(HWND hW)
{
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_SUBNET), !Button_GetCheck(GetDlgItem(hW, IDC_CHECK_SUBNET)), config.Mask);
}
void AutoGatewayChanged(HWND hW)
{
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_GATEWAY), !Button_GetCheck(GetDlgItem(hW, IDC_CHECK_GATEWAY)), config.Gateway);
}
void AutoDNS1Changed(HWND hW)
{
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_DNS1), !Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DNS1)), config.DNS1);
}
void AutoDNS2Changed(HWND hW)
{
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_DNS2), !Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DNS2)), config.DNS2);
}
void InterceptChanged(HWND hW)
{
if (Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DHCP)))
{
EnableWindow(GetDlgItem(hW, IDC_IPADDRESS_IP), true);
IPControl_SetValue(GetDlgItem(hW, IDC_IPADDRESS_IP), config.PS2IP);
Button_Enable(GetDlgItem(hW, IDC_CHECK_SUBNET), true);
Button_Enable(GetDlgItem(hW, IDC_CHECK_GATEWAY), true);
Button_Enable(GetDlgItem(hW, IDC_CHECK_DNS1), true);
Button_Enable(GetDlgItem(hW, IDC_CHECK_DNS2), true);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_SUBNET), config.AutoMask);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_GATEWAY), config.AutoGateway);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_DNS1), config.AutoDNS1);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_DNS2), config.AutoDNS2);
AutoMaskChanged(hW);
AutoGatewayChanged(hW);
AutoDNS1Changed(hW);
AutoDNS2Changed(hW);
}
else
{
EnableWindow(GetDlgItem(hW, IDC_IPADDRESS_IP), false);
IPControl_SetValue(GetDlgItem(hW, IDC_IPADDRESS_IP), {0});
Button_Enable(GetDlgItem(hW, IDC_CHECK_SUBNET), false);
Button_Enable(GetDlgItem(hW, IDC_CHECK_GATEWAY), false);
Button_Enable(GetDlgItem(hW, IDC_CHECK_DNS1), false);
Button_Enable(GetDlgItem(hW, IDC_CHECK_DNS2), false);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_SUBNET), true);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_GATEWAY), true);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_DNS1), true);
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_DNS2), true);
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_SUBNET), false, config.Mask);
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_GATEWAY), false, config.Gateway);
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_DNS1), false, config.DNS1);
IPControl_Enable(GetDlgItem(hW, IDC_IPADDRESS_DNS2), false, config.DNS2);
}
}
void OnInitDialog(HWND hW)
{
//int i;
LoadConf();
ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "Expansion");
ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "PC Card");
std::vector<AdapterEntry> tapAdapters = TAPAdapter::GetAdapters();
std::vector<AdapterEntry> pcapAdapters = PCAPAdapter::GetAdapters();
adapters.reserve(tapAdapters.size() + pcapAdapters.size());
adapters.insert(adapters.end(), tapAdapters.begin(), tapAdapters.end());
adapters.insert(adapters.end(), pcapAdapters.begin(), pcapAdapters.end());
for (size_t i = 0; i < adapters.size(); i++)
{
std::wstring dev = fmt::format(L"{}: {}", (wchar_t*)NetApiToWstring(adapters[i].type), adapters[i].name.c_str());
int itm = ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), dev.c_str());
ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV), itm, i);
char guid_char[256];
wcstombs(guid_char, adapters[i].guid.c_str(), wcslen(adapters[i].guid.c_str()) + 1);
if (config.EthApi == adapters[i].type && strcmp(guid_char, config.Eth) == 0)
ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm);
}
Button_SetCheck(GetDlgItem(hW, IDC_CHECK_DHCP), config.InterceptDHCP);
InterceptChanged(hW);
SetWindowText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd);
//HDDText
Edit_SetText(GetDlgItem(hW, IDC_HDDSIZE_TEXT), std::to_wstring(config.HddSize / 1024).c_str());
Edit_LimitText(GetDlgItem(hW, IDC_HDDSIZE_TEXT), 3); //Excluding null char
//HDDSpin
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SPIN), UDM_SETRANGE,
(WPARAM)0,
(LPARAM)MAKELPARAM(HDD_MAX_GB, HDD_MIN_GB));
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SPIN), UDM_SETPOS,
(WPARAM)0,
(LPARAM)(config.HddSize / 1024));
//HDDSlider
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETRANGE,
(WPARAM)FALSE,
(LPARAM)MAKELPARAM(HDD_MIN_GB, HDD_MAX_GB));
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETPAGESIZE,
(WPARAM)0,
(LPARAM)10);
for (int i = HDD_MIN_GB; i < HDD_MAX_GB; i += 5)
{
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETTIC,
(WPARAM)0,
(LPARAM)i);
}
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETPOS,
(WPARAM)TRUE,
(LPARAM)(config.HddSize / 1024));
//Checkboxes
Button_SetCheck(GetDlgItem(hW, IDC_ETHENABLED), config.ethEnable);
Button_SetCheck(GetDlgItem(hW, IDC_HDDENABLED), config.hddEnable);
}
void OnBrowse(HWND hW)
{
wchar_t wbuff[4096] = {0};
memcpy(wbuff, HDD_DEF, sizeof(HDD_DEF));
ghc::filesystem::path inis(EmuFolders::Settings.ToString().wx_str());
wstring w_inis = inis.wstring();
OPENFILENAMEW ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hW;
ofn.lpstrTitle = L"HDD image file";
ofn.lpstrFile = wbuff;
ofn.nMaxFile = ArraySize(wbuff);
ofn.lpstrFilter = L"HDD\0*.raw\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = w_inis.c_str();
ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileName(&ofn))
{
ghc::filesystem::path hddFile(std::wstring(ofn.lpstrFile));
if (ghc::filesystem::exists(hddFile))
{
//Get file size
int filesizeGb = ghc::filesystem::file_size(hddFile) / (1024 * 1024 * 1024);
//Set slider
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SPIN), UDM_SETPOS,
(WPARAM)0,
(LPARAM)filesizeGb);
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETPOS,
(WPARAM)TRUE,
(LPARAM)filesizeGb);
}
if (hddFile.parent_path() == inis)
hddFile = hddFile.filename();
Edit_SetText(GetDlgItem(hW, IDC_HDDFILE), hddFile.wstring().c_str());
}
}
void OnOk(HWND hW)
{
int i = ComboBox_GetCurSel(GetDlgItem(hW, IDC_ETHDEV));
if (i == -1)
{
//adapter not selected
if (Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED)))
{
//Trying to use an ethernet without
//selected adapter, we can't have that
SysMessage("Please select an ethernet adapter");
return;
}
else
{
//user not planning on using
//ethernet anyway
config.EthApi = NetApi::Unset;
strcpy(config.Eth, ETH_DEF);
}
}
else
{
//adapter is selected
config.EthApi = adapters[i].type;
char guid_char[256];
wcstombs(guid_char, adapters[i].guid.c_str(), wcslen(adapters[i].guid.c_str()) + 1);
strcpy(config.Eth, guid_char);
}
config.InterceptDHCP = Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DHCP));
if (config.InterceptDHCP)
{
config.PS2IP = IPControl_GetValue(GetDlgItem(hW, IDC_IPADDRESS_IP));
config.AutoMask = Button_GetCheck(GetDlgItem(hW, IDC_CHECK_SUBNET));
if (!config.AutoMask)
config.Mask = IPControl_GetValue(GetDlgItem(hW, IDC_IPADDRESS_SUBNET));
config.AutoGateway = Button_GetCheck(GetDlgItem(hW, IDC_CHECK_GATEWAY));
if (!config.AutoGateway)
config.Gateway = IPControl_GetValue(GetDlgItem(hW, IDC_IPADDRESS_GATEWAY));
config.AutoDNS1 = Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DNS1));
if (!config.AutoDNS1)
config.DNS1 = IPControl_GetValue(GetDlgItem(hW, IDC_IPADDRESS_DNS1));
config.AutoDNS2 = Button_GetCheck(GetDlgItem(hW, IDC_CHECK_DNS2));
if (!config.AutoDNS2)
config.DNS2 = IPControl_GetValue(GetDlgItem(hW, IDC_IPADDRESS_DNS2));
}
GetWindowText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd, 256);
if (Edit_GetTextLength(GetDlgItem(hW, IDC_HDDSIZE_TEXT)) == 0)
config.HddSize = HDD_MIN_GB * 1024;
else
{
wchar_t text[4];
GetWindowText(GetDlgItem(hW, IDC_HDDSIZE_TEXT), text, 4);
config.HddSize = stoi(text) * 1024;
}
config.ethEnable = Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED));
config.hddEnable = Button_GetCheck(GetDlgItem(hW, IDC_HDDENABLED));
ghc::filesystem::path hddPath(std::wstring(config.Hdd));
if (config.hddEnable && hddPath.empty())
{
SysMessage("Please specify a HDD file");
return;
}
if (hddPath.is_relative())
{
//GHC uses UTF8 on all platforms
ghc::filesystem::path path(EmuFolders::Settings.ToUTF8().data());
hddPath = path / hddPath;
}
if (config.hddEnable && !ghc::filesystem::exists(hddPath))
{
HddCreate hddCreator;
hddCreator.filePath = hddPath;
hddCreator.neededSize = config.HddSize;
hddCreator.Start();
if (hddCreator.errored)
return;
}
SaveConf();
adapters.clear();
EndDialog(hW, TRUE);
}
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
OnInitDialog(hW);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCANCEL:
adapters.clear();
EndDialog(hW, FALSE);
return TRUE;
case IDOK:
if (GetFocus() != GetDlgItem(hW, IDOK))
{
SetFocus(GetDlgItem(hW, IDOK));
return TRUE;
}
OnOk(hW);
return TRUE;
case IDC_CHECK_DHCP:
InterceptChanged(hW);
return TRUE;
case IDC_CHECK_SUBNET:
AutoMaskChanged(hW);
return TRUE;
case IDC_CHECK_GATEWAY:
AutoGatewayChanged(hW);
return TRUE;
case IDC_CHECK_DNS1:
AutoDNS1Changed(hW);
return TRUE;
case IDC_CHECK_DNS2:
AutoDNS2Changed(hW);
return TRUE;
case IDC_BROWSE:
OnBrowse(hW);
return TRUE;
case IDC_HDDSIZE_TEXT:
{
if (GetFocus() != GetDlgItem(hW, IDC_HDDSIZE_TEXT))
return TRUE;
if (Edit_GetTextLength(GetDlgItem(hW, IDC_HDDSIZE_TEXT)) == 0)
return TRUE;
wchar_t text[4];
Edit_GetText(GetDlgItem(hW, IDC_HDDSIZE_TEXT), text, 4); //Including null char
switch (HIWORD(wParam))
{
case EN_CHANGE:
{
int curpos = stoi(text);
if (HDD_MIN_GB > curpos)
//user may still be typing
return TRUE;
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SPIN), UDM_SETPOS,
(WPARAM)0,
(LPARAM)curpos);
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETPOS,
(WPARAM)TRUE,
(LPARAM)curpos);
return TRUE;
}
}
return FALSE;
}
default:
return FALSE;
}
case WM_HSCROLL:
{
HWND hwndDlg = (HWND)lParam;
int curpos = HIWORD(wParam);
switch (LOWORD(wParam))
{
case TB_LINEUP:
case TB_LINEDOWN:
case TB_PAGEUP:
case TB_PAGEDOWN:
case TB_TOP:
case TB_BOTTOM:
curpos = (int)SendMessage(hwndDlg, TBM_GETPOS, 0, 0);
[[fallthrough]];
case TB_THUMBPOSITION:
case TB_THUMBTRACK:
//Update Textbox
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SPIN), UDM_SETPOS,
(WPARAM)0,
(LPARAM)curpos);
return TRUE;
default:
return FALSE;
}
}
case WM_VSCROLL:
{
HWND hwndDlg = (HWND)lParam;
int curpos = HIWORD(wParam);
switch (LOWORD(wParam))
{
case SB_LINEUP:
case SB_LINEDOWN:
case SB_PAGEUP:
case SB_PAGEDOWN:
case SB_TOP:
case SB_BOTTOM:
curpos = (int)SendMessage(hwndDlg, UDM_GETPOS, 0, 0);
[[fallthrough]];
case SB_THUMBPOSITION:
case SB_THUMBTRACK:
//Update Textbox
//Edit_SetText(GetDlgItem(hW, IDC_HDDSIZE_TEXT), to_wstring(curpos).c_str());
SendMessage(GetDlgItem(hW, IDC_HDDSIZE_SLIDER), TBM_SETPOS,
(WPARAM)TRUE,
(LPARAM)curpos);
return TRUE;
default:
return FALSE;
}
}
}
return FALSE;
}
void DEV9configure()
{
ScopedCoreThreadPause paused_core;
ConfigDEV9 oldConfig = config;
DialogBox(hInst,
MAKEINTRESOURCE(IDD_CONFIG),
GetActiveWindow(),
(DLGPROC)ConfigureDlgProc);
//SysMessage("Nothing to Configure");
ApplyConfigIfRunning(oldConfig);
paused_core.AllowResume();
}
/*
UINT DEV9ThreadProc() {
DEV9thread();
return 0;
}*/

View File

@ -1,39 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by DEV9ghzdrk.rc
//
#define IDD_CONFDLG 801
#define IDD_CONFIG 801
#define IDC_NAME 8000
#define IDC_COMBO1 8007
#define IDC_ETHDEV 8007
#define IDC_BAYTYPE 8008
#define IDC_ETHENABLED 8009
#define IDC_HDDFILE 8010
#define IDC_HDDENABLED 8011
#define IDC_HDDSIZE_SLIDER 8012
#define IDC_HDDSIZE_SPIN 8013
#define IDC_HDDSIZE_TEXT 8015
#define IDC_BROWSE 8017
#define IDC_IPADDRESS_IP 8018
#define IDC_CHECK_DHCP 8019
#define IDC_IPADDRESS_SUBNET 8020
#define IDC_IPADDRESS_GATEWAY 8021
#define IDC_IPADDRESS_DNS1 8022
#define IDC_IPADDRESS_DNS2 8023
#define IDC_CHECK_SUBNET 8024
#define IDC_CHECK_GATEWAY 8025
#define IDC_CHECK_DNS1 8026
#define IDC_CHECK_DNS2 8027
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 806
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 8025
#define _APS_NEXT_SYMED_VALUE 801
#endif
#endif

View File

@ -178,21 +178,6 @@ const wxChar* NetApiToWxString(NetApi api)
}
}
const wchar_t* NetApiToWstring(NetApi api)
{
switch (api)
{
case NetApi::PCAP_Bridged:
return L"PCAP (Bridged)";
case NetApi::PCAP_Switched:
return L"PCAP (Switched)";
case NetApi::TAP:
return L"TAP";
default:
return L"UNK";
}
}
using namespace PacketReader;
using namespace PacketReader::IP;
using namespace PacketReader::IP::UDP;

View File

@ -141,4 +141,3 @@ void ReconfigureLiveNet(ConfigDEV9* oldConfig);
void TermNet();
const wxChar* NetApiToWxString(NetApi api);
const wchar_t* NetApiToWstring(NetApi api);

View File

@ -277,6 +277,7 @@
<ClCompile Include="DEV9\ATA\ATA_State.cpp" />
<ClCompile Include="DEV9\ATA\ATA_Transfer.cpp" />
<ClCompile Include="DEV9\ATA\HddCreate.cpp" />
<ClCompile Include="DEV9\ConfigUI.cpp" />
<ClCompile Include="DEV9\DEV9Config.cpp" />
<ClCompile Include="DEV9\DEV9.cpp" />
<ClCompile Include="DEV9\flash.cpp" />
@ -298,7 +299,6 @@
<ClCompile Include="DEV9\Win32\DEV9WinConfig.cpp" />
<ClCompile Include="DEV9\net.cpp" />
<ClCompile Include="DEV9\Win32\tap-win32.cpp" />
<ClCompile Include="DEV9\Win32\Win32.cpp" />
<ClCompile Include="GameDatabase.cpp" />
<ClCompile Include="Gif_Logger.cpp" />
<ClCompile Include="Gif_Unit.cpp" />
@ -751,7 +751,6 @@
<ClInclude Include="DEV9\SimpleQueue.h" />
<ClInclude Include="DEV9\smap.h" />
<ClInclude Include="DEV9\Win32\pcap_io_win32_funcs.h" />
<ClInclude Include="DEV9\Win32\resource.h" />
<ClInclude Include="DEV9\Win32\tap.h" />
<ClInclude Include="GameDatabase.h" />
<ClInclude Include="Gif_Unit.h" />
@ -1106,7 +1105,6 @@
<ResourceCompile Include="GS\GS.rc" />
<ResourceCompile Include="PAD\Windows\PAD.rc" />
<ResourceCompile Include="SPU2\Windows\SPU2.rc" />
<ResourceCompile Include="DEV9\Win32\DEV9ghzdrk.rc" />
<ResourceCompile Include="USB\usb-pad\dx\versionproxy.rc" />
<ResourceCompile Include="USB\usb-pad\raw\raw-config.rc" />
<ResourceCompile Include="USB\Win32\USBDialog.rc" />

View File

@ -1166,6 +1166,9 @@
<ClCompile Include="DEV9\ATA\HddCreate.cpp">
<Filter>System\Ps2\DEV9\ATA</Filter>
</ClCompile>
<ClCompile Include="DEV9\ConfigUI.cpp">
<Filter>System\Ps2\DEV9</Filter>
</ClCompile>
<ClCompile Include="DEV9\DEV9Config.cpp">
<Filter>System\Ps2\DEV9</Filter>
</ClCompile>
@ -1226,9 +1229,6 @@
<ClCompile Include="DEV9\Win32\tap-win32.cpp">
<Filter>System\Ps2\DEV9</Filter>
</ClCompile>
<ClCompile Include="DEV9\Win32\Win32.cpp">
<Filter>System\Ps2\DEV9</Filter>
</ClCompile>
<ClCompile Include="DEV9\Win32\DEV9WinConfig.cpp">
<Filter>System\Ps2\DEV9</Filter>
</ClCompile>
@ -2301,9 +2301,6 @@
<ClInclude Include="DEV9\Win32\pcap_io_win32_funcs.h">
<Filter>System\Ps2\DEV9</Filter>
</ClInclude>
<ClInclude Include="DEV9\Win32\resource.h">
<Filter>System\Ps2\DEV9</Filter>
</ClInclude>
<ClInclude Include="DEV9\Win32\tap.h">
<Filter>System\Ps2\DEV9</Filter>
</ClInclude>
@ -2793,9 +2790,6 @@
<ResourceCompile Include="SPU2\Windows\SPU2.rc">
<Filter>System\Ps2\SPU2</Filter>
</ResourceCompile>
<ResourceCompile Include="DEV9\Win32\DEV9ghzdrk.rc">
<Filter>System\Ps2\DEV9</Filter>
</ResourceCompile>
<ResourceCompile Include="USB\usb-pad\dx\versionproxy.rc">
<Filter>System\Ps2\USB\usb-pad\dx</Filter>
</ResourceCompile>