SHA256
Migrate to C#12
This commit is contained in:
24 files changed
+42
-42
No files matched your search
@@ -792,7 +792,7 @@ internal class RenderManager : MonoBehaviour
|
|||||||
// removes frames, and it signals FrameDequeuedEvent for each one. The wait has a timeout so that the loop
|
// removes frames, and it signals FrameDequeuedEvent for each one. The wait has a timeout so that the loop
|
||||||
// re-checks the render thread state and pumps pending readback completions (see ThrottleWaitMilliseconds).
|
// re-checks the render thread state and pumps pending readback completions (see ThrottleWaitMilliseconds).
|
||||||
isThrottling = false;
|
isThrottling = false;
|
||||||
var frameLimit = QueueFrameLimit = ComputeQueueFrameLimit(texture!);
|
var frameLimit = QueueFrameLimit = ComputeQueueFrameLimit(texture);
|
||||||
|
|
||||||
while (Instance.stage >= RenderStage.Render)
|
while (Instance.stage >= RenderStage.Render)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,7 @@ internal static class CodecUtil
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly Dictionary<AVCodecID, List<int>> AvailableSampleRate = new()
|
public static readonly Dictionary<AVCodecID, List<int>> AvailableSampleRate = new()
|
||||||
{
|
{
|
||||||
[AVCodecID.AV_CODEC_ID_AAC] = new List<int> { 44100, 48000, 96000 },
|
[AVCodecID.AV_CODEC_ID_AAC] = [44100, 48000, 96000],
|
||||||
[AVCodecID.AV_CODEC_ID_OPUS] = new List<int> { 48000 }
|
[AVCodecID.AV_CODEC_ID_OPUS] = [48000]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ public class ColorJsonConverter : JsonConverter
|
|||||||
|
|
||||||
if (reader.TokenType == JsonToken.Null)
|
if (reader.TokenType == JsonToken.Null)
|
||||||
{
|
{
|
||||||
return isNullable ? null : (object)default(Color);
|
return isNullable ? null : default(Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonToken.String)
|
if (reader.TokenType == JsonToken.String)
|
||||||
@@ -54,7 +54,7 @@ public class ColorJsonConverter : JsonConverter
|
|||||||
return parsedColor;
|
return parsedColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isNullable ? null : (object)default(Color);
|
return isNullable ? null : default(Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.TokenType == JsonToken.StartObject)
|
if (reader.TokenType == JsonToken.StartObject)
|
||||||
@@ -67,7 +67,7 @@ public class ColorJsonConverter : JsonConverter
|
|||||||
return new Color(r, g, b, a);
|
return new Color(r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isNullable ? null : (object)default(Color);
|
return isNullable ? null : default(Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using ADOFAIRenderer.Core;
|
using ADOFAIRenderer.Core;
|
||||||
using ADOFAIRenderer.Util.Audio;
|
using ADOFAIRenderer.Util.Audio;
|
||||||
using ADOFAIRenderer.Util.Audio.Clip;
|
using ADOFAIRenderer.Util.Audio.Clip;
|
||||||
@@ -206,7 +207,7 @@ public static class AudioSourceIsPlayingPatch
|
|||||||
{
|
{
|
||||||
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
// ReSharper disable once InconsistentNaming
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(AudioSource __instance, ref bool __result)
|
public static bool Prefix(AudioSource __instance, ref bool __result)
|
||||||
{
|
{
|
||||||
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
||||||
@@ -221,7 +222,7 @@ public static class AudioSourceTimeGetterPatch
|
|||||||
{
|
{
|
||||||
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
// ReSharper disable once InconsistentNaming
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(AudioSource __instance, ref float __result)
|
public static bool Prefix(AudioSource __instance, ref float __result)
|
||||||
{
|
{
|
||||||
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
||||||
@@ -257,7 +258,7 @@ public static class AudioSourceTimeSamplesGetterPatch
|
|||||||
{
|
{
|
||||||
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
// ReSharper disable once InconsistentNaming
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(AudioSource __instance, ref int __result)
|
public static bool Prefix(AudioSource __instance, ref int __result)
|
||||||
{
|
{
|
||||||
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
if (!EffectSource.TryGet(__instance, out var state, out var now)) return true;
|
||||||
@@ -287,7 +288,7 @@ public static class AudioSourcePitchGetterPatch
|
|||||||
{
|
{
|
||||||
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
/// <summary>When <see cref="EffectSource.TryGet"/> finds a mapped state, uses it and returns false (Unity is skipped); otherwise returns true.</summary>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
// ReSharper disable once InconsistentNaming
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public static bool Prefix(AudioSource __instance, ref float __result)
|
public static bool Prefix(AudioSource __instance, ref float __result)
|
||||||
{
|
{
|
||||||
if (!EffectSource.TryGet(__instance, out var state, out _)) return true;
|
if (!EffectSource.TryGet(__instance, out var state, out _)) return true;
|
||||||
|
|||||||
@@ -28,20 +28,9 @@ public static class CustomFrameRateDeferPatch
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks whether the SetFramerate render timing fix is enabled.
|
/// Checks whether the SetFramerate render timing fix is enabled.
|
||||||
/// Active if rendering session has the option enabled, or enabled by default during normal in-game play.
|
/// Active if rendering session has the option enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsEnabled
|
public static bool IsEnabled => RenderManager.IsActive && RenderManager.Instance.Configuration.AdvancedConfig.FixCustomFrameRate;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (RenderManager.IsActive && RenderManager.Instance?.Configuration?.AdvancedConfig != null)
|
|
||||||
{
|
|
||||||
return RenderManager.Instance.Configuration.AdvancedConfig.FixCustomFrameRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Intercepts manual camera render calls from SetCustomFrameRate (Update phase) or CheckUpdateFrameRateScreen
|
/// Intercepts manual camera render calls from SetCustomFrameRate (Update phase) or CheckUpdateFrameRateScreen
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public static class DecorationPatch
|
|||||||
public static bool IsEnabled =>
|
public static bool IsEnabled =>
|
||||||
RenderManager.Instance &&
|
RenderManager.Instance &&
|
||||||
RenderManager.Instance.stage >= RenderStage.Load &&
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
RenderManager.Instance.Configuration?.AdvancedConfig?.HideFailedDecorations == true;
|
RenderManager.Instance.Configuration.AdvancedConfig.HideFailedDecorations;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks whether the given sprite is the default placeholder or not-found sprite of the decoration manager.
|
/// Checks whether the given sprite is the default placeholder or not-found sprite of the decoration manager.
|
||||||
@@ -46,7 +46,7 @@ public static class DecorationPatch
|
|||||||
{
|
{
|
||||||
if (IsPlaceholderSprite(visualDec.spriteRenderer.sprite, manager))
|
if (IsPlaceholderSprite(visualDec.spriteRenderer.sprite, manager))
|
||||||
{
|
{
|
||||||
visualDec.SetSprite((Sprite)null!);
|
visualDec.SetSprite(null!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,7 @@ public static class DecorationPatch
|
|||||||
public static class VisualDecorationSetSpritePatch
|
public static class VisualDecorationSetSpritePatch
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public static void Prefix(scrVisualDecoration __instance, ref Sprite? sprite)
|
public static void Prefix(scrVisualDecoration __instance, ref Sprite? sprite)
|
||||||
{
|
{
|
||||||
if (!IsEnabled || !sprite) return;
|
if (!IsEnabled || !sprite) return;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public static class scnGamePatch
|
|||||||
|
|
||||||
var nonTile = RenderManager.Instance &&
|
var nonTile = RenderManager.Instance &&
|
||||||
RenderManager.Instance.stage >= RenderStage.Load &&
|
RenderManager.Instance.stage >= RenderStage.Load &&
|
||||||
RenderManager.Instance.Configuration?.AdvancedConfig?.NonTile == true;
|
RenderManager.Instance.Configuration.AdvancedConfig.NonTile;
|
||||||
|
|
||||||
if (!nonTile) return;
|
if (!nonTile) return;
|
||||||
foreach (var floor in scrLevelMaker.instance.listFloors)
|
foreach (var floor in scrLevelMaker.instance.listFloors)
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public static class scrControllerPatch
|
|||||||
/// <param name="__instance">The game controller.</param>
|
/// <param name="__instance">The game controller.</param>
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch("OnLandOnPortal")]
|
[HarmonyPatch("OnLandOnPortal")]
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public static void PreventWinTextsPostfix(scrController __instance)
|
public static void PreventWinTextsPostfix(scrController __instance)
|
||||||
{
|
{
|
||||||
if (!RenderManager.IsActive || __instance == null) return;
|
if (!RenderManager.IsActive || __instance == null) return;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class scrFloorPatch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch("Start")]
|
[HarmonyPatch("Start")]
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public static void ForceEnableOnStart(scrFloor __instance)
|
public static void ForceEnableOnStart(scrFloor __instance)
|
||||||
{
|
{
|
||||||
if (RenderManager.Instance &&
|
if (RenderManager.Instance &&
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ internal class CommonWarningDialogUI : MonoBehaviour
|
|||||||
var btnRowObj = new GameObject("ButtonRow");
|
var btnRowObj = new GameObject("ButtonRow");
|
||||||
btnRowObj.transform.SetParent(content, false);
|
btnRowObj.transform.SetParent(content, false);
|
||||||
var btnRowRect = btnRowObj.AddComponent<RectTransform>();
|
var btnRowRect = btnRowObj.AddComponent<RectTransform>();
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var btnRowLE = btnRowObj.AddComponent<LayoutElement>();
|
var btnRowLE = btnRowObj.AddComponent<LayoutElement>();
|
||||||
btnRowLE.preferredHeight = 40f;
|
btnRowLE.preferredHeight = 40f;
|
||||||
btnRowLE.flexibleWidth = 1f;
|
btnRowLE.flexibleWidth = 1f;
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
descText.lineSpacing = 5;
|
descText.lineSpacing = 5;
|
||||||
descText.color = new Color(0.85f, 0.85f, 0.85f, 1f);
|
descText.color = new Color(0.85f, 0.85f, 0.85f, 1f);
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var descLE = descText.gameObject.AddComponent<LayoutElement>();
|
var descLE = descText.gameObject.AddComponent<LayoutElement>();
|
||||||
descLE.flexibleWidth = 1f;
|
descLE.flexibleWidth = 1f;
|
||||||
descLE.flexibleHeight = 1f;
|
descLE.flexibleHeight = 1f;
|
||||||
@@ -237,6 +238,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
_buttonContainerObj.transform.SetParent(content, false);
|
_buttonContainerObj.transform.SetParent(content, false);
|
||||||
_buttonContainerObj.layer = 5;
|
_buttonContainerObj.layer = 5;
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var btnContainerLE = _buttonContainerObj.AddComponent<LayoutElement>();
|
var btnContainerLE = _buttonContainerObj.AddComponent<LayoutElement>();
|
||||||
btnContainerLE.preferredHeight = 40f;
|
btnContainerLE.preferredHeight = 40f;
|
||||||
btnContainerLE.flexibleWidth = 1f;
|
btnContainerLE.flexibleWidth = 1f;
|
||||||
@@ -265,6 +267,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
downloadBtn.NormalColor = ctx.Theme.ObjectActiveBright;
|
downloadBtn.NormalColor = ctx.Theme.ObjectActiveBright;
|
||||||
downloadBtn.UpdateVisual();
|
downloadBtn.UpdateVisual();
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var downloadBtnLE = downloadBtn.Rect.gameObject.AddComponent<LayoutElement>();
|
var downloadBtnLE = downloadBtn.Rect.gameObject.AddComponent<LayoutElement>();
|
||||||
downloadBtnLE.flexibleWidth = 1f;
|
downloadBtnLE.flexibleWidth = 1f;
|
||||||
downloadBtnLE.preferredHeight = 40f;
|
downloadBtnLE.preferredHeight = 40f;
|
||||||
@@ -277,6 +280,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
id: "btn_ffmpeg_cancel",
|
id: "btn_ffmpeg_cancel",
|
||||||
height: 40f
|
height: 40f
|
||||||
);
|
);
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var cancelBtnLE = cancelBtn.Rect.gameObject.AddComponent<LayoutElement>();
|
var cancelBtnLE = cancelBtn.Rect.gameObject.AddComponent<LayoutElement>();
|
||||||
cancelBtnLE.flexibleWidth = 1f;
|
cancelBtnLE.flexibleWidth = 1f;
|
||||||
cancelBtnLE.preferredHeight = 40f;
|
cancelBtnLE.preferredHeight = 40f;
|
||||||
@@ -288,6 +292,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
_progressBarObj.layer = 5;
|
_progressBarObj.layer = 5;
|
||||||
_progressBarObj.SetActive(false);
|
_progressBarObj.SetActive(false);
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var pbLE = _progressBarObj.AddComponent<LayoutElement>();
|
var pbLE = _progressBarObj.AddComponent<LayoutElement>();
|
||||||
pbLE.preferredHeight = 24f;
|
pbLE.preferredHeight = 24f;
|
||||||
pbLE.flexibleWidth = 1f;
|
pbLE.flexibleWidth = 1f;
|
||||||
@@ -355,6 +360,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
_statusTextObj.layer = 5;
|
_statusTextObj.layer = 5;
|
||||||
_statusTextObj.SetActive(false);
|
_statusTextObj.SetActive(false);
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var statusLE = _statusTextObj.AddComponent<LayoutElement>();
|
var statusLE = _statusTextObj.AddComponent<LayoutElement>();
|
||||||
statusLE.preferredHeight = 22f;
|
statusLE.preferredHeight = 22f;
|
||||||
statusLE.flexibleWidth = 1f;
|
statusLE.flexibleWidth = 1f;
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ internal class SegmentedControl<T> : O5Object
|
|||||||
segmentObj.transform.SetParent(maskRect, false);
|
segmentObj.transform.SetParent(maskRect, false);
|
||||||
|
|
||||||
var segRect = segmentObj.AddComponent<RectTransform>();
|
var segRect = segmentObj.AddComponent<RectTransform>();
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
var segLE = segmentObj.AddComponent<LayoutElement>();
|
var segLE = segmentObj.AddComponent<LayoutElement>();
|
||||||
segLE.minWidth = 0f;
|
segLE.minWidth = 0f;
|
||||||
segLE.preferredWidth = 0f;
|
segLE.preferredWidth = 0f;
|
||||||
@@ -323,7 +324,7 @@ internal class SegmentedControl<T> : O5Object
|
|||||||
if (EqualityComparer<T>.Default.Equals(_value, newValue)) return;
|
if (EqualityComparer<T>.Default.Equals(_value, newValue)) return;
|
||||||
|
|
||||||
_value = newValue;
|
_value = newValue;
|
||||||
UpdateVisual(false);
|
UpdateVisual();
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
{
|
{
|
||||||
@@ -337,7 +338,7 @@ internal class SegmentedControl<T> : O5Object
|
|||||||
if (EqualityComparer<T>.Default.Equals(_value, value)) return;
|
if (EqualityComparer<T>.Default.Equals(_value, value)) return;
|
||||||
|
|
||||||
_value = value;
|
_value = value;
|
||||||
UpdateVisual(false);
|
UpdateVisual();
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ internal static class AudioSpectrumGenerator
|
|||||||
_store = _ownStore;
|
_store = _ownStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
_source = AudioClipResolver.GetOrAdd(_store, clip!.name, clip);
|
_source = AudioClipResolver.GetOrAdd(_store, clip.name, clip);
|
||||||
if (_source == null)
|
if (_source == null)
|
||||||
{
|
{
|
||||||
Melon<RenderMod>.Logger.Error($"[AudioSpectrumGenerator] Song clip '{clip.name}' could not be loaded, the spectrum will be empty.");
|
Melon<RenderMod>.Logger.Error($"[AudioSpectrumGenerator] Song clip '{clip.name}' could not be loaded, the spectrum will be empty.");
|
||||||
@@ -125,7 +125,7 @@ internal static class AudioSpectrumGenerator
|
|||||||
{
|
{
|
||||||
var n = samples.Length;
|
var n = samples.Length;
|
||||||
var conductor = scrConductor.instance;
|
var conductor = scrConductor.instance;
|
||||||
if (_source == null || _store == null || !conductor || !conductor!.hasSongStarted || !conductor.song
|
if (_source == null || _store == null || !conductor || !conductor.hasSongStarted || !conductor.song
|
||||||
|| n == 0 || (n & (n - 1)) != 0)
|
|| n == 0 || (n & (n - 1)) != 0)
|
||||||
{
|
{
|
||||||
Array.Clear(samples, 0, n);
|
Array.Clear(samples, 0, n);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ADOFAIRenderer.Util.Audio;
|
namespace ADOFAIRenderer.Util.Audio;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ internal static class AudioClipResolver
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!clip) return store.GetOrAdd(key, () => null);
|
if (!clip) return store.GetOrAdd(key, () => null);
|
||||||
return store.GetOrAdd(key, () => UnityClipLoader.Load(clip!, store));
|
return store.GetOrAdd(key, () => UnityClipLoader.Load(clip, store));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Opens <paramref name="path"/> with FFmpeg; mono MP3 files are wrapped in <see cref="MP3MonoLayoutReader"/> (game layout).</summary>
|
/// <summary>Opens <paramref name="path"/> with FFmpeg; mono MP3 files are wrapped in <see cref="MP3MonoLayoutReader"/> (game layout).</summary>
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ internal sealed class AudioClipStore : IDisposable
|
|||||||
// same key meanwhile, its entry wins and this source is discarded.
|
// same key meanwhile, its entry wins and this source is discarded.
|
||||||
lock (_sources)
|
lock (_sources)
|
||||||
{
|
{
|
||||||
if (_disposed || _sources.TryGetValue(key, out var raced))
|
if (_disposed || _sources.TryGetValue(key, out _))
|
||||||
{
|
{
|
||||||
source?.DisposeInternal();
|
source?.DisposeInternal();
|
||||||
return _disposed ? null : _sources[key];
|
return _disposed ? null : _sources[key];
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ internal sealed class DecodeStream : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Greatest common divisor of two positive integers (Euclid).</summary>
|
/// <summary>Greatest common divisor of two positive integers (Euclid).</summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
private static int GCD(int a, int b)
|
private static int GCD(int a, int b)
|
||||||
{
|
{
|
||||||
while (b != 0) (a, b) = (b, a % b);
|
while (b != 0) (a, b) = (b, a % b);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ internal sealed unsafe class FFmpegPCMReader : IPCMReader
|
|||||||
public long Position { get; private set; }
|
public long Position { get; private set; }
|
||||||
|
|
||||||
/// <summary>True when the stream is MP3 and is decoded with the game's MP3 timing (see class summary).</summary>
|
/// <summary>True when the stream is MP3 and is decoded with the game's MP3 timing (see class summary).</summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
public bool IsMP3 { get; }
|
public bool IsMP3 { get; }
|
||||||
|
|
||||||
/// <summary>Number of demuxer seeks performed (for diagnostics).</summary>
|
/// <summary>Number of demuxer seeks performed (for diagnostics).</summary>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace ADOFAIRenderer.Util.Audio.Clip;
|
namespace ADOFAIRenderer.Util.Audio.Clip;
|
||||||
@@ -20,6 +19,7 @@ namespace ADOFAIRenderer.Util.Audio.Clip;
|
|||||||
/// - Samples per frame: Layer I 384, Layer II 1152, Layer III 1152 (MPEG-1) or 576 (MPEG-2/2.5).
|
/// - Samples per frame: Layer I 384, Layer II 1152, Layer III 1152 (MPEG-1) or 576 (MPEG-2/2.5).
|
||||||
/// - ID3v2 tags before the first frame: "ID3", version (2 bytes), flags (bit 0x10 = 10-byte footer), size (4 bytes, 7 bits each).
|
/// - ID3v2 tags before the first frame: "ID3", version (2 bytes), flags (bit 0x10 = 10-byte footer), size (4 bytes, 7 bits each).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
internal static class MP3HeaderFrame
|
internal static class MP3HeaderFrame
|
||||||
{
|
{
|
||||||
/// <summary>Bytes searched for the first frame sync after the ID3v2 tags.</summary>
|
/// <summary>Bytes searched for the first frame sync after the ID3v2 tags.</summary>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace ADOFAIRenderer.Util.Audio.Clip;
|
|||||||
/// Output: 1 channel at the inner reader's sample rate. Frame 2k is inner frame k, frame 2k + 1 is 0.
|
/// Output: 1 channel at the inner reader's sample rate. Frame 2k is inner frame k, frame 2k + 1 is 0.
|
||||||
/// <see cref="TotalFrames"/> = 2 * inner TotalFrames.
|
/// <see cref="TotalFrames"/> = 2 * inner TotalFrames.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
internal sealed class MP3MonoLayoutReader : IPCMReader
|
internal sealed class MP3MonoLayoutReader : IPCMReader
|
||||||
{
|
{
|
||||||
private readonly IPCMReader _inner;
|
private readonly IPCMReader _inner;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ internal sealed class OfflineAudioMixer : IDisposable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bgmKey = clip!.name;
|
_bgmKey = clip.name;
|
||||||
_bgmSource = AudioClipResolver.GetOrAdd(_store, _bgmKey, clip);
|
_bgmSource = AudioClipResolver.GetOrAdd(_store, _bgmKey, clip);
|
||||||
if (_bgmSource == null)
|
if (_bgmSource == null)
|
||||||
{
|
{
|
||||||
@@ -268,7 +268,7 @@ internal sealed class OfflineAudioMixer : IDisposable
|
|||||||
|
|
||||||
var state = new SourceState(voice, Math.Max(startTime, now), pitch, loop, loop ? endTime : double.PositiveInfinity,
|
var state = new SourceState(voice, Math.Max(startTime, now), pitch, loop, loop ? endTime : double.PositiveInfinity,
|
||||||
clipSource?.Duration ?? 0.0, _sampleRate);
|
clipSource?.Duration ?? 0.0, _sampleRate);
|
||||||
if (source) MapSource(source!, state);
|
if (source) MapSource(source, state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ internal sealed class SourceState
|
|||||||
public void BindClip(AudioClip? clip)
|
public void BindClip(AudioClip? clip)
|
||||||
{
|
{
|
||||||
if (!clip) return;
|
if (!clip) return;
|
||||||
_length = clip!.length;
|
_length = clip.length;
|
||||||
_frequency = Math.Max(1, clip.frequency);
|
_frequency = Math.Max(1, clip.frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,14 +107,13 @@ internal sealed class VideoEncoder : IEquatable<VideoEncoder>
|
|||||||
/// (for the families the codec has); GPUUtil.GetPrioritizedEncoders keeps this order for the encoders that do not
|
/// (for the families the codec has); GPUUtil.GetPrioritizedEncoders keeps this order for the encoders that do not
|
||||||
/// belong to the active GPU vendor.
|
/// belong to the active GPU vendor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IReadOnlyList<VideoEncoder> All = new[]
|
public static readonly IReadOnlyList<VideoEncoder> All = [
|
||||||
{
|
|
||||||
H264_NVENC, H264_QSV, H264_AMF, H264_VideoToolbox, Libx264,
|
H264_NVENC, H264_QSV, H264_AMF, H264_VideoToolbox, Libx264,
|
||||||
HEVC_NVENC, HEVC_QSV, HEVC_AMF, HEVC_VideoToolbox, Libx265,
|
HEVC_NVENC, HEVC_QSV, HEVC_AMF, HEVC_VideoToolbox, Libx265,
|
||||||
VP9_NVENC, VP9_QSV, LibvpxVP9,
|
VP9_NVENC, VP9_QSV, LibvpxVP9,
|
||||||
AV1_NVENC, AV1_QSV, AV1_AMF, LibSvtAv1, LibAomAv1,
|
AV1_NVENC, AV1_QSV, AV1_AMF, LibSvtAv1, LibAomAv1,
|
||||||
LibVvenc
|
LibVvenc
|
||||||
};
|
];
|
||||||
|
|
||||||
/// <summary>Lookup table of <see cref="All"/> by <see cref="Name"/> (case-insensitive), used by <see cref="FromName"/>.</summary>
|
/// <summary>Lookup table of <see cref="All"/> by <see cref="Name"/> (case-insensitive), used by <see cref="FromName"/>.</summary>
|
||||||
private static readonly Dictionary<string, VideoEncoder> ByName =
|
private static readonly Dictionary<string, VideoEncoder> ByName =
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using O5Kit.Control;
|
using O5Kit.Control;
|
||||||
using O5Kit.Core;
|
using O5Kit.Core;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ADOFAIRenderer.Util.UI;
|
namespace ADOFAIRenderer.Util.UI;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user