Jump to content
  • Announcement

    The HyperSpin 2 early access beta is here!

    We’re starting the first public testing phase with Platinum Members to keep the scope manageable while we test the current feature set and begin to add more. In the future, we’ll provide a version for basic members as well.  On behalf of the entire HyperSpin team, we look forward to another exciting adventure with our community.

Hyperspin loses focus when exit emulator


sic

Recommended Posts

Posted

Hi guys!

I have problem with Hyperspin loosing focus when exiting from various emulators that I have in my setup. The wierd thing is it doesnt always happen, but it happens very often. I have tried the "Restore Frontend On Exit" setting in Hyperlaunch HQ (v.1.1.13.0) but still it fails to keep focus when returning back to Hyperspin.

So I wonder if someone use/know some sort of thirdparty "winactive" app/script I could use to eliminate my problem??

/sic

Posted

Hi gigapig! Yeah, I´ve tried the "restore and Exit" and I have an exit key configured.. Should I add some time to the "Exit key wait" setting, as it is now I have it set to 0?..

Posted
Hi gigapig! Yeah, I´ve tried the "restore and Exit" and I have an exit key configured.. Should I add some time to the "Exit key wait" setting, as it is now I have it set to 0?..

Well "0" will be instant, mine is set to 1000.

Which particular emulators is it?

Posted

Ok, well its all my emulators actually. So I think it has to do with exiting the emulators. Maybe I have configured something wrong. Hope I will have some time to test out different exit settings soon, damn you real life for taking my hyperspin-time!

  • 3 months later...
Posted

I have the same problem its kinda random. I've seen it happen to me with mess, nestopia, fusion, and mednafen. It seems to happens more often with nestopia and mess. Not sure why. Restore and click doesn't improve anything. The folder I launched from takes focus when this happens. Could that be linked to the folder name being "Hyperspin"?

Posted

I think HyperSpin doesn't go well with other programs. If you want to avoid issues close everything you might have open, or even steal focus. (Antivirus, Xpadder, Skype, etc)

Posted
You could give this a shot, with version 1.06 it will minimise any windows open and maximise when Hyperspin is closed.

http://www.hyperspin-fe.com/forum/showthread.php?28986-HyperSpin-Startup-Script

Thanks for the suggestion, I have my own script so I tried the following which will minimize and hide everything. I'm still having a slight problem. It seems to only happen with MESS now, which on exit randomly Hyperpin will be frozen and won't respond till I hit ALT-TAB once. So its like it loses focus still. Happens less and so far only seems to be with MESS. (Just found out it happens with stella also, maybe its something to do with the atari 2600 theme since thats the only one still causing me troubles?) Any more ideas?


; minimize all windows.
WinMinimizeAll

; hide start button and taskbar
WinHide, ahk_class Shell_TrayWnd
WinHide, Start ahk_class Button

; hides windows
EnumAddress := RegisterCallback("EnumWindowsProcHide", "Fast")
DllCall("EnumWindows", UInt, EnumAddress, UInt, 0)

; run and wait on hyperspin
Run, .\HyperSpin.exe
WinWaitActive HyperSpin
WinWaitClose HyperSpin

; reshow task bar
WinShow, ahk_class Shell_TrayWnd
WinShow, Start ahk_class Button

; reshow hidden windows 
WinShow, ahk_group HiddenWindows

exitApp

EnumWindowsProcHide(hwnd, lParam)
{
   global Output
DetectHiddenWindows, Off
   WinGetTitle, title, ahk_id %hwnd%
   WinGetClass, class, ahk_id %hwnd%
   if ((title)or(class="Shell_TrayWnd"))
   {
       Output .= "Title: " . title . "`tClass: " . class . "`n"
       WinHide, %title% ahk_class %class%
GroupAdd, HiddenWindows, ahk_id %hwnd%
   }
   return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}

Posted
Thanks for the suggestion, I have my own script so I tried the following which will minimize and hide everything. I'm still having a slight problem. It seems to only happen with MESS now, which on exit randomly Hyperpin will be frozen and won't respond till I hit ALT-TAB once. So its like it loses focus still. Happens less and so far only seems to be with MESS. (Just found out it happens with stella also, maybe its something to do with the atari 2600 theme since thats the only one still causing me troubles?) Any more ideas?

Does it come back if you left click? Some had to use a restore focus script for Taito Type X, which was simple to add to the PCLauncher settings.

Posted
Does it come back if you left click? Some had to use a restore focus script for Taito Type X, which was simple to add to the PCLauncher settings.

Yes, it does. Are you saying to try to launch the emulator with the PCLauncher and use the PostExit options to run a script that sends a click to HyperSpin?

Posted
Yes, it does. Are you saying to try to launch the emulator with the PCLauncher and use the PostExit options to run a script that sends a click to HyperSpin?

I thought you had tried what ghutch has suggested so try that first.

But now we know it restores with a click you could perhaps add something to your script or I could let you have the return focus script to add. Hopefully it won't be necessary, and don't do anything with pclauncher that was just an example.

Posted
I thought you had tried what ghutch has suggested so try that first.

But now we know it restores with a click you could perhaps add something to your script or I could let you have the return focus script to add. Hopefully it won't be necessary, and don't do anything with pclauncher that was just an example.

I did try ghutch suggestion first. Actually tried all combinations of that setting. I also tried adding code in the Lib/UserFunctions.ahk inside the StopGlobalUserFeatures method as a test.

sleep 2000
#WinActivateForce
WinActivate, HyperSpin
ControlFocus,,HyperSpin
Process, Exist, Hyperspin.exe
frontendPID := ErrorLevel
ControlClick, , ahk_pid %frontendPID%

This didn't work for me either. So I decided to take another approach and figure out what is stealing focus. To do this I 1st change my registry to use the classic ALT-TAB window by adding and setting the following registry value to 1.

HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/AltTabSettings

After doing this I discovered what was stealing my focus from Hyperspin. It was a window titled "Msg" with a class name "Messaging". So I added some code to my start up script to find this window and close and put focus back on HyperSpin. I discovered that the "Msg" Window is always running from when you start HyperSpin. Oh well I closed it anyways. Though this wasn't it, the problem was still happening and now a different window was stealing focus. Though this windows had not title name. It had a autogenerated class name "ATL:####7020" the #### values were changing every time. The Width and Height of the window was 5 and the x,y position was 0,0. That gave me a little bit of info to try to capture that window and in my start up script and give HyperSpin focus. So the following is my first version of start up scripting that fixes my problem. Probably better and more elegant ways of doing this. Not sure what I'm breaking either by closing the Msg window. I even could be causing a race condition between my script and HyperSpin, but this is what initially works for me.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

MouseMove, %A_ScreenWidth%, %A_ScreenHeight%

WinMinimizeAll

WinHide, ahk_class Shell_TrayWnd
WinHide, Start ahk_class Button

EnumAddress := RegisterCallback("EnumWindowsProcHide", "Fast")
DllCall("EnumWindows", UInt, EnumAddress, UInt, 0)

Run, .\HyperSpin.exe
WinWaitActive HyperSpin

DetectHiddenWindows, On
SetTitleMatchMode, 3

Loop
{
   sleep 500

   IfWinExist, Msg
   {
       WinClose
       Loop
       {
    IfWinNotActive, HyperSpin
    {
        WinActivate, HyperSpin
        ControlFocus,,HyperSpin
	Process, Exist, Hyperspin.exe
	frontendPID := ErrorLevel
	ControlClick, , ahk_pid %frontendPID%
    }
           else
           {
        break
           }
       }
   }

   WinGetActiveStats, Title, Width, Height, X, Y    

   If (Width = 5 and Height = 5 and X = 0 and Y = 0)
   {
count +=1
       Loop
       {
    IfWinNotActive, HyperSpin
    {
        WinActivate, HyperSpin
        ControlFocus,,HyperSpin
	Process, Exist, Hyperspin.exe
	frontendPID := ErrorLevel
	ControlClick, , ahk_pid %frontendPID%
    }
           else
           {
        break
           }
       }
   }

   IfWinNotExist, HyperSpin
   {
   	break
   }
}


WinShow, ahk_class Shell_TrayWnd
WinShow, Start ahk_class Button

WinShow, ahk_group HiddenWindows

exitApp

EnumWindowsProcHide(hwnd, lParam)
{
   global Output
DetectHiddenWindows, Off
   WinGetTitle, title, ahk_id %hwnd%
   WinGetClass, class, ahk_id %hwnd%
   if ((title)or(class="Shell_TrayWnd"))
   {
       Output .= "Title: " . title . "`tClass: " . class . "`n"
       WinHide, %title% ahk_class %class%
GroupAdd, HiddenWindows, ahk_id %hwnd%
   }
   return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}

There is Loop handling the evil invisible windows stealing focus. So I'll probably keep refining this since its working for me. May be help to others. Also someone who knows more about HyperSpin may want to tell me how bad my solution is and what I'm actually breaking. This script seems to working fine at least with my HS setup.

Posted

Just in case it's of use to you here is the return focus script, and thanks to Connersdad for this.

Process, Exist, Hyperspin.exe
frontendPID := ErrorLevel
ControlClick, , ahk_pid %frontendPID%



sleep, 2000
MouseClick, left

Posted

Thanks, that interesting, I'm not fan of sending mouse clicks like where that 2nd click is happening. You just don't have a guarantee of what could be under the mouse. I guess if it works it works.

Well, I think I've settled in on solution I'm going to use for a while and see how it works for me. I figured out if I don't close the "Messaging" window, I stop getting the random class, empty titled windows taking my focus. Basically it ends up being the "Messaging" window every time in that case. I also don't like closing because it seems to be a part of HyperSpin, but who knows what it does. So I've settled in on the following example of HS startup script that does the following:

  • Moves mouse off screen
  • Minimized all windows
  • Hides all windows
  • Hides the start button and task bar
  • Runs HyperSpin
  • Detect the Messaging window stealling focus and returns it to HyperSpin
  • Upon hyperspin exit return the hidden start button, task bar, and hidden windows

So all of that was was important in me resolving the lost of HyperSpin focus. My sample script:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;move mouse off screen
MouseMove, %A_ScreenWidth%, %A_ScreenHeight%

;minimize all
WinMinimizeAll

;Hide start button and task bar
WinHide, ahk_class Shell_TrayWnd
WinHide, Start ahk_class Button

;Hide Windows
EnumAddress := RegisterCallback("EnumWindowsProcHide", "Fast")
DllCall("EnumWindows", UInt, EnumAddress, UInt, 0)

Run, .\HyperSpin.exe
WinWaitActive HyperSpin

DetectHiddenWindows, On
SetTitleMatchMode, 3

; Detect when the "Messaging" Window steal focus to return the focus to hyperspin or when HyperSpin closes
Loop
{
   sleep 500

   WinGetActiveStats, Title, Width, Height, X, Y 
   WinGetClass, class,A   

   If (class = "Messaging" and Title = "Msg")
   {
IfWinNotActive, HyperSpin
{
    WinActivate, HyperSpin
    ControlFocus,,HyperSpin
    Process, Exist, Hyperspin.exe
    frontendPID := ErrorLevel
    ControlClick, , ahk_pid %frontendPID%
       }	
   }

   IfWinNotExist, HyperSpin
   {
   	break
   }    
}

;Show start and task bar
WinShow, ahk_class Shell_TrayWnd
WinShow, Start ahk_class Button

;show hidden windows.
WinShow, ahk_group HiddenWindows

exitApp

EnumWindowsProcHide(hwnd, lParam)
{
   global Output
DetectHiddenWindows, Off
   WinGetTitle, title, ahk_id %hwnd%
   WinGetClass, class, ahk_id %hwnd%
   if ((title)or(class="Shell_TrayWnd"))
   {
       Output .= "Title: " . title . "`tClass: " . class . "`n"
       WinHide, %title% ahk_class %class%
GroupAdd, HiddenWindows, ahk_id %hwnd%
   }
   return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}

I would appreciate improvements, comments, or input on this. If any one else tries this and has good or bad luck with I'd like to hear about your experience with this. I'll post back if I run into any issues or modification related.

  • 1 month later...
Posted

