Author Topic: $PROGDIR variable not working on Attract Mode for MacOS  (Read 7131 times)

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
$PROGDIR variable not working on Attract Mode for MacOS
« on: January 13, 2021, 02:26:20 PM »
Hi all! I'm a new member here, and I apologize for my first post being a support request.

I have experience working with the settings of AM and have built a multi-system cabinet with it running on windows.
However, now I want to use most of what I built on MacOS but am having problems with the $PROGDIR variable, which does not seem to work on my MacOS setup.
My wheel art and other menu-art/videos do not load when using the $PROGDIR variable, however, as soon as I change that to absolute path, it runs without a problem

The code sample below is the console output of running attract mode. I understand the emulator I selected for this representation is a windows .exe file, but for the purpose of the demonstration should suffice, where my intent is to show that the $PROGDIR variable is being replaced by an empty string

Code: [Select]
Attract-Mode v2.6.1 (OSX, SFML 2.5.1 +FontConfig +SWF +Curl)
avcodec 58.54.100 / avformat 58.29.100 / swscale 5.5.100 / avutil 56.31.100 / swresample 3.5.100

Config: /Volumes/MediaBackup/Games/emu/Attract/attract.cfg

*** Initializing display: 'Sega Genesis'
 - Loaded master romlist 'Sega Genesis' in 72 ms (733 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (1466 comparisons)
Fontconfig error: Cannot load default config file
 ! Unexpectedly lost focus to: Unknown
Attract-Mode Version: v2.6.1
Screen aspect ratio: 16x10
Resolution: 2880x1800
Shader GLSL available: 1
OS: OSX
using settings[16x10][aspectDepend][res_x] : 1920
using settings[16x10][aspectDepend][res_y] : 1200
using settings[16x10][aspectDepend][maskFactor] : 1.9
 - Loaded layout: /Volumes/MediaBackup/Games/emu/Attract/layouts/Sega Genesis/ (layout.nut)
 - Constructed 1 filters in 0 ms (12 comparisons)
Attract-Mode Version: v2.6.1
Screen aspect ratio: 16x10
Resolution: 2880x1800
Shader GLSL available: 1
OS: OSX
using settings[16x10][aspectDepend][res_x] : 1920
using settings[16x10][aspectDepend][res_y] : 1200
using settings[16x10][aspectDepend][maskFactor] : 1.9
 - Loaded layout: /Volumes/MediaBackup/Games/emu/Attract/layouts/Favourites/ (layout.nut)

AN ERROR HAS OCCURED [the index '0' does not exist]

CALLSTACK
*FUNCTION [system_stats()] /Volumes/MediaBackup/Games/emu/Attract/layouts/Favourites/layout.nut line [1220]

LOCALS
[curr_sys] "Displays Menu"
[ttime] 0
[var] 2
[ttype] 0
[this] TABLE
Script Error in transition function: system_stats - the index '0' does not exist

*** Initializing display: 'Sega Genesis'
 - Loaded master romlist 'Sega Genesis' in 13 ms (733 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (1466 comparisons)
Attract-Mode Version: v2.6.1
Screen aspect ratio: 16x10
Resolution: 2880x1800
Shader GLSL available: 1
OS: OSX
using settings[16x10][aspectDepend][res_x] : 1920
using settings[16x10][aspectDepend][res_y] : 1200
using settings[16x10][aspectDepend][maskFactor] : 1.9
 - Loaded layout: /Volumes/MediaBackup/Games/emu/Attract/layouts/Sega Genesis/ (layout.nut)
Warning: could not locate rom.  Best guess: /emulators/Sega Genesis/roms/Wonder Boy V - Monster World III (J).zip
 - Working directory: /emulators/Sega Genesis/
*** Running: /emulators/Sega Genesis/Fusion.exe "/emulators/Sega Genesis/roms/Wonder Boy V - Monster World III (J).zip" -gen -fullscreen
Warning, chdir(/emulators/Sega Genesis/) failed.
Error executing: /emulators/Sega Genesis/Fusion.exe "/emulators/Sega Genesis/roms/Wonder Boy V - Monster World III (J).zip" -gen -fullscreen
 - Constructed 1 filters in 0 ms (12 comparisons)

Here is my "Sega Genesis.cfg" emulator config file.

Code: [Select]
# Generated by Attract-Mode v2.6.1
#
executable           $PROGDIR/emulators/Sega Genesis/Fusion.exe
args                 "[romfilename]" -gen -fullscreen
workdir              $PROGDIR/emulators/Sega Genesis/
rompath              $PROGDIR/emulators/Sega Genesis/roms/
romext               .zip
system               Sega Genesis
info_source          thegamesdb.net
exit_hotkey          Joy0 Button9
pause_hotkey         P+RAlt
artwork    boxart          $PROGDIR/menu-art/Sega Genesis/boxart/
artwork    flyer           $PROGDIR/menu-art/Sega Genesis/flyer/
artwork    marquee         $PROGDIR/menu-art/Sega Genesis/marquee/
artwork    snap            $PROGDIR/menu-art/Sega Genesis/snap/
artwork    video           $PROGDIR/menu-art/Sega Genesis/video/
artwork    wheel           $PROGDIR/menu-art/Sega Genesis/wheel/

My question is, does the $PROGDIR variable work on AM for MacOS?

Cheers.

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #1 on: January 14, 2021, 07:47:25 AM »
I wonder if anybody else is trying this on MacOS. Perhaps it's something about my setup, like the long path I'd be trying to replace with $PROGDIR. I have not tried moving the directory somewhere else for a shorter path yet...

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #2 on: January 14, 2021, 12:52:32 PM »
I'm not using a Mac. Is your environment $PROGDIR correct?
Attractmode is case sensitive. For example windows environment for C:\Program Files :

do not work:
executable           %programfiles%\MyProgram.exe

works:
executable           %PROGRAMFILES%\MyProgram.exe

See
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

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #3 on: January 14, 2021, 07:34:47 PM »
Thanks for checking in.
Well, the documentation references the variable $PROGDIR (all upper-case letters). On Windows this works fine, but when I ported my configs to MacOS, it didn't.
I tried with $progdir and $Progdir as well, but no dice...

I wish someone running AM on a Mac could try this and share their results.

Cheers.

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #4 on: January 20, 2021, 12:26:21 PM »
So I made a few more tests. AM on MacOS is able to replace $HOME with the correct home directory value with no problems. However, $PROGDIR is still an empty string. I've even tried setting it on the OS via command line before AND after launching AM to the same result of getting an empty string.

Any ideas?

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #5 on: March 19, 2021, 09:23:06 AM »
a quick bump to try and find someone willing to test this on MacOS.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1245
    • View Profile
    • My deviantart page
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #6 on: March 19, 2021, 11:03:08 PM »
This probably happens because on Mac os the program directory is inside Tha Attract "app", while the user data are in the.attract folder of your user folder. If you need to access.attract there's a variable in squirrel for that, I'm not sure you can access the program folder

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1274
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #7 on: March 19, 2021, 11:34:23 PM »
$PROGDIR is a variable and is OS dependent. It seems that this variable isn't native to OSX. This issues has nothing to do with AM but with OSX. The simplest thing to do in AM is to just use a full, dynamic or root path to resolve your issue.

You can add any variable/path to any OS. If you prefer this method, you'll need to make a modification to your OS and then AM will "follow the rules" of your OS configuration. OSX, Mac and Apple forums will be more helpful on how to set this up on your machine.
« Last Edit: March 19, 2021, 11:38:49 PM by progets »

tuxic

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #8 on: May 18, 2021, 07:15:36 AM »
$PROGDIR is a variable and is OS dependent. It seems that this variable isn't native to OSX. This issues has nothing to do with AM but with OSX. The simplest thing to do in AM is to just use a full, dynamic or root path to resolve your issue.

You can add any variable/path to any OS. If you prefer this method, you'll need to make a modification to your OS and then AM will "follow the rules" of your OS configuration. OSX, Mac and Apple forums will be more helpful on how to set this up on your machine.

My goal was to make my AM setup portable across different operating systems, and since the $PROGDIR variable was advertised as being replaced by the config-dir, I attempted to use it as such on MacOS.
I understand what you say. Unfortunately, this workaround would make the AM setup less portable.

Thanks all for sharing your thoughts!

HanOne

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: $PROGDIR variable not working on Attract Mode for MacOS
« Reply #9 on: June 12, 2023, 02:09:09 AM »
Dear tuxic

i registered here to give you the nessesary information to configure attract mode "portable".

1) Attract Mode is independet, i start it with a script, and it works everywhere
The problems are the emulators - e.g. RetroArch

2) Variables: "%PROGRAMFILES%" is not working on macOS - seems to be Windows-OS-Variables.
$PROGRDIR - i didn't manage to make it work until now.

Working Variables on macOS are e.g. $HOME
My first thought about $HOME was "but i want to install AM on a network drive - e.g. NAS".
After trying around i found the solution.

With the terminal command "ln" i generat links from $HOME to my network installation.

copy RetroArch to your prefered shared path
e.g. network_path=/Volumes/your_network_storage/your_share_name/RetroArch

the prefered RetroArch installation path is $HOME/Documents/RetroArch
delete this folder an link you shared path to the default home path
ln -s "/Volumes/your_network_storage/your_share_name/RetroArch" "/Users/your_local_username/Documents"

now the excutable looks like this
executable           $HOME/Documents/RetroArch/RetroArch.app

in fact, RetroArch needs more than to start the app, but start RetroArch.app/Contents/MacOS/RetroArch and a core and a file and so on, but this example works with other emulators, too
Just link every emulator to a local folder, so you can start it with "$HOME/Emulators/Emulator_folder/Emulatorname" and so on

Hopefully i could tell it the way others are able to understand.

Greetings






 
« Last Edit: July 25, 2023, 01:05:07 AM by HanOne »