Wire audio end-to-end (OGG plays natively in Godot; no Frida, no decode):
- IHost.PlayBgm/PlayVoice + VM dispatch for play-bgm(0xbf)/play-voice(0xc4).
Non-Godot hosts no-op them so --selftest + engine 8/8 stay byte-identical.
- GodotAdvHost resolves id->OGG; Main plays via two AudioStreamPlayer nodes
(BGM looping; voice interrupt-on-new).
Key finding (by-ear, systematic-debugging): the two audio ops use DIFFERENT
addressing — the earlier "unified manifest" assumption was wrong for BGM.
- play-voice -> per-scene manifest files[base+id] (offset 0, same as textures).
Confirmed by ear; upgraded med->HIGH.
- play-bgm -> DIRECT LITERAL NAME BGM{id:03d}.OGG, NOT the manifest.
Real game: play-bgm 5->BGM005, 8->BGM008 (manifest gave +1). Proven by
play-bgm 0x23->BGM035 (real standalone track; BGM set skips 030-034) that the
manifest mis-resolved to a graphics entry. Fix is BGM-only:
ResourceMap.BgmPathById; voices/textures unchanged.
Also: Lily's silence root-caused as correct form-gating (G[0xa57/0xa58/0xa59]),
left unseeded by choice (no dummy state). Added diagnostic
`Age.Cli audio <SCENE.BIN> [0xADDR=VAL ...]`. Corrected opcodes.toml (play-bgm
direct-name, play-voice HIGH) + docs/memory (dropped the bogus unified-manifest
/ Frida-BGM006 claims).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using Age.Engine.Hosting;
|
|
using Age.Engine.Sys4;
|
|
using Age.Engine.Vm;
|
|
using Xunit;
|
|
|
|
public class TextureOpsTests
|
|
{
|
|
private sealed class RecHost : IHost
|
|
{
|
|
public List<(long resId, int slot)> Sets = new();
|
|
public List<(int slot, int w, int h)> Draws = new();
|
|
public int Creates;
|
|
public void ShowText(int o, string t) { }
|
|
public void CallScript(long id) { }
|
|
public void OnStub(int op) { }
|
|
public void WaitForInput() { }
|
|
public void CreateTexture(int slot, int w, int h) => Creates++;
|
|
public void SetTexture(long resId, int slot) => Sets.Add((resId, slot));
|
|
public void DrawTexture(int slot, int srcX, int srcY, int w, int h, int dstX, int dstY) => Draws.Add((slot, w, h));
|
|
public void PlayBgm(long id) { }
|
|
public void PlayVoice(long id) { }
|
|
}
|
|
|
|
[Fact]
|
|
public void SC0000FiresTextureOpsWithSlot0FullScreenSlideshow()
|
|
{
|
|
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
|
var script = Sys4Loader.Load(Paths.Scripts()["SC0000.BIN"], table);
|
|
var host = new RecHost();
|
|
new VirtualMachine(script, table, host).Run();
|
|
Assert.True(host.Creates > 0, "create-texture should fire");
|
|
// The intro loads a sequence of full-screen images into slot 0; res 0x23 is the first bg.
|
|
Assert.Contains(host.Sets, s => s.resId == 0x23 && s.slot == 0);
|
|
Assert.Contains(host.Draws, d => d.slot == 0 && d.w == 0x320 && d.h == 0x258);
|
|
}
|
|
}
|