Author Topic: Passing arguments from layout code to emulator (from AM,not fe.plugin_command)  (Read 6298 times)

farique

  • Full Member
  • ***
  • Posts: 28
    • View Profile
Hi.
Is there a way to pass arguments directly from the layout Squirrel code to the emulator on Windows?
I am not talking about calling an emulator with args from code (like with fe.plugin_command) but to pass arguments to the emulator being called from Attract Mode itself.

I thought it would be a common need but I could find nothing here nor on the documentation.

The problem is my front end has "Alternate" modes for the Virtual boy (to call the emulator with or without the anaglyph mode) and for the Vectrex (to call games with or without the overlays) and the way it is working now is whenever I press the key to change the mode (the layout changes to indicate which mode it is in) I rename a file accordingly. Then, when I run a game, an AHK script checks the file and according to its name calls the emulator with the appropriate settings.

It works but is far from neat and elegant and may cause problems in the future (apart from having to change the code on the layout and both AHK script whenever the path changes).

Preemptive thanks!

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Couldn’t you just create two different emulator configs?

farique

  • Full Member
  • ***
  • Posts: 28
    • View Profile
That is actually a good idea, keilmillerjr!

Would, maybe, be a little overkill on my current layout/support apps setup but surely deserves a thought.

Still curious about passing arguments, tho. Seems to be an useful feature.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
That is actually a good idea, keilmillerjr!

Would, maybe, be a little overkill on my current layout/support apps setup but surely deserves a thought.

Still curious about passing arguments, tho. Seems to be an useful feature.

Here’s what I do, just as an example:

Emulators
  mame
  neogeo (mame with unibios command line)
Displays
  Arcade (mame emulator with nofiller tag list)
  NeoGeo (neogeo emulator with neogeo tag list)
  Vs Unisystem (mame emulator with vs tag list)

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
Hi,

There isn't currently a way to pass arguments directly from the layout code to the emulator and yes I can see this being a limitation on more complicated setups.

There is a transition that layouts can use both before and after a game is launched, to configure things for their emulator (see the ultrastik plugin as an example).  You can also use the Edit Game feature to edit an entry on the romlist to specify a custom executable and command line arguments for that entry.  There is also the multi-emulator config approach keilmillerjr suggested.


raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
You know what, I think it would be pretty straight forward to extend the "magic token" support for calling a squirrel function into the emulator argument processing as well, so you would be able to call into a script to get it. I'll look into this further.

farique

  • Full Member
  • ***
  • Posts: 28
    • View Profile
Thank you, keilmillerjr and raygun for the ideas. If I ever decide to publish my frontend I will sure adopt one of these approaches.

I already have 9 emulators with 2 alternates using a single, very adaptive, layout. Although there are some advantages to the keilmillerjr method, the apps I made to manage my setup are very dependent on the romlists and a duplicate emulator would complicate things a bit so I'll stick to the file approach for now. Will look into the ultrastick method, tho.

And I look forward to developments on your idea, raygun!

ps. This is my layout. The screens might seems similar but everything changes from one to another, from the font to the spacing and the way they display the overviews, for instance. (the two screens on the right are the alternate VB and Vectrex)