summaryrefslogtreecommitdiff
path: root/src/yuzu
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/bootmanager.cpp32
-rw-r--r--src/yuzu/bootmanager.h2
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/configuration/configure_input_advanced.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_advanced.ui22
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp2
-rw-r--r--src/yuzu/configuration/configure_ringcon.cpp2
-rw-r--r--src/yuzu/game_list.cpp1
-rw-r--r--src/yuzu/game_list.h1
-rw-r--r--src/yuzu/main.cpp28
10 files changed, 65 insertions, 30 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index d65991734..17acd3933 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -67,7 +67,7 @@ void EmuThread::run() {
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
if (Settings::values.use_disk_shader_cache.GetValue()) {
m_system.Renderer().ReadRasterizer()->LoadDiskResources(
- m_system.GetCurrentProcessProgramID(), stop_token,
+ m_system.GetApplicationProcessProgramID(), stop_token,
[this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
emit LoadProgress(stage, value, total);
});
@@ -401,12 +401,6 @@ qreal GRenderWindow::windowPixelRatio() const {
return devicePixelRatioF();
}
-std::pair<u32, u32> GRenderWindow::ScaleTouch(const QPointF& pos) const {
- const qreal pixel_ratio = windowPixelRatio();
- return {static_cast<u32>(std::max(std::round(pos.x() * pixel_ratio), qreal{0.0})),
- static_cast<u32>(std::max(std::round(pos.y() * pixel_ratio), qreal{0.0}))};
-}
-
void GRenderWindow::closeEvent(QCloseEvent* event) {
emit Closed();
QWidget::closeEvent(event);
@@ -649,10 +643,12 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) {
// Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
// coordinates and map them to the current render area
const auto pos = mapFromGlobal(QCursor::pos());
- const auto [x, y] = ScaleTouch(pos);
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
const auto button = QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(x, y, touch_x, touch_y, button);
+
+ input_subsystem->GetMouse()->PressMouseButton(button);
+ input_subsystem->GetMouse()->PressButton(pos.x(), pos.y(), button);
+ input_subsystem->GetMouse()->PressTouchButton(touch_x, touch_y, button);
emit MouseActivity();
}
@@ -665,11 +661,13 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
// Qt sometimes returns the parent coordinates. To avoid this we read the global mouse
// coordinates and map them to the current render area
const auto pos = mapFromGlobal(QCursor::pos());
- const auto [x, y] = ScaleTouch(pos);
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
const int center_x = width() / 2;
const int center_y = height() / 2;
- input_subsystem->GetMouse()->MouseMove(x, y, touch_x, touch_y, center_x, center_y);
+
+ input_subsystem->GetMouse()->MouseMove(touch_x, touch_y);
+ input_subsystem->GetMouse()->TouchMove(touch_x, touch_y);
+ input_subsystem->GetMouse()->Move(pos.x(), pos.y(), center_x, center_y);
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
@@ -697,8 +695,8 @@ void GRenderWindow::wheelEvent(QWheelEvent* event) {
void GRenderWindow::TouchBeginEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
for (const auto& touch_point : touch_points) {
- const auto [x, y] = ScaleTouch(touch_point.pos());
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto pos = touch_point.pos();
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id());
}
}
@@ -707,8 +705,8 @@ void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
input_subsystem->GetTouchScreen()->ClearActiveFlag();
for (const auto& touch_point : touch_points) {
- const auto [x, y] = ScaleTouch(touch_point.pos());
- const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
+ const auto pos = touch_point.pos();
+ const auto [touch_x, touch_y] = MapToTouchScreen(pos.x(), pos.y());
input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id());
}
input_subsystem->GetTouchScreen()->ReleaseInactiveTouch();
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index 092c6206f..627e19f42 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -184,8 +184,6 @@ public:
void CaptureScreenshot(const QString& screenshot_path);
- std::pair<u32, u32> ScaleTouch(const QPointF& pos) const;
-
/**
* Instructs the window to re-launch the application using the specified program_index.
* @param program_index Specifies the index within the application of the program to launch.
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 35fef506a..db68ed259 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -441,6 +441,7 @@ void Config::ReadControlValues() {
Settings::values.mouse_panning = false;
ReadBasicSetting(Settings::values.mouse_panning_sensitivity);
ReadBasicSetting(Settings::values.enable_joycon_driver);
+ ReadBasicSetting(Settings::values.enable_procon_driver);
ReadBasicSetting(Settings::values.tas_enable);
ReadBasicSetting(Settings::values.tas_loop);
@@ -1102,6 +1103,7 @@ void Config::SaveValues() {
SaveRendererValues();
SaveAudioValues();
SaveSystemValues();
+ qt_config->sync();
}
void Config::SaveAudioValues() {
@@ -1141,6 +1143,7 @@ void Config::SaveControlValues() {
WriteGlobalSetting(Settings::values.motion_enabled);
WriteBasicSetting(Settings::values.enable_raw_input);
WriteBasicSetting(Settings::values.enable_joycon_driver);
+ WriteBasicSetting(Settings::values.enable_procon_driver);
WriteBasicSetting(Settings::values.keyboard_enabled);
WriteBasicSetting(Settings::values.emulate_analog_keyboard);
WriteBasicSetting(Settings::values.mouse_panning_sensitivity);
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp
index 77b976e74..8d81322f3 100644
--- a/src/yuzu/configuration/configure_input_advanced.cpp
+++ b/src/yuzu/configuration/configure_input_advanced.cpp
@@ -139,6 +139,7 @@ void ConfigureInputAdvanced::ApplyConfiguration() {
Settings::values.enable_ring_controller = ui->enable_ring_controller->isChecked();
Settings::values.enable_ir_sensor = ui->enable_ir_sensor->isChecked();
Settings::values.enable_joycon_driver = ui->enable_joycon_driver->isChecked();
+ Settings::values.enable_procon_driver = ui->enable_procon_driver->isChecked();
}
void ConfigureInputAdvanced::LoadConfiguration() {
@@ -174,6 +175,7 @@ void ConfigureInputAdvanced::LoadConfiguration() {
ui->enable_ring_controller->setChecked(Settings::values.enable_ring_controller.GetValue());
ui->enable_ir_sensor->setChecked(Settings::values.enable_ir_sensor.GetValue());
ui->enable_joycon_driver->setChecked(Settings::values.enable_joycon_driver.GetValue());
+ ui->enable_procon_driver->setChecked(Settings::values.enable_procon_driver.GetValue());
UpdateUIEnabled();
}
diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui
index 75d96d3ab..0eb2b34bc 100644
--- a/src/yuzu/configuration/configure_input_advanced.ui
+++ b/src/yuzu/configuration/configure_input_advanced.ui
@@ -2712,6 +2712,22 @@
</widget>
</item>
<item row="6" column="0">
+ <widget class="QCheckBox" name="enable_procon_driver">
+ <property name="toolTip">
+ <string>Requires restarting yuzu</string>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>23</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Enable direct Pro Controller driver [EXPERIMENTAL]</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
<widget class="QCheckBox" name="mouse_panning">
<property name="minimumSize">
<size>
@@ -2724,7 +2740,7 @@
</property>
</widget>
</item>
- <item row="6" column="2">
+ <item row="7" column="2">
<widget class="QSpinBox" name="mouse_panning_sensitivity">
<property name="toolTip">
<string>Mouse sensitivity</string>
@@ -2746,14 +2762,14 @@
</property>
</widget>
</item>
- <item row="7" column="0">
+ <item row="8" column="0">
<widget class="QLabel" name="motion_touch">
<property name="text">
<string>Motion / Touch</string>
</property>
</widget>
</item>
- <item row="7" column="2">
+ <item row="8" column="2">
<widget class="QPushButton" name="buttonMotionTouch">
<property name="text">
<string>Configure</string>
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 723690e71..50b62293e 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -1490,7 +1490,7 @@ void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) {
}
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
+ input_subsystem->GetMouse()->PressButton(0, 0, button);
}
void ConfigureInputPlayer::wheelEvent(QWheelEvent* event) {
diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp
index 1275f10c8..71afbc423 100644
--- a/src/yuzu/configuration/configure_ringcon.cpp
+++ b/src/yuzu/configuration/configure_ringcon.cpp
@@ -371,7 +371,7 @@ void ConfigureRingController::mousePressEvent(QMouseEvent* event) {
}
const auto button = GRenderWindow::QtButtonToMouseButton(event->button());
- input_subsystem->GetMouse()->PressButton(0, 0, 0, 0, button);
+ input_subsystem->GetMouse()->PressButton(0, 0, button);
}
void ConfigureRingController::keyPressEvent(QKeyEvent* event) {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 22aa19c56..c21828b1d 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -870,6 +870,7 @@ void GameList::ToggleFavorite(u64 program_id) {
tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true);
}
}
+ SaveConfig();
}
void GameList::AddFavorite(u64 program_id) {
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index f7ff93ed9..64e5af4c1 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -122,6 +122,7 @@ signals:
void AddDirectory();
void ShowList(bool show);
void PopulatingCompleted();
+ void SaveConfig();
private slots:
void OnItemExpanded(const QModelIndex& item);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index f28268e9b..f233b065e 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -219,7 +219,7 @@ static void LogRuntimes() {
#ifdef _MSC_VER
// It is possible that the name of the dll will change.
// vcruntime140.dll is for 2015 and onwards
- constexpr char runtime_dll_name[] = "vcruntime140.dll";
+ static constexpr char runtime_dll_name[] = "vcruntime140.dll";
UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr);
bool runtime_version_inspection_worked = false;
if (sz > 0) {
@@ -805,6 +805,8 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
layout.screen.GetHeight() / scale_ratio);
web_browser_view.move(layout.screen.left / scale_ratio,
(layout.screen.top / scale_ratio) + menuBar()->height());
+ web_browser_view.setZoomFactor(static_cast<qreal>(layout.screen.GetWidth() / scale_ratio) /
+ static_cast<qreal>(Layout::ScreenUndocked::Width));
web_browser_view.setFocus();
web_browser_view.show();
@@ -1163,6 +1165,14 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue());
});
connect_shortcut(QStringLiteral("Toggle Mouse Panning"), [&] {
+ if (Settings::values.mouse_enabled) {
+ Settings::values.mouse_panning = false;
+ QMessageBox::warning(
+ this, tr("Emulated mouse is enabled"),
+ tr("Real mouse input and mouse panning are incompatible. Please disable the "
+ "emulated mouse in input advanced settings to allow mouse panning."));
+ return;
+ }
Settings::values.mouse_panning = !Settings::values.mouse_panning;
if (Settings::values.mouse_panning) {
render_window->installEventFilter(render_window);
@@ -1269,6 +1279,7 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::ShowList, this, &GMainWindow::OnGameListShowList);
connect(game_list, &GameList::PopulatingCompleted,
[this] { multiplayer_state->UpdateGameList(game_list->GetModel()); });
+ connect(game_list, &GameList::SaveConfig, this, &GMainWindow::OnSaveConfig);
connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
&GMainWindow::OnGameListOpenPerGameProperties);
@@ -1777,7 +1788,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())}
.filename());
}
- const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess();
+ const bool is_64bit = system->Kernel().ApplicationProcess()->Is64BitProcess();
const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
.arg(QString::fromStdString(title_name), instruction_set_suffix)
@@ -2652,6 +2663,8 @@ void GMainWindow::OnGameListAddDirectory() {
} else {
LOG_WARNING(Frontend, "Selected directory is already in the game list");
}
+
+ OnSaveConfig();
}
void GMainWindow::OnGameListShowList(bool show) {
@@ -3013,8 +3026,10 @@ void GMainWindow::OnRestartGame() {
if (!system->IsPoweredOn()) {
return;
}
- // Make a copy since BootGame edits game_path
- BootGame(QString(current_game_path));
+ // Make a copy since ShutdownGame edits game_path
+ const auto current_game = QString(current_game_path);
+ ShutdownGame();
+ BootGame(current_game);
}
void GMainWindow::OnPauseGame() {
@@ -3378,6 +3393,7 @@ void GMainWindow::OnConfigureTas() {
return;
} else if (result == QDialog::Accepted) {
dialog.ApplyConfiguration();
+ OnSaveConfig();
}
}
@@ -3530,7 +3546,7 @@ void GMainWindow::OnToggleGraphicsAPI() {
}
void GMainWindow::OnConfigurePerGame() {
- const u64 title_id = system->GetCurrentProcessProgramID();
+ const u64 title_id = system->GetApplicationProcessProgramID();
OpenPerGameConfiguration(title_id, current_game_path.toStdString());
}
@@ -3689,7 +3705,7 @@ void GMainWindow::OnCaptureScreenshot() {
return;
}
- const u64 title_id = system->GetCurrentProcessProgramID();
+ const u64 title_id = system->GetApplicationProcessProgramID();
const auto screenshot_path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
const auto date =