Jump to content
LaunchBox Community Forums

Recommended Posts

While playing around with RetroArch 1.60 at work today, i threw this plugin together to quickly launch netplay sessions.

It works great in lan but i haven't tested it via WAN... you'll probably need a good connection for it to work decently over wan for now.

I haven't added the framesettings etc. yet, it's as simple as can be.

If you want to test it, make sure that the host and client both use the same core in retroarch and EXACTLY the same rom, retroarch will say nope otherwise :)

Here's a short video of me testing it locally with mk2(pool fatality, pit fatality, fatality!) f yeah :D :

If there's any interest i'll update this with more features and saving of the nickname etc.

LBP_SimpleRetroarchMultiplayer.dll

  • Like 5
Link to comment
Share on other sites

  • 5 months later...
  • 4 weeks later...
  • 2 months later...

@Izegod I somehow missed this thread but just stumbled on your video here: 

This is exactly what I was looking to do to integrate Retroarch Netplay, awesome job! The only pain point I can foresee is that supposedly Retroarch requires the ROM files to be scanned in for it to work. Is that your observation as well?

Also, would you be willing to share your source code with me to help me get it integrated faster? I would be looking to basically implement it exactly as you have done it, but with an interface that is more integrated into LaunchBox and Big Box. I'll certainly credit you for that code. :)

Link to comment
Share on other sites

@Jason Carr the roms checksum has to be same and it'll work... i've never scanned my roms with retroarch :)

I'll just paste the HORRIBLE class here:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unbroken.LaunchBox.Plugins;
using Unbroken.LaunchBox.Plugins.Data;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualBasic; //need this for the inputbox... obsolete with proper gui

//I apologize for this horrible code but maybe you can still use something from it :P

namespace LBP_SimpleRetroarchMultiplayer
{
    public class Class1 : IGameMenuItemPlugin
    {
        public string Caption
        {
            get
            {
                return "RetroArch Multiplayer";
            }
        }

        public System.Drawing.Image IconImage
        {
            get
            {
                return null;
            }
        }

        public bool ShowInBigBox
        {
            get
            {
                return true;
            }
        }

        public bool ShowInLaunchBox
        {
            get
            {
                return true;
            }
        }

        public bool SupportsMultipleGames
        {
            get
            {
                return false;
            }
        }

        public bool GetIsValidForGame(IGame selectedGame)
        {
            if (PluginHelper.DataManager.GetEmulatorById(selectedGame.EmulatorId).Title == "Retroarch") //emulator is retroarch? ok for netplay!
                return true;

            return false;
        }

        public bool GetIsValidForGames(IGame[] selectedGames)
        {
            return false;
        }

        public void OnSelected(IGame[] selectedGames)
        {
            return;
        }

        public void OnSelected(IGame selectedGame)
        {
            var emulator = PluginHelper.DataManager.GetEmulatorById(selectedGame.EmulatorId);
            var platform = PluginHelper.DataManager.GetPlatformByName(selectedGame.Platform);
            var emulatorPlatform = emulator.GetAllEmulatorPlatforms().ToList<IEmulatorPlatform>().Find(p => p.Platform == platform.Name);

            Process myArch = new Process();
            myArch.StartInfo.FileName = Path.GetFullPath(emulator.ApplicationPath); //retroarch doesn't like shortened paths so i use the GetFullPath function
            myArch.StartInfo.Arguments = emulatorPlatform.CommandLine + " " + '"' + Path.GetFullPath(selectedGame.ApplicationPath) + '"';
            myArch.StartInfo.WorkingDirectory = Path.GetDirectoryName(Path.GetFullPath(emulator.ApplicationPath)); //set working directory to retroarch.exe's dir

            var addCommand = "";

            if (MessageBox.Show("Do you want to host?" + Environment.NewLine + "If you choose no, you will connect as the client.", "Netplay setup", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                addCommand = addCommand + "-H "; //-H = Host
                addCommand = addCommand + "--nick " + Microsoft.VisualBasic.Interaction.InputBox("Please enter your nickname:","Multiplayer setup");
            }
            else
            {
                addCommand = addCommand + "-C " + Microsoft.VisualBasic.Interaction.InputBox("Please enter the Server IP or Hostname:", "Multiplayer setup"); //-C = Connect to server as client
                addCommand = addCommand + " --nick " + Microsoft.VisualBasic.Interaction.InputBox("Please enter your nickname", "Multiplayer setup");
            }

            
            myArch.StartInfo.Arguments = myArch.StartInfo.Arguments + " " + addCommand; //add our new command to the arguments
            myArch.Start(); //launch
        }
    }
}

Maybe you can still salvage something from it... it doesn't really do anything except start retroarch with parameters :D

I didn't develope this any further cause there wasn't much interest :(

  • Like 2
Link to comment
Share on other sites

If this can get implimented and working well with Launchbox, this would be huge!! Its my single most wanted feature at this point. I have noticed it the past when Netplay was redone last year, that you did have to have the roms scanned in RetroArch for it to work, and they needed to be used with the same core and same files, but if you and the other player have the same stuff, it did work pretty well. I haven't tried in a long long time as I was waiting for this. I really hope you guys can figure it out!

  • Like 1
Link to comment
Share on other sites

You only need to have the roms scanned in retroarch if you use the integrated serverbrowser of retroarch afaik... so it can join a sesssion properly by checking if you have the correct rom.

By starting it via commandline you directly tell it which rom to use... so no need to check it's own database :)

It's just important that both players use the EXACT same core (you have to set this up before!) and the EXACT same rom... if there is a crc missmatch during the handshake retroarch won't sync the games or abort the connection.

  • Like 2
Link to comment
Share on other sites

Alright, so I have this integrated in the latest beta:

 

@Izegod I forgot to put your name in the change log for this beta, but I have it in there for the next one. Thanks again for the plugin and the code. :)

I'm having a bit of trouble testing it, so if anyone can jump on testing it and let me know how it goes, I'd appreciate it. :)

  • Thanks 2
Link to comment
Share on other sites

On 2/5/2018 at 11:27 PM, Izegod said:

lol that was fast. i'll test it when im back from work later today :D

EDIT: meh... just startet lb @ work cause i wanted to test it:

rnetplaynew.thumb.jpg.de14515d44163780110e8b91bdc4cd55.jpgWorks great actually @Jason Carr :D

Looks like you are running two copies of Retroarch locally... correct? Or are you remoting in and running one instance locally and the other remotely? Because I can't get it to work from outside the network yet. 

I'm having some weird slowdown issues though running Netplay. Contra on NES for instance runs fine just loading up the game without netplay, but with netplay enabled, it runs a bit slower and has choppy audio. 

Edited by TheMadMan007
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...