RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    moonlight: request for comments and testing

    Scheduled Pinned Locked Moved Ideas and Development
    moonlighttestingscriptmodulestreamingsteam
    147 Posts 21 Posters 40.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MightyHandy @MightyHandy
      last edited by

      @MightyHandy nevermind... found this:
      https://github.com/irtimmer/moonlight-embedded/wiki/Usage
      I assume you are just passing the options through.

      H 1 Reply Last reply Reply Quote 0
      • H
        hhromic @Silent
        last edited by

        @Silent said in moonlight: request for comments and testing:

        @MightyHandy said in moonlight: request for comments and testing:

        @hhromic - this is awesome! Given that there is now a brand new experimental "steam-link" package... would it make more sense to store the ml files under:
        /roms/moonlight
        In order to eliminate the ambiguity.

        I don't agree. By using 'steam' you're playing nice with scrapers and ES themes (lots of them have a 'steam' theme). Moonlight is just an "emulator" used to play those, steam is "platform".

        I agree with @Silent , steam is a defacto standard and that's why I chose to use it :)
        And yes indeed I designed the integration for Moonlight to just be an "emulator" for "steam".

        1 Reply Last reply Reply Quote 0
        • H
          hhromic @MightyHandy
          last edited by

          @MightyHandy said in moonlight: request for comments and testing:

          @MightyHandy nevermind... found this:
          https://github.com/irtimmer/moonlight-embedded/wiki/Usage
          I assume you are just passing the options through.

          Almost. The options are actually the ones that can be set in a moonlight.conf file.
          The supported options (and their names) can be seen in the template config file from Moonlight here: https://github.com/irtimmer/moonlight-embedded/blob/master/moonlight.conf

          1 Reply Last reply Reply Quote 0
          • H
            hhromic
            last edited by hhromic

            Hi all, I've been away for some time and I'm still busy nowadays :(
            However I haven't forgotten about Moonlight and finishing the scriptmodule to be included in RetroPie officially. I will be working on some extra improvements after all the feedback you have given so far. Thanks for all the input guys, some ideas are very nice!

            @Silent said in moonlight: request for comments and testing:

            Two things to note:

            Generated filenames still contain : in them, which greatly confuses Windows when previewing roms\steam directory from a network share. Maybe cut them, like retromoonlight does?
            Some games listed by Moonlight have ™ (maybe also © or ®) in names and this confuses some other software. Maybe they also could be omitted from filenames.

            I understand how this is problematic for your use case. However I think I have an idea on how to solve it nicely for both, you who can't use full names and also others (like me) that prefer the full names in filesystems that supports it. To help me (later) develop this, I would be very thankful if you can provide me with the your list of games so I can study what kind of characters are there.

            Therefore, can you please send me the output of this command?

            /opt/retropie/supplementary/moonlight/moonlight.sh list
            

            Cheers!

            S 1 Reply Last reply Reply Quote 1
            • S
              Silent @hhromic
              last edited by

              @hhromic said in moonlight: request for comments and testing:

              Therefore, can you please send me the output of this command?

              1. Spintires MudRunner
              2. Run PCSX2
              3. Grand Theft Auto Vice City Stories PS2
              4. Grand Theft Auto Vice City PS2
              5. Grand Theft Auto San Andreas PS2
              6. Grand Theft Auto Liberty City Stories PS2
              7. Gran Turismo 4
              8. Crash Bandicoot N. Sane Trilogy
              9. BattleBlock Theater
              10. American Truck Simulator
              11. Worms W.M.D
              12. Portal 2
              13. GRID 2
              14. Steam
              15. Grand Theft Auto V
              16. Fallout 4
              17. Sid Meier's Civilization V (DX 11)
              18. GRID
              19. Driver San Francisco
              20. DiRT Showdown
              21. Left 4 Dead 2
              22. Saints Row: The Third (DX 11)
              23. Saints Row IV (DX 11)
              24. Deus Ex: Human Revolution
              25. Hitman™
              26. Double Dragon Neon
              27. DiRT 3 Complete Edition
              28. Hitman 2
              29. Hotline Miami 2: Wrong Number
              30. Mafia III
              31. Overcooked
              32. Broforce
              33. DiRT Rally
              34. L.A. Noire
              35. I am Bread
              36. Rocket League
              37. The Expendabros
              38. The King Of Fighters XIII
              39. Max Payne 3
              40. Euro Truck Simulator 2
              41. DiRT 4
              42. Agents of Mayhem
              
              1 Reply Last reply Reply Quote 1
              • S
                Silent
                last edited by

                Also something I am not sure which was brought up in the past, but I think it is worth to broadcast a moonlight quit message on closing Moonlight emulator, so killing the session on pi also shuts it down on host.

                What I did was add this to runcommand_onend.sh:

                #!/bin/bash
                if [[ $2 == 'moonlight' ]] ; then
                	/opt/retropie/supplementary/moonlight/moonlight.sh quit
                fi
                

                Also, Moonlight works great as a PS2 "emulator" too, by streaming PCSX2 games from the PC =) GeForce Experience preserves shortcut arguments for shortcuts you add, so it's just a matter of preparing proper ones for PCSX2 games and adding them.

                H 1 Reply Last reply Reply Quote 1
                • H
                  hhromic @Silent
                  last edited by hhromic

                  @Silent yes I'm very aware of that "issue" and it was briefly mentioned before. This happens to me as well and I understand how annoying it can be, specially when you stream the "desktop" and the computer is left with the audio unrestored. I have seen this reported multiple times in multiple places, so it is not an isolated case.

                  The "problem" is that when you quit the streaming session, Moonlight simply terminates without any further network messaging. Then, the GFE server on the remote computer never realises that the client vanished. That's why when you send a formal "quit" message (like you do in your "onend" script) it quits gracefully.

                  In my honest opinion this is an issue that GFE should address because it should be the responsability of the server to cleanup the session if the client dissappears. This can happen on network disruptions or any other cases too. However I don't really expect NVIDIA to change anything.

                  I've been working on a native solution since some time (I don't have much time nowadays so testing is going slow for me). My solution is implementing a new key combo to send a "quit" request to the server (like you do on your solution) from inside the streaming session but do not quit immediately. Once the server gracefully terminates the session on its side, Moonlight receives the termination packe tand simply quits itself cleanly too. This is the way it should work.

                  While the solution you post using the "onend" script in runcommand works (and is not a bad temporary fix), I don't think is the proper solution because a race condition is created between terminating the session and sending the quit request. I prefer to do it natively the other way around for robustness.

                  Currently I have it implemented, compiled and working on my system but I want to clean it a bit more before publishing here for wider testing. Let me know if you are interested on testing, that would speed-up things a lot on the development side! I intend to send this to upstream so it's official.

                  Thanks for the patience, and be sure I am definitively working on a solution.

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Silent @hhromic
                    last edited by

                    @hhromic said in moonlight: request for comments and testing:

                    Currently I have it implemented, compiled and working on my system but I want to clean it a bit more before publishing here for wider testing. Let me know if you are interested on testing, that would speed-up things a lot on the development side! I intend to send this to upstream so it's official.

                    Of course! I stream plenty of games to my pi, so I'd definitely be able to help with testing.

                    Also, you are right about this 'race condition' - however I'm yet to experience any issues from that.

                    H 1 Reply Last reply Reply Quote 1
                    • H
                      hhromic @Silent
                      last edited by hhromic

                      @Silent, @seriously24
                      I have a solution for the quit issue ready for testing now :)
                      Initially I was crafting a more complicated solution but recently I had an epiphany and turned out to be very simple to implement after all.

                      It works like this: I added an option for automatically sending a remote app quit request when you quit the session with the same quit keys combo. This option is activated by default. So you won't need to change any config for it to take effect.

                      If you want to disable it and return to the old behaviour (quitting the streaming session does nothing to the server) you can simply use a new -noquitappafter cli option or quitappafter config file option.

                      To test the new option/functionality, you need to edit the scriptmodules/supplementary/moonlight.sh file and replace the line:

                      gitPullOrClone "$md_build" https://github.com/irtimmer/moonlight-embedded.git
                      

                      With this one:

                      gitPullOrClone "$md_build" https://github.com/hhromic/moonlight-embedded.git add-quit-app-after
                      

                      Then just re-compile/re-install Moonlight using the scriptmodule and you should get the improved binary ready to go. To verify you are using the new binary, just run:

                      /opt/retropie/supplementary/moonlight/moonlight.sh help
                      

                      And check that there is this line in the help:

                      -noquitappafter         Do not quit remote app after quitting session
                      

                      I would really appreciate if you can test this patch and report back if all works as expected: when you quit the session in Moonlight, the remote computer should go back to normal gracefully.
                      Don't forget to disable any script in runcommand-onend that sends the quit request externally. This patch makes that obsolete.

                      If all goes well, I will be sending this patch upstream so it's officially added to Moonlight.

                      Thanks for testing!

                      1 Reply Last reply Reply Quote 0
                      • H
                        hhromic
                        last edited by

                        Update

                        Ref: @Silent @seriously24 (all)

                        I tested now the "quit app after" option and is working very nicely. When activated, when I quit the streaming session using the exit combo, GFE on the remote server gracefully restores the audio/video settings to normal.

                        For example, I can start a YouTube video on the computer, launch Moonlight and stream the Desktop, audio and video are now forwarded to my TV, then I can quit the streaming session and audio/video are back on the computer without any interruption nor intervention. Keyboard/mouse is also properly restored.

                        However I did a small change compared to what I wrote in the above post. The option is now disabled by default (to keep the current behaviour) and needs to be enabled explicitly in the config file or command line. I modified the Moonlight scriptmodule to enable it by default automatically on the global config file. You can add it yourselves too, the option is quitappafter = true.

                        I just sent a PR upstream and hopefully this enhancement will be integrated officially in Moonlight and you can start using it. Will keep you updated.

                        1 Reply Last reply Reply Quote 0
                        • H
                          hhromic
                          last edited by

                          Update

                          The "quit app after" feature is now merged upstream in Moonlight :)
                          I updated the experimental scriptmodule to add quitappafter = true by default to the global.conf config file on new installs. This is an option many will want by default.

                          Thanks all for the testing and feedback, I still have some good ideas from you to implement into the scriptmodule, just looking for some time to do them.
                          Hopefully soon the scriptmodule is mature enough to include in RetroPie \o/

                          1 Reply Last reply Reply Quote 1
                          • S
                            Silent
                            last edited by

                            Cool stuff! I'll give it a try later today :)

                            1 Reply Last reply Reply Quote 1
                            • S
                              seriously24
                              last edited by

                              @hhromic Yup, sorry I couldn't test it before your PR intoMoonlight, but I sure will test it asap and provide you a feedback if I see anything.

                              Thanks a lot for your work !

                              1 Reply Last reply Reply Quote 1
                              • S
                                Silent
                                last edited by

                                So I quickly gave the newest version a try and there's nothing to complain about, everything works as expected :D

                                Looking forward to seeing quitappafter an option in Configuration screen, too.

                                H 1 Reply Last reply Reply Quote 1
                                • H
                                  hhromic @Silent
                                  last edited by hhromic

                                  @seriously24 thanks for the support, hope all works for you.
                                  @Silent glad to read! let me know of any issues.
                                  happy streaming!

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    Silent
                                    last edited by

                                    Now the only outstanding issue is : character being present in generated filenames and Windows not liking that :)

                                    H 1 Reply Last reply Reply Quote 1
                                    • H
                                      hhromic @Silent
                                      last edited by hhromic

                                      @Silent yes I have that written down on my TODO list :)

                                      I've been thinking on the idea of having an option to slugify the filenames when autogenerating the game configs for these users that can't use the full names. I already have a prototype bash function to do this, and this is how your list of games would look like using it:

                                      Spintires MudRunner ==> spintires-mudrunner.ml
                                      Run PCSX2 ==> run-pcsx2.ml
                                      Grand Theft Auto Vice City Stories PS2 ==> grand-theft-auto-vice-city-stories-ps2.ml
                                      Grand Theft Auto Vice City PS2 ==> grand-theft-auto-vice-city-ps2.ml
                                      Grand Theft Auto San Andreas PS2 ==> grand-theft-auto-san-andreas-ps2.ml
                                      Grand Theft Auto Liberty City Stories PS2 ==> grand-theft-auto-liberty-city-stories-ps2.ml
                                      Gran Turismo 4 ==> gran-turismo-4.ml
                                      Crash Bandicoot N. Sane Trilogy ==> crash-bandicoot-n-sane-trilogy.ml
                                      BattleBlock Theater ==> battleblock-theater.ml
                                      American Truck Simulator ==> american-truck-simulator.ml
                                      Worms W.M.D ==> worms-w-m-d.ml
                                      Portal 2 ==> portal-2.ml
                                      GRID 2 ==> grid-2.ml
                                      Steam ==> steam.ml
                                      Grand Theft Auto V ==> grand-theft-auto-v.ml
                                      Fallout 4 ==> fallout-4.ml
                                      Sid Meier's Civilization V (DX 11) ==> sid-meier-s-civilization-v-dx-11.ml
                                      GRID ==> grid.ml
                                      Driver San Francisco ==> driver-san-francisco.ml
                                      DiRT Showdown ==> dirt-showdown.ml
                                      Left 4 Dead 2 ==> left-4-dead-2.ml
                                      Saints Row: The Third (DX 11) ==> saints-row-the-third-dx-11.ml
                                      Saints Row IV (DX 11) ==> saints-row-iv-dx-11.ml
                                      Deus Ex: Human Revolution ==> deus-ex-human-revolution.ml
                                      Hitman™ ==> hitman-tm.ml
                                      Double Dragon Neon ==> double-dragon-neon.ml
                                      DiRT 3 Complete Edition ==> dirt-3-complete-edition.ml
                                      Hitman 2 ==> hitman-2.ml
                                      Hotline Miami 2: Wrong Number ==> hotline-miami-2-wrong-number.ml
                                      Mafia III ==> mafia-iii.ml
                                      Overcooked ==> overcooked.ml
                                      Broforce ==> broforce.ml
                                      DiRT Rally ==> dirt-rally.ml
                                      L.A. Noire ==> l-a-noire.ml
                                      I am Bread ==> i-am-bread.ml
                                      Rocket League ==> rocket-league.ml
                                      The Expendabros ==> the-expendabros.ml
                                      The King Of Fighters XIII ==> the-king-of-fighters-xiii.ml
                                      Max Payne 3 ==> max-payne-3.ml
                                      Euro Truck Simulator 2 ==> euro-truck-simulator-2.ml
                                      DiRT 4 ==> dirt-4.ml
                                      Agents of Mayhem ==> agents-of-mayhem.ml
                                      

                                      Note how things like the trademark symbol are transliterated to the string tm. This approach has the benefit of using only characters that are valid almost everywhere, including network shares and Windows filesystems. It also has the benefit of being scraper-friendly. I searched most of the slugified versions of your games in TheGameDB for example and almost everything is found successfully.

                                      What do you think?

                                      Edit: here is another list of games from another user:

                                      Walking Dead ==> walking-dead.ml
                                      Stardew Valley ==> stardew-valley.ml
                                      Sonic and All-Stars Racing Transformed ==> sonic-and-all-stars-racing-transformed.ml
                                      The Elder Scrolls V: Skyrim ==> the-elder-scrolls-v-skyrim.ml
                                      Broforce ==> broforce.ml
                                      Crawl ==> crawl.ml
                                      Steam ==> steam.ml
                                      Hotline Miami 2: Wrong Number ==> hotline-miami-2-wrong-number.ml
                                      Trine 2 ==> trine-2.ml
                                      Terraria ==> terraria.ml
                                      Lara Croft and the Guardian of Light ==> lara-croft-and-the-guardian-of-light.ml
                                      Rogue Legacy ==> rogue-legacy.ml
                                      Metro: Last Light ==> metro-last-light.ml
                                      Soma ==> soma.ml
                                      Steam ==> steam.ml
                                      Warframe ==> warframe.ml
                                      Prey ==> prey.ml
                                      Helldivers ==> helldivers.ml
                                      Resident Evil HD REMASTER ==> resident-evil-hd-remaster.ml
                                      Dishonored ==> dishonored.ml
                                      Minecraft ==> minecraft.ml
                                      Renegade Ops ==> renegade-ops.ml
                                      Day of the Tentacle Remastered ==> day-of-the-tentacle-remastered.ml
                                      Metro: Last Light ==> metro-last-light.ml
                                      Dark Souls ==> dark-souls.ml
                                      Rayman Legends ==> rayman-legends.ml
                                      DuckTales: Remastered ==> ducktales-remastered.ml
                                      Overcooked ==> overcooked.ml
                                      The Witness ==> the-witness.ml
                                      The Expendabros ==> the-expendabros.ml
                                      7 Days to Die ==> 7-days-to-die.ml
                                      
                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        Silent @hhromic
                                        last edited by

                                        @hhromic said in moonlight: request for comments and testing:

                                        I searched most of the slugified versions of your games in TheGameDB for example and almost everything is found successfully.

                                        If that's the case, then it's fine I guess! What about IGDB and Mobygames? Those are the most likely to be used with PC games.

                                        Also PSA - with a few custom apps added to GFE and moonlight added as a ps2 "emulator" I'm successfully using PCSX2 over moonlight as a PS2 "emulator" :D Thankfully Gamestream allows specifying commandline arguments to shortcuts it's executing, so it's possible to just add multiple PCSX2 shortcuts with different parameters!

                                        I only need to hook up PowerShell's Restart-Service to those shortcuts as my PS3 controller driver on PC doesn't handle disconnecting gracefully.

                                        H 1 Reply Last reply Reply Quote 1
                                        • H
                                          hhromic @Silent
                                          last edited by

                                          @Silent said in moonlight: request for comments and testing:

                                          If that's the case, then it's fine I guess! What about IGDB and Mobygames? Those are the most likely to be used with PC games.

                                          You can give them a try on their websites search engine. I don't have much time nowadays, hence the delay implementing these things :( If you can confirm these other databases also handle slugified names properly, then I guess this is a solid idea. I don't think they would have any issues as dashes are most of the times ignored by text-based search engines. Beware that these scrapers that rely on checksums, will never work as the ml files never will have the correct checksum as the game they launch.

                                          @Silent said in moonlight: request for comments and testing:

                                          Also PSA - with a few custom apps added to GFE and moonlight added as a ps2 "emulator" I'm successfully using PCSX2 over moonlight as a PS2 "emulator" :D Thankfully Gamestream allows specifying commandline arguments to shortcuts it's executing, so it's possible to just add multiple PCSX2 shortcuts with different parameters!

                                          that sounds great! I'm trying to do sometihng similar with CEMU for the WiiU, however in recent versions CEMU is not working with Moonlight in full screen (all I get is a black screen). I have yet to investigate what's going on, seems to be an OpenGL issue with GFE/Nvidia drivers, not Moonlight itself. DirectX games work fine (e.g. Dolphin for Gamecube/Wii games).

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            MightyHandy
                                            last edited by

                                            This is super minor. But, are the uninstall instructions correct with respect to the config directory? Are the config settings in ‘config/all/moonlight’ not ‘config/moonlight’?

                                            H 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.