feat(a2b): implement 0x208 get-texture-size (geometry keystone)
Promote 0x208 from stub to a real VM op that writes the loaded texture's width/height into its two output globals, via new IHost.GetTextureSize. This is the single native primitive the CG-load subroutine (SC0000 label_12649) needs; all downstream centering/anchor geometry is already computed in bytecode. Non-Godot hosts return (0,0) so trace/selftest parity holds (engine 9/9 incl. TraceDiffTests). Godot host gets a temporary (0,0) stub; real impl in the compositor task. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ public sealed class CaptureHost : IHost
|
||||
public void CreateTexture(int slot, int width, int height) { }
|
||||
public void SetTexture(long resourceId, int slot) { }
|
||||
public void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY) { }
|
||||
public (int Width, int Height) GetTextureSize(int slot) => (0, 0);
|
||||
public void PlayBgm(long id) { }
|
||||
public void PlayVoice(long id) { }
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ public interface IHost
|
||||
void CreateTexture(int slot, int width, int height);
|
||||
void SetTexture(long resourceId, int slot);
|
||||
void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY);
|
||||
(int Width, int Height) GetTextureSize(int slot);
|
||||
void PlayBgm(long id);
|
||||
void PlayVoice(long id);
|
||||
}
|
||||
|
||||
@@ -175,6 +175,12 @@ public sealed class VirtualMachine
|
||||
case "draw-texture": // (handle, slot, srcX, srcY, w, h, dstX, dstY)
|
||||
_host.DrawTexture((int)Read(a[1]), (int)Read(a[2]), (int)Read(a[3]), (int)Read(a[4]),
|
||||
(int)Read(a[5]), (int)Read(a[6]), (int)Read(a[7])); return pc + 1;
|
||||
case "get-texture-size": // 0x208 (slot) (out_w) (out_h)
|
||||
{
|
||||
var (gw, gh) = _host.GetTextureSize((int)Read(a[0]));
|
||||
Write(a[1], gw); Write(a[2], gh);
|
||||
return pc + 1;
|
||||
}
|
||||
case "play-bgm": _host.PlayBgm(Read(a[0])); return pc + 1;
|
||||
case "play-voice": _host.PlayVoice(Read(a[0])); return pc + 1;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user