diff --git a/Qwilight/Assets/Language.json b/Qwilight/Assets/Language.json index 9018dd1..febb631 100644 --- a/Qwilight/Assets/Language.json +++ b/Qwilight/Assets/Language.json @@ -1819,9 +1819,13 @@ "ko-KR": "CORSAIR® iCUE™ 활성화", "en-US": "Enable CORSAIR® iCUE™" }, + "LazyGCFault": { + "ko-KR": "게임 플레이 중 GC가 발생한 것 같습니다. 고급 설정에서 미리 예약한 메모리를 늘려주세요", + "en-US": "It appears that GC occurred during gameplay. Please increase the pre-reserved memory in advanced settings." + }, "LazyGCText": { - "ko-KR": "게임 플레이 중 다음 메모리를 미리 할당하여 GC 스파이크로 인한 스터터링을 방지합니다.", - "en-US": "Preallocate the following memory during gameplay to prevent stutter caused by GC spikes." + "ko-KR": "게임 플레이 중 메모리를 미리 예약하여 GC 스파이크로 인한 스터터링을 방지합니다.", + "en-US": "Pre-reserve memory during gameplay to prevent stuttering due to GC spikes." }, "Level0Contents": { "ko-KR": "미정", @@ -3232,8 +3236,8 @@ "en-US": "Click to watch Qwilight stream {0}" }, "SlowLoopingContents": { - "ko-KR": "게임이 느립니다. 게임 설정에서 폴링 레이트를 내려주세요", - "en-US": "The game is slow. Please lower the polling rate in the game settings" + "ko-KR": "게임이 느립니다. 고급 설정에서 폴링 레이트를 줄여주세요", + "en-US": "The game is slow. Please reduce the polling rate in advanced settings." }, "SoftwareAssister": { "ko-KR": "개발자", diff --git a/Qwilight/Compute/CommentCompute.cs b/Qwilight/Compute/CommentCompute.cs index 94b9998..c3c6987 100644 --- a/Qwilight/Compute/CommentCompute.cs +++ b/Qwilight/Compute/CommentCompute.cs @@ -15,6 +15,8 @@ public override bool CanSetPosition => true; + public override bool CanModifySalt => false; + public override string PlatformVarietyContents => LanguageSystem.Instance.PlatformCommentComputing; public override void HandleWarning() diff --git a/Qwilight/Compute/DefaultCompute.cs b/Qwilight/Compute/DefaultCompute.cs index 042e971..ce4bb65 100644 --- a/Qwilight/Compute/DefaultCompute.cs +++ b/Qwilight/Compute/DefaultCompute.cs @@ -416,7 +416,7 @@ public virtual bool CanUndo => WwwLevelDataValue?.AllowPause != false; - public bool CanModifySalt => (IsSalt || ModeComponentValue.CanModifySalt) && string.IsNullOrEmpty(EventNoteEntryItem?.EventNoteID); + public virtual bool CanModifySalt => (IsSalt || ModeComponentValue.CanModifySalt) && string.IsNullOrEmpty(EventNoteEntryItem?.EventNoteID); public int FadingViewLayer { get; set; } = 1; diff --git a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs index d0f4499..445a315 100644 --- a/Qwilight/System/LanguageSystem/LanguageSystem.g.cs +++ b/Qwilight/System/LanguageSystem/LanguageSystem.g.cs @@ -457,6 +457,7 @@ public string JudgmentVisualizerPositionContents { get; set; } public string K70Contents { get; set; } public string K70Text { get; set; } + public string LazyGCFault { get; set; } public string LazyGCText { get; set; } public string Level0Contents { get; set; } public string Level1Contents { get; set; } diff --git a/Qwilight/ViewModel/MainViewModel.cs b/Qwilight/ViewModel/MainViewModel.cs index 9fb71ab..4c0d467 100644 --- a/Qwilight/ViewModel/MainViewModel.cs +++ b/Qwilight/ViewModel/MainViewModel.cs @@ -116,7 +116,8 @@ string _twilightCommentary = string.Empty; bool _isWPFViewVisible = true; bool _isLoaded; - double _windowDPI = 1.0; + double _windowDPI; + bool _wasLazyGC; static bool IsNotModal(BaseViewModel targetViewModel = null) { @@ -252,32 +253,36 @@ IsPragmatic = !IsWPFViewVisible && IsComputingMode && !Computer.IsPausingWindowOpened; if (IsPragmatic) { - if (Configure.Instance.AutoLazyGC) + if (!_wasLazyGC) { - Configure.Instance.LazyGCV2 = Utility.GetLazyGC(); - } - - var lazyGC = Configure.Instance.LazyGCV2 * 1000 * 1000; - if (lazyGC > 0L) - { - try + if (Configure.Instance.AutoLazyGC) { - GC.Collect(); - GC.TryStartNoGCRegion(lazyGC); + Configure.Instance.LazyGCV2 = Utility.GetLazyGC(); } - catch (InvalidOperationException) + + var lazyGC = Configure.Instance.LazyGCV2 * 1000 * 1000; + if (lazyGC > 0L) { + _wasLazyGC = GC.TryStartNoGCRegion(lazyGC); } } } else { - try + if (_wasLazyGC) { - GC.EndNoGCRegion(); - } - catch (InvalidOperationException) - { + try + { + GC.EndNoGCRegion(); + } + catch (InvalidOperationException) + { + NotifySystem.Instance.Notify(NotifySystem.NotifyVariety.Warning, NotifySystem.NotifyConfigure.Default, LanguageSystem.Instance.LazyGCFault); + } + finally + { + _wasLazyGC = false; + } } } }