summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/fs/path_util.cpp27
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp10
-rw-r--r--src/input_common/sdl/sdl_impl.cpp7
-rw-r--r--src/video_core/command_classes/codecs/h264.cpp7
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp4
-rw-r--r--src/yuzu/configuration/configure_tas.ui8
-rw-r--r--src/yuzu/debugger/profiler.cpp12
-rw-r--r--src/yuzu/game_list.cpp3
-rw-r--r--src/yuzu/main.cpp39
-rw-r--r--src/yuzu/main.h2
-rw-r--r--src/yuzu/main.ui48
11 files changed, 99 insertions, 68 deletions
diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp
index 43b79bd6d..1bcb897b5 100644
--- a/src/common/fs/path_util.cpp
+++ b/src/common/fs/path_util.cpp
@@ -82,32 +82,35 @@ public:
private:
PathManagerImpl() {
+ fs::path yuzu_path;
+ fs::path yuzu_path_cache;
+ fs::path yuzu_path_config;
+
#ifdef _WIN32
- auto yuzu_path = GetExeDirectory() / PORTABLE_DIR;
+ yuzu_path = GetExeDirectory() / PORTABLE_DIR;
if (!IsDir(yuzu_path)) {
yuzu_path = GetAppDataRoamingDirectory() / YUZU_DIR;
}
- GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
- GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR);
- GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
+ yuzu_path_cache = yuzu_path / CACHE_DIR;
+ yuzu_path_config = yuzu_path / CONFIG_DIR;
#else
- auto yuzu_path = GetCurrentDir() / PORTABLE_DIR;
+ yuzu_path = GetCurrentDir() / PORTABLE_DIR;
if (Exists(yuzu_path) && IsDir(yuzu_path)) {
- GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
- GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path / CACHE_DIR);
- GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path / CONFIG_DIR);
+ yuzu_path_cache = yuzu_path / CACHE_DIR;
+ yuzu_path_config = yuzu_path / CONFIG_DIR;
} else {
yuzu_path = GetDataDirectory("XDG_DATA_HOME") / YUZU_DIR;
-
- GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
- GenerateYuzuPath(YuzuPath::CacheDir, GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR);
- GenerateYuzuPath(YuzuPath::ConfigDir, GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR);
+ yuzu_path_cache = GetDataDirectory("XDG_CACHE_HOME") / YUZU_DIR;
+ yuzu_path_config = GetDataDirectory("XDG_CONFIG_HOME") / YUZU_DIR;
}
#endif
+ GenerateYuzuPath(YuzuPath::YuzuDir, yuzu_path);
+ GenerateYuzuPath(YuzuPath::CacheDir, yuzu_path_cache);
+ GenerateYuzuPath(YuzuPath::ConfigDir, yuzu_path_config);
GenerateYuzuPath(YuzuPath::DumpDir, yuzu_path / DUMP_DIR);
GenerateYuzuPath(YuzuPath::KeysDir, yuzu_path / KEYS_DIR);
GenerateYuzuPath(YuzuPath::LoadDir, yuzu_path / LOAD_DIR);
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index 35f194961..927eeefff 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -24,6 +24,7 @@
#include "core/hle/service/am/applets/applet_web_browser.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/pl_u.h"
+#include "core/loader/loader.h"
namespace Service::AM::Applets {
@@ -122,6 +123,15 @@ FileSys::VirtualFile GetOfflineRomFS(Core::System& system, u64 title_id,
const auto nca = system.GetContentProvider().GetEntry(title_id, nca_type);
if (nca == nullptr) {
+ if (nca_type == FileSys::ContentRecordType::HtmlDocument) {
+ LOG_WARNING(Service_AM, "Falling back to AppLoader to get the RomFS.");
+ FileSys::VirtualFile romfs;
+ system.GetAppLoader().ReadManualRomFS(romfs);
+ if (romfs != nullptr) {
+ return romfs;
+ }
+ }
+
LOG_ERROR(Service_AM,
"NCA of type={} with title_id={:016X} is not found in the ContentProvider!",
nca_type, title_id);
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index ab6211b29..ecb00d428 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -170,7 +170,8 @@ public:
float GetAxis(int axis, float range, float offset) const {
std::lock_guard lock{mutex};
const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f;
- return (value + offset) / range;
+ const float offset_scale = (value + offset) > 0.0f ? 1.0f + offset : 1.0f - offset;
+ return (value + offset) / range / offset_scale;
}
bool RumblePlay(u16 amp_low, u16 amp_high) {
@@ -789,8 +790,8 @@ public:
const std::string invert_y_value = params.Get("invert_y", "+");
const bool invert_x = invert_x_value == "-";
const bool invert_y = invert_y_value == "-";
- const float offset_x = params.Get("offset_x", 0.0f);
- const float offset_y = params.Get("offset_y", 0.0f);
+ const float offset_x = std::clamp(params.Get("offset_x", 0.0f), -0.99f, 0.99f);
+ const float offset_y = std::clamp(params.Get("offset_y", 0.0f), -0.99f, 0.99f);
auto joystick = state.GetSDLJoystickByGUID(guid, port);
// This is necessary so accessing GetAxis with axis_x and axis_y won't crash
diff --git a/src/video_core/command_classes/codecs/h264.cpp b/src/video_core/command_classes/codecs/h264.cpp
index 51ee14c13..5519c4705 100644
--- a/src/video_core/command_classes/codecs/h264.cpp
+++ b/src/video_core/command_classes/codecs/h264.cpp
@@ -20,6 +20,8 @@
#include <array>
#include <bit>
+
+#include "common/settings.h"
#include "video_core/command_classes/codecs/h264.h"
#include "video_core/gpu.h"
#include "video_core/memory_manager.h"
@@ -96,7 +98,10 @@ const std::vector<u8>& H264::ComposeFrameHeader(const NvdecCommon::NvdecRegister
(context.h264_parameter_set.frame_mbs_only_flag ? 1 : 2);
// TODO (ameerj): Where do we get this number, it seems to be particular for each stream
- writer.WriteUe(6); // Max number of reference frames
+ const auto nvdec_decoding = Settings::values.nvdec_emulation.GetValue();
+ const bool uses_gpu_decoding = nvdec_decoding == Settings::NvdecEmulation::GPU;
+ const u32 max_num_ref_frames = uses_gpu_decoding ? 6u : 16u;
+ writer.WriteUe(max_num_ref_frames);
writer.WriteBit(false);
writer.WriteUe(context.h264_parameter_set.pic_width_in_mbs - 1);
writer.WriteUe(pic_height - 1);
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index da328d904..f31f86339 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -1837,7 +1837,7 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) {
const float led_size = 5.0f;
const QPointF led_position = sideview_center + QPointF(0, -36);
int led_count = 0;
- for (const auto color : led_color) {
+ for (const auto& color : led_color) {
p.setBrush(color);
DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size);
}
@@ -1933,7 +1933,7 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) {
const float led_size = 5.0f;
const QPointF led_position = sideview_center + QPointF(0, -36);
int led_count = 0;
- for (const auto color : led_color) {
+ for (const auto& color : led_color) {
p.setBrush(color);
DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size);
}
diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui
index 3972f9083..6caa19031 100644
--- a/src/yuzu/configuration/configure_tas.ui
+++ b/src/yuzu/configuration/configure_tas.ui
@@ -2,14 +2,6 @@
<ui version="4.0">
<class>ConfigureTas</class>
<widget class="QDialog" name="ConfigureTas">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>337</width>
- <height>316</height>
- </rect>
- </property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_1">
diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp
index 7a6f84d96..33110685a 100644
--- a/src/yuzu/debugger/profiler.cpp
+++ b/src/yuzu/debugger/profiler.cpp
@@ -143,24 +143,28 @@ void MicroProfileWidget::hideEvent(QHideEvent* ev) {
}
void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0);
+ const auto mouse_position = ev->pos();
+ MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
ev->accept();
}
void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0);
+ const auto mouse_position = ev->pos();
+ MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
ev->accept();
}
void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) {
- MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale, 0);
+ const auto mouse_position = ev->pos();
+ MicroProfileMousePosition(mouse_position.x() / x_scale, mouse_position.y() / y_scale, 0);
MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton);
ev->accept();
}
void MicroProfileWidget::wheelEvent(QWheelEvent* ev) {
- MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale,
+ const auto wheel_position = ev->position().toPoint();
+ MicroProfileMousePosition(wheel_position.x() / x_scale, wheel_position.y() / y_scale,
ev->angleDelta().y() / 120);
ev->accept();
}
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index f9d949e75..ba54423ff 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -159,8 +159,7 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
* @return true if the haystack contains all words of userinput
*/
static bool ContainsAllWords(const QString& haystack, const QString& userinput) {
- const QStringList userinput_split =
- userinput.split(QLatin1Char{' '}, QString::SplitBehavior::SkipEmptyParts);
+ const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts);
return std::all_of(userinput_split.begin(), userinput_split.end(),
[&haystack](const QString& s) { return haystack.contains(s); });
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 552c2cc63..3eea61354 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1172,10 +1172,16 @@ void GMainWindow::ConnectMenuEvents() {
&GMainWindow::OnDisplayTitleBars);
connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
+
connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this,
&GMainWindow::ResetWindowSize720);
+ connect(ui.action_Reset_Window_Size_900, &QAction::triggered, this,
+ &GMainWindow::ResetWindowSize900);
connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this,
&GMainWindow::ResetWindowSize1080);
+ ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_720);
+ ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_900);
+ ui.menu_Reset_Window_Size->addAction(ui.action_Reset_Window_Size_1080);
// Fullscreen
connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
@@ -2621,32 +2627,29 @@ void GMainWindow::ToggleWindowMode() {
}
}
-void GMainWindow::ResetWindowSize720() {
+void GMainWindow::ResetWindowSize(u32 width, u32 height) {
const auto aspect_ratio = Layout::EmulationAspectRatio(
static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
- static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width);
+ static_cast<float>(height) / width);
if (!ui.action_Single_Window_Mode->isChecked()) {
- render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio,
- Layout::ScreenUndocked::Height);
+ render_window->resize(height / aspect_ratio, height);
} else {
- resize(Layout::ScreenUndocked::Height / aspect_ratio,
- Layout::ScreenUndocked::Height + menuBar()->height() +
- (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
+ const bool show_status_bar = ui.action_Show_Status_Bar->isChecked();
+ const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
+ resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
}
}
+void GMainWindow::ResetWindowSize720() {
+ ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
+}
+
+void GMainWindow::ResetWindowSize900() {
+ ResetWindowSize(1600U, 900U);
+}
+
void GMainWindow::ResetWindowSize1080() {
- const auto aspect_ratio = Layout::EmulationAspectRatio(
- static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
- static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width);
- if (!ui.action_Single_Window_Mode->isChecked()) {
- render_window->resize(Layout::ScreenDocked::Height / aspect_ratio,
- Layout::ScreenDocked::Height);
- } else {
- resize(Layout::ScreenDocked::Height / aspect_ratio,
- Layout::ScreenDocked::Height + menuBar()->height() +
- (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
- }
+ ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height);
}
void GMainWindow::OnConfigure() {
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 60ce01471..5df2c9422 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -272,7 +272,9 @@ private slots:
void ShowFullscreen();
void HideFullscreen();
void ToggleWindowMode();
+ void ResetWindowSize(u32 width, u32 height);
void ResetWindowSize720();
+ void ResetWindowSize900();
void ResetWindowSize1080();
void OnCaptureScreenshot();
void OnCoreError(Core::System::ResultStatus, std::string);
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui
index 653c010d8..a62e39a06 100644
--- a/src/yuzu/main.ui
+++ b/src/yuzu/main.ui
@@ -78,6 +78,35 @@
<property name="title">
<string>&amp;View</string>
</property>
+ <widget class="QMenu" name="menu_Reset_Window_Size">
+ <property name="title">
+ <string>&amp;Reset Window Size</string>
+ </property>
+ </widget>
+ <action name="action_Reset_Window_Size_720">
+ <property name="text">
+ <string>Reset Window Size to &amp;720p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 720p</string>
+ </property>
+ </action>
+ <action name="action_Reset_Window_Size_900">
+ <property name="text">
+ <string>Reset Window Size to &amp;900p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 900p</string>
+ </property>
+ </action>
+ <action name="action_Reset_Window_Size_1080">
+ <property name="text">
+ <string>Reset Window Size to &amp;1080p</string>
+ </property>
+ <property name="iconText">
+ <string>Reset Window Size to 1080p</string>
+ </property>
+ </action>
<widget class="QMenu" name="menu_View_Debugging">
<property name="title">
<string>&amp;Debugging</string>
@@ -88,9 +117,8 @@
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Show_Filter_Bar"/>
<addaction name="action_Show_Status_Bar"/>
- <addaction name="action_Reset_Window_Size_720"/>
- <addaction name="action_Reset_Window_Size_1080"/>
<addaction name="separator"/>
+ <addaction name="menu_Reset_Window_Size"/>
<addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Tools">
@@ -216,22 +244,6 @@
<string>Show Status Bar</string>
</property>
</action>
- <action name="action_Reset_Window_Size_720">
- <property name="text">
- <string>Reset Window Size to &amp;720p</string>
- </property>
- <property name="iconText">
- <string>Reset Window Size to 720p</string>
- </property>
- </action>
- <action name="action_Reset_Window_Size_1080">
- <property name="text">
- <string>Reset Window Size to &amp;1080p</string>
- </property>
- <property name="iconText">
- <string>Reset Window Size to 1080p</string>
- </property>
- </action>
<action name="action_Fullscreen">
<property name="checkable">
<bool>true</bool>