Author Topic: Launching ePSXe using .bat?  (Read 3807 times)

prefor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Launching ePSXe using .bat?
« on: June 07, 2020, 12:40:34 PM »
Hello i'm trying to run my PSX games through a .bat file.

The only reason why i want to to run it through .bat file is because i can open 2 programs simultaneously or together, in this case both ePSXE and Antimicro.
I have configured Antimicro so i can save state and load state using my controller.

This is the code i wrote:

Code: [Select]
@ECHO OFF

start /d "C:\AttractMode\emulators\Playstation\antimicro" antimicro.exe
start /WAIT /d "C:\AttractMode\emulators\Playstation" ePSXe.exe -nogui -loadbin "[romfilename]"

Taskkill /IM Antimicro.exe /F


When i try to launch a game in Attract Mode, both Antimicro and ePSXe launches just fine, BUT i only get a black screen in ePSXe and nothing more. I don't think it loads the game correctly somehow.

I dont think "[romfilename]" work unless we remove the "[romfilename]" and specify it with a game. But if I do that, all the game that I choose will play that specific game...
Does someone know how i can fix this problem?

Or if there is an easier way for Antimicro to open whenever i launch a PSX game? :)
« Last Edit: June 07, 2020, 04:00:56 PM by prefor »

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Launching ePSXe using .bat?
« Reply #1 on: June 07, 2020, 11:52:43 PM »
Hi.
[romfilename] is an "attractmode-specific" variable.
external programs cant deal with it.
you have to do it with a parameter transfer via commandline parameters : %1

1) direct batch start:
for example to start notepad via batch file direct:
Code: [Select]
@echo off
notepad

2) start batchfile Test123.bat and give notepad as parameter to this file Test123.bat:
using first commandline parameter:
Code: [Select]
@echo off
%1

If you goto commandline and type : Test123.bat notepad

the batchfile Test123.bat starts.
get notepad as parameter
and replace %1 with notepad



or you can use commandline paremeters direct in AM.
I'm using this config for my OpenBOR-Games:
Code: [Select]
executable           cmd
args                 /c cd C:\attract\EMU\OpenBOR\[name] & start OpenBOR.exe & start C:\attract\EMU\OpenBOR\wait_for_ESC.exe
rompath              C:\attract\EMU\OpenBOR
romext               <DIR>
« Last Edit: June 07, 2020, 11:55:33 PM by hermine.potter »
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

prefor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Launching ePSXe using .bat?
« Reply #2 on: June 08, 2020, 01:02:49 AM »
Hi.
[romfilename] is an "attractmode-specific" variable.
external programs cant deal with it.
you have to do it with a parameter transfer via commandline parameters : %1

1) direct batch start:
for example to start notepad via batch file direct:
Code: [Select]
@echo off
notepad


2) start batchfile Test123.bat and give notepad as parameter to this file Test123.bat:
using first commandline parameter:
Code: [Select]
@echo off
%1

If you goto commandline and type : Test123.bat notepad

the batchfile Test123.bat starts.
get notepad as parameter
and replace %1 with notepad



or you can use commandline paremeters direct in AM.
I'm using this config for my OpenBOR-Games:
Code: [Select]
executable           cmd
args                 /c cd C:\attract\EMU\OpenBOR\[name] & start OpenBOR.exe & start C:\attract\EMU\OpenBOR\wait_for_ESC.exe
rompath              C:\attract\EMU\OpenBOR
romext               <DIR>

Thank you very much for replying! You have no idea how much I have played around with the dam codes! xD
Everything works smoothly with the others emulators except this one :P

I'm not 100% sure I understood about the %1 and what command I should use to get similar to mine, but I will see what i can do about it when I get home. :)

Hmm I didn't know we could use commandline parameters in AM directly.

But will it work even if I put the /Wait command and Taskkill /IM Antimicro.exe /F ??

I want it to force taskkill Antimicro when I close ePSXe emulator.

prefor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Launching ePSXe using .bat?
« Reply #3 on: June 08, 2020, 08:23:39 AM »

or you can use commandline paremeters direct in AM.
I'm using this config for my OpenBOR-Games:
Code: [Select]
executable           cmd
args                 /c cd C:\attract\EMU\OpenBOR\[name] & start OpenBOR.exe & start C:\attract\EMU\OpenBOR\wait_for_ESC.exe
rompath              C:\attract\EMU\OpenBOR
romext               <DIR>

---------------------------------------------

UPDATE

I just want to write that i finally managed to fix it thanks to your tip! :D

I was missing something that's why it didn't work, but here is the complete code if anyone have similar problem.
Whenever i launch a game through AM, Antimicro/Xpadder/Joy2key launches. And whenever i close the game, Antimicro also closes. With this, my configured keys in antimicro will close all together and won't interfere the hotkeys i have in Retroarch if I change game or emulator :)

Code: [Select]
# Generated by Attract-Mode v2.6.1
#
executable           cmd
args                 /c cd C:\AttractMode\emulators\Playstation\ & start antimicro.exe --no-tray & start /WAIT ePSXe.exe -nogui -loadbin "[romfilename]" & Taskkill /F /IM antimicro.exe
rompath              C:\AttractMode\roms\Playstation\
romext               .cue;.PBP;.iso
system               Sony Playstation
info_source          thegamesdb.net
artwork    flyer           C:\AttractMode\roms\Playstation\media\flyer
artwork    marquee         C:\AttractMode\roms\Playstation\media\marquee
artwork    snap            C:\AttractMode\roms\Playstation\media\snap
artwork    wheel           C:\AttractMode\roms\Playstation\media\wheel

Thank you very much @hermine.potter :D
« Last Edit: June 08, 2020, 12:09:47 PM by prefor »

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Launching ePSXe using .bat?
« Reply #4 on: June 11, 2020, 12:31:50 PM »
I'm try to explain %1 parameter with the emulator zsnes (for snes games):

>zsnes started from CMD (the ordinary common way):
Code: [Select]
"C:\attract\EMU\zsnes\zsnesw.exe" -m "C:\attract\EMU\zsnes\ROMS\MyGame123.smc"
entered in AM:
Code: [Select]
executable           C:\attract\EMU\zsnes\zsnesw.exe
args                 -m "[romfilename]"
rompath              C:\attract\EMU\zsnes\ROMS
romext               .smc



>starting games via single game batches (each game got own batch file (for example : TestGame123.bat starts TestGame123.smc)):

content of TestGame123.bat:
Code: [Select]
@echo off
"C:\attract\EMU\zsnes\zsnesw.exe" -m "C:\attract\EMU\zsnes\ROMS\TestGame123.smc"

entered in AM:
Code: [Select]
executable           cmd /c
args                 "[romfilename]"
rompath              C:\attract\EMU\zsnes\ROMS
romext               .bat



>general starter with dynamic commandline parameter %1:
create a general STARTER.bat with this content:
Code: [Select]
@echo off
"C:\attract\EMU\zsnes\zsnesw.exe" -m %1

entered in AM:
Code: [Select]
executable           C:\attract\EMU\zsnes\STARTER.bat
args                 "[romfilename]"
rompath              C:\attract\EMU\zsnes\ROMS
romext               .smc

If you start a Game in AM (for example Test123.smc, this command starts in CMD:
"C:\attract\EMU\zsnes\STARTER.bat" "C:\attract\EMU\zsnes\ROMS\Test123.smc"
Within STARTER.bat %1 will be replaced by C:\attract\EMU\zsnes\ROMS\Test123.smc

« Last Edit: June 11, 2020, 09:35:04 PM by hermine.potter »
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