Populate OpenVR compat libs in non-flatpak build
This commit is contained in:
@@ -25,3 +25,5 @@
|
||||
#cmakedefine01 WIVRN_USE_VAAPI
|
||||
#cmakedefine01 WIVRN_USE_VULKAN_ENCODE
|
||||
#cmakedefine01 WIVRN_USE_X264
|
||||
|
||||
#define OVR_COMPAT_SEARCH_PATH "@OVR_COMPAT_SEARCH_PATH@"
|
||||
|
||||
@@ -354,16 +354,11 @@ Kirigami.ScrollablePage {
|
||||
"value": "",
|
||||
"is_custom": false
|
||||
});
|
||||
|
||||
if (config.flatpak) {
|
||||
var libs = WivrnServer.openVRCompat;
|
||||
for (var i = 0; i < libs.length; i++) {
|
||||
openvr_libs.append({
|
||||
"name": i18n("xrizer"),
|
||||
"value": "xrizer",
|
||||
"is_custom": false
|
||||
});
|
||||
openvr_libs.append({
|
||||
"name": i18n("Open Composite"),
|
||||
"value": "OpenComposite",
|
||||
"name": libs[i].name,
|
||||
"value": libs[i].path,
|
||||
"is_custom": false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "magic_enum.hpp"
|
||||
#include "utils/flatpak.h"
|
||||
#include "wivrn_server_dbus.h"
|
||||
#include <KLocalization>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopServices>
|
||||
@@ -576,6 +577,23 @@ QString wivrn_server::host_path(QString path)
|
||||
return path;
|
||||
}
|
||||
|
||||
QList<OpenVRCompat> wivrn_server::openVRCompat() const
|
||||
{
|
||||
if (wivrn::is_flatpak())
|
||||
return {
|
||||
OpenVRCompat(i18n("xrizer"), "xrizer"),
|
||||
OpenVRCompat(i18n("Open Composite"), "OpenComposite"),
|
||||
};
|
||||
|
||||
QList<OpenVRCompat> result;
|
||||
for (auto path: std::ranges::split_view(std::string_view(OVR_COMPAT_SEARCH_PATH), std::string_view(":")))
|
||||
{
|
||||
if (std::filesystem::path fs = std::string_view(path); std::filesystem::exists(fs))
|
||||
result.push_back(OpenVRCompat(QString::fromStdString(fs.string()), QString::fromStdString(fs.string())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void wivrn_server::disconnect_headset()
|
||||
{
|
||||
if (server_interface)
|
||||
|
||||
@@ -95,6 +95,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class OpenVRCompat
|
||||
{
|
||||
Q_GADGET
|
||||
QML_VALUE_TYPE(openVRCompat)
|
||||
QML_ELEMENT
|
||||
Q_PROPERTY(QString name READ name CONSTANT)
|
||||
Q_PROPERTY(QString path READ path CONSTANT)
|
||||
|
||||
QString m_name;
|
||||
QString m_path;
|
||||
|
||||
public:
|
||||
OpenVRCompat() = default;
|
||||
OpenVRCompat(QString name, QString path) :
|
||||
m_name(name), m_path(path) {}
|
||||
|
||||
// localized name of the compat layer (can be the path)
|
||||
QString name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString path() const
|
||||
{
|
||||
return m_path;
|
||||
}
|
||||
};
|
||||
|
||||
class wivrn_server : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -170,6 +198,9 @@ public:
|
||||
// flatpak API
|
||||
Q_INVOKABLE QString host_path(QString path);
|
||||
|
||||
// System information
|
||||
Q_PROPERTY(QList<OpenVRCompat> openVRCompat READ openVRCompat CONSTANT)
|
||||
|
||||
Status serverStatus() const
|
||||
{
|
||||
return m_serverStatus;
|
||||
@@ -284,6 +315,8 @@ public:
|
||||
return server_output.join("");
|
||||
}
|
||||
|
||||
QList<OpenVRCompat> openVRCompat() const;
|
||||
|
||||
Q_INVOKABLE void disconnect_headset();
|
||||
Q_INVOKABLE void copy_steam_command();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user