Skip to content

Commit

Permalink
Functionality improvement
Browse files Browse the repository at this point in the history
Update wt_to_5 converter
Started GUI creation
  • Loading branch information
AddyMills committed May 19, 2023
1 parent 80507b8 commit 0316e19
Show file tree
Hide file tree
Showing 27 changed files with 72,727 additions and 605 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ output/
scratchpad/
build/
dist/
test*/
tofix*
*.mid
midqb_gen/midqb_gen*/
midqb_gen/PAK Folders*/
midqb_gen/PAK Compile*/
pak_extract/pak_extract*/
pak_extract/Input*/
pak_extract/Decompressed PAKs*/
Expand All @@ -28,4 +33,5 @@ dbg_*.py
compile-exe.bat
Reaper Gen/
tofix.txt
*.pyproj
*.pyproj
libmp3lame*
19 changes: 19 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 38 additions & 11 deletions GH Toolkit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import os.path
import sys
import traceback
import re

from toolkit_functions import *

from random import randint
from create_audio import audio_functions

debug = 0

Expand Down Expand Up @@ -47,7 +50,12 @@ def manual_input():
mid_file = input(
"Drag in your mid file (make sure the name of the file is the internal name of your custom): ").replace(
"\"", "")
output_mid_gh3(mid_file)

output = f'{os.path.dirname(mid_file)}'
pak_file, filename = output_mid_gh3(mid_file)

with open(f"{output}\\{filename}_song.pak.xen", 'wb') as f:
f.write(pak_file)
input("Done! Press Enter to go back to the Main Menu. ")
elif main_menu == 2:
pak_file = input("Drag in your PAK file: ").replace("\"", "")
Expand Down Expand Up @@ -145,15 +153,24 @@ def print_instructions():
print(f"{x}")
return

def launch_gui(ghproj = ""):
root_folder = os.path.realpath(os.path.dirname(__file__))
sys.path.append(f"{root_folder}\\gui")
from gui import toolkit_gui
toolkit_gui.open_gui(sys.argv, proj_file = ghproj)


if __name__ == "__main__":
if len(sys.argv) == 1:
print("Guitar Hero III Tools\n")
launch_gui()
'''print("Guitar Hero III Tools\n")
begin_mode = input("No argument detected, did you want to use beginner mode? (Y/N) ")
if begin_mode[0].lower() == "y":
manual_input()
else:
print_instructions()
print_instructions()'''
elif sys.argv[1].endswith(".ghproj"):
launch_gui(ghproj = sys.argv[1])
else:
try:
root_folder = os.path.realpath(os.path.dirname(__file__))
Expand Down Expand Up @@ -243,11 +260,11 @@ def print_instructions():
if "_song.pak" in midqb_file.lower():
if "output" not in locals():
output = f'{os.path.dirname(midqb_file)}'
if "newname" not in locals():
new_name = f"dlc{randint(10000,1000000000)}"
pak_data = convert_to_5(midqb_file, new_name)
pak_file = mid_qb.pakMaker([[x["file_data"], x["file_name"]] for x in pak_data], new_name)
with open(output + f'\\b{new_name}_song.pak.xen', 'wb') as f:
if "pak_name" not in locals():
pak_name = f"dlc{randint(10000,1000000000)}"
pak_data = convert_to_5(midqb_file, pak_name)
pak_file = mid_qb.pakMaker([[x["file_data"], x["file_name"]] for x in pak_data], pak_name)
with open(output + f'\\b{pak_name}_song.pak.xen', 'wb') as f:
f.write(pak_file)

elif sys.argv[1] == "compile_pak":
Expand Down Expand Up @@ -307,9 +324,19 @@ def print_instructions():
elif sys.argv[1] == "extract_fsb":
if "output" not in locals():
output = f'{os.path.dirname(input_file)}'
with open(sys.argv[2], "rb") as f:
fsbpath = sys.argv[2]
dat = b''
with open(fsbpath, "rb") as f:
fsb = f.read()
fsb_ext = audio_functions.extract_fsb(fsb)
if ".fsb" in fsbpath:
datpath = f"{fsbpath[:fsbpath.find('.fsb')]}.dat.xen"
if os.path.isfile(datpath):
with open(datpath, 'rb') as f:
dat = f.read()
filename = os.path.basename(fsbpath)
if re.search(r'^[a-c]dlc', filename, flags=re.IGNORECASE):
filename = filename[1:]
fsb_ext = audio_functions.extract_fsb(fsb, filename, datfile = dat)
for key, value in fsb_ext.items():
output_file = os.path.join(output, key)
with open(output_file, 'wb') as f:
Expand Down
2 changes: 2 additions & 0 deletions compile-folder.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyinstaller -p "D:\GitHub\Guitar-Hero-III-Tools\create_audio" -p D:\GitHub\Guitar-Hero-III-Tools\midqb_gen -p D:\GitHub\Guitar-Hero-III-Tools\pak_extract -p D:\GitHub\Guitar-Hero-III-Tools\ska_switcher -p D:\GitHub\Guitar-Hero-III-Tools -p "D:\GitHub\Guitar-Hero-III-Tools\gui" --add-data "debug.txt;." --add-data "conversion_files;conversion_files" "GH Toolkit.py"
pause
1 change: 1 addition & 0 deletions compile-onefile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyinstaller -p "D:\GitHub\Guitar-Hero-III-Tools\create_audio" -p D:\GitHub\Guitar-Hero-III-Tools\midqb_gen -p D:\GitHub\Guitar-Hero-III-Tools\pak_extract -p D:\GitHub\Guitar-Hero-III-Tools\ska_switcher -p D:\GitHub\Guitar-Hero-III-Tools --onefile --add-data "debug.txt;." --add-data "conversion_files;conversion_files" "GH Toolkit.py"
Loading

0 comments on commit 0316e19

Please sign in to comment.