Author Topic: retrofe video still playing on background when launching TTX Games  (Read 21410 times)

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #15 on: February 03, 2017, 06:44:01 PM »
a little news.    ;)


i found  a method to launch  only a link shortcut without using  a bat file.

however it does the same issue.

what we can say is this is not  a problem of  bat file but a problem that we need to launch 2 exe one following an other. i think retrofe though (  ;D ).. that i launch a game then, i stop it immediately but  the first  exe call the second exe immediately and  this  cause  an issue...  perheaps i need  to put  a 'wait' instruction between the two exe in the bat file,  i don't know, i'll make a try soon as  i can...   

I found a new exe  : ttx_loader : this loader work like this :

it replace the old typex_loader exe, and  to work it need an exe with the folowing name : 'game.exe'  in the same directory.

What i have done is i rename the Ttxshell.exe  --> game.exe then i  deleted the old typex_loader.exe from the same directory

i launched a test, (i only click on the ttx_loder.exe this time... and  it  launched the game --> ok)

Then i create my shortcut (lnk) and putted it into my rom folder

Then i launched  RetroFe and  tried to launch the game again  but it still the same issue.


ginzu       :-\

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: retrofe video still playing on background when launching TTX Games
« Reply #16 on: February 03, 2017, 09:03:51 PM »
The problem is that your launcher immediately returns after starting the game. I have no idea why it does that or how to stop it from doing that. RetroFE works as expected in this case.

Sent from my SM-G920F using Tapatalk


ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #17 on: February 04, 2017, 12:05:50 AM »
Ok Pieter,

Thank you. If i found a solution , i will post it here.
I know that retrofe work as expected.
I think this ttx_loader somewhere stop himself at the end and retrofe could detect that. If i could tell him to stop only if the game stop, i think it will be ok.

Keep up the good work  ;)

PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #18 on: February 04, 2017, 07:22:44 AM »
I've got another idea for you to try:

Instead of launching with a batch script, try a PowerShell script.  You should be able to run whatever command necessary to launch the game, then use cmdlets to find the process id of the actual game process and wait for it.  Here's documentation on the relevant cmdlets, with some examples: https://msdn.microsoft.com/en-us/powershell/reference/4.0/microsoft.powershell.management/wait-process

I put the following in a file called calc.ps1:
Code: [Select]
Write-Host Launching calc.exe
Invoke-Item C:\Windows\System32\calc.exe
Write-Host It was launched
$proc_id = (Get-Process calc).id
Wait-Process -id $proc_id
Write-Host It was closed

I then ran it with powershell -file calc.ps1; it printed "It was launched" immediately but then paused until I closed the calculator app, after which it printed "It was closed" and exited back to the prompt.

KMetalMind

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #19 on: February 04, 2017, 08:41:57 AM »
I use this on my Windows retroFE build, and it works perfectly on all games... Hope it helps!

Launcher
Code: [Select]
executable = %ITEM_DIRECTORY%\Launch.bat
arguments = "%ITEM_FILEPATH%"

Launch.bat (put it into your PC collection rom folder, with the lnks)
Code: [Select]
@echo off
%1

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #20 on: February 04, 2017, 09:23:11 AM »
Ok,

It's good to see that there is lot of solution to test!

I have no experience on powershell language, so it is difficult for me to understand.

i made  a try with your  code PinealServo, but  i have no idea , how to  adapt  it  for launching the games, i need  more time to understand how it work.

@ KMetalMind ,

Could  you explain me a little more how it work? 
i made  a try too but,  when  i modify the executable line like in your example, now, retroFe doesn't launch anything...

my hope is your solution work because you said this :

"I use this on my Windows retroFE build, and it works perfectly on all games",

so, i think we are  close  to get a solution, but i must understand  how it work first...


big thanks!   :P
« Last Edit: February 04, 2017, 09:48:36 AM by ginzu »

KMetalMind

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #21 on: February 04, 2017, 03:21:48 PM »
I´ll elaborate:

Create a new launcher on your launcher folder: whatever.conf. It should have exactly this content:
Code: [Select]
executable = %ITEM_DIRECTORY%\Launch.bat
arguments = "%ITEM_FILEPATH%"

Check that your collection´s settings.conf is pointing to your launcher.

Create a new .bat file with this content. If you haven´t done it before, you can create a new .txt using Notepad, and rename the file from whatever.txt to Launch.bat.
Code: [Select]
@echo off
%1

Put the Launch.bat file in the same folder where you have all the links to the PC games, your "roms" folder.

When you launch an item in your collection, the launcher will execute the .bat pointing to your link. The .bat launches the application, and retroFE waits until its finished. Tell me if you still have trouble, as there are plenty .bat code variations in case you still have the problem.

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #22 on: February 04, 2017, 10:39:12 PM »
Hi KMetalMind,


i tried  what you recommand to me to do but it is the same exact situation.

games are launching , but retrofe still continue to play the video on the background.

