Author Topic: [Help] Exiting emulator not returning to Attract Mode - macOS Gurus please help  (Read 375 times)

RetroMacGamer

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Attract Mode 2.41 on macOS High Sierra

I have added an emulator and display for Mac Games, this is to launch App Store Games and Games in the /Applications folder.  Mainly to have Zen Pinball 2 running from Attract Mode

I am launching them via /bin/bash and a .sh rom file with a path in it.

I can successfully launch the game but it exits back to the desktop and Attract Mode is as if minimised or in the background, when I click on Attract Mode it opens again, it seems that Attract Mode doesnt know that Zen Pinball has closed.

The Exit Emulator button doesn't work.  NB Mode Wait set to 1, if 0 then the Game launches in the background.

Does anyone have any ideas on why this is happening?  Any suggestions please are welcomed.

More details below

Mac Games.cfg

Code: [Select]
# Generated by Attract-Mode v2.4.1
#
executable           /bin/bash
args                 "[romfilename]"
rompath              /Volumes/Roms/macgames
romext               .sh
system               Mac Games
nb_mode_wait         1
artwork    boxart          /Volumes/Roms/macgames/boxart
artwork    cartart         /Volumes/Roms/macgames/cartart
artwork    flyer           /Volumes/Roms/macgames/flyer
artwork    marquee         /Volumes/Roms/macgames/marquee
artwork    snap            /Volumes/Roms/macgames/snap
artwork    wheel           /Volumes/Roms/macgames/wheel

Here is the contents of the Zen Pinball 2.sh
Code: [Select]
open -a "Zen Pinball 2"
Here is the Terminal details when running in console mode;

Code: [Select]
Alexs-iMac:~ alexmartens$ /Applications/Attract.app/Contents/MacOS/attract
Attract-Mode v2.4.1 (OSX, SFML 2.4 +SWF)
avcodec 58.18.100 / avformat 58.12.100 / swscale 5.1.100 / avutil 56.14.100 / swresample 3.1.100

Warning: Attract-Mode was compiled to look for its default configuration files in: ../config/, which is not available.
Config: /Users/alexmartens/.attract/attract.cfg
Error loading language resource file: en

*** Initializing display: 'Computers'
 - Loaded master romlist 'Computers' in 0 ms (9 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (18 comparisons)
 ! Unexpectedly lost focus to: Unknown

***
*** WARNING: PreserveArt module version mismatch.
*** PreserveArt version installed: 1.1
*** PanAndScan expecting version: 1
***

 - Loaded layout: /Users/alexmartens/.attract/layouts/HP2-Sub-Menu/ (layout.nut)
 - Constructed 1 filters in 0 ms (12 comparisons)
 - Loaded layout: /Users/alexmartens/.attract/layouts/HP2-Main-Menu/ (layout.nut)

*** Initializing display: 'Computers'
 - Loaded master romlist 'Computers' in 0 ms (9 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (18 comparisons)

***
*** WARNING: PreserveArt module version mismatch.
*** PreserveArt version installed: 1.1
*** PanAndScan expecting version: 1
***

 - Loaded layout: /Users/alexmartens/.attract/layouts/HP2-Sub-Menu/ (layout.nut)

*** Initializing display: 'Mac Games'
 - Loaded master romlist 'Mac Games' in 0 ms (8 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (16 comparisons)
 - Loaded layout: /Users/alexmartens/.attract/layouts/HP2-Systems-Menu/ (layout.nut)
 - Working directory: /bin
*** Running: /bin/bash "/Volumes/Roms/macgames/Zen Pinball 2.sh"
 ! Unexpectedly lost focus to: Unknown


here is a Youtube Vide0 only goes for a few seconds of the error;

https://www.youtube.com/watch?v=0-4Y8jUU3hM
« Last Edit: September 24, 2018, 03:05:10 AM by RetroMacGamer »

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 678
    • View Profile
I haven't tried launching anything except mame - on mac and windows.

However, just a thought, perhaps attract is tracking bash (terminal) and loosing focus to the app you are using bash to launch?

I am not at my mac, but enable and use the key combo to spread all the windows on active screen while playing to get a preview of attracts terminal output. See if that error happens before you exit. If so, that is likely your issue.
« Last Edit: September 24, 2018, 05:41:52 AM by keilmillerjr »

RetroMacGamer

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
[Help] Exiting emulator not returning to Attract Mode - macOS Gurus please help
« Reply #2 on: September 26, 2018, 03:04:25 AM »
Thanks Keilmillerjr,  if I amend the .sh scrip that launches the game to (just to test that Terminal is not causing the issue)
Code: [Select]
open -a "Zen Pinball 2"
killall Terminal

Zen Pinball 2 does launch, Terminal is closed but still no return to Attract Mode.

I'm not sure what the other method you mentioned re the key combo to spread all windows is?  You mean F3?

Upon testing several more other Mac Applications, the verdict is when closing some applications, Attract does "wake up' and returns focus, with other Applications it loses focus and I return to the desktop, so it's hit and miss.  For example Kodi does launch and on exit returns to Attract Mode

Any other ideas or suggestions guys?  Maybe the Mac Applications can be launched a different way or more code added to the .sh script?

Appreciate any input from Mac or Linux users

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 678
    • View Profile
It’s now called mission control and default F3.

Your still launching an app with your sh script that executes an open command and then closes itself. I’m GUESSING this is your issue. The app you launched with attract is closed and you have another app stealing focus.?

I’ll try and play with this when the weekend comes. My GUESS is to create a script that will take your param and launch the process, wait for it to close, and then terminate itself. That way attract sees the “emulator“ closing and return focus to itself.

This is all speculation at this point until I test or some one else chimes in. Sorry the Mac attract community is small.

RetroMacGamer

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Thanks again and yes I agree the Mac Attract community is small ;)

Yes the sh script launches the app and then closes itself, once the Application that was launched is closed after some time by the user, something else seems to steal the focus or Attract doesn't know that the user has closed the application.  Clicking on Attract manually straight away resumes Attract Mode where it left off.  I guess having to avoid the click to resume Attract is the solution we want to achieve.

Any idea on what this script should you mentioned should look like?  Scripting is not my strength.  What details or files do you need from me to test this?  Anyone else have any suggestions?