Skip to content

Instantly share code, notes, and snippets.

@Infernio
Created May 14, 2023 13:32
Show Gist options
  • Save Infernio/f20c5793ae6daad2667e213ab61af56a to your computer and use it in GitHub Desktop.
Save Infernio/f20c5793ae6daad2667e213ab61af56a to your computer and use it in GitHub Desktop.
Python script I use for launching xEdit on Linux via protontricks
#!/bin/python
import os
import subprocess
import sys
# Map xEdit game ID to Steam App ID
GAMES = {
'tes3': 22320,
'tes4': 22330,
'tes5': 72850,
'tes5vr': 611670,
'sse': 489830,
'enderal': 933480,
'enderalse': 976620,
'fo3': 22370, # TODO what about 22300?
'fnv': 22380,
'fo4': 377160,
'fo76': 1151340,
}
def main():
if len(sys.argv) < 2:
usage()
game = sys.argv[1].lower()
try:
steam_id = GAMES[game]
except KeyError:
usage()
# You will have to adjust this to fit where you install xEdit!
xedit_path = os.path.join(os.path.expanduser('~'), 'Downloads', 'xEdit', 'xEdit.exe')
subprocess.run('/usr/bin/protontricks -c '
f'"wine {xedit_path} -IKnowWhatImDoing -{game} {sys.argv[2:]}" '
f'{steam_id}', shell=True)
def usage():
print('Syntax: xedit <game> [extra args]', file=sys.stderr)
print('Valid games are:')
for game in GAMES:
print(f' - {game}')
sys.exit(1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment