2019-01-25 11:17:48 +01:00
|
|
|
|
// 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.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-11-11 12:19:01 +09:00
|
|
|
|
using System;
|
2020-11-11 12:54:39 +09:00
|
|
|
|
using System.Diagnostics;
|
2020-03-05 13:18:42 +09:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-05-02 19:37:47 +09:00
|
|
|
|
using osu.Framework.Configuration.Tracking;
|
2019-01-04 14:18:29 +09:00
|
|
|
|
using osu.Framework.Extensions;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Framework.Platform;
|
2020-09-04 20:34:26 +09:00
|
|
|
|
using osu.Framework.Testing;
|
2020-08-16 11:04:28 +09:30
|
|
|
|
using osu.Game.Input;
|
2020-11-11 12:54:39 +09:00
|
|
|
|
using osu.Game.Input.Bindings;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Game.Overlays;
|
2018-06-08 03:17:12 +09:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
using osu.Game.Screens.Select;
|
2019-08-23 13:15:38 +02:00
|
|
|
|
using osu.Game.Screens.Select.Filter;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Configuration
|
|
|
|
|
{
|
2020-09-04 20:34:26 +09:00
|
|
|
|
[ExcludeFromDynamicCompile]
|
2018-04-13 18:19:50 +09:00
|
|
|
|
public class OsuConfigManager : IniConfigManager<OsuSetting>
|
|
|
|
|
{
|
|
|
|
|
protected override void InitialiseDefaults()
|
|
|
|
|
{
|
|
|
|
|
// UI/selection defaults
|
|
|
|
|
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
|
2019-08-29 16:38:39 +09:00
|
|
|
|
Set(OsuSetting.Skin, 0, -1, int.MaxValue);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-02-12 19:52:47 +09:00
|
|
|
|
Set(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details);
|
2020-09-15 21:33:52 -07:00
|
|
|
|
Set(OsuSetting.BeatmapDetailModsFilter, false);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
Set(OsuSetting.ShowConvertedBeatmaps, true);
|
|
|
|
|
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
2020-01-24 19:12:56 +09:00
|
|
|
|
Set(OsuSetting.DisplayStarsMaximum, 10.1, 0, 10.1, 0.1);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-08-24 10:34:54 +02:00
|
|
|
|
Set(OsuSetting.SongSelectGroupingMode, GroupMode.All);
|
|
|
|
|
Set(OsuSetting.SongSelectSortingMode, SortMode.Title);
|
2019-08-23 13:15:38 +02:00
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
|
|
|
|
|
2019-09-03 01:50:52 +03:00
|
|
|
|
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
// Online settings
|
|
|
|
|
Set(OsuSetting.Username, string.Empty);
|
|
|
|
|
Set(OsuSetting.Token, string.Empty);
|
|
|
|
|
|
2020-10-28 19:03:01 +09:00
|
|
|
|
Set(OsuSetting.AutomaticallyDownloadWhenSpectating, false);
|
|
|
|
|
|
2019-02-22 17:51:39 +09:00
|
|
|
|
Set(OsuSetting.SavePassword, false).ValueChanged += enabled =>
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2019-02-22 17:51:39 +09:00
|
|
|
|
if (enabled.NewValue) Set(OsuSetting.SaveUsername, true);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
};
|
|
|
|
|
|
2019-02-22 17:51:39 +09:00
|
|
|
|
Set(OsuSetting.SaveUsername, true).ValueChanged += enabled =>
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2019-02-22 17:51:39 +09:00
|
|
|
|
if (!enabled.NewValue) Set(OsuSetting.SavePassword, false);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-11-01 23:52:07 +03:00
|
|
|
|
Set(OsuSetting.ExternalLinkWarning, true);
|
2020-04-11 14:08:16 +03:00
|
|
|
|
Set(OsuSetting.PreferNoVideo, false);
|
2018-10-22 23:57:37 +03:00
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
|
// Audio
|
|
|
|
|
Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.MenuVoice, true);
|
|
|
|
|
Set(OsuSetting.MenuMusic, true);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1);
|
|
|
|
|
|
|
|
|
|
// Input
|
2019-09-03 01:28:51 +03:00
|
|
|
|
Set(OsuSetting.MenuCursorSize, 1.0f, 0.5f, 2f, 0.01f);
|
|
|
|
|
Set(OsuSetting.GameplayCursorSize, 1.0f, 0.1f, 2f, 0.01f);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Set(OsuSetting.AutoCursorSize, false);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.MouseDisableButtons, false);
|
|
|
|
|
Set(OsuSetting.MouseDisableWheel, false);
|
2020-10-06 22:39:35 +10:30
|
|
|
|
Set(OsuSetting.ConfineMouseMode, OsuConfineMouseMode.DuringGameplay);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
// Graphics
|
|
|
|
|
Set(OsuSetting.ShowFpsDisplay, false);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.ShowStoryboard, true);
|
2018-04-25 16:15:23 +09:00
|
|
|
|
Set(OsuSetting.BeatmapSkins, true);
|
|
|
|
|
Set(OsuSetting.BeatmapHitsounds, true);
|
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Set(OsuSetting.CursorRotation, true);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.MenuParallax, true);
|
|
|
|
|
|
|
|
|
|
// Gameplay
|
2020-02-07 21:03:33 -08:00
|
|
|
|
Set(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
2019-12-10 15:10:35 +03:00
|
|
|
|
Set(OsuSetting.LightenDuringBreaks, true);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-09-18 02:16:57 +09:00
|
|
|
|
Set(OsuSetting.HitLighting, true);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2020-10-20 14:19:15 +09:00
|
|
|
|
Set(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Always);
|
2019-07-05 08:52:44 +02:00
|
|
|
|
Set(OsuSetting.ShowProgressGraph, true);
|
2019-07-07 05:30:30 +09:00
|
|
|
|
Set(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
2020-03-30 12:59:39 +02:00
|
|
|
|
Set(OsuSetting.FadePlayfieldWhenHealthLow, true);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Set(OsuSetting.KeyOverlay, false);
|
2020-04-09 18:12:15 +02:00
|
|
|
|
Set(OsuSetting.PositionalHitSounds, true);
|
2020-07-14 20:11:54 +09:00
|
|
|
|
Set(OsuSetting.AlwaysPlayFirstComboBreak, true);
|
2019-08-19 22:04:27 +03:00
|
|
|
|
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
|
|
Set(OsuSetting.FloatingComments, false);
|
|
|
|
|
|
2018-06-08 03:17:12 +09:00
|
|
|
|
Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised);
|
|
|
|
|
|
2018-04-25 17:15:53 +09:00
|
|
|
|
Set(OsuSetting.IncreaseFirstObjectVisibility, true);
|
2020-06-30 13:12:33 +02:00
|
|
|
|
Set(OsuSetting.GameplayDisableWinKey, true);
|
2018-04-25 17:15:53 +09:00
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
|
// Update
|
|
|
|
|
Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.Version, string.Empty);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
|
2018-04-13 21:13:09 +09:00
|
|
|
|
Set(OsuSetting.ScreenshotCaptureMenuCursor, false);
|
2018-04-13 19:50:37 +09:00
|
|
|
|
|
2018-04-18 19:26:54 +09:00
|
|
|
|
Set(OsuSetting.SongSelectRightMouseScroll, false);
|
2019-01-04 13:29:37 +09:00
|
|
|
|
|
|
|
|
|
Set(OsuSetting.Scaling, ScalingMode.Off);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.ScalingSizeX, 0.8f, 0.2f, 1f);
|
|
|
|
|
Set(OsuSetting.ScalingSizeY, 0.8f, 0.2f, 1f);
|
|
|
|
|
|
|
|
|
|
Set(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f);
|
|
|
|
|
Set(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f);
|
2019-01-09 19:01:33 +09:00
|
|
|
|
|
|
|
|
|
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
2019-08-09 20:05:28 +09:00
|
|
|
|
|
2019-10-02 12:26:46 +08:00
|
|
|
|
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
|
2019-09-19 14:04:51 +09:00
|
|
|
|
|
2019-08-09 20:05:28 +09:00
|
|
|
|
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
2019-09-24 17:42:06 +08:00
|
|
|
|
|
2019-11-22 02:38:31 +09:00
|
|
|
|
Set(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
2020-10-30 15:54:10 +01:00
|
|
|
|
Set(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes);
|
2020-11-03 16:01:14 +09:00
|
|
|
|
|
|
|
|
|
Set(OsuSetting.EditorWaveformOpacity, 1f);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-04 14:18:29 +09:00
|
|
|
|
public OsuConfigManager(Storage storage)
|
|
|
|
|
: base(storage)
|
2018-04-13 18:19:50 +09:00
|
|
|
|
{
|
2020-03-05 13:18:42 +09:00
|
|
|
|
Migrate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Migrate()
|
|
|
|
|
{
|
|
|
|
|
// arrives as 2020.123.0
|
|
|
|
|
var rawVersion = Get<string>(OsuSetting.Version);
|
|
|
|
|
|
|
|
|
|
if (rawVersion.Length < 6)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var pieces = rawVersion.Split('.');
|
|
|
|
|
|
2020-03-05 15:36:36 +09:00
|
|
|
|
// on a fresh install or when coming from a non-release build, execution will end here.
|
|
|
|
|
// we don't want to run migrations in such cases.
|
2020-03-05 13:18:42 +09:00
|
|
|
|
if (!int.TryParse(pieces[0], out int year)) return;
|
|
|
|
|
if (!int.TryParse(pieces[1], out int monthDay)) return;
|
|
|
|
|
|
|
|
|
|
int combined = (year * 10000) + monthDay;
|
|
|
|
|
|
|
|
|
|
if (combined < 20200305)
|
|
|
|
|
{
|
|
|
|
|
// the maximum value of this setting was changed.
|
|
|
|
|
// if we don't manually increase this, it causes song select to filter out beatmaps the user expects to see.
|
|
|
|
|
var maxStars = (BindableDouble)GetOriginalBindable<double>(OsuSetting.DisplayStarsMaximum);
|
|
|
|
|
|
|
|
|
|
if (maxStars.Value == 10)
|
|
|
|
|
maxStars.Value = maxStars.MaxValue;
|
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
2018-05-02 19:37:47 +09:00
|
|
|
|
|
2020-11-11 12:54:39 +09:00
|
|
|
|
public override TrackedSettings CreateTrackedSettings()
|
2019-01-04 15:34:32 +09:00
|
|
|
|
{
|
2020-11-11 12:54:39 +09:00
|
|
|
|
// these need to be assigned in normal game startup scenarios.
|
|
|
|
|
Debug.Assert(LookupKeyBindings != null);
|
|
|
|
|
Debug.Assert(LookupSkinName != null);
|
|
|
|
|
|
|
|
|
|
return new TrackedSettings
|
2020-11-11 12:19:01 +09:00
|
|
|
|
{
|
2020-11-11 12:54:39 +09:00
|
|
|
|
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled", LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))),
|
|
|
|
|
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription(), $"cycle: shift-tab quick view: {LookupKeyBindings(GlobalAction.HoldForHUD)}")),
|
|
|
|
|
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
|
|
|
|
|
new TrackedSetting<int>(OsuSetting.Skin, m =>
|
|
|
|
|
{
|
|
|
|
|
string skinName = LookupSkinName(m) ?? string.Empty;
|
2020-11-11 13:05:03 +09:00
|
|
|
|
return new SettingDescription(skinName, "skin", skinName, $"random: {LookupKeyBindings(GlobalAction.RandomSkin)}");
|
2020-11-11 12:54:39 +09:00
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Func<int, string> LookupSkinName { private get; set; }
|
2020-11-11 12:19:01 +09:00
|
|
|
|
|
2020-11-11 12:54:39 +09:00
|
|
|
|
public Func<GlobalAction, string> LookupKeyBindings { private get; set; }
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum OsuSetting
|
|
|
|
|
{
|
|
|
|
|
Ruleset,
|
|
|
|
|
Token,
|
|
|
|
|
MenuCursorSize,
|
|
|
|
|
GameplayCursorSize,
|
|
|
|
|
AutoCursorSize,
|
|
|
|
|
DimLevel,
|
|
|
|
|
BlurLevel,
|
2019-12-10 15:10:35 +03:00
|
|
|
|
LightenDuringBreaks,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
ShowStoryboard,
|
|
|
|
|
KeyOverlay,
|
2020-04-09 18:12:15 +02:00
|
|
|
|
PositionalHitSounds,
|
2020-07-14 20:11:54 +09:00
|
|
|
|
AlwaysPlayFirstComboBreak,
|
2019-08-18 15:01:04 +03:00
|
|
|
|
ScoreMeter,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
FloatingComments,
|
2020-07-22 12:41:06 +09:00
|
|
|
|
HUDVisibilityMode,
|
2019-07-05 08:52:44 +02:00
|
|
|
|
ShowProgressGraph,
|
2019-07-07 05:30:30 +09:00
|
|
|
|
ShowHealthDisplayWhenCantFail,
|
2020-03-30 12:59:39 +02:00
|
|
|
|
FadePlayfieldWhenHealthLow,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
MouseDisableButtons,
|
|
|
|
|
MouseDisableWheel,
|
2020-08-16 11:04:28 +09:30
|
|
|
|
ConfineMouseMode,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
AudioOffset,
|
|
|
|
|
VolumeInactive,
|
|
|
|
|
MenuMusic,
|
|
|
|
|
MenuVoice,
|
|
|
|
|
CursorRotation,
|
|
|
|
|
MenuParallax,
|
|
|
|
|
BeatmapDetailTab,
|
2020-09-15 21:33:52 -07:00
|
|
|
|
BeatmapDetailModsFilter,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
Username,
|
|
|
|
|
ReleaseStream,
|
|
|
|
|
SavePassword,
|
|
|
|
|
SaveUsername,
|
|
|
|
|
DisplayStarsMinimum,
|
|
|
|
|
DisplayStarsMaximum,
|
2019-08-24 10:34:54 +02:00
|
|
|
|
SongSelectGroupingMode,
|
|
|
|
|
SongSelectSortingMode,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
RandomSelectAlgorithm,
|
|
|
|
|
ShowFpsDisplay,
|
|
|
|
|
ChatDisplayHeight,
|
|
|
|
|
Version,
|
|
|
|
|
ShowConvertedBeatmaps,
|
|
|
|
|
Skin,
|
2018-04-13 19:50:37 +09:00
|
|
|
|
ScreenshotFormat,
|
2018-04-18 18:10:40 +09:00
|
|
|
|
ScreenshotCaptureMenuCursor,
|
2018-04-20 18:17:57 +03:00
|
|
|
|
SongSelectRightMouseScroll,
|
2018-04-25 16:15:23 +09:00
|
|
|
|
BeatmapSkins,
|
2018-04-25 17:15:53 +09:00
|
|
|
|
BeatmapHitsounds,
|
2018-06-08 03:17:12 +09:00
|
|
|
|
IncreaseFirstObjectVisibility,
|
2018-10-22 23:57:37 +03:00
|
|
|
|
ScoreDisplayMode,
|
2019-01-04 13:29:37 +09:00
|
|
|
|
ExternalLinkWarning,
|
2020-04-11 14:08:16 +03:00
|
|
|
|
PreferNoVideo,
|
2019-01-04 13:29:37 +09:00
|
|
|
|
Scaling,
|
|
|
|
|
ScalingPositionX,
|
|
|
|
|
ScalingPositionY,
|
|
|
|
|
ScalingSizeX,
|
2019-01-09 19:01:33 +09:00
|
|
|
|
ScalingSizeY,
|
2019-08-09 20:05:28 +09:00
|
|
|
|
UIScale,
|
2019-09-19 14:04:51 +09:00
|
|
|
|
IntroSequence,
|
2019-09-19 20:05:14 +09:00
|
|
|
|
UIHoldActivationDelay,
|
2019-09-24 17:42:06 +08:00
|
|
|
|
HitLighting,
|
2020-06-30 13:12:33 +02:00
|
|
|
|
MenuBackgroundSource,
|
2020-08-01 19:44:30 +02:00
|
|
|
|
GameplayDisableWinKey,
|
2020-10-31 16:22:49 +09:00
|
|
|
|
SeasonalBackgroundMode,
|
2020-11-03 16:01:14 +09:00
|
|
|
|
EditorWaveformOpacity,
|
2020-10-28 19:03:01 +09:00
|
|
|
|
AutomaticallyDownloadWhenSpectating,
|
2018-04-13 18:19:50 +09:00
|
|
|
|
}
|
|
|
|
|
}
|