Fix build warnings for fun

This commit is contained in:
Loporrit
2025-06-30 15:53:11 +00:00
parent c8e988abc5
commit dd42bf0913
18 changed files with 54 additions and 47 deletions

View File

@@ -20,31 +20,31 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_symbols.interface.applicable_kinds = interface dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers = dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers = dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers = dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles # Naming styles
dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4 tab_width = 4
@@ -94,7 +94,7 @@ csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion csharp_style_prefer_utf8_string_literals = true:suggestion
dotnet_diagnostic.S1075.severity = silent dotnet_diagnostic.S1075.severity = silent
dotnet_diagnostic.SS3358.severity = true:suggestion dotnet_diagnostic.SS3358.severity = suggestion
dotnet_diagnostic.MA0007.severity = silent dotnet_diagnostic.MA0007.severity = silent
dotnet_diagnostic.MA0075.severity = silent dotnet_diagnostic.MA0075.severity = silent

View File

@@ -18,7 +18,7 @@ internal sealed class DalamudLogger : ILogger
_pluginLog = pluginLog; _pluginLog = pluginLog;
} }
public IDisposable BeginScope<TState>(TState state) => default!; public IDisposable BeginScope<TState>(TState state) where TState : notnull => default!;
public bool IsEnabled(LogLevel logLevel) public bool IsEnabled(LogLevel logLevel)
{ {

View File

@@ -27,6 +27,7 @@ public unsafe sealed class GameChatHooks : IDisposable
private readonly ILogger<GameChatHooks> _logger; private readonly ILogger<GameChatHooks> _logger;
#region signatures #region signatures
#pragma warning disable CS0649
// I do not know what kind of black magic this function performs // I do not know what kind of black magic this function performs
[Signature("E8 ?? ?? ?? ?? 0F B7 7F 08 48 8B CE")] [Signature("E8 ?? ?? ?? ?? 0F B7 7F 08 48 8B CE")]
private readonly delegate* unmanaged<PronounModule*, Utf8String*, byte, Utf8String*> ProcessStringStep2; private readonly delegate* unmanaged<PronounModule*, Utf8String*, byte, Utf8String*> ProcessStringStep2;
@@ -62,7 +63,7 @@ public unsafe sealed class GameChatHooks : IDisposable
DetourName = nameof(ShouldDoNameLookupDetour) DetourName = nameof(ShouldDoNameLookupDetour)
)] )]
private Hook<ShouldDoNameLookupDelegate>? ShouldDoNameLookupHook { get; init; } private Hook<ShouldDoNameLookupDelegate>? ShouldDoNameLookupHook { get; init; }
#pragma warning restore CS0649
#endregion #endregion
private ChatChannelOverride? _chatChannelOverride; private ChatChannelOverride? _chatChannelOverride;

View File

@@ -94,6 +94,7 @@ public sealed class IpcCallerBrio : IIpcCaller
var gameObject = await _dalamudUtilService.CreateGameObjectAsync(address).ConfigureAwait(false); var gameObject = await _dalamudUtilService.CreateGameObjectAsync(address).ConfigureAwait(false);
if (gameObject == null) return default; if (gameObject == null) return default;
var data = await _dalamudUtilService.RunOnFrameworkThread(() => _brioGetModelTransform.InvokeFunc(gameObject)).ConfigureAwait(false); var data = await _dalamudUtilService.RunOnFrameworkThread(() => _brioGetModelTransform.InvokeFunc(gameObject)).ConfigureAwait(false);
if (data.Item1 == null || data.Item2 == null || data.Item3 == null) return default;
_logger.LogDebug("Getting Transform from Actor {actor}", gameObject.Name.TextValue); _logger.LogDebug("Getting Transform from Actor {actor}", gameObject.Name.TextValue);
return new WorldData() return new WorldData()

View File

