rwops: Reworked RWops for SDL3.

- SDL_RWops is now an opaque struct.
- SDL_AllocRW is gone. If an app is creating a custom RWops, they pass the
  function pointers to SDL_CreateRW(), which are stored internally.
- SDL_RWclose is gone, there is only SDL_DestroyRW(), which calls the
  implementation's `->close` method before freeing other things.
- There is only one path to create and use RWops now, so we don't have to
  worry about whether `->close` will call SDL_DestroyRW, or if this will
  risk any Properties not being released, etc.
- SDL_RWFrom* still works as expected, for getting a RWops without having
  to supply your own implementation. Objects from these functions are also
  destroyed with SDL_DestroyRW.
- Lots of other cleanup and SDL3ization of the library code.
This commit is contained in:
Ryan C. Gordon
2024-03-12 01:14:38 -04:00
parent 495e432fb9
commit 525919b315
22 changed files with 424 additions and 470 deletions

View File

@@ -66,12 +66,12 @@ extern void Android_JNI_CloseAudioDevice(const int iscapture);
extern SDL_bool Android_IsDeXMode(void);
extern SDL_bool Android_IsChromebook(void);
int Android_JNI_FileOpen(SDL_RWops *ctx, const char *fileName, const char *mode);
Sint64 Android_JNI_FileSize(SDL_RWops *ctx);
Sint64 Android_JNI_FileSeek(SDL_RWops *ctx, Sint64 offset, int whence);
size_t Android_JNI_FileRead(SDL_RWops *ctx, void *buffer, size_t size);
size_t Android_JNI_FileWrite(SDL_RWops *ctx, const void *buffer, size_t size);
int Android_JNI_FileClose(SDL_RWops *ctx);
int Android_JNI_FileOpen(void **puserdata, const char *fileName, const char *mode);
Sint64 Android_JNI_FileSize(void *userdata);
Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, int whence);
size_t Android_JNI_FileRead(void *userdata, void *buffer, size_t size);
size_t Android_JNI_FileWrite(void *userdata, const void *buffer, size_t size);
int Android_JNI_FileClose(void *userdata);
/* Environment support */
void Android_JNI_GetManifestEnvironmentVariables(void);