#include #include #include #include #include "common/common.h" #include // SDL Functions CALL(0, SDL_Init, int, (uint32_t flags)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST return trampoline(flags); #else uint32_t flags = args.next(); return func(flags); #endif } CALL(1, SDL_PollEvent, int, (SDL_Event *event)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST return trampoline(uint32_t(event)); #else SDL_Event event; const int ret = func(&event); writer(args.next(), &event, sizeof(SDL_Event)); return ret; #endif } CALL(2, SDL_PushEvent, int, (SDL_Event *event)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST return trampoline(*event); #else SDL_Event event = args.next(); return func(&event); #endif } CALL(3, SDL_WM_SetCaption, void, (const char *title, const char *icon)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(copy_array(title), copy_array(icon)); #else const char *title = args.next_arr(); const char *icon = args.next_arr(); func(title, icon); return 0; #endif } CALL(4, media_toggle_fullscreen, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(); #else func(); return 0; #endif } CALL(5, SDL_WM_GrabInput, SDL_GrabMode, (SDL_GrabMode mode)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST return (SDL_GrabMode) trampoline(mode); #else return func(args.next()); #endif } CALL(6, SDL_ShowCursor, int, (int32_t toggle)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST return trampoline(toggle); #else return func(args.next()); #endif } CALL(8, media_swap_buffers, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(); #else func(); return 0; #endif } CALL(9, media_cleanup, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(false); #else func(); return 0; #endif } CALL(10, media_get_framebuffer_size, void, (int *width, int *height)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(uint32_t(width), uint32_t(height)); #else int width; int height; func(&width, &height); writer(args.next(), &width, sizeof(int)); writer(args.next(), &height, sizeof(int)); return 0; #endif } 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); #else float volume = args.next(); float x = args.next(); float y = args.next(); float z = args.next(); float yaw = args.next(); func(volume, x, y, z, yaw); return 0; #endif } 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); #else const char *source = args.next_arr(); const char *name = args.next_arr(); float x = args.next(); float y = args.next(); float z = args.next(); float pitch = args.next(); float volume = args.next(); int is_ui = args.next(); func(source, name, x, y, z, pitch, volume, is_ui); return 0; #endif } CALL(62, media_set_interactable, void, (int is_interactable)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(is_interactable); #else func(args.next()); return 0; #endif } CALL(63, media_disable_vsync, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(); #else func(); return 0; #endif } CALL(64, media_set_raw_mouse_motion_enabled, void, (int enabled)) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(enabled); #else func(args.next()); return 0; #endif } CALL(66, media_force_egl, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(); #else func(); return 0; #endif } CALL(68, media_ensure_loaded, void, ()) #ifdef MEDIA_LAYER_TRAMPOLINE_GUEST trampoline(); #else func(); return 0; #endif }