@@ -16,6 +16,8 @@ public unsafe class VfxSpawnManager : DisposableMediatorSubscriberBase
{ {
private static readonly byte[] _pool = "Client.System.Scheduler.Instance.VfxObject\0"u8.ToArray(); private static readonly byte[] _pool = "Client.System.Scheduler.Instance.VfxObject\0"u8.ToArray();
#region signatures
#pragma warning disable CS0649
[Signature("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")] [Signature("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")]
private readonly delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate; private readonly delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate;
@@ -24,6 +26,8 @@ public unsafe class VfxSpawnManager : DisposableMediatorSubscriberBase
[Signature("40 53 48 83 EC 20 48 8B D9 48 8B 89 ?? ?? ?? ?? 48 85 C9 74 28 33 D2 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9")] [Signature("40 53 48 83 EC 20 48 8B D9 48 8B 89 ?? ?? ?? ?? 48 85 C9 74 28 33 D2 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9")]
private readonly delegate* unmanaged<VfxStruct*, nint> _staticVfxRemove; private readonly delegate* unmanaged<VfxStruct*, nint> _staticVfxRemove;
#pragma warning restore CS0649
#endregion
public VfxSpawnManager(ILogger<VfxSpawnManager> logger, IGameInteropProvider gameInteropProvider, MareMediator mareMediator) public VfxSpawnManager(ILogger<VfxSpawnManager> logger, IGameInteropProvider gameInteropProvider, MareMediator mareMediator)
: base(logger, mareMediator) : base(logger, mareMediator)

View File

@@ -56,11 +56,6 @@ public abstract class ConfigurationServiceBase<T> : IConfigService<T> where T :
if (!File.Exists(ConfigurationPath)) if (!File.Exists(ConfigurationPath))
{ {
config = AttemptToLoadBackup(); config = AttemptToLoadBackup();
if (Equals(config, default(T)))
{
config = (T)Activator.CreateInstance(typeof(T))!;
Save();
}
} }
else else
{ {
@@ -73,12 +68,12 @@ public abstract class ConfigurationServiceBase<T> : IConfigService<T> where T :
// config failed to load for some reason // config failed to load for some reason
config = AttemptToLoadBackup(); config = AttemptToLoadBackup();
} }
}
if (config == null || Equals(config, default(T))) if (config == null || Equals(config, default(T)))
{ {
config = (T)Activator.CreateInstance(typeof(T))!; config = Activator.CreateInstance<T>();
Save(); Save();
}
} }
_configLastWriteTime = GetConfigLastWriteTime(); _configLastWriteTime = GetConfigLastWriteTime();

View File

@@ -142,7 +142,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, async (msg) => Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, async (msg) =>
{ {
Logger.LogDebug("Received Penumbra Mod settings change, updating player"); Logger.LogDebug("Received Penumbra Mod settings change, updating player");
_ = AddPlayerCacheToCreate(); await AddPlayerCacheToCreate();
}); });
Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (msg) => ProcessCacheCreation()); Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (msg) => ProcessCacheCreation());

View File

