babalae/better-genshin-impact · error · Exception

游戏窗口分辨率不是 16:9 !无法使用地图追踪功能!

Error message

游戏窗口分辨率不是 16:9 !无法使用地图追踪功能!

What it means

Thrown by PathExecutor.LogScreenResolution when the game window's captured rect does not have a 16:9 aspect ratio (gameScreenSize.Width * 9 != gameScreenSize.Height * 16). Map tracking depends on 16:9 coordinate assumptions, so a different ratio is rejected outright.

Source

Thrown at BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs:393

        return true;
    }

    private void InitializePathing(PathingTask task)
    {
        LogScreenResolution();
        InitHurryOnConfig();
        WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(this,
            "UpdateCurrentPathing", new object(), task));
    }

    private void LogScreenResolution()
    {
        var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
        if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)
        {
            Logger.LogError("游戏窗口分辨率不是 16:9 !当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏无法正常使用地图追踪功能!",
                gameScreenSize.Width, gameScreenSize.Height);
            throw new Exception("游戏窗口分辨率不是 16:9 !无法使用地图追踪功能!");
        }

        if (gameScreenSize.Width < 1920 || gameScreenSize.Height < 1080)
        {
            Logger.LogError("游戏窗口分辨率小于 1920x1080 !当前分辨率为 {Width}x{Height} , 小于 1920x1080 的分辨率的游戏地图追踪的效果非常差!",
                gameScreenSize.Width, gameScreenSize.Height);
            throw new Exception("游戏窗口分辨率小于 1920x1080 !无法使用地图追踪功能!");
        }
    }

    /// <summary>
    /// 切换队伍
    /// </summary>
    /// <param name="partyName"></param>
    /// <returns></returns>
    private async Task<bool> SwitchParty(string? partyName)
    {
        bool success = true;

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Set the game to a 16:9 resolution (1920x1080, 2560x1440, 3840x2160) in fullscreen or borderless.
  2. If windowed, resize the window so the client area is exactly 16:9.
  3. Disable DPI scaling overrides that distort the captured rect.
  4. Avoid ultrawide resolutions for map-tracking tasks.
Defensive patterns

Strategy: validation

Validate before calling

var rect = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);
if (rect.Width * 9 != rect.Height * 16)
{
    throw new InvalidOperationException($"游戏窗口分辨率非 16:9 ({rect.Width}x{rect.Height}),请设置为 1920x1080 等 16:9 分辨率");
}

Type guard

static bool Is16by9(System.Drawing.Size s) => s.Width * 9 == s.Height * 16;

Prevention

When it happens

Trigger: SystemControl.GetGameScreenRect(handle) returns a rect whose W*9 != H*16 — e.g. a windowed or borderless size like 2560x1080, 3440x1440, or a non-standard client area.

Common situations: Ultrawide/4:3 monitor; windowed mode resized to a non-16:9 size; DPI/border miscalculation making the client rect non-16:9.

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/e307d1438735442e. Report an issue: GitHub.