Skip to content

Commit

Permalink
Merge pull request #70 from OpenGOAL-Mods/hfrag-fix2
Browse files Browse the repository at this point in the history
fix hfrag hack
  • Loading branch information
dallmeyer authored May 24, 2024
2 parents 7f2f4d1 + 7d28eb6 commit 7b31d43
Showing 1 changed file with 24 additions and 70 deletions.
94 changes: 24 additions & 70 deletions utils/launcherUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,78 +249,32 @@ def ensure_jak_folders_exist():
os.makedirs(jak3_path)
print(f"Created 'jak3' folder at {jak3_path}")


#check if we have decompiler in the path, if not check if we have a backup, if so use it, if not download a backup then use it
#check if we have hfrag shaders in the path, if not check if we have a backup, if so use it, if not download a backup then use it
def getHfragVert(path):
decompiler_exe = "hfrag.vert"
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe

# Check if the decompiler exists in the provided path
if os.path.exists(os.path.join(path, decompiler_exe)):
print(f"Found {decompiler_exe} in the directory.")
return
else:
# Check if the backup decompiler exists
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
print(f"{decompiler_exe} downloaded successfully as backup.")
while not os.path.exists(os.path.join(path, decompiler_exe)):
time.sleep(1) # Wait for the download to complete

decompiler_exe = "hfrag_montage.frag"
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe


# Check if the decompiler exists in the provided path
if os.path.exists(os.path.join(path, decompiler_exe)):
print(f"Found {decompiler_exe} in the directory.")
return
else:
# Check if the backup decompiler exists
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
print(f"{decompiler_exe} downloaded successfully as backup.")
while not os.path.exists(os.path.join(path, decompiler_exe)):
time.sleep(1) # Wait for the download to complete

decompiler_exe = "hfrag_montage.vert"
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe


# Check if the decompiler exists in the provided path
if os.path.exists(os.path.join(path, decompiler_exe)):
print(f"Found {decompiler_exe} in the directory.")
return
else:
# Check if the backup decompiler exists
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
print(f"{decompiler_exe} downloaded successfully as backup.")
while not os.path.exists(os.path.join(path, decompiler_exe)):
time.sleep(1) # Wait for the download to complete

decompiler_exe = "hfrag.frag"
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe

# Check if the decompiler exists in the provided path
if os.path.exists(os.path.join(path, decompiler_exe)):
print(f"Found {decompiler_exe} in the directory.")
return
else:
# Check if the backup decompiler exists
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
print(f"{decompiler_exe} downloaded successfully as backup.")
while not os.path.exists(os.path.join(path, decompiler_exe)):
time.sleep(1) # Wait for the download to complete

return





hfrag_base_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/shaders/"
hfrag_shaders = [
"hfrag.vert",
"hfrag_montage.frag",
"hfrag_montage.vert",
"hfrag.frag"
]

for shader in hfrag_shaders:
hfrag_url = hfrag_base_url + shader

# Check if the decompiler exists in the provided path
if os.path.exists(os.path.join(path, shader)):
print(f"Found {shader} in the directory.")
continue
else:
# Check if the backup decompiler exists
print(f"Couldn't find {shader} in the directory or backup. Downloading it...")
urllib.request.urlretrieve(hfrag_url, os.path.join(path, shader))

while not os.path.exists(os.path.join(path, shader)):
time.sleep(1) # Wait for the download to complete

print(f"{shader} downloaded successfully as backup.")

def launch_local(MOD_ID, GAME):
try:
Expand Down

0 comments on commit 7b31d43

Please sign in to comment.