Compare commits

...

4 commits

Author SHA1 Message Date
6ce883eac2 Remove default options in extract script
Signed-off-by: William Brawner <me@wbrawner.com>
2021-06-08 07:53:09 -06:00
d619b92504 Make extract script executable on unix
Signed-off-by: William Brawner <me@wbrawner.com>
2021-06-08 07:51:51 -06:00
5c366d1f02 Load directory paths from environment if present
Signed-off-by: William Brawner <me@wbrawner.com>
2021-06-07 21:26:14 -06:00
cb17043e41 Add "assume yes" option to extraction script
Signed-off-by: William Brawner <me@wbrawner.com>
2021-06-07 08:46:15 -06:00

41
scripts/extract.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The reone project contributors # Copyright (c) 2020-2021 The reone project contributors
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -21,26 +22,28 @@ TODO: support case sensitive paths (Unix)
import glob import glob
import os import os
import shutil import shutil
import sys
from reo_shared import * from reo_shared import *
game_dir = r"D:\Games\Star Wars - KotOR" game_dir = os.getenv("REONE_GAME_DIR")
tools_dir = r"D:\Source\reone\build\bin\RelWithDebInfo" tools_dir = os.getenv("REONE_TOOLS_DIR")
extract_dir = r"D:\OpenKotOR\Extract\KotOR" extract_dir = os.getenv("REONE_EXTRACT_DIR")
nwnnsscomp_dir = r"D:\OpenKotOR\Tools\DeNCS" nwnnsscomp_dir = os.getenv("REONE_NWNNSSCOMP_DIR")
steps = [ steps = [
["extract_bifs", "Extract BIF files (y/n)?", None], ["extract_bifs", "Extract BIF files (y/n)?"],
["extract_patch", "Extract patch.erf (y/n)?", None], ["extract_patch", "Extract patch.erf (y/n)?"],
["extract_modules", "Extract modules (y/n)?", None], ["extract_modules", "Extract modules (y/n)?"],
["extract_dialog", "Extract dialog.tlk (y/n)?", None], ["extract_dialog", "Extract dialog.tlk (y/n)?"],
["extract_textures", "Extract texture packs (y/n)?", None], ["extract_textures", "Extract texture packs (y/n)?"],
["extract_voices", "Extract streamwaves/streamvoices (y/n)?", None], ["extract_voices", "Extract streamwaves/streamvoices (y/n)?"],
["extract_lips", "Extract LIP files (y/n)?", None], ["extract_lips", "Extract LIP files (y/n)?"],
["convert_to_json", "Convert 2DA, GFF, TLK and LIP to JSON (y/n)?", None], ["convert_to_json", "Convert 2DA, GFF, TLK and LIP to JSON (y/n)?"],
["convert_to_tga", "Convert TPC to TGA/TXI (y/n)?", None], ["convert_to_tga", "Convert TPC to TGA/TXI (y/n)?"],
["convert_to_ascii_pth", "Convert binary PTH to ASCII PTH (y/n)?", None], ["convert_to_ascii_pth", "Convert binary PTH to ASCII PTH (y/n)?"],
["disassemble_scripts", "Disassemble NCS scripts (y/n)?", None] ] ["disassemble_scripts", "Disassemble NCS scripts (y/n)?"]
]
def extract_bifs(game_dir, extract_dir): def extract_bifs(game_dir, extract_dir):
@ -219,12 +222,10 @@ if not is_valid_extract_dir(extract_dir):
if not is_valid_extract_dir(extract_dir): if not is_valid_extract_dir(extract_dir):
exit(1) exit(1)
assume_yes = len(sys.argv) > 1 and sys.argv[1] == '-y'
for step in steps: for step in steps:
if step[2] is None: run = assume_yes or input(step[1] + " ").lower()[0] == 'y'
choice = input(step[1] + " ")
run = choice.lower()[0] == 'y'
else:
run = step[2]
if run: if run:
if step[0] == "extract_bifs": if step[0] == "extract_bifs":