mirror of
https://github.com/ppy/osu.git
synced 2026-06-02 23:41:00 +08:00
Re-enable debug settings
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
@@ -22,7 +19,7 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
[LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.Behaviour))]
|
||||
public partial class ScreenBehaviour : WizardScreen
|
||||
{
|
||||
private SearchContainer<SettingsSection> searchContainer;
|
||||
private SearchContainer<SettingsSection> searchContainer = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
@@ -91,13 +88,11 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
new GraphicsSection(),
|
||||
new OnlineSection(),
|
||||
new MaintenanceSection(),
|
||||
new DebugSection()
|
||||
},
|
||||
SearchTerm = SettingsItem<bool>.CLASSIC_DEFAULT_SEARCH_TERM,
|
||||
}
|
||||
};
|
||||
|
||||
if (DebugUtils.IsDebugBuild)
|
||||
searchContainer.Add(new DebugSection());
|
||||
}
|
||||
|
||||
private void applyClassic()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
@@ -20,12 +21,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
public DebugSection()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GeneralSettings(),
|
||||
new BatchImportSettings(),
|
||||
new MemorySettings(),
|
||||
};
|
||||
Add(new GeneralSettings());
|
||||
|
||||
if (DebugUtils.IsDebugBuild)
|
||||
Add(new BatchImportSettings());
|
||||
|
||||
Add(new MemorySettings());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
||||
@@ -15,19 +15,20 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
Add(new SettingsCheckbox
|
||||
{
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = @"Show log overlay",
|
||||
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
LabelText = @"Show log overlay",
|
||||
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
|
||||
});
|
||||
|
||||
if (DebugUtils.IsDebugBuild)
|
||||
{
|
||||
Add(new SettingsCheckbox
|
||||
{
|
||||
LabelText = @"Bypass front-to-back render pass",
|
||||
Current = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
@@ -24,73 +25,77 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
|
||||
SettingsButton blockAction;
|
||||
SettingsButton unblockAction;
|
||||
|
||||
Children = new Drawable[]
|
||||
Add(new SettingsButton
|
||||
{
|
||||
new SettingsButton
|
||||
Text = @"Clear all caches",
|
||||
Action = host.Collect
|
||||
});
|
||||
|
||||
if (DebugUtils.IsDebugBuild)
|
||||
{
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
Text = @"Clear all caches",
|
||||
Action = host.Collect
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
Text = @"Compact realm",
|
||||
Action = () =>
|
||||
new SettingsButton
|
||||
{
|
||||
// Blocking operations implicitly causes a Compact().
|
||||
using (realm.BlockAllOperations(@"compact"))
|
||||
Text = @"Compact realm",
|
||||
Action = () =>
|
||||
{
|
||||
// Blocking operations implicitly causes a Compact().
|
||||
using (realm.BlockAllOperations(@"compact"))
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
blockAction = new SettingsButton
|
||||
{
|
||||
Text = @"Block realm",
|
||||
},
|
||||
unblockAction = new SettingsButton
|
||||
{
|
||||
Text = @"Unblock realm",
|
||||
}
|
||||
});
|
||||
|
||||
blockAction.Action = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
IDisposable? token = realm.BlockAllOperations(@"maintenance");
|
||||
|
||||
blockAction.Enabled.Value = false;
|
||||
|
||||
// As a safety measure, unblock after 10 seconds.
|
||||
// This is to handle the case where a dev may block, but then something on the update thread
|
||||
// accesses realm and blocks for eternity.
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(10000);
|
||||
unblock();
|
||||
});
|
||||
|
||||
unblockAction.Action = unblock;
|
||||
|
||||
void unblock()
|
||||
{
|
||||
if (token.IsNull())
|
||||
return;
|
||||
|
||||
token.Dispose();
|
||||
token = null;
|
||||
|
||||
Scheduler.Add(() =>
|
||||
{
|
||||
blockAction.Enabled.Value = true;
|
||||
unblockAction.Action = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
blockAction = new SettingsButton
|
||||
{
|
||||
Text = @"Block realm",
|
||||
},
|
||||
unblockAction = new SettingsButton
|
||||
{
|
||||
Text = @"Unblock realm",
|
||||
},
|
||||
};
|
||||
|
||||
blockAction.Action = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
IDisposable? token = realm.BlockAllOperations(@"maintenance");
|
||||
|
||||
blockAction.Enabled.Value = false;
|
||||
|
||||
// As a safety measure, unblock after 10 seconds.
|
||||
// This is to handle the case where a dev may block, but then something on the update thread
|
||||
// accesses realm and blocks for eternity.
|
||||
Task.Factory.StartNew(() =>
|
||||
catch (Exception e)
|
||||
{
|
||||
Thread.Sleep(10000);
|
||||
unblock();
|
||||
});
|
||||
|
||||
unblockAction.Action = unblock;
|
||||
|
||||
void unblock()
|
||||
{
|
||||
if (token.IsNull())
|
||||
return;
|
||||
|
||||
token.Dispose();
|
||||
token = null;
|
||||
|
||||
Scheduler.Add(() =>
|
||||
{
|
||||
blockAction.Enabled.Value = true;
|
||||
unblockAction.Action = null;
|
||||
});
|
||||
Logger.Error(e, @"Blocking realm failed");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, @"Blocking realm failed");
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@@ -31,7 +30,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override IEnumerable<SettingsSection> CreateSections()
|
||||
{
|
||||
var sections = new List<SettingsSection>
|
||||
return new List<SettingsSection>
|
||||
{
|
||||
// This list should be kept in sync with ScreenBehaviour.
|
||||
new GeneralSection(),
|
||||
@@ -44,12 +43,8 @@ namespace osu.Game.Overlays
|
||||
new GraphicsSection(),
|
||||
new OnlineSection(),
|
||||
new MaintenanceSection(),
|
||||
new DebugSection()
|
||||
};
|
||||
|
||||
if (DebugUtils.IsDebugBuild)
|
||||
sections.Add(new DebugSection());
|
||||
|
||||
return sections;
|
||||
}
|
||||
|
||||
private readonly List<SettingsSubPanel> subPanels = new List<SettingsSubPanel>();
|
||||
|
||||
Reference in New Issue
Block a user