Jump to content
LaunchBox Community Forums

Bypass Rom path verification before launch


Recommended Posts

So, i guess this is for really niche use case and the way i manage to do that is ... well, it works....

So, my point is to get rid of this message and launch the emulator command even if the rom is not there :
image.png

You don't have this verification if your emulator name have "Mame" in his name, so it just rename your emulator to MAMEFAKE-emulator name just before launching the game and restore it after.

I'm too lazy to make a github for few lines of code, so here is the source code

	internal class GameLaunchingPlugin : IGameLaunchingPlugin
	{

		public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator)
		{
			if (!File.Exists(game.ApplicationPath) && emulator.Title.StartsWith("MAME") == false)
			{
				emulator.Title = "MAMEFAKE-" + emulator.Title;
			}
			return;
		}

		public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulator emulator)
		{
			string prefixToRemove = "MAMEFAKE-";
			if (emulator.Title.StartsWith("MAMEFAKE-"))
			{
				emulator.Title = emulator.Title.Substring(prefixToRemove.Length);
			}
			return;
		}

		public void OnGameExited()
		{
			return;
		}
	}

BypassFileExistCheck.dll

Link to comment
Share on other sites

Nice find. Nice solution. Very creative! :) 

But can you elaborate on why you would even want to launch an emulator if the ROM file doesn't even exist?  (Future readers want to know ;))

 

Side note:

Since the emulators Title only needs to contain "mame" to skip the 'does ROM file exist' check, I might suggest just checking for that.  This would save on some unnecessary operations.  i.e., if the emulators Title is "Mame" or "MameUI" or "Test emu MAME", there's no need to rename it.

It's a minor thing and the way it's written, realistically has very little impact behind-the-scenes.  But in the grand scheme of things, every little bit helps. ;) 

public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator)
{
    if (!File.Exists(game.ApplicationPath) && !emulator.Title.Contains("mame", StringComparison.InvariantCultureIgnoreCase))
    {
       emulator.Title = $"MAMEFAKE-{emulator.Title}";
    }
    //return;
}

 

 

Link to comment
Share on other sites

On 6/2/2023 at 2:40 PM, JoeViking245 said:

Nice find. Nice solution. Very creative! :) 

But can you elaborate on why you would even want to launch an emulator if the ROM file doesn't even exist?  (Future readers want to know ;)

 

I have an use case with my other tool here https://forums.launchbox-app.com/topic/72127-bigbox-profile-if-you-use-bigbox-on-both-your-pc-monitor-and-your-tv-screen-you-probably-need-this/

Basically, it act as a middle man beetween launchbox and the emulator. So even if launchbox execute retroarch.exe D:/roms/myrom.bin, the real command that retroarch receive could be \\MyNas\myrom.bin if i currently don't have the file on my harddrive.

To give a complete exemple : (and i just saw a bug i have to correct for my next rlz)

image.thumb.png.a8c75dd72fa871b857814bf704dfc1ba.png

If the rom was on C:\FavoriteRoms, it would have use it regardless if it's on D drive or not, but it's not here (usefull if you want a game to run from quicker SSD instead of HDD)

For my test, i renamed my directory dreamcast on my D:\ drive so it does not find the rom, so it look for the low priority paths.
My Nas is offline, so no match here.
He found a match on my google drive mounted drive, modify the command to change the path and process to the next module (CopyFile)
And for my google drive, since it's too slow to launch game from there, i use the CopyFile module (not yet rlz), that copy the game to a local drive E:\cache and change the command line to execute it from here.

(And yes, my CopyFile module have an ugly UI, but it's not finished)

Edited by Nixx
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

This is incredibly close to my use case, and I am trying to get something like this up and running. 

I have a server that all the ROMs are stored on, with a copy of LaunchBox installed on it.  This is my master copy that is set up to be completely portable.  I also store all the media on the server, so none of it is in the LaunchBox installation, keeping its size to a minimum.  I then copy the LaunchBox folder to another machine, mount the drive containing the ROMS and the media, and when you try to launch a game I have a batch file that checks if there is a local copy of the ROM.  It copies it to the local machine if there is not, then launches it from there.  Essentially, it "installs" the ROM to a local folder before trying to launch the emulator.  It works, but it's clunky, and requires the batch file to be the emulator associated with the ROM instead of the emulator itself, causing other issues. I also have to create a new batch file for each emulator as launch commands are different for each one.

What I would like is for there to be a "middle-man" plugin that handles the copying automatically, with a progress window, then changing the ROM path for the launch command to the local copy.  This would mean any AHK scripting for the emulator would still work, something that is essential for some standalone emulators, storage requirements on the local machine are kept to a minimum, while still giving access to the full library. 

I tried playing with the DLL you posted but couldn't figure out how to get it to work, LaunchBox didn't give me any indication it was even there as a plugin, so I imagine I'm not doing it right.  Can you go over the installation and setup of this for a noob like me?

Also, you appear to be my spirit animal, as your BigBoxProfile project is another thing I was going to try to figure out.  With my use case above, it would be awesome if each machine LaunchBox is copied to can leverage a profile system so the user can customize how their setup looks and works.  When they update the installation from the master copy on the server, it would still maintain those settings.  If it also was able to maintain the user's save games on the server separate to other user's saves, my setup would be complete.

Edited by LongElf
Link to comment
Share on other sites

The plugin itself is really straighfoward, Let says you have a rom registered as D:/rom/myrom.bin, and launchbox is set to launch emulator.exe "D:/rom/myrom.bin", if the rom is missing, Launchbox will not execute the command line. With this plugin, it will.
But that mean it will execute emulator.exe "D:/rom/myrom.bin" and the emulator will complain that the rom is missing, that's where BigBox Profile come to play. The plugin itself will just bypass the file verification that prevent to launch the emulator if the file is missing, nothing more.

And for bigboxprofile, there is two modules that will be handy

ChangeRomPath that will change missing rom the rom path to an other one

Lfd2taMl1WDhUy-v9azTJi-RyzQWZYpbRecYXPvhU9wGP9EnzASqfylbxNJfESd8qmgbxRzJ6cTxPLQY02yPJfx0or8Ea8N3sX9gamQMKkkDY-KTQqOIx6LuNOCisUS-k9ekxiJko5_PsPU5lOUvpdA

and CopyFile that will copy a remote file to local.
tGhy1CCk2vYwPCclVEKgzw5l0v75TlwO38D5uRNI0geBPZQ9t8wmdZ0gAoLHCUkNco1wP19lGhi7Mj3z1kGw0AYAuG8zDoFw9mnqoLI_GXdDmDp_sLCU0r-67WAeFds4V7S3_kt6V60lx6V4Wm9sVKs

 

So, let's say you have on your main computer launchbox install a rom registered as D:\roms\N64\SuperMario64.bin and D:\rom is also shared as \\MainComputer\roms
You have a copy of the install on Computer2, you can install bigboxprofile and register for retroarch.exe a ChangeRomPathModule from D:\roms\ to  \\MainComputer\roms. That way, with this plugin installed, launchbox will not complain that D:\roms\N64\SuperMario64.bin is missing, it will execute retroarch.exe D:\roms\N64\SuperMario64.bin but that will be changed by bigboxprofile and retroarch \\MainComputer\roms\N64\SuperMario64.bin will be executed instead.

Now let's says it's D:\roms\switch\Zelda.bin and it's too big to be played over network, and you want to copy it first to local.
You use two module, first changeRomPath from D:\roms\switch\Zelda.bin to \\MainComputer\roms\switch\Zelda.bin
Then the copyFile module with source \\MainComputer\roms\switch\ and target let says C:\roms
And upon execution of retroarch.exe D:\roms\switch\Zelda.bin from launchbox it will copy \\MainComputer\roms\switch\Zelda.bin to C:\roms\Zelda.bin and execute retroarch.exe C:\roms\Zelda.bin

As for using multiple profile, it's also something that bigbox profile do, but there is no gui for that and it's a little tricky. You have to create a profile in your secondary computer bigboxprofile, let says "secondary", create a directory inside launchbox LaunchBox\Data\Profile_secondary, then you will put inside the xml that you want to change from your usual profile, for exemple Settings.xml. And if you execute bigbox or launchbox with that profile (bigbox.exe --profile=secondary) it will use those file (and use the regular one for the rest). If you create LaunchBox\Data\Profile_secondary\Platforms (or Playlists) it will totally ignore LaunchBox\Data\Platforms and use LaunchBox\Data\Profile_secondary\Platforms instead.

Edited by Nixx
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...