mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
feat: 添加性能测试模式
This commit is contained in:
parent
d894579bd7
commit
c42ce9adeb
11 changed files with 50 additions and 1 deletions
|
|
@ -394,6 +394,7 @@ void AppSettings::IsDeveloperMode(bool value) noexcept {
|
|||
if (!value) {
|
||||
// 关闭开发者模式则禁用所有开发者选项
|
||||
_isDebugMode = false;
|
||||
_isBenchmarkMode = false;
|
||||
_isEffectCacheDisabled = false;
|
||||
_isFontCacheDisabled = false;
|
||||
_isSaveEffectSources = false;
|
||||
|
|
@ -508,6 +509,8 @@ bool AppSettings::_Save(const _AppSettingsData& data) noexcept {
|
|||
writer.Bool(data._isDeveloperMode);
|
||||
writer.Key("debugMode");
|
||||
writer.Bool(data._isDebugMode);
|
||||
writer.Key("benchmarkMode");
|
||||
writer.Bool(data._isBenchmarkMode);
|
||||
writer.Key("disableEffectCache");
|
||||
writer.Bool(data._isEffectCacheDisabled);
|
||||
writer.Key("disableFontCache");
|
||||
|
|
@ -665,6 +668,7 @@ void AppSettings::_LoadSettings(const rapidjson::GenericObject<true, rapidjson::
|
|||
}
|
||||
JsonHelper::ReadBool(root, "developerMode", _isDeveloperMode);
|
||||
JsonHelper::ReadBool(root, "debugMode", _isDebugMode);
|
||||
JsonHelper::ReadBool(root, "benchmarkMode", _isBenchmarkMode);
|
||||
JsonHelper::ReadBool(root, "disableEffectCache", _isEffectCacheDisabled);
|
||||
JsonHelper::ReadBool(root, "disableFontCache", _isFontCacheDisabled);
|
||||
JsonHelper::ReadBool(root, "saveEffectSources", _isSaveEffectSources);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ struct _AppSettingsData {
|
|||
bool _isAlwaysRunAsAdmin = false;
|
||||
bool _isDeveloperMode = false;
|
||||
bool _isDebugMode = false;
|
||||
bool _isBenchmarkMode = false;
|
||||
bool _isEffectCacheDisabled = false;
|
||||
bool _isFontCacheDisabled = false;
|
||||
bool _isSaveEffectSources = false;
|
||||
|
|
@ -151,6 +152,15 @@ public:
|
|||
SaveAsync();
|
||||
}
|
||||
|
||||
bool IsBenchmarkMode() const noexcept {
|
||||
return _isBenchmarkMode;
|
||||
}
|
||||
|
||||
void IsBenchmarkMode(bool value) noexcept {
|
||||
_isBenchmarkMode = value;
|
||||
SaveAsync();
|
||||
}
|
||||
|
||||
bool IsEffectCacheDisabled() const noexcept {
|
||||
return _isEffectCacheDisabled;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,6 +194,10 @@
|
|||
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_DebugMode"
|
||||
IsChecked="{x:Bind ViewModel.IsDebugMode, Mode=TwoWay}" />
|
||||
</local:SettingsCard>
|
||||
<local:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_BenchmarkMode"
|
||||
IsChecked="{x:Bind ViewModel.IsBenchmarkMode, Mode=TwoWay}" />
|
||||
</local:SettingsCard>
|
||||
<local:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Uid="Home_Advanced_DeveloperOptions_DisableEffectCache"
|
||||
IsChecked="{x:Bind ViewModel.IsEffectCacheDisabled, Mode=TwoWay}" />
|
||||
|
|
|
|||
|
|
@ -298,6 +298,21 @@ void HomeViewModel::IsDebugMode(bool value) {
|
|||
RaisePropertyChanged(L"IsDebugMode");
|
||||
}
|
||||
|
||||
bool HomeViewModel::IsBenchmarkMode() const noexcept {
|
||||
return AppSettings::Get().IsBenchmarkMode();
|
||||
}
|
||||
|
||||
void HomeViewModel::IsBenchmarkMode(bool value) {
|
||||
AppSettings& settings = AppSettings::Get();
|
||||
|
||||
if (settings.IsBenchmarkMode() == value) {
|
||||
return;
|
||||
}
|
||||
|
||||
settings.IsBenchmarkMode(value);
|
||||
RaisePropertyChanged(L"IsBenchmarkMode");
|
||||
}
|
||||
|
||||
bool HomeViewModel::IsEffectCacheDisabled() const noexcept {
|
||||
return AppSettings::Get().IsEffectCacheDisabled();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ struct HomeViewModel : HomeViewModelT<HomeViewModel>, wil::notify_property_chang
|
|||
bool IsDebugMode() const noexcept;
|
||||
void IsDebugMode(bool value);
|
||||
|
||||
bool IsBenchmarkMode() const noexcept;
|
||||
void IsBenchmarkMode(bool value);
|
||||
|
||||
bool IsEffectCacheDisabled() const noexcept;
|
||||
void IsEffectCacheDisabled(bool value);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ namespace Magpie.App {
|
|||
|
||||
Boolean IsDeveloperMode;
|
||||
Boolean IsDebugMode;
|
||||
Boolean IsBenchmarkMode;
|
||||
Boolean IsEffectCacheDisabled;
|
||||
Boolean IsFontCacheDisabled;
|
||||
Boolean IsSaveEffectSources;
|
||||
|
|
|
|||
|
|
@ -838,4 +838,7 @@
|
|||
<data name="Home_Advanced_SimulateExclusiveFullscreen_InfoBar.Title" xml:space="preserve">
|
||||
<value>This option is not compatible with some older games. Please use it with caution.</value>
|
||||
</data>
|
||||
<data name="Home_Advanced_DeveloperOptions_BenchmarkMode.Content" xml:space="preserve">
|
||||
<value>Benchmark mode</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -838,4 +838,7 @@
|
|||
<data name="Home_Advanced_SimulateExclusiveFullscreen_InfoBar.Title" xml:space="preserve">
|
||||
<value>此选项和一些旧游戏不兼容,请谨慎使用。</value>
|
||||
</data>
|
||||
<data name="Home_Advanced_DeveloperOptions_BenchmarkMode.Content" xml:space="preserve">
|
||||
<value>性能测试模式</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -304,6 +304,7 @@ bool ScalingService::_StartScale(HWND hWnd, const Profile& profile) {
|
|||
}
|
||||
|
||||
options.IsDebugMode(settings.IsDebugMode());
|
||||
options.IsBenchmarkMode(settings.IsBenchmarkMode());
|
||||
options.IsEffectCacheDisabled(settings.IsEffectCacheDisabled());
|
||||
options.IsFontCacheDisabled(settings.IsFontCacheDisabled());
|
||||
options.IsSaveEffectSources(settings.IsSaveEffectSources());
|
||||
|
|
|
|||
|
|
@ -693,7 +693,10 @@ void Renderer::_BackendThreadProc() noexcept {
|
|||
waitingForStepTimer = false;
|
||||
}
|
||||
|
||||
const FrameSourceBase::UpdateState state = _frameSource->Update();
|
||||
FrameSourceBase::UpdateState state = _frameSource->Update();
|
||||
if (ScalingWindow::Get().Options().IsBenchmarkMode()) {
|
||||
state = FrameSourceBase::UpdateState::NewFrame;
|
||||
}
|
||||
_stepTimer.UpdateFPS(state == FrameSourceBase::UpdateState::NewFrame);
|
||||
|
||||
switch (state) {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ struct ScalingFlags {
|
|||
// Magpie.Core 不负责启动 TouchHelper.exe,指定此标志会使 Magpie.Core 创建辅助窗口以拦截
|
||||
// 黑边上的触控输入
|
||||
static constexpr uint32_t IsTouchSupportEnabled = 1 << 17;
|
||||
static constexpr uint32_t BenchmarkMode = 1 << 18;
|
||||
};
|
||||
|
||||
enum class ScalingType {
|
||||
|
|
@ -83,6 +84,7 @@ enum class DuplicateFrameDetectionMode {
|
|||
struct ScalingOptions {
|
||||
DEFINE_FLAG_ACCESSOR(IsWindowResizingDisabled, ScalingFlags::DisableWindowResizing, flags)
|
||||
DEFINE_FLAG_ACCESSOR(IsDebugMode, ScalingFlags::BreakpointMode, flags)
|
||||
DEFINE_FLAG_ACCESSOR(IsBenchmarkMode, ScalingFlags::BenchmarkMode, flags)
|
||||
DEFINE_FLAG_ACCESSOR(IsEffectCacheDisabled, ScalingFlags::DisableEffectCache, flags)
|
||||
DEFINE_FLAG_ACCESSOR(IsFontCacheDisabled, ScalingFlags::DisableFontCache, flags)
|
||||
DEFINE_FLAG_ACCESSOR(IsSaveEffectSources, ScalingFlags::SaveEffectSources, flags)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue