From 8a887a6fea07c719ac226273340036d17dd1ddda Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 28 Nov 2013 15:04:22 +0100 Subject: [PATCH] Don't prepend file:// in wxUtils::Explore() on windows. Wxw will just remove it, and/or blow up trying to remove it, if the path isn't ascii. This fixes issue 6721. (cherry picked from commit cc05f66ba1a0c4641b4dc19b77b252470d346350) Fix unicode support for File::Rename() on windows. Partial fix of issue 6721. (cherry picked from commit 99c89ae10961f84192cdbfc501b4ff45a559dcd1) Missed a accept error handler. Init instead of memset. (cherry picked from commit 935ed814eaff19094c96fdd38642b980e85c078f) Fix accept() bug, which was using the wrong isRW for error conversion. Also fixed a debug issue where local_name is used uninitialised. (cherry picked from commit f811dbb57516b6f3a34637bd1c8c8299ceea20e4) Only add real HID devices to HID list. (cherry picked from commit e805bf60685bb5f4bd5ac1bf0a290519a678e5b4) Add dxsdk_dir to vc++ paths via base.props. This means you no longer need the paths in a global property sheet. In fact if you have them in such a file, you should remove them as it will cause conflicts with the vs2013 build. (cherry picked from commit 0791a9ef80889ffb70c67fbd6491635b0014747b) --- Source/Core/Common/Src/FileUtil.cpp | 4 ++++ .../Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp | 12 +++++++++++- Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp | 6 +++--- Source/Core/DolphinWX/Src/Main.cpp | 4 ++-- Source/Core/DolphinWX/Src/WxUtils.cpp | 2 ++ Source/VSProps/Base.props | 10 ++++++++++ 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 7663e11078..dc07ddd7d7 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -241,7 +241,11 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename) { INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); +#ifdef _WIN32 + if (_trename(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str()) == 0) +#else if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) +#endif return true; ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp index e663d737c2..1a570315cc 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp @@ -398,12 +398,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) Memory::WriteBigEData((const u8*)&wii_device, OffsetBuffer, Align(wii_device.bLength, 4)); OffsetBuffer += Align(wii_device.bLength, 4); bool deviceValid = true; + bool isHID = false; for (c = 0; deviceValid && c < desc.bNumConfigurations; c++) { struct libusb_config_descriptor *config = NULL; int cRet = libusb_get_config_descriptor(device, c, &config); - // do not try to use usb devices with more than one interface, games can crash if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES) { @@ -415,10 +415,14 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) for (ic = 0; ic < config->bNumInterfaces; ic++) { const struct libusb_interface *interfaceContainer = &config->interface[ic]; + for (i = 0; i < interfaceContainer->num_altsetting; i++) { const struct libusb_interface_descriptor *interface = &interfaceContainer->altsetting[i]; + if (interface->bInterfaceClass == LIBUSB_CLASS_HID) + isHID = true; + WiiHIDInterfaceDescriptor wii_interface; ConvertInterfaceToWii(&wii_interface, interface); Memory::WriteBigEData((const u8*)&wii_interface, OffsetBuffer, Align(wii_interface.bLength, 4)); @@ -448,6 +452,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) } } // configs + if (!isHID) + { + deviceValid = false; + OffsetBuffer = OffsetStart; + } + if (deviceValid) { Memory::Write_U32(OffsetBuffer-OffsetStart, OffsetStart); // fill in length diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp index 0caa2ed7e8..8db1580ef7 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp @@ -236,14 +236,14 @@ void WiiSocket::update(bool read, bool write, bool except) socklen_t addrlen = sizeof(sockaddr_in); int ret = (s32)accept(fd, (sockaddr*)&local_name, &addrlen); - ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", false); + ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", true); WiiSockMan::Convert(local_name, *wii_name, addrlen); } else { int ret = (s32)accept(fd, NULL, 0); - ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", false); + ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", true); } WiiSockMan::getInstance().addSocket(ReturnValue); @@ -432,7 +432,7 @@ void WiiSocket::update(bool read, bool write, bool except) // send/sendto only handles MSG_OOB flags &= SO_MSG_OOB; - sockaddr_in local_name; + sockaddr_in local_name = {0}; if (has_destaddr) { WiiSockAddrIn* wii_name = (WiiSockAddrIn*)Memory::GetPointer(BufferIn2 + 0x0C); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 37dd449922..a5416465ad 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -131,12 +131,12 @@ bool IsInvalidVersion() return false; } -// Timebomb only active from 2013-Nov-07. +// Timebomb only active from 2014-Jan-01. bool IsTimebombActive() { SYSTEMTIME t; GetSystemTime(&t); - return (t.wYear > 2013) || (t.wMonth > 11) || (t.wMonth >= 11 && t.wDay >= 07); + return (t.wYear >= 2014); } #endif diff --git a/Source/Core/DolphinWX/Src/WxUtils.cpp b/Source/Core/DolphinWX/Src/WxUtils.cpp index 173c07fbcc..f33dbb9db2 100644 --- a/Source/Core/DolphinWX/Src/WxUtils.cpp +++ b/Source/Core/DolphinWX/Src/WxUtils.cpp @@ -24,11 +24,13 @@ void Launch(const char *filename) void Explore(const char *path) { wxString wxPath = StrToWxStr(path); +#ifndef _WIN32 // Default to file if (! wxPath.Contains(wxT("://"))) { wxPath = wxT("file://") + wxPath; } +#endif #ifdef __WXGTK__ wxPath.Replace(wxT(" "), wxT("\\ ")); diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index e1201912fd..a09f84f7d7 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -6,6 +6,16 @@ $(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ + + $(DXSDK_DIR)Include;$(IncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + $(DXSDK_DIR)Utilities\Bin\x86;$(ExecutablePath) + + + $(DXSDK_DIR)Include;$(IncludePath) + $(DXSDK_DIR)Lib\x64;$(LibraryPath) + $(DXSDK_DIR)Utilities\Bin\x64;$(ExecutablePath) + _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;USE_UPNP;%(PreprocessorDefinitions)