Skip to content

Commit

Permalink
Hotfix /playsound hard-crashing the game
Browse files Browse the repository at this point in the history
Closes #13 by removing the old signature-based hook to play chat sounds and replacing it with ClientStructs.
  • Loading branch information
PrincessRTFM committed Jul 22, 2024
1 parent f923ca5 commit 040de20
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 29 deletions.
10 changes: 4 additions & 6 deletions TinyCmds/Commands/PlayChatSound.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using FFXIVClientStructs.FFXIV.Client.UI;

using PrincessRTFM.TinyCmds.Attributes;
using PrincessRTFM.TinyCmds.Chat;
using PrincessRTFM.TinyCmds.Utils;
Expand All @@ -11,18 +13,14 @@ namespace PrincessRTFM.TinyCmds.Commands;
)]
public class PlayChatSound: PluginCommand {
protected override void Execute(string? command, string rawArguments, FlagMap flags, bool verbose, bool dryRun, ref bool showHelp) {
if (!Plugin.Sfx.Valid) {
ChatUtil.ShowPrefixedError("Unable to play sounds, the relevant game function couldn't be located");
return;
}
if (!int.TryParse(rawArguments, out int idx)) {
if (!uint.TryParse(rawArguments, out uint idx)) {
ChatUtil.ShowPrefixedError("Invalid value, must provide a sound ID from 1-16, inclusive");
return;
}
if (idx is < 1 or > 16) {
ChatUtil.ShowPrefixedError("Invalid sound ID, must be 1-16 inclusive");
return;
}
Plugin.Sfx.Play(SoundsExtensions.FromGameIndex(idx));
UIModule.PlayChatSoundEffect(idx);
}
}
20 changes: 0 additions & 20 deletions TinyCmds/Internal/PlaySound.cs

This file was deleted.

2 changes: 0 additions & 2 deletions TinyCmds/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public class Plugin: IDalamudPlugin {
[PluginService] internal static IPluginLog Log { get; private set; } = null!;
[PluginService] internal static IGameInteropProvider Interop { get; private set; } = null!;
internal static PluginCommandManager CommandManager { get; private set; } = null!;
internal static PlaySound Sfx { get; private set; } = null!;
internal static XivCommonBase Common { get; private set; } = null!;
internal static ServerChat ServerChat { get; private set; } = null!;

Expand All @@ -59,7 +58,6 @@ public Plugin() {
//ServerChat = Common.Functions.Chat;
// XivCommon isn't updated yet, so we're ripping the chat functionality locally
ServerChat = new(Scanner);
Sfx = new();
CommandManager = new(this) {
ErrorHandler = ChatUtil.ShowPrefixedError
};
Expand Down
2 changes: 1 addition & 1 deletion TinyCmds/TinyCmds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Product>TinyCmds</Product>
<Version>8.9.0</Version>
<Version>8.9.1</Version>
<Description>This plugin adds tiny and simple but useful chat commands, and nothing more. It finally has a UI specifically for command help.</Description>
<PackageProjectUrl>https://github.com/PrincessRTFM/TinyCommands</PackageProjectUrl>
<Copyright>Copyleft VariableVixen 2021</Copyright>
Expand Down

0 comments on commit 040de20

Please sign in to comment.