using System.Runtime.InteropServices; namespace XFEEDToolBox.Plugin; internal static unsafe partial class Navigation { static uint GalaxyAccountCommunityGoalsSelfTest() { var memory=Platform.Allocate(0x1000);if(memory==0)return 0; try { uint passed=0;var manager=memory;var owner=memory+0x800;var vector=memory+0x900; var expectedImage=unchecked((nuint)0x140000000UL); Write(manager,expectedImage+0x55276B8);Write(manager+8,expectedImage+0x55276E8); Write(manager+0x60,expectedImage+0x5527810);Write(manager+0x10,owner); Write(manager+0x218,4UL);Write(manager+0x228,3UL);Write(manager+0x230,vector); Write(vector,9007199254740995UL);Write(vector+8,300UL);Write(vector+16,300UL); var before=Platform.ReadBytes(memory,0x1000); if(CopyGalaxyCommunityGoals(manager,owner,expectedImage,out var systems)&& systems.SequenceEqual(new ulong[]{9007199254740995,300,300}))passed|=1; if(Platform.ReadBytes(memory,0x1000).AsSpan().SequenceEqual(before))passed|=2; var published=new GalaxyAccountCommunityGoals(1,2,systems); if(!published.complete&&published.source=="original-community-goal-map-published-cache"&&published.systemAddresses.Length==3)passed|=4; Write(manager+0x218,0UL);Write(manager+0x228,0UL);Write(manager+0x230,(nuint)0); if(CopyGalaxyCommunityGoals(manager,owner,expectedImage,out var empty)&&empty.Length==0&& !new GalaxyAccountCommunityGoals(1,2,empty).complete)passed|=8; Write(manager+0x218,4UL);Write(manager+0x228,3UL);Write(manager+0x230,vector); var rejected=!CopyGalaxyCommunityGoals(manager,owner+8,expectedImage,out _)&& !CopyGalaxyCommunityGoals(manager,owner,expectedImage+8,out _); Write(manager+0x60,expectedImage+0x5527890);rejected&=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(manager+0x60,expectedImage+0x5527810);if(rejected)passed|=16; Write(manager+0x228,5UL);rejected=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(manager+0x218,65537UL);Write(manager+0x228,0UL);rejected&=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(manager+0x218,4097UL);Write(manager+0x228,4097UL);rejected&=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(manager+0x218,4UL);Write(manager+0x228,3UL);Write(manager+0x230,(nuint)0);rejected&=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(manager+0x230,vector);if(rejected)passed|=32; Write(vector,0UL);rejected=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(vector,0x80000000000000UL);rejected&=!CopyGalaxyCommunityGoals(manager,owner,expectedImage,out _); Write(vector,9007199254740995UL);if(rejected)passed|=64; if(CopyGalaxyCommunityGoals(manager,owner,expectedImage,out systems)) { Write(vector,301UL); if(systems[0]==9007199254740995UL&&CopyGalaxyCommunityGoals(manager,owner,expectedImage,out var newer)&&newer[0]==301)passed|=128; } return passed; } finally{Platform.Free(memory);} } #if PLUGIN_NAVIGATION [UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyAccountCommunityGoalsSelfTest")] internal static uint ExportGalaxyAccountCommunityGoalsSelfTest()=>RunTest(GalaxyAccountCommunityGoalsSelfTest); #endif }