using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Json;
using XFEEDToolBox.Plugin;
var results=Enumerable.Range(0,8).Select(_=>Navigation.RunExtentFixture()).ToArray();
var report=new{sourceLinked=true,gameAccess=false,gameCalls=0,nativeAotBuilt=false,expected=255,results,passed=results.All(value=>value==255)};
var directory=Path.GetFullPath("artifacts/galaxy-power-outer-extent-probe");Directory.CreateDirectory(directory);
File.WriteAllText(Path.Combine(directory,"result.json"),JsonSerializer.Serialize(report,new JsonSerializerOptions{WriteIndented=true}));
Console.WriteLine(JsonSerializer.Serialize(report));if(!report.passed)Environment.ExitCode=1;
namespace XFEEDToolBox.Plugin
{
// A bounded own-allocation memory host, not the game Platform. Production
// Copy/Mask/Source and the own-allocation fixture are linked unchanged.
internal static unsafe class Platform
{
private static readonly Dictionary<nuint,nuint> allocations=[];
internal static nuint Allocate(nuint size)
{var value=(nuint)NativeMemory.AllocZeroed(size);if(value!=0)allocations[value]=size;return value;}
internal static void Free(nuint address){allocations.Remove(address);NativeMemory.Free((void*)address);}
internal static byte[] ReadBytes(nuint address,int length)
{
if(!allocations.Any(pair=>address>=pair.Key&&address-pair.Key<=pair.Value&&(nuint)length<=pair.Value-(address-pair.Key)))throw new InvalidDataException("Outside owned fixture memory");
return new ReadOnlySpan<byte>((void*)address,length).ToArray();
}
internal static void WriteBytes(nuint address,ReadOnlySpan<byte> bytes){ReadBytes(address,bytes.Length);bytes.CopyTo(new Span<byte>((void*)address,bytes.Length));}
internal static void Write<T>(nuint address,T value)where T:unmanaged
{ReadBytes(address,Unsafe.SizeOf<T>());Unsafe.Write((void*)address,value);}
}
internal static unsafe partial class Navigation
{
internal static uint RunExtentFixture()=>GalaxyPowerOuterExtentSelfTest();
static T Read<T>(nuint address)where T:unmanaged=>MemoryMarshal.Read<T>(Platform.ReadBytes(address,Unsafe.SizeOf<T>()));
static nuint Pointer(nuint address)=>Read<nuint>(address);
static void Write<T>(nuint address,T value)where T:unmanaged=>Platform.Write(address,value);
static ulong GalaxyFactHash(ulong address)
{
unchecked{var hash=address*0x40000+~address;hash=((hash>>31)^hash)*0x15;hash=((hash>>11)^hash)*0x41;return(uint)(hash>>22)^(uint)hash;}
}
// Runtime entry declarations only. These guards are never exercised by
// the copy fixture; all game-facing entry conditions remain false.
static bool Enabled()=>false;
static bool inGame=>false;
static nuint image=>0;
static uint owningThread=>0;
static uint GetCurrentThreadId()=>0;
static ulong GetTickCount64()=>0;
static Snapshot Current()=>new();
static nuint RegisteredComponent(nuint registry,uint type)=>0;
internal sealed class Snapshot{internal bool valid=>false;internal ulong entity=>0;internal ulong referenceWorld=>0;internal ulong physics=>0;internal ulong tick=>0;}
internal readonly record struct Vector(double x,double y,double z);
internal sealed class GalaxyServices{internal nuint registry=>0;internal int[] origin=>[0,0,0];}
internal sealed record GalaxyPowerOuterStyleFact(float[] rawRgb,float[] linearRgb,float size,float opacity);
internal sealed class GalaxyPowerOuterStyleContext{}
static bool CopyGalaxyPowerOuterStyleContext(GalaxyPowerOuterContext outer,out GalaxyPowerOuterStyleContext context){context=new();return false;}
static bool TryGetGalaxyAccountRegistry(Snapshot frame,out nuint registry){registry=0;return false;}
static bool GalaxyFactFindHash(nuint map,ulong address,out nuint node){node=0;return false;}
static bool GalaxyAccountString(nuint address,out string text)
{
text="";try{var length=Read<ulong>(address);if(length>1024||Read<ulong>(address+8)<length)return false;
text=System.Text.Encoding.UTF8.GetString(Platform.ReadBytes(address+20,(int)length));return true;}catch{return false;}
}
internal sealed class GalaxyFilterContext{internal nuint expectedImage=>0;internal uint thread=>0;internal ulong tick=>0;internal ulong entity=>0;internal ulong currentSystem=>0;}
}
}
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Json;
using XFEEDToolBox.Plugin;
var results=Enumerable.Range(0,8).Select(_=>Navigation.RunExtentFixture()).ToArray();
var report=new{sourceLinked=true,gameAccess=false,gameCalls=0,nativeAotBuilt=false,expected=255,results,passed=results.All(value=>value==255)};
var directory=Path.GetFullPath("artifacts/galaxy-power-outer-extent-probe");Directory.CreateDirectory(directory);
File.WriteAllText(Path.Combine(directory,"result.json"),JsonSerializer.Serialize(report,new JsonSerializerOptions{WriteIndented=true}));
Console.WriteLine(JsonSerializer.Serialize(report));if(!report.passed)Environment.ExitCode=1;
namespace XFEEDToolBox.Plugin
{
// A bounded own-allocation memory host, not the game Platform. Production
// Copy/Mask/Source and the own-allocation fixture are linked unchanged.
internal static unsafe class Platform
{
private static readonly Dictionary<nuint,nuint> allocations=[];
internal static nuint Allocate(nuint size)
{var value=(nuint)NativeMemory.AllocZeroed(size);if(value!=0)allocations[value]=size;return value;}
internal static void Free(nuint address){allocations.Remove(address);NativeMemory.Free((void*)address);}
internal static byte[] ReadBytes(nuint address,int length)
{
if(!allocations.Any(pair=>address>=pair.Key&&address-pair.Key<=pair.Value&&(nuint)length<=pair.Value-(address-pair.Key)))throw new InvalidDataException("Outside owned fixture memory");
return new ReadOnlySpan<byte>((void*)address,length).ToArray();
}
internal static void WriteBytes(nuint address,ReadOnlySpan<byte> bytes){ReadBytes(address,bytes.Length);bytes.CopyTo(new Span<byte>((void*)address,bytes.Length));}
internal static void Write<T>(nuint address,T value)where T:unmanaged
{ReadBytes(address,Unsafe.SizeOf<T>());Unsafe.Write((void*)address,value);}
}
internal static unsafe partial class Navigation
{
internal static uint RunExtentFixture()=>GalaxyPowerOuterExtentSelfTest();
static T Read<T>(nuint address)where T:unmanaged=>MemoryMarshal.Read<T>(Platform.ReadBytes(address,Unsafe.SizeOf<T>()));
static nuint Pointer(nuint address)=>Read<nuint>(address);
static void Write<T>(nuint address,T value)where T:unmanaged=>Platform.Write(address,value);
static ulong GalaxyFactHash(ulong address)
{
unchecked{var hash=address*0x40000+~address;hash=((hash>>31)^hash)*0x15;hash=((hash>>11)^hash)*0x41;return(uint)(hash>>22)^(uint)hash;}
}
// Runtime entry declarations only. These guards are never exercised by
// the copy fixture; all game-facing entry conditions remain false.
static bool Enabled()=>false;
static bool inGame=>false;
static nuint image=>0;
static uint owningThread=>0;
static uint GetCurrentThreadId()=>0;
static ulong GetTickCount64()=>0;
static Snapshot Current()=>new();
static nuint RegisteredComponent(nuint registry,uint type)=>0;
internal sealed class Snapshot{internal bool valid=>false;internal ulong entity=>0;internal ulong referenceWorld=>0;internal ulong physics=>0;internal ulong tick=>0;}
internal readonly record struct Vector(double x,double y,double z);
internal sealed class GalaxyServices{internal nuint registry=>0;internal int[] origin=>[0,0,0];}
internal sealed record GalaxyPowerOuterStyleFact(float[] rawRgb,float[] linearRgb,float size,float opacity);
internal sealed class GalaxyPowerOuterStyleContext{}
static bool CopyGalaxyPowerOuterStyleContext(GalaxyPowerOuterContext outer,out GalaxyPowerOuterStyleContext context){context=new();return false;}
static bool TryGetGalaxyAccountRegistry(Snapshot frame,out nuint registry){registry=0;return false;}
static bool GalaxyFactFindHash(nuint map,ulong address,out nuint node){node=0;return false;}
static bool GalaxyAccountString(nuint address,out string text)
{
text="";try{var length=Read<ulong>(address);if(length>1024||Read<ulong>(address+8)<length)return false;
text=System.Text.Encoding.UTF8.GetString(Platform.ReadBytes(address+20,(int)length));return true;}catch{return false;}
}
internal sealed class GalaxyFilterContext{internal nuint expectedImage=>0;internal uint thread=>0;internal ulong tick=>0;internal ulong entity=>0;internal ulong currentSystem=>0;}
}
}