Compare commits

..

1 Commits

Author SHA1 Message Date
lizzie 2427134c00 [input/sdl] nuke SDL_Vibration thread
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-07 12:27:39 +02:00
14 changed files with 160 additions and 128 deletions
+6
View File
@@ -711,6 +711,8 @@ add_library(core STATIC
hle/service/kernel_helpers.h
hle/service/lbl/lbl.cpp
hle/service/lbl/lbl.h
hle/service/ldn/client_process_monitor.cpp
hle/service/ldn/client_process_monitor.h
hle/service/ldn/lan_discovery.cpp
hle/service/ldn/lan_discovery.h
hle/service/ldn/ldn.cpp
@@ -830,6 +832,8 @@ add_library(core STATIC
hle/service/ns/system_update_control.h
hle/service/ns/system_update_interface.cpp
hle/service/ns/system_update_interface.h
hle/service/ns/vulnerability_manager_interface.cpp
hle/service/ns/vulnerability_manager_interface.h
hle/service/nvdrv/core/container.cpp
hle/service/nvdrv/core/container.h
hle/service/nvdrv/core/heap_mapper.cpp
@@ -1063,6 +1067,8 @@ add_library(core STATIC
hle/service/sockets/sockets.h
hle/service/sockets/sockets_translate.cpp
hle/service/sockets/sockets_translate.h
hle/service/spl/csrng.cpp
hle/service/spl/csrng.h
hle/service/spl/spl.cpp
hle/service/spl/spl.h
hle/service/spl/spl_module.cpp
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -124,7 +121,6 @@ size_t HierarchicalIntegrityVerificationStorage::Read(u8* buffer, size_t size,
}
size_t HierarchicalIntegrityVerificationStorage::GetSize() const {
ASSERT(m_data_size >= 0);
return m_data_size;
}
+5 -5
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -29,14 +26,17 @@ IStorage::~IStorage() = default;
Result IStorage::Open(Out<SharedPointer<IStorageAccessor>> out_storage_accessor) {
LOG_DEBUG(Service_AM, "called");
R_UNLESS(m_impl->GetHandle() == nullptr, AM::ResultInvalidStorageType);
*out_storage_accessor = std::make_shared<IStorageAccessor>(system, m_impl);
R_SUCCEED();
}
Result IStorage::OpenTransferStorage(Out<SharedPointer<ITransferStorageAccessor>> out_transfer_storage_accessor) {
LOG_DEBUG(Service_AM, "called");
Result IStorage::OpenTransferStorage(
Out<SharedPointer<ITransferStorageAccessor>> out_transfer_storage_accessor) {
R_UNLESS(m_impl->GetHandle() != nullptr, AM::ResultInvalidStorageType);
*out_transfer_storage_accessor = std::make_shared<ITransferStorageAccessor>(system, m_impl);
R_SUCCEED();
}
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/ldn/ldn_results.h"
#include "core/hle/service/ldn/client_process_monitor.h"
#include "core/hle/service/ipc_helpers.h"
namespace Service::LDN {
IClientProcessMonitor::IClientProcessMonitor(Core::System& system_)
: ServiceFramework{system_, "IClientProcessMonitor"} {
static const FunctionInfo functions[] = {
{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"},
};
RegisterHandlers(functions);
}
IClientProcessMonitor::~IClientProcessMonitor() = default;
Result IClientProcessMonitor::RegisterClient() {
LOG_WARNING(Service_LDN, "(STUBBED) called");
R_SUCCEED();
}
} // namespace Service::LDN
@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::LDN {
class IClientProcessMonitor final
: public ServiceFramework<IClientProcessMonitor> {
public:
explicit IClientProcessMonitor(Core::System& system_);
~IClientProcessMonitor() override;
private:
Result RegisterClient();
};
} // namespace Service::LDN
+3 -21
View File
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@@ -7,6 +7,7 @@
#include "core/core.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/ldn/ldn.h"
#include "core/hle/service/ldn/client_process_monitor.h"
#include "core/hle/service/ldn/monitor_service.h"
#include "core/hle/service/ldn/sf_monitor_service.h"
#include "core/hle/service/ldn/sf_service.h"
@@ -16,26 +17,6 @@
namespace Service::LDN {
class IClientProcessMonitor final
: public ServiceFramework<IClientProcessMonitor> {
public:
explicit IClientProcessMonitor(Core::System& system_)
: ServiceFramework{system_, "IClientProcessMonitor"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, D<&IClientProcessMonitor::RegisterClient>, "RegisterClient"},
};
// clang-format on
RegisterHandlers(functions);
}
~IClientProcessMonitor() override = default;
private:
Result RegisterClient(ClientProcessId pid) {
LOG_WARNING(Service_LDN, "(STUBBED) called");
R_SUCCEED();
}
};
class IMonitorServiceCreator final : public ServiceFramework<IMonitorServiceCreator> {
public:
explicit IMonitorServiceCreator(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {
@@ -44,6 +25,7 @@ public:
{0, C<&IMonitorServiceCreator::CreateMonitorService>, "CreateMonitorService"}
};
// clang-format on
RegisterHandlers(functions);
}
+1 -40
View File
@@ -10,9 +10,7 @@
#include "core/hle/service/ns/query_service.h"
#include "core/hle/service/ns/service_getter_interface.h"
#include "core/hle/service/ns/system_update_interface.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/ns/vulnerability_manager_interface.h"
#include "core/hle/service/server_manager.h"
namespace Service::NS {
@@ -41,43 +39,6 @@ public:
}
};
class IVulnerabilityManagerInterface final
: public ServiceFramework<IVulnerabilityManagerInterface> {
public:
explicit IVulnerabilityManagerInterface(Core::System& system_)
: ServiceFramework{system_, "ns:vm"} {
// clang-format off
static const FunctionInfo functions[] = {
{1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"},
{1201, nullptr, "UpdateSafeSystemVersionForDebug"},
{1202, nullptr, "GetSafeSystemVersion"},
{3100, D<&IVulnerabilityManagerInterface::GetSafeSystemVersionCheckInfo>, "GetSafeSystemVersionCheckInfo"},
{3101, nullptr, "RequestUpdateSafeSystemVersionCheckInfo"},
{3102, D<&IVulnerabilityManagerInterface::ResetSafeSystemVersionCheckInfo>, "ResetSafeSystemVersionCheckInfo"},
};
// clang-format on
RegisterHandlers(functions);
}
~IVulnerabilityManagerInterface() override = default;
Result NeedsUpdateVulnerability(Out<bool> out_needs_update_vulnerability) {
LOG_WARNING(Service_NS, "(STUBBED)");
*out_needs_update_vulnerability = false;
R_SUCCEED();
}
Result GetSafeSystemVersionCheckInfo(Out<std::array<u8, 0x20>> out_system_version_check_info) {
LOG_WARNING(Service_NS, "(STUBBED)");
*out_system_version_check_info = {};
R_SUCCEED();
}
Result ResetSafeSystemVersionCheckInfo() {
LOG_WARNING(Service_NS, "(STUBBED)");
R_SUCCEED();
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
@@ -0,0 +1,31 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/ns/vulnerability_manager_interface.h"
namespace Service::NS {
IVulnerabilityManagerInterface::IVulnerabilityManagerInterface(Core::System& system_)
: ServiceFramework{system_, "ns:vm"} {
// clang-format off
static const FunctionInfo functions[] = {
{1200, D<&IVulnerabilityManagerInterface::NeedsUpdateVulnerability>, "NeedsUpdateVulnerability"},
{1201, nullptr, "UpdateSafeSystemVersionForDebug"},
{1202, nullptr, "GetSafeSystemVersion"},
};
// clang-format on
RegisterHandlers(functions);
}
IVulnerabilityManagerInterface::~IVulnerabilityManagerInterface() = default;
Result IVulnerabilityManagerInterface::NeedsUpdateVulnerability(
Out<bool> out_needs_update_vulnerability) {
LOG_WARNING(Service_NS, "(STUBBED) called");
*out_needs_update_vulnerability = false;
R_SUCCEED();
}
} // namespace Service::NS
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/service.h"
namespace Service::NS {
class IVulnerabilityManagerInterface final
: public ServiceFramework<IVulnerabilityManagerInterface> {
public:
explicit IVulnerabilityManagerInterface(Core::System& system_);
~IVulnerabilityManagerInterface() override;
private:
Result NeedsUpdateVulnerability(Out<bool> out_needs_update_vulnerability);
};
} // namespace Service::NS
+18
View File
@@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/spl/csrng.h"
namespace Service::SPL {
CSRNG::CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "csrng") {
static const FunctionInfo functions[] = {
{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"},
};
RegisterHandlers(functions);
}
CSRNG::~CSRNG() = default;
} // namespace Service::SPL
+20
View File
@@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "core/hle/service/spl/spl_module.h"
namespace Core {
class System;
}
namespace Service::SPL {
class CSRNG final : public Module::Interface {
public:
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_);
~CSRNG() override;
};
} // namespace Service::SPL
+1 -12
View File
@@ -13,6 +13,7 @@
#include "core/hle/api_version.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/spl/csrng.h"
#include "core/hle/service/spl/spl.h"
#include "core/hle/service/spl/spl_module.h"
@@ -202,18 +203,6 @@ Result Module::Interface::GetConfigImpl(u64* out_config, ConfigItem config_item)
}
}
class CSRNG final : public Module::Interface {
public:
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "csrng") {
static const FunctionInfo functions[] = {
{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"},
};
RegisterHandlers(functions);
}
~CSRNG() override = default;
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
auto module = std::make_shared<Module>();
+1 -40
View File
@@ -697,16 +697,6 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
SDL_AddEventWatch(&SDLEventWatcher, this);
initialized = true;
if (start_thread) {
vibration_thread = std::thread([this] {
Common::SetCurrentThreadName("SDL_Vibration");
using namespace std::chrono_literals;
while (initialized) {
SendVibrations();
std::this_thread::sleep_for(250ms); // 4 TPS
}
});
}
// Because the events for joystick connection happens before we have our event watcher added, we
// can just open all the joysticks right here
int joystick_count = 0;
@@ -725,7 +715,6 @@ SDLDriver::~SDLDriver() {
initialized = false;
if (start_thread) {
vibration_thread.join();
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);
}
}
@@ -805,10 +794,7 @@ Common::Input::DriverResult SDLDriver::SetVibration(
.type = Common::Input::VibrationAmplificationType::Exponential,
};
vibration_queue.Push(VibrationRequest{
.identifier = identifier,
.vibration = new_vibration,
});
joystick->RumblePlay(new_vibration);
return Common::Input::DriverResult::Success;
}
@@ -852,31 +838,6 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
return true;
}
void SDLDriver::SendVibrations() {
std::vector<VibrationRequest> filtered_vibrations{};
while (!vibration_queue.Empty()) {
VibrationRequest request;
vibration_queue.Pop(request);
const auto joystick = GetSDLJoystickByGUID(request.identifier.guid.RawString(),
static_cast<int>(request.identifier.port));
const auto it = std::find_if(filtered_vibrations.begin(), filtered_vibrations.end(),
[request](VibrationRequest vibration) {
return vibration.identifier == request.identifier;
});
if (it == filtered_vibrations.end()) {
filtered_vibrations.push_back(std::move(request));
continue;
}
*it = request;
}
for (const auto& vibration : filtered_vibrations) {
const auto joystick = GetSDLJoystickByGUID(vibration.identifier.guid.RawString(),
static_cast<int>(vibration.identifier.port));
joystick->RumblePlay(vibration.vibration);
}
}
Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, const Common::UUID& guid,
s32 axis, float value) const {
Common::ParamPackage params{};
+1 -6
View File
@@ -113,16 +113,11 @@ private:
/// Returns true if the button is on the left joycon
bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const;
/// Queue of vibration request to controllers
Common::SPSCQueue<VibrationRequest> vibration_queue;
/// Map of GUID of a list of corresponding virtual Joysticks
::Common::unordered_map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
std::mutex joystick_map_mutex;
bool start_thread = false;
std::atomic<bool> initialized = false;
std::thread vibration_thread;
bool start_thread;
};
} // namespace InputCommon