Jump to content
LaunchBox Community Forums

AHK script for trilogy/game-within-game games?


Garosath

Recommended Posts

Hiya, so I got an ahk script that moves my RPSC3 emulated game to my TV on startup, which works great. However, when booting up "The Sly Collection" and selecting one of the three games in-game, it closes and opens up again as the selected game, but this one doesn't get affected by my script and thus doesn't move to my TV. Do anyone know a solution to this?

 

Here's my current script:

#NoEnv
WinWaitActive, ahk_exe rpcs3.exe
Send #+{Left}  ;Send Win+Shift+Left
WinMaximize, ahk_exe rpcs3.exe

$Esc::
{
	Process, Close, {{{StartupEXE}}}
}

 

Link to comment
Share on other sites

If I'm reading this correctly, the simplest fix might be to set up a new ("2nd") RPCS3 emulator in LaunchBox, pointing to your same rpcs3.exe but with a different Running Script.  In the new script, add a Sleep timer right after the WinMaximize line.  Set it to however long you think it takes to select one of the 3 games have it start running. Then add another Send and WinMaximize lines after the sleep.  Then set "The Sky Collection to use this new emulator.

WinWaitActive, ahk_exe rpcs3.exe
Send #+{Left}    ;Send Win+Shift+Left
WinMaximize, ahk_exe rpcs3.exe
Sleep, 10000	 ;10 seconds
Send #+{Left}    ;Send Win+Shift+Left
WinMaximize, ahk_exe rpcs3.exe

$Esc::
{
   ;Process, Close, {{{StartupEXE}}}
   WinClose, {{{StartupEXE}}}    ;better method to exit a program
   ;WinClose, ahk_exe rpcs3.exe  ;alternate, direct method to exit a program
}

Adjust the Sleep timer accordingly.

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

If I'm reading this correctly, the simplest fix might be to set up a new ("2nd") RPCS3 emulator in LaunchBox, pointing to your same rpcs3.exe but with a different Running Script.  In the new script, add a Sleep timer right after the WinMaximize line.  Set it to however long you think it takes to select one of the 3 games have it start running. Then add another Send and WinMaximize lines after the sleep.  Then set "The Sky Collection to use this new emulator.

WinWaitActive, ahk_exe rpcs3.exe
Send #+{Left}    ;Send Win+Shift+Left
WinMaximize, ahk_exe rpcs3.exe
Sleep, 10000	 ;10 seconds
Send #+{Left}    ;Send Win+Shift+Left
WinMaximize, ahk_exe rpcs3.exe

$Esc::
{
   ;Process, Close, {{{StartupEXE}}}
   WinClose, {{{StartupEXE}}}    ;better method to exit a program
   ;WinClose, ahk_exe rpcs3.exe  ;alternate, direct method to exit a program
}

Adjust the Sleep timer accordingly.

I would prefer a method that wouldn't depend a sleep timer though, as it seems more like a band-aid than a solution here. I might take time contemplating which game to start, and I believe the pre-game-select menu has exclusive features too that I might check out before deciding on one of the games, and other factors can also affect when I select a game.

 

But if there's no better solution than the sleep timer then I'll just have to settle with it.

Edited by Garosath
Link to comment
Share on other sites

9 hours ago, Garosath said:

it seems more like a band-aid than a solution here

Never said it was elegant. Just simple. And it is a solution. ;) 

 

What you're needing to do is wait for a new instance of rpcs3.exe to open and then move that window.  I don't have that game to test with, so now really sure what all it's doing. Window-wise.   You may need to tweak it a little depending on what rpcs3 is actually doing with its windows for your game.

WinWaitActive, ahk_exe rpcs3.exe
WinGet, var, PID, A
Send #+{Left}
WinMaximize

Loop
{
   IfWinActive ahk_exe rpcs3.exe
   WinGet, var2, PID, A
   if var = var2
      Sleep 500
   Else
   {	
      Sleep, 2000      ;give it a sec or two to actually appear (may not be necessary?)
      Send #+{Left}
      WinMaximize, ahk_exe rpcs3.exe
      Break
   }
}

$Esc::Send !{F4}

Depending on how many instances it opens to finally get to the actual game, you may need to add one or more loops to get and compare PID's.

If the "exclusive features" opens yet another instance of rpcs3 windows (as does the game), that'll really screw things up (using the above example script).  But if you go straight to one of the games, you should be OK.  I don't know what the exclusive features actually are, but for me, if I'm putting a game on "the Big Screen", I'm just wanting to play the game. :D

 

If you plan to pop in and out of exclusive features before actually starting a game, that could get messy.  Each instance of rpcs3 you start, you'll need to win+shift+left and maximize.  Between new windows opening up, you need to capture which window instances you've moved/maximized or nest more loops.

 

