using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
static uint GalaxyAccountColonisationSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var fakeImage=unchecked((nuint)0x140000000UL);var manager=memory;var owner=memory+4096;var storage=memory+8192;var row=storage+16;
Write(manager,fakeImage+0x519DA40);Write(manager+8,fakeImage+0x519DA70);Write(manager+0x58,fakeImage+0x519DB70);Write(manager+0x10,owner);
var map=manager+0x160;Write(map+8,1UL);Write(map+0x10,8UL);Write(map+0x18,storage);Write(storage,(byte)1);
Write(row,9007199254740995UL);Write(row+0x18,9007199254740995UL);Write(row+0x20,9876543UL);Write(row+0x10,(byte)3);
Write(row+0xD0,-1L);Write(row+0xD8,(byte)1);Write(row+0xE0,1700000000UL);
uint passed=0;
if(CopyGalaxyColonisationManager(manager,owner,fakeImage,out var items)&&items.Length==1&&
items[0].systemAddress==9007199254740995&&items[0].commanderId==9876543&&items[0].statusName=="established"&&
items[0].active&&items[0].unusedConstructionSlots&&items[0].megashipMarketId==-1)passed|=1;
if(!new GalaxyAccountColonisation(1,2,items).complete)passed|=2;
Write(map+0x10,9UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=4;
Write(map+0x10,8UL);Write(map+8,9UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=8;
Write(map+8,1UL);Write(row+0x18,42UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=16;
Write(row+0x18,9007199254740995UL);Write(row+0x10,(byte)4);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=32;
Write(row+0x10,(byte)3);Write(manager+0x10,owner+8);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=64;
Write(manager+0x10,owner);Write(map+8,0UL);Write(map+0x10,0UL);Write(map+0x18,(nuint)0);
if(CopyGalaxyColonisationManager(manager,owner,fakeImage,out items)&&items.Length==0&&
!new GalaxyAccountColonisation(1,2,items).complete)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyColonisationSelfTest")]
internal static uint ExportGalaxyAccountColonisationSelfTest()=>RunTest(GalaxyAccountColonisationSelfTest);
#endif
}
using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
static uint GalaxyAccountColonisationSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var fakeImage=unchecked((nuint)0x140000000UL);var manager=memory;var owner=memory+4096;var storage=memory+8192;var row=storage+16;
Write(manager,fakeImage+0x519DA40);Write(manager+8,fakeImage+0x519DA70);Write(manager+0x58,fakeImage+0x519DB70);Write(manager+0x10,owner);
var map=manager+0x160;Write(map+8,1UL);Write(map+0x10,8UL);Write(map+0x18,storage);Write(storage,(byte)1);
Write(row,9007199254740995UL);Write(row+0x18,9007199254740995UL);Write(row+0x20,9876543UL);Write(row+0x10,(byte)3);
Write(row+0xD0,-1L);Write(row+0xD8,(byte)1);Write(row+0xE0,1700000000UL);
uint passed=0;
if(CopyGalaxyColonisationManager(manager,owner,fakeImage,out var items)&&items.Length==1&&
items[0].systemAddress==9007199254740995&&items[0].commanderId==9876543&&items[0].statusName=="established"&&
items[0].active&&items[0].unusedConstructionSlots&&items[0].megashipMarketId==-1)passed|=1;
if(!new GalaxyAccountColonisation(1,2,items).complete)passed|=2;
Write(map+0x10,9UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=4;
Write(map+0x10,8UL);Write(map+8,9UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=8;
Write(map+8,1UL);Write(row+0x18,42UL);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=16;
Write(row+0x18,9007199254740995UL);Write(row+0x10,(byte)4);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=32;
Write(row+0x10,(byte)3);Write(manager+0x10,owner+8);if(!CopyGalaxyColonisationManager(manager,owner,fakeImage,out _))passed|=64;
Write(manager+0x10,owner);Write(map+8,0UL);Write(map+0x10,0UL);Write(map+0x18,(nuint)0);
if(CopyGalaxyColonisationManager(manager,owner,fakeImage,out items)&&items.Length==0&&
!new GalaxyAccountColonisation(1,2,items).complete)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyColonisationSelfTest")]
internal static uint ExportGalaxyAccountColonisationSelfTest()=>RunTest(GalaxyAccountColonisationSelfTest);
#endif
}