babalae/better-genshin-impact · error · Exception
游戏窗口分辨率不是 16:9
Error message
游戏窗口分辨率不是 16:9
What it means
Generic Exception from AutoStygianOnslaughtTask.LogScreenResolution when the game client rect is not 16:9 (width*9 != height*16). Unlike the PathExecutor variant, this one hard-fails on aspect ratio alone (the <1920x1080 branch only warns). The combat CV scripts assume a 16:9 frame for Q/E/burst icon localization.
Source
Thrown at BetterGenshinImpact/GameTask/AutoStygianOnslaught/AutoStygianOnslaughtTask.cs:812
LogScreenResolution();
if (_taskParam.SpecifyResinUse)
{
Logger.LogInformation("→ {Text} 指定使用树脂", $"{Name},");
}
else
{
Logger.LogInformation("→ {Text} 用尽所有浓缩树脂和原粹树脂后结束", $"{Name},");
}
}
private void LogScreenResolution()
{
var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
{
Logger.LogError("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height}",
gameScreenSize.Width, gameScreenSize.Height);
throw new Exception("游戏窗口分辨率不是 16:9");
}
if (gameScreenSize.Width < 1920 || gameScreenSize.Height < 1080)
{
Logger.LogWarning("游戏窗口分辨率小于 1920x1080 !当前分辨率为 {Width}x{Height}",
gameScreenSize.Width, gameScreenSize.Height);
}
}
private async Task<CombatScenes> InitializeCombatScenesLoop()
{
CombatScenes? result = null;
var found = await NewRetry.WaitForAction(() =>
{
result = new CombatScenes().InitializeTeam(CaptureToRectArea());
return result.CheckTeamInitialized();
}, _ct, 10, 500);
View on GitHub (pinned to a7cb36712d)
Solutions
- Set Genshin Impact to a 16:9 resolution (1920x1080, 2560x1440, 3840x2160, etc.).
- On ultrawide displays, use a 16:9 fullscreen resolution with black bars rather than the native aspect.
- Avoid manually resizing the windowed client; restore default size.
- Confirm display scaling is 100% if the rect is being DPI-skewed.
Defensive patterns
Strategy: validation
Validate before calling
var r = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
if (r.Width * 9 != r.Height * 16)
return Result.Fail($"分辨率 {r.Width}x{r.Height} 非 16:9,斯根斯特赖特任务不可用"); Try / catch
try { StartStygianTask(); }
catch (Exception e) when (e.Message.Contains("16:9"))
{ /* prompt user to switch to a 16:9 resolution */ } Prevention
- Surface the 16:9 requirement in the task's UI before launch.
- Detect ultrawide/windowed-non-16:9 and warn the user up front.
- Gate combat CV tasks behind the same resolution preflight as pathing.
When it happens
Trigger: Game running at an ultrawide (21:9) or 4:3 resolution; windowed mode with a non-standard aspect; letterboxed/pillarboxed client rect; multi-monitor span. SystemControl.GetGameScreenRect returns the raw GetClientRect so any non-16:9 window trips it.
Common situations: Ultrawide monitor user; game set to a 16:10 or 5:4 resolution; windowed mode resized by the user; DPI mismatch producing a slightly off client rect.
Related errors
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/68cd7d6ac8b87c7b.
Report an issue: GitHub.