diff --git a/src/library_sdl.js b/src/library_sdl.js index 5ef41f6acd4c6..9cf53f86a2855 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -2668,10 +2668,10 @@ var LibrarySDL = { #if USE_SDL == 2 if (rwops === undefined) { - var type = {{{ makeGetValue('rwopsID', 20 /*type*/, 'i32') }}}; + var type = {{{ makeGetValue('rwopsID', C_STRUCTS.SDL_RWops.type, 'i32') }}}; if (type === 2/*SDL_RWOPS_STDFILE*/) { - var fp = {{{ makeGetValue('rwopsID', 28 /*hidden.stdio.fp*/, 'i32') }}}; + var fp = {{{ makeGetValue('rwopsID', C_STRUCTS.SDL_RWops.hidden.stdio.fp, 'i32') }}}; var fd = _fileno(fp); var stream = FS.getStream(fd); if (stream) { @@ -2679,8 +2679,8 @@ var LibrarySDL = { } } else if (type === 4/*SDL_RWOPS_MEMORY*/ || type === 5/*SDL_RWOPS_MEMORY_RO*/) { - var base = {{{ makeGetValue('rwopsID', 24 /*hidden.mem.base*/, 'i32') }}}; - var stop = {{{ makeGetValue('rwopsID', 32 /*hidden.mem.stop*/, 'i32') }}}; + var base = {{{ makeGetValue('rwopsID', C_STRUCTS.SDL_RWops.hidden.mem.base, 'i32') }}}; + var stop = {{{ makeGetValue('rwopsID', C_STRUCTS.SDL_RWops.hidden.mem.stop, 'i32') }}}; rwops = { bytes: base, count: stop - base }; } diff --git a/src/struct_info.json b/src/struct_info.json index c8541c3e24545..dd55b17cf29f5 100644 --- a/src/struct_info.json +++ b/src/struct_info.json @@ -705,6 +705,29 @@ ] } }, + { + "file": "SDL/SDL_rwops.h", + "structs": { + "SDL_RWops": [ + "type", + { + "hidden": [ + { + "mem": [ + "base", + "stop" + ] + }, + { + "stdio": [ + "fp" + ] + } + ] + } + ] + } + }, { "file": "uuid/uuid.h", "defines": [ diff --git a/src/struct_info_generated.json b/src/struct_info_generated.json index 6fc3cdb87ee6c..be07598c2e9af 100644 --- a/src/struct_info_generated.json +++ b/src/struct_info_generated.json @@ -744,6 +744,22 @@ "format": 0, "palette": 4 }, + "SDL_RWops": { + "__size__": 32, + "hidden": { + "__size__": 12, + "mem": { + "__size__": 12, + "base": 20, + "stop": 28 + }, + "stdio": { + "__size__": 8, + "fp": 24 + } + }, + "type": 16 + }, "SDL_Rect": { "__size__": 16, "h": 12, diff --git a/src/struct_info_generated_wasm64.json b/src/struct_info_generated_wasm64.json index 9a424fb07f111..781ed17113fa0 100644 --- a/src/struct_info_generated_wasm64.json +++ b/src/struct_info_generated_wasm64.json @@ -744,6 +744,22 @@ "format": 0, "palette": 8 }, + "SDL_RWops": { + "__size__": 64, + "hidden": { + "__size__": 24, + "mem": { + "__size__": 24, + "base": 40, + "stop": 56 + }, + "stdio": { + "__size__": 16, + "fp": 48 + } + }, + "type": 32 + }, "SDL_Rect": { "__size__": 16, "h": 12,