Skip to content

Unable to use keyboard on Unreal Engine game #87

Closed

Description

@aneutron

Hey !

First of all thanks for the amazing work. I noticed the keyboard is usable in a normal manner, and it works for apps such as Messenger, etc., and it works with Hearthstone too. However, it does not work with PUBG Mobile.

I just noticed this, and thought that maybe it's worth reporting, because on the one hand it could be something with Unreal Engine, but it could also be a bug in scrcpy.

Anyway, you're doing amazing work, thanks a lot !

Activity

  1. rom1v commented on Mar 22, 2018

    @rom1v
    Collaborator

    However, it does not work with PUBG Mobile.

    I just installed the game on some device, it works for me. I can type text for example in the "team chat".

  2. aneutron commented on Mar 22, 2018

    @aneutron
    Author

    Yes but the controls don't work. I've seen people using OTG keyboard and mice on YouTube to play.

  3. pete1414 commented on Apr 4, 2018

    @pete1414

    Any progress on this? Is there a way for ScrCpy to say an external OTG keyboard is connected? Some Apps don't recognize the keyboard because it's looking for an OTG or bluetooth keyboard.

  4. rom1v commented on Apr 4, 2018

    @rom1v
    Collaborator

    Is there a way for ScrCpy to say an external OTG keyboard is connected?

    One possibility would be using HID over AOA to generate HID events.

    I already implemented HID events forwarding (i.e. forward raw events from an USB keyboard or mouse) in the past (here is a sample project), but generating the HID events from SDL events requires some work (including reading the USB HID spec).

    And like audio support in scrcpy, this would only work on Linux (which is still great).

    This could also be interesting as a separate project: this would make the computer keyboard act like an OTG keyboard.

  5. pete1414 commented on Apr 25, 2018

    @pete1414

    Please see screenshot below. Top half is key events from Scrcpy, bottom half is keyboard events from bluetooth keyboard. In both situations I held down the 'w' key'. It seems Scrcpy sends Key up before it is released.

    image

  6. pete1414 commented on Apr 27, 2018

    @pete1414

    I have a work around for this, not fully sure of the implications but it at least works for me in PUBG.
    I am not too familiar with github, so I'll just explain what I did.
    in scrcpy.c
    I removed SDL_TEXTINPUT from the case statement.
    I copied the call in KEYUP to KEYDOWN.
    Then in Convert.c I added more key mappings to include alpha keys and number keys and a few others..

    It now works in PUBG, I can also still type normally and paste text.. things that were handled in text input will not work like volume up etc, they could easily be moved to the key handling event, but I haven't bothered.

    I have not thoroughly tested this.. really just wanted it to work for games and now it does.. no longer have to connect a bluetooth keyboard.

    This applies to #122 and #127 as well I believe.

  7. rom1v commented on Apr 27, 2018

    @rom1v
    Collaborator

    Cool 👍

    I am not too familiar with github, so I'll just explain what I did.

    You should click on "fork", then push your branch to your github fork and post the link here :)

    Then in Convert.c I added more key mappings to include alpha keys and number keys and a few others..

    What is your keyboard layout? What if you press Shift+, (for example, on a French keyboard)?

    I initially implemented key events using keycodes only (before scrcpy was published), but after reading documentation and discussions on irc #sdl, I think there is no way to work independently of your keyboard layout. Maybe I am wrong though.

    things that were handled in text input will not work like volume up etc, they could easily be moved to the key handling event, but I haven't bothered.

    On dev branch, volume shortcuts have been changed to Ctrl+up and Ctrl+down without text input.

  8. pete1414 commented on Apr 27, 2018

    @pete1414

    I don't see a mapping for "<" in the android keycodes.h, which is what my Shift + "," would be. But I think as long as a mapping is created you could use any layout.

    Also, thanks to you for creating this! The app is amazing and I can't say that enough. I am an original kickstarter backer for the 'superbook' and this might replace my need for it... all though I am still looking forward to it.

  9. rom1v commented on Apr 28, 2018

    @rom1v
    Collaborator

    But I think as long as a mapping is created you could use any layout.

    I agree, but it may not work with all layout without remapping (while with text input events it should work).

    You said:

    Would it be easier to have the user switch between modes? ie, press Ctrl G to enter 'game' mode. Press again to use text mode.

    This is a possibility. 👍

  10. rom1v commented on Aug 15, 2018

    @rom1v
    Collaborator

    I added a command-line option: (see next comment)

    scrcpy --raw-key-events
    

    or:

    scrcpy -k
    

    Please try the rawkeyevents branch. If it works as expected, I will merge it into dev.

    press Ctrl G to enter 'game' mode

    I decided to use a command-line option, because there is no clear feedback about the current mode, which may be confusing if someone enables it without noticing.

    EDIT: not sure I will keep it that way. Maybe I will remove the option and bind it to a shortcut. What do you think?

  11. rom1v commented on Aug 15, 2018

    @rom1v
    Collaborator

    I changed my mind, I remove the command-line argument, and bound Ctrl+k instead (the mode may need to be toggled while scrcpy is running).

  12. rom1v commented on Aug 18, 2018

    @rom1v
    Collaborator

    @aneutron @pete1414 Could you test the branch rawkeyevents and tell me if it fixes/workarounds the problem, please?

  13. 22 remaining items

  14. shashi007 commented on Oct 6, 2018

    @shashi007

    Any way to make mouse work? Without mouse working the games can be played properly. I tried using Octopus app for mapping and was able to walk/run but couldn't get mouse working. (I'm using Linux)

  15. rom1v commented on Oct 6, 2018

    @rom1v
    Collaborator
  16. shashi007 commented on Oct 6, 2018

    @shashi007

    @rom1v Ah, Mouse feature is not implemented yet, I hope it will be soon.. Thanks. I love Scrcpy. :-)

  17. rom1v commented on Oct 6, 2018

    @rom1v
    Collaborator

    Yes, mouse forwarding is implemented (you can click on the screen), but not in capture mode for gaming.

  18. IAmMadMax commented on Oct 9, 2018

    @IAmMadMax

    Was looking for a solution to this and ended up here. Is there a scope for this "capture mode" to be added in future builds? Would really open gates for some good gaming experience. Coincidentally I was looking for ways to play PUBG mobile too, just like the others above.

    Whether or not you will, you are doing great work. Cheers!

  19. rom1v commented on Oct 9, 2018

    @rom1v
    Collaborator

    Is there a scope for this "capture mode" to be added in future builds?

    I did not investigate how to implement it yet (#269). If someone have time and is interested, please go ahead 😉 Otherwise I might look at it some day.

  20. walkiitm commented on Oct 13, 2018

    @walkiitm

    @walkiitm I just built a win64 version of master+rawalpha.

    Could you test it, please?

    Just download scrcpy.exe and replace it in your scrcpy directory.
    SHA-256: 7a027131e5669dfb01e34cc75f080728ef5434cd3f21f0b3e8cc89ac30fe5887

    Hey, both my Windows defender and Anti-virus warned me of running this file. It didn't happen with the original build.

  21. rom1v commented on Oct 13, 2018

    @rom1v
    Collaborator

    Hey, both my Windows defender and Anti-virus warned me of running this file.

    What do they say?
    Could you check its SHA-256 to verify that your file is exactly the same?

    I downloaded it, its SHA-256 is the expected one, and if I scan it online with virustotal, everything is fine:
    https://www.virustotal.com/fr/file/7a027131e5669dfb01e34cc75f080728ef5434cd3f21f0b3e8cc89ac30fe5887/analysis/1539415214/

    It didn't happen with the original build.

    Maybe the reason is that they detected that the original file has been replaced (same filepath, different content)?

    By the way, you don't need this temporary file anymore, the feature is included in v1.4.

  22. walkiitm commented on Oct 13, 2018

    @walkiitm

    Hey, both my Windows defender and Anti-virus warned me of running this file.

    What do they say?
    Could you check its SHA-256 to verify that your file is exactly the same?

    I downloaded it, its SHA-256 is the expected one, and if I scan it online with virustotal, everything is fine:
    https://www.virustotal.com/fr/file/7a027131e5669dfb01e34cc75f080728ef5434cd3f21f0b3e8cc89ac30fe5887/analysis/1539415214/

    It didn't happen with the original build.

    Maybe the reason is that they detected that the original file has been replaced (same filepath, different content)?

    By the way, you don't need this temporary file anymore, the feature is included in v1.4.

    Okay. Thank you. Yeah must be a false positive. The antivirus uploaded the file to its servers(apparently cause it's an exe that's rare) and later reported that it's safe. Sorry for the confusion.

  23. Mehardeep commented on Dec 12, 2018

    @Mehardeep

    Hi everyone please help me to find where pubg controller are implemented in the code
    as A-W-S_D buttons are working in PUBG (scrcpy) but when i sent through cmd (adb input keyevent ) its not working

  24. rom1v commented on Dec 12, 2018

    @rom1v
    Collaborator

    @Mehardeep See 411aa4f and injectKeyEvent() on the server.

  25. added a commit that references this issue on Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions