feat: 增加 DWM 被禁用与重复拖动解决方案提示

This commit is contained in:
uye
2026-06-27 12:37:34 +08:00
parent 0239409ef4
commit cdbf31debb
7 changed files with 38 additions and 4 deletions

View File

@@ -1121,11 +1121,24 @@ public class Bootstrapper : Bootstrapper<RootViewModel>
private static void ShowErrorDialog(Exception exception)
{
Application.Current.Dispatcher.Invoke(() => {
// DragDrop.DoDragSourceMove 会导致崩溃,但不需要退出程序
// 这些异常虽然会导致崩溃,但不需要退出程序
// 这是一坨屎,但是没办法,只能这样了
var isDragDropException = exception is COMException && exception.ToString()!.Contains("DragDrop.DoDragSourceMove");
var comEx = exception as COMException;
var shouldExit = !isDragDropException;
var details = exception.ToString();
// DragDrop.DoDragSourceMove 会在拖拽时偶发崩溃
var isDragDropException = comEx != null && details.Contains("DragDrop.DoDragSourceMove");
// DWM 桌面组合被禁用0x80263001通常是瞬时的显卡驱动问题DWM 会自行恢复
// 同时用 HResult 与异常文本双重判断,避免不同 .NET 版本/语言环境下 HRESULT 暴露不一致
const int DwmECompositionDisabled = unchecked((int)0x80263001);
var isDwmCompositionDisabledException = comEx != null &&
(comEx.HResult == DwmECompositionDisabled ||
details.Contains("Desktop composition is disabled") ||
details.Contains("0x80263001"));
var shouldExit = !isDragDropException && !isDwmCompositionDisabledException;
var errorView = new ErrorDialogView(exception, shouldExit);
errorView.ShowDialog();

View File

@@ -1165,6 +1165,8 @@ Right-click to clear inactive jobs</system:String>
<system:String x:Key="ErrorSolutionUpdatePackageExtractionFailed">Failed to extract the update package. Please try restarting MAA.exe first. If the issue persists, restart your computer and try again. Do not extract the update package manually, as this may skip necessary file deletions.</system:String>
<system:String x:Key="ErrorSolutionReplaceAdb">Please retry after shutting down the emulator and killing ADB. Otherwise, restart your computer, then run MAA as administrator without opening the emulator, finally retry it.</system:String>
<system:String x:Key="ErrorSolutionFailedToMove">The file is occupied, please restart the computer and try again.</system:String>
<system:String x:Key="ErrorSolutionDesktopCompositionDisabled">This is usually caused by a transient graphics driver issue that disables DWM desktop composition. MAA will try to keep running. If the UI displays abnormally, please restart MAA manually, and check/update your graphics driver.</system:String>
<system:String x:Key="ErrorSolutionDragDrop">This is usually an occasional crash caused by repeated dragging while a drag operation is in progress. It does not affect functionality and can be ignored. If it happens frequently, please avoid repeated dragging during the operation.</system:String>
<system:String x:Key="ErrorSolutionSelectDefaultBrowser">Open link failure, please go to 「Windows Settings」 and select the default browser.</system:String>
<system:String x:Key="ErrorFeedbackLinkText">Create a GitHub issue</system:String>
<system:String x:Key="ErrorQqGroupLinkText">Join QQ Group</system:String>

View File

@@ -1166,6 +1166,8 @@ C:\\leidian\\LDPlayer9
<system:String x:Key="ErrorSolutionUpdatePackageExtractionFailed">アップデートパッケージの解凍に失敗しました。まずは MAA.exe の再起動をお試しください。問題が解決しない場合は、PC を再起動して再度お試しください。必要なファイルの削除が行われない可能性があるため、手動で解凍しないでください。</system:String>
<system:String x:Key="ErrorSolutionReplaceAdb">エミュレータとADBを閉じるか、コンピューターを再起動してから、管理者権限でMAAを開いて操作してください。</system:String>
<system:String x:Key="ErrorSolutionFailedToMove">ファイルが占有されています。コンピュータを再起動して再試行してください。</system:String>
<system:String x:Key="ErrorSolutionDesktopCompositionDisabled">これは通常、グラフィックスドライバの一時的な問題により DWM デスクトップ合成が無効化されたことによるものです。MAA は実行を継続しようとします。UI の表示に異常がある場合は MAA を手動で再起動し、グラフィックスドライバの確認と更新を行ってください。</system:String>
<system:String x:Key="ErrorSolutionDragDrop">これは通常、ドラッグ操作の進行中に繰り返しドラッグしたことによる偶発的なクラッシュです。機能には影響せず、無視できます。頻繁に発生する場合は、操作中の繰り返しドラッグを避けてください。</system:String>
<system:String x:Key="ErrorSolutionSelectDefaultBrowser">リンクを開けませんでした。Windows 設定に移動してデフォルトのブラウザを選択してください。</system:String>
<system:String x:Key="ErrorFeedbackLinkText">GitHub issueを作成する</system:String>
<system:String x:Key="ErrorQqGroupLinkText">QQグループに入ります</system:String>

View File

@@ -1167,6 +1167,8 @@ C:\\leidian\\LDPlayer9
<system:String x:Key="ErrorSolutionUpdatePackageExtractionFailed">업데이트 패키지 압축 해제에 실패했습니다. 먼저 MAA.exe를 재시작해 보세요. 문제가 계속되면 컴퓨터를 재부팅한 후 다시 시도해 주세요. 필수 파일 삭제가 누락될 수 있으므로 수동으로 압축을 해제하지 마세요.</system:String>
<system:String x:Key="ErrorSolutionReplaceAdb">에뮬레이터와 ADB를 종료하거나 컴퓨터를 재시작하고 관리자 권한으로 MAA를 실행해 주세요.</system:String>
<system:String x:Key="ErrorSolutionFailedToMove">파일이 사용 중입니다. 컴퓨터를 재시작한 후 다시 시도하세요.</system:String>
<system:String x:Key="ErrorSolutionDesktopCompositionDisabled">이는 일반적으로 그래픽 드라이버의 일시적인 문제로 인해 DWM 데스크톱 합성이 비활성화된 것입니다. MAA는 계속 실행을 시도합니다. UI가 비정상적으로 표시되면 MAA를 수동으로 다시 시작하고, 그래픽 드라이버를 확인하고 업데이트하세요.</system:String>
<system:String x:Key="ErrorSolutionDragDrop">이는 일반적으로 드래그 조작이 진행 중일 때 반복적으로 드래그하여 발생한 우발적인 크래시입니다. 기능에 영향을 주지 않으며 무시해도 됩니다. 자주 발생한다면 조작 중 반복 드래그를 피해 주세요.</system:String>
<system:String x:Key="ErrorSolutionSelectDefaultBrowser">링크 열기 실패. 「Windows 설정」으로 이동하여 기본 브라우저를 선택하세요.</system:String>
<system:String x:Key="ErrorFeedbackLinkText">GitHub에 issue 생성</system:String>
<system:String x:Key="ErrorQqGroupLinkText">QQ 그룹 가입</system:String>

View File

@@ -1166,6 +1166,8 @@ C:\\leidian\\LDPlayer9。\n
<system:String x:Key="ErrorSolutionUpdatePackageExtractionFailed">解压更新包失败。建议先尝试重新启动 MAA.exe如仍无法解决请重启电脑后再试。请勿手动解压更新包以免遗漏必要的文件删除操作。</system:String>
<system:String x:Key="ErrorSolutionReplaceAdb">请 「关闭模拟器与 ADB」 或 「重启电脑后在未开启模拟器的情况下使用管理员权限打开 MAA」 后进行操作。</system:String>
<system:String x:Key="ErrorSolutionFailedToMove">文件被占用,请重启电脑后重试。</system:String>
<system:String x:Key="ErrorSolutionDesktopCompositionDisabled">这通常是显卡驱动瞬时异常导致 DWM 桌面组合不可用,程序将尝试继续运行。如果界面显示异常,请手动重启 MAA并建议检查并更新显卡驱动。</system:String>
<system:String x:Key="ErrorSolutionDragDrop">这通常是在拖拽操作进行过程中重复拖动导致的偶发崩溃,不影响功能,可忽略。如频繁出现,请避免在拖拽过程中重复操作。</system:String>
<system:String x:Key="ErrorSolutionSelectDefaultBrowser">打开链接失败,请前往 「Windows 设置」 选择默认浏览器。</system:String>
<system:String x:Key="ErrorFeedbackLinkText">创建 GitHub issue</system:String>
<system:String x:Key="ErrorQqGroupLinkText">加入 QQ 群</system:String>

View File

@@ -1166,6 +1166,8 @@ C:\\leidian\\LDPlayer9\n
<system:String x:Key="ErrorSolutionUpdatePackageExtractionFailed">解壓縮更新檔案失敗。建議先嘗試重新啟動 MAA.exe若仍無法解決請重新啟動電腦後再試。請勿手動解壓縮更新檔案以免漏刪必要的檔案。</system:String>
<system:String x:Key="ErrorSolutionReplaceAdb">請關閉模擬器與 ADB 或重啟電腦後,以系統管理員身分執行 MAA 進行操作。</system:String>
<system:String x:Key="ErrorSolutionFailedToMove">檔案被佔用,請重啟電腦後重試。</system:String>
<system:String x:Key="ErrorSolutionDesktopCompositionDisabled">這通常是顯示卡驅動程式瞬時異常導致 DWM 桌面組合不可用,程式將嘗試繼續執行。如果介面顯示異常,請手動重啟 MAA並建議檢查並更新顯示卡驅動程式。</system:String>
<system:String x:Key="ErrorSolutionDragDrop">這通常是在拖曳操作進行過程中重複拖曳導致的偶發崩潰,不影響功能,可忽略。如頻繁出現,請避免在拖曳過程中重複操作。</system:String>
<system:String x:Key="ErrorSolutionSelectDefaultBrowser">開啟連結失敗,請前往 「Windows 設定」 選擇預設瀏覽器。</system:String>
<system:String x:Key="ErrorFeedbackLinkText">建立 GitHub Issue</system:String>
<system:String x:Key="ErrorQqGroupLinkText">加入 QQ 群</system:String>

View File

@@ -134,12 +134,23 @@ public partial class ErrorDialogView : INotifyPropertyChanged
return LocalizationHelper.GetString("ErrorSolutionSelectDefaultBrowser");
}
// ReSharper disable once ConvertIfStatementToReturnStatement
if (details.Contains("System.IO.File.InternalMove"))
{
return LocalizationHelper.GetString("ErrorSolutionFailedToMove");
}
// DWM 桌面组合被禁用0x80263001通常是瞬时的显卡驱动问题
if (details.Contains("Desktop composition is disabled") || details.Contains("0x80263001"))
{
return LocalizationHelper.GetString("ErrorSolutionDesktopCompositionDisabled");
}
// 拖拽正在执行时重复拖动导致的偶发崩溃,可忽略
if (details.Contains("DragDrop.DoDragSourceMove"))
{
return LocalizationHelper.GetString("ErrorSolutionDragDrop");
}
AchievementTrackerHelper.Instance.Unlock(AchievementIds.UnexpectedCrash);
return $"{LocalizationHelper.GetString("UnknownErrorOccurs")}\n" +