Tonight I have released Ashita v18.104.22.168 which contains some major internal changes to how the packet handlers deal with modified packets and the original packet buffer. This is going to be a breaking change for some addons and plugins in the near future with the next part of this update which will be pushed in the upcoming week. So please, if you are an addon or plugin developer, read this post carefully and be sure you are following the new guidelines of using packets!
Packet Handler Changes
With Ashita v2, developers grew accustomed to how modifying packet data worked as well as blocking packets or resending them manually. With Ashita v3, the ability to view modified data, blocked packets, and such was added to give developers more control of the packet system. With Ashita v22.214.171.124, this has been further enhanced by modifying some of the internal handlings of the data. The plugin callbacks for HandleIncomingPacket and HandleOutgoingPacket are exactly the same, but the parameters data is different to a degree.
The prototypes of these functions are still the same, as follows:
However, the data and modified parameters have changed.
Code: Select all
bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override
- Prior to this change, data contained the current packet data being processed and nothing else. Now, with v126.96.36.199 and forward, data is now a pointer to the packet data in the original buffer. What this means is that data can now be used to look behind and look ahead manually at the data within the buffer. This greatly enhances what plugins are able to do as some packets have limits and restrictions on when they can and can't be sent. This change gives developers a way to read other packets in the current chunk to determine if what they plan to do is possible due to other data in the chunk.
With this change, data is also now considered constant. Meaning that any changes you make to data directly WILL BE UNDONE!
Any and all changes you wish to make to the buffer should be done within modified now, this is now mandatory and not optional!
- The modified buffer is now required to be used for any packet changes that developers wish to make to the buffer.
Changes directly to the data will be ignored and undone after the handler has been processed rendering the change useless.
Huge thanks and full credit goes to Lolwutt for these changes!