Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Script/Gameplay/GameManager.Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private double GetVolumeSetting()
private void LoadAudio()
{
_stemStates.Clear();
_mixer = Song.LoadAudio(GlobalVariables.State.SongSpeed, DEFAULT_VOLUME);
_mixer = Song.LoadAudio(GlobalVariables.State.SongSpeed, DEFAULT_VOLUME, SettingsManager.Settings.CensorMatureContent.Value);
if (_mixer == null)
{
_loadState = LoadFailureState.Error;
Expand Down
4 changes: 4 additions & 0 deletions Assets/Script/Gameplay/GameManager.Loading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ private void LoadChart()
Chart = Song.LoadChart();
if (Chart != null)
{
if (SettingsManager.Settings.CensorMatureContent.Value)
{
Chart.ApplyCensorship();
}
GenerateVenueTrack();
GenerateLipsyncTrack();
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Script/Gameplay/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ public void SetEditHUD(bool on)
var stars = StarAmountHelper.GetStarsFromInt(Mathf.FloorToInt(bandStars));
ReplayData = new ReplayData(colorProfiles, cameraPresets, frames.ToArray(), _frameTimes.ToArray());

(bool success, var replayInfo) = ReplayIO.TrySerialize(directory, Song, SongSpeed, length, bandScore, stars, PauseInfo.ToArray(), replayStats.ToArray(), ReplayData);
(bool success, var replayInfo) = ReplayIO.TrySerialize(directory, Song, SongSpeed, length, bandScore, stars, PauseInfo.ToArray(), SettingsManager.Settings.CensorMatureContent.Value, replayStats.ToArray(), ReplayData);
if (!success)
{
return null;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Script/Menu/History/ViewTypes/ReplayViewType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public override void Shortcut1()
return;
}

if (_entry.CensorshipEnabled)
{
chart.ApplyCensorship();
}

var replayOptions = new ReplayReadOptions { KeepFrameTimes = GlobalVariables.VerboseReplays };
var (result, data) = ReplayIO.TryLoadData(_entry, replayOptions);
if (result != ReplayReadResult.Valid)
Expand Down
1 change: 1 addition & 0 deletions Assets/Script/Menu/MusicLibrary/MusicLibraryMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ private async void StartPreview(double delay, CancellationTokenSource canceller)
GlobalVariables.State.SongSpeed,
delay,
FADE_DURATION,
SettingsManager.Settings.CensorMatureContent.Value,
canceller.Token);
if (context != null)
{
Expand Down
3 changes: 2 additions & 1 deletion Assets/Script/Menu/MusicLibrary/Sidebar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using YARG.Helpers.Extensions;
using YARG.Menu.Navigation;
using YARG.Menu.Persistent;
using YARG.Settings;
using YARG.Song;
using static System.Globalization.CultureInfo;

Expand Down Expand Up @@ -245,7 +246,7 @@ private void ShowSongInfo(SongViewType songViewType)
_year.text = songEntry.ParsedYear;
}

_contentRatingImage.sprite = songEntry.SongRating switch
_contentRatingImage.sprite = songEntry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value) switch
{
SongRating.Unspecified => _contentRatingIcons[0],
SongRating.Family_Friendly => _contentRatingIcons[1],
Expand Down
26 changes: 13 additions & 13 deletions Assets/Script/Menu/MusicLibrary/SongSorting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static void SortByTitle(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand Down Expand Up @@ -200,7 +200,7 @@ private static void SortByArtist(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -223,7 +223,7 @@ private static void SortByAlbum(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -246,7 +246,7 @@ private static void SortByGenre(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -269,7 +269,7 @@ private static void SortBySubgenre(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -293,7 +293,7 @@ private static void SortByYear(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -316,7 +316,7 @@ private static void SortByCharter(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -339,7 +339,7 @@ private static void SortByPlaylist(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -362,7 +362,7 @@ private static void SortBySource(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -385,7 +385,7 @@ private static void SortByLength(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand Down Expand Up @@ -418,7 +418,7 @@ private static void SortByDateAdded(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand All @@ -441,7 +441,7 @@ private static void SortByArtistAlbum(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand Down Expand Up @@ -474,7 +474,7 @@ private static void SortByInstruments(SongCache cache, SortedSongs sorted)
{
foreach (var entry in list.Value)
{
if (DisallowedByRating(entry.SongRating))
if (DisallowedByRating(entry.GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Script/Menu/Persistent/MusicPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async void NextSong()
lock (_lock)
{
const float SPEED = 1f;
_current = task = Task.Run(() => entry.LoadAudio(SPEED, SettingsManager.Settings.MusicPlayerVolume.Value, SongStem.Crowd));
_current = task = Task.Run(() => entry.LoadAudio(SPEED, SettingsManager.Settings.MusicPlayerVolume.Value, SettingsManager.Settings.CensorMatureContent.Value, SongStem.Crowd));
}

var mixer = await task;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Script/Menu/ScoreScreen/ScoreScreenMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ private bool AnalyzeReplay(SongEntry songEntry, ReplayInfo? replayEntry)
return true;
}

if (replayEntry.CensorshipEnabled)
{
chart.ApplyCensorship();
}

var replayOptions = new ReplayReadOptions
{
KeepFrameTimes = GlobalVariables.VerboseReplays
Expand Down
9 changes: 9 additions & 0 deletions Assets/Script/Settings/SettingsManager.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ public void OpenVenueFolder()
SongRating.None,
};

public ToggleSetting CensorMatureContent { get; } = new(false, _ =>
{
// If MaxSongRating is set to anything other than Family_Friendly,
// this setting could change the available songs, so we need to force an update
SongContainer.RequestContainerRefresh();
MusicLibraryMenu.SetReload(MusicLibraryReloadState.Full);
HistoryMenu.ForceUpdate = true;
});

public ToggleSetting AllowDuplicateSongs { get; } = new(true, _ => MusicLibraryMenu.SetReload(MusicLibraryReloadState.Partial));
public ToggleSetting UseFullDirectoryForPlaylists { get; } = new(false);

Expand Down
1 change: 1 addition & 0 deletions Assets/Script/Settings/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static partial class SettingsManager
nameof(Settings.Genrelizer),
new HeaderMetadata("MusicLibrary"),
nameof(Settings.MaxSongRating),
nameof(Settings.CensorMatureContent),
nameof(Settings.ShowFavoriteButton),
nameof(Settings.DifficultyRings),
nameof(Settings.HighScoreInfo),
Expand Down
4 changes: 3 additions & 1 deletion Assets/Script/Song/Exporters/SongExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using YARG.Core.Song;
using YARG.Core.Utility;
using YARG.Helpers;
using YARG.Settings;

namespace YARG.Song.Exporters
{
Expand Down Expand Up @@ -96,7 +97,8 @@ private static void ExportCsv(string path)
int seconds = totalSeconds % 60;
string songLength = $"{minutes}:{seconds:D2}";

string songRating = song.SongRating switch
// Always false, as song export should not be affected by a user's settings
string songRating = song.GetSongRating(false) switch
{
SongRating.Family_Friendly => "Family Friendly",
SongRating.Supervision_Recommended => "Supervision Recommended",
Expand Down
4 changes: 2 additions & 2 deletions Assets/Script/Song/SongContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static SongEntry[] SetAllSongs(Dictionary<HashWrapper, List<SongEntry>> entries)
var count = node.Value.Count;
for (int i = 0; i < count; i++)
{
if (AllowedByRating(node.Value[i].SongRating))
if (AllowedByRating(node.Value[i].GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
songCount++;
}
Expand All @@ -662,7 +662,7 @@ static SongEntry[] SetAllSongs(Dictionary<HashWrapper, List<SongEntry>> entries)
{
for (int i = 0; i < node.Value.Count; i++)
{
if (AllowedByRating(node.Value[i].SongRating))
if (AllowedByRating(node.Value[i].GetSongRating(SettingsManager.Settings.CensorMatureContent.Value)))
{
if (_songsByHash.ContainsKey(node.Key))
{
Expand Down
4 changes: 4 additions & 0 deletions Assets/StreamingAssets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,10 @@
"None": "None"
}
},
"CensorMatureContent": {
"Name": "Censor Mature Content",
"Description": "On supported songs, mutes and censors mature content in lyrics and vocals, and downgrades the song's rating to \"Supervision Recommended\"."
},
"MetronomeVolume": {
"Name": "Metronome Volume",
"PauseName": "Metronome",
Expand Down