mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge branch 'wii-usb' into temp merge branch
Conflicts: Source/Core/Common/Src/Log.h Source/Core/Core/Core.vcxproj Source/Core/Core/Core.vcxproj.filters Source/VSProps/Dolphin.Win32.props Source/VSProps/Dolphin.x64.props
This commit is contained in:
@@ -208,9 +208,16 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
"Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
add_definitions(-D_DEBUG -ggdb)
|
||||
set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging")
|
||||
|
||||
option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF)
|
||||
if(ENABLE_GPROF)
|
||||
add_definitions(-pg)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
endif()
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
@@ -435,6 +442,16 @@ else(SDL2_FOUND)
|
||||
endif(SDL_FOUND)
|
||||
endif(SDL2_FOUND)
|
||||
|
||||
include(FindLibUSB OPTIONAL)
|
||||
if(LIBUSB_FOUND)
|
||||
message("Using shared LibUSB")
|
||||
|
||||
add_definitions(-D__LIBUSB__)
|
||||
include_directories(${LIBUSB_INCLUDE_DIR})
|
||||
else(LIBUSB_FOUND)
|
||||
|
||||
endif(LIBUSB_FOUND)
|
||||
|
||||
set(SFML_FIND_VERSION TRUE)
|
||||
set(SFML_FIND_VERSION_MAJOR 1)
|
||||
set(SFML_FIND_VERSION_MINOR 5)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# - Find libusb-1.0 library
|
||||
# This module defines
|
||||
# LIBUSB_INCLUDE_DIR, where to find bluetooth.h
|
||||
# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0.
|
||||
# LIBUSB_FOUND, If false, do not try to use libusb-1.0.
|
||||
#
|
||||
# Copyright (c) 2009, Michal Cihar, <michal@cihar.com>
|
||||
#
|
||||
# vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if (NOT LIBUSB_FOUND)
|
||||
pkg_check_modules (LIBUSB_PKG libusb-1.0)
|
||||
|
||||
find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
|
||||
PATHS
|
||||
${LIBUSB_PKG_INCLUDE_DIRS}
|
||||
/usr/include/libusb-1.0
|
||||
/usr/include
|
||||
/usr/local/include/libusb-1.0
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LIBUSB_LIBRARIES NAMES usb-1.0
|
||||
PATHS
|
||||
${LIBUSB_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
|
||||
else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
|
||||
endif (NOT LIBUSB_FOUND)
|
||||
|
||||
Vendored
+1443
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -65,6 +65,7 @@ enum LOG_TYPE {
|
||||
WII_IPC_DVD,
|
||||
WII_IPC_ES,
|
||||
WII_IPC_FILEIO,
|
||||
WII_IPC_HID,
|
||||
WII_IPC_HLE,
|
||||
WII_IPC_NET,
|
||||
WII_IPC_WC24,
|
||||
@@ -100,10 +101,10 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
;
|
||||
|
||||
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
||||
#define MAX_LOGLEVEL WARNING_LEVEL
|
||||
#else
|
||||
#ifndef MAX_LOGLEVEL
|
||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
||||
#endif // loglevel
|
||||
#endif // logging
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ LogManager::LogManager()
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
|
||||
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||
m_Log[LogTypes::WII_IPC_HID] = new LogContainer("WII_IPC_HID", "WII IPC HID");
|
||||
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
||||
m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
|
||||
m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
|
||||
|
||||
@@ -70,8 +70,8 @@ set(SRCS Src/ActionReplay.cpp
|
||||
Src/HW/CPU.cpp
|
||||
Src/HW/DSP.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_AX.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_NewAXWii.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_NewAXWii.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_CARD.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp
|
||||
Src/HW/DSPHLE/UCodes/UCode_ROM.cpp
|
||||
@@ -201,6 +201,13 @@ if(NOT USE_GLES)
|
||||
set(LIBS ${LIBS} videoogl)
|
||||
endif()
|
||||
|
||||
|
||||
if(LIBUSB_FOUND)
|
||||
# Using shared LibUSB
|
||||
set(LIBS ${LIBS} ${LIBUSB_LIBRARIES})
|
||||
set(SRCS ${SRCS} Src/IPC_HLE/WII_IPC_HLE_Device_hid.cpp)
|
||||
endif(LIBUSB_FOUND)
|
||||
|
||||
if(WIN32)
|
||||
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp
|
||||
Src/HW/WiimoteReal/IOWin.cpp)
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -127,7 +127,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -139,7 +139,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -153,7 +153,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -167,7 +167,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -181,7 +181,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>.\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\portaudio\include;..\..\..\Externals\zlib;..\..\..\Externals\openssl;..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -328,6 +328,7 @@
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_es.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_fs.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_hid.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_net.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_net_ssl.cpp" />
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.cpp" />
|
||||
@@ -538,6 +539,7 @@
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_es.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_FileIO.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_fs.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_hid.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_net.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.h" />
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_net_ssl.h" />
|
||||
|
||||
@@ -566,7 +566,10 @@
|
||||
<Filter>HW %28Flipper/Hollywood%29\GCMemcard</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\IPC_HLE\ICMPWin.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\IPC_HLE\WII_IPC_HLE_Device_hid.cpp">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -1063,6 +1066,9 @@
|
||||
<ClInclude Include="Src\IPC_HLE\ICMP.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\Net</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\IPC_HLE\WII_IPC_HLE_Device_hid.h">
|
||||
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CMakeLists.txt" />
|
||||
@@ -1203,5 +1209,8 @@
|
||||
<Filter Include="HW %28Flipper/Hollywood%29\GCMemcard">
|
||||
<UniqueIdentifier>{3e9e6e83-c1bf-45f9-aeff-231f98f60d29}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="IPC HLE %28IOS/Starlet%29\USB">
|
||||
<UniqueIdentifier>{321a9af5-9b3d-4620-888c-fe9d02e9559e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -52,6 +52,10 @@ They will also generate a true or false return for UpdateInterrupts() in WII_IPC
|
||||
#include "WII_IPC_HLE_Device_usb_kbd.h"
|
||||
#include "WII_IPC_HLE_Device_sdio_slot0.h"
|
||||
|
||||
#if defined(__LIBUSB__) || defined (_WIN32)
|
||||
#include "WII_IPC_HLE_Device_hid.h"
|
||||
#endif
|
||||
|
||||
#include "FileUtil.h" // For Copy
|
||||
#include "../ConfigManager.h"
|
||||
#include "../HW/CPU.h"
|
||||
@@ -80,6 +84,7 @@ IWII_IPC_HLE_Device* es_handles[ES_MAX_COUNT];
|
||||
typedef std::deque<u32> ipc_msg_queue;
|
||||
static ipc_msg_queue request_queue; // ppc -> arm
|
||||
static ipc_msg_queue reply_queue; // arm -> ppc
|
||||
static std::mutex s_reply_queue;
|
||||
|
||||
void Init()
|
||||
{
|
||||
@@ -116,7 +121,11 @@ void Init()
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_usb_kbd(i, std::string("/dev/usb/kbd")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_sdio_slot0(i, std::string("/dev/sdio/slot0")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/sdio/slot1")); i++;
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/hid")); i++;
|
||||
#if defined(__LIBUSB__) || defined(_WIN32)
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_hid(i, std::string("/dev/usb/hid")); i++;
|
||||
#else
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/hid")); i++;
|
||||
#endif
|
||||
g_DeviceMap[i] = new CWII_IPC_HLE_Device_stub(i, std::string("/dev/usb/oh1")); i++;
|
||||
g_DeviceMap[i] = new IWII_IPC_HLE_Device(i, std::string("_Unimplemented_Device_")); i++;
|
||||
}
|
||||
@@ -154,7 +163,12 @@ void Reset(bool _bHard)
|
||||
g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end());
|
||||
}
|
||||
request_queue.clear();
|
||||
reply_queue.clear();
|
||||
|
||||
// lock due to using reply_queue
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
reply_queue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
@@ -236,6 +250,8 @@ IWII_IPC_HLE_Device* CreateFileIO(u32 _DeviceID, const std::string& _rDeviceName
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
|
||||
p.Do(request_queue);
|
||||
p.Do(reply_queue);
|
||||
|
||||
@@ -531,6 +547,7 @@ void EnqRequest(u32 _Address)
|
||||
// Called when IOS module has some reply
|
||||
void EnqReply(u32 _Address)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
reply_queue.push_back(_Address);
|
||||
}
|
||||
|
||||
@@ -555,12 +572,16 @@ void Update()
|
||||
Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (reply_queue.size())
|
||||
|
||||
// lock due to using reply_queue
|
||||
{
|
||||
WII_IPCInterface::GenerateReply(reply_queue.front());
|
||||
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
||||
reply_queue.pop_front();
|
||||
std::lock_guard<std::mutex> lk(s_reply_queue);
|
||||
if (reply_queue.size())
|
||||
{
|
||||
WII_IPCInterface::GenerateReply(reply_queue.front());
|
||||
INFO_LOG(WII_IPC_HLE, "<<-- Reply to IPC Request @ 0x%08x", reply_queue.front());
|
||||
reply_queue.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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, version 2.0.
|
||||
|
||||
// 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "WII_IPC_HLE.h"
|
||||
#include "WII_IPC_HLE_Device.h"
|
||||
#include "libusb.h"
|
||||
#include "Thread.h"
|
||||
#include <list>
|
||||
|
||||
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
||||
#define MAX_HID_INTERFACES 1
|
||||
|
||||
#define HIDERR_NO_DEVICE_FOUND -4
|
||||
|
||||
/* Connection timed out */
|
||||
|
||||
class CWII_IPC_HLE_Device_hid : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::string& _rDeviceName);
|
||||
|
||||
virtual ~CWII_IPC_HLE_Device_hid();
|
||||
|
||||
virtual bool Open(u32 _CommandAddress, u32 _Mode);
|
||||
virtual bool Close(u32 _CommandAddress, bool _bForce);
|
||||
virtual u32 Update();
|
||||
|
||||
virtual bool IOCtlV(u32 _CommandAddress);
|
||||
virtual bool IOCtl(u32 _CommandAddress);
|
||||
private:
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
IOCTL_HID_GET_ATTACHED = 0x00,
|
||||
IOCTL_HID_SET_SUSPEND = 0x01,
|
||||
IOCTL_HID_CONTROL = 0x02,
|
||||
IOCTL_HID_INTERRUPT_IN = 0x03,
|
||||
IOCTL_HID_INTERRUPT_OUT = 0x04,
|
||||
IOCTL_HID_GET_US_STRING = 0x05,
|
||||
IOCTL_HID_OPEN = 0x06,
|
||||
IOCTL_HID_SHUTDOWN = 0x07,
|
||||
IOCTL_HID_CANCEL_INTERRUPT = 0x08,
|
||||
};
|
||||
|
||||
/* Device descriptor */
|
||||
typedef struct
|
||||
{
|
||||
u8 bLength;
|
||||
u8 bDescriptorType;
|
||||
u16 bcdUSB;
|
||||
u8 bDeviceClass;
|
||||
u8 bDeviceSubClass;
|
||||
u8 bDeviceProtocol;
|
||||
u8 bMaxPacketSize0;
|
||||
u16 idVendor;
|
||||
u16 idProduct;
|
||||
u16 bcdDevice;
|
||||
u8 iManufacturer;
|
||||
u8 iProduct;
|
||||
u8 iSerialNumber;
|
||||
u8 bNumConfigurations;
|
||||
u8 pad[2];
|
||||
} WiiHIDDeviceDescriptor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 bLength;
|
||||
u8 bDescriptorType;
|
||||
u16 wTotalLength;
|
||||
u8 bNumInterfaces;
|
||||
u8 bConfigurationValue;
|
||||
u8 iConfiguration;
|
||||
u8 bmAttributes;
|
||||
u8 MaxPower;
|
||||
u8 pad[3];
|
||||
} WiiHIDConfigDescriptor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 bLength;
|
||||
u8 bDescriptorType;
|
||||
u8 bInterfaceNumber;
|
||||
u8 bAlternateSetting;
|
||||
u8 bNumEndpoints;
|
||||
u8 bInterfaceClass;
|
||||
u8 bInterfaceSubClass;
|
||||
u8 bInterfaceProtocol;
|
||||
u8 iInterface;
|
||||
u8 pad[3];
|
||||
} WiiHIDInterfaceDescriptor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 bLength;
|
||||
u8 bDescriptorType;
|
||||
u8 bEndpointAddress;
|
||||
u8 bmAttributes;
|
||||
u16 wMaxPacketSize;
|
||||
u8 bInterval;
|
||||
u8 bRefresh;
|
||||
u8 bSynchAddress;
|
||||
u8 pad[1];
|
||||
} WiiHIDEndpointDescriptor;
|
||||
|
||||
|
||||
u32 deviceCommandAddress;
|
||||
void FillOutDevices(u32 BufferOut, u32 BufferOutSize);
|
||||
int GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check);
|
||||
|
||||
bool ClaimDevice(libusb_device_handle * dev);
|
||||
|
||||
void ConvertDeviceToWii(WiiHIDDeviceDescriptor *dest, const struct libusb_device_descriptor *src);
|
||||
void ConvertConfigToWii(WiiHIDConfigDescriptor *dest, const struct libusb_config_descriptor *src);
|
||||
void ConvertInterfaceToWii(WiiHIDInterfaceDescriptor *dest, const struct libusb_interface_descriptor *src);
|
||||
void ConvertEndpointToWii(WiiHIDEndpointDescriptor *dest, const struct libusb_endpoint_descriptor *src);
|
||||
|
||||
int Align(int num, int alignment);
|
||||
static void checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid);
|
||||
static void LIBUSB_CALL handleUsbUpdates(struct libusb_transfer *transfer);
|
||||
|
||||
struct libusb_device_handle * GetDeviceByDevNum(u32 devNum);
|
||||
std::map<u32,libusb_device_handle*> open_devices;
|
||||
std::mutex s_open_devices;
|
||||
std::map<std::string,int> device_identifiers;
|
||||
|
||||
std::thread usb_thread;
|
||||
bool usb_thread_running;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 enq_address;
|
||||
u32 type;
|
||||
void * context;
|
||||
} _hidevent;
|
||||
|
||||
std::list<_hidevent> event_list;
|
||||
};
|
||||
@@ -7,8 +7,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\Cg;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\openssl\$(PlatformName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;cg.lib;cgGL.lib;opengl32.lib;glew32s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\Cg;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\$(PlatformName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libusb-1.0.lib;portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;cg.lib;cgGL.lib;opengl32.lib;glew32s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\Cg64;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\openssl\$(PlatformName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;cg.lib;cgGL.lib;opengl32.lib;glew64s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\..\Externals\SDL\$(PlatformName);..\..\..\Externals\GLew;..\..\..\Externals\Cg64;..\..\..\Externals\portaudio\$(PlatformName)\$(ConfigurationName);..\..\..\Externals\openssl\$(PlatformName);..\..\..\Externals\libusb\$(PlatformName)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libusb-1.0.lib;portaudio.lib;dsound.lib;dxerr.lib;iphlpapi.lib;winmm.lib;setupapi.lib;xinput.lib;vfw32.lib;cg.lib;cgGL.lib;opengl32.lib;glew64s.lib;glu32.lib;rpcrt4.lib;comctl32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
||||
Reference in New Issue
Block a user