Skip to content

Commit

Permalink
Update for SDL_PROP_IOSTREAM_MEMORY_POINTER.
Browse files Browse the repository at this point in the history
Let us never speak of the shortcut again.
  • Loading branch information
flibitijibibo committed Oct 3, 2024
1 parent 54bff04 commit 165e5f9
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/FAudio_platform_sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,26 +480,11 @@ FAudioIOStream* FAudio_memopen(void *mem, int len)
return io;
}

/* FIXME: Expose IOStreamMemData as a property! */
struct SDL_IOStream
{
SDL_IOStreamInterface iface;
void *userdata;
SDL_IOStatus status;
SDL_PropertiesID props;
};
typedef struct IOStreamMemData
{
Uint8 *base;
Uint8 *here;
Uint8 *stop;
} IOStreamMemData;

uint8_t* FAudio_memptr(FAudioIOStream *io, size_t offset)
{
SDL_IOStream *stream = (SDL_IOStream*) io->data;
IOStreamMemData *memdata = (IOStreamMemData*) stream->userdata;
return memdata->base + offset;
SDL_PropertiesID props = SDL_GetIOProperties((SDL_IOStream*) io->data);
FAudio_assert(SDL_HasProperty(props, SDL_PROP_IOSTREAM_MEMORY_POINTER));
return ((uint8_t*) SDL_GetPointerProperty(props, SDL_PROP_IOSTREAM_MEMORY_POINTER, NULL)) + offset;
}

void FAudio_close(FAudioIOStream *io)
Expand Down

0 comments on commit 165e5f9

Please sign in to comment.