Author Topic: Automatic Game Launcher for 7th Heaven  (Read 7375 times)

Jdbye

  • *
  • Posts: 3
    • View Profile
Automatic Game Launcher for 7th Heaven
« on: 2019-06-16 03:26:16 »
I wrote this today for my own use and after lots of debugging and testing it tens of times it seems to work flawlessly, so I'm releasing it here.

It's just a simple AutoIt script that does the following:
Mounts FF7DISC1.ISO (placed in the main game directory) using Windows 10's built in ISO mounting feature.
Launches 7th Heaven (this should be in a folder called "7thHeaven" inside the main game folder)
Sets the disc drive letter in the registry to the correct one where the ISO was mounted, as this can change when using the built in ISO mounting as there is no set drive letter.
And finally, it presses the "Launch Game" button.
It stays running in the background, once the game is closed, it will automatically close 7th Heaven and exit. It can also be changed slightly so that 7th Heaven is closed shortly after the game is launched, but the script needs to stay running in the background for Steam In-Home Streaming not to think the game has closed and close the stream.
Once the game closes it will unmount the ISO automatically.

If you use Steam In-Home Streaming (Remote Play) please add the /stream launch option to the launch parameters of the shortcut. This will make a window appear that prevents the streaming client from timing out in the beginning because it doesn't get any video. Without this, streaming didn't seem to work.
Steam will have to be ran as Administrator when using In-Home Streaming, as otherwise it can't get access to the game to emulate a keyboard/mouse/controller. If you use a controller with In-Home Streaming you may have to map it to keyboard keys in Steam Big Picture (make sure Generic Gamepad Support is enabled to be able to set per game controller mappings) and then configure the game to use the same keys, like I had to, since the game isn't compatible with XInput. I did this on the client side, but if you have the launcher added as a non-steam game, you may not be able to do it on the client side and you may need to actually launch Big Picture in the streaming client to set controller mappings on the host (I haven't tried this, so I don't know if that would even work)

The way I use it is, I have this launcher named as FF7_Launcher.exe in place of the original Steam FF7 launcher, and I have ff7_bc.exe named as ff7_en.exe (use ff7.exe/ff7_mo.exe instead if you don't use Beacause) in place of the original game executable, this way I can launch the game normally through Steam and it automatically launches with my mods enabled. This also has the benefit of letting me close the streaming client and resume streaming mid-game if the client crashes or otherwise messes up, when added as a non-steam game it would instead try to launch the game a second time when resuming the stream. Also remember that you need to change the FF7 executable path in 7th Heaven itself to match this if you rename the files.
But it should also work by just adding it as a non-steam game, you may have issues if you want to use in-home streaming though, since Steam doesn't really detect the game properly when it's added as a non-steam game. I haven't tested this much though so it may work fine with in-home streaming.

NOTE: If you are on x86 and not x64, you will have to change one thing.
This line:
Code: [Select]
if not RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Square Soft, Inc.\Final Fantasy VII", "DataDrive", "REG_SZ", $drive & "\") then ; write drive letter to registryShould be changed to this:
Code: [Select]
if not RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Square Soft, Inc.\Final Fantasy VII", "DataDrive", "REG_SZ", $drive & "\") then ; write drive letter to registry
Download (Source code and compiled exe included): https://www.dropbox.com/s/bk7ij7036b3l768/Launch_v0.1.rar?dl=0
It should be placed in the main game directory, along with FF7DISC1.ISO and a "7thHeaven" folder containing 7th Heaven.
« Last Edit: 2019-06-17 00:23:10 by Jdbye »

EQ2Alyza

  • 7th Heaven Crew
  • Global moderator
  • *
  • Posts: 3200
  • Dilly-Dally Shilly-Shally
    • View Profile
    • EQ2Alyza - YouTube Channel
Re: Automatic Game Launcher for 7th Heaven
« Reply #1 on: 2019-06-16 12:02:07 »
Thank you for this. If it unmounts the ISO a few seconds after launch, the game won't recognize FF7DISC1 during the disc changes. That'll need to be addressed somehow.

Jdbye

  • *
  • Posts: 3
    • View Profile
Re: Automatic Game Launcher for 7th Heaven
« Reply #2 on: 2019-06-17 00:22:21 »
Thank you for this. If it unmounts the ISO a few seconds after launch, the game won't recognize FF7DISC1 during the disc changes. That'll need to be addressed somehow.
I thought it unmounted a few seconds after launch (that's how I had it originally as it seemed to work), but the unmounting is actually at the end of the script, after the game is closed down, so it shouldn't be an issue.
Originally, I didn't have it wait for the game to close before running the cleanup, but that caused issues with In-Home Streaming, so I guess adding that change fixed another issue I didn't even know about. :)

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: Automatic Game Launcher for 7th Heaven
« Reply #3 on: 2019-06-17 16:48:27 »
There are a few CMD commands iros has added because I asked him for a way to automatically start the game with 7H active.

Code: [Select]
v1.41
-Can list multiple programs for 'Also Launch' in config
-Fix crash when corrupt .iro file is in 7H folder - should show a proper error message
-Add some more command line parameters

There are some command line parameters you can use with 7H:

/PROFILE:<profilename>  - loads a particular profile
/LAUNCH - launches FF7 as soon as 7H is loaded
/QUIT - quits 7H

They happen in the order you list them so:
7thHeaven.exe /LAUNCH /QUIT
will launch the game and then exit straight away.
7thHeaven.exe /PROFILE:AllMods /LAUNCH
will load the AllMods profile, launch the game, but not quit 7H.
« Last Edit: 2019-06-17 17:14:33 by Kaldarasha »

Jdbye

  • *
  • Posts: 3
    • View Profile
Re: Automatic Game Launcher for 7th Heaven
« Reply #4 on: 2019-06-25 20:29:48 »
Thanks. I looked for something like that, but couldn't find anything. It would have made the script a lot simpler :P
I'll change the script when I have time.

ARC-TIC

  • *
  • Posts: 1
    • View Profile
Re: Automatic Game Launcher for 7th Heaven
« Reply #5 on: 2023-08-02 06:45:10 »
Sorry for necro-ing this thread but I keep getting the error "Failure to launch 7th Heaven: 1 2" when trying to use it.