diff options
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/yuzu/about_dialog.cpp | 6 | ||||
-rw-r--r-- | src/yuzu/aboutdialog.ui | 16 | ||||
-rw-r--r-- | src/yuzu/applets/qt_software_keyboard.cpp | 29 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 69 | ||||
-rw-r--r-- | src/yuzu/bootmanager.h | 16 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 5 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_debug.cpp | 9 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_debug.ui | 54 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 39 |
10 files changed, 158 insertions, 91 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 2e32dea09..1c50295c1 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -244,7 +244,7 @@ elseif(WIN32) if(MSVC) set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") elseif(MINGW) - set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "-mwindows") + set_target_properties(yuzu PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows") endif() endif() @@ -323,3 +323,7 @@ endif() if (NOT APPLE) target_compile_definitions(yuzu PRIVATE HAS_OPENGL) endif() + +if (ARCHITECTURE_x86_64) + target_link_libraries(yuzu PRIVATE dynarmic) +endif() diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index cbcef7b45..eeff54359 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -19,7 +19,11 @@ AboutDialog::AboutDialog(QWidget* parent) const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build; ui->setupUi(this); - ui->labelLogo->setPixmap(QIcon::fromTheme(QStringLiteral("yuzu")).pixmap(200)); + // Try and request the icon from Qt theme (Linux?) + const QIcon yuzu_logo = QIcon::fromTheme(QStringLiteral("org.yuzu_emu.yuzu")); + if (!yuzu_logo.isNull()) { + ui->labelLogo->setPixmap(yuzu_logo.pixmap(200)); + } ui->labelBuildInfo->setText( ui->labelBuildInfo->text().arg(QString::fromStdString(yuzu_build_version), QString::fromUtf8(Common::g_build_date).left(10))); diff --git a/src/yuzu/aboutdialog.ui b/src/yuzu/aboutdialog.ui index 2f7ddc7f3..1dd7b74bf 100644 --- a/src/yuzu/aboutdialog.ui +++ b/src/yuzu/aboutdialog.ui @@ -26,8 +26,20 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="maximumSize"> + <size> + <width>200</width> + <height>200</height> + </size> + </property> <property name="text"> - <string><html><head/><body><p><img src=":/icons/yuzu.png"/></p></body></html></string> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../../dist/qt_themes/default/default.qrc">:/icons/default/256x256/yuzu.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> </property> </widget> </item> @@ -152,7 +164,7 @@ p, li { white-space: pre-wrap; } </layout> </widget> <resources> - <include location="../../dist/icons/icons.qrc"/> + <include location="../../dist/qt_themes_default/default/default.qrc"/> </resources> <connections> <connection> diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp index d3cf0b43b..e8b217d90 100644 --- a/src/yuzu/applets/qt_software_keyboard.cpp +++ b/src/yuzu/applets/qt_software_keyboard.cpp @@ -411,11 +411,11 @@ void QtSoftwareKeyboardDialog::ShowTextCheckDialog( break; } - auto text = ui->topOSK->currentIndex() == 1 - ? ui->text_edit_osk->toPlainText().toStdU16String() - : ui->line_edit_osk->text().toStdU16String(); + const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText() + : ui->line_edit_osk->text(); + auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size()); - emit SubmitNormalText(SwkbdResult::Ok, std::move(text), true); + emit SubmitNormalText(SwkbdResult::Ok, std::move(text_str), true); break; } } @@ -562,7 +562,7 @@ void QtSoftwareKeyboardDialog::keyPressEvent(QKeyEvent* event) { return; } - InlineTextInsertString(entered_text.toStdU16String()); + InlineTextInsertString(Common::U16StringFromBuffer(entered_text.utf16(), entered_text.size())); } void QtSoftwareKeyboardDialog::MoveAndResizeWindow(QPoint pos, QSize size) { @@ -1119,11 +1119,11 @@ void QtSoftwareKeyboardDialog::NormalKeyboardButtonClicked(QPushButton* button) } if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) { - auto text = ui->topOSK->currentIndex() == 1 - ? ui->text_edit_osk->toPlainText().toStdU16String() - : ui->line_edit_osk->text().toStdU16String(); + const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText() + : ui->line_edit_osk->text(); + auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size()); - emit SubmitNormalText(SwkbdResult::Ok, std::move(text)); + emit SubmitNormalText(SwkbdResult::Ok, std::move(text_str)); return; } @@ -1189,7 +1189,8 @@ void QtSoftwareKeyboardDialog::InlineKeyboardButtonClicked(QPushButton* button) return; } - InlineTextInsertString(button->text().toStdU16String()); + const auto button_text = button->text(); + InlineTextInsertString(Common::U16StringFromBuffer(button_text.utf16(), button_text.size())); // Revert the keyboard to lowercase if the shift key is active. if (bottom_osk_index == BottomOSKIndex::UpperCase && !caps_lock_enabled) { @@ -1282,11 +1283,11 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(Core::HID::NpadButton button if (is_inline) { emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position); } else { - auto text = ui->topOSK->currentIndex() == 1 - ? ui->text_edit_osk->toPlainText().toStdU16String() - : ui->line_edit_osk->text().toStdU16String(); + const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText() + : ui->line_edit_osk->text(); + auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size()); - emit SubmitNormalText(SwkbdResult::Cancel, std::move(text)); + emit SubmitNormalText(SwkbdResult::Cancel, std::move(text_str)); } break; case Core::HID::NpadButton::Y: diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index e9fac839f..bde465485 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -50,6 +50,7 @@ void EmuThread::run() { auto& gpu = system.GPU(); auto stop_token = stop_source.get_token(); + bool debugger_should_start = system.DebuggerEnabled(); system.RegisterHostThread(); @@ -89,6 +90,12 @@ void EmuThread::run() { this->SetRunning(false); emit ErrorThrown(result, system.GetStatusDetails()); } + + if (debugger_should_start) { + system.InitializeDebugger(); + debugger_should_start = false; + } + running_wait.Wait(); result = system.Pause(); if (result != Core::SystemResultStatus::Success) { @@ -102,11 +109,9 @@ void EmuThread::run() { was_active = true; emit DebugModeEntered(); } - } else if (exec_step) { - UNIMPLEMENTED(); } else { std::unique_lock lock{running_mutex}; - running_cv.wait(lock, stop_token, [this] { return IsRunning() || exec_step; }); + running_cv.wait(lock, stop_token, [this] { return IsRunning(); }); } } @@ -772,65 +777,25 @@ 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) { - if (!TouchUpdate(touch_point)) { - TouchStart(touch_point); - } + const auto [x, y] = ScaleTouch(touch_point.pos()); + const auto [touch_x, touch_y] = MapToTouchScreen(x, y); + input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id()); } } void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) { QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints(); + input_subsystem->GetTouchScreen()->ClearActiveFlag(); for (const auto& touch_point : touch_points) { - if (!TouchUpdate(touch_point)) { - TouchStart(touch_point); - } - } - // Release all inactive points - for (std::size_t id = 0; id < touch_ids.size(); ++id) { - if (!TouchExist(touch_ids[id], touch_points)) { - touch_ids[id] = 0; - input_subsystem->GetTouchScreen()->TouchReleased(id); - } + const auto [x, y] = ScaleTouch(touch_point.pos()); + const auto [touch_x, touch_y] = MapToTouchScreen(x, y); + input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id()); } + input_subsystem->GetTouchScreen()->ReleaseInactiveTouch(); } void GRenderWindow::TouchEndEvent() { - for (std::size_t id = 0; id < touch_ids.size(); ++id) { - if (touch_ids[id] != 0) { - touch_ids[id] = 0; - input_subsystem->GetTouchScreen()->TouchReleased(id); - } - } -} - -void GRenderWindow::TouchStart(const QTouchEvent::TouchPoint& touch_point) { - for (std::size_t id = 0; id < touch_ids.size(); ++id) { - if (touch_ids[id] == 0) { - touch_ids[id] = touch_point.id() + 1; - const auto [x, y] = ScaleTouch(touch_point.pos()); - const auto [touch_x, touch_y] = MapToTouchScreen(x, y); - input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, id); - } - } -} - -bool GRenderWindow::TouchUpdate(const QTouchEvent::TouchPoint& touch_point) { - for (std::size_t id = 0; id < touch_ids.size(); ++id) { - if (touch_ids[id] == static_cast<std::size_t>(touch_point.id() + 1)) { - const auto [x, y] = ScaleTouch(touch_point.pos()); - const auto [touch_x, touch_y] = MapToTouchScreen(x, y); - input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, id); - return true; - } - } - return false; -} - -bool GRenderWindow::TouchExist(std::size_t id, - const QList<QTouchEvent::TouchPoint>& touch_points) const { - return std::any_of(touch_points.begin(), touch_points.end(), [id](const auto& point) { - return id == static_cast<std::size_t>(point.id() + 1); - }); + input_subsystem->GetTouchScreen()->ReleaseAllTouch(); } bool GRenderWindow::event(QEvent* event) { diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 281d5bfbe..d01538039 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -55,15 +55,6 @@ public: void run() override; /** - * Steps the emulation thread by a single CPU instruction (if the CPU is not already running) - * @note This function is thread-safe - */ - void ExecStep() { - exec_step = true; - running_cv.notify_all(); - } - - /** * Sets whether the emulation thread is running or not * @param running Boolean value, set the emulation thread to running if true * @note This function is thread-safe @@ -99,7 +90,6 @@ public: } private: - bool exec_step = false; bool running = false; std::stop_source stop_source; std::mutex running_mutex; @@ -217,10 +207,6 @@ private: void TouchUpdateEvent(const QTouchEvent* event); void TouchEndEvent(); - void TouchStart(const QTouchEvent::TouchPoint& touch_point); - bool TouchUpdate(const QTouchEvent::TouchPoint& touch_point); - bool TouchExist(std::size_t id, const QList<QTouchEvent::TouchPoint>& touch_points) const; - void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override; bool InitializeOpenGL(); @@ -246,8 +232,6 @@ private: bool first_frame = false; InputCommon::TasInput::TasState last_tas_state; - std::array<std::size_t, 16> touch_ids{}; - Core::System& system; protected: diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index ac26b885b..583e9df24 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -525,6 +525,9 @@ void Config::ReadDebuggingValues() { // Intentionally not using the QT default setting as this is intended to be changed in the ini Settings::values.record_frame_times = qt_config->value(QStringLiteral("record_frame_times"), false).toBool(); + + ReadBasicSetting(Settings::values.use_gdbstub); + ReadBasicSetting(Settings::values.gdbstub_port); ReadBasicSetting(Settings::values.program_args); ReadBasicSetting(Settings::values.dump_exefs); ReadBasicSetting(Settings::values.dump_nso); @@ -1095,6 +1098,8 @@ void Config::SaveDebuggingValues() { // Intentionally not using the QT default setting as this is intended to be changed in the ini qt_config->setValue(QStringLiteral("record_frame_times"), Settings::values.record_frame_times); + WriteBasicSetting(Settings::values.use_gdbstub); + WriteBasicSetting(Settings::values.gdbstub_port); WriteBasicSetting(Settings::values.program_args); WriteBasicSetting(Settings::values.dump_exefs); WriteBasicSetting(Settings::values.dump_nso); diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index d6e8b5ead..343d2aee1 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -24,13 +24,18 @@ ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent) QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir)); QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }); + + connect(ui->toggle_gdbstub, &QCheckBox::toggled, + [&]() { ui->gdbport_spinbox->setEnabled(ui->toggle_gdbstub->isChecked()); }); } ConfigureDebug::~ConfigureDebug() = default; void ConfigureDebug::SetConfiguration() { const bool runtime_lock = !system.IsPoweredOn(); - + ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub.GetValue()); + ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub.GetValue()); + ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port.GetValue()); ui->toggle_console->setEnabled(runtime_lock); ui->toggle_console->setChecked(UISettings::values.show_console.GetValue()); ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue())); @@ -71,6 +76,8 @@ void ConfigureDebug::SetConfiguration() { } void ConfigureDebug::ApplyConfiguration() { + Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked(); + Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); UISettings::values.show_console = ui->toggle_console->isChecked(); Settings::values.log_filter = ui->log_filter_edit->text().toStdString(); Settings::values.program_args = ui->homebrew_args_edit->text().toStdString(); diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 863a3fd57..1152fa6c6 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui @@ -3,6 +3,60 @@ <class>ConfigureDebug</class> <widget class="QWidget" name="ConfigureDebug"> <layout class="QVBoxLayout" name="verticalLayout_1"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Debugger</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <item> + <widget class="QCheckBox" name="toggle_gdbstub"> + <property name="text"> + <string>Enable GDB Stub</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Port:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="gdbport_spinbox"> + <property name="minimum"> + <number>1024</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </item> <item> <widget class="QGroupBox" name="groupBox_2"> <property name="title"> diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 817a964d0..379c925e5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -198,6 +198,31 @@ static void RemoveCachedContents() { Common::FS::RemoveDirRecursively(offline_system_data); } +static QString PrettyProductName() { +#ifdef _WIN32 + // After Windows 10 Version 2004, Microsoft decided to switch to a different notation: 20H2 + // With that notation change they changed the registry key used to denote the current version + QSettings windows_registry( + QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), + QSettings::NativeFormat); + const QString release_id = windows_registry.value(QStringLiteral("ReleaseId")).toString(); + if (release_id == QStringLiteral("2009")) { + const u32 current_build = windows_registry.value(QStringLiteral("CurrentBuild")).toUInt(); + const QString display_version = + windows_registry.value(QStringLiteral("DisplayVersion")).toString(); + const u32 ubr = windows_registry.value(QStringLiteral("UBR")).toUInt(); + u32 version = 10; + if (current_build >= 22000) { + version = 11; + } + return QStringLiteral("Windows %1 Version %2 (Build %3.%4)") + .arg(QString::number(version), display_version, QString::number(current_build), + QString::number(ubr)); + } +#endif + return QSysInfo::prettyProductName(); +} + GMainWindow::GMainWindow() : ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()}, input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, @@ -259,7 +284,7 @@ GMainWindow::GMainWindow() } LOG_INFO(Frontend, "Host CPU: {}", cpu_string); #endif - LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString()); + LOG_INFO(Frontend, "Host OS: {}", PrettyProductName().toStdString()); LOG_INFO(Frontend, "Host RAM: {:.2f} GiB", Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB}); LOG_INFO(Frontend, "Host Swap: {:.2f} GiB", Common::GetMemInfo().TotalSwapMemory / f64{1_GiB}); @@ -1015,6 +1040,10 @@ void GMainWindow::SetDefaultUIGeometry() { void GMainWindow::RestoreUIState() { setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint); restoreGeometry(UISettings::values.geometry); + // Work-around because the games list isn't supposed to be full screen + if (isFullScreen()) { + showNormal(); + } restoreState(UISettings::values.state); render_window->setWindowFlags(render_window->windowFlags() & ~Qt::FramelessWindowHint); render_window->restoreGeometry(UISettings::values.renderwindow_geometry); @@ -1401,7 +1430,8 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && type == StartGameType::Normal) { // Load per game settings - const auto file_path = std::filesystem::path{filename.toStdU16String()}; + const auto file_path = + std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())}; const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) : fmt::format("{:016X}", title_id); @@ -1482,7 +1512,8 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t } if (res != Loader::ResultStatus::Success || title_name.empty()) { title_name = Common::FS::PathToUTF8String( - std::filesystem::path{filename.toStdU16String()}.filename()); + std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())} + .filename()); } const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess(); const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)"); @@ -3150,7 +3181,7 @@ void GMainWindow::OnTasStateChanged() { } void GMainWindow::UpdateStatusBar() { - if (emu_thread == nullptr) { + if (emu_thread == nullptr || !system->IsPoweredOn()) { status_bar_update_timer.stop(); return; } |