@@ -126,7 +126,7 @@ public sealed class CharacterAnalyzer : DisposableMediatorSubscriberBase
Logger.LogWarning(ex, "Could not identify extension for {path}", filePath); Logger.LogWarning(ex, "Could not identify extension for {path}", filePath);
} }
var tris = await _xivDataAnalyzer.GetTrianglesByHash(fileEntry.Hash).ConfigureAwait(false); var tris = await Task.Run(() => _xivDataAnalyzer.GetTrianglesByHash(fileEntry.Hash)).ConfigureAwait(false);
foreach (var entry in fileCacheEntries) foreach (var entry in fileCacheEntries)
{ {

View File

@@ -147,7 +147,7 @@ public sealed class PairAnalyzer : DisposableMediatorSubscriberBase
Logger.LogWarning(ex, "Could not identify extension for {path}", filePath); Logger.LogWarning(ex, "Could not identify extension for {path}", filePath);
} }
var tris = await _xivDataAnalyzer.GetTrianglesByHash(fileEntry.Hash).ConfigureAwait(false); var tris = await Task.Run(() => _xivDataAnalyzer.GetTrianglesByHash(fileEntry.Hash)).ConfigureAwait(false);
foreach (var entry in fileCacheEntries) foreach (var entry in fileCacheEntries)
{ {

View File

@@ -66,7 +66,7 @@ public class PlayerPerformanceService : DisposableMediatorSubscriberBase
foreach (var hash in moddedModelHashes) foreach (var hash in moddedModelHashes)
{ {
triUsage += await _xivDataAnalyzer.GetTrianglesByHash(hash).ConfigureAwait(false); triUsage += await Task.Run(() => _xivDataAnalyzer.GetTrianglesByHash(hash)).ConfigureAwait(false);
} }
pair.LastAppliedDataTris = triUsage; pair.LastAppliedDataTris = triUsage;
@@ -208,7 +208,7 @@ public class PlayerPerformanceService : DisposableMediatorSubscriberBase
if (fileEntry == null) return; if (fileEntry == null) return;
if (fileEntry.IsSubstEntry) return; if (fileEntry.IsSubstEntry) return;
var texFormat = await _xivDataAnalyzer.GetTexFormatByHash(hash); var texFormat = await Task.Run(() => _xivDataAnalyzer.GetTexFormatByHash(hash));
var filePath = fileEntry.ResolvedFilepath; var filePath = fileEntry.ResolvedFilepath;
var tmpFilePath = _fileCacheManager.GetSubstFilePath(Guid.NewGuid().ToString(), "tmp"); var tmpFilePath = _fileCacheManager.GetSubstFilePath(Guid.NewGuid().ToString(), "tmp");
var newFilePath = _fileCacheManager.GetSubstFilePath(hash, "tex"); var newFilePath = _fileCacheManager.GetSubstFilePath(hash, "tex");

View File

@@ -153,7 +153,7 @@ public sealed class XivDataAnalyzer
return output; return output;
} }
public async Task<long> GetTrianglesByHash(string hash) public long GetTrianglesByHash(string hash)
{ {
if (_configService.Current.TriangleDictionary.TryGetValue(hash, out var cachedTris) && cachedTris > 0) if (_configService.Current.TriangleDictionary.TryGetValue(hash, out var cachedTris) && cachedTris > 0)
return cachedTris; return cachedTris;
@@ -215,7 +215,7 @@ public sealed class XivDataAnalyzer
} }
} }
public async Task<(uint Format, int MipCount, ushort Width, ushort Height)> GetTexFormatByHash(string hash) public (uint Format, int MipCount, ushort Width, ushort Height) GetTexFormatByHash(string hash)
{ {
if (_configService.Current.TexDictionary.TryGetValue(hash, out var cachedTex) && cachedTex.Mip0Size > 0) if (_configService.Current.TexDictionary.TryGetValue(hash, out var cachedTex) && cachedTex.Mip0Size > 0)
return cachedTex; return cachedTex;

View File

@@ -13,14 +13,16 @@ internal sealed partial class CharaDataHubUi
AccessTypeDto.AllPairs => "All Pairs", AccessTypeDto.AllPairs => "All Pairs",
AccessTypeDto.ClosePairs => "Direct Pairs", AccessTypeDto.ClosePairs => "Direct Pairs",
AccessTypeDto.Individuals => "Specified", AccessTypeDto.Individuals => "Specified",
AccessTypeDto.Public => "Everyone" AccessTypeDto.Public => "Everyone",
_ => ((int)dto).ToString()
}; };
private static string GetShareTypeString(ShareTypeDto dto) => dto switch private static string GetShareTypeString(ShareTypeDto dto) => dto switch
{ {
ShareTypeDto.Private => "Code Only", ShareTypeDto.Private => "Code Only",
ShareTypeDto.Shared => "Shared" ShareTypeDto.Shared => "Shared",
}; _ => ((int)dto).ToString()
};
private static string GetWorldDataTooltipText(PoseEntryExtended poseEntry) private static string GetWorldDataTooltipText(PoseEntryExtended poseEntry)
{ {

View File

@@ -480,8 +480,8 @@ internal sealed partial class CharaDataHubUi
ImGui.SameLine(); ImGui.SameLine();
ImGuiHelpers.ScaledDummy(10, 1); ImGuiHelpers.ScaledDummy(10, 1);
ImGui.SameLine(); ImGui.SameLine();
var worldData = pose.WorldData; var worldData = pose.WorldData ?? default;
bool hasWorldData = (worldData ?? default) != default; bool hasWorldData = worldData != default;
_uiSharedService.IconText(FontAwesomeIcon.Globe, UiSharedService.GetBoolColor(hasWorldData)); _uiSharedService.IconText(FontAwesomeIcon.Globe, UiSharedService.GetBoolColor(hasWorldData));
var tooltipText = !hasWorldData ? "This Pose has no world data attached." : "This Pose has world data attached."; var tooltipText = !hasWorldData ? "This Pose has no world data attached." : "This Pose has world data attached.";
if (hasWorldData) if (hasWorldData)
@@ -491,8 +491,8 @@ internal sealed partial class CharaDataHubUi
UiSharedService.AttachToolTip(tooltipText); UiSharedService.AttachToolTip(tooltipText);
if (hasWorldData && ImGui.IsItemClicked(ImGuiMouseButton.Left)) if (hasWorldData && ImGui.IsItemClicked(ImGuiMouseButton.Left))
{ {
_dalamudUtilService.SetMarkerAndOpenMap(position: new Vector3(worldData.Value.PositionX, worldData.Value.PositionY, worldData.Value.PositionZ), _dalamudUtilService.SetMarkerAndOpenMap(position: new Vector3(worldData.PositionX, worldData.PositionY, worldData.PositionZ),
_dalamudUtilService.MapData.Value[worldData.Value.LocationInfo.MapId].Map); _dalamudUtilService.MapData.Value[worldData.LocationInfo.MapId].Map);
} }
ImGui.SameLine(); ImGui.SameLine();
using (ImRaii.Disabled(!_uiSharedService.IsInGpose || !(_charaDataManager.AttachingPoseTask?.IsCompleted ?? true) || !_charaDataManager.BrioAvailable)) using (ImRaii.Disabled(!_uiSharedService.IsInGpose || !(_charaDataManager.AttachingPoseTask?.IsCompleted ?? true) || !_charaDataManager.BrioAvailable))

View File

@@ -27,7 +27,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
Pair = pair; Pair = pair;
_uiSharedService = uiSharedService; _uiSharedService = uiSharedService;
_apiController = apiController; _apiController = apiController;
_ownPermissions = pair.UserPair.OwnPermissions.DeepClone(); _ownPermissions = pair.UserPair?.OwnPermissions.DeepClone() ?? default;
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize; Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize;
SizeConstraints = new() SizeConstraints = new()
{ {
@@ -49,6 +49,9 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
_uiSharedService.BigText("Permissions for " + Pair.UserData.AliasOrUID); _uiSharedService.BigText("Permissions for " + Pair.UserData.AliasOrUID);
ImGuiHelpers.ScaledDummy(1f); ImGuiHelpers.ScaledDummy(1f);
if (Pair.UserPair == null)
return;
if (ImGui.Checkbox("Pause Sync", ref paused)) if (ImGui.Checkbox("Pause Sync", ref paused))
{ {
_ownPermissions.SetPaused(paused); _ownPermissions.SetPaused(paused);

View File

@@ -351,7 +351,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
using var pushId = ImRaii.PushId(bannedUser.UID); using var pushId = ImRaii.PushId(bannedUser.UID);
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Check, "Unban")) if (_uiSharedService.IconTextButton(FontAwesomeIcon.Check, "Unban"))
{ {
_apiController.GroupUnbanUser(bannedUser); Task.Run(async () => await _apiController.GroupUnbanUser(bannedUser));
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal)); _bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
} }
} }

