diff options
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
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; } |