I think the most straight forward solution might be to set the TV as the primary monitor before starting LaunchBox/BigBox when you want play games on it.  I use a program called Monitor Profile Switcher and created 2 different profiles. One where the arcade cabinet is the Primary monitor and another where the TV is the Primary monitor.  I then created a batch file that will: load the profile for the TV as primary, start BigBox, then when BB exits, loads the cab as primary profile.  No fuss. No muss. No Win+Shift+Left. Ever.

Link to comment
Share on other sites

I tried that script but it didn't work unfortunately :(

I've attached a video of what it looks like currently using that script, maybe it'll be useful.

I tried the "primary monitor" strategy before, but found it tedious to constantly change primary monitor manually depending on what I wanted to do. But the program and batch file solution you proposed sounds interesting, although I have no idea how to set that up.

Link to comment
Share on other sites

If it were me I would be booting directly into the specific game and bypass the whole game selection boot process all together. If you navigate deeper into the game's folder structure you will find additional "*insert game title here*.self" files for the various 3 specific games rather than the one EBOOT.bin you're currently using that brings up the game selection. It will reflect better in your collection since you could list all 3 games in your platform and boot directly to all of them. The couple games I have like this are simply just giving you the ability to select game A, B, or C, so I got no idea what exclusive features you may be alluding to since I too do not have this specific game.

@Garosath If you were to adopt this launching method I've detailed, your script would then work as normal, by theory. The problem you're having is due to the "game selection" game coming up before the "actual" game....it boots the EBOOT.bin file for game selection, and when a game is selected it boots the specific games .self file. My suggestion eliminates the  "game selection" game from booting. What you would have to do is add those 3 specific .self files to the Playstation 3 platform, which I would argue is actually easier since it requires no additional emulator setup or revision to existing scripts. It's no different than setting up any other PS3 game, with the exception you make your ROM file the "game name here".self file instead of the EBOOT.bin file

  • Like 1
Link to comment
Share on other sites

1 hour ago, skizzosjt said:

What you would have to do is add those 3 specific .self files to the Playstation 3 platform, which I would argue is actually easier since it requires no additional emulator setup or revision to existing scripts. 

This worked! And I can just keep the Sly Collection as an added game too if I ever want to access some of its own features like minigames, short films etc. Thanks for the help! 😊

Link to comment
Share on other sites

12 minutes ago, Garosath said:

This worked! And I can just keep the Sly Collection as an added game too if I ever want to access some of its own features like minigames, short films etc. Thanks for the help! 😊

Great! Glad it sorted it out. Do be aware you cannot add these .self files to your game list in the actual RPCS3 emulator, they currently don't allow it. If you ever wanted to boot a .self file directly from the emulator you have to use their File menu and select "Boot (S)Elf". Alternatively you can drag and drop the self/elf file onto the emulator to launch it that way. Otherwise what LB/BB does is using command line and it obviously works that way. So it's kinda sorta lame how the function exists but for whatever reason the RPCS3 devs have restricted this ability to list them in your game list for one reason or another.

This all means you cannot have custom settings for these games booting this way.....because it's not in the game list so cannot be setup. I got around this, and the reason I stumbled on to this, is because I needed specific settings for games like this, I used a script to copy/move config files around prior to launch of the emulator so what it would do is take the custom setting file and put it in place of the main config file (works for controller configs too). Then upon exit of the game, takes a copy of the main config file and puts it copies it back where it normally is. So this way you can get custom settings for each individual game but also keep all your other games working well since the main configs all return to the settings they need. That's all a bit more advanced but wanted to let you know of there is an * asterisk going this route. Best case scenario is you didn't have any special settings required for these games so you wouldn't even noticed it defaults to the main config.

Link to comment
Share on other sites

2 hours ago, skizzosjt said:

Do be aware you cannot add these .self files to your game list in the actual RPCS3 emulator, they currently don't allow it. If you ever wanted to boot a .self file directly from the emulator you have to use their File menu and select "Boot (S)Elf". Alternatively you can drag and drop the self/elf file onto the emulator to launch it that way.

I'll make sure to keep this in mind, although luckily I tend to run all my games directly from LB/BB.

10 hours ago, JoeViking245 said:

I use a program called Monitor Profile Switcher and created 2 different profiles. One where the arcade cabinet is the Primary monitor and another where the TV is the Primary monitor.  I then created a batch file that will: load the profile for the TV as primary, start BigBox, then when BB exits, loads the cab as primary profile.  No fuss. No muss. No Win+Shift+Left. Ever.

I'm also still interested in trying this out, as on rare occasions BB and RetroArch will boot up on the wrong monitor for me, so it would make everything consistent and fluid. Would you be able to share the batch file?

Link to comment
Share on other sites

9 hours ago, Garosath said:

