Author Topic: Attract Mode window focus problem - but only with MAME?  (Read 9365 times)

apzonerunner

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Attract Mode window focus problem - but only with MAME?
« on: March 26, 2017, 05:37:17 AM »
Hey folks!

Just a quick query... I've had attract mode set up for a while now with no major problems, except something has just broken out of the blue with no changes made to break it. Go figure... I'm hoping this is a pretty obvious fix.

So, I'm running attract mode in the default fill screen mode. I've got a number of different machines on there, from steam to MAME to some old consoles, some using MAMEUI, some not.

Anyway, here's my problem: with MAME, and only MAME, when I quit out of a game attractmode doesn't get Focus back. Attract Mode is there, frozen, and the focus is instead on the windows taskbar (which I have set to automatically hide). With every other thing focus is handed back fine - be that Street Fighter 4 or 5 through Steam, NullDC for Dreamcast, Dolphin for Gamecube - they all play nice. This problem is specific to MAME. It's easily fixed with a quick alt-tab, but that's not ideal, obviously.

My attract mode settings seem to be fine - fill screen, console hidden, etc. Whats more, this worked with MAME previously, so this problem is new. It used to be fine. Any ideas? Any work-arounds? Thanks all!
« Last Edit: March 26, 2017, 05:38:59 AM by apzonerunner »

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #1 on: March 26, 2017, 11:20:34 PM »
@apzonerunner
start AM > press TAB key > Plug-ins > ResFix > Enabled : Yes > Specific Emulators : name your emulator system
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

apzonerunner

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #2 on: March 27, 2017, 01:09:01 AM »
@hermine.potter So... resfix was already enabled for /all/ emulators, and making it specific to my mame emulator doesn't seem to be working either. Turning it off and back on doesn't have any impact either. Thanks for the advice; any more ideas?

Another wrinkle to this is if I switch MAME to windowed mode it all works fine again - but obviously that doesn't look right. I've tried with two versions of mame 181 (regular mame and mameui), plus with a 183 alpha... all the same.

This situation is the same - I've just checked - in every single display mode for Attract Mode. I'm guessing the fault lies with MAME, but I'm hoping somebody can help me to make this work with AM.
« Last Edit: March 27, 2017, 03:45:33 AM by apzonerunner »

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #3 on: March 27, 2017, 02:11:25 PM »
I had the same problem.

What I found was that Mame64.exe was not actually exiting.   It's hanging when it tries to close its main window.    Pressing alt-tab seems to get it "unstuck" and it exits completely.   

AttractMode has some issue when the system wants to redraw the main window, but it's waiting for the emulator to exit.   This manifests as a white screen or a previous display in the Full Screen modes.   The author has made some changes in recent builds to try and address it but it doesn't seem fully fixed.   I strongly suspect this issue is related.

I worked around it by creating a small app that draws a full screen black pop up window, then runs Mame.     The black pop up prevents Attract Mode from trying to redraw itself, which allows Mame to exit without issue.   

Not sure why this just started happening for you out of nowhere though.   Perhaps a windows update or video driver update?     What kind of video card does your system have?   Mine is built in Intel video.




tomek

  • Full Member
  • ***
  • Posts: 29
    • View Profile
    • About Me
Re: Attract Mode window focus problem - but only with MAME?
« Reply #4 on: April 06, 2017, 07:40:17 PM »
Hi All,


I have the opposite problem. When launching a game from AM, mame64 is started correctly but never brought to the front. I have to use Cmd-TAB to bring the mame process to the front. This only happens in Fullscreen Mode. If I change the Window Mode to Window [No Border] then mame is brought to the foreground correctly. This is not ideal though.


OS: macOS Sierra 10.12.4
AM: 2.2.0-3
MAME: SDLMAME v0.184 64-bit

feltz916

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #5 on: May 02, 2017, 01:20:12 AM »
I have the same problem on Windows 8.1 x64, have to alt-tab to get focus back when exiting Mame.

Ryugah

  • Full Member
  • ***
  • Posts: 33
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #6 on: May 02, 2017, 08:28:35 AM »
same issue here just alt tab or fill screen works but fullscreen get the game in the background and dont show up at all

feltz916

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #7 on: May 03, 2017, 01:36:06 AM »
Anyone have any possible solutions not mentioned??

My setup:
Windows 8.1 x64
Mame64 v0.185

Things I have tried:
Removing ESC key from any input in AM
hide_console = yes
resfix plugin for mame
compatibility mode for attract.exe
window,fill,full screen modes

Nothing works. Same behavior every time. Must force focus onto another process (alt-tab, window key, etc) to make AM recover.

feltz916

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #8 on: May 03, 2017, 10:09:28 PM »
Looks like I found a solution. Using Oomek's tool, I no longer have problems losing focus on exit.

http://forum.attractmode.org/index.php?topic=1569.0

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #9 on: May 05, 2017, 01:07:21 AM »
@all
I've got installed Win8.1 Pro x64 on my test system. AM & Mame 0.185 works perfectly.

=Please could somebody test this way:
-Create this auto-it script and compile it to ESC_wait.exe :
Code: [Select]
#include <Misc.au3>
#include <File.au3>

While 1

If _IsPressed ("1B") Then

Dim $aTextlines
_FileReadToArray("systems.txt",$aTextlines)
For $i = 1 To UBound($aTextlines)-1
;MsgBox(0,"",$aTextlines[$i])

ProcessClose($aTextlines[$i])
Next

Exit
EndIf
WEnd

-create a textfile called systems.txt with this content (name of the task in windows task manager) :
Code: [Select]
calc.exe
notepad.exe
mame64.exe
zsnesw.exe
scummvm.exe
x64.exe

-copy it to your mame folder (where mame64.exe is found)

-change your emulator settings for mame system:
Code: [Select]
executable           cmd
args                 /c cd C:\attract\EMU\mame & start ESC_wait.exe & start mame64.exe "[romfilename]" -skip_gameinfo
rompath              C:\attract\EMU\mame\roms
romext               .zip
info_source          listxml

If you start your mame system in AM, it starts ESC_wait.exe and mame64.exe
Then, if you press the ESC key, all tasks in systems.txt will be closed (taskkill/process close) and brings you back to AM
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

Xargs80

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Attract Mode window focus problem - but only with MAME?
« Reply #10 on: August 27, 2017, 03:51:19 AM »
I had the same problem.

What I found was that Mame64.exe was not actually exiting.   It's hanging when it tries to close its main window.    Pressing alt-tab seems to get it "unstuck" and it exits completely.   

AttractMode has some issue when the system wants to redraw the main window, but it's waiting for the emulator to exit.   This manifests as a white screen or a previous display in the Full Screen modes.   The author has made some changes in recent builds to try and address it but it doesn't seem fully fixed.   I strongly suspect this issue is related.

I worked around it by creating a small app that draws a full screen black pop up window, then runs Mame.     The black pop up prevents Attract Mode from trying to redraw itself, which allows Mame to exit without issue.   

Not sure why this just started happening for you out of nowhere though.   Perhaps a windows update or video driver update?     What kind of video card does your system have?   Mine is built in Intel video.

If you bind an exit hotkey in emulator settings for example (num5+num1+left ctrl) it works fine with the resfix.
I think the problem lies with hitting ESC because that's the key to quit mame, but you need to kill mame via Attract-Mode instead.