Jump to content
LaunchBox Community Forums
Sign in to follow this  
ClassicGMR

Big Box Windows Focus issue

Recommended Posts

Hi! New to the forums and to LaunchBox. I purchased a subscription based on what I saw from videos online (Thanks ETA!) and I like what I see.

Now I am not new to emulation at ALL. Everything I run works fine in Windows 10, GameEx and EmulationStation. Emulators are not the problem.

I also know how to search but looking at the forum search for "focus" see a decent amount of recent topics based on Big Box not regaining focus in Windows. People have noted they have to click into it or ALT+TAB to regain focus. Trouble is most of the topics posted have zero replies. So here's my $0.02:

 - I like what I see and I want this to work. But it doesn't. ☹️

 - This is a brand new install as of 3 days ago so I am running the newest version. My registration file is in the directory and I see my name in the upper right corner of LaunchBox so no issue there.

 - I am running Windows 10 64-bit on an HP EliteBook 2760p with 8GB RAM and an i7 2.8GHz processor. As stated I run GameEx and EmulationStation on this system with zero issues.

 - When I launch a game from Big Box and return Big Box is "frozen" because it doesn't have focus. I have to click the mouse or ALT+TAB to get functionality back. I have Stella running Atari 2600 and Mednafen for Atari Lynx. Both emulators run fine and when I press ESC they exit to a "stuck" Big Box. I haven't tested anything else yet until I figure this out.

Is someone looking into this? It seems to be a known issue but I haven't seen anything that says "Here is the fix" so sorry if I missed it. If there is one point me to it and I'll give it a go! Thank you!

Share this post


Link to post
Share on other sites

Yes, the focus loss has been reported, but has been hard to nail down the issue and it for now seems to affect a small amount of users. Jason does look into reported issues like this. 

In those threads your search found there were several solutions that have worked for some. Did you try any of them? One recommendation is to turn off Startup themes globally or just for the affected emulator and test. Another was to check the "Hide all windows that are not in exclusive fullscreen" for that emulator.

Share this post


Link to post
Share on other sites
4 hours ago, Retro808 said:

Yes, the focus loss has been reported, but has been hard to nail down the issue and it for now seems to affect a small amount of users. Jason does look into reported issues like this. 

In those threads your search found there were several solutions that have worked for some. Did you try any of them? One recommendation is to turn off Startup themes globally or just for the affected emulator and test. Another was to check the "Hide all windows that are not in exclusive fullscreen" for that emulator.

Yes I did try the "Hide all windows" checkbox. I also tried the downloads listed here and here. I saw some modded code in this post but wasn't sure what to do with it so I admit I didn't try that.

EDIT: I realized the "modded code" was for the ahk file jayjay posted so I tried them all. Nothing changed unfortunately.

Edited by ClassicGMR
Tried some more troubleshooting

Share this post


Link to post
Share on other sites
8 hours ago, ClassicGMR said:

I have to click the mouse

 

Its not a pretty solution by any means but we could try simulating a mouse click on game exit. If this dont work, it'll be the last time I comment on a "focus" issue thread.

Turn on start up and shut down screens.

focus.zip

Download that.

Right click on the zip, properties, unblock.

Extract it.

Put the .dll in Launchbox/Plugins.

 

There is 2 .ahk files in the zip.

The first one, RegainFocus.ahk, is just a test to make sure that the .dll is finding and launching the ahk script correctly. So put RegainFocus.ahk in Launchbox/Autohotkey.

Open BigBox, Start a game that has the focus issue, Exit the game... dont press any buttons and wait for 10 seconds. Does a messagebox with the word "hello" pop up.

 

If yes.

Delete RegainFocus.ahk.

Rename RegainFocus2.ahk to RegainFocus.ahk and put it in Launchbox/Autohotkey.

Open BigBox, Start a game that has the focus issue, Exit the game... dont press any buttons and wait for 10 seconds. Make it a slow 10 seconds. Then try moving in bigbox to see if it active.

 

If yes...

Open (the newly named) RegainFocus.ahk with notepad. Where it says "Sleep, 8000", (sleep, 8000 means wait 8 seconds, 1000 = 1 second). So now you have to try to change this to get the timing right. From when the game exits, then for the "gameover" screen to disappear and then you want to send your mouse click.

 

if none of it works. Then i give up. 

Edited by jayjay
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

So this seems to work! I have opened about a dozen Lynx and 2600 games - alternating between the two platforms - and every time focus has returned to Big Box after a few seconds. I'm going to add a few more platforms and I will update again later but this seems to do the trick! :)

Thank you @jayjay!

EDIT: I added TG-16 and NeoGeo Pocket Color to Big Box and it's working fine. Watching this execute in LaunchBox it seems you pushed the cursor to the Search box and started a search? Very slick. :)

EDIT2: Final update - I have added roughly 9 more systems to Big Box so far and this works every time. Thank you! :)

