From fabef0334bdb170ec0b3317ee992ddc62d3316a3 Mon Sep 17 00:00:00 2001 From: GovanifY Date: Sat, 3 Oct 2020 21:33:15 +0200 Subject: [PATCH] DEV9: windows support unicode fixes --- pcsx2/CMakeLists.txt | 2 +- pcsx2/DEV9/Win32/Win32.cpp | 2 +- pcsx2/DEV9/Win32/tap-win32.cpp | 50 +++++++++++++--------------------- pcsx2/DEV9/Win32/tap.h | 3 +- pcsx2/IPC.h | 2 ++ pcsx2/gui/SysState.cpp | 1 - 6 files changed, 25 insertions(+), 35 deletions(-) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index cd832f3b9e..87d6d6ea6c 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1,4 +1,4 @@ -include(macros/CompileGResources) +include(macros/GlibCompileResourcesSupport) if (openSUSE) diff --git a/pcsx2/DEV9/Win32/Win32.cpp b/pcsx2/DEV9/Win32/Win32.cpp index cb6d5d5234..45cbe26824 100644 --- a/pcsx2/DEV9/Win32/Win32.cpp +++ b/pcsx2/DEV9/Win32/Win32.cpp @@ -63,7 +63,7 @@ void OnInitDialog(HWND hW) vector* al = GetTapAdapters(); for (size_t i = 0; i < al->size(); i++) { - int itm = ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str()); + int itm = SendMessageA(GetDlgItem(hW, IDC_ETHDEV), CB_ADDSTRING, NULL, (LPARAM)(LPCTSTR)al[0][i].name.c_str()); ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV), itm, _strdup(al[0][i].guid.c_str())); if (strcmp(al[0][i].guid.c_str(), config.Eth) == 0) { diff --git a/pcsx2/DEV9/Win32/tap-win32.cpp b/pcsx2/DEV9/Win32/tap-win32.cpp index 28d7a63e1b..e22f690832 100644 --- a/pcsx2/DEV9/Win32/tap-win32.cpp +++ b/pcsx2/DEV9/Win32/tap-win32.cpp @@ -1,30 +1,16 @@ -/* - * TAP-Win32 -- A kernel driver to provide virtual tap device functionality - * on Windows. Originally derived from the CIPE-Win32 - * project by Damion K. Wilson, with extensive modifications by - * James Yonan. +/* PCSX2 - PS2 Emulator for PCs + * Copyright (C) 2002-2010 PCSX2 Dev Team * - * All source code which derives from the CIPE-Win32 project is - * Copyright (C) Damion K. Wilson, 2003, and is released under the - * GPL version 2 (see below). + * 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. * - * All other source code is Copyright (C) James Yonan, 2003-2004, - * and is released under the GPL version 2 (see below). + * 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. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 this program (see the file COPYING included with this - * distribution); if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the GNU General Public License along with PCSX2. + * If not, see . */ #include "PrecompiledHeader.h" @@ -195,9 +181,11 @@ vector* GetTapAdapters() { if (IsTAPDevice(enum_name)) { - std::string tmp("hello"); - std::string tmp2("hello"); - tap_adapter t = {tmp, tmp2}; + std::wstring tmp(name_data); + std::wstring tmp2(enum_name); + std::string tmp3(tmp.begin(), tmp.end()); + std::string tmp4(tmp2.begin(), tmp2.end()); + tap_adapter t = {tmp3, tmp4}; tap_nic->push_back(t); } } @@ -284,10 +272,10 @@ TAPAdapter::TAPAdapter() read.OffsetHigh = 0; read.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - write.Offset = 0; - write.OffsetHigh = 0; - write.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - isActive = true; + write.Offset = 0; + write.OffsetHigh = 0; + write.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + isActive = true; } bool TAPAdapter::blocks() diff --git a/pcsx2/DEV9/Win32/tap.h b/pcsx2/DEV9/Win32/tap.h index fd840a1c55..572c738c07 100644 --- a/pcsx2/DEV9/Win32/tap.h +++ b/pcsx2/DEV9/Win32/tap.h @@ -28,8 +28,9 @@ vector* GetTapAdapters(); class TAPAdapter : public NetAdapter { HANDLE htap; - OVERLAPPED read,write; + OVERLAPPED read, write; bool isActive = false; + public: TAPAdapter(); virtual bool blocks(); diff --git a/pcsx2/IPC.h b/pcsx2/IPC.h index c2ca2b590c..9a98a9b75a 100644 --- a/pcsx2/IPC.h +++ b/pcsx2/IPC.h @@ -20,8 +20,10 @@ #include "Utilities/PersistentThread.h" #include "System/SysThreads.h" +#ifdef _WIN32 #include #include +#endif using namespace Threading; diff --git a/pcsx2/gui/SysState.cpp b/pcsx2/gui/SysState.cpp index e122c108d4..ea8ca848f6 100644 --- a/pcsx2/gui/SysState.cpp +++ b/pcsx2/gui/SysState.cpp @@ -291,7 +291,6 @@ static const std::unique_ptr SavestateEntries[] = { std::unique_ptr(new PluginSavestateEntry(PluginId_PAD)), std::unique_ptr(new PluginSavestateEntry(PluginId_USB)), }; ->>>>>>> DEV9: initial work on merge, removing references // It's bad mojo to have savestates trying to read and write from the same file at the // same time. To prevent that we use this mutex lock, which is used by both the