Created
August 7, 2024 20:25
-
-
Save sgtlaggy/42b8c3db6d4b922ce9dea207b75ee91d to your computer and use it in GitHub Desktop.
Symlink Tarkov and SPT installs to save space when testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script requires Python 3.11 or later | |
Put it in a directory alongside a folder named `meta`, it should have a structure like the following: | |
├── newlink.py | |
└── meta | |
├── game | |
│ └── 14.1.2.29197 | |
│ ├── EscapeFromTarkov_Data | |
│ ├── EscapeFromTarkov.exe | |
│ ├── MonoBleedingEdge | |
│ ├── NLog | |
│ └── UnityPlayer.dll | |
├── spt | |
│ └── SPT-3.8.0-29197-2dd4d91 | |
│ ├── Aki_Data | |
│ ├── Aki.Launcher.exe | |
│ ├── Aki.Server.exe | |
│ ├── BepInEx | |
│ ├── doorstop_config.ini | |
│ ├── EscapeFromTarkov_Data | |
│ ├── LICENSE-BEPINEX.txt | |
│ ├── LICENSE-ConfigurationManager.txt | |
│ ├── LICENSE-Launcher.txt | |
│ ├── LICENSE-Modules.txt | |
│ ├── LICENSE-Server.txt | |
│ ├── user | |
│ └── winhttp.dll | |
└── sptSettings | |
├── Control.ini | |
├── Game.ini | |
├── Graphics.ini | |
├── PostFx.ini | |
└── Sound.ini | |
The only names that matter are `meta`, `game`, `spt`, and `sptSettings` | |
The folders in `game` should contain patched versions of EFT without SPT installed. | |
The folders in `spt` should contain extracted SPT releases. | |
`sptSettings` should be copied from an existing install's `user` folder. | |
This will optionally be linked so all installs share the same graphics and keybind settings. | |
If using this, select "No" when the launcher asks to copy settings from Live. | |
The new instance will be created next to the `meta` folder. | |
Note when using this script editing files in `SPT_Data/Server/configs` will affect all installs. | |
It's recommended to use server mods to edit those instead. | |
Copyright 2024 sgtlaggy | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
""" | |
from pathlib import Path | |
THIS_DIR = Path(__file__).parent | |
META_DIR = THIS_DIR / 'meta' | |
GAME_VERSIONS = tuple(p for p in (META_DIR / 'game').iterdir() if p.is_dir()) | |
SPT_VERSIONS = tuple(p for p in (META_DIR / 'spt').iterdir() if p.is_dir()) | |
SETTINGS_DIR = META_DIR / 'sptSettings' | |
def recursive_link(base: Path, dest: Path): | |
for fp in base.rglob('*'): | |
if fp.is_dir(): | |
continue | |
rel = fp.relative_to(base) | |
target = dest / rel | |
symlink(target, fp) | |
def symlink(link: Path, dest: Path): | |
link.parent.mkdir(parents=True, exist_ok=True) | |
link.symlink_to(dest) | |
def do_link(game: Path, spt: Path, instance: Path): | |
print("Linking game...") | |
recursive_link(game, instance) | |
print("Linking SPT...") | |
recursive_link(spt, instance) | |
print("Done!") | |
if __name__ == '__main__': | |
try: | |
print('Game versions:', *(f'{n}. {ver.name}' for n, ver in enumerate(GAME_VERSIONS, start=1)), sep='\n') | |
while True: | |
try: | |
game_index = int(input('> ')) | |
if 1 <= game_index <= len(GAME_VERSIONS): | |
game = GAME_VERSIONS[game_index - 1] | |
break | |
except ValueError: | |
pass | |
print('Invalid value.') | |
print('SPT versions:', *(f'{n}. {ver.name}' for n, ver in enumerate(SPT_VERSIONS, start=1)), sep='\n') | |
while True: | |
try: | |
spt_index = int(input('> ')) | |
if 1 <= spt_index <= len(SPT_VERSIONS): | |
spt = SPT_VERSIONS[spt_index - 1] | |
break | |
except ValueError: | |
pass | |
print('Invalid value.') | |
while True: | |
loc = input('New instance name > ') | |
instance = THIS_DIR / loc | |
if instance.exists(): | |
print('Instance already exists.') | |
else: | |
break | |
do_link(game, spt, instance) | |
while True: | |
link_settings = input('Link game settings? (Y/n) > ').lower() or 'y' | |
if link_settings[0] in {'y', 'n'}: | |
link_settings = link_settings[0] == 'y' | |
break | |
if link_settings: | |
symlink(instance / 'user' / 'sptSettings', SETTINGS_DIR) | |
print('Click "No" when the launcher asks to import settings from live.') | |
except KeyboardInterrupt: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment