Skip to content

Commit

Permalink
HACK: Make patcher recognise all filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
lah7 committed Jun 24, 2024
1 parent ee6836e commit 1bb58c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gamefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def __init__(self, path: str):
self.file_path = path
self.backup_path = path + ".bak"
self.meta_path = path + ".patched"
self.game_name = self.get_game_name(path)
self.game_name = "The Sims 2*"
self.name = os.path.basename(path)
self.relative_path = self.file_path.split(self.game_name)[1][1:]
self.relative_path = path

self.backed_up = os.path.exists(self.backup_path)
self.patched = False
Expand All @@ -57,7 +57,7 @@ def get_game_name(self, file_path) -> str:
Identify the game name by going up a directory until we find "filelist.txt",
the root of the game installation, and take the name from this directory.
"""
return "The Sims 2 Ultimate Collection"
return "The Sims 2*"
path = os.path.realpath(file_path)
root_count = len(path.split(os.sep))
while root_count > 2:
Expand Down
8 changes: 4 additions & 4 deletions sims2_4k_ui_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_resource(relative_path):
self.banner_image.pack(side=tk.LEFT, padx=8, pady=8)

# Create group box to select game files
self.groupbox1 = ttk.LabelFrame(self, text="EA Games folder")
self.groupbox1 = ttk.LabelFrame(self, text="Game Folder")
self.groupbox1.pack(padx=8, pady=8, expand=True)
self.input_dir = ttk.Entry(self.groupbox1, width=50)
self.input_dir.grid(column=0, row=0, padx=8, pady=8)
Expand Down Expand Up @@ -200,7 +200,7 @@ def _browse(self):
if os.path.exists(path):
initial_dir = path
break
dirname = filedialog.askdirectory(initialdir=initial_dir, title="Select EA GAMES directory", mustexist=True)
dirname = filedialog.askdirectory(initialdir=initial_dir, title="Select The Sims 2 directory", mustexist=True)

if not dirname:
return
Expand Down Expand Up @@ -231,7 +231,7 @@ def get_all_patchable_files(self) -> list:
"""
files = []
for filename in ["ui.package", "FontStyle.ini", "CaSIEUI.data"]:
files += glob.glob(os.path.join(self.ea_games_dir, "*Sims 2*", f"**/**/TSData/**/{filename}"), recursive=True)
files += glob.glob(f"{self.ea_games_dir}/**/{filename}", recursive=True)
return sorted(list(set(files)))

def refresh_game_status(self):
Expand All @@ -253,7 +253,7 @@ def refresh_game_status(self):
# Make sure we have a valid game directory
if not patch_list:
messagebox.showerror("Wrong folder selected", "No installation of The Sims 2 (or its expansion packs) was found in this folder.")
self.set_status_bar_text("Missing EA Games Folder")
self.set_status_bar_text("Missing Game Folder")
return

# Gather list of game files
Expand Down

0 comments on commit 1bb58c9

Please sign in to comment.