Skip to content

Commit

Permalink
Fix Cheat canvas background
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLastBreath committed Oct 18, 2024
1 parent c5c9af4 commit 003f8ba
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
66 changes: 32 additions & 34 deletions src/modules/FrontEnd/FrontEnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ def __init__(Manager, window):

# Load Canvas
# Load_ImagePath(Manager)
Manager.load_canvas()
Manager.Create_Canvases()

log.warning(f"Emulator {Manager.mode}")
Manager.switchmode()
Manager.ForceGameBG()

# Window protocols
Manager._window.protocol(
Expand All @@ -118,6 +119,16 @@ def __init__(Manager, window):
def warning(Manager, e):
messagebox.showwarning(f"{e}")

def ForceGameBG(Manager):
# Change Name and Load Image.
Manager.ChangeName()

for canvas in Manager.all_canvas:
Canvas_Create.Change_Background_Image(
canvas,
os.path.join(Manager._patchInfo.Folder, "image.jpg"),
)

def LoadNewGameInfo(Manager):
"""Loads new Game info from the combobox (dropdown Menu)."""
for item in Manager.patches:
Expand All @@ -131,6 +142,7 @@ def LoadNewGameInfo(Manager):
Manager.DeletePatches()
Manager.LoadPatches(Manager.all_canvas[0], pos_dict)
Manager.toggle_pages("main")
Manager.ForceGameBG()

# Save the selected game in the config file and load options for that game.
save_config_game(Manager, Manager.config)
Expand Down Expand Up @@ -243,13 +255,6 @@ def LoadPatches(Manager, canvas, pos_dict):
continue
Manager.UserChoices[name] = patch_var

# Change Name and Load Image.
Manager.ChangeName()
Canvas_Create.Change_Background_Image(
Manager.all_canvas[0],
os.path.join(Manager._patchInfo.Folder, "image.jpg"),
)

def DeletePatches(Manager):
Manager.UserChoices.clear()
Manager.all_canvas[0].delete("patchinfo")
Expand Down Expand Up @@ -549,9 +554,6 @@ def appdata():
load_user_choices(Manager, Manager.config)
return Manager.maincanvas

def update_scaling_variable(Manager, something=None):
Manager.fps_var.set(Manager.fps_var_new.get())

def select_Legacy_exe(Manager):
if Manager.os_platform == "Windows":
Legacy_path = filedialog.askopenfilename(
Expand Down Expand Up @@ -613,11 +615,29 @@ def select_Legacy_exe(Manager):
save_user_choices(Manager, Manager.config, Legacy_path)
return Legacy_path

def Create_Canvases(Manager):
# Main
Manager.create_canvas()
Cheats.CreateCanvas(Manager)
Cheats.Hide()
load_benchmark(Manager)

def show_main_canvas(Manager):
Canvas_Create.is_Ani_Paused = True
Manager.cheatcanvas.pack_forget()
Cheats.Hide()
Manager.maincanvas.pack()

def show_cheat_canvas(Manager):
Canvas_Create.is_Ani_Paused = False
if Manager._patchInfo.Cheats is False:
return

for canvas in Manager.all_canvas:
if canvas is not Cheats.Canvas:
canvas.pack_forget()

Cheats.Show()

def toggle_pages(Manager, ShowPage: str):
Manager.maincanvas.itemconfig(ShowPage, state="normal")

Expand All @@ -630,17 +650,6 @@ def toggle_pages(Manager, ShowPage: str):
else:
button.ToggleImg(WidgetState.Enter)

def show_cheat_canvas(Manager):
Canvas_Create.is_Ani_Paused = False
if Manager._patchInfo.Cheats is False:
return

for canvas in Manager.all_canvas:
if canvas is not Cheats.Canvas:
canvas.pack_forget()

Cheats.Show()

def open_browser(Manager, web, event=None):
url = "https://ko-fi.com/maxlastbreath#"
if web == "Kofi":
Expand All @@ -651,13 +660,6 @@ def open_browser(Manager, web, event=None):
url = "https://discord.gg/7MMv4yGfhM"
webbrowser.open(url)

def load_canvas(Manager):
# Main
Manager.create_canvas()
Cheats.CreateCanvas(Manager)
Cheats.Hide()
load_benchmark(Manager)

def ShowRyujinx(Manager):
Manager.mode = "Ryujinx"
for canvas in Manager.all_canvas:
Expand Down Expand Up @@ -701,10 +703,6 @@ def switchmode(Manager, Force=False):
superlog.info(f"Switched to {Manager.mode}")
FileManager.checkpath(Manager.mode)

def fetch_var(Manager, var, dict, option):
if not dict.get(option, "") == "":
var.set(dict.get(option, ""))

def extract_patches(Manager):
FileManager.is_extracting = True
FileManager.submit()
2 changes: 1 addition & 1 deletion src/modules/FrontEnd/TextureMgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def CreateTexture(
@classmethod
def Initialize(cls):
TextureMgr.CreateTexture(
image_path="image.jpg", width=int(70 * 1.6), height=int(48 * 1.6)
image_path="image.jpg", width=int(1200), height=int(600)
)
TextureMgr.CreateTexture(
image_path="graphics.png", width=int(70 * 1.6), height=int(48 * 1.6)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/GameManager/CheatManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def Cheat_UI_elements(cls, canvas):
canvas.create_image(
0,
0,
anchor="c",
anchor="nw",
image=TextureMgr.Request("image.jpg"),
tags="background",
)
Expand Down
2 changes: 2 additions & 0 deletions src/modules/load_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ def load_UI_elements(manager, canvas: ttk.Canvas):
canvas.create_image(
0, 0, anchor="nw", image=TextureMgr.Request("image.jpg"), tags="background"
)

canvas.create_image(
0,
0,
anchor="nw",
image=TextureMgr.Request("Legacy_BG.png"),
tags="SWITCHOVERLAY",
)

canvas.create_image(
0, 0, anchor="nw", image=TextureMgr.Request("BG_Left_2.png"), tags="overlay"
)
Expand Down

0 comments on commit 003f8ba

Please sign in to comment.