Skip to content

Commit

Permalink
fix: cmd error
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Mar 12, 2024
1 parent 280b4fd commit b0a56c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 8 additions & 0 deletions assets/docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# 更新日志

## v2.0.6

### 新功能
- 在 “完整运行” 清体力前增加一次 “委托奖励检测” [#171](https://github.com/moesnow/March7thAssistant/pull/171)
### 修复
- 部分用户报错 “'cmd' 不是内部或外部命令...” 导致无法启动游戏
- 部分分辨率全屏状态判断异常 [#183](https://github.com/moesnow/March7thAssistant/pull/183)

## v2.0.5

### 新功能
Expand Down
5 changes: 0 additions & 5 deletions tasks/reward/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,13 @@ def __init__(self):
def check_and_collect_rewards(self):
log.hr("开始领取奖励", 0)

flag = False
for reward_type, (image_path, confidence) in self.reward_mapping.items():
if self._find_reward(image_path, confidence):
flag = True
self.reward_instances[reward_type].start()
else:
reward_name = self._get_reward_name(reward_type)
log.info(f"未检测到{reward_name}奖励")

if not flag:
log.info("未检测到任何奖励")

log.hr("完成", 2)

def check_and_collect_specific_reward(self, reward_type):
Expand Down
3 changes: 2 additions & 1 deletion update.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def run(self):
self.cover_folder()
self.cleanup()
input("按回车键退出并打开软件")
os.system(f'cmd /c start "" "{os.path.abspath("./March7th Launcher.exe")}"')
if not os.system(f'cmd /c start "" "{os.path.abspath("./March7th Launcher.exe")}"'):
subprocess.Popen(os.path.abspath("./March7th Launcher.exe"))


def check_temp_dir_and_run():
Expand Down
8 changes: 8 additions & 0 deletions utils/gamecontroller.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import time
import psutil
import subprocess
import win32gui
import ctypes
from typing import Literal, Tuple, Optional
Expand Down Expand Up @@ -46,6 +47,13 @@ def start_game(self) -> bool:
return True
else:
self.log_error("启动游戏时发生错误")
try:
# 为什么有的用户环境变量内没有cmd呢?
subprocess.Popen(self.game_path)
self.log_info(f"游戏启动:{self.game_path}")
return True
except Exception as e:
self.log_error(f"启动游戏时发生错误:{e}")
return False

@staticmethod
Expand Down

0 comments on commit b0a56c0

Please sign in to comment.