Beispiel #1
0
DWORD __stdcall RetrieveImageEvent( VOID* Parameter )
{
    OVERLAPPED          ov          = { 0 };
    //BOOLEAN                bReturnCode = FALSE;
    UINT32              iBytesReturned;
    IMAGE_CALLBACK_INFO imageInfo;

    // Create an event handle for async notification from the driver
    NtCreateEvent(&ov.hEvent, EVENT_ALL_ACCESS, NULL, NotificationEvent, FALSE);

    // Get the process info
    PushGetImageInfo(&imageInfo);

    Log(L"%i loaded D3D module", imageInfo.processID);


    //
    // Wait here for the event handle to be set, indicating
    // that the IOCTL processing is completed.
    //
    GetOverlappedResult(
        R0DriverHandle,
        &ov,
        &iBytesReturned,
        TRUE
        );

    CreateOverlay(imageInfo.processID);
    NtClose(ov.hEvent);

    return 0;
}
Beispiel #2
0
VOID ProcessEnum( SYSTEM_PROCESS_INFORMATION* ProcessInformation )
{
    GAME_LIST gameList;
    PUSH_GAME* game;
    UINT8 i;

    i = 0;

    gameList = Game_GetGames();

    while (gameList != NULL)
    {
        game = gameList->Game;

        if (ProcessInformation->ImageName.Length
            && String_CompareN(
                game->ExecutableName,
                ProcessInformation->ImageName.Buffer,
                ProcessInformation->ImageName.Length) == 0)
        {
            CreateOverlay((DWORD)ProcessInformation->UniqueProcessId);
        }

        gameList = gameList->NextEntry;

        i++;
    }
}
Beispiel #3
0
const Entity EntityBuilder::CreateProgressBar(const XMFLOAT3 & position, const std::string & text, float fontSize, float textSize, const XMFLOAT4 & colorTex, const float min, const float max, const float start, float width, float height)
{
	ProgressBar* b = nullptr;
	try {
		b = new ProgressBar(start, min, max, width, height);
	}
	catch (std::exception& e) { e; throw ErrorMsg(0, L"Failed to create progress bar."); }
	Entity ent = CreateLabel(position, text, fontSize, colorTex, textSize, height, "");


	float l = width*((b->value - b->minV) / (b->maxV - b->minV));
	Entity bar = CreateOverlay(XMFLOAT3(textSize, 0.0f, 0.0f), l, height, "Assets/Textures/default_color.png");
	
	_transform->BindChild(ent, bar);

	_transform->SetPosition(ent, position);

	_animation->CreateAnimation(ent, "scale", 0.15f, 
		[bar,b,this](float delta, float amount, float offset) 
	{
		_overlay->SetExtents(bar, offset + amount, b->height);
	});


	_controller->AddProgressBar(ent, b);
	return ent;
}
Beispiel #4
0
void showMinSpecWarning() {
    auto vrSystem = acquireOpenVrSystem();
    auto vrOverlay = vr::VROverlay();
    if (!vrOverlay) {
        qFatal("Unable to initialize SteamVR overlay manager");
    }

    vr::VROverlayHandle_t minSpecFailedOverlay = 0;
    if (vr::VROverlayError_None != vrOverlay->CreateOverlay(FAILED_MIN_SPEC_OVERLAY_NAME, FAILED_MIN_SPEC_OVERLAY_FRIENDLY_NAME, &minSpecFailedOverlay)) {
        qFatal("Unable to create overlay");
    }

    // Needed here for PathUtils
    QCoreApplication miniApp(__argc, __argv);

    vrSystem->ResetSeatedZeroPose();
    QString imagePath = PathUtils::resourcesPath() + "/images/steam-min-spec-failed.png";
    vrOverlay->SetOverlayFromFile(minSpecFailedOverlay, imagePath.toLocal8Bit().toStdString().c_str());
    vrOverlay->SetHighQualityOverlay(minSpecFailedOverlay);
    vrOverlay->SetOverlayWidthInMeters(minSpecFailedOverlay, 1.4f);
    vrOverlay->SetOverlayInputMethod(minSpecFailedOverlay, vr::VROverlayInputMethod_Mouse);
    vrOverlay->ShowOverlay(minSpecFailedOverlay);

    QTimer* timer = new QTimer(&miniApp);
    timer->setInterval(FAILED_MIN_SPEC_UPDATE_INTERVAL_MS); // Qt::CoarseTimer acceptable, we don't need this to be frame rate accurate
    QObject::connect(timer, &QTimer::timeout, [&] {
        vr::TrackedDevicePose_t vrPoses[vr::k_unMaxTrackedDeviceCount];
        vrSystem->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseSeated, 0, vrPoses, vr::k_unMaxTrackedDeviceCount);
        auto headPose = toGlm(vrPoses[vr::k_unTrackedDeviceIndex_Hmd].mDeviceToAbsoluteTracking);
        auto overlayPose = toOpenVr(headPose * glm::translate(glm::mat4(), vec3(0, 0, -1)));
        vrOverlay->SetOverlayTransformAbsolute(minSpecFailedOverlay, vr::TrackingUniverseSeated, &overlayPose);

        vr::VREvent_t event;
        while (vrSystem->PollNextEvent(&event, sizeof(event))) {
            switch (event.eventType) {
                case vr::VREvent_Quit:
                    vrSystem->AcknowledgeQuit_Exiting();
                    QCoreApplication::quit();
                    break;

                case vr::VREvent_ButtonPress:
                    // Quit on any button press except for 'putting on the headset'
                    if (event.data.controller.button != vr::k_EButton_ProximitySensor) {
                        QCoreApplication::quit();
                    }
                    break;

                default:
                    break;
            }
        }

    });
    timer->start();

    QTimer::singleShot(FAILED_MIN_SPEC_AUTO_QUIT_INTERVAL_MS, &miniApp, &QCoreApplication::quit);
    miniApp.exec();
}
/*
====================
idRenderModelOverlay::CreateDeferredOverlays
====================
*/
void idRenderModelOverlay::CreateDeferredOverlays( const idRenderModel* model )
{
	for( unsigned int i = firstDeferredOverlay; i < nextDeferredOverlay; i++ )
	{
		const overlayProjectionParms_t& parms = deferredOverlays[i & ( MAX_DEFERRED_OVERLAYS - 1 )];
		if( parms.startTime > tr.viewDef->renderView.time[0] -  DEFFERED_OVERLAY_TIMEOUT )
		{
			CreateOverlay( model, parms.localTextureAxis, parms.material );
		}
	}
	firstDeferredOverlay = 0;
	nextDeferredOverlay = 0;
}
Beispiel #6
0
vr::EVRCompositorError CompositorBase::SubmitFrame(ovrLayerHeader const * const * layerPtrList, unsigned int layerCount)
{
	MICROPROFILE_SCOPE(SubmitFrame);

	// Other layers are interpreted as overlays.
	std::vector<vr::VROverlayHandle_t> activeOverlays;
	for (uint32_t i = 0; i < layerCount; i++)
	{
		if (layerPtrList[i] == nullptr)
			continue;

		if (layerPtrList[i]->Type == ovrLayerType_Quad)
		{
			ovrLayerQuad* layer = (ovrLayerQuad*)layerPtrList[i];
			ovrTextureSwapChain chain = layer->ColorTexture;

			// Every overlay is associated with a swapchain.
			// This is necessary because the position of the layer may change in the array,
			// which would otherwise cause flickering between overlays.
			// TODO: Support multiple overlays using the same texture.
			vr::VROverlayHandle_t overlay = layer->ColorTexture->Overlay;
			if (overlay == vr::k_ulOverlayHandleInvalid)
			{
				overlay = CreateOverlay();
				layer->ColorTexture->Overlay = overlay;
			}
			activeOverlays.push_back(overlay);

			// Set the layer rendering order.
			vr::VROverlay()->SetOverlaySortOrder(overlay, i);

			// Transform the overlay.
			vr::HmdMatrix34_t transform = REV::Matrix4f(layer->QuadPoseCenter);
			vr::VROverlay()->SetOverlayWidthInMeters(overlay, layer->QuadSize.x);
			if (layer->Header.Flags & ovrLayerFlag_HeadLocked)
				vr::VROverlay()->SetOverlayTransformTrackedDeviceRelative(overlay, vr::k_unTrackedDeviceIndex_Hmd, &transform);
			else
				vr::VROverlay()->SetOverlayTransformAbsolute(overlay, vr::VRCompositor()->GetTrackingSpace(), &transform);

			// Set the texture and show the overlay.
			vr::VRTextureBounds_t bounds = ViewportToTextureBounds(layer->Viewport, layer->ColorTexture, layer->Header.Flags);
			vr::Texture_t texture = chain->Textures[chain->SubmitIndex]->ToVRTexture();
			vr::VROverlay()->SetOverlayTextureBounds(overlay, &bounds);
			vr::VROverlay()->SetOverlayTexture(overlay, &texture);
			chain->Submit();

			// Show the overlay, unfortunately we have no control over the order in which
			// overlays are drawn.
			// TODO: Support ovrLayerFlag_HighQuality for overlays with anisotropic sampling.
			// TODO: Handle overlay errors.
			vr::VROverlay()->ShowOverlay(overlay);
		}
		else if (layerPtrList[i]->Type == ovrLayerType_EyeFov)
		{
			ovrLayerEyeFov* sceneLayer = (ovrLayerEyeFov*)layerPtrList[i];

			if (!m_SceneLayer)
				m_SceneLayer = layerPtrList[i];
			else
				SubmitFovLayer(sceneLayer->Viewport, sceneLayer->Fov, sceneLayer->ColorTexture, sceneLayer->Header.Flags);
		}
		else if (layerPtrList[i]->Type == ovrLayerType_EyeMatrix)
		{
			ovrLayerEyeMatrix* sceneLayer = (ovrLayerEyeMatrix*)layerPtrList[i];

			ovrFovPort fov[ovrEye_Count] = {
				MatrixToFovPort(sceneLayer->Matrix[ovrEye_Left]),
				MatrixToFovPort(sceneLayer->Matrix[ovrEye_Right])
			};

			if (!m_SceneLayer)
				m_SceneLayer = layerPtrList[i];
			else
				SubmitFovLayer(sceneLayer->Viewport, fov, sceneLayer->ColorTexture, sceneLayer->Header.Flags);
		}
	}

	// Hide previous overlays that are not part of the current layers.
	for (vr::VROverlayHandle_t overlay : m_ActiveOverlays)
	{
		// Find the overlay in the current active overlays, if it was not found then hide it.
		// TODO: Handle overlay errors.
		if (std::find(activeOverlays.begin(), activeOverlays.end(), overlay) == activeOverlays.end())
			vr::VROverlay()->HideOverlay(overlay);
	}
	m_ActiveOverlays = activeOverlays;

	vr::EVRCompositorError error = vr::VRCompositorError_None;
	if (m_SceneLayer && m_SceneLayer->Type == ovrLayerType_EyeFov)
	{
		ovrLayerEyeFov* sceneLayer = (ovrLayerEyeFov*)m_SceneLayer;
		error = SubmitSceneLayer(sceneLayer->Viewport, sceneLayer->Fov, sceneLayer->ColorTexture, sceneLayer->Header.Flags);

		if (m_MirrorTexture && error == vr::VRCompositorError_None)
			RenderMirrorTexture(m_MirrorTexture, sceneLayer->ColorTexture);
	}
	else if (m_SceneLayer && m_SceneLayer->Type == ovrLayerType_EyeMatrix)
	{
		ovrLayerEyeMatrix* sceneLayer = (ovrLayerEyeMatrix*)m_SceneLayer;

		ovrFovPort fov[ovrEye_Count] = {
			MatrixToFovPort(sceneLayer->Matrix[ovrEye_Left]),
			MatrixToFovPort(sceneLayer->Matrix[ovrEye_Right])
		};

		error = SubmitSceneLayer(sceneLayer->Viewport, fov, sceneLayer->ColorTexture, sceneLayer->Header.Flags);

		if (m_MirrorTexture && error == vr::VRCompositorError_None)
			RenderMirrorTexture(m_MirrorTexture, sceneLayer->ColorTexture);
	}

	m_SceneLayer = nullptr;

	return error;
}