Skip to content

Commit

Permalink
fix: resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Mar 8, 2024
1 parent eb275ff commit 98feea5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions assets/docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- 多个红点导致模拟宇宙领取每周奖励失败
- 快速解锁教学动画导致虚构叙事异常
- 主页三月七背景在高缩放率下模糊的问题
- 某启动器修改分辨率注册表项后会导致注册表读取错误

## v2.0.4

Expand Down
10 changes: 6 additions & 4 deletions utils/registry/star_rail_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ def get_game_resolution() -> Optional[Tuple[int, int, bool]]:
value = read_registry_value(winreg.HKEY_CURRENT_USER, registry_key_path, resolution_value_name)
if value:
data_dict = json.loads(value.decode('utf-8').strip('\x00'))
# Convert keys to lower case to ensure case-insensitivity
data_dict = {k.lower(): v for k, v in data_dict.items()}

# Validate data format
if 'width' in data_dict and 'height' in data_dict and 'isFullScreen' in data_dict:
if isinstance(data_dict['width'], int) and isinstance(data_dict['height'], int) and isinstance(data_dict['isFullScreen'], bool):
return data_dict['width'], data_dict['height'], data_dict['isFullScreen']
# Validate data format with case-insensitive keys
if 'width' in data_dict and 'height' in data_dict and 'isfullscreen' in data_dict:
if isinstance(data_dict['width'], int) and isinstance(data_dict['height'], int) and isinstance(data_dict['isfullscreen'], bool):
return data_dict['width'], data_dict['height'], data_dict['isfullscreen']
else:
raise ValueError("Registry data is invalid: width, height, and isFullScreen must be of type int, int, and bool respectively.")
else:
Expand Down

0 comments on commit 98feea5

Please sign in to comment.