Jump to content
LaunchBox Community Forums

Get Currently Running Game?


Recommended Posts

E.g., when implementing the ISystemEventsPlugin.OnEventRaised method and handling SystemEventTypes.GameStarting:

...is there a way to get the currently running game? I currently do this: PluginHelper.StateManager.GetAllSelectedGames()[0], and while it works fine when the plugin is used in BigBox it does not work reliably within LaunchBox. It'd be great if there was a method in PluginHelper to get the currently running game as an IGame.

@Jason Carr: Pardon me if this was already mentioned in the past and I overlooked it on the forums.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 11/5/2018 at 9:10 PM, eatkinola said:

PluginHelper.StateManager.GetAllSelectedGames()[0], and while it works fine when the plugin is used in BigBox

Thanks for adding that to your list, @Jason Carr. Just noted for BB I also run into a problem with the GetAllSelectedGames() kluge when the game details screen is skipped. So a way to get the currently running IGame would help with both LB and BB plugin development.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
On 11/6/2018 at 10:32 AM, Jason Carr said:

Good to know. I don't believe that exists yet, but I'll add that to my list. :)

Hey @Jason Carr. Is this (getting the currently running game) something you might incorporate in the plugin API when working on the game loading screens? I suppose this is complicated by the fact multiple games can be launched by Alt-tabbing back to BB then hitting play game again, so there is no guarantee of a single running game. From the game details screen, you can actually hit enter rapidly in succession and get the game to load multiple times. Ah, the things we do when testing. Surely someone would've done that in the real world, anyway. O.o

On a related note, an ISystemEventPlugin's method gets invoked with a GameStarting event type even when the game load fails, e.g., "the specified rom is not found".  I can make a workaround for this but my workaround is a bit klugey and I'm sure does not capture all cases; the logic you use is certainly more comprehensive. Would it be possible to only fire a GameStarting event if it first passes muster in your BB code?

P.s. Thanks for working on the load screens by the way; will be nice to have that a core feature of BB. I'll hopefully post my windowed version for download later this week, once I work out a few more wrinkles. I learned a bit more about C#, p/invoke, and low-level input stuff when working on it; was kinda fun.

  • Like 1
Link to comment
Share on other sites

12 minutes ago, eatkinola said:

Hey @Jason Carr. Is this (getting the currently running game) something you might incorporate in the plugin API when working on the game loading screens?

Yes, I'll look to tackle this at this time. The play game stuff will need restructured somewhat for the plugins anyways, because currently the existing methods won't use the startup screens at all.

13 minutes ago, eatkinola said:

From the game details screen, you can actually hit enter rapidly in succession and get the game to load multiple times. Ah, the things we do when testing. Surely someone would've done that in the real world, anyway. O.o

This has been a major thorn in my side. It seems that Windows will actually change the window focus strategy if you're pressing keys while the game is loading. I still have to come up with a solution for this before the official release. I want to make sure that no matter what you do, you can't start multiple copies or mess up the active window by just spamming keys. The latter is the difficult part.

16 minutes ago, eatkinola said:

On a related note, an ISystemEventPlugin's method gets invoked with a GameStarting event type even when the game load fails, e.g., "the specified rom is not found".  I can make a workaround for this but my workaround is a bit klugey and I'm sure does not capture all cases; the logic you use is certainly more comprehensive. Would it be possible to only fire a GameStarting event if it first passes muster in your BB code?

I'll review this and see what I can do to improve it.

16 minutes ago, eatkinola said:

P.s. Thanks for working on the load screens by the way; will be nice to have that a core feature of BB. I'll hopefully post my windowed version for download later this week, once I work out a few more wrinkles. I learned a bit more about C#, p/invoke, and low-level input stuff when working on it; was kinda fun.

I am looking forward to seeing it. Especially since I'm learning how much of a challenge all of this is lol. ;)

  • Like 1
Link to comment
Share on other sites

1 hour ago, Jason Carr said:

Hey all, already called you guys out over there, but just updating this topic to say that I *think* I've fulfilled all of these requests with 9.2-beta-3

Yep, the new API features fix most of these issues very nicely. You can still spam the play game menu item, but I just ignore extra invocations in my plugin so it's no big deal from my perspective. Thanks so much for implementing these features.

  • Like 1
Link to comment
Share on other sites

1 hour ago, eatkinola said:

Yep, the new API features fix most of these issues very nicely. You can still spam the play game menu item, but I just ignore extra invocations in my plugin so it's no big deal from my perspective. Thanks so much for implementing these features.

Yeah, a fix for that is still coming before the official release.

Link to comment
Share on other sites

  • 1 month later...

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...