I am having the same problem with my hyperspin losing focus and it's really getting on my nerves. I tried the "Restore and Click" option, I tried the HyperSpin Startup Script, I closed all open windows and running programs. I want to try epicfails solution, but where do I place that code? User Functions.ahk? I hope this will get fixed soon it's really driving me bonkers.

Posted

Yeah this focus problem was happening to all systems when I exit any random emulator. I figured out what was causing it though....it was Xpadder. I use a gamepad to navigate through HyperSpin and for every system I have to load a blank Xpadder profile. Xpadder is loading and closing profiles everytime I start and exit an emulator which was causing the focus nonsense. If I disable Keymapper in HLHQ I have no focus problems when exiting any emulators, it works as it should. If HyperSpin had working gamepad support I wouldn't be using Keymapper at all for any systems. I would just use Pinnacle Game Profiler for those emulators that don't support gamepad inputs. There are a ton of features that many fans are hoping for in the next version of HS, but native Gamepad support is at the absolute top of that list for me! No gamepad support in a GAMING frontend?? That's my only gripe with this truly amazing software we call HyperSpin.

So anyway for now I am using JoyToKey for my keymapper. For some reason JoyToKey isn't causing the focus glitch. I guess using that simple MouseClick script I'd have to add it to every AHK in my setup and I don't really know where it would go, etc. But thanks for the help and getting me to dig further into this. I at least know what is causing it.

Posted
Yeah this focus problem was happening to all systems when I exit any random emulator. I figured out what was causing it though....it was Xpadder. I use a gamepad to navigate through HyperSpin and for every system I have to load a blank Xpadder profile. Xpadder is loading and closing profiles everytime I start and exit an emulator which was causing the focus nonsense. If I disable Keymapper in HLHQ I have no focus problems when exiting any emulators, it works as it should. If HyperSpin had working gamepad support I wouldn't be using Keymapper at all for any systems. I would just use Pinnacle Game Profiler for those emulators that don't support gamepad inputs. There are a ton of features that many fans are hoping for in the next version of HS, but native Gamepad support is at the absolute top of that list for me! No gamepad support in a GAMING frontend?? That's my only gripe with this truly amazing software we call HyperSpin.

So anyway for now I am using JoyToKey for my keymapper. For some reason JoyToKey isn't causing the focus glitch. I guess using that simple MouseClick script I'd have to add it to every AHK in my setup and I don't really know where it would go, etc. But thanks for the help and getting me to dig further into this. I at least know what is causing it.

This is great info Mr Wonka, for a long time I had an issue with not losing focus but the task bar showing up after closing a game, whether a Mame game or a Steam game.

I tested this and noticed when the game closed and taskbar pops up, I can see the xpadder icon briefly in the systray.

So I've now switched off keymapper for all systems where I have setup controls in the emu. Time to get rid of xpadder completely, somehow. :)

Thank you.

Posted

I think I found a permanent fix for this out of focus problem, without disabling keymapper and still using Xpadder. It involves using this neat tool called HyperSpin Startup Script. I am sure most of you are using it. If you've never used it I highly recommend it. Just follow the instructions carefully on that main page. It is so simple. When you launch that program for the first time it will create a HyperSpin Startup Script.ini file. Open that file and look at the [startup] section. There is an option in there:

Window_Classes_To_Not_Minimize=Shell_TrayWnd,Button

Simply change it to:

Window_Classes_To_Not_Minimize=

In HyperLaunchHQ click on GLOBAL-->Settings-->Main Settings-->Desktop-->Hide Taskbar-->FALSE. It's important that you leave this false when you're using HyperSpin Startup Script. Make sure Hide Taskbar is false for every system in your setup too. From now when you launch Hyperspin using the Startup Script the windows taskbar and start menu button will be hidden away until HS is closed. When HS is closed the taskbar and start menu button will be restored. This will fix the out of focus problem and the taskbar from appearing in HS after you exit an emulator. I tested it on two different setups, I've launched and closed just about every emulator in my system multiple times from within HyperSpin and nothing is out of focus and no taskbar is appearing in HS. And the best part is you can still use your Xpadder profiles as you please. I still want gamepad support in the next version!!!! I hope this works for some of you who are having the same issues. Try it out! Good luck.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...