Skip to content

Commit

Permalink
fix soundplay and update for api11
Browse files Browse the repository at this point in the history
  • Loading branch information
xorus committed Nov 13, 2024
1 parent 870a38f commit 543c657
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Plugin/EngageTimer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.13" />
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<PackageReference Include="EmbedIO" Version="3.5.2"/>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<!-- required for Unosquare.Swan.Lite (implicit dependency of EmbedIO) -->
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
<PackageReference Include="Unosquare.Swan.Lite" Version="3.1.0"/>
Expand Down
3 changes: 1 addition & 2 deletions Plugin/EngageTimer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ image_urls:
category_tags:
- jobs
changelog: |-
- Option to hide the stopwatch/floating window in cutscenes
- Enabling light effect animation would show an error texture and required a plugin restart to be loaded properly
- API11 update
26 changes: 4 additions & 22 deletions Plugin/Game/SFXPlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,16 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System;
using Dalamud.Utility.Signatures;
using System.Diagnostics;
using FFXIVClientStructs.FFXIV.Client.UI;

namespace EngageTimer.Game;

/**
* thanks aers
* sig taken from https://github.com/philpax/plogonscript/blob/main/PlogonScript/Script/Bindings/Sound.cs
* https://github.com/0ceal0t/JobBars/blob/2c9bef8dd4f0bf9ebc91c07e03da6c841ac2bd35/JobBars/Helper/UiHelper.GameFunctions.cs#L61
* ---
* https://discord.com/channels/581875019861328007/653504487352303619/988123102116450335
*/
internal unsafe class GameSound
{
[Signature("E8 ?? ?? ?? ?? 48 63 45 80")]
public readonly delegate* unmanaged<uint, IntPtr, IntPtr, byte, void> PlaySoundEffect = null;

public GameSound()
{
Plugin.GameInterop.InitializeFromAttributes(this);
}
}

public class SfxPlay
{
public const uint FirstSeSfx = 37 - 1;
public const uint SmallTick = 29;
public const uint CdTick = 48;
private readonly GameSound _gameSound = new();

public SfxPlay()
{
Expand All @@ -53,11 +35,11 @@ public SfxPlay()
SoundEffect(0); // should be cursor sound
}

public unsafe void SoundEffect(uint id)
public void SoundEffect(uint id)
{
// var s = new Stopwatch();
// s.Start();
_gameSound.PlaySoundEffect(id, IntPtr.Zero, IntPtr.Zero, 0);
UIGlobals.PlaySoundEffect(id, IntPtr.Zero, IntPtr.Zero, 0);
// s.Stop();
// Plugin.Logger.Debug("Sound play took " + s.ElapsedMilliseconds + "ms");
}
Expand Down
12 changes: 6 additions & 6 deletions Plugin/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.13, )",
"resolved": "2.1.13",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
"requested": "[11.0.0, )",
"resolved": "11.0.0",
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
},
"EmbedIO": {
"type": "Direct",
Expand All @@ -19,9 +19,9 @@
},
"JetBrains.Annotations": {
"type": "Direct",
"requested": "[2023.3.0, )",
"resolved": "2023.3.0",
"contentHash": "PHfnvdBUdGaTVG9bR/GEfxgTwWM0Z97Y6X3710wiljELBISipSfF5okn/vz+C2gfO+ihoEyVPjaJwn8ZalVukA=="
"requested": "[2024.3.0, )",
"resolved": "2024.3.0",
"contentHash": "ox5pkeLQXjvJdyAB4b2sBYAlqZGLh3PjSnP1bQNVx72ONuTJ9+34/+Rq91Fc0dG29XG9RgZur9+NcP4riihTug=="
},
"System.ValueTuple": {
"type": "Direct",
Expand Down

0 comments on commit 543c657

Please sign in to comment.