Implement numbered save pair lifecycle
This commit is contained in:
@@ -849,6 +849,34 @@ public sealed class GodotAdvHost : IHost
|
||||
public (int Width, int Height) GetTextureSize(int slot)
|
||||
=> _slotDims.TryGetValue(slot, out var d) ? (d.W, d.H) : (0, 0);
|
||||
|
||||
public RgbaImage? CaptureSurfacePixels(int slot)
|
||||
{
|
||||
RgbaImage? image = ResolveSurfacePixels(slot);
|
||||
return image == null
|
||||
? null
|
||||
: new RgbaImage(image.Width, image.Height, (byte[])image.Pixels.Clone());
|
||||
}
|
||||
|
||||
public bool ReplaceSurfacePixels(int slot, RgbaImage image)
|
||||
{
|
||||
if (image.Width <= 0 || image.Height <= 0
|
||||
|| image.Pixels.Length != checked(image.Width * image.Height * 4))
|
||||
return false;
|
||||
lock (_imageLock)
|
||||
{
|
||||
_surfaceImages[slot] =
|
||||
new RgbaImage(image.Width, image.Height, (byte[])image.Pixels.Clone());
|
||||
_surfaceColorKeys.Remove(slot);
|
||||
}
|
||||
lock (_textLock)
|
||||
{
|
||||
_surfaceText.Remove(slot);
|
||||
_surfaceResources.Remove(slot);
|
||||
}
|
||||
_slotDims[slot] = (image.Width, image.Height);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Retained render model: draw-texture updates GfxState (object -> surface bind); Main._Process composites
|
||||
// the visible objects each frame in ascending-handle order. No immediate blit here.
|
||||
public void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY) { }
|
||||
|
||||
@@ -8,6 +8,7 @@ using Godot;
|
||||
using Age.Engine.Diagnostics;
|
||||
using Age.Engine.Hosting;
|
||||
using Age.Engine.Model;
|
||||
using Age.Engine.Persistence;
|
||||
using Age.Engine.Sys4;
|
||||
using Age.Engine.Vm;
|
||||
using Script = Age.Engine.Model.Script; // disambiguate from Godot.Script
|
||||
@@ -248,8 +249,17 @@ public partial class Main : Godot.Control
|
||||
Age.Engine.Diagnostics.ITraceSink sink = _trace;
|
||||
if (histFile != null) { _hist = new Age.Engine.Diagnostics.HistogramTraceSink();
|
||||
sink = new Age.Engine.Diagnostics.CompositeTraceSink(_trace, _hist); }
|
||||
// Persistence opcodes retain AGE's native filenames and binary formats, but the port owns the
|
||||
// root interception point. Keep authored saves isolated from the original installation under
|
||||
// Godot's per-application user directory.
|
||||
var nativeSaveStore = new DirectoryNativeDatStore(
|
||||
ProjectSettings.GlobalizePath("user://SAVE"),
|
||||
new NativeSaveIdentity(
|
||||
NativeSaveMagic.S4SD, 0x4a343234, "姫狩りダンジョンマイスター",
|
||||
SaveVersion1: 3, SaveVersion2: 10, NumberedCompatibilityId: 0x42323234));
|
||||
_vm = new VirtualMachine(script, table, _host,
|
||||
new VmOptions(MaxSteps: 20_000_000, IgnoreExitRequests: nativeDebugMenu), provider, sink);
|
||||
new VmOptions(MaxSteps: 20_000_000, IgnoreExitRequests: nativeDebugMenu), provider, sink,
|
||||
nativeDatStore: nativeSaveStore);
|
||||
if (scripts != null)
|
||||
{
|
||||
_debugSceneEntries = DebugSceneCatalog.Build(scripts.Catalog);
|
||||
|
||||
Reference in New Issue
Block a user