Compare commits

..

2 Commits

Author SHA1 Message Date
lizzie eacb5f40a1 2026-09-06 21:41:03
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-06 21:41:03 +00:00
lizzie e1dcee37bf 2026-09-06 21:03:44
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-06 21:03:44 +00:00
7 changed files with 52 additions and 16 deletions
@@ -83,7 +83,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
SHOW_SHADERS_BUILDING("show_shaders_building"), SHOW_SHADERS_BUILDING("show_shaders_building"),
DEBUG_FLUSH_BY_LINE("flush_line"), DEBUG_FLUSH_BY_LINE("flush_line"),
EXTENDED_LOGGING("extended_logging"),
DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"), DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"),
ENABLE_OVERLAY("enable_overlay"), ENABLE_OVERLAY("enable_overlay"),
@@ -262,13 +262,6 @@ abstract class SettingsItem(
descriptionId = R.string.flush_by_line_description descriptionId = R.string.flush_by_line_description
) )
) )
put(
SwitchSetting(
BooleanSetting.EXTENDED_LOGGING,
titleId = R.string.extended_logging,
descriptionId = R.string.extended_logging_description
)
)
val dockedModeSetting = object : AbstractBooleanSetting { val dockedModeSetting = object : AbstractBooleanSetting {
override val key = BooleanSetting.USE_DOCKED_MODE.key override val key = BooleanSetting.USE_DOCKED_MODE.key
@@ -1323,7 +1323,6 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.log)) add(HeaderSetting(R.string.log))
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key) add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
add(BooleanSetting.EXTENDED_LOGGING.key)
add(StringSetting.LOG_FILTER.key) add(StringSetting.LOG_FILTER.key)
} }
@@ -636,8 +636,6 @@
<string name="log">Logging</string> <string name="log">Logging</string>
<string name="flush_by_line">Flush debug logs by line</string> <string name="flush_by_line">Flush debug logs by line</string>
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string> <string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
<string name="extended_logging">Enable extended logging</string>
<string name="extended_logging_description">Increases the maximum log file size from 100 MiB to 1 GiB.</string>
<string name="log_filter">Log filter</string> <string name="log_filter">Log filter</string>
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string> <string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
+40 -1
View File
@@ -697,6 +697,16 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
SDL_AddEventWatch(&SDLEventWatcher, this); SDL_AddEventWatch(&SDLEventWatcher, this);
initialized = true; 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 // Because the events for joystick connection happens before we have our event watcher added, we
// can just open all the joysticks right here // can just open all the joysticks right here
int joystick_count = 0; int joystick_count = 0;
@@ -715,6 +725,7 @@ SDLDriver::~SDLDriver() {
initialized = false; initialized = false;
if (start_thread) { if (start_thread) {
vibration_thread.join();
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD); SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD);
} }
} }
@@ -794,7 +805,10 @@ Common::Input::DriverResult SDLDriver::SetVibration(
.type = Common::Input::VibrationAmplificationType::Exponential, .type = Common::Input::VibrationAmplificationType::Exponential,
}; };
joystick->RumblePlay(new_vibration); vibration_queue.Push(VibrationRequest{
.identifier = identifier,
.vibration = new_vibration,
});
return Common::Input::DriverResult::Success; return Common::Input::DriverResult::Success;
} }
@@ -838,6 +852,31 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
return true; 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, Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, const Common::UUID& guid,
s32 axis, float value) const { s32 axis, float value) const {
Common::ParamPackage params{}; Common::ParamPackage params{};
+6 -1
View File
@@ -113,11 +113,16 @@ private:
/// Returns true if the button is on the left joycon /// Returns true if the button is on the left joycon
bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const; 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 /// Map of GUID of a list of corresponding virtual Joysticks
::Common::unordered_map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map; ::Common::unordered_map<Common::UUID, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
std::mutex joystick_map_mutex; std::mutex joystick_map_mutex;
bool start_thread = false;
std::atomic<bool> initialized = false; std::atomic<bool> initialized = false;
bool start_thread;
std::thread vibration_thread;
}; };
} // namespace InputCommon } // namespace InputCommon
+6 -3
View File
@@ -55,11 +55,11 @@ constexpr u64 GpuClockMultiplier(Settings::GpuClock clock) {
struct GPU::Impl { struct GPU::Impl {
explicit Impl(Core::System& system_, bool is_async_, bool use_nvdec_) explicit Impl(Core::System& system_, bool is_async_, bool use_nvdec_)
: system{system_} : gpu_thread{system_}
, system{system_}
, use_nvdec{use_nvdec_} , use_nvdec{use_nvdec_}
, shader_notify() , shader_notify()
, is_async{is_async_} , is_async{is_async_}
, gpu_thread{system_}
{} {}
~Impl() = default; ~Impl() = default;
@@ -301,6 +301,10 @@ struct GPU::Impl {
return out; return out;
} }
// Destruction of thread must be done before all (non trivial)
// previous members has been destroyed
VideoCommon::GPUThread::ThreadManager gpu_thread;
Core::System& system; Core::System& system;
std::unique_ptr<VideoCore::RendererBase> renderer; std::unique_ptr<VideoCore::RendererBase> renderer;
@@ -329,7 +333,6 @@ struct GPU::Impl {
const bool is_async; const bool is_async;
VideoCommon::GPUThread::ThreadManager gpu_thread;
std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context; std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context;
Tegra::Control::Scheduler scheduler; Tegra::Control::Scheduler scheduler;