-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSoC Part 1 & 2: Binary Buffer functions, Serialization and Deserialization #2318
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…signed long long
Update buffer_fill and buffer_poke
- Update serialize_to_type to automatically switch between integer types when the value can't fit in the signed type - Update deserialize_from_type to only use unsigned integers - Update buffer_fill to set the position of the buffer back to the start so that it can be read from again - Update buffer_peek to use 'deserialize_from_type'
- Add a new class, `BinaryBufferAsset`, to act as a wrapper around `std::unique_ptr<BinaryBuffer>` so that the `AssetArray` interface is satisfied. - Add a function `push_buffer` to handle creating a buffer - Create a new file `buffers_internal.cpp` to store function definitions
- No longer reliant only on int, thus less possibility for bugs as strict typing is enforced - Move buffer enums into `buffers_data.h` and give them names, `buffer_seek_t`, `buffer_type_t`, `buffer_data_t` - Update buffer functions and BinaryBuffer class to use these type names
- Previously, they used to read only 0 bytes from the given file, that too in a non-portable way, as `pos_type` is not guaranteed to be a `std::size_t` or whatever, and is instead an implementation-defined type.
- Previously, it wasn't using the buffer's type correctly. It would always use `.insert()` so the size of the buffer would always increase. Now, it only makes the buffer bigger when using `buffer_grow`. - Also fix `buffer_create` and `buffer_delete` not using the correct `AssetArray` functions. - Add a (big) test case for `buffer_load_ext` to test the various buffer types being loaded properly.
- Make the `buffer_fill` test much more comprehensive, using `offset` too - Fix `buffer_fill` implementation not using `offset`
- Make the implementation better, check for more edge cases - Change `buffer_seek` to use `buffer_seek_t` - Update `buffer_fill` test case to check buffer size - Change `buffer_poke` to write bytes using `serialize_to_type`
- Set `position` to 0 when `offset` is negative - Clamp to `GetSize() - 1` instead of `GetSize()` as it is zero-indexed - Turn `M_USER_ERROR` into `M_WARNING` - When seeking `buffer_seek_end`, use `GetSize() - 1` instead of `GetSize()` as it is zero indexed.
- Pad buffer with extra 0s after data for alignment purposes - Update test to reflect change
- Have it properly pad with zeroes, i.e. only insert zeroes if there is space for it after the element - Make `buffer_read` more compliant because GMS only pushes `position` forward when using `buffer_read` not `buffer_peek` - Update test case
…rnal_deserialize_many`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request marks the completion of my GSoC Project for Summer 2022, and contains all the commits pertaining to my changes in both the pull requests for Part 1 and Part 2 of my project, which are:
Aside from these, I also made the following pull requests which got merged:
libEGM
Also, I made the following pull requests which did not get merged:
MSVC x86_64
CII tracked my progress approximately weekly on my personal blog: https://dc03.github.io/