-
Notifications
You must be signed in to change notification settings - Fork 30
Description
For the Monkey-X forum by user Maverick:
The Android Browser in my Samsung Galaxy S3 (Android 4.4.2) does have a
problem that I haven't encountered in other Browsers:Creating a buffer view with an buffer that has a size that isn't a multiple of the base type creates an Exception:
ArrayBuffer length minus the byteOffset is not a multiple of the element size
This happened to me in a game where I'm loading a Binary File. Of course it is possible that the size of this Binary File isn't a multiple of 4.
Now when Monkey tries to load in the File into a DataBuffer object the above-mentioned Exception is thrown.
I've created a workaround in this pull request (blitz-research/monkey#93) because I weren't able to come up with a cleaner solution:
If the length of the buffer isn't a multiple of 4, I copy/resize the buffer to be a multiple of 4 in length.
Note: I keep the original length property so that the seeking logic remains the same.