{"record":{"id":"c5cf13a1ba40b70c","repo":"babalae/better-genshin-impact","slug":"16-9-c5cf13","errorCode":null,"errorMessage":"游戏窗口分辨率不是 16:9","messagePattern":"游戏窗口分辨率不是 16:9","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Helpers/AssertUtils.cs","lineNumber":29,"sourceCode":"    {\n        if (!b)\n        {\n            throw new System.Exception(msg);\n        }\n    }\n    \n    \n    /// <summary>\n    /// 强制要求游戏分辨率检查\n    /// 要求功能必须处于启用状态\n    /// </summary>\n    public static void CheckGameResolution(string msg = \"\")\n    {\n        var gameScreenSize = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);\n        if (gameScreenSize.Width * 9 != gameScreenSize.Height * 16)\n        {\n            TaskControl.Logger.LogError(\"游戏窗口分辨率不是 16:9 ！当前分辨率为 {Width}x{Height} , 非 16:9 分辨率的游戏无法正常使用{Msg}功能 !\", gameScreenSize.Width, gameScreenSize.Height, msg);\n            throw new Exception(\"游戏窗口分辨率不是 16:9\");\n        }\n    }\n}","sourceCodeStart":11,"sourceCodeEnd":32,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Helpers/AssertUtils.cs#L11-L32","documentation":"A generic Exception from AssertUtils.CheckGameResolution thrown when the game window's screen rect does not satisfy a 16:9 aspect ratio (width*9 != height*16). Genshin Impact automation relies on template matching and coordinate math tuned for 16:9, so non-conforming resolutions are rejected to avoid misbehavior. A LogError is emitted before the throw.","triggerScenarios":"Calling CheckGameResolution (directly or via a feature that asserts it) when the game window has a non-16:9 client area, e.g. ultrawide 21:9, 4:3, a windowed custom size, or a resolution with black bars/scaled client area.","commonSituations":"Running the game in ultrawide or non-standard windowed mode; DPI scaling or letterboxing distorting the reported client rect; the game set to a resolution like 1600x900 vs 1366x768 that is 16:9 but the window chrome skews GetGameScreenRect.","solutions":["Set the game to a 16:9 resolution (e.g. 1920x1080, 1600x900, 1280x720) in windowed or borderless mode.","Disable OS-level DPI scaling overrides for the game so the client rect is accurate.","Ensure no letterboxing/black bars are present inside the window.","Re-run the feature once the window reports a 16:9 client area."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"var rect = SystemControl.GetGameScreenRect(TaskContext.Instance().GameHandle);\nif (rect.Width * 9 != rect.Height * 16) { /* prompt user to set 16:9; do not proceed */ }","typeGuard":"static bool IsSixteenNine(SystemControl.RECT r) => r.Width * 9 == r.Height * 16;","tryCatchPattern":"try { AssertUtils.CheckGameResolution(\"自动战斗\"); }\ncatch (Exception ex) { Toast.Warning(ex.Message); return; }","preventionTips":["Run Genshin at a 16:9 resolution (1920x1080, 1600x900, 1280x720).","Disable DPI scaling overrides for the game.","Avoid letterboxed/ultrawide modes."],"tags":["precondition","resolution","game-window","assertion"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}