ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.07k stars 1.28k forks source link

SetApplicationAutoLaunch fails with VRApplicationError_UnknownApplication after successful AddApplicationManifest #1378

Open henriheimann opened 4 years ago

henriheimann commented 4 years ago

I am trying to register an overlay application to auto launch. I wrote the following function for testing purposes. The path of manifest.vrmanifest is correct and AddApplicationManifest returns VRApplicationError_None. Listing the applications returns an app with id system.generated.overlay_wheelchair.exe. The call of SetApplicationAutoLaunch returns VRApplicationError_UnknownApplication.

constexpr const char* applicationKey = "overlay_wheelchair";

void handleManifests()
{
    vr::HmdError hmdError = vr::VRInitError_None;
    vr::IVRSystem *vrSystem = vr::VR_Init(&hmdError, vr::VRApplication_Utility);

    std::string manifestPath = (QCoreApplication::applicationDirPath() + "/manifest.vrmanifest").toStdString();

    if (vr::VRApplications()->IsApplicationInstalled(applicationKey)) {
        std::cout << "Manifest Is already Installed for key installed: " << applicationKey << std::endl;
    } else {
        const auto app_error = vr::VRApplications()->AddApplicationManifest(manifestPath.c_str());
        if (app_error != vr::VRApplicationError_None) {
            throw std::runtime_error(std::string("Could not add application manifest: ") + std::string(vr::VRApplications()->GetApplicationsErrorNameFromEnum(app_error)));
        } else {
            std::cout << "Manifest installed: " << manifestPath << std::endl;
        }
    }

    uint32_t count = vr::VRApplications()->GetApplicationCount();
    for (size_t i = 0; i < count; i++) {
        char buffer[2048];
        auto error = vr::VRApplications()->GetApplicationKeyByIndex(i, buffer, sizeof(buffer));
        if (error == vr::VRApplicationError_None) {
            std::cout << i << ", app key: " << buffer << std::endl;
        }
    }

    auto error = vr::VRApplications()->SetApplicationAutoLaunch(applicationKey, true);
    if (error != vr::VRApplicationError_None) {
        throw std::runtime_error(std::string("Could not set auto launch application: ") + std::string(vr::VRApplications()->GetApplicationsErrorNameFromEnum(error)));
    }

    vr::VR_Shutdown();
}

The manifest file I am trying to load:

{
    "source" : "builtin",
    "applications": [{
        "app_key": "overlay_wheelchair",
        "launch_type": "binary",
        "binary_path_windows": "overlay_wheelchair.exe",
        "is_dashboard_overlay": true,

        "strings": {
            "en_us": {
                "name": "Wheelchair Controller Overlay",
                "description": "Used to force wheelchair controller movement and rotation input for all SteamVR applications"
            }
        }
    }]
}

I'm struggeling to find more information on whether I am supposed to register the application in any other way or am missing something.

I found Issue #106 which stated that SteamVR might have to be restarted in between AddApplicationManifest and SetApplicationAutoLaunch, which I tried with no results. vr::VRApplications()->IsApplicationInstalled(applicationKey) also returns false after a restart of SteamVR.

I also tested this project: https://github.com/elvissteinjr/SteamVR-ForceCompositorScale But I am running into the same problem with SetApplicationAutoLaunch returning VRApplicationError_UnknownApplication there, too.

imagitama commented 3 years ago

Any progress on this? I also get the same error using very similar code I copied from Advanced Settings: https://github.com/matzman666/OpenVR-AdvancedSettings/blob/master/src/main.cpp

sergioberg commented 3 years ago

Any progress on this? I also get the same error using very similar code I copied from Advanced Settings: https://github.com/matzman666/OpenVR-AdvancedSettings/blob/master/src/main.cpp

with SteamVR Beta?

imagitama commented 3 years ago

Ignore my comment - my manifest was wrong. I fixed my manifest and it works (OpenVR 1.16.8 and SteamVR 1.16.10)

MisutaaAsriel commented 1 year ago

I'm also getting this issue. It seems to register the manifest, but steamvr doesn't get the memo, as it shows in the manifest list json, nowhere else.

Just returns Unknown Application. Likewise, the actually registering of the manifest returns no error.