diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/file_sys/errors.h | 1 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 4 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.h | 9 | ||||
-rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 2 | ||||
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 8 | ||||
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.h | 1 | ||||
-rw-r--r-- | src/yuzu/applets/web_browser.cpp | 19 | ||||
-rw-r--r-- | src/yuzu/applets/web_browser.h | 11 | ||||
-rw-r--r-- | src/yuzu/game_list.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/game_list_p.h | 2 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/main.h | 2 |
14 files changed, 51 insertions, 36 deletions
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index bb4654366..1a920b45d 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h @@ -9,6 +9,7 @@ namespace FileSys { constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; +constexpr ResultCode ERROR_PATH_ALREADY_EXISTS{ErrorModule::FS, 2}; constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005}; diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 50db6a654..be4736f47 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -12,7 +12,7 @@ WebBrowserApplet::~WebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; void DefaultWebBrowserApplet::OpenLocalWebPage( - std::string_view local_url, std::function<void()> extract_romfs_callback, + const std::string& local_url, std::function<void()> extract_romfs_callback, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); @@ -21,7 +21,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage( } void DefaultWebBrowserApplet::OpenExternalWebPage( - std::string_view external_url, + const std::string& external_url, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 1c5ef19a9..d7bd44c27 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -16,11 +16,11 @@ public: virtual ~WebBrowserApplet(); virtual void OpenLocalWebPage( - std::string_view local_url, std::function<void()> extract_romfs_callback, + const std::string& local_url, std::function<void()> extract_romfs_callback, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; virtual void OpenExternalWebPage( - std::string_view external_url, + const std::string& external_url, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; }; @@ -28,11 +28,12 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet { public: ~DefaultWebBrowserApplet() override; - void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback, + void OpenLocalWebPage(const std::string& local_url, + std::function<void()> extract_romfs_callback, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const override; - void OpenExternalWebPage(std::string_view external_url, + void OpenExternalWebPage(const std::string& external_url, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const override; }; diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 72ad273b2..67b2b3102 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -55,10 +55,15 @@ std::string VfsDirectoryServiceWrapper::GetName() const { ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { std::string path(Common::FS::SanitizePath(path_)); auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); - // dir can be nullptr if path contains subdirectories, create those prior to creating the file. if (dir == nullptr) { - dir = backing->CreateSubdirectory(Common::FS::GetParentPath(path)); + return FileSys::ERROR_PATH_NOT_FOUND; + } + + const auto entry_type = GetEntryType(path); + if (entry_type.Code() == RESULT_SUCCESS) { + return FileSys::ERROR_PATH_ALREADY_EXISTS; } + auto file = dir->CreateFile(Common::FS::GetFilename(path)); if (file == nullptr) { // TODO(DarkLordZach): Find a better error code for this diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 155808f6a..71545bf1f 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -33,7 +33,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u shared_memory.header.timestamp = core_timing.GetCPUTicks(); shared_memory.header.total_entry_count = 17; - if (!IsControllerActivated()) { + if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { shared_memory.header.entry_count = 0; shared_memory.header.last_entry_index = 0; return; diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index b5f8077be..8f56a0255 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -33,7 +33,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin shared_memory.header.timestamp = core_timing.GetCPUTicks(); shared_memory.header.total_entry_count = 17; - if (!IsControllerActivated()) { + if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { shared_memory.header.entry_count = 0; shared_memory.header.last_entry_index = 0; return; diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index ec3167bea..320f51ee6 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp @@ -155,8 +155,12 @@ void Adapter::UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_pa for (const PadAxes axis : axes) { const auto index = static_cast<std::size_t>(axis); const u8 axis_value = adapter_payload[offset + 3 + index]; - if (pads[port].axis_origin[index] == 255) { + if (pads[port].reset_origin_counter <= 18) { + if (pads[port].axis_origin[index] != axis_value) { + pads[port].reset_origin_counter = 0; + } pads[port].axis_origin[index] = axis_value; + pads[port].reset_origin_counter++; } pads[port].axis_values[index] = static_cast<s16>(axis_value - pads[port].axis_origin[index]); @@ -375,7 +379,7 @@ void Adapter::ResetDevice(std::size_t port) { pads[port].buttons = 0; pads[port].last_button = PadButton::Undefined; pads[port].axis_values.fill(0); - pads[port].axis_origin.fill(255); + pads[port].reset_origin_counter = 0; } void Adapter::Reset() { diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index 7a6c545bd..e5de5e94f 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h @@ -70,6 +70,7 @@ struct GCController { PadButton last_button{}; std::array<s16, 6> axis_values{}; std::array<u8, 6> axis_origin{}; + u8 reset_origin_counter{}; }; class Adapter { diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/web_browser.cpp index e482ba029..93e3a4f6f 100644 --- a/src/yuzu/applets/web_browser.cpp +++ b/src/yuzu/applets/web_browser.cpp @@ -102,8 +102,8 @@ QtNXWebEngineView::~QtNXWebEngineView() { StopInputThread(); } -void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url, - std::string_view additional_args) { +void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, + const std::string& additional_args) { is_local = true; LoadExtractedFonts(); @@ -113,12 +113,12 @@ void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url, SetLastURL("http://localhost/"); StartInputThread(); - load(QUrl(QUrl::fromLocalFile(QString::fromStdString(std::string(main_url))).toString() + - QString::fromStdString(std::string(additional_args)))); + load(QUrl(QUrl::fromLocalFile(QString::fromStdString(main_url)).toString() + + QString::fromStdString(additional_args))); } -void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url, - std::string_view additional_args) { +void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, + const std::string& additional_args) { is_local = false; SetUserAgent(UserAgent::WebApplet); @@ -127,8 +127,7 @@ void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url, SetLastURL("http://localhost/"); StartInputThread(); - load(QUrl(QString::fromStdString(std::string(main_url)) + - QString::fromStdString(std::string(additional_args)))); + load(QUrl(QString::fromStdString(main_url) + QString::fromStdString(additional_args))); } void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) { @@ -375,7 +374,7 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { QtWebBrowser::~QtWebBrowser() = default; void QtWebBrowser::OpenLocalWebPage( - std::string_view local_url, std::function<void()> extract_romfs_callback_, + const std::string& local_url, std::function<void()> extract_romfs_callback_, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { extract_romfs_callback = std::move(extract_romfs_callback_); callback = std::move(callback_); @@ -390,7 +389,7 @@ void QtWebBrowser::OpenLocalWebPage( } void QtWebBrowser::OpenExternalWebPage( - std::string_view external_url, + const std::string& external_url, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { callback = std::move(callback_); diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h index 47f960d69..7ad07409f 100644 --- a/src/yuzu/applets/web_browser.h +++ b/src/yuzu/applets/web_browser.h @@ -58,7 +58,7 @@ public: * @param main_url The url to the file. * @param additional_args Additional arguments appended to the main url. */ - void LoadLocalWebPage(std::string_view main_url, std::string_view additional_args); + void LoadLocalWebPage(const std::string& main_url, const std::string& additional_args); /** * Loads an external website. Cannot be used to load local urls. @@ -66,7 +66,7 @@ public: * @param main_url The url to the website. * @param additional_args Additional arguments appended to the main url. */ - void LoadExternalWebPage(std::string_view main_url, std::string_view additional_args); + void LoadExternalWebPage(const std::string& main_url, const std::string& additional_args); /** * Sets the background color of the web page. @@ -193,16 +193,17 @@ public: explicit QtWebBrowser(GMainWindow& parent); ~QtWebBrowser() override; - void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback_, + void OpenLocalWebPage(const std::string& local_url, + std::function<void()> extract_romfs_callback_, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const override; - void OpenExternalWebPage(std::string_view external_url, + void OpenExternalWebPage(const std::string& external_url, std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const override; signals: - void MainWindowOpenWebPage(std::string_view main_url, std::string_view additional_args, + void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, bool is_local) const; private: diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 5ff3932dc..63cf82f7d 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -85,8 +85,8 @@ void GameListSearchField::setFilterResult(int visible, int total) { label_filter_result->setText(tr("%1 of %n result(s)", "", total).arg(visible)); } -bool GameListSearchField::isEmpty() const { - return edit_filter->text().isEmpty(); +QString GameListSearchField::filterText() const { + return edit_filter->text(); } QString GameList::GetLastFilterResultItem() const { @@ -236,9 +236,9 @@ void GameList::OnTextChanged(const QString& new_text) { } else { tree_view->setRowHidden(j, folder_index, true); } - search_field->setFilterResult(result_count, children_total); } } + search_field->setFilterResult(result_count, children_total); } } @@ -595,6 +595,7 @@ void GameList::AddCustomDirPopup(QMenu& context_menu, QModelIndex selected) { connect(delete_dir, &QAction::triggered, [this, &game_dir, selected] { UISettings::values.game_dirs.removeOne(game_dir); item_model->invisibleRootItem()->removeRow(selected.row()); + OnTextChanged(search_field->filterText()); }); } @@ -776,7 +777,7 @@ void GameList::RefreshGameDirectory() { void GameList::ToggleFavorite(u64 program_id) { if (!UISettings::values.favorited_ids.contains(program_id)) { tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), - !search_field->isEmpty()); + !search_field->filterText().isEmpty()); UISettings::values.favorited_ids.append(program_id); AddFavorite(program_id); item_model->sort(tree_view->header()->sortIndicatorSection(), diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 7ca8ece23..978d27325 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -346,8 +346,8 @@ class GameListSearchField : public QWidget { public: explicit GameListSearchField(GameList* parent = nullptr); + QString filterText() const; void setFilterResult(int visible, int total); - bool isEmpty() const; void clear(); void setFocus(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 39bdf186d..00d4cfe67 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -574,8 +574,8 @@ void GMainWindow::SoftwareKeyboardExit() { software_keyboard = nullptr; } -void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, - bool is_local) { +void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, + const std::string& additional_args, bool is_local) { #ifdef YUZU_USE_QT_WEB_ENGINE if (disable_web_applet) { @@ -596,13 +596,15 @@ void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_v loading_progress.setRange(0, 3); loading_progress.setValue(0); - if (is_local && !Common::FS::Exists(std::string(main_url))) { + if (is_local && !Common::FS::Exists(main_url)) { loading_progress.show(); auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); }); while (!future.isFinished()) { QCoreApplication::processEvents(); + + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7f1e50a5b..98a608fce 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -159,7 +159,7 @@ public slots: void SoftwareKeyboardExit(); void ErrorDisplayDisplayError(QString error_code, QString error_text); void ProfileSelectorSelectProfile(); - void WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, + void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args, bool is_local); void OnAppFocusStateChanged(Qt::ApplicationState state); |