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

tonberryhunter

  • Full Member
  • ***
  • Posts: 48
    • 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: 1071
    • 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: 137
    • 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: 153
    • 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.

xev1n

  • 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?

xev1n

  • 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: 153
    • 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.