Skip to main content
Up and Coming
March 9, 2016

[GearVR] Oculus Patched UE4 4.10.2 Back Button Issues

Greetings!

I'm using the 4.10-0.8 branch from https://github.com/Oculus-VR/UnrealEngine as I need to be on Mobile SDk 1.x to launch my GearVR title. However, it looks like the Back button now behaves quite differently in this version compared to the standard UE4 4.10.4.

It is now not possible for the application to receive a Back button event, and it always attempts to quit the application. To test this out, I just recompiled by Circumpaint application using the Oculus branch. Now any short press of the Back button brings up the standard "Are you sure you want to quit" dialog.

In going through the new code in Engine/Plugins/Runtime/GearVR/Source/GearVR/Private/GearVR.cpp there are added HandleBackButtonAction() and HandleInputKey() methods. Within HandleInputKey(), if the Back button is released before BACK_BUTTON_SHORT_PRESS_TIME_IN_SECONDS is up, then we enter a short press state. So far, so good.

But then within HandleBackButtonAction() a pending Back button short press state has the following code:

	else if (BackButtonState == BACK_BUTTON_STATE_PENDING_SHORT_PRESS && !BackButtonDown)
{
if ( ( vrapi_GetTimeInSeconds() - BackButtonDownStartTime ) > BACK_BUTTON_DOUBLE_TAP_TIME_IN_SECONDS )
{
UE_LOG(LogHMD, Log, TEXT("back button short press"));

PushBlackFinal();

UE_LOG(LogHMD, Log, TEXT(" SystemActivities_StartSystemActivity( %s )"), ANSI_TO_TCHAR(PUI_CONFIRM_QUIT));
SystemActivities_StartSystemActivity( &JavaGT, PUI_CONFIRM_QUIT, NULL );
BackButtonState = BACK_BUTTON_STATE_NONE;
}
}


With this code, a Back button short press will always pop up the quit confirmation activity. This means that an application or game can never make use of the Back button to navigate back through its menus.

Is there a reason this is now forced on us? Or is it just an error? If it is an error, what would be the fix to pass a short press Back button back into UE4's input stream like we have in the standard 4.10.4?

Thanks!

- Dave
    This topic has been closed for replies.

    15 replies

    Inspiring
    March 9, 2016
    Hmm.. Didn't know there is a special fork of UE4. What's the difference between stock UE4 and this fork ? (for Gear VR anyway)
    GnometechAuthor
    Up and Coming
    March 9, 2016
    For GearVR, this adds Oculus Mobile SDK 1.0.1 support to UE4 4.10.2. The regular version of UE4 4.10.4 only has Mobile SDK 0.63 support. To publish on Oculus Home you now need to be on Mobile SDK 1.x.

    Regular UE4 4.11 also supports Mobile SDK 1.x, but that branch isn't considered stable yet.

    - Dave
    David Wyand www.gnometech.com @Gnometech Game in progress: The Field -- Multiplayer, battlefield-style VR FPS GearVR Store: Circumpaint -- Paint and animate on a dome around you
    GnometechAuthor
    Up and Coming
    March 9, 2016
    OK, I think I have a workable solution to get me past this. In FGearVR::HandleInputKey() change the elseif block to read as:

    			else if (EventType == IE_Released)
    {
    BackButtonDown = false;
    if (BackButtonState == BACK_BUTTON_STATE_NONE)
    {
    if ( ( vrapi_GetTimeInSeconds() - BackButtonDownStartTime ) < BACK_BUTTON_SHORT_PRESS_TIME_IN_SECONDS )
    {
    //BackButtonState = BACK_BUTTON_STATE_PENDING_SHORT_PRESS;
    return false;
    }
    }
    else if (BackButtonState == BACK_BUTTON_STATE_SKIP_UP)
    {
    BackButtonState = BACK_BUTTON_STATE_NONE;
    }
    }


    I've moved the BackButtonDown = false; to the top, commented out the BackButtonState assignment, and added the return false. This means that if a short press is detected then the event gets bubbled up to UE4. The downside is that this means only the release event is being sent to UE4, and not the pressed one so you need to be aware of that in your input event node.

    Also note that it looks like 4.11 is using the same code as from this Oculus branch, so it will currently have the same broken Back button behavior.

    - Dave
    David Wyand www.gnometech.com @Gnometech Game in progress: The Field -- Multiplayer, battlefield-style VR FPS GearVR Store: Circumpaint -- Paint and animate on a dome around you
    Up and Coming
    March 9, 2016
    There is a variable gearvr.HandleBackButton that could be set to 1 and this will override the default behavior of the back button. You can set this var in ConsoleVariables.ini or in [SystemSettings] of ...Engine.ini.
    New Participant
    March 22, 2016
    Sorry for posting here, but I think it could be related.

    WE are experiencing problems with the GearVR integration of the Back button behaviour.

    After calling via Execute command the OVRGLOBALMENU command appear the "Exit to Oculus Home" screen. Then, if we push the Back button again the game crashes with the classic "<App name> stopped working" popup. I've been looking in the logcat withe "logcat -s UE4 OVR VrApi VrLib VRSVC HmdInfo" and I've not been able to see any strange message that guides me to know what is happening.

    I imagine that the Oculus activity is trying to go back to the Unreal Engine's GameActivity and it fails for some reason, ¿any clues?
    Up and Coming
    March 22, 2016
    Send us a full logcat for the start. Dropbox/google drive link should work fine.
    New Participant
    March 23, 2016
    Here is the full logcat (no filters): https://www.dropbox.com/s/kjczk4m70ekrz ... t.txt?dl=0
    Up and Coming
    March 23, 2016
    Yeah, don't see any traces of any crash in that logcat.... Are you sure it is the full log? But I can see a lot of different parts in that logcat. Can you do 'logcat -c' and then just collect full clean logcat till it crashes?

    Where did you get the integration from, btw?
    New Participant
    March 23, 2016
    I've generated 2 new files.

    This one is a logcat with the unreal engine and other filters: "logcat -s UE4 OVR VrApi VrLib VRSVC HmdInfo"
    https://www.dropbox.com/s/a037madv3h9n2 ... 4.txt?dl=0

    The second one is a new one with no filters:
    https://www.dropbox.com/s/drlng2g66ve8g ... l.txt?dl=0

    The integration is the one that comes with Unreal Engine 4.11 (preview 7), and it's a 1.0 if I'm not wrong.
    Up and Coming
    March 23, 2016
    Uhm... Now your logcat doesn't contain any UE4 entries....