when i hit the escape button to quit  the game, i come back to my desktop and  i can see retroFe staying on the task bar ( i hear the video still playing again).

 :(

i am on windows 10, this is the only issue  i have  with retroFe , any other emulators are launching fine.



PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #23 on: February 05, 2017, 02:03:40 AM »
When you launch an item in your collection, the launcher will execute the .bat pointing to your link. The .bat launches the application, and retroFE waits until its finished. Tell me if you still have trouble, as there are plenty .bat code variations in case you still have the problem.

The problem is that these exe files require a specific launcher to do some sort of fixup on them before they'll run, but the launcher itself doesn't keep running once the game starts. RetroFE (or whatever batch file you launch with RetroFE) detects that the launcher has died, but does not realize that there is a new process to wait for.

We need a way to tell the program RetroFE launches directly to keep running until a process other than the one that it starts itself stops running. My PowerShell script shows a way to do this by knowing both the exe/bat/lnk file that launches the game and the process name that represents the game process itself, which will be different from the launcher.  The trick is to devise a PowerShell script and a means of launching it from RetroFE with both the pathname of the item that launches the game and the string that will show up in the process list as the name of the game process itself.  I don't run RetroFE in Windows myself typically, aside from testing builds, so I'm hoping someone who does can experiment with this technique a bit to get it working right.

I have modified the PowerShell script to take parameters:
Code: [Select]
param (
  [string]$exename,
  [string]$procname
)
Write-Host Launching $exename
Invoke-Item $exename
Write-Host It was launched
$proc_id = (Get-Process $procname).id
Wait-Process -id $proc_id
Write-Host It was closed

If you name that
Code: [Select]
pslauncher.ps1 you should be able to call it with parameters like this:
Code: [Select]
powershell -executionpolicy bypass -file C:\RetroFE\pslauncher.ps1 C:\Games\GameDir\FunGameLauncher.lnk FunGame assuming you replace the pathnames with real ones and use the right name for the game's process name. If the process name of the final game exe ends up being related to the game item name from RetroFE, it should be pretty straightforward to get a launcher configuration set up to use this technique.

The script you pass in the $exename parameter doesn't have to be an exe; it can be anything that will launch a program when you double-click on it, but it has to have the full path.  It will probably help if both the $exename and $procname can be derived from something from RetroFE like %ITEM_NAME%, but I have no idea how the Windows process names are actually determined.

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #24 on: February 05, 2017, 10:24:33 AM »
hello,

i tried this :

i put the pslauncher.ps1 into my rom folder with the commands you gave me inside.

then i went to the launcher directory ta create a new launcher file for my system with the right name of my collection.

then inside this launcher file, i have add this:

Code: [Select]
executable = powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER
arguments = "%ITEM_FILEPATH%"

the instructions "executable =" and "arguments =" are mandatory.

but after some tries, games won't launch, maybe i don't know how to adapt it more because i don't understand  very well the content of the pslauncher.ps1 file.


the end of the log.txt file :

Code: [Select]
[2017-02-05 11:20:51] [INFO] [Menu] Found: "F:\RetroFE\collections\Main\menu.txt"
[2017-02-05 11:20:56] [INFO] [Layout] Initializing F:\RetroFE\layouts\Flatio 16x9\collections\Taito type X\layout\layout.xml
[2017-02-05 11:20:56] [INFO] [Layout] could not find layout file: F:\RetroFE\layouts\Flatio 16x9\collections\Taito type X\layout\layout.xml
[2017-02-05 11:20:56] [INFO] [CollectionInfoBuilder] Checking for "F:\RetroFE\collections\Taito type X\include.txt"
[2017-02-05 11:20:56] [INFO] [CollectionInfoBuilder] Scanning directory "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER"
[2017-02-05 11:20:56] [INFO] [Menu] Found: "F:\RetroFE\collections\Taito type X\menu.txt"
[2017-02-05 11:21:00] [INFO] [Launcher] Checking to see if "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\StreetFighter 4 Arcade Edition Export.lnk" exists  [Yes]
[2017-02-05 11:21:00] [INFO] [Launcher] Attempting to launch: "powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER" "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\StreetFighter 4 Arcade Edition Export.lnk"
[2017-02-05 11:21:00] [INFO] [Launcher]      from within folder: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES
[2017-02-05 11:21:00] [ERROR] [Launcher] Failed to run: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER
[2017-02-05 11:21:00] [INFO] [Launcher] Completed
[2017-02-05 11:21:00] [ERROR] [Launcher] Failed to launch.
[2017-02-05 11:21:06] [INFO] [Launcher] Checking to see if "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\StreetFighter 4 Arcade Edition Exportiiiiii.lnk" exists  [Yes]
[2017-02-05 11:21:06] [INFO] [Launcher] Attempting to launch: "powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER" "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\StreetFighter 4 Arcade Edition Exportiiiiii.lnk"
[2017-02-05 11:21:06] [INFO] [Launcher]      from within folder: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES
[2017-02-05 11:21:06] [ERROR] [Launcher] Failed to run: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER
[2017-02-05 11:21:06] [INFO] [Launcher] Completed
[2017-02-05 11:21:06] [ERROR] [Launcher] Failed to launch.
[2017-02-05 11:21:13] [INFO] [Launcher] Checking to see if "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\King of Fighters 98 Ultimate Match.lnk" exists  [Yes]
[2017-02-05 11:21:13] [INFO] [Launcher] Attempting to launch: "powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER" "F:\RetroFE\..\JEUX\TTX GAMES\LAUNCHER\King of Fighters 98 Ultimate Match.lnk"
[2017-02-05 11:21:13] [INFO] [Launcher]      from within folder: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES
[2017-02-05 11:21:13] [ERROR] [Launcher] Failed to run: powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER
[2017-02-05 11:21:13] [INFO] [Launcher] Completed
[2017-02-05 11:21:13] [ERROR] [Launcher] Failed to launch.
[2017-02-05 11:21:16] [INFO] [SDL] DeInitializing
[2017-02-05 11:21:16] [INFO] [RetroFE] Exiting

in any case
thank you PinealServo  :)



