diff --git a/.gitignore b/.gitignore index 5f6f8a1..9e7860c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -release/* *.cache *.pbo texHeaders.bin @@ -9,10 +8,11 @@ Thumbs.db *.sqfc *.exe -## Added by HEMTT +#### HEMTT hemtt hemtt.exe -releases/* -keys/* +release/ +releases/ +keys/ .hemttout/ #### diff --git a/.hemtt/project.toml b/.hemtt/project.toml index 1447967..6455091 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -34,3 +34,8 @@ preset = "Hemtt" [hemtt.release] folder = "Metis_Marker" + +[hemtt.launch.default] +workshop = [ + "450814997", # CBA_A3's Workshop ID +] diff --git a/.vscode/settings.json b/.vscode/settings.json index 0796667..540f6d6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,9 +22,15 @@ }, "search.exclude": { "**/venv": true, + ".hemttout/dev": true, + ".hemttout/build": true, + ".hemttout/release": true, }, "explorer.autoRevealExclude": { - "**/venv": true + "**/venv": true, + ".hemttout/dev": true, + ".hemttout/build": true, + ".hemttout/release": true, }, "sqf.enableACE3": false, "sqf.enableCBA": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bef2126..dd4a1e4 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ "detail": "Build Arma addon with HEMTT in debug mode.", "type": "process", "command": "hemtt", - "args": ["build"], + "args": ["dev"], "group": "build", "presentation": { "close": true, diff --git a/build.bat b/build.bat index 34e67d1..d82070d 100644 --- a/build.bat +++ b/build.bat @@ -1,3 +1,3 @@ @echo off -hemtt build +hemtt dev pause diff --git a/tools/setup.py b/tools/setup.py deleted file mode 100644 index 03c3717..0000000 --- a/tools/setup.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 - -######################## -# Metis Setup Script # -######################## - -import os -import sys -import shutil -import platform -import subprocess -import winreg - -######## GLOBALS ######### -MAINDIR = "z" -PROJECTDIR = "mts" -CBA = "P:\\x\\cba" -########################## - -def main(): - FULLDIR = "{}\\{}".format(MAINDIR,PROJECTDIR) - print(""" - ####################################### - # Metis Development Environment Setup # - ####################################### - - This script will create your Metis dev environment for you. - - Before you run this, you should already have: - - The Arma 3 Tools installed properly via Steam - - A properly set up P-drive - - If you have not done those things yet, please abort this script in the next step and do so first. - - This script will create two hard links on your system, both pointing to your Metis project folder: - [Arma 3 installation directory]\\{} => Metis project folder - P:\\{} => Metis project folder - - It will also copy the required CBA includes to {}, if you do not have the CBA source code already.""".format(FULLDIR,FULLDIR,CBA)) - print("\n") - - try: - reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) - key = winreg.OpenKey(reg, - r"SOFTWARE\Wow6432Node\bohemia interactive\arma 3") - armapath = winreg.EnumValue(key,1)[1] - except: - print("Failed to determine Arma 3 Path.") - return 1 - - if not os.path.exists("P:\\"): - print("No P-drive detected.") - return 2 - - scriptpath = os.path.realpath(__file__) - projectpath = os.path.dirname(os.path.dirname(scriptpath)) - - print("# Detected Paths:") - print(" Arma Path: {}".format(armapath)) - print(" Project Path: {}".format(projectpath)) - - repl = input("\nAre these correct? (y/n): ") - if repl.lower() != "y": - return 3 - - print("\n# Creating links ...") - - if os.path.exists("P:\\{}\\{}".format(MAINDIR,PROJECTDIR)): - print("Link on P: already exists. Please finish the setup manually.") - return 4 - - if os.path.exists(os.path.join(armapath, MAINDIR, PROJECTDIR)): - print("Link in Arma directory already exists. Please finish the setup manually.") - return 5 - - try: - if not os.path.exists("P:\\{}".format(MAINDIR)): - os.makedirs("P:\\{}".format(MAINDIR)) - if not os.path.exists(os.path.join(armapath, MAINDIR)): - os.makedirs(os.path.join(armapath, MAINDIR)) - - subprocess.call(["cmd", "/c", "mklink", "/J", "P:\\{}\\{}".format(MAINDIR,PROJECTDIR), projectpath]) - subprocess.call(["cmd", "/c", "mklink", "/J", os.path.join(armapath, MAINDIR, PROJECTDIR), projectpath]) - except: - raise - print("Something went wrong during the link creation. Please finish the setup manually.") - return 6 - - print("# Links created successfully.") - - - print("\n# Copying required CBA includes ...") - - if os.path.exists(CBA): - print("{} already exists, skipping.".format(CBA)) - return -1 - - try: - shutil.copytree(os.path.join(projectpath, "include", "x", "cba"), CBA) - except: - raise - print("Something went wrong while copying CBA includes. Please copy include\\x\\cba to {} manually.".format(CBA)) - return 7 - - print("# CBA includes copied successfully to {}.".format(CBA)) - - return 0 - - -if __name__ == "__main__": - exitcode = main() - - if exitcode > 0: - print("\nSomething went wrong during the setup. Make sure you run this script as administrator. If these issues persist, please follow the instructions on the Metis wiki to perform the setup manually.") - else: - print("\nSetup successfully completed.") - - input("\nPress enter to exit ...") - sys.exit(exitcode) diff --git a/tools/setup_filepatching_links.py b/tools/setup_filepatching_links.py new file mode 100644 index 0000000..83f3d36 --- /dev/null +++ b/tools/setup_filepatching_links.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 + +######################## +# Metis Setup Script # +######################## + +import os +import sys +import winreg +import _winapi + +######## GLOBALS ######### +MAINDIR = "z" +PROJECTDIR = "mts" +########################## + +def main(): + FULLDIR = f"{MAINDIR}\\{PROJECTDIR}" + print(f""" + ####################################### + # Metis Development Environment Setup # + ####################################### + + This script will create your Metis dev environment for you. + + Before you run this, you should already have: + - The Arma 3 Tools installed properly via Steam + - A properly set up P-drive + + If you have not done those things yet, please abort this script in the next step and do so first. + + This script will create two hard links on your system, both pointing to your Metis project folder: + [Arma 3 installation directory]\\{FULLDIR} => Metis project HEMTT dev build folder + P:\\{FULLDIR} => Metis project HEMTT dev build folder""") + print("\n") + + try: + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + key = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\bohemia interactive\arma 3") + armapath = winreg.EnumValue(key,1)[1] + except: + print("Failed to determine Arma 3 Path.") + return 2 + + if not os.path.exists("P:\\"): + print("No P-drive detected.") + return 3 + + scriptpath = os.path.realpath(__file__) + projectpath = os.path.dirname(os.path.dirname(scriptpath)) + devpath = os.path.join(projectpath, '.hemttout', 'dev') + + print("# Detected Paths:") + print(f" Arma path: {armapath}") + print(f" Project path: {projectpath}") + print(f" HEMTT dev build path: {devpath}") + + repl = input("\nAre these correct? (y/n): ") + if repl.lower() != "y": + return 4 + + print("\n# Creating links ...") + try: + os.makedirs(devpath, exist_ok=True) + + if not os.path.exists(os.path.join("P:", MAINDIR, PROJECTDIR)): + os.makedirs(os.path.join("P:", MAINDIR), exist_ok=True) + _winapi.CreateJunction(devpath, os.path.join("P:", MAINDIR, PROJECTDIR)) + else: + print("Link on P: already exists. Skipping it.") + + if not os.path.exists(os.path.join(armapath, MAINDIR, PROJECTDIR)): + os.makedirs(os.path.join(armapath, MAINDIR), exist_ok=True) + _winapi.CreateJunction(devpath, os.path.join(armapath, MAINDIR, PROJECTDIR)) + else: + print("Link in Arma directory already exists. Skipping it.") + except: + print("Something went wrong during the link creation. Please finish the setup manually.") + raise + + print("# Links created successfully.") + + return 0 + + +if __name__ == "__main__": + exitcode = main() + + if exitcode > 0: + print("\nSomething went wrong during the setup. If these issues persist, please follow the instructions on the Metis wiki to perform the setup manually.") + else: + print("\nSetup successfully completed.") + + sys.exit(exitcode)