using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
// Synthetic allocations only. This test does not resolve a game object,
// invoke a game function, attach a hook or access an account cache.
static uint GalaxyAccountSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var fakeImage=unchecked((nuint)0x140000000UL);var manager=memory;var owner=memory+1024;var rows=memory+2048;var str=memory+4096;
Write(manager,fakeImage+0x529B850);Write(manager+8,fakeImage+0x529B880);Write(manager+0x58,fakeImage+0x529B980);
Write(manager+0x10,owner);Write(manager+0x190,2UL);Write(manager+0x198,rows);
Write(str,7UL);Write(str+8,7UL);Write(str+16,1);Platform.WriteBytes(str+20,"Fixture\0"u8);
for(nuint i=0;i<2;i++)
{
var row=rows+i*0x60;Write(row,42UL+(ulong)i);Write(row+0x18,9007199254740995UL+(ulong)i);
Write(row+0x28,0x200UL);Write(row+0x38,-1L);Write(row+0x10,str);Write(row+0x5C,(int)i+1);
}
uint passed=0;
if(CopyGalaxyBookmarkManager(manager,owner,fakeImage,out var items)&&items.Length==2&&
items[0].systemAddress==9007199254740995&&items[0].name=="Fixture"&&items[1].sourceKind==2)passed|=1;
if(!new GalaxyAccountBookmarks(1,2,items).complete)passed|=2;
Write(manager+0x190,4097UL);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=4;
Write(manager+0x190,2UL);Write(rows+0x5C,3);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=8;
Write(rows+0x5C,1);Write(str,513UL);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=16;
Write(str,7UL);Write(manager+0x10,owner+8);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=32;
Write(manager+0x10,owner);Write(manager+8,fakeImage+0x529B8B8);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=64;
Write(manager+8,fakeImage+0x529B880);Write(manager+0x190,0UL);Write(manager+0x198,(nuint)0);
if(CopyGalaxyBookmarkManager(manager,owner,fakeImage,out items)&&items.Length==0&&
!new GalaxyAccountBookmarks(1,2,items).complete)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyAccountSelfTest")]
internal static uint ExportGalaxyAccountSelfTest()=>RunTest(GalaxyAccountSelfTest);
#endif
}
using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
// Synthetic allocations only. This test does not resolve a game object,
// invoke a game function, attach a hook or access an account cache.
static uint GalaxyAccountSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var fakeImage=unchecked((nuint)0x140000000UL);var manager=memory;var owner=memory+1024;var rows=memory+2048;var str=memory+4096;
Write(manager,fakeImage+0x529B850);Write(manager+8,fakeImage+0x529B880);Write(manager+0x58,fakeImage+0x529B980);
Write(manager+0x10,owner);Write(manager+0x190,2UL);Write(manager+0x198,rows);
Write(str,7UL);Write(str+8,7UL);Write(str+16,1);Platform.WriteBytes(str+20,"Fixture\0"u8);
for(nuint i=0;i<2;i++)
{
var row=rows+i*0x60;Write(row,42UL+(ulong)i);Write(row+0x18,9007199254740995UL+(ulong)i);
Write(row+0x28,0x200UL);Write(row+0x38,-1L);Write(row+0x10,str);Write(row+0x5C,(int)i+1);
}
uint passed=0;
if(CopyGalaxyBookmarkManager(manager,owner,fakeImage,out var items)&&items.Length==2&&
items[0].systemAddress==9007199254740995&&items[0].name=="Fixture"&&items[1].sourceKind==2)passed|=1;
if(!new GalaxyAccountBookmarks(1,2,items).complete)passed|=2;
Write(manager+0x190,4097UL);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=4;
Write(manager+0x190,2UL);Write(rows+0x5C,3);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=8;
Write(rows+0x5C,1);Write(str,513UL);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=16;
Write(str,7UL);Write(manager+0x10,owner+8);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=32;
Write(manager+0x10,owner);Write(manager+8,fakeImage+0x529B8B8);if(!CopyGalaxyBookmarkManager(manager,owner,fakeImage,out _))passed|=64;
Write(manager+8,fakeImage+0x529B880);Write(manager+0x190,0UL);Write(manager+0x198,(nuint)0);
if(CopyGalaxyBookmarkManager(manager,owner,fakeImage,out items)&&items.Length==0&&
!new GalaxyAccountBookmarks(1,2,items).complete)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyAccountSelfTest")]
internal static uint ExportGalaxyAccountSelfTest()=>RunTest(GalaxyAccountSelfTest);
#endif
}