You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The save-stating and screenshotting methods should be able to read from and write to any python object that exposes a buffer.
Writing the data directly into a buffer will greatly increase performance, because you won't have to allocate memory for a bytes object, nor will you have to copy the data twice.
The buffer protocol was made an official protocol as of python 3.11, and all major array-like objects support it (including bytes, bytearray, array.array, numpy.array, etc).
The text was updated successfully, but these errors were encountered:
fromcollections.abcimportBuffer@overloaddefsave_to_bytes(out:Buffer)->None:
...
defload_from_bytes(in_:Buffer):
... # bytes implements Buffer so this signature doesn't need to be overloadeddefmem_size() ->int: ...
For the savestates. Basically, just expanding the existing api to accept any buffer object.
As for the screenshot, I'm not entirely sure what's the best way. Maybe a way to set a global buffer that the frames are dumped into? That would probably suffice. And a way to get the dimensions of the image to set the size of the buffer.
The save-stating and screenshotting methods should be able to read from and write to any python object that exposes a buffer.
Writing the data directly into a buffer will greatly increase performance, because you won't have to allocate memory for a bytes object, nor will you have to copy the data twice.
The buffer protocol was made an official protocol as of python 3.11, and all major array-like objects support it (including bytes, bytearray, array.array, numpy.array, etc).
The text was updated successfully, but these errors were encountered: