From 2d9659f273b943e3bae2ceab70769355e045bf40 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 8 Jun 2024 04:23:15 -0400 Subject: [PATCH] This is a commit message. --- dependencies/trampoline/src | 2 +- media-layer/trampoline/src/GLESv1_CM.cpp | 90 +++++++++---------- media-layer/trampoline/src/guest/guest.cpp | 52 ++++------- media-layer/trampoline/src/guest/guest.h | 9 +- .../trampoline/src/media-layer-core.cpp | 32 +++---- 5 files changed, 85 insertions(+), 100 deletions(-) diff --git a/dependencies/trampoline/src b/dependencies/trampoline/src index 027e58ee..06e9f4d7 160000 --- a/dependencies/trampoline/src +++ b/dependencies/trampoline/src @@ -1 +1 @@ -Subproject commit 027e58ee9bdcfef285c16e731c8db218082b9639 +Subproject commit 06e9f4d7c8505a1e8c8ec4d65e21e93161eae6f7 diff --git a/media-layer/trampoline/src/GLESv1_CM.cpp b/media-layer/trampoline/src/GLESv1_CM.cpp index baa6763f..e0071543 100644 --- a/media-layer/trampoline/src/GLESv1_CM.cpp +++ b/media-layer/trampoline/src/GLESv1_CM.cpp @@ -12,7 +12,7 @@ static int get_glFogfv_params_length(GLenum pname) { #endif CALL(11, glFogfv, void, (GLenum pname, const GLfloat *params)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(pname, copy_array(get_glFogfv_params_length(pname), params)); + trampoline(true, pname, copy_array(get_glFogfv_params_length(pname), params)); #else GLenum pname = args.next(); const GLfloat *params = args.next_arr(); @@ -90,7 +90,7 @@ static gl_state_t gl_state; state.type = type; \ state.stride = stride; \ state.pointer = uint32_t(pointer); \ - trampoline(state); \ + trampoline(true, state); \ } \ } #else @@ -106,7 +106,7 @@ CALL_GL_POINTER(12, glVertexPointer) CALL(13, glLineWidth, void, (GLfloat width)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(width); + trampoline(true, width); #else func(args.next()); return 0; @@ -115,7 +115,7 @@ CALL(13, glLineWidth, void, (GLfloat width)) CALL(14, glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(sfactor, dfactor); + trampoline(true, sfactor, dfactor); #else GLenum sfactor = args.next(); GLenum dfactor = args.next(); @@ -126,7 +126,7 @@ CALL(14, glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) CALL(15, glDrawArrays, void, (GLenum mode, GLint first, GLsizei count)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(gl_state, mode, first, count); + trampoline(true, gl_state, mode, first, count); #else gl_state_t gl_state = args.next(); gl_state.send_to_driver(); @@ -140,7 +140,7 @@ CALL(15, glDrawArrays, void, (GLenum mode, GLint first, GLsizei count)) CALL(16, glColor4f, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(red, green, blue, alpha); + trampoline(true, red, green, blue, alpha); #else GLfloat red = args.next(); GLfloat green = args.next(); @@ -153,7 +153,7 @@ CALL(16, glColor4f, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alp CALL(17, glClear, void, (GLbitfield mask)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(mask); + trampoline(true, mask); #else func(args.next()); return 0; @@ -162,7 +162,7 @@ CALL(17, glClear, void, (GLbitfield mask)) CALL(18, glBufferData, void, (GLenum target, GLsizeiptr size, const void *data, GLenum usage)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(gl_state.bound_array_buffer, target, copy_array(size, (unsigned char *) data), usage); + trampoline(true, gl_state.bound_array_buffer, target, copy_array(size, (unsigned char *) data), usage); #else glBindBuffer(GL_ARRAY_BUFFER, args.next()); GLenum target = args.next(); @@ -176,7 +176,7 @@ CALL(18, glBufferData, void, (GLenum target, GLsizeiptr size, const void *data, CALL(19, glFogx, void, (GLenum pname, GLfixed param)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(pname, param); + trampoline(true, pname, param); #else GLenum pname = args.next(); GLfixed param = args.next(); @@ -187,7 +187,7 @@ CALL(19, glFogx, void, (GLenum pname, GLfixed param)) CALL(20, glFogf, void, (GLenum pname, GLfloat param)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(pname, param); + trampoline(true, pname, param); #else GLenum pname = args.next(); GLfloat param = args.next(); @@ -198,7 +198,7 @@ CALL(20, glFogf, void, (GLenum pname, GLfloat param)) CALL(21, glMatrixMode, void, (GLenum mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(mode); + trampoline(true, mode); #else func(args.next()); return 0; @@ -209,7 +209,7 @@ CALL_GL_POINTER(22, glColorPointer) CALL(23, glScissor, void, (GLint x, GLint y, GLsizei width, GLsizei height)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(x, y, width, height); + trampoline(true, x, y, width, height); #else GLint x = args.next(); GLint y = args.next(); @@ -222,7 +222,7 @@ CALL(23, glScissor, void, (GLint x, GLint y, GLsizei width, GLsizei height)) CALL(24, glTexParameteri, void, (GLenum target, GLenum pname, GLint param)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(gl_state.bound_texture, target, pname, param); + trampoline(true, gl_state.bound_texture, target, pname, param); #else glBindTexture(GL_TEXTURE_2D, args.next()); GLenum target = args.next(); @@ -271,7 +271,7 @@ static int get_texture_size(const GLsizei width, const GLsizei height, const GLe CALL(25, glTexImage2D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(gl_state.bound_texture, target, level, internalformat, width, height, border, format, type, copy_array(get_texture_size(width, height, format, type, true), (const unsigned char *) pixels)); + trampoline(true, gl_state.bound_texture, target, level, internalformat, width, height, border, format, type, copy_array(get_texture_size(width, height, format, type, true), (const unsigned char *) pixels)); #else glBindTexture(GL_TEXTURE_2D, args.next()); GLenum target = args.next(); @@ -290,7 +290,7 @@ CALL(25, glTexImage2D, void, (GLenum target, GLint level, GLint internalformat, CALL(26, glEnable, void, (GLenum cap)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(cap); + trampoline(true, cap); #else func(args.next()); return 0; @@ -305,7 +305,7 @@ void glEnableClientState(const GLenum array) { CALL(28, glPolygonOffset, void, (GLfloat factor, GLfloat units)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(factor, units); + trampoline(true, factor, units); #else GLfloat factor = args.next(); GLfloat units = args.next(); @@ -324,7 +324,7 @@ void glDisableClientState(const GLenum array) { CALL(30, glDepthRangef, void, (GLclampf near, GLclampf far)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(near, far); + trampoline(true, near, far); #else GLclampf near = args.next(); GLclampf far = args.next(); @@ -335,7 +335,7 @@ CALL(30, glDepthRangef, void, (GLclampf near, GLclampf far)) CALL(31, glDepthFunc, void, (GLenum func)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(func); + trampoline(true, func); #else func(args.next()); return 0; @@ -354,7 +354,7 @@ void glBindBuffer(const GLenum target, const GLuint buffer) { CALL(33, glClearColor, void, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(red, green, blue, alpha); + trampoline(true, red, green, blue, alpha); #else GLclampf red = args.next(); GLclampf green = args.next(); @@ -367,7 +367,7 @@ CALL(33, glClearColor, void, (GLclampf red, GLclampf green, GLclampf blue, GLcla CALL(34, glPopMatrix, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -376,7 +376,7 @@ CALL(34, glPopMatrix, void, ()) CALL(35, glLoadIdentity, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -385,7 +385,7 @@ CALL(35, glLoadIdentity, void, ()) CALL(36, glScalef, void, (GLfloat x, GLfloat y, GLfloat z)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(x, y, z); + trampoline(true, x, y, z); #else GLfloat x = args.next(); GLfloat y = args.next(); @@ -397,7 +397,7 @@ CALL(36, glScalef, void, (GLfloat x, GLfloat y, GLfloat z)) CALL(37, glPushMatrix, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -406,7 +406,7 @@ CALL(37, glPushMatrix, void, ()) CALL(38, glDepthMask, void, (GLboolean flag)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(flag); + trampoline(true, flag); #else func(args.next()); return 0; @@ -415,7 +415,7 @@ CALL(38, glDepthMask, void, (GLboolean flag)) CALL(39, glHint, void, (GLenum target, GLenum mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(target, mode); + trampoline(true, target, mode); #else GLenum target = args.next(); GLenum mode = args.next(); @@ -431,7 +431,7 @@ static int get_glMultMatrixf_size() { #endif CALL(40, glMultMatrixf, void, (const GLfloat *m)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(copy_array(get_glMultMatrixf_size(), m)); + trampoline(true, copy_array(get_glMultMatrixf_size(), m)); #else func(args.next_arr()); return 0; @@ -440,7 +440,7 @@ CALL(40, glMultMatrixf, void, (const GLfloat *m)) CALL(42, glDeleteBuffers, void, (GLsizei n, const GLuint *buffers)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(copy_array(n, buffers)); + trampoline(true, copy_array(n, buffers)); #else uint32_t n; const GLuint *buffers = args.next_arr(&n); @@ -451,7 +451,7 @@ CALL(42, glDeleteBuffers, void, (GLsizei n, const GLuint *buffers)) CALL(43, glColorMask, void, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(red, green, blue, alpha); + trampoline(true, red, green, blue, alpha); #else GLboolean red = args.next(); GLboolean green = args.next(); @@ -464,7 +464,7 @@ CALL(43, glColorMask, void, (GLboolean red, GLboolean green, GLboolean blue, GLb CALL(44, glTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(gl_state.bound_texture, target, level, xoffset, yoffset, width, height, format, type, copy_array(get_texture_size(width, height, format, type, true), (const unsigned char *) pixels)); + trampoline(true, gl_state.bound_texture, target, level, xoffset, yoffset, width, height, format, type, copy_array(get_texture_size(width, height, format, type, true), (const unsigned char *) pixels)); #else glBindTexture(GL_TEXTURE_2D, args.next()); GLenum target = args.next(); @@ -483,7 +483,7 @@ CALL(44, glTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLin CALL(45, glGenTextures, void, (GLsizei n, GLuint *textures)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(n, uint32_t(textures)); + trampoline(false, n, uint32_t(textures)); #else GLsizei n = args.next(); GLuint *textures = new GLuint[n]; @@ -496,7 +496,7 @@ CALL(45, glGenTextures, void, (GLsizei n, GLuint *textures)) CALL(46, glDeleteTextures, void, (GLsizei n, const GLuint *textures)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(copy_array(n, textures)); + trampoline(true, copy_array(n, textures)); #else uint32_t n; const GLuint *textures = args.next_arr(&n); @@ -507,7 +507,7 @@ CALL(46, glDeleteTextures, void, (GLsizei n, const GLuint *textures)) CALL(47, glAlphaFunc, void, (GLenum func, GLclampf ref)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(func, ref); + trampoline(true, func, ref); #else GLenum func2 = args.next(); GLclampf ref = args.next(); @@ -535,7 +535,7 @@ static int get_glGetFloatv_params_size(GLenum pname) { #endif CALL(48, glGetFloatv, void, (GLenum pname, GLfloat *params)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(pname, uint32_t(params)); + trampoline(false, pname, uint32_t(params)); #else GLenum pname = args.next(); int size = get_glGetFloatv_params_size(pname); @@ -559,7 +559,7 @@ void glBindTexture(const GLenum target, const GLuint texture) { CALL(50, glTranslatef, void, (GLfloat x, GLfloat y, GLfloat z)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(x, y, z); + trampoline(true, x, y, z); #else GLfloat x = args.next(); GLfloat y = args.next(); @@ -571,7 +571,7 @@ CALL(50, glTranslatef, void, (GLfloat x, GLfloat y, GLfloat z)) CALL(51, glShadeModel, void, (GLenum mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(mode); + trampoline(true, mode); #else func(args.next()); return 0; @@ -580,7 +580,7 @@ CALL(51, glShadeModel, void, (GLenum mode)) CALL(52, glOrthof, void, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(left, right, bottom, top, near, far); + trampoline(true, left, right, bottom, top, near, far); #else GLfloat left = args.next(); GLfloat right = args.next(); @@ -595,7 +595,7 @@ CALL(52, glOrthof, void, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat t CALL(53, glDisable, void, (GLenum cap)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(cap); + trampoline(true, cap); #else func(args.next()); return 0; @@ -604,7 +604,7 @@ CALL(53, glDisable, void, (GLenum cap)) CALL(54, glCullFace, void, (GLenum mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(mode); + trampoline(true, mode); #else func(args.next()); return 0; @@ -613,7 +613,7 @@ CALL(54, glCullFace, void, (GLenum mode)) CALL(55, glRotatef, void, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(angle, x, y, z); + trampoline(true, angle, x, y, z); #else GLfloat angle = args.next(); GLfloat x = args.next(); @@ -626,7 +626,7 @@ CALL(55, glRotatef, void, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) CALL(56, glViewport, void, (GLint x, GLint y, GLsizei width, GLsizei height)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(x, y, width, height); + trampoline(true, x, y, width, height); #else GLint x = args.next(); GLint y = args.next(); @@ -639,7 +639,7 @@ CALL(56, glViewport, void, (GLint x, GLint y, GLsizei width, GLsizei height)) CALL(57, glNormal3f, void, (GLfloat nx, GLfloat ny, GLfloat nz)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(nx, ny, nz); + trampoline(true, nx, ny, nz); #else GLfloat nx = args.next(); GLfloat ny = args.next(); @@ -651,7 +651,7 @@ CALL(57, glNormal3f, void, (GLfloat nx, GLfloat ny, GLfloat nz)) CALL(58, glIsEnabled, GLboolean, (GLenum cap)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return trampoline(cap); + return trampoline(false, cap); #else return func(args.next()); #endif @@ -676,7 +676,7 @@ static int get_glGetIntegerv_params_size(GLenum pname) { #endif CALL(61, glGetIntegerv, void, (GLenum pname, GLint *params)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(pname, uint32_t(params)); + trampoline(false, pname, uint32_t(params)); #else GLenum pname = args.next(); int size = get_glGetIntegerv_params_size(pname); @@ -690,7 +690,7 @@ CALL(61, glGetIntegerv, void, (GLenum pname, GLint *params)) CALL(65, glReadPixels, void, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(x, y, width, height, format, type, uint32_t(data)); + trampoline(false, x, y, width, height, format, type, uint32_t(data)); #else GLint x = args.next(); GLint y = args.next(); @@ -709,7 +709,7 @@ CALL(65, glReadPixels, void, (GLint x, GLint y, GLsizei width, GLsizei height, G CALL(67, glGenBuffers, void, (GLsizei n, GLuint *buffers)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(n, uint32_t(buffers)); + trampoline(false, n, uint32_t(buffers)); #else GLsizei n = args.next(); GLuint *buffers = new GLuint[n]; diff --git a/media-layer/trampoline/src/guest/guest.cpp b/media-layer/trampoline/src/guest/guest.cpp index d699e269..374e941c 100644 --- a/media-layer/trampoline/src/guest/guest.cpp +++ b/media-layer/trampoline/src/guest/guest.cpp @@ -26,7 +26,7 @@ static int get_pipe(const char *env) { std::string str = value; return std::stoi(str); } -static uint32_t trampoline_pipe(const uint32_t id) { +static uint32_t trampoline_pipe(const uint32_t id, const bool allow_early_return, const uint32_t length, const unsigned char *args) { // Get Pipes static int arguments_pipe = -1; static int return_value_pipe = -1; @@ -34,20 +34,30 @@ static uint32_t trampoline_pipe(const uint32_t id) { arguments_pipe = get_pipe(TRAMPOLINE_ARGUMENTS_PIPE_ENV); return_value_pipe = get_pipe(TRAMPOLINE_RETURN_VALUE_PIPE_ENV); } - // Write ID - if (write(arguments_pipe, &id, sizeof(uint32_t)) != sizeof(uint32_t)) { + // Write Command + const trampoline_pipe_arguments cmd = { + .id = id, + .allow_early_return = allow_early_return, + .length = length, + .args_addr = uint32_t(args) + }; + if (write(arguments_pipe, &cmd, sizeof(trampoline_pipe_arguments)) != sizeof(trampoline_pipe_arguments)) { ERR("Unable To Write Trampoline Command"); } // Return - uint32_t ret; - if (read(return_value_pipe, &ret, sizeof(uint32_t)) != sizeof(uint32_t)) { - ERR("Unable To Read Trampoline Return Value"); + if (length > 0 || !allow_early_return) { + uint32_t ret; + if (read(return_value_pipe, &ret, sizeof(uint32_t)) != sizeof(uint32_t)) { + ERR("Unable To Read Trampoline Return Value"); + } + return ret; + } else { + return 0; } - return ret; } // Main Function -uint32_t _raw_trampoline(const uint32_t id, const uint32_t length, const unsigned char *args) { +uint32_t _raw_trampoline(const uint32_t id, const bool allow_early_return, const uint32_t length, const unsigned char *args) { // Configure Method static int use_syscall = -1; if (use_syscall == -1) { @@ -57,30 +67,6 @@ uint32_t _raw_trampoline(const uint32_t id, const uint32_t length, const unsigne if (use_syscall) { return trampoline_syscall(id, length, args); } else { - return trampoline_pipe(id); + return trampoline_pipe(id, allow_early_return, length, args); } } - -// Arguments Memory -unsigned char *get_arguments_memory() { - static unsigned char fallback[MAX_TRAMPOLINE_ARGS_SIZE]; - // Find Result - static unsigned char *ret = nullptr; - if (ret == nullptr) { - ret = fallback; - // Try Shared Memory - const char *shared_memory_name = getenv(TRAMPOLINE_SHARED_MEMORY_ENV); - if (shared_memory_name != nullptr) { - int fd = shm_open(shared_memory_name, O_RDWR, 0600); - if (fd == -1) { - ERR("Unable To Open Shared Memory: %s", strerror(errno)); - } - ret = (unsigned char *) mmap(nullptr, MAX_TRAMPOLINE_ARGS_SIZE, PROT_WRITE, MAP_SHARED, fd, 0); - if (ret == MAP_FAILED) { - ERR("Unable To Map Shared Memory: %s", strerror(errno)); - } - } - } - // Return - return ret; -} \ No newline at end of file diff --git a/media-layer/trampoline/src/guest/guest.h b/media-layer/trampoline/src/guest/guest.h index fa9d22b4..7a7cf636 100644 --- a/media-layer/trampoline/src/guest/guest.h +++ b/media-layer/trampoline/src/guest/guest.h @@ -5,8 +5,7 @@ #include "../common/common.h" // Trampoline Function -unsigned char *get_arguments_memory(); -uint32_t _raw_trampoline(uint32_t id, uint32_t length, const unsigned char *args); +uint32_t _raw_trampoline(uint32_t id, bool allow_early_return, uint32_t length, const unsigned char *args); // Compile Trampoline Arguments template @@ -53,12 +52,12 @@ void _add_to_trampoline_args(unsigned char *&out, const T &first, const Args... // Main Trampoline Function template -unsigned int _trampoline(unsigned int id, Args... args) { - static unsigned char *out = get_arguments_memory(); +unsigned int _trampoline(const unsigned int id, const bool allow_early_return, Args... args) { + static unsigned char out[MAX_TRAMPOLINE_ARGS_SIZE]; unsigned char *end = out; _add_to_trampoline_args(end, args...); const uint32_t length = end - out; - return _raw_trampoline(id, length, out); + return _raw_trampoline(id, allow_early_return, length, out); } #define trampoline(...) _trampoline(_id, ##__VA_ARGS__) diff --git a/media-layer/trampoline/src/media-layer-core.cpp b/media-layer/trampoline/src/media-layer-core.cpp index c70c072b..f9c19aff 100644 --- a/media-layer/trampoline/src/media-layer-core.cpp +++ b/media-layer/trampoline/src/media-layer-core.cpp @@ -13,7 +13,7 @@ CALL(0, SDL_Init, int, (uint32_t flags)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return trampoline(flags); + return trampoline(false, flags); #else uint32_t flags = args.next(); return func(flags); @@ -22,7 +22,7 @@ CALL(0, SDL_Init, int, (uint32_t flags)) CALL(1, SDL_PollEvent, int, (SDL_Event *event)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return trampoline(uint32_t(event)); + return trampoline(false, uint32_t(event)); #else SDL_Event event; const int ret = func(&event); @@ -33,7 +33,7 @@ CALL(1, SDL_PollEvent, int, (SDL_Event *event)) CALL(2, SDL_PushEvent, int, (SDL_Event *event)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return trampoline(*event); + return trampoline(false, *event); #else SDL_Event event = args.next(); return func(&event); @@ -42,7 +42,7 @@ CALL(2, SDL_PushEvent, int, (SDL_Event *event)) CALL(3, SDL_WM_SetCaption, void, (const char *title, const char *icon)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(copy_array(title), copy_array(icon)); + trampoline(true, copy_array(title), copy_array(icon)); #else const char *title = args.next_arr(); const char *icon = args.next_arr(); @@ -53,7 +53,7 @@ CALL(3, SDL_WM_SetCaption, void, (const char *title, const char *icon)) CALL(4, media_toggle_fullscreen, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -62,7 +62,7 @@ CALL(4, media_toggle_fullscreen, void, ()) CALL(5, SDL_WM_GrabInput, SDL_GrabMode, (SDL_GrabMode mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return (SDL_GrabMode) trampoline(mode); + return (SDL_GrabMode) trampoline(false, mode); #else return func(args.next()); #endif @@ -70,7 +70,7 @@ CALL(5, SDL_WM_GrabInput, SDL_GrabMode, (SDL_GrabMode mode)) CALL(6, SDL_ShowCursor, int, (int32_t toggle)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - return trampoline(toggle); + return trampoline(false, toggle); #else return func(args.next()); #endif @@ -78,7 +78,7 @@ CALL(6, SDL_ShowCursor, int, (int32_t toggle)) CALL(8, media_swap_buffers, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -96,7 +96,7 @@ CALL(9, media_cleanup, void, ()) CALL(10, media_get_framebuffer_size, void, (int *width, int *height)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(uint32_t(width), uint32_t(height)); + trampoline(false, uint32_t(width), uint32_t(height)); #else int width; int height; @@ -109,7 +109,7 @@ CALL(10, media_get_framebuffer_size, void, (int *width, int *height)) CALL(59, media_audio_update, void, (float volume, float x, float y, float z, float yaw)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(volume, x, y, z, yaw); + trampoline(true, volume, x, y, z, yaw); #else float volume = args.next(); float x = args.next(); @@ -123,7 +123,7 @@ CALL(59, media_audio_update, void, (float volume, float x, float y, float z, flo CALL(60, media_audio_play, void, (const char *source, const char *name, float x, float y, float z, float pitch, float volume, int is_ui)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(copy_array(source), copy_array(name), x, y, z, pitch, volume, is_ui); + trampoline(true, copy_array(source), copy_array(name), x, y, z, pitch, volume, is_ui); #else const char *source = args.next_arr(); const char *name = args.next_arr(); @@ -140,7 +140,7 @@ CALL(60, media_audio_play, void, (const char *source, const char *name, float x, CALL(62, media_set_interactable, void, (int is_interactable)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(is_interactable); + trampoline(true, is_interactable); #else func(args.next()); return 0; @@ -149,7 +149,7 @@ CALL(62, media_set_interactable, void, (int is_interactable)) CALL(63, media_disable_vsync, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -158,7 +158,7 @@ CALL(63, media_disable_vsync, void, ()) CALL(64, media_set_raw_mouse_motion_enabled, void, (int enabled)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(enabled); + trampoline(true, enabled); #else func(args.next()); return 0; @@ -167,7 +167,7 @@ CALL(64, media_set_raw_mouse_motion_enabled, void, (int enabled)) CALL(66, media_force_egl, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0; @@ -176,7 +176,7 @@ CALL(66, media_force_egl, void, ()) CALL(68, media_ensure_loaded, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST - trampoline(); + trampoline(true); #else func(); return 0;