diff --git a/README.md b/README.md index 75a6cf109..dca5a7cbc 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2132. +This is the source code for early-access 2133. ## Legal Notice diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index be3d52d54..439e7e472 100755 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -524,7 +524,9 @@ private: Disconnect = 11, AllocateBuffers = 13, - SetPreallocatedBuffer = 14 + SetPreallocatedBuffer = 14, + + GetBufferHistory = 17 }; void TransactParcel(Kernel::HLERequestContext& ctx) { @@ -641,6 +643,14 @@ private: ctx.WriteBuffer(response.Serialize()); break; } + case TransactionId::GetBufferHistory: { + LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory"); + [[maybe_unused]] const auto buffer = ctx.ReadBuffer(); + + IGBPEmptyResponseParcel response{}; + ctx.WriteBuffer(response.Serialize()); + break; + } default: ASSERT_MSG(false, "Unimplemented"); } diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 402be6a78..4f42aa9d1 100755 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -285,6 +285,11 @@ if (USE_DISCORD_PRESENCE) target_compile_definitions(yuzu PRIVATE -DUSE_DISCORD_PRESENCE) endif() +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + find_package(Qt5 ${QT_VERSION} REQUIRED COMPONENTS DBus ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH} REQUIRED) + target_link_libraries(yuzu PRIVATE Qt5::DBus) +endif() + if (YUZU_USE_QT_WEB_ENGINE) target_link_libraries(yuzu PRIVATE Qt5::WebEngineCore Qt5::WebEngineWidgets) target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 9f80a245c..f016b0f44 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -48,6 +48,12 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #define QT_NO_OPENGL #include +#ifdef __linux__ +#include +#include +#include +#include +#endif #include #include #include @@ -1220,12 +1226,72 @@ void GMainWindow::OnDisplayTitleBars(bool show) { void GMainWindow::PreventOSSleep() { #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); +#elif defined(__linux__) + QDBusConnection bus = QDBusConnection::sessionBus(); + if (bus.isConnected()) { + // Specs: https://specifications.freedesktop.org/idle-inhibit-spec/0.1/re01.html + const QString service = QStringLiteral("org.freedesktop.ScreenSaver"); + const QString path = QStringLiteral("/org/freedesktop/ScreenSaver"); + + QDBusInterface screen_saver_interface(service, path, service, bus, this); + if (screen_saver_interface.isValid()) { + const QString method = QStringLiteral("Inhibit"); + const QString application_name = QStringLiteral("org.yuzu-emu.Yuzu"); + const QString reason_for_inhibit = QStringLiteral("Playing a game"); + + QDBusReply reply = + screen_saver_interface.call(method, application_name, reason_for_inhibit); + + if (reply.isValid()) { + screensaver_dbus_cookie = reply.value(); + screensaver_inhibited = true; + + LOG_INFO(Frontend, "Screen saver disabled successfully (cookie: {})", + screensaver_dbus_cookie); + } else { + QDBusError error = reply.error(); + LOG_ERROR(Frontend, "Could not disable screen saver: {} {}", + error.message().toStdString(), error.name().toStdString()); + } + } + } #endif } void GMainWindow::AllowOSSleep() { #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS); +#elif defined(__linux__) + if (!screensaver_inhibited) { + LOG_WARNING(Frontend, "Screen saver already enabled."); + return; + } + + QDBusConnection bus = QDBusConnection::sessionBus(); + if (bus.isConnected()) { + // Specs: https://specifications.freedesktop.org/idle-inhibit-spec/0.1/re01.html + const QString service = QStringLiteral("org.freedesktop.ScreenSaver"); + const QString path = QStringLiteral("/org/freedesktop/ScreenSaver"); + + QDBusInterface screen_saver_interface(service, path, service, bus, this); + if (screen_saver_interface.isValid()) { + const QString method = QStringLiteral("UnInhibit"); + + QDBusReply reply = screen_saver_interface.call(method, screensaver_dbus_cookie); + + if (reply.isValid()) { + LOG_INFO(Frontend, "Screen saver enabled successfully (cookie: {})", + screensaver_dbus_cookie); + + screensaver_dbus_cookie = 0; + screensaver_inhibited = false; + } else { + QDBusError error = reply.error(); + LOG_ERROR(Frontend, "Could not disable screen saver: {} {}", + error.message().toStdString(), error.name().toStdString()); + } + } + } #endif } diff --git a/src/yuzu/main.h b/src/yuzu/main.h index e31b3d06b..29c60cd52 100755 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -342,6 +342,11 @@ private: bool auto_paused = false; QTimer mouse_hide_timer; +#ifdef __linux__ + bool screensaver_inhibited = false; + uint32_t screensaver_dbus_cookie; +#endif + // FS std::shared_ptr vfs; std::unique_ptr provider; diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 434518d53..8ca20679a 100755 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -518,6 +518,9 @@ void Config::ReadValues() { ReadSetting("WebService", Settings::values.web_api_url); ReadSetting("WebService", Settings::values.yuzu_username); ReadSetting("WebService", Settings::values.yuzu_token); + + // Network + ReadSetting("Network", Settings::values.network_interface); } void Config::Reload() { diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 8119a50d8..339dca766 100755 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -428,6 +428,12 @@ web_api_url = https://api.yuzu-emu.org yuzu_username = yuzu_token = +[Network] +# Name of the network interface device to use with yuzu LAN play. +# e.g. On *nix: 'enp7s0', 'wlp6s0u1u3u3', 'lo' +# e.g. On Windows: 'Ethernet', 'Wi-Fi' +network_interface = + [AddOns] # Used to disable add-ons # List of title IDs of games that will have add-ons disabled (separated by '|'):