diff --git a/media-layer/CMakeLists.txt b/media-layer/CMakeLists.txt index 65ecf6f363..55e4e7711f 100644 --- a/media-layer/CMakeLists.txt +++ b/media-layer/CMakeLists.txt @@ -21,7 +21,6 @@ endif() # Add Core if(BUILD_MEDIA_LAYER_CORE) - add_subdirectory(gles) add_subdirectory(core) endif() diff --git a/media-layer/core/CMakeLists.txt b/media-layer/core/CMakeLists.txt index 187beb9e52..58b934ce65 100644 --- a/media-layer/core/CMakeLists.txt +++ b/media-layer/core/CMakeLists.txt @@ -3,11 +3,12 @@ project(media-layer-core) # SDL Re-Implementation Using GLFW set(CORE_SRC src/base.cpp - src/media.cpp - src/cursor.cpp - src/util.cpp - src/events.cpp - src/offscreen.cpp + src/window/media.cpp + src/window/cursor.cpp + src/window/util.cpp + src/window/events.cpp + src/window/offscreen.cpp + src/window/gles.cpp src/audio/api.cpp src/audio/engine.cpp src/audio/file.cpp @@ -28,7 +29,6 @@ target_link_libraries(media-layer-core-real PUBLIC media-layer-headers reborn-util - GLESv1_CM dl PRIVATE "${OPENAL_LIBRARY}" diff --git a/media-layer/core/src/base.cpp b/media-layer/core/src/base.cpp index ac92152f41..196948eb5f 100644 --- a/media-layer/core/src/base.cpp +++ b/media-layer/core/src/base.cpp @@ -4,7 +4,7 @@ #include -#include "media.h" +#include "window/media.h" // SDL Is Replaced With GLFW @@ -22,7 +22,7 @@ int media_SDL_PollEvent(SDL_Event *event) { // Poll Event int ret; - if (queue.size() > 0) { + if (!queue.empty()) { *event = queue[0]; queue.erase(queue.begin()); ret = 1; diff --git a/media-layer/core/src/cursor.cpp b/media-layer/core/src/window/cursor.cpp similarity index 100% rename from media-layer/core/src/cursor.cpp rename to media-layer/core/src/window/cursor.cpp diff --git a/media-layer/core/src/events.cpp b/media-layer/core/src/window/events.cpp similarity index 100% rename from media-layer/core/src/events.cpp rename to media-layer/core/src/window/events.cpp diff --git a/media-layer/gles/src/passthrough.cpp b/media-layer/core/src/window/gles.cpp similarity index 99% rename from media-layer/gles/src/passthrough.cpp rename to media-layer/core/src/window/gles.cpp index eede57cc03..9bfe023ae6 100644 --- a/media-layer/gles/src/passthrough.cpp +++ b/media-layer/core/src/window/gles.cpp @@ -4,6 +4,8 @@ #include +#include "media.h" + // Load GL Function unsigned int media_context_id = 0; #define GL_FUNC(name, return_type, args) \ @@ -13,6 +15,9 @@ unsigned int media_context_id = 0; static unsigned int old_context = 0; \ if (!func || old_context != media_context_id) { \ old_context = media_context_id; \ + if (glfw_window == nullptr) { \ + IMPOSSIBLE(); \ + } \ func = (real_##name##_t) glfwGetProcAddress(#name); \ if (!func) { \ ERR("Error Resolving OpenGL Function: " #name); \ diff --git a/media-layer/core/src/media.cpp b/media-layer/core/src/window/media.cpp similarity index 98% rename from media-layer/core/src/media.cpp rename to media-layer/core/src/window/media.cpp index 00b14902a0..477d5cf9eb 100644 --- a/media-layer/core/src/media.cpp +++ b/media-layer/core/src/window/media.cpp @@ -2,7 +2,7 @@ #include #include "media.h" -#include "audio/engine.h" +#include "../audio/engine.h" // Window GLFWwindow *glfw_window = nullptr; diff --git a/media-layer/core/src/media.h b/media-layer/core/src/window/media.h similarity index 100% rename from media-layer/core/src/media.h rename to media-layer/core/src/window/media.h diff --git a/media-layer/core/src/offscreen.cpp b/media-layer/core/src/window/offscreen.cpp similarity index 100% rename from media-layer/core/src/offscreen.cpp rename to media-layer/core/src/window/offscreen.cpp diff --git a/media-layer/core/src/util.cpp b/media-layer/core/src/window/util.cpp similarity index 100% rename from media-layer/core/src/util.cpp rename to media-layer/core/src/window/util.cpp diff --git a/media-layer/gles/CMakeLists.txt b/media-layer/gles/CMakeLists.txt deleted file mode 100644 index ddb83c8eec..0000000000 --- a/media-layer/gles/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -project(media-layer-gles) - -# Build -add_library(GLESv1_CM OBJECT src/passthrough.cpp) -target_link_libraries(GLESv1_CM PRIVATE glfw media-layer-headers reborn-util) \ No newline at end of file diff --git a/media-layer/trampoline/CMakeLists.txt b/media-layer/trampoline/CMakeLists.txt index 19952507ab..9543b59491 100644 --- a/media-layer/trampoline/CMakeLists.txt +++ b/media-layer/trampoline/CMakeLists.txt @@ -7,8 +7,8 @@ set(MEDIA_LAYER_TRAMPOLINE_SRC src/media-layer-core.cpp src/GLESv1_CM.cpp) if(BUILD_NATIVE_COMPONENTS) # Host Component add_library(media-layer-trampoline src/host/host.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC}) - target_link_libraries(media-layer-trampoline reborn-util media-layer-core GLESv1_CM trampoline-headers) - target_compile_definitions(media-layer-trampoline PRIVATE -DMEDIA_LAYER_TRAMPOLINE_HOST) + target_link_libraries(media-layer-trampoline reborn-util media-layer-core trampoline-headers) + target_compile_definitions(media-layer-trampoline PRIVATE MEDIA_LAYER_TRAMPOLINE_HOST) # Install install(TARGETS media-layer-trampoline DESTINATION "${MCPI_LIB_DIR}") elseif(BUILD_ARM_COMPONENTS) @@ -22,7 +22,7 @@ elseif(BUILD_ARM_COMPONENTS) trampoline-headers rt ) - target_compile_definitions(media-layer-core PRIVATE -DMEDIA_LAYER_TRAMPOLINE_GUEST) + target_compile_definitions(media-layer-core PRIVATE MEDIA_LAYER_TRAMPOLINE_GUEST) # Install if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE) install(TARGETS media-layer-core DESTINATION "${MCPI_LIB_DIR}")