From 26d271b907c95ba2066b653287b3d8d5e39e579a Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Fri, 4 Oct 2024 21:10:00 +0200 Subject: [PATCH] Rework the wizard APK downloading, install directly instead of telling the user to use ADB. Add setting to choose which game to start automatically. --- CMakeLists.txt | 3 +- cmake/GitVersion.cmake | 14 + common/version.cpp.in | 3 + common/version.h | 1 + dashboard/CMakeLists.txt | 24 +- dashboard/adb.cpp | 156 ++++ dashboard/adb.h | 76 ++ dashboard/main.cpp | 10 +- dashboard/main_window.cpp | 15 +- dashboard/settings.cpp | 401 ++++++---- dashboard/settings.h | 13 +- dashboard/settings.ui | 1064 ++++++++++++++------------ dashboard/steam_app.cpp | 95 +++ dashboard/steam_app.h | 31 + dashboard/version.cpp.in | 26 + dashboard/version.h | 26 + dashboard/wizard.cpp | 379 +++++++-- dashboard/wizard.h | 42 +- dashboard/wizard.ui | 139 ++-- flatpak/io.github.wivrn.wivrn.yml.in | 6 +- server/main.cpp | 2 +- server/start_application.cpp | 36 +- tools/gen_flatpak_manifest.sh | 16 +- 23 files changed, 1809 insertions(+), 769 deletions(-) create mode 100644 dashboard/adb.cpp create mode 100644 dashboard/adb.h create mode 100644 dashboard/steam_app.cpp create mode 100644 dashboard/steam_app.h create mode 100644 dashboard/version.cpp.in create mode 100644 dashboard/version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 61561d73..a1483abe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,8 +45,6 @@ option(WIVRN_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH OFF) option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON) -set(WIVRN_CLIENT_URL "https://github.com/WiVRn/WiVRn/releases/latest/download/WiVRn-standard-release.apk" CACHE STRING "URL used to download the client in the GUI") - if(ENABLE_COLOURED_OUTPUT) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-fdiagnostics-color=always) @@ -150,6 +148,7 @@ endif() if (WIVRN_BUILD_DASHBOARD) find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets DBus Network LinguistTools) + find_package(nlohmann_json REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake index e81a57ba..431a7520 100644 --- a/cmake/GitVersion.cmake +++ b/cmake/GitVersion.cmake @@ -5,6 +5,12 @@ execute_process( ERROR_QUIET WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + OUTPUT_VARIABLE GIT_COMMIT + ERROR_QUIET + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + if (GIT_DESC) string(STRIP ${GIT_DESC} GIT_DESC) message(STATUS "Setting version to ${GIT_DESC} from git") @@ -13,4 +19,12 @@ else() message(STATUS "Setting version to ${GIT_DESC} from CMakeLists") endif() +if (GIT_COMMIT) + string(STRIP ${GIT_COMMIT} GIT_COMMIT) + message(STATUS "Setting commit to ${GIT_COMMIT}") +else() + set(GIT_COMMIT "") + message(STATUS "Not setting commit") +endif() + configure_file(${INPUT_FILE} ${OUTPUT_FILE}) diff --git a/common/version.cpp.in b/common/version.cpp.in index a96904b5..9cd7a709 100644 --- a/common/version.cpp.in +++ b/common/version.cpp.in @@ -21,4 +21,7 @@ namespace wivrn { extern const char git_version[]; const char git_version[] = "@GIT_DESC@"; + + extern const char git_commit[]; + const char git_commit[] = "@GIT_COMMIT@"; } diff --git a/common/version.h b/common/version.h index ef797018..6f9a2aa3 100644 --- a/common/version.h +++ b/common/version.h @@ -8,5 +8,6 @@ namespace wivrn using protocol = std::variant; extern const char git_version[]; +extern const char git_commit[]; static inline const constinit auto protocol_version = serialization_type_hash(); } // namespace wivrn diff --git a/dashboard/CMakeLists.txt b/dashboard/CMakeLists.txt index 47789a2b..a7a0c4dd 100644 --- a/dashboard/CMakeLists.txt +++ b/dashboard/CMakeLists.txt @@ -1,3 +1,19 @@ + +if (GIT_DESC) + configure_file(version.cpp.in version.cpp) +else () + add_custom_target(wivrn-dashboard-version ALL + COMMAND ${CMAKE_COMMAND} + -D GIT_EXECUTABLE=${GIT_EXECUTABLE} + -D INPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in + -D OUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/version.cpp + -D CMAKE_PROJECT_VERSION=${CMAKE_PROJECT_VERSION} + -P ${CMAKE_SOURCE_DIR}/cmake/GitVersion.cmake + BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in + ) +endif() + qt_add_executable(wivrn-dashboard main.cpp main_window.cpp @@ -13,8 +29,12 @@ qt_add_executable(wivrn-dashboard wizard.ui rectangle_partitionner.cpp rectangle_partitionner.h + steam_app.cpp + steam_app.h + adb.cpp + adb.h ../wivrn-dashboard.qrc - ${CMAKE_CURRENT_BINARY_DIR}/../common/version.cpp + ${CMAKE_CURRENT_BINARY_DIR}/version.cpp ) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../dbus/io.github.wivrn.Server.xml PROPERTIES INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/wivrn_qdbus_types.h") @@ -28,12 +48,12 @@ configure_file(gui_config.h.in gui_config.h) configure_file(io.github.wivrn.wivrn.desktop.in io.github.wivrn.wivrn.desktop) target_link_libraries(wivrn-dashboard PRIVATE - wivrn-common Qt6::Core Qt6::Gui Qt6::Widgets Qt6::DBus Qt6::Network + nlohmann_json ) file(GLOB TRANSLATION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/wivrn_*.ts) diff --git a/dashboard/adb.cpp b/dashboard/adb.cpp new file mode 100644 index 00000000..7e84224e --- /dev/null +++ b/dashboard/adb.cpp @@ -0,0 +1,156 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2024 Guillaume Meunier + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "adb.h" + +#include +#include +#include +#include +#include + +template +std::unique_ptr escape_sandbox(const std::string & executable, Args &&... args_orig) +{ + auto process = std::make_unique(); + QStringList args; + + if (std::filesystem::exists("/.flatpak-info")) + { + process->setProgram("flatpak-spawn"); + args.push_back("--host"); + args.push_back(QString::fromStdString(executable)); + } + else + { + process->setProgram(QString::fromStdString(executable)); + } + + (args.push_back(QString::fromStdString(args_orig)), ...); + + process->setArguments(args); + + return process; +} + +std::shared_ptr>> adb::devices() +{ + auto process = escape_sandbox("adb", "devices", "-l"); + + process->start(); + + auto promise = std::make_shared>>(); + + auto p = process.get(); + + QObject::connect(p, &QProcess::finished, [p = std::move(process), promise](int exitCode, QProcess::ExitStatus exitStatus) { + try + { + if (exitCode != 0 or exitStatus != QProcess::NormalExit) + { + qDebug() << "adb devices exited with code" << exitCode << ", status" << exitStatus; + + QString out = p->readAllStandardOutput(); + qDebug() << "stdout:" << out; + + QString err = p->readAllStandardError(); + qDebug() << "stderr:" << err; + + throw std::runtime_error("adb devices failed"); + } + else + { + auto out = p->readAllStandardOutput(); + auto lines = QString{out}.split('\n'); + + if (not lines.empty()) + lines.pop_front(); + + std::vector devs; + for (auto & line: lines) + { + auto words = line.split(' ', Qt::SkipEmptyParts); + device dev; + + if (words.empty()) + continue; + dev._serial = words.front().toStdString(); + words.pop_front(); + + if (words.empty()) + continue; + dev._state = words.front().toStdString(); + words.pop_front(); + + for (auto & word: words) + { + auto idx = word.indexOf(':'); + if (idx >= 0) + { + dev._properties[word.left(idx).toStdString()] = word.mid(idx + 1).toStdString(); + } + } + + devs.push_back(dev); + } + + promise->addResult(std::move(devs)); + } + } + catch (...) + { + promise->setException(std::current_exception()); + } + + promise->finish(); + }); + + return promise; +} + +std::unique_ptr adb::device::install(const std::filesystem::path & path) +{ + return escape_sandbox("adb", "-s", _serial, "install", "-r", path); +} + +std::unique_ptr adb::device::uninstall(const std::string & app) +{ + return escape_sandbox("adb", "-s", _serial, "uninstall", app); +} + +// void adb::device::start(const std::string& app) +// { +// auto process = escape_sandbox("adb", "-s", _serial, "shell", "am", "start", app); +// process->start(); +// process->waitForFinished(); +// } +// +// void adb::device::stop(const std::string& app) +// { +// auto process = escape_sandbox("adb", "-s", _serial, "shell", "am", "force-stop", app); +// process->start(); +// process->waitForFinished(); +// } +// +// void adb::device::start(const std::string& app, const std::string& action, const std::string& uri) +// { +// // action: "android.intent.action.VIEW" or "android.intent.action.MAIN" +// auto process = escape_sandbox("adb", "-s", _serial, "shell", "am", "start", "-a", action, "-d", uri, app); +// process->start(); +// process->waitForFinished(); +// } diff --git a/dashboard/adb.h b/dashboard/adb.h new file mode 100644 index 00000000..3840d4a4 --- /dev/null +++ b/dashboard/adb.h @@ -0,0 +1,76 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2024 Guillaume Meunier + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +class QProcess; + +class adb +{ +public: + class device + { + std::string _serial; + std::string _state; + std::map _properties; + + friend class adb; + + public: + device() = default; + device(const device &) = default; + device(device &&) = default; + device & operator=(const device &) = default; + device & operator=(device &&) = default; + + const auto & serial() const + { + return _serial; + }; + + const auto & state() const + { + return _state; + }; + + const auto & properties() const + { + return _properties; + }; + + bool operator==(const device & other) const + { + return _serial == other._serial; + } + + std::unique_ptr install(const std::filesystem::path & path); + std::unique_ptr uninstall(const std::string & app); + // void start(const std::string& app); + // void stop(const std::string& app); + // void start(const std::string& app, const std::string& action, const std::string& uri); + }; + + std::shared_ptr>> devices(); +}; diff --git a/dashboard/main.cpp b/dashboard/main.cpp index 64ec705e..3fbfacb3 100644 --- a/dashboard/main.cpp +++ b/dashboard/main.cpp @@ -25,13 +25,9 @@ #include #include "main_window.h" +#include "version.h" #include "wizard.h" -namespace wivrn -{ -extern const char git_version[]; -} - int main(int argc, char * argv[]) { QApplication app(argc, argv); @@ -63,13 +59,13 @@ int main(int argc, char * argv[]) auto main = std::make_unique(); QSettings settings; - if (settings.value("first_run", true).toBool()) + if (settings.value("wizard/first_run", true).toBool()) { wizard_window.reset(new wizard); wizard_window->show(); QObject::connect(wizard_window.get(), &QWizard::finished, [&](int value) { - settings.setValue("first_run", false); + settings.setValue("wizard/first_run", false); wizard_window.release()->deleteLater(); main->show(); diff --git a/dashboard/main_window.cpp b/dashboard/main_window.cpp index d535ad79..79b90606 100644 --- a/dashboard/main_window.cpp +++ b/dashboard/main_window.cpp @@ -28,7 +28,6 @@ #include #include -#include "exit_codes.h" #include "settings.h" #include "ui_main_window.h" #include "wivrn_server.h" @@ -372,19 +371,19 @@ void main_window::on_server_finished(int exit_code, QProcess::ExitStatus status) QString error_message = tr("Unknown error (%1), check logs").arg(exit_code); switch (exit_code) { - case wivrn_exit_code::cannot_connect_to_avahi: - error_message = tr("Cannot connect to avahi, make sure avahi-daemon service is started"); + case EXIT_SUCCESS: + case EXIT_FAILURE: break; - case wivrn_exit_code::cannot_create_pipe: - case wivrn_exit_code::cannot_create_socketpair: + case 2: + case 3: error_message = tr("Insufficient system resources"); break; - case wivrn_exit_code::success: - case wivrn_exit_code::unknown_error: + case 4: + error_message = tr("Cannot connect to avahi, make sure avahi-daemon service is started"); break; } - QMessageBox msgbox /*(this)*/; + QMessageBox msgbox; msgbox.setIcon(QMessageBox::Critical); msgbox.setText(tr("Server crashed:\n%1").arg(error_message)); msgbox.setStandardButtons(QMessageBox::Close); diff --git a/dashboard/settings.cpp b/dashboard/settings.cpp index c72920dd..6b9701c9 100644 --- a/dashboard/settings.cpp +++ b/dashboard/settings.cpp @@ -19,11 +19,12 @@ #include "settings.h" #include "rectangle_partitionner.h" +#include "steam_app.h" #include "ui_settings.h" #include "wivrn_server.h" #include -#include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include -#include #include #include #include @@ -123,108 +123,18 @@ settings::settings(wivrn_server * server_interface) : ui = new Ui::Settings; ui->setupUi(this); - QJsonParseError error; - json_doc = QJsonDocument::fromJson(server_interface->jsonConfiguration().toUtf8(), &error); - - std::vector rectangles; - std::vector encoder_config; - - if (error.error) - { - std::cout << "Cannot read configuration: " << error.errorString().toStdString() << ", offset " << error.offset << std::endl; - } - else - { - auto encoders = json_doc.object().find("encoders"); - - if (encoders->isArray()) - { - ui->radio_auto_encoder->setChecked(false); - ui->radio_manual_encoder->setChecked(true); - } - else - { - ui->radio_auto_encoder->setChecked(true); - ui->radio_manual_encoder->setChecked(false); - - encoders = json_doc.object().find("encoders.disabled"); - } - - if (encoders->isArray()) - { - for (QJsonValue i: encoders->toArray()) - { - int encoder = encoder_id_from_string(i["encoder"].toString("auto").toLower().toStdString()); - int codec = codec_id_from_string(i["codec"].toString("auto").toLower().toStdString()); - double width = i["width"].toDouble(1); - double height = i["height"].toDouble(1); - double offset_x = i["offset_x"].toDouble(0); - double offset_y = i["offset_y"].toDouble(0); - int group = i["group"].toInt(0); // TODO: handle groups - - rectangles.push_back(QRectF(offset_x, offset_y, width, height)); - encoder_config.push_back(QVariant::fromValue(std::pair(encoder, codec))); - } - } - } - - if (rectangles.empty()) - { - rectangles.push_back(QRectF(0, 0, 1, 1)); - std::pair config{0, 0}; - encoder_config.push_back(QVariant::fromValue(config)); - } - - try - { - ui->partitionner->set_rectangles(rectangles); - } - catch (...) - { - QMessageBox msgbox{QMessageBox::Information, tr("Invalid settings"), tr("The encoder configuration is invalid, the default values will be restored."), QMessageBox::Close, this}; - msgbox.exec(); - - ui->radio_auto_encoder->setChecked(true); - ui->radio_manual_encoder->setChecked(false); - - rectangles.clear(); - encoder_config.clear(); - - rectangles.push_back(QRectF(0, 0, 1, 1)); - ui->partitionner->set_rectangles(rectangles); - - std::pair config{0, 0}; - encoder_config.push_back(QVariant::fromValue(config)); - } - - ui->partitionner->set_rectangles_data(encoder_config); - ui->partitionner->set_selected_index(0); - - if (json_doc["scale"].isDouble()) - { - ui->slider_foveation->setValue(std::round((1 - json_doc["scale"].toDouble(1)) * 100)); - ui->spin_foveation->setValue(std::round((1 - json_doc["scale"].toDouble(1)) * 100)); - ui->radio_auto_foveation->setChecked(false); - ui->radio_manual_foveation->setChecked(true); - } - else - { - ui->radio_auto_foveation->setChecked(true); - ui->radio_manual_foveation->setChecked(false); - } - ui->bitrate->setValue(json_doc["bitrate"].toDouble(50'000'000) / 1'000'000); - - selected_rectangle_changed(0); + connect(ui->combo_select_game, &QComboBox::currentIndexChanged, this, &settings::on_selected_game_changed); + connect(ui->button_game_browse, &QPushButton::clicked, this, &settings::on_browse_game); connect(ui->partitionner, &rectangle_partitionner::selected_index_change, this, &settings::selected_rectangle_changed); // connect(ui->partitionner, &rectangle_partitionner::rectangles_change, this, [](){}); - connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_encoder_changed); - connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_settings_changed); - connect(ui->codec, &QComboBox::currentIndexChanged, this, &settings::on_settings_changed); - connect(ui->bitrate, &QDoubleSpinBox::valueChanged, this, &settings::on_settings_changed); - connect(ui->slider_foveation, &QSlider::valueChanged, this, &settings::on_settings_changed); - connect(ui->spin_foveation, &QSpinBox::valueChanged, this, &settings::on_settings_changed); + connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_selected_encoder_changed); + connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_encoder_settings_changed); + connect(ui->codec, &QComboBox::currentIndexChanged, this, &settings::on_encoder_settings_changed); + connect(ui->bitrate, &QDoubleSpinBox::valueChanged, this, &settings::on_encoder_settings_changed); + connect(ui->slider_foveation, &QSlider::valueChanged, this, &settings::on_encoder_settings_changed); + connect(ui->spin_foveation, &QSpinBox::valueChanged, this, &settings::on_encoder_settings_changed); // connect(ui->foveation_info, &QPushButton::clicked, this, [&]() { QToolTip::showText(ui->radio_manual_foveation->pos(), ui->radio_manual_foveation->toolTip(), ui->radio_manual_foveation); }); @@ -264,13 +174,9 @@ settings::settings(wivrn_server * server_interface) : painter.setFont(font); }); - // Update the compatible codecs - on_encoder_changed(); - - // Update the status text - on_settings_changed(); - setWindowModality(Qt::WindowModality::ApplicationModal); + + load_settings(); } settings::~settings() @@ -279,7 +185,7 @@ settings::~settings() ui = nullptr; } -void settings::on_encoder_changed() +void settings::on_selected_encoder_changed() { int encoder = ui->encoder->currentIndex(); @@ -302,7 +208,7 @@ void settings::on_encoder_changed() } } -void settings::on_settings_changed() +void settings::on_encoder_settings_changed() { QString status; @@ -343,6 +249,45 @@ void settings::on_settings_changed() ui->message->setText(status); } +void settings::on_selected_game_changed(int index) +{ + if (index == 0) // No game selected + { + ui->edit_game_path->setEnabled(false); + ui->button_game_browse->setEnabled(false); + } + else if (index == 1) // Custom path + { + ui->edit_game_path->setEnabled(true); + ui->button_game_browse->setEnabled(true); + } + else // From Steam vrmanifest + { + ui->edit_game_path->setEnabled(false); + ui->button_game_browse->setEnabled(false); + } +} + +void settings::on_browse_game() +{ + QFileInfo info(ui->edit_game_path->text()); + + QFileDialog dlg(this, tr("Select game")); + dlg.setFilter(QDir::Executable | QDir::Files); + dlg.setFileMode(QFileDialog::ExistingFile); + dlg.setDirectory(info.dir()); + + if (not dlg.exec()) + return; + + auto files = dlg.selectedFiles(); + + if (files.empty()) + return; + + ui->edit_game_path->setText(files.front()); +} + void settings::selected_rectangle_changed(int index) { auto [encoder, codec] = ui->partitionner->rectangles_data(index).value>(); @@ -367,44 +312,223 @@ void settings::restore_defaults() ui->partitionner->set_rectangles(rectangles); ui->partitionner->set_rectangles_data(encoder_config); ui->partitionner->set_selected_index(0); + + ui->combo_select_game->setCurrentIndex(0); + ui->edit_game_path->setText(""); +} + +void settings::load_settings() +{ + std::vector rectangles; + std::vector encoder_config; + + // Encoders configuration + try + { + json_doc = nlohmann::json::parse(server_interface->jsonConfiguration().toUtf8()); + } + catch (std::exception & e) + { + qWarning() << "Cannot read configuration: " << e.what(); + restore_defaults(); + return; + } + + try + { + nlohmann::json encoders; + + if (json_doc.contains("encoders")) + { + encoders = json_doc["encoders"]; + ui->radio_auto_encoder->setChecked(false); + ui->radio_manual_encoder->setChecked(true); + } + else if (json_doc.contains("encoders.disabled")) + { + encoders = json_doc["encoders.disabled"]; + ui->radio_auto_encoder->setChecked(true); + ui->radio_manual_encoder->setChecked(false); + ui->layout_encoder_config->setVisible(false); + } + else + { + ui->radio_auto_encoder->setChecked(true); + ui->radio_manual_encoder->setChecked(false); + ui->layout_encoder_config->setVisible(false); + } + + for (auto & i: encoders) + { + int encoder = encoder_id_from_string(i.value("encoder", "auto")); + int codec = codec_id_from_string(i.value("codec", "auto")); + double width = i.value("width", 1.0); + double height = i.value("height", 1.0); + double offset_x = i.value("offset_x", 0.0); + double offset_y = i.value("offset_y", 0.0); + int group = i.value("group", 0); // TODO: handle groups + + rectangles.push_back(QRectF(offset_x, offset_y, width, height)); + encoder_config.push_back(QVariant::fromValue(std::pair(encoder, codec))); + } + } + catch (...) + { + QMessageBox msgbox{QMessageBox::Information, tr("Invalid settings"), tr("The encoder configuration is invalid, the default values will be restored."), QMessageBox::Close, this}; + msgbox.exec(); + + rectangles.clear(); + encoder_config.clear(); + } + + if (rectangles.empty()) + { + ui->radio_auto_encoder->setChecked(true); + ui->radio_manual_encoder->setChecked(false); + ui->layout_encoder_config->setVisible(false); + + rectangles.push_back(QRectF(0, 0, 1, 1)); + std::pair config{0, 0}; + encoder_config.push_back(QVariant::fromValue(config)); + } + + ui->partitionner->set_rectangles(rectangles); + ui->partitionner->set_rectangles_data(encoder_config); + ui->partitionner->set_selected_index(0); + + // Foveation + try + { + if (json_doc.contains("scale")) + { + ui->slider_foveation->setValue(std::round((1 - json_doc.value("scale", 1.0)) * 100)); + ui->spin_foveation->setValue(std::round((1 - json_doc.value("scale", 1.0)) * 100)); + ui->radio_auto_foveation->setChecked(false); + ui->radio_manual_foveation->setChecked(true); + } + else + { + ui->radio_auto_foveation->setChecked(true); + ui->radio_manual_foveation->setChecked(false); + } + } + catch (...) + { + ui->radio_auto_foveation->setChecked(true); + ui->radio_manual_foveation->setChecked(false); + } + + // Bitrate + ui->bitrate->setValue(json_doc.value("bitrate", 50'000'000.0) / 1'000'000); + + // Automatically started application + std::vector application; + + if (json_doc["application"].is_array()) + application = json_doc.value>("application", {}); + else if (json_doc["application"].is_string()) + application.push_back(json_doc["application"]); + + ui->combo_select_game->clear(); + ui->combo_select_game->addItem(tr("None", "Game selection combo box")); + ui->combo_select_game->addItem(tr("Custom...", "Game selection combo box")); + + auto apps = steam_apps(); + for (auto & app: apps) + { + ui->combo_select_game->addItem(QString::fromUtf8(app.name), QVariant::fromValue(app)); + + if (application.size() == 2 and application[0] == "steam" and application[1] == app.url) + { + ui->combo_select_game->setCurrentIndex(ui->combo_select_game->count() - 1); + } + } + + if (application.size() == 1 and ui->combo_select_game->currentIndex() == 0) + { + ui->combo_select_game->setCurrentIndex(1); + ui->edit_game_path->setText(QString::fromUtf8(application.front())); + } + selected_rectangle_changed(0); + + ui->partitionner->set_paint([&](QPainter & painter, QRect rect, const QVariant & data, int index, bool selected) { + if (selected) + { + painter.fillRect(rect.adjusted(1, 1, 0, 0), QColorConstants::Cyan); + } + + auto [encoder_id, codec_id] = data.value>(); + + QString codec = ui->codec->itemText(codec_id); + QString encoder = ui->encoder->itemText(encoder_id); + + QFont font = painter.font(); + QFont font2 = font; + + font2.setPixelSize(24); + + QString text = QString("%1\n%2").arg(encoder, codec); + + QFontMetrics metrics{font2}; + QSize size = metrics.size(0, text); + + if (double ratio = std::max((double)size.width() / rect.width(), (double)size.height() / rect.height()); ratio > 1) + { + int pixel_size = font2.pixelSize() / ratio; + if (pixel_size > 0) + font2.setPixelSize(pixel_size); + } + + painter.setFont(font2); + painter.drawText(rect, Qt::AlignCenter, text); + painter.setFont(font); + }); + + // Update the compatible codecs + on_selected_encoder_changed(); + + // Update the status text + on_encoder_settings_changed(); } void settings::save_settings() { - QJsonObject json = json_doc.object(); - // Remove all optional keys that might not be overwritten - auto it = json.find("scale"); - if (it != json.end()) - json.erase(it); + auto it = json_doc.find("scale"); + if (it != json_doc.end()) + json_doc.erase(it); - it = json.find("encoders.disabled"); - if (it != json.end()) - json.erase(it); + it = json_doc.find("encoders.disabled"); + if (it != json_doc.end()) + json_doc.erase(it); - it = json.find("encoders"); - if (it != json.end()) - json.erase(it); + it = json_doc.find("encoders"); + if (it != json_doc.end()) + json_doc.erase(it); + + it = json_doc.find("application"); + if (it != json_doc.end()) + json_doc.erase(it); if (not ui->radio_auto_foveation->isChecked()) - json["scale"] = 1 - ui->slider_foveation->value() / 100.0; + json_doc["scale"] = 1 - ui->slider_foveation->value() / 100.0; - json["bitrate"] = ui->bitrate->value() * 1'000'000; + json_doc["bitrate"] = ui->bitrate->value() * 1'000'000; - QJsonArray encoders; + nlohmann::json encoders; const auto & rect = ui->partitionner->rectangles(); const auto & data = ui->partitionner->rectangles_data(); for (int i = 0, n = rect.size(); i < n; i++) { - QJsonObject encoder; + nlohmann::json encoder; auto [encoder_id, codec_id] = data[i].value>(); - if (auto value = QString::fromLatin1(encoder_from_id(encoder_id)); value != "auto") + if (auto value = encoder_from_id(encoder_id); value != "auto") encoder["encoder"] = value; - if (auto value = QString::fromLatin1(codec_from_id(codec_id)); value != "auto") + if (auto value = codec_from_id(codec_id); value != "auto") encoder["codec"] = value; encoder["width"] = rect[i].width(); @@ -418,15 +542,34 @@ void settings::save_settings() } // If there is only one automatic encoder, don't save it' - if (encoders.size() != 1 or encoders[0].toObject().contains("codec") or encoders[0].toObject().contains("encoder")) + if (encoders.size() != 1 or encoders[0].contains("codec") or encoders[0].contains("encoder")) { if (ui->radio_manual_encoder->isChecked()) - json["encoders"] = encoders; + json_doc["encoders"] = encoders; else - json["encoders.disabled"] = encoders; + json_doc["encoders.disabled"] = encoders; } - server_interface->setJsonConfiguration(QString::fromUtf8(QJsonDocument(json).toJson())); + if (ui->combo_select_game->currentIndex() == 0) + { + } + else if (ui->combo_select_game->currentIndex() == 1) + { + nlohmann::json application; + application.push_back(ui->edit_game_path->text().toStdString()); + json_doc["application"] = application; + } + else + { + auto app = qvariant_cast(ui->combo_select_game->currentData()); + + nlohmann::json application; + application.push_back("steam"); + application.push_back(app.url); + json_doc["application"] = application; + } + + server_interface->setJsonConfiguration(QString::fromStdString(json_doc.dump(2))); } #include "moc_settings.cpp" diff --git a/dashboard/settings.h b/dashboard/settings.h index 4f48d9d1..a3b9daef 100644 --- a/dashboard/settings.h +++ b/dashboard/settings.h @@ -19,8 +19,7 @@ #pragma once #include -#include -#include +#include namespace Ui { @@ -35,7 +34,7 @@ class settings : public QDialog Ui::Settings * ui; wivrn_server * server_interface; - QJsonDocument json_doc; + nlohmann::json json_doc; void selected_rectangle_changed(int); @@ -43,8 +42,12 @@ public: settings(wivrn_server * server_interface = nullptr); ~settings(); - void on_settings_changed(); - void on_encoder_changed(); +private: + void on_encoder_settings_changed(); + void on_selected_encoder_changed(); + void on_selected_game_changed(int index); + void on_browse_game(); + void load_settings(); void save_settings(); void restore_defaults(); }; diff --git a/dashboard/settings.ui b/dashboard/settings.ui index 104490cc..b2ede000 100644 --- a/dashboard/settings.ui +++ b/dashboard/settings.ui @@ -6,8 +6,8 @@ 0 0 - 1018 - 805 + 1007 + 932 @@ -17,433 +17,132 @@ 0 + + 0 + 0 - - - - - Foveation strength: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - Bitrate: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - bitrate - - - - - - - - - Weaker - - + + + QFrame::Shape::NoFrame + + + true + + + + + 0 + 0 + 986 + 1047 + + + + + + + + + Mbit/s + + + 0 + + + 1.000000000000000 + + + 200.000000000000000 + + + 100.000000000000000 + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + - - + + Qt::Orientation::Horizontal - - - 40 - 20 - - - + - - + + - Stronger + Foveation strength: Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - - Mbit/s + + + + Automatic - - 0 - - - 1.000000000000000 - - - 200.000000000000000 - - - 100.000000000000000 + + true + + group_foveation + - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - - You can use several encoders in order to split the workload between your CPU and your GPU and reduce the latency. - - - - - - - - - false - - - - 0 - 0 - - - - false - - - QFrame::Shape::Panel - - - QFrame::Shadow::Sunken - - - 1 - - - 0 - - - - - - - - - false - - - - 100 - 0 - - + + + + - Encoder - - - encoder + Weaker - - - - false + + + + Qt::Orientation::Horizontal - + - 100 - 0 + 40 + 20 - - - Auto - - - - - nvenc (NVIDIA GPUs) - - - - - vaapi (AMD and Intel GPUs) - - - - - x264 (software encoding) - - - + - - - - false - - - - 100 - 0 - - - - - Auto - - - - - H.264 - - - - - H.265 - - - - - AV1 - - - - - - - - false - - - - 0 - 0 - - - - - 220 - 0 - - - - - 220 - 16777215 - + + + + Stronger - Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop - - - true - - - - - - - false - - - - 100 - 0 - - - - Codec - - - codec + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - Encoder configuration: - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - Qt::Orientation::Horizontal - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - false - - - false - - - % - - - 80 - - - 20 - - - - - - - Qt::Orientation::Horizontal - - - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - false - - - - 0 - 0 - - - - 0 - - - 80 - - - 20 - - - Qt::Orientation::Horizontal - - - QSlider::TickPosition::TicksBelow - - - - - - - Automatic - - - true - - - group_encoder - - - - - - - A stronger foveation makes the image sharper in the center than in the periphery and makes the decoding faster. This is better for fast paced games. - -A weaker foveation gives a uniform sharpness in the whole image. - -The recommended values are between 20% and 50% for headsets without eye tracking and between 50% and 70% for headsets with eye tracking. - - - true - - - - - - - Manual - - - group_encoder - - - - - - - Automatic - - - true - - - group_foveation - - - - - - - + + Qt::Orientation::Horizontal @@ -455,74 +154,449 @@ The recommended values are between 20% and 50% for headsets without eye tracking - - - - - - Manual - - - group_foveation - - - - - - - Qt::Orientation::Horizontal - - - - - - - - - Qt::Orientation::Horizontal - - - QSizePolicy::Policy::Fixed - - - - 12 - 20 - - - - - - - - - 14 - - + + - WiVRn settings + A stronger foveation makes the image sharper in the center than in the periphery and makes the decoding faster. This is better for fast paced games. + +A weaker foveation gives a uniform sharpness in the whole image. + +The recommended values are between 20% and 50% for headsets without eye tracking and between 50% and 70% for headsets with eye tracking. + + + true - - + + + + false + + + + 0 + 0 + + + + 0 + + + 80 + + + 20 + Qt::Orientation::Horizontal - - QSizePolicy::Policy::Fixed + + QSlider::TickPosition::TicksBelow + + + + + + + Manual + + + group_encoder + + + + + + + Qt::Orientation::Vertical - 12 + 20 + 40 + + + + + + + + + 0 + 100 + + + + + + + false + + + + 0 + 0 + + + + + 0 + 400 + + + + false + + + QFrame::Shape::Panel + + + QFrame::Shadow::Sunken + + + 1 + + + 0 + + + + + + + + + false + + + + 100 + 0 + + + + Encoder + + + encoder + + + + + + + false + + + + 100 + 0 + + + + + Auto + + + + + nvenc (NVIDIA GPUs) + + + + + vaapi (AMD and Intel GPUs) + + + + + x264 (software encoding) + + + + + + + + false + + + + 100 + 0 + + + + + Auto + + + + + H.264 + + + + + H.265 + + + + + AV1 + + + + + + + + false + + + + 0 + 0 + + + + + 220 + 0 + + + + + 220 + 16777215 + + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + true + + + + + + + false + + + + 100 + 0 + + + + Codec + + + codec + + + + + + + + + + + + Manual + + + group_foveation + + + + + + + false + + + Path + + + + + + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Fixed + + + + 12 + 20 + + + + + + + + + 14 + + + + WiVRn settings + + + + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Fixed + + + + 12 + 20 + + + + + + + + + + Encoder configuration: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + Qt::Orientation::Horizontal + + + + + + + Qt::Orientation::Horizontal + + + + + + + Qt::Orientation::Horizontal + + + + + + + Automatic + + + true + + + group_encoder + + + + + + + You can use several encoders in order to split the workload between your CPU and your GPU and reduce the latency. + + + + + + + Bitrate: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + bitrate + + + + + + + You can choose a game to be started automatically when the headset connects. + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + true + + + + + + + false + + + Browse + + + + + + + false + + + false + + + % + + + 80 + + + 20 + + + + + + + Qt::Orientation::Horizontal + + + + 40 20 + + + - - + + @@ -594,7 +668,7 @@ The recommended values are between 20% and 50% for headsets without eye tracking 260 - 778 + 1185 157 @@ -610,7 +684,7 @@ The recommended values are between 20% and 50% for headsets without eye tracking 328 - 778 + 1185 286 @@ -625,12 +699,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setValue(int) - 777 - 213 + 888 + 530 - 849 - 218 + 1049 + 521 @@ -641,12 +715,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setValue(int) - 849 - 218 + 1049 + 521 - 777 - 213 + 888 + 530 @@ -657,12 +731,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 487 - 180 + 888 + 496 - 777 - 213 + 888 + 530 @@ -673,12 +747,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 836 - 183 + 888 + 496 - 849 - 218 + 1049 + 521 @@ -689,12 +763,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 836 - 338 + 888 + 663 - 388 - 508 + 449 + 745 @@ -705,12 +779,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 836 - 338 + 888 + 663 - 834 - 378 + 952 + 695 @@ -721,12 +795,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 494 - 323 + 888 + 663 - 834 - 416 + 952 + 734 @@ -737,12 +811,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 542 - 323 + 888 + 663 - 721 - 378 + 715 + 695 @@ -753,12 +827,12 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 560 - 322 + 888 + 663 - 721 - 416 + 715 + 734 @@ -769,12 +843,28 @@ The recommended values are between 20% and 50% for headsets without eye tracking setEnabled(bool) - 627 - 333 + 888 + 663 - 675 - 465 + 764 + 778 + + + + + radio_manual_encoder + toggled(bool) + layout_encoder_config + setVisible(bool) + + + 805 + 664 + + + 825 + 818 diff --git a/dashboard/steam_app.cpp b/dashboard/steam_app.cpp new file mode 100644 index 00000000..d9fcac13 --- /dev/null +++ b/dashboard/steam_app.cpp @@ -0,0 +1,95 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2024 Guillaume Meunier + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "steam_app.h" +#include +#include +#include +#include +#include +#include +#include + +namespace +{ +std::string read_vr_manifest() +{ + const char * home = getenv("HOME"); + + std::filesystem::path vrmanifest = std::string{home ? home : ""} + "/.steam/steam/config/steamapps.vrmanifest"; + + if (std::filesystem::exists("/.flatpak-info")) + { + QProcess flatpak_spawn; + flatpak_spawn.start("flatpak-spawn", {"--host", "cat", QString::fromStdString(vrmanifest)}); + flatpak_spawn.waitForFinished(); + return flatpak_spawn.readAllStandardOutput().toStdString(); + } + else + { + std::ifstream f(vrmanifest); + std::istreambuf_iterator begin{f}, end; + + return {begin, end}; + } +} +} // namespace + +std::vector steam_apps(const std::string & locale) +{ + std::vector apps; + + nlohmann::json json = nlohmann::json::parse(read_vr_manifest()); + + for (auto & i: json["applications"]) + { + try + { + steam_app app; + + app.image_path = i.value("image_path", ""); + app.name = i["strings"]["en_us"]["name"]; + + if (i["launch_type"] == "url") + { + app.url = i["url"]; + } + else if (i["launch_type"] == "binary") + { + std::string app_key = i["app_key"]; + + const char prefix[] = "steam.app."; + if (app_key.starts_with(prefix)) + app.url = "steam://rungameid/" + app_key.substr(strlen(prefix)); + } + + if (app.url != "") + apps.push_back(app); + } + catch (std::exception & e) + { + std::cerr << e.what() << std::endl; + } + } + + std::ranges::sort(apps, [](const steam_app & a, const steam_app & b) { + return a.name < b.name; + }); + + return apps; +} diff --git a/dashboard/steam_app.h b/dashboard/steam_app.h new file mode 100644 index 00000000..5d0cb869 --- /dev/null +++ b/dashboard/steam_app.h @@ -0,0 +1,31 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2024 Guillaume Meunier + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include +#include + +struct steam_app +{ + std::string name; + std::string image_path; + std::string url; +}; + +std::vector steam_apps(const std::string & locale = "en_us"); diff --git a/dashboard/version.cpp.in b/dashboard/version.cpp.in new file mode 100644 index 00000000..206da0cb --- /dev/null +++ b/dashboard/version.cpp.in @@ -0,0 +1,26 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2022 Guillaume Meunier + * Copyright (C) 2022 Patrick Nicolas + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "version.h" + +namespace wivrn +{ +const char git_version[] = "@GIT_DESC@"; +const char git_commit[] = "@GIT_COMMIT@"; +} // namespace wivrn diff --git a/dashboard/version.h b/dashboard/version.h new file mode 100644 index 00000000..6142992c --- /dev/null +++ b/dashboard/version.h @@ -0,0 +1,26 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2022 Guillaume Meunier + * Copyright (C) 2022 Patrick Nicolas + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +namespace wivrn +{ +extern const char git_version[]; +extern const char git_commit[]; +} // namespace wivrn diff --git a/dashboard/wizard.cpp b/dashboard/wizard.cpp index 8fc98306..c091a855 100644 --- a/dashboard/wizard.cpp +++ b/dashboard/wizard.cpp @@ -26,22 +26,30 @@ #include #include #include +#include #include +#include #include #include #include +#include +#include -#include "ui_wizard.h" - -#include "wivrn_server.h" - +#include "adb.h" #include "gui_config.h" +#include "ui_wizard.h" +#include "version.h" +#include "wivrn_server.h" #include +#include + +using namespace Qt::Literals::StringLiterals; enum class wizard_page { select_headset_model, sideload_download, + sideload_devmode, sideload_install, connect_hmd, start_game @@ -71,9 +79,30 @@ static constexpr int role_devmode_url = Qt::UserRole + 1; static constexpr int role_store_name = Qt::UserRole + 2; static constexpr int role_store_url = Qt::UserRole + 3; +// #define TEST 1 // Not in the WiVRn-APK repo +// #define TEST 2 // In the WiVRn-APK repo, not a tagged version +// #define TEST 3 // Current version +// #define TEST 4 // Old version + +#if !defined(TEST) || TEST == 0 // Normal case +static const std::string git_version = wivrn::git_version; +static const std::string git_commit = wivrn::git_commit; +#elif TEST == 1 +static const std::string git_version = "v0.19.1-60-g66ce2c5"; +static const std::string git_commit = "66ce2c547dedf9b320af677ed42f32f361b32832"; +#elif TEST == 2 +static const std::string git_version = "v0.19.1-59-g0d62929"; +static const std::string git_commit = "554c0f7ad647d9cd66e380f567f2e842fff6a27a"; +#elif TEST == 3 +static const std::string git_version = "v0.19.1"; +static const std::string git_commit = "bcffadcd4e043d7bacd700b1331c2e98f96ca178"; +#elif TEST == 4 +static const std::string git_version = "v0.19"; +static const std::string git_commit = "d0014823480bc0e54594b74d2475882554ed5829"; +#endif + wizard::wizard() : - server(new wivrn_server(this)), - apk_file(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/wivrn.apk") + server(new wivrn_server(this)) { ui = new Ui::Wizard; ui->setupUi(this); @@ -87,10 +116,6 @@ wizard::wizard() : QGuiApplication::clipboard()->setText(ui->label_steam_command->text()); }); - connect(ui->copy_adb_command, &QPushButton::clicked, this, [&]() { - QGuiApplication::clipboard()->setText(ui->label_adb_install->text()); - }); - connect(server, &wivrn_server::headsetConnectedChanged, this, &wizard::on_headset_connected_changed); connect(ui->button_cancel_download, &QPushButton::clicked, this, &wizard::cancel_download); @@ -101,10 +126,6 @@ wizard::wizard() : ui->label_steam_command->setText(server->steamCommand()); setPixmap(WatermarkPixmap, QPixmap(":/images/wivrn.svg")); - - ui->label_adb_install->setText("adb install -r " + apk_file.fileName()); - apk_downloaded = QFileInfo(apk_file).exists() and (settings.value("client_apk_url").toString() == WIVRN_CLIENT_URL); - for (const headset & i: headsets_info) { auto item = new QStandardItem(i.name); @@ -119,14 +140,168 @@ wizard::wizard() : ui->combo_hmd_model->setModel(&headsets); ui->combo_hmd_model->setCurrentIndex(-1); - connect(ui->combo_hmd_model, &QComboBox::currentIndexChanged, this, &wizard::on_headset_model_changed); - connect(ui->check_sideload, &QCheckBox::clicked, this, &wizard::on_headset_model_changed); + connect(ui->combo_hmd_model, &QComboBox::currentIndexChanged, this, &wizard::update_welcome_page); + connect(ui->check_sideload, &QCheckBox::clicked, this, &wizard::update_welcome_page); setWindowModality(Qt::WindowModality::ApplicationModal); + + if (std::regex_match(git_version, std::regex(".*-g[0-9a-f]+"))) + { + apk_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/wivrn-" + QString::fromStdString(git_commit) + ".apk"); + + qDebug() << "Not a tagged version" << git_version.c_str(); + + ui->label_release_info->setText( + tr("This is not a tagged release.") + + "\n" + + tr("If you install the headset app from the store, it might not be compatible with this server.") + + "\n" + + tr("If you install the headset app manually, this wizard will download the version that matches the dashboard.")); + + std::string url = "https://api.github.com/repos/WiVRn/WiVRn-APK/releases/tags/apk-" + git_commit; + qDebug() << "Downloading metadata from" << url.c_str(); + + apk_release_reply = manager.get(QNetworkRequest{QUrl{url.c_str()}}); + connect(apk_release_reply, &QNetworkReply::finished, this, &wizard::on_apk_release_finished); + } + else + { + apk_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/wivrn-" + QString::fromStdString(git_version) + ".apk"); + + qDebug() << "Tagged version" << git_version.c_str(); + + // Get the current release information + std::string url = "https://api.github.com/repos/WiVRn/WiVRn/releases/tags/" + git_version; + qDebug() << "Downloading metadata from" << url.c_str(); + apk_release_reply = manager.get(QNetworkRequest{QUrl{url.c_str()}}); + connect(apk_release_reply, &QNetworkReply::finished, this, &wizard::on_apk_release_finished); + + // Get the latest release information + latest_release_reply = manager.get(QNetworkRequest{QUrl{"https://api.github.com/repos/WiVRn/WiVRn/releases/latest"}}); + connect(latest_release_reply, &QNetworkReply::finished, this, &wizard::on_latest_release_finished); + } + + // Detect connected android devices + poll_devices_timer.setInterval(std::chrono::milliseconds(500)); + connect(&poll_devices_timer, &QTimer::timeout, this, [this]() { + if (android_devices_future.isFinished()) + { + android_devices_promise = adb{}.devices(); + android_devices_future = android_devices_promise->future(); + android_devices_future_watcher.setFuture(android_devices_future); + } + }); + poll_devices_timer.start(); + connect(&android_devices_future_watcher, &QFutureWatcher>::finished, this, &wizard::on_android_devices_future_finished); } -void wizard::on_headset_model_changed() +void wizard::on_latest_release_finished() { + disconnect(latest_release_reply, &QNetworkReply::finished, this, &wizard::on_latest_release_finished); + + // By default, assume this is the latest release + latest_release = git_version; + + try + { + if (latest_release_reply->error()) + throw std::runtime_error(latest_release_reply->errorString().toStdString()); + + auto json = nlohmann::json::parse(latest_release_reply->readAll()); + + latest_release = json["tag_name"]; + + if (latest_release == git_version) + { + // This is already the latest release + ui->label_release_info->setText("This is the latest WiVRn release."); + } + else + { + ui->label_release_info->setText( + tr("A new release is available (%1 → %2).").arg(QString::fromLatin1(git_version)).arg(QString::fromLatin1(latest_release)) + + "\n" + + tr("If you install the headset app from the store, it might not be compatible with this server.") + + "\n" + + tr("If you install the headset app manually, this wizard will download the version that matches the dashboard.")); + } + } + catch (std::exception & e) + { + qWarning() << "Cannot get latest release: " << e.what(); + ui->label_release_info->setText(tr("Cannot get latest release: %1").arg(e.what())); + } + + latest_release_reply->deleteLater(); + latest_release_reply = nullptr; + update_welcome_page(); +} + +void wizard::on_apk_release_finished() +{ + disconnect(apk_release_reply, &QNetworkReply::finished, this, &wizard::on_apk_release_finished); + + try + { + auto error = apk_release_reply->error(); + + if (error == QNetworkReply::NetworkError::ContentNotFoundError) + { + ui->label_release_info->setText( + "

" + + tr("There is no precompiled APK for this version.") + + "

\n

" + + tr("Follow the documentation to build your own client.") + + "

"); + + ui->combo_hmd_model->setEnabled(false); + ui->combo_hmd_model->setCurrentIndex(-1); + ui->check_sideload->setEnabled(false); + } + else if (error != QNetworkReply::NetworkError::NoError) + { + throw std::runtime_error(apk_release_reply->errorString().toStdString()); + } + else + { + auto json = nlohmann::json::parse(apk_release_reply->readAll()); + + for (auto & i: json["assets"]) + { + std::string name = i["name"]; + + if (name.ends_with("-standard-release.apk")) + { + apk_url = i["browser_download_url"]; + qDebug() << "Using APK URL" << apk_url.c_str(); + break; + } + } + + apk_downloaded = QFileInfo(apk_file).exists(); + } + } + catch (std::exception & e) + { + qWarning() << "Cannot get APK information: " << e.what(); + ui->label_release_info->setText(tr("Cannot get APK information: %1").arg(e.what())); + } + + apk_release_reply->deleteLater(); + apk_release_reply = nullptr; + update_welcome_page(); +} + +void wizard::update_welcome_page() +{ + if (latest_release == "") + { + // We don't have the latest release information yet + ui->widget_store->setVisible(false); + ui->check_sideload->setVisible(false); + button(NextButton)->setEnabled(false); + } + auto devmode_url = ui->combo_hmd_model->currentData(role_devmode_url).toString(); auto store_name = ui->combo_hmd_model->currentData(role_store_name).toString(); auto store_url = ui->combo_hmd_model->currentData(role_store_url).toString(); @@ -136,26 +311,29 @@ void wizard::on_headset_model_changed() if (ui->combo_hmd_model->currentIndex() < 0) { + // No headset selected ui->widget_store->setVisible(false); ui->check_sideload->setVisible(false); button(NextButton)->setEnabled(false); } else if (store_name != "") { + // Headset with a link to a store ui->widget_store->setVisible(not ui->check_sideload->isChecked()); ui->check_sideload->setVisible(true); - button(NextButton)->setEnabled(true); + button(NextButton)->setEnabled(apk_url != "" or nextId() != (int)wizard_page::sideload_download); } else { + // Headset without store ui->widget_store->setVisible(false); ui->check_sideload->setVisible(false); - button(NextButton)->setEnabled(true); + button(NextButton)->setEnabled(apk_url != ""); } ui->label_devmode_url->setVisible(devmode_url != ""); - if (nextId() == (int)wizard_page::sideload_download and ui->combo_hmd_model->currentIndex() >= 0) + if (nextId() == (int)wizard_page::sideload_download and ui->combo_hmd_model->currentIndex() >= 0 and apk_url != "") button(NextButton)->setText(tr("Download")); else button(NextButton)->setText(QWizard::tr("&Next >", "do not translate, the QWizard translation will be used")); @@ -175,6 +353,9 @@ void wizard::on_custom_button_clicked(int which) case wizard_page::sideload_download: return; + case wizard_page::sideload_devmode: + return; + case wizard_page::sideload_install: return; @@ -197,7 +378,7 @@ void wizard::on_page_changed(int id) button(WizardButton::CustomButton2)->setText(tr("Skip")); setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CustomButton2, QWizard::CancelButton}); - on_headset_model_changed(); + update_welcome_page(); return; case wizard_page::sideload_download: @@ -209,8 +390,16 @@ void wizard::on_page_changed(int id) button(NextButton)->setEnabled(false); return; - case wizard_page::sideload_install: + case wizard_page::sideload_devmode: setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CancelButton}); + on_adb_device_list_changed(); + return; + + case wizard_page::sideload_install: + start_install(); + setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CancelButton}); + button(BackButton)->setEnabled(false); + button(NextButton)->setEnabled(false); return; case wizard_page::connect_hmd: @@ -248,7 +437,7 @@ int wizard::nextId() const if (ui->combo_hmd_model->currentData(role_store_name).toString() != "" and not ui->check_sideload->isChecked()) return (int)wizard_page::connect_hmd; else if (apk_downloaded) - return (int)wizard_page::sideload_install; + return (int)wizard_page::sideload_devmode; else return (int)wizard_page::sideload_download; @@ -277,9 +466,9 @@ void wizard::start_download() { ui->button_cancel_download->setEnabled(true); - QUrl url(WIVRN_CLIENT_URL); + QUrl url(apk_url.c_str()); - qDebug() << "Downloading from " << url.toString(); + qDebug() << "Downloading from" << url.toString(); auto apk_dir = std::filesystem::path(apk_file.fileName().toStdString()).parent_path(); std::filesystem::create_directories(apk_dir); @@ -288,20 +477,20 @@ void wizard::start_download() QNetworkRequest request(url); - if (reply) + if (apk_reply) { - disconnect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); - disconnect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); - disconnect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished); - reply->abort(); - reply->deleteLater(); + disconnect(apk_reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); + disconnect(apk_reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); + disconnect(apk_reply, &QNetworkReply::finished, this, &wizard::on_download_finished); + apk_reply->abort(); + apk_reply->deleteLater(); } - reply = manager.get(request); + apk_reply = manager.get(request); - connect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); - connect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); - connect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished); + connect(apk_reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); + connect(apk_reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); + connect(apk_reply, &QNetworkReply::finished, this, &wizard::on_download_finished); ui->progress_download->setValue(0); } @@ -310,12 +499,12 @@ void wizard::cancel_download() { assert(reply); - disconnect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); - disconnect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); - disconnect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished); - reply->abort(); - reply->deleteLater(); - reply = nullptr; + disconnect(apk_reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress); + disconnect(apk_reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error); + disconnect(apk_reply, &QNetworkReply::finished, this, &wizard::on_download_finished); + apk_reply->abort(); + apk_reply->deleteLater(); + apk_reply = nullptr; // Cancel and commit to close without saving the already written data, so that it can be reopened apk_file.cancelWriting(); @@ -328,12 +517,12 @@ void wizard::on_download_progress(qint64 bytesReceived, qint64 bytesTotal) { assert(reply); - if (not reply->error()) + if (not apk_reply->error()) { if (bytesTotal > 0) ui->progress_download->setValue(bytesReceived * 100 / bytesTotal); - apk_file.write(reply->readAll()); + apk_file.write(apk_reply->readAll()); } } @@ -347,7 +536,7 @@ void wizard::on_download_error(QNetworkReply::NetworkError code) QMessageBox msgbox /*(this)*/; msgbox.setIcon(QMessageBox::Critical); - msgbox.setText(tr("Error downloading the client:\n%1").arg(QMetaEnum::fromType().valueToKey(code))); + msgbox.setText(tr("Error downloading the client:\n%1").arg(apk_reply->errorString())); msgbox.setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel); #ifdef WORKAROUND_QTBUG_90005 @@ -374,18 +563,110 @@ void wizard::on_download_finished() { assert(reply); - if (not reply->error()) + if (not apk_reply->error()) { - reply->deleteLater(); - reply = nullptr; + auto last_modified = apk_reply->header(QNetworkRequest::LastModifiedHeader).value(); + apk_file.setFileTime(last_modified, QFileDevice::FileModificationTime); + + apk_reply->deleteLater(); + apk_reply = nullptr; ui->button_cancel_download->setEnabled(false); apk_file.commit(); apk_downloaded = true; - settings.setValue("client_apk_url", WIVRN_CLIENT_URL); back(); // Remove current page from history before going to the install page - setCurrentId((int)wizard_page::sideload_install); + setCurrentId((int)wizard_page::sideload_devmode); + } +} + +void wizard::on_android_devices_future_finished() +{ + auto old_devs = android_devices; + android_devices = android_devices_future.result(); + + bool changed = false; + for (auto & i: android_devices) + { + if (i.state() != "device") + continue; + + if (std::ranges::find(old_devs, i) == old_devs.end()) + changed = true; + } + + for (auto & i: old_devs) + { + if (i.state() != "device") + continue; + + if (std::ranges::find(android_devices, i) == android_devices.end()) + changed = true; + } + + if (changed) + on_adb_device_list_changed(); +} + +void wizard::on_adb_device_list_changed() +{ + if (android_devices.empty()) + { + ui->label_device_detected->setText(tr("No device detected.")); + + if (currentId() == (int)wizard_page::sideload_devmode) + button(NextButton)->setEnabled(false); + } + else + { + ui->label_device_detected->setText(tr("%n device(s) detected.", nullptr, android_devices.size())); + + if (currentId() == (int)wizard_page::sideload_devmode) + button(NextButton)->setEnabled(true); + } + + // TODO show device list +} + +void wizard::start_install() +{ + if (android_devices.empty()) + { + back(); + return; + } + + auto dev = android_devices.back(); // TODO choose device from device list + process_adb_install = dev.install(apk_file.fileName().toStdString()); + + connect(process_adb_install.get(), &QProcess::finished, this, &wizard::on_install_finished); + connect(process_adb_install.get(), &QProcess::readyReadStandardOutput, this, &wizard::on_install_stdout); + connect(process_adb_install.get(), &QProcess::readyReadStandardError, this, &wizard::on_install_stderr); + process_adb_install->setParent(this); + process_adb_install->start(); + ui->adb_install_logs->setPlainText(""); +} + +void wizard::on_install_stdout() +{ + ui->adb_install_logs->appendPlainText(process_adb_install->readAllStandardOutput()); + ui->adb_install_logs->verticalScrollBar()->setValue(ui->adb_install_logs->verticalScrollBar()->maximum()); +} + +void wizard::on_install_stderr() +{ + ui->adb_install_logs->appendPlainText(process_adb_install->readAllStandardError()); + ui->adb_install_logs->verticalScrollBar()->setValue(ui->adb_install_logs->verticalScrollBar()->maximum()); +} + +void wizard::on_install_finished(int exit_code, QProcess::ExitStatus exit_status) +{ + if (exit_code == 0 and exit_status == QProcess::NormalExit) + { + // back(); // Remove current page from history before going to the connect page + // setCurrentId((int)wizard_page::connect_hmd); + + button(NextButton)->setEnabled(true); } } diff --git a/dashboard/wizard.h b/dashboard/wizard.h index 1b4921e3..47186aef 100644 --- a/dashboard/wizard.h +++ b/dashboard/wizard.h @@ -18,12 +18,18 @@ #pragma once +#include "adb.h" +#include #include #include +#include #include #include #include +#include #include +#include +#include namespace Ui { @@ -43,10 +49,31 @@ class wizard : public QWizard QSettings settings; QNetworkAccessManager manager; - QNetworkReply * reply = nullptr; + + // Used to download the APK + QNetworkReply * apk_reply = nullptr; + + // Used to query the latest release on github + QNetworkReply * latest_release_reply = nullptr; + + // Used to get the info about the current version on github, either from the WiVRn or the WiVRn-APK repo + QNetworkReply * apk_release_reply = nullptr; + QSaveFile apk_file; + std::string apk_url; bool apk_downloaded = false; + std::string latest_release; + + std::shared_ptr>> android_devices_promise; + QFuture> android_devices_future; + QFutureWatcher> android_devices_future_watcher; + + std::vector android_devices; + QTimer poll_devices_timer; + // std::unique_ptr process_adb_devices; + std::unique_ptr process_adb_install; + public: wizard(); ~wizard(); @@ -64,7 +91,18 @@ public: void on_download_error(QNetworkReply::NetworkError code); void on_download_finished(); - void on_headset_model_changed(); + void on_android_devices_future_finished(); + void on_adb_device_list_changed(); + + void start_install(); + void on_install_finished(int exit_code, QProcess::ExitStatus exit_status); + void on_install_stdout(); + void on_install_stderr(); + + void on_latest_release_finished(); + void on_apk_release_finished(); + + void update_welcome_page(); void on_headset_connected_changed(bool); void on_custom_button_clicked(int which); }; diff --git a/dashboard/wizard.ui b/dashboard/wizard.ui index 8764193c..2554c032 100644 --- a/dashboard/wizard.ui +++ b/dashboard/wizard.ui @@ -23,9 +23,6 @@ - - 0 - @@ -80,6 +77,19 @@
+ + + + Getting latest release information... + + + true + + + true + + + @@ -151,9 +161,6 @@ - - 1 - @@ -211,16 +218,13 @@ - + Install the WiVRn app on your headset - - 2 - @@ -266,52 +270,30 @@ - - - Run the following command to install the client: + + + Qt::Orientation::Vertical - - true + + QSizePolicy::Policy::Fixed + + + + 20 + 40 + + + + + + + + label_device_detected - - - - - Copy to clipboard - - - - - - - - - - - - - - Noto Sans Mono - - - - IBeamCursor - - - adb install wivrn.apk - - - Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse - - - - - - - + Qt::Orientation::Vertical @@ -325,16 +307,58 @@ - + + + Install the WiVRn app on your headset + + + + + + Qt::Orientation::Vertical + + + QSizePolicy::Policy::Fixed + + + + 20 + 40 + + + + + + + + Installing... + + + + + + + + Noto Sans Mono + + + + true + + + + + + + + + Start the WiVRn app and connect to this computer - - 3 - @@ -422,16 +446,13 @@ - + Finished - - 4 - diff --git a/flatpak/io.github.wivrn.wivrn.yml.in b/flatpak/io.github.wivrn.wivrn.yml.in index e11895f8..5218f338 100644 --- a/flatpak/io.github.wivrn.wivrn.yml.in +++ b/flatpak/io.github.wivrn.wivrn.yml.in @@ -1,3 +1,4 @@ +# kate: syntax yaml id: io.github.wivrn.wivrn runtime: org.kde.Platform runtime-version: '6.7' @@ -28,6 +29,8 @@ finish-args: - --own-name=io.github.wivrn.Server # QSystemTrayIcon - --talk-name=org.kde.StatusNotifierWatcher + # Run processes outside of sandbox + - --talk-name=org.freedesktop.Flatpak cleanup: - /lib/pkgconfig @@ -152,11 +155,11 @@ modules: - -DWIVRN_USE_X264=ON - -DWIVRN_USE_NVENC=ON - -DWIVRN_USE_PULSEAUDIO=OFF - - -DWIVRN_CLIENT_URL=https://github.com/WiVRn/WiVRn/releases/latest/download/WiVRn-standard-release.apk - -DWIVRN_WERROR=ON - -DFETCHCONTENT_FULLY_DISCONNECTED=ON - -DFETCHCONTENT_BASE_DIR=deps - -DGIT_DESC=WIVRN_GIT_DESC + - -DGIT_COMMIT=WIVRN_GIT_COMMIT - -Wno-dev sources: - WIVRN_SRC1 @@ -217,4 +220,3 @@ modules: - trap cleanup EXIT INT TERM HUP - - wivrn-dashboard - diff --git a/server/main.cpp b/server/main.cpp index 07a1914f..6842e189 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -574,7 +574,7 @@ void on_name_acquired(GDBusConnection * connection, const gchar * name, gpointer on_headset_info_packet({}); std::ifstream file(configuration::get_config_file()); - std::string config{std::istream_iterator(file), std::istream_iterator()}; + std::string config{std::istreambuf_iterator(file), std::istreambuf_iterator()}; wivrn_server_set_json_configuration(dbus_server, config.c_str()); diff --git a/server/start_application.cpp b/server/start_application.cpp index a2b2af32..94798add 100644 --- a/server/start_application.cpp +++ b/server/start_application.cpp @@ -10,6 +10,8 @@ #include "driver/configuration.h" +#include +#include #include #include #include @@ -230,13 +232,39 @@ int wivrn::exec_application(configuration config) if (config.application.empty()) return 0; - std::vector argv; - argv.reserve(config.application.size() + 1); + std::string executable; + std::vector args; + + if (std::filesystem::exists("/.flatpak-info")) + { + executable = "flatpak-spawn"; + args.push_back("flatpak-spawn"); + args.push_back("--host"); + } + else + { + executable = config.application.front(); + } + for (auto & arg: config.application) - argv.push_back(arg.data()); + args.push_back(arg.data()); + + std::vector argv; + argv.reserve(args.size()); + + for (auto & i: args) + argv.push_back(i.data()); argv.push_back(nullptr); - execvp(config.application.front().c_str(), argv.data()); + std::cerr << "Launching " << executable << std::endl; + std::cerr << "With args:" << std::endl; + for (auto & i: argv) + { + if (i) + std::cerr << " " << std::quoted(i) << std::endl; + } + + execvp(executable.c_str(), argv.data()); perror("Cannot start application"); exit(EXIT_FAILURE); diff --git a/tools/gen_flatpak_manifest.sh b/tools/gen_flatpak_manifest.sh index 5dc77277..902038d4 100755 --- a/tools/gen_flatpak_manifest.sh +++ b/tools/gen_flatpak_manifest.sh @@ -32,13 +32,6 @@ MONADO_COMMIT=$(grep -zo "FetchContent_Declare(monado[^)]*)" ../CMakeLists.txt | BOOSTPFR_URL=$(grep -zo "FetchContent_Declare(boostpfr[^)]*)" ../CMakeLists.txt | sed -ze "s/^.*URL *\([^ )]*\).*$/\1/" | tr -d '\0') BOOSTPFR_SHA256=$(curl --silent --location $BOOSTPFR_URL | sha256sum | cut -f1 -d' ') -if [ -z "$GIT_TAG" ] -then - WIVRN_CLIENT_URL=https://github.com/WiVRn/WiVRn-APK/releases/download/apk-${GIT_SHA}/org.meumeu.wivrn-standard-release.apk -else - WIVRN_CLIENT_URL=https://github.com/WiVRn/WiVRn/releases/download/${GIT_TAG}/WiVRn-standard-release.apk -fi - if [ $WIVRN_SRC_TYPE = git ] then WIVRN_SRC1="type: git" @@ -57,17 +50,16 @@ fi echo "Git commit: $GIT_COMMIT" >&2 echo "Git tag: $GIT_DESC" >&2 -echo "Client URL: $WIVRN_CLIENT_URL" >&2 echo "Monado commit: $MONADO_COMMIT" >&2 echo "Boost.PFR URL: $BOOSTPFR_URL" >&2 echo "Boost.PFR SHA256: $BOOSTPFR_SHA256" >&2 cat ../flatpak/io.github.wivrn.wivrn.yml.in | sed \ - -e s,WIVRN_SRC1,"$WIVRN_SRC1", \ - -e s,WIVRN_SRC2,"$WIVRN_SRC2", \ - -e s,WIVRN_SRC3,"$WIVRN_SRC3", \ + -e s,WIVRN_SRC1,"$WIVRN_SRC1", \ + -e s,WIVRN_SRC2,"$WIVRN_SRC2", \ + -e s,WIVRN_SRC3,"$WIVRN_SRC3", \ -e s,WIVRN_GIT_DESC,$GIT_DESC, \ - -e s,WIVRN_CLIENT_URL=.*,WIVRN_CLIENT_URL=$WIVRN_CLIENT_URL, \ + -e s,WIVRN_GIT_COMMIT,$GIT_COMMIT, \ -e s,BOOSTPFR_URL,$BOOSTPFR_URL, \ -e s,BOOSTPFR_SHA256,$BOOSTPFR_SHA256, \ -e s,MONADO_COMMIT,$MONADO_COMMIT,