From a17c867fba1518b7a3604696175d320282d6f95659c4acb408c63c7d69a5cfc7 Mon Sep 17 00:00:00 2001 From: copecone Date: Tue, 9 Jun 2026 22:09:59 +0900 Subject: [PATCH] Refactor Codec Map Code --- RenderMod.cs | 2 +- Util/GPUUtil.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RenderMod.cs b/RenderMod.cs index b73696a..f830cbf 100644 --- a/RenderMod.cs +++ b/RenderMod.cs @@ -7,7 +7,7 @@ using MelonLoader.Utils; using UnityEngine; using UnityEngine.EventSystems; -[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.1.0-BETA", "ADOFAI Editor Forum")] +[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.4-INDEV", "ADOFAI Editor Forum")] [assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")] namespace ADOFAIRenderer diff --git a/Util/GPUUtil.cs b/Util/GPUUtil.cs index dec0bb4..ac3a2fe 100644 --- a/Util/GPUUtil.cs +++ b/Util/GPUUtil.cs @@ -20,13 +20,13 @@ namespace ADOFAIRenderer.Util private const string IntelPattern = @"^Intel(?>\(R\))* (?>U*HD Graphics [0-9]+$|Arc\(TM\) [A-C][0-9]+ Graphics)"; - private static Dictionary> _codecMap = new Dictionary> + private static readonly Dictionary> CodecMap = new Dictionary> { - { Codec.H264, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "h264_nvenc"), (GPUVendor.Intel, "h264_qsv"), (GPUVendor.AMD, "h264_amf"), (GPUVendor.Unknown, "libx264") } }, - { Codec.H265, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "hevc_nvenc"), (GPUVendor.Intel, "hevc_qsv"), (GPUVendor.AMD, "hevc_amf"), (GPUVendor.Unknown, "libx265") } }, - { Codec.VP9, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "vp9_nvenc"), (GPUVendor.Intel, "vp9_qsv"), (GPUVendor.Unknown, "libvpx-vp9") } }, - { Codec.AV1, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "av1_nvenc"), (GPUVendor.Intel, "av1_qsv"), (GPUVendor.AMD, "av1_amf"), (GPUVendor.Unknown, "libsvtav1"), (GPUVendor.Unknown, "libaom-av1") } }, - { Codec.VVC, new List<(GPUVendor, string)> { (GPUVendor.Unknown, "libvvenc") }} + [Codec.H264] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "h264_nvenc"), (GPUVendor.Intel, "h264_qsv"), (GPUVendor.AMD, "h264_amf"), (GPUVendor.Unknown, "libx264") }, + [Codec.H265] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "hevc_nvenc"), (GPUVendor.Intel, "hevc_qsv"), (GPUVendor.AMD, "hevc_amf"), (GPUVendor.Unknown, "libx265") }, + [Codec.VP9] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "vp9_nvenc"), (GPUVendor.Intel, "vp9_qsv"), (GPUVendor.Unknown, "libvpx-vp9") }, + [Codec.AV1] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "av1_nvenc"), (GPUVendor.Intel, "av1_qsv"), (GPUVendor.AMD, "av1_amf"), (GPUVendor.Unknown, "libsvtav1"), (GPUVendor.Unknown, "libaom-av1") }, + [Codec.VVC] = new List<(GPUVendor, string)> { (GPUVendor.Unknown, "libvvenc") } }; public static GPUVendor GetActiveGPUVendor() @@ -49,7 +49,7 @@ namespace ADOFAIRenderer.Util public static List GetPrioritizedEncoderCandidates(Codec codec) { - if (!_codecMap.TryGetValue(codec, out var list)) return new List(); + if (!CodecMap.TryGetValue(codec, out var list)) return new List(); var vendor = GetActiveGPUVendor(); var prioritized = new List();