update:修复单独打补丁失败的bug
This commit is contained in:
@@ -430,20 +430,29 @@ class MainWindow(QMainWindow):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
def download_setting(self, url, game_folder, game_version, _7z_path, plugin_path):
|
def download_setting(self, url, game_folder, game_version, _7z_path, plugin_path):
|
||||||
game_exe = {
|
# 修改游戏可执行文件路径获取方式
|
||||||
|
game_exe_paths = {
|
||||||
game: os.path.join(
|
game: os.path.join(
|
||||||
self.selected_folder, info["install_path"].split("/")[0], info["exe"]
|
self.selected_folder,
|
||||||
|
info["install_path"].split("/")[0],
|
||||||
|
info["exe"]
|
||||||
)
|
)
|
||||||
for game, info in GAME_INFO.items()
|
for game, info in GAME_INFO.items()
|
||||||
}
|
}
|
||||||
# 判断游戏是否存在,不存在则跳过
|
|
||||||
if (
|
# 检查游戏是否存在
|
||||||
game_version not in game_exe
|
if not os.path.exists(game_exe_paths.get(game_version, "")):
|
||||||
or not os.path.exists(game_exe[game_version])
|
QMessageBox.warning(
|
||||||
or self.installed_status[game_version]
|
self,
|
||||||
):
|
f"通知 {APP_NAME}",
|
||||||
self.installed_status[game_version] = False
|
f"\n未找到 {game_version} 游戏主程序,跳过安装\n"
|
||||||
self.show_result()
|
)
|
||||||
|
self.next_download_task()
|
||||||
|
return
|
||||||
|
|
||||||
|
# 如果已经安装则跳过
|
||||||
|
if self.installed_status[game_version]:
|
||||||
|
self.next_download_task()
|
||||||
return
|
return
|
||||||
|
|
||||||
progress_window = ProgressWindow(self)
|
progress_window = ProgressWindow(self)
|
||||||
@@ -509,14 +518,48 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def pre_hash_compare(self, install_path, game_version, plugin_hash):
|
def pre_hash_compare(self, install_path, game_version, plugin_hash):
|
||||||
msg_box = self.hash_manager.hash_pop_window()
|
msg_box = self.hash_manager.hash_pop_window()
|
||||||
self.hash_manager.cfg_pre_hash_compare(
|
QApplication.processEvents()
|
||||||
install_path, game_version, plugin_hash, self.installed_status
|
|
||||||
|
# 检查游戏可执行文件是否存在
|
||||||
|
game_exe = os.path.join(
|
||||||
|
self.selected_folder,
|
||||||
|
GAME_INFO[game_version]["install_path"].split("/")[0],
|
||||||
|
GAME_INFO[game_version]["exe"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not os.path.exists(game_exe):
|
||||||
|
self.installed_status[game_version] = False
|
||||||
|
msg_box.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
# 检查补丁文件
|
||||||
|
if not os.path.exists(install_path):
|
||||||
|
self.installed_status[game_version] = False
|
||||||
|
msg_box.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
file_hash = self.hash_manager.hash_calculate(install_path)
|
||||||
|
if file_hash == plugin_hash[game_version]:
|
||||||
|
self.installed_status[game_version] = True
|
||||||
|
else:
|
||||||
|
reply = msgbox_frame(
|
||||||
|
f"文件校验 {APP_NAME}",
|
||||||
|
f"\n检测到 {game_version} 的文件哈希值不匹配,是否重新安装?\n",
|
||||||
|
QMessageBox.Yes | QMessageBox.No,
|
||||||
|
).exec()
|
||||||
|
if reply == QMessageBox.Yes:
|
||||||
|
self.installed_status[game_version] = False
|
||||||
|
else:
|
||||||
|
self.installed_status[game_version] = True
|
||||||
|
|
||||||
msg_box.close()
|
msg_box.close()
|
||||||
|
|
||||||
def download_action(self):
|
def download_action(self):
|
||||||
install_paths = self.get_install_paths()
|
install_paths = self.get_install_paths()
|
||||||
for game_version, install_path in install_paths.items():
|
|
||||||
|
# 独立检查每个游戏的安装状态
|
||||||
|
for game_version in GAME_INFO:
|
||||||
|
install_path = install_paths[game_version]
|
||||||
self.pre_hash_compare(install_path, game_version, PLUGIN_HASH)
|
self.pre_hash_compare(install_path, game_version, PLUGIN_HASH)
|
||||||
|
|
||||||
config = self.get_download_url()
|
config = self.get_download_url()
|
||||||
@@ -526,29 +569,14 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# 处理1-4卷
|
for game_version in GAME_INFO:
|
||||||
for i in range(1, 5):
|
|
||||||
game_version = f"NEKOPARA Vol.{i}"
|
|
||||||
if not self.installed_status[game_version]:
|
if not self.installed_status[game_version]:
|
||||||
url = config[f"vol{i}"]
|
config_key = "after" if game_version == "NEKOPARA After" else f"vol{game_version.split('.')[1]}"
|
||||||
game_folder = os.path.join(self.selected_folder, f"NEKOPARA Vol. {i}")
|
url = config[config_key]
|
||||||
_7z_path = os.path.join(PLUGIN, f"vol.{i}.7z")
|
game_folder = os.path.join(self.selected_folder, game_version.replace("Vol.", "Vol. "))
|
||||||
plugin_path = os.path.join(
|
_7z_path = os.path.join(PLUGIN, f"{config_key}.7z")
|
||||||
PLUGIN, GAME_INFO[game_version]["plugin_path"]
|
plugin_path = os.path.join(PLUGIN, GAME_INFO[game_version]["plugin_path"])
|
||||||
)
|
|
||||||
self.download_queue.append(
|
|
||||||
(url, game_folder, game_version, _7z_path, plugin_path)
|
|
||||||
)
|
|
||||||
|
|
||||||
# 处理After
|
|
||||||
game_version = "NEKOPARA After"
|
|
||||||
if not self.installed_status[game_version]:
|
|
||||||
url = config["after"]
|
|
||||||
game_folder = os.path.join(self.selected_folder, "NEKOPARA After")
|
|
||||||
_7z_path = os.path.join(PLUGIN, "after.7z")
|
|
||||||
plugin_path = os.path.join(
|
|
||||||
PLUGIN, GAME_INFO[game_version]["plugin_path"]
|
|
||||||
)
|
|
||||||
self.download_queue.append(
|
self.download_queue.append(
|
||||||
(url, game_folder, game_version, _7z_path, plugin_path)
|
(url, game_folder, game_version, _7z_path, plugin_path)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user