Skip to content

Instantly share code, notes, and snippets.

@martynassateika
Created August 31, 2019 16:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martynassateika/29d8a6b7b8dde377b5c2669354ff3c0f to your computer and use it in GitHub Desktop.
Save martynassateika/29d8a6b7b8dde377b5c2669354ff3c0f to your computer and use it in GitHub Desktop.
Updates SCL files under Splinter Cell's /maps directory to enable thermal vision in all levels.
"""Updates SCL files under Splinter Cell's /maps directory to enable thermal vision in all levels.
The game introduces thermal vision goggles in level 5 "CIA HQ". Game files of earlier levels all have a
"bNoThermalAvailable" flag defined. Simply updating the name of the flag disables it and does not seem
to cause any crashes.
To update the files, run the script with the location of the game directory as an argument. You can also
use the '--dry-run' flag to see which files will be updated.
Example:
python 01_enable_thermal_vision.py "<...>\Tom Clancys Splinter Cell" --dry-run
> 0_0_2_Training.scl: - Has value, not updating (using dry-run)
> 0_0_3_Training.scl: Has value, not updating (using dry-run)
> ...
python 01_enable_thermal_vision.py "<...>\Tom Clancys Splinter Cell"
> 0_0_2_Training.scl: Updated
> 0_0_2_Training.scl: Updated
> ...
Written by Martynas Sateika, 2019
"""
import argparse
from os import listdir
from os.path import join, isfile
def get_maps(maps_dir):
return [f for f in listdir(maps_dir) if isfile(join(maps_dir, f)) and f.endswith('.scl')]
def update_file(maps_dir, scl_file_name, dry_run):
full_path = join(maps_dir, scl_file_name)
file_original = open(full_path, "rb").read()
file_updated = file_original.replace(b'bNoThermalAvailable', b'bNoThermalAvailabl0')
if file_original == file_updated:
print('> {name}: No change'.format(name=scl_file_name))
else:
if dry_run:
print('> {name}: Has value, not updating (using dry-run)'.format(name=scl_file_name))
else:
with open(full_path, 'wb') as f:
f.write(file_updated)
print('> {name}: Updated'.format(name=scl_file_name))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Enable thermal vision in all maps in Splinter Cell 1')
parser.add_argument('game_dir', type=str, help='game location')
parser.add_argument('--dry-run', dest='dry_run', action='store_true')
parser.set_defaults(dry_run=False)
args = parser.parse_args()
game_maps_dir = join(args.game_dir, 'maps')
game_maps = get_maps(game_maps_dir)
for game_map in game_maps:
update_file(game_maps_dir, game_map, args.dry_run)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment