summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/CMakeLists.txt17
-rw-r--r--src/common/fs/path_util.h2
-rw-r--r--src/core/hle/kernel/svc.cpp4
-rw-r--r--src/core/hle/service/service.h2
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp3
-rw-r--r--src/yuzu/util/limitable_input_dialog.cpp38
-rw-r--r--src/yuzu/util/limitable_input_dialog.h12
7 files changed, 61 insertions, 17 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 7a4d9e354..2d403d471 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -21,14 +21,14 @@ find_package(Git QUIET)
add_custom_command(OUTPUT scm_rev.cpp
COMMAND ${CMAKE_COMMAND}
- -DSRC_DIR="${CMAKE_SOURCE_DIR}"
- -DBUILD_REPOSITORY="${BUILD_REPOSITORY}"
- -DTITLE_BAR_FORMAT_IDLE="${TITLE_BAR_FORMAT_IDLE}"
- -DTITLE_BAR_FORMAT_RUNNING="${TITLE_BAR_FORMAT_RUNNING}"
- -DBUILD_TAG="${BUILD_TAG}"
- -DBUILD_ID="${DISPLAY_VERSION}"
- -DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
- -P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
+ -DSRC_DIR=${CMAKE_SOURCE_DIR}
+ -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
+ -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
+ -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
+ -DBUILD_TAG=${BUILD_TAG}
+ -DBUILD_ID=${DISPLAY_VERSION}
+ -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
+ -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
DEPENDS
# WARNING! It was too much work to try and make a common location for this list,
# so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well
@@ -92,6 +92,7 @@ add_custom_command(OUTPUT scm_rev.cpp
"${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
# technically we should regenerate if the git version changed, but its not worth the effort imo
"${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
+ VERBATIM
)
add_library(common STATIC
diff --git a/src/common/fs/path_util.h b/src/common/fs/path_util.h
index 14e8c35d7..f956ac9a2 100644
--- a/src/common/fs/path_util.h
+++ b/src/common/fs/path_util.h
@@ -209,7 +209,7 @@ void SetYuzuPath(YuzuPath yuzu_path, const std::filesystem::path& new_path);
#ifdef _WIN32
template <typename Path>
-[[nodiscard]] void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) {
+void SetYuzuPath(YuzuPath yuzu_path, const Path& new_path) {
if constexpr (IsChar<typename Path::value_type>) {
SetYuzuPath(yuzu_path, ToU8String(new_path));
} else {
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 28bcae6e7..8339e11a0 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -449,8 +449,8 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) {
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(
- static_cast<Handle>(handle));
+ system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
+ R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Cancel the thread's wait.
thread->WaitCancel();
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index ec757753c..7f133a7cb 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -42,7 +42,7 @@ class ServiceManager;
static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters)
/// Arbitrary default number of maximum connections to an HLE service.
-static const u32 DefaultMaxSessions = 64;
+static const u32 DefaultMaxSessions = 0x10000;
/**
* This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index ab3512810..d5d624b96 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -1395,7 +1395,8 @@ void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
void ConfigureInputPlayer::CreateProfile() {
const auto profile_name =
- LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 20);
+ LimitableInputDialog::GetText(this, tr("New Profile"), tr("Enter a profile name:"), 1, 20,
+ LimitableInputDialog::InputLimiter::Filesystem);
if (profile_name.isEmpty()) {
return;
diff --git a/src/yuzu/util/limitable_input_dialog.cpp b/src/yuzu/util/limitable_input_dialog.cpp
index edd78e579..6fea41f95 100644
--- a/src/yuzu/util/limitable_input_dialog.cpp
+++ b/src/yuzu/util/limitable_input_dialog.cpp
@@ -21,11 +21,13 @@ void LimitableInputDialog::CreateUI() {
text_label = new QLabel(this);
text_entry = new QLineEdit(this);
+ text_label_invalid = new QLabel(this);
buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
auto* const layout = new QVBoxLayout;
layout->addWidget(text_label);
layout->addWidget(text_entry);
+ layout->addWidget(text_label_invalid);
layout->addWidget(buttons);
setLayout(layout);
@@ -37,18 +39,36 @@ void LimitableInputDialog::ConnectEvents() {
}
QString LimitableInputDialog::GetText(QWidget* parent, const QString& title, const QString& text,
- int min_character_limit, int max_character_limit) {
+ int min_character_limit, int max_character_limit,
+ InputLimiter limit_type) {
Q_ASSERT(min_character_limit <= max_character_limit);
LimitableInputDialog dialog{parent};
dialog.setWindowTitle(title);
dialog.text_label->setText(text);
dialog.text_entry->setMaxLength(max_character_limit);
+ dialog.text_label_invalid->show();
+
+ switch (limit_type) {
+ case InputLimiter::Filesystem:
+ dialog.invalid_characters = QStringLiteral("<>:;\"/\\|,.!?*");
+ break;
+ default:
+ dialog.invalid_characters.clear();
+ dialog.text_label_invalid->hide();
+ break;
+ }
+ dialog.text_label_invalid->setText(
+ tr("The text can't contain any of the following characters:\n%1")
+ .arg(dialog.invalid_characters));
auto* const ok_button = dialog.buttons->button(QDialogButtonBox::Ok);
ok_button->setEnabled(false);
- connect(dialog.text_entry, &QLineEdit::textEdited, [&](const QString& new_text) {
- ok_button->setEnabled(new_text.length() >= min_character_limit);
+ connect(dialog.text_entry, &QLineEdit::textEdited, [&] {
+ if (!dialog.invalid_characters.isEmpty()) {
+ dialog.RemoveInvalidCharacters();
+ }
+ ok_button->setEnabled(dialog.text_entry->text().length() >= min_character_limit);
});
if (dialog.exec() != QDialog::Accepted) {
@@ -57,3 +77,15 @@ QString LimitableInputDialog::GetText(QWidget* parent, const QString& title, con
return dialog.text_entry->text();
}
+
+void LimitableInputDialog::RemoveInvalidCharacters() {
+ auto cpos = text_entry->cursorPosition();
+ for (int i = 0; i < text_entry->text().length(); i++) {
+ if (invalid_characters.contains(text_entry->text().at(i))) {
+ text_entry->setText(text_entry->text().remove(i, 1));
+ i--;
+ cpos--;
+ }
+ }
+ text_entry->setCursorPosition(cpos);
+}
diff --git a/src/yuzu/util/limitable_input_dialog.h b/src/yuzu/util/limitable_input_dialog.h
index 164ad7301..a8e31098b 100644
--- a/src/yuzu/util/limitable_input_dialog.h
+++ b/src/yuzu/util/limitable_input_dialog.h
@@ -18,14 +18,24 @@ public:
explicit LimitableInputDialog(QWidget* parent = nullptr);
~LimitableInputDialog() override;
+ enum class InputLimiter {
+ None,
+ Filesystem,
+ };
+
static QString GetText(QWidget* parent, const QString& title, const QString& text,
- int min_character_limit, int max_character_limit);
+ int min_character_limit, int max_character_limit,
+ InputLimiter limit_type = InputLimiter::None);
private:
void CreateUI();
void ConnectEvents();
+ void RemoveInvalidCharacters();
+ QString invalid_characters;
+
QLabel* text_label;
QLineEdit* text_entry;
+ QLabel* text_label_invalid;
QDialogButtonBox* buttons;
};