Author Topic: Windows .bat files wont load in Attract Mode  (Read 5023 times)

tonberryhunter

  • Full Member
  • ***
  • Posts: 60
    • View Profile
Windows .bat files wont load in Attract Mode
« on: April 20, 2019, 08:14:45 PM »
I cant get .bat files to load within Attract Mode.  They work within Windows fine but not Attract Mode.

Here is my Windows.cfg

Code: [Select]
# Generated by Attract-Mode v2.5.1
#
executable           cmd
args                 /c "[romfilename]"
rompath              \roms\pc
romext               .bat
system               PC Games
exit_hotkey          Joy0 Button6+Joy0 Button7
artwork    flyer           \Attract Mode\scraper\Windows\flyer
artwork    marquee         \Attract Mode\scraper\Windows\marquee
artwork    snap            \Attract Mode\scraper\Windows\snap
artwork    wheel           \Attract Mode\scraper\Windows\wheel

Also here is a sample .bat file

Code: [Select]
@echo off

rem Run game application
cd .\Blade Strangers
start game.exe %*

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #1 on: April 21, 2019, 12:23:10 AM »
I cant get .bat files to load within Attract Mode.  They work within Windows fine but not Attract Mode.

Here is my Windows.cfg

Code: [Select]
# Generated by Attract-Mode v2.5.1
#
executable           cmd
args                 /c "[romfilename]"
rompath              \roms\pc
romext               .bat
system               PC Games
exit_hotkey          Joy0 Button6+Joy0 Button7
artwork    flyer           \Attract Mode\scraper\Windows\flyer
artwork    marquee         \Attract Mode\scraper\Windows\marquee
artwork    snap            \Attract Mode\scraper\Windows\snap
artwork    wheel           \Attract Mode\scraper\Windows\wheel

Also here is a sample .bat file

Code: [Select]
@echo off

rem Run game application
cd .\Blade Strangers
start game.exe %*

You're using relative paths but don't define the working dirrectory in the Windows.cfg.

I would try (just to test)...
- use full paths and not relative paths (in both the Windows.cfg and *.bat file)
- define the working directory in the Windows.cfg (this could be problematic)

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #2 on: May 06, 2019, 10:21:40 AM »
Does that exit hotkey combo actually work?  I was always under the impression that you can only assign a single key and not a simultaneous set of keys.  Did they add this ability in the newer nightlies or something?

Enkak

  • Sr. Member
  • ****
  • Posts: 161
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #3 on: May 06, 2019, 10:40:21 AM »
Here they are working good inside AM with relative paths (you can adapt it to your structure):

executable           cmd
args                 /c "[romfilename]"
rompath              collections\PC Games\roms
romext               .bat
system               PC
nb_mode_wait         5


Sample .bat file

@echo off
set "GAMENAME=yourgame.exe"
set "GAMEPATH=\your game folder name\"
set HOME="%~dp0"
set "GAMEROOT=%~dp0%GAMEPATH%"
cd %GAMEROOT%
start "" /WAIT "%GAMEROOT%%GAMENAME%"
exit


PS: .bat files and games folders are located in the same main folder

Something like:

PC games roms. Inside you have:

Game name folder
.bat file named the same as the game name folder
a cmd.exe just in case.

Hope this helps.

retrogam3

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #4 on: September 07, 2020, 11:04:58 AM »
Here they are working good inside AM with relative paths (you can adapt it to your structure):

executable           cmd
args                 /c "[romfilename]"
rompath              collections\PC Games\roms
romext               .bat
system               PC
nb_mode_wait         5


Sample .bat file

@echo off
set "GAMENAME=yourgame.exe"
set "GAMEPATH=\your game folder name\"
set HOME="%~dp0"
set "GAMEROOT=%~dp0%GAMEPATH%"
cd %GAMEROOT%
start "" /WAIT "%GAMEROOT%%GAMENAME%"
exit


PS: .bat files and games folders are located in the same main folder

Something like:

PC games roms. Inside you have:

Game name folder
.bat file named the same as the game name folder
a cmd.exe just in case.

Hope this helps.

This really helped allot, however I noticed something in AM if the game name or .bat name has a "space" in it the game will launch fine in AM. However if it doesn't and it one single work like gamename.bat it won't work however if the .bat file is named game name.bat or gamename .bat it works. Why does the space matter or have anything to do with AM CMD launching the game?

retrogam3

  • Full Member
  • ***
  • Posts: 93
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #5 on: September 11, 2020, 07:49:05 AM »
Is this a bug? Or am I just doing something wrong?

Enkak

  • Sr. Member
  • ****
  • Posts: 161
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #6 on: September 11, 2020, 09:53:10 AM »
Unsure. Here the games launch fine if the name have a space or not. Maybe someone else can shine a light on the issue.

DJO_Maverick

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #7 on: May 20, 2023, 08:13:54 AM »
Not to unduely necro a thread, but: I've never seen retrogam3's issue mentioned anywhere else, and I have the exact same issue he does, on current Attract Plus 3.01. 

I spent two days trying to figure out why .bat and .lnk files would not launch, and scrupulously following the directions out there...  but it always went to a black screen and froze Attract.  Log wasn't helpful in diagnosing it.  Then I stumbled across this thread. 

Adding a space anywhere to the file title (like changing from "th06" to "th 06") immediately cleared up the problem; all launch exactly as intended with no further changes.

I'm guessing it's some weird, specific interaction to fly under the radar and not affect more people, but, he's not alone.

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #8 on: May 21, 2023, 01:15:00 PM »
mabey ..check uppercase lowercase...matching...
help a friend....

Retrozz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Windows .bat files wont load in Attract Mode
« Reply #9 on: June 09, 2023, 05:28:17 AM »
I hope this helps the OP.. this works 100% and a lot less messing around..

executable           $PROGDIR\Start_Emu.bat
args                 "[romfilename]" stella_libretro.dll at2600
rompath              $PROGDIR\roms
romext               .a26;.zip
system               a2600;Atari 2600
info_source          listsoftware
artwork    flyer           $PROGDIR/extras/boxart
artwork    marquee         
artwork    snap            $PROGDIR/extras/videos
artwork    wheel           



for completeness.. near the start of my 'universal loader' batch (currently rewriting to a windows executable instead, but meanwhile...)

rem clear variables we are using
set game_file=
set core_name=
set emu_name=

rem check if user forgot to pass parameter
if [%1] == [] goto bad_filename
if [%2] == [] goto bad_filename
if [%3] == [] goto bad_filename

echo filename passed along was: %1 >>last_game_played.txt
set game_file=%1%

echo code name passed along was: %2 >>last_game_played.txt
set core_name=%2%

echo emulator name passed along was %3 >>last_game_played.txt
set emu_name=%3%

rem front end keeps putting / in filename!!!!! Let's fix that..
set game_file=%game_file:/=\%

**note that last line above.. AM puts / instead of windows/dos \ **
« Last Edit: June 09, 2023, 05:33:00 AM by Retrozz »