Skip to content

Commit 7b31d43

Browse files
authored
Merge pull request #70 from OpenGOAL-Mods/hfrag-fix2
fix hfrag hack
2 parents 7f2f4d1 + 7d28eb6 commit 7b31d43

File tree

1 file changed

+24
-70
lines changed

1 file changed

+24
-70
lines changed

utils/launcherUtils.py

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -249,78 +249,32 @@ def ensure_jak_folders_exist():
249249
os.makedirs(jak3_path)
250250
print(f"Created 'jak3' folder at {jak3_path}")
251251

252-
253-
#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
252+
#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
254253
def getHfragVert(path):
255-
decompiler_exe = "hfrag.vert"
256-
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe
257-
258-
# Check if the decompiler exists in the provided path
259-
if os.path.exists(os.path.join(path, decompiler_exe)):
260-
print(f"Found {decompiler_exe} in the directory.")
261-
return
262-
else:
263-
# Check if the backup decompiler exists
264-
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
265-
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
266-
print(f"{decompiler_exe} downloaded successfully as backup.")
267-
while not os.path.exists(os.path.join(path, decompiler_exe)):
268-
time.sleep(1) # Wait for the download to complete
269-
270-
decompiler_exe = "hfrag_montage.frag"
271-
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe
272-
273-
274-
# Check if the decompiler exists in the provided path
275-
if os.path.exists(os.path.join(path, decompiler_exe)):
276-
print(f"Found {decompiler_exe} in the directory.")
277-
return
278-
else:
279-
# Check if the backup decompiler exists
280-
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
281-
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
282-
print(f"{decompiler_exe} downloaded successfully as backup.")
283-
while not os.path.exists(os.path.join(path, decompiler_exe)):
284-
time.sleep(1) # Wait for the download to complete
285-
286-
decompiler_exe = "hfrag_montage.vert"
287-
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe
288-
289-
290-
# Check if the decompiler exists in the provided path
291-
if os.path.exists(os.path.join(path, decompiler_exe)):
292-
print(f"Found {decompiler_exe} in the directory.")
293-
return
294-
else:
295-
# Check if the backup decompiler exists
296-
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
297-
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
298-
print(f"{decompiler_exe} downloaded successfully as backup.")
299-
while not os.path.exists(os.path.join(path, decompiler_exe)):
300-
time.sleep(1) # Wait for the download to complete
301-
302-
decompiler_exe = "hfrag.frag"
303-
decompiler_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/"+decompiler_exe
304-
305-
# Check if the decompiler exists in the provided path
306-
if os.path.exists(os.path.join(path, decompiler_exe)):
307-
print(f"Found {decompiler_exe} in the directory.")
308-
return
309-
else:
310-
# Check if the backup decompiler exists
311-
print(f"Couldn't find {decompiler_exe} in the directory or backup. Downloading it...")
312-
urllib.request.urlretrieve(decompiler_url, os.path.join(path, decompiler_exe))
313-
print(f"{decompiler_exe} downloaded successfully as backup.")
314-
while not os.path.exists(os.path.join(path, decompiler_exe)):
315-
time.sleep(1) # Wait for the download to complete
316-
317-
return
318-
319-
320-
321-
322-
254+
hfrag_base_url = "https://raw.githubusercontent.com/open-goal/jak-project/master/game/graphics/opengl_renderer/shaders/"
255+
hfrag_shaders = [
256+
"hfrag.vert",
257+
"hfrag_montage.frag",
258+
"hfrag_montage.vert",
259+
"hfrag.frag"
260+
]
323261

262+
for shader in hfrag_shaders:
263+
hfrag_url = hfrag_base_url + shader
264+
265+
# Check if the decompiler exists in the provided path
266+
if os.path.exists(os.path.join(path, shader)):
267+
print(f"Found {shader} in the directory.")
268+
continue
269+
else:
270+
# Check if the backup decompiler exists
271+
print(f"Couldn't find {shader} in the directory or backup. Downloading it...")
272+
urllib.request.urlretrieve(hfrag_url, os.path.join(path, shader))
273+
274+
while not os.path.exists(os.path.join(path, shader)):
275+
time.sleep(1) # Wait for the download to complete
276+
277+
print(f"{shader} downloaded successfully as backup.")
324278

325279
def launch_local(MOD_ID, GAME):
326280
try:

0 commit comments

Comments
 (0)