Author Topic: Exit from PC game  (Read 2346 times)

^F117^

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Exit from PC game
« on: June 10, 2020, 05:40:12 AM »
After launching a pc game, it's not possible to return on the frontend with the exit hotkey.. I need some args?

# Generated by Attract-Mode v2.2.1
#
executable           cmd
args                    /c "[romfilename]"
rompath              D:\Attract Mode\Emulatori\Pc Games\Rom
romext               .lnk
exit_hotkey          U
artwork    flyer           
artwork    marquee         
artwork    snap            D:\Attract Mode\scraper\Pc\Snap
artwork    wheel           D:\Attract Mode\scraper\Pc\Wheel

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Exit from PC game
« Reply #1 on: June 12, 2020, 12:44:48 AM »
to exit a PC game by external button, depends on the game itself.
the game has to support it.
some games blocks or does not recognize any external input (anti cheat / anti bot system).
so you need to test this:



on windows, you can kill all windows processes this way (excluding specific tasks/processes):
Code: [Select]
taskkill /F /FI "USERNAME eq %username%" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne notepad.exe"
explorer.exe and dwm.exe are better excluded.
cmd.exe for this project too.
notepad.exe is an example, to exclude an specific task



Next step is recognizing an external input.
Try this hybrid solution with Autoit script (an batch enclosed):

goto your AM folder (where attract.exe is). Create and compile this autoit script (for example : Killall.exe)

Code: [Select]
#include <Misc.au3>

While 1

; 55 = U key
If _IsPressed ("55") Then
Sleep(300)
FileDelete(@TempDir & "\cmd.bat")
FileWrite(@TempDir & "\cmd.bat", "@echo off" & @CRLF & 'taskkill /F /IM attract.exe' & @CRLF & 'taskkill /F /FI "USERNAME eq %username%" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne cmd.exe"' & @CRLF & 'cd "C:\attract"' & @CRLF & 'start /MAX attract.exe')
Run(@TempDir & "\cmd.bat")
Exit
EndIf
WEnd

Create this config in AM:
Code: [Select]
executable           cmd
args                 /c start Killall.exe & "[romfilename]"
rompath              C:\attract\EMU\PC Games\ROMS
romext               .lnk



If you start a file from AM, Killall.exe starts too.

If you press U on keyboard:
a file cmd.bat is created in TEMP folder
all processes are killed (except: explorer.exe, dwm.exe, cmd.exe)
C:\attract\attract.exe starts

« Last Edit: June 13, 2020, 07:28:16 AM 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