Compare commits

..

11 Commits

Author SHA1 Message Date
PavelBARABANOV 283935dc7c h 2026-09-06 00:44:22 +02:00
PavelBARABANOV fc97a59d2c Bruno FIX OVERLAY 2.0 2026-09-06 00:44:22 +02:00
PavelBARABANOV b4a92a5db8 Brubo patch 2026-09-06 00:44:22 +02:00
PavelBARABANOV cd9c750545 find? 2026-09-06 00:44:22 +02:00
PavelBARABANOV 9858c9d346 add ColorOpaqueBlackRgba32 2026-09-06 00:44:22 +02:00
PavelBARABANOV 70e274fe5f return ClearAppletCaptureBuffer etc. 2026-09-06 00:44:22 +02:00
PavelBARABANOV 55546f2481 ac3 again 2026-09-06 00:44:22 +02:00
PavelBARABANOV 870dd5e175 headers 2026-09-06 00:44:22 +02:00
PavelBARABANOV 398f202891 for convenience 2026-09-06 00:44:22 +02:00
PavelBARABANOV 645938daf3 or 2026-09-06 00:44:22 +02:00
PavelBARABANOV 9d975c5870 return SetLayerZIndex(layer_id, 100000) 2026-09-06 00:44:22 +02:00
7 changed files with 32 additions and 62 deletions
@@ -81,12 +81,12 @@ Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer_id) {
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, *out_layer_id);
if (m_applet_id == AppletId::OverlayDisplay) {
(void)m_manager_display_service->SetLayerZIndex(Overlay, *out_layer_id);
(void)m_display_service->GetContainer()->SetLayerIsOverlay(*out_layer_id, true);
} else {
(void)m_manager_display_service->SetLayerZIndex(Foreground, *out_layer_id);
}
}
m_display_service->GetContainer()->SetLayerZIndex(*out_layer_id, true);
m_managed_display_layers.emplace(*out_layer_id);
R_SUCCEED();
@@ -126,15 +126,16 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() {
// Ensure the overlay layer is visible
m_manager_display_service->SetLayerVisibility(m_visible, m_system_shared_layer_id);
(void)m_display_service->GetContainer()->SetLayerStackMask(m_system_shared_layer_id,
this->GetLayerStackMask());
m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
s32 initial_z = Foreground;
if (m_applet_id == AppletId::OverlayDisplay) {
initial_z = Overlay;
(void)m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
}
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
m_display_service->GetContainer()->SetLayerZIndex(m_system_shared_layer_id, true);
m_managed_display_layers.emplace(m_system_shared_layer_id);
R_SUCCEED();
}
@@ -300,28 +300,6 @@ Result SharedBufferManager::CreateSession(Kernel::KProcess* owner_process, u64*
}
}
// Claim a presentation slot range.
u32 slot_base = 0;
std::array<bool, SharedBufferMaxSessions> in_use{};
for (const auto& [existing_aruid, existing] : m_sessions) {
const u32 index = existing.presentation_slot_base / SharedBufferSlotsPerSession;
if (index < in_use.size())
in_use[index] = true;
}
u32 index = 0;
while (index < in_use.size() && in_use[index])
index++;
if (index >= in_use.size()) {
LOG_ERROR(Service_VI, "Out of shared buffer presentation slots ({} sessions)", SharedBufferMaxSessions);
R_THROW(VI::ResultOperationFailed);
}
slot_base = index * SharedBufferSlotsPerSession;
// Map into process.
Common::ProcessAddress map_address{};
R_TRY(MapSharedBufferIntoProcessAddressSpace(std::addressof(map_address), m_buffer_page_group,
@@ -330,7 +308,6 @@ Result SharedBufferManager::CreateSession(Kernel::KProcess* owner_process, u64*
// Create new session.
auto [it, was_emplaced] = m_sessions.emplace(aruid, SharedBufferSession{});
auto& session = it->second;
session.presentation_slot_base = slot_base;
auto& container = m_nvdrv->GetContainer();
session.session_id = container.OpenSession(owner_process);
+13 -11
View File
@@ -4,16 +4,17 @@
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <chrono>
#include <thread>
#include <fmt/ranges.h>
#include <math.h>
#include "common/param_package.h"
#include "common/settings.h"
#include "common/steady_clock.h"
#include "common/thread.h"
#include "input_common/drivers/mouse.h"
namespace InputCommon {
constexpr int update_time = 10;
constexpr float default_panning_sensitivity = 0.0010f;
constexpr float default_stick_sensitivity = 0.0006f;
constexpr float default_deadzone_counterweight = 0.01f;
@@ -73,7 +74,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
last_motion_change = {};
}
void Mouse::UpdateStickInput(Common::SteadyClock::time_point timestamp) {
void Mouse::UpdateStickInput() {
if (!IsMousePanningEnabled()) {
return;
}
@@ -99,9 +100,12 @@ void Mouse::UpdateStickInput(Common::SteadyClock::time_point timestamp) {
last_mouse_change *= clamped_decay;
}
void Mouse::UpdateMotionInput(Common::SteadyClock::time_point timestamp) {
const float sensitivity = IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x + last_motion_change.y * last_motion_change.y);
void Mouse::UpdateMotionInput() {
const float sensitivity =
IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x +
last_motion_change.y * last_motion_change.y);
// Clamp rotation speed
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
@@ -117,7 +121,7 @@ void Mouse::UpdateMotionInput(Common::SteadyClock::time_point timestamp) {
.accel_x = 0,
.accel_y = 0,
.accel_z = 0,
.delta_timestamp = u64(std::chrono::duration_cast<std::chrono::microseconds>(timestamp - last_notify_timestamp).count()),
.delta_timestamp = update_time * 1000,
};
if (IsMousePanningEnabled()) {
@@ -173,10 +177,8 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
}
void Mouse::NotifyChanged() {
auto const timestamp = Common::SteadyClock::Now();
UpdateStickInput(timestamp);
UpdateMotionInput(timestamp);
last_notify_timestamp = Common::SteadyClock::Now();
UpdateStickInput();
UpdateMotionInput();
}
void Mouse::MouseMove(f32 touch_x, f32 touch_y) {
+7 -10
View File
@@ -7,9 +7,7 @@
#pragma once
#include <thread>
#include <chrono>
#include "common/steady_clock.h"
#include "common/polyfill_thread.h"
#include "common/vector_math.h"
#include "input_common/input_engine.h"
@@ -103,18 +101,17 @@ public:
Common::Input::ButtonNames GetUIName(const Common::ParamPackage& params) const override;
private:
void UpdateStickInput(Common::SteadyClock::time_point timestamp);
void UpdateMotionInput(Common::SteadyClock::time_point timestamp);
void UpdateStickInput();
void UpdateMotionInput();
bool IsMousePanningEnabled();
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
Common::Vec2<int> mouse_origin{};
Common::Vec2<int> last_mouse_position{};
Common::Vec2<float> last_mouse_change{};
Common::Vec3<float> last_motion_change{};
Common::Vec2<int> wheel_position{};
Common::SteadyClock::time_point last_notify_timestamp{};
Common::Vec2<int> mouse_origin;
Common::Vec2<int> last_mouse_position;
Common::Vec2<float> last_mouse_change;
Common::Vec3<float> last_motion_change;
Common::Vec2<int> wheel_position;
bool button_pressed = false;
};
+7 -5
View File
@@ -538,7 +538,6 @@ void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) {
}
void GRenderWindow::ConstrainMouse() {
input_subsystem->GetMouse()->NotifyChanged(); // required to reset mouse once it's no longer moved
if (QtCommon::emu_thread == nullptr || !Settings::values.mouse_panning) {
mouse_constrain_timer.stop();
return;
@@ -553,12 +552,15 @@ void GRenderWindow::ConstrainMouse() {
const auto pos = mapFromGlobal(QCursor::pos());
const int new_pos_x = std::clamp(pos.x(), 0, width());
const int new_pos_y = std::clamp(pos.y(), 0, height());
QCursor::setPos(mapToGlobal(QPoint{new_pos_x, new_pos_y}));
} else {
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
return;
}
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
}
void GRenderWindow::wheelEvent(QWheelEvent* event) {
@@ -37,16 +37,10 @@ EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Co
SDL_SetWindowTitle(this_->render_window, title.c_str());
return 2000;
}, this);
mouse_timer = SDL_AddTimer(100, [](void *userdata, SDL_TimerID, Uint32) -> Uint32 {
auto* this_ = (EmuWindow_SDL3*)userdata;
this_->input_subsystem->GetMouse()->NotifyChanged();
return 100;
}, this);
}
EmuWindow_SDL3::~EmuWindow_SDL3() {
SDL_RemoveTimer(titlebar_timer);
SDL_RemoveTimer(mouse_timer);
system.HIDCore().UnloadInputDevices();
input_subsystem->Shutdown();
SDL_Quit();
@@ -84,9 +84,6 @@ protected:
/// Periodic changer of titlebar (independent of event loop)
SDL_TimerID titlebar_timer;
// Mouse resetter once it
SDL_TimerID mouse_timer;
/// Is the window still open?
bool is_open = true;