Skip to content

Commit

Permalink
Fixed config not reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenochxd committed Mar 23, 2024
1 parent 3d2aaeb commit 0506cf1
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions join_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
config_path = "../config.json"
if os.path.exists("config.json"):
config_path = "config.json"

with open(config_path, encoding="utf-8") as f:
config = json.load(f)
config["emu"] = config["emu"].lower()

def reload_config():
with open(config_path, encoding="utf-8") as f:
config = json.load(f)
config["emu"] = config["emu"].lower()
return config

config = reload_config()

class GlobalContainer:
global_variable = None
Expand Down Expand Up @@ -58,6 +62,7 @@ def showError(message):
ctypes.windll.user32.MessageBoxW(None, message, "JigglyConnect Error", 0)

def yuzu_ready():
config = reload_config()
found = False
windows = gw.getAllWindows()

Expand Down Expand Up @@ -94,23 +99,22 @@ def focus_yuzu_window():
return False

def focus_yuzu():
print('1')
if not config["emu"] in gw.getActiveWindow().title.lower():
print('2')
windows = gw.getAllWindows()

for window in windows:
title = window.title.lower()
if "yuzu" in title and not "yuzu 1" in title:
try:
window.activate() # Focus window
except gw.PyGetWindowException:
pass
win32gui.ShowWindow(window._hWnd, 9) # Restore window if minimized
pyautogui.press("esc")
return focus_yuzu_window()

return True
if config["emu"] in gw.getActiveWindow().title.lower():
return True

windows = gw.getAllWindows()

for window in windows:
title = window.title.lower()
if "yuzu" in title and not "yuzu 1" in title:
try:
window.activate() # Focus window
except gw.PyGetWindowException:
pass
win32gui.ShowWindow(window._hWnd, 9) # Restore window if minimized
pyautogui.press("esc")

return focus_yuzu_window()

def focus_webview():
windows = gw.getAllWindows()
Expand Down

0 comments on commit 0506cf1

Please sign in to comment.