Asset - Scripts [BUFFERS] xBufferFunctions is a collection of advanced buffer functions (FREE)

xDGameStudios

GameMaker Staff
GameMaker Dev.
[LINKS]


[INFORMATION]

This asset is composed by a set of buffer functions that allow for complex buffer parsing. Functions allow to seek and match patterns, copy regions (using read format and padding) and read into array everything at byte level.

[FUNCTIONS]

buffer_pattern_create(str);
This function allow to create seeking and matching patterns. Allows hexadecimal input and wild bytes. A pattern example is "F6 3C 3D ?? ?? 77" this will allow to seek/match bytes that match the pattern were ?? are wild bytes (can be any byte).

buffer_block_format_create(str);
This function allow to create block format for copying. Allows FF/00 inputs where FF bytes are copied and 00 are jumped over. A format example is "FF 00 FF FF 00" this will copy an input example of "6B D0 8A FF 25" as "6B 8A FF" (ignoring 2nd and 5th bytes).

buffer_copy_until(src, pattern, dest, [offset=end]);
This function will copy a buffer from the current point up until the specified patter is found into a destination buffer with a given offset position. The offset is optional (buffer_grow/buffer_wrap only) and will write to the end of the destination buffer. Returns false if there is no final pattern match.

buffer_copy_until_ext(src, pattern, format, pad, dest, [offset=end]);
This function is similar to the previous one but allows for specifying a block format and also a padding between blocks. Note that this function will only copy entire blocks, if the last block ends middle way that block won't be copied. Returns false if there is no final pattern match.

buffer_seek_pattern(buffer, pattern, [after=false], [step=1]);
This function will step through the buffer until it matches a given pattern. The optional parameters allow for specifying if the cursor should be left after or before the match, and the step is the number of bytes that should be jumped when the match doesn't occur. Returns false if there is no match.

buffer_check_pattern(buffer, pattern, [after=false]);
This function will check the next bytes for the given pattern. The optional parameters allow for specifying if the cursor should be left after or before the match. Returns false if there is no match.

buffer_read_bytes(buffer, [amount = 1]);
This function reads a given amount of bytes from the buffer and returns a byte array with each read byte.

[COMPATIBILITY]

The asset is fully compatible with 2.3+ and is purely written in GML making it compatible with all exports available.
 
Last edited:
Top