xray-16
xray-16 copied to clipboard
[Fix] Binder net packet reader io
Changes
- Fixing case when writing size_t to net packet, but reading u32, creates issues with custom binders for weapon objects and try to read data
~~Ohhh, this will introduce incompatibility between x64 and x86 game saves (they won't be identical after this change)~~ Oh, they aren't compatible already. This needs to be fixed.
Can't look at the engine code right now to find the place where we actually write size_t to a net packet, so I just briefly say that we should never use size_t in net packets and binary formats, so we need to change the code to write u32 as it was before. (or u64 if it's reaaally necessary)
I would stick with u32. Then save
method should be modified instead
We write size of magazine here
save_data(m_magazine2.size(), output_packet);
And get
_NODISCARD _CONSTEXPR20 size_type size() const noexcept {
auto& _My_data = _Mypair._Myval2;
return static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst);
}
Should I just do static cast to u32 to make it work? I believe it is very unlikely to get overflow here + it will match original 32bit engine
@Neloreck I agree!
Now we need to analyze all changes we have and merge everything that breaks saves compatibility within one time period (e.g. a day?)