Skip to content

Commit

Permalink
OpenVRBackend: Add vr-app-overlay-key
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Aug 23, 2024
1 parent f03168c commit de62f4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Backends/OpenVRBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ namespace gamescope
opt_name = gamescope_options[opt_index].name;
if (strcmp(opt_name, "vr-overlay-key") == 0) {
m_szOverlayKey = optarg;
} else if (strcmp(opt_name, "vr-app-overlay-key") == 0) {
m_szAppOverlayKey = optarg;
} else if (strcmp(opt_name, "vr-overlay-explicit-name") == 0) {
m_pchOverlayName = optarg;
m_bExplicitOverlayName = true;
Expand Down Expand Up @@ -792,6 +794,7 @@ namespace gamescope
}

const char *GetOverlayKey() const { return m_szOverlayKey.c_str(); }
const char *GetAppOverlayKey() const { return m_szAppOverlayKey.c_str(); }
const char *GetOverlayName() const { return m_pchOverlayName; }
const char *GetOverlayIcon() const { return m_pchOverlayIcon; }
bool ShouldEnableControlBar() const { return m_bEnableControlBar; }
Expand Down Expand Up @@ -1077,6 +1080,7 @@ namespace gamescope
}

std::string m_szOverlayKey;
std::string m_szAppOverlayKey;
const char *m_pchOverlayName = nullptr;
const char *m_pchOverlayIcon = nullptr;
bool m_bExplicitOverlayName = false;
Expand Down Expand Up @@ -1500,7 +1504,16 @@ namespace gamescope
bool bIsSteam = VirtualConnectorKeyIsSteam( ulKey );
if ( !bIsSteam )
{
sOverlayKey += ".app";
const char *pszAppOverlayKey = m_pBackend->GetAppOverlayKey();
if ( pszAppOverlayKey && *pszAppOverlayKey )
{
sOverlayKey = pszAppOverlayKey;
sOverlayKey += ".";
}
else
{
sOverlayKey += ".app.";
}
sOverlayKey += std::to_string( m_pConnector->GetVirtualConnectorKey() );
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const struct option *gamescope_options = (struct option[]){
// openvr options
#if HAVE_OPENVR
{ "vr-overlay-key", required_argument, nullptr, 0 },
{ "vr-app-overlay-key", required_argument, nullptr, 0 },
{ "vr-overlay-explicit-name", required_argument, nullptr, 0 },
{ "vr-overlay-default-name", required_argument, nullptr, 0 },
{ "vr-overlay-icon", required_argument, nullptr, 0 },
Expand Down Expand Up @@ -222,6 +223,7 @@ const char usage[] =
#if HAVE_OPENVR
"VR mode options:\n"
" --vr-overlay-key Sets the SteamVR overlay key to this string\n"
" --vr-app-overlay-key Sets the SteamVR overlay key to use for child apps\n"
" --vr-overlay-explicit-name Force the SteamVR overlay name to always be this string\n"
" --vr-overlay-default-name Sets the fallback SteamVR overlay name when there is no window title\n"
" --vr-overlay-icon Sets the SteamVR overlay icon to this file\n"
Expand Down

0 comments on commit de62f4f

Please sign in to comment.