Skip to content

Commit

Permalink
Fix special modes
Browse files Browse the repository at this point in the history
  • Loading branch information
slotthhy committed Jul 18, 2024
1 parent 2737d2c commit d04afe8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Orchestrion/BGMSystem/BGMAddressResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static unsafe void Init()
{
_baseAddress = DalamudApi.SigScanner.GetStaticAddressFromSig("48 8B 05 ?? ?? ?? ?? 48 85 C0 74 51 83 78 08 0B");
AddRestartId = DalamudApi.SigScanner.ScanText("E8 ?? ?? ?? ?? 88 9D ?? ?? ?? ?? 84 DB");
GetSpecialMode = DalamudApi.SigScanner.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 44 8B 41 10");
GetSpecialMode = DalamudApi.SigScanner.ScanText("40 57 48 83 EC 20 48 83 79 ?? ?? 48 8B F9 0F 84 ?? ?? ?? ?? 0F B6 51 4D");

DalamudApi.PluginLog.Debug($"[BGMAddressResolver] init: base address at {_baseAddress.ToInt64():X}");

Expand Down
12 changes: 6 additions & 6 deletions Orchestrion/BGMSystem/BGMController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class BGMController
private unsafe delegate DisableRestart* AddDisableRestartIdPrototype(BGMScene* scene, ushort songId);
private readonly AddDisableRestartIdPrototype _addDisableRestartId;

private unsafe delegate int GetSpecialModeByScenePrototype(BGMPlayer* bgmPlayer, byte specialModeType);
private unsafe delegate int GetSpecialModeByScenePrototype(BGMPlayer* bgmPlayer);
private readonly Hook<GetSpecialModeByScenePrototype> _getSpecialModeForSceneHook;

public unsafe BGMController()
Expand Down Expand Up @@ -196,15 +196,15 @@ public void SetSong(ushort songId, int priority = 0)
}
}

private unsafe int GetSpecialModeBySceneDetour(BGMPlayer* player, byte specialModeType)
private unsafe int GetSpecialModeBySceneDetour(BGMPlayer* player)
{
// Let the game do what it needs to do
if (player->BgmScene != PlayingScene
|| player->BgmId != PlayingSongId
|| specialModeType == 0)
return _getSpecialModeForSceneHook.Original(player, specialModeType);
|| player->SpecialModeType == 0)
return _getSpecialModeForSceneHook.Original(player);

if (!SongList.Instance.TryGetSong(player->BgmId, out var song)) return _getSpecialModeForSceneHook.Original(player, specialModeType);
if (!SongList.Instance.TryGetSong(player->BgmId, out var song)) return _getSpecialModeForSceneHook.Original(player);

// Default to scene 10 behavior, but if the mode is mount mode, use the mount scene
uint newScene = 10;
Expand All @@ -214,7 +214,7 @@ private unsafe int GetSpecialModeBySceneDetour(BGMPlayer* player, byte specialMo
// Trick the game into giving us the result we want for the scene our song should actually be playing on
var tempScene = player->BgmScene;
player->BgmScene = newScene;
var result = _getSpecialModeForSceneHook.Original(player, specialModeType);
var result = _getSpecialModeForSceneHook.Original(player);
player->BgmScene = tempScene;
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion Orchestrion/Orchestrion.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<PluginVersion>2.2.0.6</PluginVersion>
<PluginVersion>2.2.0.7</PluginVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit d04afe8

Please sign in to comment.