View File

@@ -661,7 +661,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
} }
public T? DrawColorCombo<T>(string comboName, IEnumerable<T> comboItems, Func<T, (uint Color, string Name)> toEntry, public T? DrawColorCombo<T>(string comboName, IEnumerable<T> comboItems, Func<T, (uint Color, string Name)> toEntry,
Action<T>? onSelected = null, T? initialSelectedItem = default) Action<T?>? onSelected = null, T? initialSelectedItem = default)
{ {
if (!comboItems.Any()) return default; if (!comboItems.Any()) return default;
@@ -689,7 +689,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
{ {
entry = toEntry(item); entry = toEntry(item);
ImGui.PushStyleColor(ImGuiCol.Text, ColorHelpers.RgbaUintToVector4(ColorHelpers.SwapEndianness(entry.Color))); ImGui.PushStyleColor(ImGuiCol.Text, ColorHelpers.RgbaUintToVector4(ColorHelpers.SwapEndianness(entry.Color)));
bool isSelected = EqualityComparer<T>.Default.Equals(item, (T)selectedItem); bool isSelected = EqualityComparer<T>.Default.Equals(item, (T)selectedItem!);
if (ImGui.Selectable(entry.Name, isSelected)) if (ImGui.Selectable(entry.Name, isSelected))
{ {
_selectedComboItems[comboName] = item!; _selectedComboItems[comboName] = item!;

View File

@@ -215,13 +215,14 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
if (_dalamudUtil.HasModifiedGameFiles) if (_dalamudUtil.HasModifiedGameFiles)
{ {
Logger.LogError("Detected modified game files on connection"); Logger.LogWarning("Detected modified game files on connection");
if (false) #if false
Mediator.Publish(new NotificationMessage("Modified Game Files detected", Mediator.Publish(new NotificationMessage("Modified Game Files detected",
"Dalamud has reported modified game files in your FFXIV installation. " + "Dalamud has reported modified game files in your FFXIV installation. " +
"You will be able to connect, but the synchronization functionality might be (partially) broken. " + "You will be able to connect, but the synchronization functionality might be (partially) broken. " +
"Exit the game and repair it through XIVLauncher to get rid of this message.", "Exit the game and repair it through XIVLauncher to get rid of this message.",
NotificationType.Error, TimeSpan.FromSeconds(15))); NotificationType.Error, TimeSpan.FromSeconds(15)));
#endif
} }
await LoadIninitialPairs().ConfigureAwait(false); await LoadIninitialPairs().ConfigureAwait(false);

View File

@@ -39,7 +39,7 @@ public record HubConnectionConfig
"longpolling" => HttpTransportType.LongPolling, "longpolling" => HttpTransportType.LongPolling,
_ => HttpTransportType.None _ => HttpTransportType.None
}; };
}; }
return result; return result;
} }