diff options
Diffstat (limited to '')
-rw-r--r-- | .gitmodules | 2 | ||||
m--------- | externals/mbedtls | 0 | ||||
-rw-r--r-- | src/core/crypto/aes_util.cpp | 2 | ||||
-rw-r--r-- | src/input_common/udp/client.cpp | 26 | ||||
-rw-r--r-- | src/input_common/udp/client.h | 6 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_command_pool.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_motion_touch.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_motion_touch.h | 2 |
8 files changed, 25 insertions, 23 deletions
diff --git a/.gitmodules b/.gitmodules index 93ba9b930..a0a89933d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -27,7 +27,7 @@ url = https://github.com/ReinUsesLisp/sirit [submodule "mbedtls"] path = externals/mbedtls - url = https://github.com/DarkLordZach/mbedtls + url = https://github.com/yuzu-emu/mbedtls [submodule "libzip"] path = externals/libzip/libzip url = https://github.com/nih-at/libzip.git diff --git a/externals/mbedtls b/externals/mbedtls -Subproject a280e602f3a4ae001d3a83cbc3e6e04c99c2227 +Subproject eac2416b8fdb2cb9c867a538100bf95326bad75 diff --git a/src/core/crypto/aes_util.cpp b/src/core/crypto/aes_util.cpp index 6a9734812..cb7506241 100644 --- a/src/core/crypto/aes_util.cpp +++ b/src/core/crypto/aes_util.cpp @@ -105,8 +105,6 @@ void AESCipher<Key, KeySize>::Transcode(const u8* src, std::size_t size, u8* des } } } - - mbedtls_cipher_finish(context, nullptr, nullptr); } template <typename Key, std::size_t KeySize> diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index c4afa4174..df73f9ff7 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp @@ -5,6 +5,7 @@ #include <chrono> #include <cstring> #include <functional> +#include <random> #include <thread> #include <boost/asio.hpp> #include "common/logging/log.h" @@ -26,10 +27,10 @@ class Socket { public: using clock = std::chrono::system_clock; - explicit Socket(const std::string& host, u16 port, std::size_t pad_index_, u32 client_id_, + explicit Socket(const std::string& host, u16 port, std::size_t pad_index_, SocketCallback callback_) : callback(std::move(callback_)), timer(io_service), - socket(io_service, udp::endpoint(udp::v4(), 0)), client_id(client_id_), + socket(io_service, udp::endpoint(udp::v4(), 0)), client_id(GenerateRandomClientId()), pad_index(pad_index_) { boost::system::error_code ec{}; auto ipv4 = boost::asio::ip::make_address_v4(host, ec); @@ -63,6 +64,11 @@ public: } private: + u32 GenerateRandomClientId() const { + std::random_device device; + return device(); + } + void HandleReceive(const boost::system::error_code&, std::size_t bytes_transferred) { if (auto type = Response::Validate(receive_buffer.data(), bytes_transferred)) { switch (*type) { @@ -115,7 +121,7 @@ private: boost::asio::basic_waitable_timer<clock> timer; udp::socket socket; - u32 client_id{}; + const u32 client_id; std::size_t pad_index{}; static constexpr std::size_t PORT_INFO_SIZE = sizeof(Message<Request::PortInfo>); @@ -203,7 +209,7 @@ void Client::ReloadSockets() { LOG_ERROR(Input, "Duplicated UDP servers found"); continue; } - StartCommunication(client++, udp_input_address, udp_input_port, pad, 24872); + StartCommunication(client++, udp_input_address, udp_input_port, pad); } } } @@ -277,7 +283,7 @@ void Client::OnPadData(Response::PadData data, std::size_t client) { } void Client::StartCommunication(std::size_t client, const std::string& host, u16 port, - std::size_t pad_index, u32 client_id) { + std::size_t pad_index) { SocketCallback callback{[this](Response::Version version) { OnVersion(version); }, [this](Response::PortInfo info) { OnPortInfo(info); }, [this, client](Response::PadData data) { OnPadData(data, client); }}; @@ -287,7 +293,7 @@ void Client::StartCommunication(std::size_t client, const std::string& host, u16 clients[client].port = port; clients[client].pad_index = pad_index; clients[client].active = 0; - clients[client].socket = std::make_unique<Socket>(host, port, pad_index, client_id, callback); + clients[client].socket = std::make_unique<Socket>(host, port, pad_index, callback); clients[client].thread = std::thread{SocketLoop, clients[client].socket.get()}; // Set motion parameters // SetGyroThreshold value should be dependent on GyroscopeZeroDriftMode @@ -416,7 +422,7 @@ const Common::SPSCQueue<UDPPadStatus>& Client::GetPadQueue() const { return pad_queue; } -void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, u32 client_id, +void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, const std::function<void()>& success_callback, const std::function<void()>& failure_callback) { std::thread([=] { @@ -426,7 +432,7 @@ void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, .port_info = [](Response::PortInfo) {}, .pad_data = [&](Response::PadData) { success_event.Set(); }, }; - Socket socket{host, port, pad_index, client_id, std::move(callback)}; + Socket socket{host, port, pad_index, std::move(callback)}; std::thread worker_thread{SocketLoop, &socket}; const bool result = success_event.WaitFor(std::chrono::seconds(5)); socket.Stop(); @@ -440,7 +446,7 @@ void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, } CalibrationConfigurationJob::CalibrationConfigurationJob( - const std::string& host, u16 port, std::size_t pad_index, u32 client_id, + const std::string& host, u16 port, std::size_t pad_index, std::function<void(Status)> status_callback, std::function<void(u16, u16, u16, u16)> data_callback) { @@ -485,7 +491,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( complete_event.Set(); } }}; - Socket socket{host, port, pad_index, client_id, std::move(callback)}; + Socket socket{host, port, pad_index, std::move(callback)}; std::thread worker_thread{SocketLoop, &socket}; complete_event.Wait(); socket.Stop(); diff --git a/src/input_common/udp/client.h b/src/input_common/udp/client.h index a523f6124..e9e438e88 100644 --- a/src/input_common/udp/client.h +++ b/src/input_common/udp/client.h @@ -126,7 +126,7 @@ private: void OnPortInfo(Response::PortInfo); void OnPadData(Response::PadData, std::size_t client); void StartCommunication(std::size_t client, const std::string& host, u16 port, - std::size_t pad_index, u32 client_id); + std::size_t pad_index); void UpdateYuzuSettings(std::size_t client, const Common::Vec3<float>& acc, const Common::Vec3<float>& gyro); @@ -165,7 +165,7 @@ public: * @param data_callback Called when calibration data is ready */ explicit CalibrationConfigurationJob(const std::string& host, u16 port, std::size_t pad_index, - u32 client_id, std::function<void(Status)> status_callback, + std::function<void(Status)> status_callback, std::function<void(u16, u16, u16, u16)> data_callback); ~CalibrationConfigurationJob(); void Stop(); @@ -174,7 +174,7 @@ private: Common::Event complete_event; }; -void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, u32 client_id, +void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, const std::function<void()>& success_callback, const std::function<void()>& failure_callback); diff --git a/src/video_core/renderer_vulkan/vk_command_pool.cpp b/src/video_core/renderer_vulkan/vk_command_pool.cpp index a99df9323..d8e92ac0e 100644 --- a/src/video_core/renderer_vulkan/vk_command_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_command_pool.cpp @@ -10,7 +10,7 @@ namespace Vulkan { -constexpr size_t COMMAND_BUFFER_POOL_SIZE = 0x1000; +constexpr size_t COMMAND_BUFFER_POOL_SIZE = 4; struct CommandPool::Pool { vk::CommandPool handle; diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index 1f2b792e4..52fdf7265 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp @@ -24,7 +24,7 @@ CalibrationConfigurationDialog::CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port, - u8 pad_index, u16 client_id) + u8 pad_index) : QDialog(parent) { layout = new QVBoxLayout; status_label = new QLabel(tr("Communicating with the server...")); @@ -41,7 +41,7 @@ CalibrationConfigurationDialog::CalibrationConfigurationDialog(QWidget* parent, using namespace InputCommon::CemuhookUDP; job = std::make_unique<CalibrationConfigurationJob>( - host, port, pad_index, client_id, + host, port, pad_index, [this](CalibrationConfigurationJob::Status status) { QString text; switch (status) { @@ -218,7 +218,6 @@ void ConfigureMotionTouch::OnCemuhookUDPTest() { udp_test_in_progress = true; InputCommon::CemuhookUDP::TestCommunication( ui->udp_server->text().toStdString(), static_cast<u16>(ui->udp_port->text().toInt()), 0, - 24872, [this] { LOG_INFO(Frontend, "UDP input test success"); QMetaObject::invokeMethod(this, "ShowUDPTestResult", Q_ARG(bool, true)); @@ -233,8 +232,7 @@ void ConfigureMotionTouch::OnConfigureTouchCalibration() { ui->touch_calibration_config->setEnabled(false); ui->touch_calibration_config->setText(tr("Configuring")); CalibrationConfigurationDialog dialog(this, ui->udp_server->text().toStdString(), - static_cast<u16>(ui->udp_port->text().toUInt()), 0, - 24872); + static_cast<u16>(ui->udp_port->text().toUInt()), 0); dialog.exec(); if (dialog.completed) { min_x = dialog.min_x; diff --git a/src/yuzu/configuration/configure_motion_touch.h b/src/yuzu/configuration/configure_motion_touch.h index 15d61e8ba..d76bc8154 100644 --- a/src/yuzu/configuration/configure_motion_touch.h +++ b/src/yuzu/configuration/configure_motion_touch.h @@ -30,7 +30,7 @@ class CalibrationConfigurationDialog : public QDialog { Q_OBJECT public: explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port, - u8 pad_index, u16 client_id); + u8 pad_index); ~CalibrationConfigurationDialog() override; private: |