I'm also still interested in trying this out, as on rare occasions BB and RetroArch will boot up on the wrong monitor for me, so it would make everything consistent and fluid. Would you be able to share the batch file?

So you know, I'm the only one that I know of here on the forums that uses "Monitor Profile Switcher" for this purpose.  It's a small simple program that does only what is needed and works perfectly.  A lot of people like using Display Fusion.  Probably because it has a lot of other "bells & whistles", it's frequently updated, and (just guessing) "if you have to pay for it, it must be good".  The views and opinions expressed here are those solely if the author and in no way reflect those of management.

 

1st thing you'll need to do is to download Monitor Profile Switcher and then create/save the profiles for you monitor configurations.  Their Wiki page also describes how to do this.

  • Download the zip file, right click it and select Properties, check Unblock and click OK.
  • Extract the files to somewhere convenient.  i.e. F:\MonitorSwitcher\
  • Start MonitorSwitcherGUI.exe. This will show an icon on your task bar. image.png.c93e4db5527e7d824985f36ddbd7d3f9.png
  • Setup your monitors via Windows Display Settings with your PC as the Primary Monitor (I assume it's that way now).
  • Click the icon and select Save ProfileNew Profile, and name it something you'll remember.  i.e. PC_Primary.
  • Now in Display Setting, set your monitors so that the TV is the Primary Monitor (and any other adjustments you may need to make).
  • Click the icon and select Save ProfileNew Profile, and name it something you'll remember.  i.e. TV_Primary.
    • The 2 profiles you just created will be saved in C:\Users\YourUserName\AppData\Roaming\MonitorSwitcher\Profiles\
  • Now that you monitor settings are all screwed up for working from the PC, click the icon and select PC_Primary. You monitor settings will now be back to your "normal" settings.
  • Click the MonitorSwitcherGUI icon and select Exit.
  • Copy (or move) the 2 'profile' files ("PC_Primary.xml" and "TV_Primary.xml") from where they were saved to where you extracted the files above (F:\MonitorSwitcher\)

2nd thing, create a batch file.

  • In your MonitorSwitcher folder, create a new batch file and name it something you'll remember.  ("BigBoxOnTV.bat")
  • The batch file will something like this:
start /w "" "MonitorSwitcher.exe" -load:TV_Primary.xml
start /w "" "F:\LaunchBox\Core\BigBox.exe"
start "" "MonitorSwitcher.exe" -load:PC_Primary.xml

On lines 1 and 3, change the file name (right after "-load:") to whatever you called them (if different than my example names).

On line 2, change the path to where your LaunchBox is installed ("F:\LaunchBox").  But leave it pointing to "BigBox.exe" that is in the "Core" subfolder.  If you have it point to BigBox.exe that's in LaunchBox's root folder ("F:\LaunchBox\BigBox.exe"), this batch file won't work as intended.

Double click on "BigBoxOnTV.bat" and if all goes well, watch magic happen. :) 

 

Once this is all working as expected, to make the Command Prompt Window not show a 'popup' when you start the batch file, create a shortcut to batch file (in the same folder or somewhere else).  Right click the shortcut and select Properties.  Next to Run:, change it to Minimized and click OK.  Now use the shortcut to start the batch file.

Link to comment
Share on other sites

3 hours ago, JoeViking245 said:

Once this is all working as expected, to make the Command Prompt Window not show a 'popup' when you start the batch file, create a shortcut to batch file (in the same folder or somewhere else).  Right click the shortcut and select Properties.  Next to Run:, change it to Minimized and click OK.  Now use the shortcut to start the batch file.

This worked perfectly! Well almost; I somehow end up with a comically large pointer on my PC monitor after I exit Big Box when it switches back to my PC profile, and I don't know how to get it back to normal. 😰

huge_pointer_2.jpg

huge_pointer_1.jpg

Link to comment
Share on other sites

5 hours ago, Garosath said:

This worked perfectly! Well almost; I somehow end up with a comically large pointer on my PC monitor after I exit Big Box when it switches back to my PC profile

Glad it [almost] worked.  I've never had the comical mouse pointer thing happen.  Do you by chance have your connected TV's "Scale and layout" in the Windows Display Settings set to something ither than 100%?

Link to comment
Share on other sites

17 hours ago, JoeViking245 said:

Glad it [almost] worked.  I've never had the comical mouse pointer thing happen.  Do you by chance have your connected TV's "Scale and layout" in the Windows Display Settings set to something ither than 100%?

That fixed it! My main monitor uses 125% so I set my TV to the same and now it remains the same size. The taskbar on the TV does look microscopic now, but I don't use he TV's taskbar for anything anyway so its no problem.

My setup runs flawlessly now thanks to all the help I've gotten here, so thank you very much! 😁

  • Game On 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...