diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50cfc95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +gitignore +env2 +env +*log +*swp +__pycache__/ +config.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3151f55 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +help: + @echo "Elite:Dangerous and Saitek x52/x52Pro helper tool" + @echo " - - - " + @echo "It helps you manage the configurations of both things:" + @echo "deploy - put the files from the repo to the app folders" + @echo "collect - get the files from the app folders to the repo" + +deploy: + python edx52man.py deploy + +collect: + python edx52man.py collect diff --git a/README.md b/README.md index 31f1318..77226c8 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,27 @@ * "X52ProElite v2.2.3.1.8.binds" needs to be copy & pasted into ```"C:\Users\\AppData\Local\Frontier Developments\Elite Dangerous\Options\Bindings"```. * It will show up in the 'Controls' drop down ingame as ```"X52ProElite v2.2.3"```. + +# Using the tool to deploy and collect files + +If you have already python and make, nothing to worry about, just run `make deploy` and `make collect`. + +If you don't have python, install it and put it in the path, or install it and modify the Makefile with the path to your python.exe + +If you don't want to use make, check the Makefile on how to run the script and just do that. + + +# GOTchas when editing profiles + +- the tool is shit. sorry, there is no way to put it softer. is just really bad. having said that, amazing people can get amazing results with it. I struggled. + +- If you change 1 setting, in 1 of the modes, the other 3 will change too. + +- If you want to change a setting, is better to do it first in the profile editor. + + - If you want to change a setting that already has a button, and is assigned in ED, change it in the profile. + + - if it doesn't exist yet, add a key combination there. then go to E:D + +- + diff --git a/X52ProElite v2.2.3.3.0.binds b/X52ProElite v2.2.3.3.0.binds new file mode 100644 index 0000000..565ec69 --- /dev/null +++ b/X52ProElite v2.2.3.3.0.binds @@ -0,0 +1,1449 @@ + + + es-ES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/X52ProEliteV223.pr0 b/X52ProEliteV223.pr0 index 1547e71..fc4bed4 100644 Binary files a/X52ProEliteV223.pr0 and b/X52ProEliteV223.pr0 differ diff --git a/config.py.sample b/config.py.sample new file mode 100644 index 0000000..da2c429 --- /dev/null +++ b/config.py.sample @@ -0,0 +1,44 @@ +# coding: utf-8 +# +# This is a config file, but: +# You probably don't need to modify it, unless you have weird settings, or +# you have some custom setup. Like I do. +# +# In the end, this is just python, so you can do anything you can do in python. +# Some basic rules (if you don't know python: +# - respect the spaces at the start of the line +# - watch out for the little r in front of the folders locations + +################################################################################ +# Your username (Only if differs from the windows name +################################################################################ +import os +username=os.getlogin() # by default will be the one in c:/Users/{here} + +################################################################################ +# Folders +################################################################################ + +# Location of the repository with version control files +source_location = os.path.abspath(os.path.curdir) + +# Profile location of the x52 config tool (Usually in Public user, or your user's Documents) +pr_location=r"C:\Users\Public\Documents\SmartTechnology Profiles" + +# Elite dangerous bindings location (usually within your user's AppData\Local\...) +elite_location=r"C:\Users\{username}\AppData\Local\Frontier Developments\Elite Dangerous\Options\Bindings".format(username=username) + +################################################################################ +# Filenames - This you can customize +################################################################################ + +# Binding filename - usally a fixed string and a version +# filename_binds="X52ProElite v2.2.3.1.8.binds" # old. no longer used in ED Horizons +filename_binds = "X52ProElite v2.2.3.3.0.binds" + +# Profiles filename - the standard one +filename_profile="X52ProEliteV223.pr0" + +# Custom Profile - a different one if you just want to be different, whatever. +filename_profile_custom="X52ProEliteV223{0}.pr0".format("Your_CMDR_name") + diff --git a/edx52man.py b/edx52man.py new file mode 100644 index 0000000..c3b95c6 --- /dev/null +++ b/edx52man.py @@ -0,0 +1,81 @@ +# coding: utf-8 + + +import invoke +import argparse +import os + +from config import source_location, pr_location, elite_location +from config import filename_binds, filename_profile, filename_profile_custom + +# trying to do an installer for the files, with auto retrieve for updates +def locations_exist(): + """verify that all locations are dirs and have the files""" + # TODO: perform this checks on all dirs after initial setup + # this are all the locations for the files. the source, where all lives, and pr and elite where the saitek tool's and elite's folders are. + a = os.path.isdir(source_location) + b = os.path.isdir(pr_location) + c = os.path.isdir(elite_location) + return (a and b and c) + + +def cp(a,b): + """run a copy file from a to b""" + c = invoke.run('cp "{}" "{}" '.format(a,b), warn=True) + return c + + +def deploy_files(): + """put the files in the right places""" + local_profile = os.path.join(source_location, filename_profile) + local_bindings = os.path.join(source_location, filename_binds) + c = cp(local_profile, pr_location) + d = cp(local_bindings, elite_location) + if not c.ok or not d.ok: + print("FAIL: Some shit went wrong on deployment") + return (c.ok and d.ok) + + +def collect_files(): + """get all the files from the deployed locations""" + # oops, we should make sure we are in the right location first of all. + # first get the profile, then the bindings. + profile_path = os.path.join(pr_location,filename_profile) + profile_destiny= os.path.join(source_location, filename_profile) + bindings_path = os.path.join(elite_location, filename_binds) + #TODO: Stash the files before collecting??? + c = invoke.run('cp "{}" "{}"'.format(profile_path, profile_destiny), warn=True) + d = invoke.run('cp "{}" "{}"'.format(bindings_path, source_location), warn=True) + diff = invoke.run("git diff") + if not c.ok or not d.ok: + print("FAIL: Some shit went wrong while copyng files") + return (c.ok and d.ok) + +def check_files(): + """verify that all is good with the files and if they have changes""" + if locations_exist(): + a = invoke.run("git status") + return a.ok + +if __name__=="__main__": + # and then do all the argparse stuff + a = argparse.ArgumentParser(description="manage your ED config files, to make it easier to have your files under version control") + a.add_argument("operation", nargs="?", help="Choose to 'deploy' or 'collect' the files", choices=("deploy","collect","check"), default="check") + # TODO: Add an argument to support a custom name for the settings, with like a nick or something + #a.title="choose to deploy or collect the files modified by E:D or Profile Editor" + + opts = a.parse_args() + + if not locations_exist(): + print("WTF Dude, create the folders you need to work") + #TODO: Have a nicer way of addressing the creation of files and folders, and asking the user. + exit(1) + + perform = { + "deploy":deploy_files, + "collect":collect_files, + "check":check_files, + } + perform[opts.operation]() + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..eb8cba5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +fabric +invoke +ipython