Edited by ClassicGMR
Additional Information
  • Like 1

Share this post


Link to post
Share on other sites
16 hours ago, ClassicGMR said:

Watching this execute in LaunchBox it seems you pushed the cursor to the Search box and started a search? Very slick. :)

Haha. It was just random coordinates. You can change the coordinates by opening the .ahk in notepad and changing the 100, 100 line.  

Glad its working ok for you.

Each time a new LB update comes out, you should try removing the .dll and see if the focus issue disappears. Some times these things fix themselves.

  • Like 1

Share this post


Link to post
Share on other sites

@jayjay I have a few questions for ya about this myself if you dont mind/when you have time.

I have been killing myself trying to track down the root of this behavior, and while I wasnt able to make any headway after someodd days of testing, this seemingly has me part way there.

So in short, this pertains to the shutdown screens.   Theyve been a nightmare.   In launchbox all is well.   In bigbox, I stream and initially thought that steam or the streaming capture process was the root of the issue.  Turns out it happens from bigbox at the pc as well. 

I close a game via my button combo and Im left with a black screen.   Once in awhile, at seemingly random, my shutdown screen will trigger - but its in super slow motion.  Takes about 30 seconds before I can see bigbox again and its useable.

Turns out, after watching the taskbar on my 2nd monitor it seems to be a focus issue.  When the screen is black I can click on it, and immediately get my shutdown screen.   This seems to happen due to using my 2nd display for things like walkthroughs and discord intermittently while playing etc.   After closing the game, somehow focus seems to often shift over to chrome /boggle.  

This still doesnt explain why it happens when streaming/playing remotely via steam big picture mode - but its plagued me long enough that at this point i want to move past it.  if that means workaround as opposed to root of the issue - so be it.   Its certainly newer, as when i began using Bigbox it wasnt a thing but i digress.

I figured up your dll and noticed i still got the dead black screen, however after ~8-10 seconds, I got the shutdown screen.   So i modified the sleep timer in the ahk script and it began giving me the shutdown screen at such a time that the sleep timer went off.   great!

problem is, focus is lost again after that.

So after my novel - what im really asking is, any way I can make this regain focus a second time? 

Share this post


Link to post
Share on other sites

ok - i think i have it.  took some mucking with depending if i ended the process with retroarch having focus on monitor 1, or my browser having focus on monitor 2.

still remains to be seen if it works remotely and id certainly love to know why this focus issue suddenly became a thing, but at least I have a satisfactory workaround for now.  So thank you very much for that.

is 


CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160
Sleep, 6500
CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160
 

the right way to get the double click?   Its working, unsure if theres a more concise way to do it. 

multi monitors, forever the pita.  if bb tracked the exe's closing instead of the active window, i imagine it might alleviate this but the fact that isnt the way it functions means theres likely a good reason for it being so.

no way to do this without a dll i presume? 

Edited by klepp0906

Share this post


Link to post
Share on other sites

Hey @klepp0906.

I'd imagine there would be reasons why it uses window focus other than tracking the process.

For instance some games will load one .exe and pass on to another .exe. If BB were to track the .exe in this case you would see the loading screen then immediately see the shutdown screen. 

Some .exe may hang in the background when closed... etc etc.

Also when coding something like this I know for me it wouldn't cross my mind that someone could be jumping from screen to screen, messing up the window order. Even though I have 2 screens it'd be something I'd forget. Having it as window focus is prob the lesser of 2 evils. 

I could be wrong but i would imagine ur issue could be using Google whilst gaming. When clicking on Google on ur second screen u move Google's screen up above BB in the window order. So when u exit the game google has focus and not BB. 

U could test this by replacing the ahk script with one that message boxes the active window title. 

 

WinGetActiveTitle, title

Msgbox %title%

 

In this case u could try winActivate / force winActivate etc commands in the script. But not sure how successful it'll be. 

Share this post


Link to post
Share on other sites

I appreciate the reply very much.   I think the first issue could be circumvented with a manual setting to designate which exe to use, the second scenario I didnt think of.  That being said, a processclose ahk script usually shuts anything down instantly.  At that point it would become a requirement for people and both those things together equal more manual configuration, something im sure they try to limit.

Lesser of the evils i imagine.   

as for your suggestion, goes a little above my head.   I'm not a programmer, just a user.  If you get time and care to explain it to me better - id appreciate it.

best i can tell that fetches the active window title, but im unsure how that would help? Does it log the window title? is this to track all the windows i use outside of bb?

that same script would be followed with winactivate, wintitle then or something?

this would still require the dll and thus require to be named RegainFocus.ahk?

 
Thanks for your time and help with this.  I cant even explain how many hours ive wasted trying to find ways to get these shutdown screens working locally and remotely. 

 

 

Share this post


Link to post
Share on other sites
1 hour ago, klepp0906 said:

 

I'm not near my pc at the moment so can't be to much help.

 

I can't think of a way to make this work without the dll.

 

The WinGetActiveTitle commands above, yeah replace what ever is in the regainfocus.ahk with them 2 lines.

 

Actually put a sleep command in there...

WinGetActiveTitle, title

Sleep 5000

Msgbox %title%

 

Start a game in BB.

Quit the game.

Note if the shutdown screen works correctly.

On game exit a message box will pop up telling u what window has the focus.

If the shutdown screen works correctly then supposedly it should pop up a message box that says launchbox bigbox or something like that.

If the shutdown screen doesn't work correctly then a message box should pop up with the name of a different window. 

This is all assuming that u using Google whilst gaming is actually the issue but testing with WinGetActiveTitle and msgbox commands should at least tell u, that is the issue. 

Share this post


Link to post
Share on other sites

excellent.  thats where ill start then.   And thats plenty of help :)

im in no hurry at this point and todays my off day so win!

the dll isnt a big deal, was just curious if it was something ill need to keep in place going forward. 

will report back with my findings in a few.  thanks again.

Share this post


Link to post
Share on other sites

yea, thats pretty much the issue.  I could tell it was the case by looking at my taskbar as i have it displayed on my non-primary monitor and you can see whats highlighted etc. 
image.thumb.png.2822b1a6e94e790b7f26b5e882f77fd4.png
that pops up over a black screen and of course the minute i click back in the BB area the shutdown screen then displays.

Edited by klepp0906

Share this post


Link to post
Share on other sites

yea just tried with discord, same result.  fails with anything that has focus on 2nd display.

when it succeeds i get

RegainFocus.ahk
Launchbox Game Startup

any way to make it always return to that irrespective of whatever has focus previously?  Whether i close a game when i have something on my 2nd monitor focused, or i "Had" something on it focused, but returned focus to BB, it will fail.  

only way it will not, is if focus starts and stays with BB the entire time.   Best I can tell, doesnt seem to happen with LB only BB. 

Share this post


Link to post
Share on other sites

also discovered that the current means im using to partially make this function


CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160
Sleep, 6500
CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160

is okay for bigbox, but when using launchbox it ends up clicking the "2nd" time on my taskbar which actually takes focus away from launchbox and prevents controller usage.  The irony is the first click isnt necessary with launchbox, only bigbox.   Actually the whole script isnt necessary for LB only BB.   Any means to make the script only run for BB mode?

i tried changing the coords which of course worked, but then resulted with the cursor moving to said position which I had hoped to keep hidden.  Assumed the CoordMode functioned differently than MouseMove and perhaps was seen as a behind the scenes/phantom click without putting the cursor in said coordinates. 

Apparently I was wrong.

Such a pain lol.  

hunting for the happy medium on this one.  I was hoping I would just have to ensure that I return focus to the emulator before closing, but thats evidently not enough. 

Edited by klepp0906

Share this post


Link to post
Share on other sites
3 hours ago, klepp0906 said:

also discovered that the current means im using to partially make this function


CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160
Sleep, 6500
CoordMode, Mouse, Screen
MouseClick , Left, 3640, 2160

is okay for bigbox, but when using launchbox it ends up clicking the "2nd" time on my taskbar which actually takes focus away from launchbox and prevents controller usage.  The irony is the first click isnt necessary with launchbox, only bigbox.   Actually the whole script isnt necessary for LB only BB.   Any means to make the script only run for BB mode?

i tried changing the coords which of course worked, but then resulted with the cursor moving to said position which I had hoped to keep hidden.  Assumed the CoordMode functioned differently than MouseMove and perhaps was seen as a behind the scenes/phantom click without putting the cursor in said coordinates. 

Apparently I was wrong.

Such a pain lol.  

hunting for the happy medium on this one.  I was hoping I would just have to ensure that I return focus to the emulator before closing, but thats evidently not enough. 

Replace everything in the regainfocus.ahk with this:

if WinExist("LaunchBox")
{
    WinActivate
    WinActivate, LaunchBox Game Startup
}

if WinExist("LaunchBox Big Box")
{
    WinActivate
    WinActivate, LaunchBox Game Startup
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Iv just tested it and I dunno about you but when I dont change the window focus during the game, on game exit theres a nasty flicker. If thats true for you try this one instead:

if !WinActive("LaunchBox Game Startup")
{
	if WinExist("LaunchBox")
	{
    		WinActivate
    		WinActivate, LaunchBox Game Startup
		ExitApp
	}

	if WinExist("LaunchBox Big Box")
	{
    		WinActivate
    		WinActivate, LaunchBox Game Startup
		ExitApp
	}
}

 

Edited by jayjay

Share this post


Link to post
Share on other sites

well, the new version allows the shutdown screen to fire and does so without flicker, but it never takes back control of bigbox.  

Share this post


Link to post
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
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.

Sign in to follow this  

×
×
  • Create New...