コード例 #1
0
        private void HandleListingEvents(IntPtr data)
        {
            var dataPtr = data + 0x10;

            var packet = Marshal.PtrToStructure <PartyFinder.Packet>(dataPtr);

            // rewriting is an expensive operation, so only do it if necessary
            var needToRewrite = false;

            for (var i = 0; i < packet.listings.Length; i++)
            {
                // these are empty slots that are not shown to the player
                if (packet.listings[i].IsNull())
                {
                    continue;
                }

                var listing = new PartyFinderListing(packet.listings[i], Dalamud.Data, Dalamud.SeStringManager);
                var args    = new PartyFinderListingEventArgs(packet.batchNumber);
                ReceiveListing?.Invoke(listing, args);

                if (args.Visible)
                {
                    continue;
                }

                // hide the listing from the player by setting it to a null listing
                packet.listings[i] = new PartyFinder.Listing();
                needToRewrite      = true;
            }

            if (!needToRewrite)
            {
                return;
            }

            // write our struct into the memory (doing this directly crashes the game)
            Marshal.StructureToPtr(packet, Memory, false);

            // copy our new memory over the game's
            unsafe {
                Buffer.MemoryCopy(
                    (void *)Memory,
                    (void *)dataPtr,
                    PartyFinder.PacketInfo.PacketSize,
                    PartyFinder.PacketInfo.PacketSize
                    );
            }
        }
コード例 #2
0
 private void PartyFinderOnReceiveListing(PartyFinderListing listing, PartyFinderListingEventArgs args)
 {
     this.hasPassed = true;
 }