Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: IceLancer on January 01, 2018, 03:09:27 PM

Title: CEMU/WIndows Games Launch bat.Using Relative Path for mobility
Post by: IceLancer on January 01, 2018, 03:09:27 PM
Hello there!

Here it is,
PC Games:
write file Angry Birds.bat
and put it in root of ur PC GAMES folder
Apparently Attract Mode is heaving issue with BAT command start MINIMIZED. If its used in script AM will keep on running in background.. i am not sure how to resolve issue, for now minimized cant be used
Code: [Select]
@echo off
set "GAMENAME=AngryBirds.exe"
set "GAMEPATH=Angry Birds\Angry Birds\"
set HOME="%~dp0"
set "GAMEROOT=%~dp0%GAMEPATH%"
cd %GAMEROOT%
start "" /WAIT "%GAMEROOT%%GAMENAME%"
exit

CEMU:
write file New Super Mario Bros U.bat
and put it in root of ur WiiU folder
Code: [Select]
@echo off
set "GAMENAME=red-pro2.rpx"
set "GAMEPATH=Roms\New Super Mario Bros U\code\"
set "CEMUPATH=..\..\Emulators\Cemu\"
set "ROM=%~dp0%GAMEPATH%"
set HOME="%~dp0"
set "EMUROOT=%~dp0%CEMUPATH%"
cd %EMUROOT%
start "" /WAIT "%EMUROOT%Cemu.exe" -g "%ROM%%GAMENAME%" -f
exit

Budford:
Code: [Select]
@echo off
set "GAMENAME=U-King.rpx"
set "GAMEPATH=Roms\The Legend of Zelda Breath of the Wild [ALZP0101]\code\"
set "CEMUPATH=..\..\Emulators\Cemu\Budford\"
set "ROM=%~dp0%GAMEPATH%"
set HOME="%~dp0"
set "EMUROOT=%~dp0%CEMUPATH%"
cd %EMUROOT%
start "" /WAIT "%EMUROOT%Budford.exe" "%ROM%%GAMENAME%"
exit

It is compatible across front-ends. ES/HS/AM.It is portable proof as well.

Now some explanation:
Point of origin is where .bat file is located. So always look from that point of view.(Also always point front-ends to those .bat files.)
Now example in pc games. C:/some folder/some folder/pc games(bat files here)/Angry Birds/Angry Birds/AngryBirds.exe
So from .bat point of view u start where they are. So GAMEPATH=Angry Birds\Angry Birds\
Simple isnt it?
So even if u move games to any other folder and or hard disk (drive/letter) and move bat files from their root with them , games will always work if you point frontend to those bat files.

---
Now in case of CEMU it gets slightly more complicated, simply because i keep my emulator for CEMU in totally different folder not linked to folder where my games are.Simply because i love structuring them the way i am :)

SO, from bat point of view:

set "CEMUPATH=..\..\Emulators\Cemu\"
(..\..\)  meaning:    (return folder up \return folder up\ )
then go folders forward (Emulators\Cemu\)

Example:
somefolderX/roms/wiiugames(bat files here)
..\
somefolderX/roms/
*again*
 ..\
somefolderX

Now going forward:
somefolderX/Emulators/Cemu/

Simple isnt it?
Just edit
GAMENAME
GAMEPATH
CEMUPATH
per instructions.
And Enjoy!

If u attempt differently great deal of problems may occur. Even some games will not work because they will look for their config or related files in wrong folders.

P.S
Happy NEW Year!

.....i need bigger signature space..

P.P.S
...some may need this too

ES:
Code: [Select]
    <system>
        <name>PC Games</name>
        <fullname>PC Games</fullname>
        <path>PC GAMES PATH</path>
        <extension>.bat</extension>
        <command>"%ROM_RAW%"</command>
        <platform>pc</platform>
        <theme>pc</theme>
    </system>

AM:
Code: [Select]
executable           cmd
args                 /c "[romfilename]"
rompath              PC GAMES PATH
romext               .lnk;.bat;.cmd

HS:
Code: [Select]
[exe info]
path=
rompath=PC GAMES PATH
userompath=true
exe=
romextension=bat
parameters=
searchsubfolders=true
pcgame=true
winstate=HIDDEN
hyperlaunch=false
Edit PC GAMES PATH to match where u stored bat files , usually root where games for system are :)
Use the exact same config for both PC games AND Cemu, because they use bat files they should behave like they are activating PC games
NOTE:
You can use relative paths for emulationstation game rom path as well.
Example : (es_systems.cfg)
Code: [Select]
<path>..\..\Roms\PC Games</path>
Title: Re: CEMU/WIndows Games Launch bat.Using Relative Path for mobility
Post by: qqplayer on January 02, 2018, 01:46:47 PM
Awesome, thanks.

I made something "similar" for .rpx files :)
Title: Re: CEMU/WIndows Games Launch bat.Using Relative Path for mobility
Post by: IceLancer on January 02, 2018, 01:48:10 PM
:) Good, i love it
Apparantly i forgot to make cmd window minimized
need this at header
if not DEFINED IS_MINIMIZED SET IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
Cant use minimize, attract will take over control
and just to be on safe side for front ends which might resume work on background a start "" /WAIT is needed, editing main post :)

------
It would be awesome if someone would know how to make a crawler  for game folders to make this automatic :)
Title: Re: CEMU/WIndows Games Launch bat.Using Relative Path for mobility
Post by: IceLancer on January 08, 2018, 03:43:22 PM
Apparently Attract Mode is heaving issue with start MINIMIZED. If its used in script AM will keep on running in background.. i am not sure how to resolve issue, for now minimized cant be used
Title: Re: CEMU/WIndows Games Launch bat.Using Relative Path for mobility
Post by: IceLancer on March 08, 2018, 04:17:33 PM
Budford batch file
Code: [Select]
@echo off

set "GAMENAME=U-King.rpx"
set "GAMEPATH=Roms\The Legend of Zelda Breath of the Wild [ALZP0101]\code\"
set "CEMUPATH=..\..\Emulators\Cemu\Budford\"
set "ROM=%~dp0%GAMEPATH%"
set HOME="%~dp0"
set "EMUROOT=%~dp0%CEMUPATH%"
cd %EMUROOT%
start "" /WAIT "%EMUROOT%Budford.exe" "%ROM%%GAMENAME%"
exit
-f -g lines are obsolete if using budford as cemu handler. Rest of the script is the same

https://github.com/SteveLeafo/Budford