Implement ADV History voice replay

This commit is contained in:
gamer147
2026-07-19 14:11:49 -04:00
parent eee9022cfb
commit d3698a0612
10 changed files with 134 additions and 21 deletions

View File

@@ -72,6 +72,9 @@ public interface IHost
(int Width, int Height) GetTextureSize(int slot);
void PlayBgm(long id);
void PlayVoice(long id);
// Native voice playback retains a second start argument: ordinary dialogue passes 0,
// while History replay (0x1bd) passes 1. Existing non-audio hosts may ignore it.
void PlayVoice(long id, int playbackVariant) => PlayVoice(id);
void LoadSoundEffect(long resourceId, int channel) { }
void StartSoundEffect(int channel) { }
void ReleaseSoundEffect(int channel) { }

View File

@@ -882,7 +882,12 @@ public sealed class VirtualMachine
case "play-voice":
_autoVoicePending = true;
TextHistory.AppendVoice(Read(a[0]), 0, _advTextStyle);
_host.PlayVoice(Read(a[0])); return pc + 1;
_host.PlayVoice(Read(a[0]), 0); return pc + 1;
case "play-history-voice": // 0x1bd: native voice start/history argument is one
case "u0041D910":
_autoVoicePending = true;
TextHistory.AppendVoice(Read(a[0]), 1, _advTextStyle);
_host.PlayVoice(Read(a[0]), 1); return pc + 1;
case "play-sound-effect": // 0xb4 / semantics: sfx-load
_host.LoadSoundEffect(Read(a[0]), (int)Read(a[1])); return pc + 1;
case "u0041D050": // 0xb5 / semantics: sfx-start