JonahUK

  • Guest
Re: retrofe video still playing on background when launching TTX Games
« Reply #25 on: February 05, 2017, 11:57:01 AM »
Code: [Select]
executable = powershell -executionpolicy bypass -file F:\JEUX\TTX GAMES\LAUNCHER
arguments = "%ITEM_FILEPATH%"

That seems incorrect?
From what I can see, maybe it should be:

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1 "%ITEM_FILEPATH%"

You may need to use %ITEM_FILENAME% or %ITEM_NAME% rather than %ITEM_FILEPATH%
« Last Edit: February 05, 2017, 12:06:28 PM by JonahUK »

PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #26 on: February 05, 2017, 04:28:19 PM »
That seems incorrect?
From what I can see, maybe it should be:

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1 "%ITEM_FILEPATH%"

You may need to use %ITEM_FILENAME% or %ITEM_NAME% rather than %ITEM_FILEPATH%

That's probably closer to what it needs to be; you'll have to verify the pathname of powershell on your machine and also, the powershell script takes two arguments, which (assuming the game itself is named so that it matches what's in RetroFE) will be %ITEM_FILEPATH% followed by %ITEM_NAME%.  The second one is supposed to be the name that shows up in the process list if you open up the task manager tool while the game is running, so it can wait for the real game exe to exit.

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #27 on: February 05, 2017, 07:09:51 PM »
hey! thank you all to taking  your time to help me.

I tested it but  as  always  till now >  games won't launch.

 ::)

I take  a look to this page to have a better understanding on the variables : http://www.retrofe.com/wiki/index.php?title=Launchers/Emulators

i test with the 4 following possibilities :

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1 "%ITEM_FILENAME%"

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1 "%ITEM_FILEPATH%"

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1  "%ITEM_DIRECTORY% %ITEM_FILENAME%"


ah and also check if the PATH for Powershell is the right one (it's ok).

AND

Code: [Select]
executable = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments = -executionpolicy bypass -file F:\Jeux\TTX Games\pslauncher.ps1  "%ITEM_DIRECTORY% %ITEM_NAME%"


sorry, and  i don't want  to bother any of you too much about this...     :-[


PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #28 on: February 05, 2017, 07:19:29 PM »
You should be able to take from the RetroFE log exactly what command it executes and what directory it does it in.  Can you tell me what happens if you open a CMD prompt, cd to that directory, and execute the same command that RetroFE does?

ginzu

  • Newbie
  • *
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: retrofe video still playing on background when launching TTX Games
« Reply #29 on: February 05, 2017, 08:57:19 PM »


so, here is  what's happening when  i launch the same  command that does the laucher.conf from the retroFe launcher directory:

i opened a cmd and  went  to that directory, then i launched the command  with the same argument :

F:\RetroFE\launchers>C:\Users\ginzu>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "F:\JEUX\TTX GAMES\LAUNCHER\pslauncher.ps1" "%ITEM_FILENAME%"
Accès refusé. <-------------     access refused!   :o

F:\RetroFE\launchers>

i also make  a try with administrator  rights  on the cmd (i opend  a new terminal with admin rights) -->  access refused!   :o

i don't know  how to bypass this situation right now, i must investigate more.


i would also tell that i have  made  other  test too with my fisrt command line (invoking  cmd.exe) like this :

this time,  i used  the "/K" argument  :

Code: [Select]
executable = C:\Windows\System32\cmd.exe
arguments = /K "%ITEM_DIRECTORY% & %ITEM_FILEPATH%"

you know what?  it  work, .. well almost    ;D
when i quit the game : i return into retroFe  but  retroFe is stuck completely......   :P

(i found  that if  i kill the correct cmd in the task manager (detail tab) ,  retroFe run like  a charm!

i don't know  to add a command  line after  my code that could  help in this case to make  running  retrofe angain after  i quit a game....


to be  continued  ...    ::)