mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 07:59:46 +00:00
This commit is contained in:
commit
70ed83cf84
@ -79,7 +79,7 @@ if(NOT LIBMGBA_ONLY)
|
||||
set(SKIP_LIBRARY OFF CACHE BOOL "Skip building the library (useful for only building libretro or OpenEmu cores)")
|
||||
set(BUILD_GL ON CACHE BOOL "Build with OpenGL")
|
||||
set(BUILD_GLES2 ON CACHE BOOL "Build with OpenGL|ES 2")
|
||||
set(BUILD_GLES3 OFF CACHE BOOL "Build with OpenGL|ES 3")
|
||||
set(BUILD_GLES3 ON CACHE BOOL "Build with OpenGL|ES 3")
|
||||
set(USE_EPOXY ON CACHE STRING "Build with libepoxy")
|
||||
set(DISABLE_DEPS OFF CACHE BOOL "Build without dependencies")
|
||||
set(DISTBUILD OFF CACHE BOOL "Build distribution packages")
|
||||
@ -212,8 +212,7 @@ if(WIN32)
|
||||
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
|
||||
add_definitions(-D_UNICODE -DUNICODE)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -municode")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode")
|
||||
add_definitions(-D_GNU_SOURCE)
|
||||
endif()
|
||||
list(APPEND OS_LIB ws2_32 shlwapi)
|
||||
list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-fd.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/windows/vfs-w32.c)
|
||||
@ -331,7 +330,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
find_function(localtime_r)
|
||||
# The strtof_l on Linux not actually exposed nor actually strtof_l
|
||||
set(HAVE_STRTOF_L OFF)
|
||||
elseif(NOT DEFINED PSP2)
|
||||
else()
|
||||
find_function(localtime_r)
|
||||
find_function(strtof_l)
|
||||
endif()
|
||||
@ -398,6 +397,7 @@ if(CMAKE_SYSTEM_NAME MATCHES ".*BSD|DragonFly")
|
||||
else()
|
||||
find_feature(USE_EDITLINE "libedit")
|
||||
endif()
|
||||
|
||||
if(BUILD_GL)
|
||||
find_package(OpenGL QUIET)
|
||||
if(NOT OPENGL_FOUND)
|
||||
@ -406,39 +406,49 @@ if(BUILD_GL)
|
||||
set(OPENGL_LIBRARY OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT BUILD_GL AND NOT LIBMGBA_ONLY)
|
||||
set(OPENGL_LIBRARY "" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
if(BUILD_GLES2 AND NOT BUILD_RASPI AND NOT CMAKE_SYSTEM_NAME MATCHES "^(Windows|Darwin|Linux|.*BSD|DragonFly|Haiku)$")
|
||||
find_path(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h)
|
||||
find_library(OPENGLES2_LIBRARY NAMES GLESv2 GLESv2_CM)
|
||||
if(NOT OPENGLES2_INCLUDE_DIR OR NOT OPENGLES2_LIBRARY)
|
||||
set(BUILD_GLES2 OFF CACHE BOOL "OpenGL|ES 2 not found" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT BUILD_GLES2 AND NOT LIBMGBA_ONLY)
|
||||
set(OPENGLES2_LIBRARY "" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
if(BUILD_GL)
|
||||
list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/opengl/gl.c)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GL)
|
||||
list(APPEND DEPENDENCY_LIB ${OPENGL_LIBRARY})
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
if(NOT BUILD_GL AND NOT LIBMGBA_ONLY)
|
||||
set(OPENGL_LIBRARY "" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
|
||||
if(BUILD_GLES2 AND NOT BUILD_GL)
|
||||
find_path(OPENGLES2_INCLUDE_DIR NAMES GLES2/gl2.h)
|
||||
find_library(OPENGLES2_LIBRARY NAMES GLESv2 GLESv2_CM)
|
||||
if(NOT OPENGLES2_INCLUDE_DIR OR NOT OPENGLES2_LIBRARY)
|
||||
set(BUILD_GLES2 OFF CACHE BOOL "OpenGL|ES 2 not found" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_GLES2)
|
||||
list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/opengl/gles2.c)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GLES2)
|
||||
list(APPEND DEPENDENCY_LIB ${OPENGLES2_LIBRARY})
|
||||
include_directories(${OPENGLES2_INCLUDE_DIR})
|
||||
endif()
|
||||
if(BUILD_GLES3)
|
||||
|
||||
if(BUILD_GLES3 AND NOT BUILD_GL)
|
||||
find_path(OPENGLES3_INCLUDE_DIR NAMES GLES3/gl3.h)
|
||||
find_library(OPENGLES3_LIBRARY NAMES GLESv3 GLESv2)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GLES3)
|
||||
if(NOT OPENGLES3_INCLUDE_DIR OR NOT OPENGLES3_LIBRARY)
|
||||
set(BUILD_GLES3 OFF CACHE BOOL "OpenGL|ES 3 not found" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_GLES3)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GLES3)
|
||||
list(APPEND DEPENDENCY_LIB ${OPENGLES3_LIBRARY})
|
||||
include_directories(${OPENGLES3_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(BUILD_GLES2 OR BUILD_GLES3)
|
||||
list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/opengl/gles2.c)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_GLES2 AND NOT BUILD_GLES3 AND NOT LIBMGBA_ONLY)
|
||||
set(OPENGLES2_LIBRARY "" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
|
||||
if(DISABLE_DEPS)
|
||||
set(USE_GDB_STUB OFF)
|
||||
@ -679,7 +689,7 @@ endif()
|
||||
|
||||
if(USE_EPOXY)
|
||||
list(APPEND FEATURE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/opengl/gl.c ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/opengl/gles2.c)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GL BUILD_GLES2)
|
||||
list(APPEND FEATURE_DEFINES BUILD_GL BUILD_GLES2 BUILD_GLES3)
|
||||
list(APPEND FEATURES EPOXY)
|
||||
include_directories(AFTER ${EPOXY_INCLUDE_DIRS})
|
||||
link_directories(${EPOXY_LIBRARY_DIRS})
|
||||
@ -914,14 +924,16 @@ if(BUILD_OPENEMU)
|
||||
install(TARGETS ${BINARY_NAME}-openemu LIBRARY DESTINATION ${OE_LIBDIR} COMPONENT ${BINARY_NAME}.oecoreplugin NAMELINK_SKIP)
|
||||
endif()
|
||||
|
||||
if(BUILD_QT AND WIN32)
|
||||
if(BUILD_QT AND (WIN32 OR APPLE))
|
||||
set(BUILD_UPDATER ON)
|
||||
endif()
|
||||
|
||||
if(BUILD_UPDATER)
|
||||
add_executable(updater-stub WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c)
|
||||
target_link_libraries(updater-stub ${OS_LIB} ${PLATFORM_LIBRARY} ${BINARY_NAME})
|
||||
if(NOT MSVC)
|
||||
if(MSVC)
|
||||
set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup)
|
||||
else()
|
||||
set_target_properties(updater-stub PROPERTIES LINK_FLAGS_RELEASE -s)
|
||||
set_target_properties(updater-stub PROPERTIES LINK_FLAGS_RELWITHDEBINFO -s)
|
||||
endif()
|
||||
|
@ -254,9 +254,9 @@ typedef intptr_t ssize_t;
|
||||
#define ATTRIBUTE_NOINLINE
|
||||
// Adapted from https://stackoverflow.com/a/2390626
|
||||
#define _CONSTRUCTOR(FN, PRE) \
|
||||
static void FN(void); \
|
||||
__declspec(allocate(".CRT$XCU")) void (*_CONSTRUCTOR_ ## FN)(void) = FN; \
|
||||
static void FN(void)
|
||||
static void FN(void); \
|
||||
__declspec(allocate(".CRT$XCU")) void (*_CONSTRUCTOR_ ## FN)(void) = FN; \
|
||||
static void FN(void)
|
||||
#ifdef _WIN64
|
||||
#define CONSTRUCTOR(FN) _CONSTRUCTOR(FN, "")
|
||||
#else
|
||||
|
@ -17,16 +17,16 @@ struct StringList;
|
||||
struct Table;
|
||||
|
||||
struct mUpdaterContext {
|
||||
struct Configuration manifest;
|
||||
struct Configuration manifest;
|
||||
};
|
||||
|
||||
struct mUpdate {
|
||||
const char* path;
|
||||
size_t size;
|
||||
int rev;
|
||||
const char* version;
|
||||
const char* commit;
|
||||
const char* sha256;
|
||||
const char* path;
|
||||
size_t size;
|
||||
int rev;
|
||||
const char* version;
|
||||
const char* commit;
|
||||
const char* sha256;
|
||||
};
|
||||
|
||||
bool mUpdaterInit(struct mUpdaterContext*, const char* manifest);
|
||||
|
@ -16,7 +16,7 @@ CXX_GUARD_START
|
||||
#include <mgba/internal/gba/renderers/common.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
|
||||
#ifdef USE_EPOXY
|
||||
#include <epoxy/gl.h>
|
||||
|
@ -662,7 +662,7 @@ size_t _parseGDBMessage(struct GDBStub* stub, const char* message) {
|
||||
break;
|
||||
case 'X':
|
||||
_writeMemoryBinary(stub, message);
|
||||
break;
|
||||
break;
|
||||
case 'Z':
|
||||
_setBreakpoint(stub, message);
|
||||
break;
|
||||
|
@ -185,6 +185,16 @@ void mUpdateRegister(struct mCoreConfig* config, const char* arg0, const char* u
|
||||
#endif
|
||||
if (last) {
|
||||
last[0] = '\0';
|
||||
#ifdef __APPLE__
|
||||
ssize_t len = strlen(filename);
|
||||
if (len > 19 && strcmp(&filename[len - 19], ".app/Contents/MacOS") == 0) {
|
||||
filename[len - 19] = '\0';
|
||||
last = strrchr(filename, '/');
|
||||
if (last) {
|
||||
last[0] = '\0';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ConfigurationSetValue(cfg, UPDATE_SECTION, "bin", arg0);
|
||||
ConfigurationSetValue(cfg, UPDATE_SECTION, "root", filename);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef DISABLE_THREADING
|
||||
#include <mgba/feature/thread-proxy.h>
|
||||
#endif
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
#include <mgba/internal/gba/renderers/gl.h>
|
||||
#endif
|
||||
#include <mgba/internal/gba/renderers/proxy.h>
|
||||
@ -134,7 +134,7 @@ struct GBACore {
|
||||
struct mCore d;
|
||||
struct GBAVideoRenderer dummyRenderer;
|
||||
struct GBAVideoSoftwareRenderer renderer;
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
struct GBAVideoGLRenderer glRenderer;
|
||||
#endif
|
||||
#ifndef MINIMAL_CORE
|
||||
@ -192,7 +192,7 @@ static bool _GBACoreInit(struct mCore* core) {
|
||||
GBAVideoSoftwareRendererCreate(&gbacore->renderer);
|
||||
gbacore->renderer.outputBuffer = NULL;
|
||||
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
GBAVideoGLRendererCreate(&gbacore->glRenderer);
|
||||
gbacore->glRenderer.outputTex = -1;
|
||||
#endif
|
||||
@ -248,7 +248,7 @@ static bool _GBACoreSupportsFeature(const struct mCore* core, enum mCoreFeature
|
||||
UNUSED(core);
|
||||
switch (feature) {
|
||||
case mCORE_FEATURE_OPENGL:
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
@ -362,7 +362,7 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
||||
}
|
||||
|
||||
struct GBACore* gbacore = (struct GBACore*) core;
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
if (strcmp("videoScale", option) == 0) {
|
||||
if (config != &core->config) {
|
||||
mCoreConfigCopyValue(&core->config, config, "videoScale");
|
||||
@ -380,7 +380,7 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
||||
if (gbacore->renderer.outputBuffer) {
|
||||
renderer = &gbacore->renderer.d;
|
||||
}
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
|
||||
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
|
||||
renderer = &gbacore->glRenderer.d;
|
||||
@ -402,7 +402,7 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
||||
}
|
||||
|
||||
static void _GBACoreDesiredVideoDimensions(const struct mCore* core, unsigned* width, unsigned* height) {
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
const struct GBACore* gbacore = (const struct GBACore*) core;
|
||||
int scale = gbacore->glRenderer.scale;
|
||||
#else
|
||||
@ -422,7 +422,7 @@ static void _GBACoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t s
|
||||
}
|
||||
|
||||
static void _GBACoreSetVideoGLTex(struct mCore* core, unsigned texid) {
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
struct GBACore* gbacore = (struct GBACore*) core;
|
||||
gbacore->glRenderer.outputTex = texid;
|
||||
#else
|
||||
@ -562,7 +562,7 @@ static void _GBACoreReset(struct mCore* core) {
|
||||
struct GBA* gba = (struct GBA*) core->board;
|
||||
int fakeBool;
|
||||
if (gbacore->renderer.outputBuffer
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
|| gbacore->glRenderer.outputTex != (unsigned) -1
|
||||
#endif
|
||||
) {
|
||||
@ -570,7 +570,7 @@ static void _GBACoreReset(struct mCore* core) {
|
||||
if (gbacore->renderer.outputBuffer) {
|
||||
renderer = &gbacore->renderer.d;
|
||||
}
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
|
||||
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
|
||||
renderer = &gbacore->glRenderer.d;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include <mgba/internal/gba/renderers/gl.h>
|
||||
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#ifdef BUILD_GLES3
|
||||
|
||||
#include <mgba/core/cache-set.h>
|
||||
#include <mgba/internal/arm/macros.h>
|
||||
|
@ -159,6 +159,7 @@ static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
|
||||
mGLES2ShaderInit(&context->finalShader, 0, 0, 0, 0, false, 0, 0);
|
||||
mGLES2ShaderInit(&context->interframeShader, 0, _interframeFragmentShader, -1, -1, false, 0, 0);
|
||||
|
||||
#ifdef BUILD_GLES3
|
||||
if (context->initialShader.vao != (GLuint) -1) {
|
||||
glBindVertexArray(context->initialShader.vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, context->vbo);
|
||||
@ -168,6 +169,7 @@ static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, context->vbo);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
glDeleteFramebuffers(1, &context->finalShader.fbo);
|
||||
glDeleteTextures(1, &context->finalShader.tex);
|
||||
@ -297,9 +299,12 @@ void _drawShader(struct mGLES2Context* context, struct mGLES2Shader* shader) {
|
||||
glUseProgram(shader->program);
|
||||
glUniform1i(shader->texLocation, 0);
|
||||
glUniform2f(shader->texSizeLocation, context->d.width - padW, context->d.height - padH);
|
||||
#ifdef BUILD_GLES3
|
||||
if (shader->vao != (GLuint) -1) {
|
||||
glBindVertexArray(shader->vao);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, context->vbo);
|
||||
glEnableVertexAttribArray(shader->positionLocation);
|
||||
glVertexAttribPointer(shader->positionLocation, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
@ -391,9 +396,11 @@ void mGLES2ContextDrawFrame(struct VideoBackend* v) {
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glUseProgram(0);
|
||||
#ifdef BUILD_GLES3
|
||||
if (context->finalShader.vao != (GLuint) -1) {
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void mGLES2ContextPostFrame(struct VideoBackend* v, const void* frame) {
|
||||
@ -508,6 +515,7 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
|
||||
shader->uniforms[i].location = glGetUniformLocation(shader->program, shader->uniforms[i].name);
|
||||
}
|
||||
|
||||
#ifdef BUILD_GLES3
|
||||
const GLubyte* extensions = glGetString(GL_EXTENSIONS);
|
||||
if (shaderBuffer[0] == _gles2Header || version[0] >= '3' || (extensions && strstr((const char*) extensions, "_vertex_array_object") != NULL)) {
|
||||
glGenVertexArrays(1, &shader->vao);
|
||||
@ -515,7 +523,9 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
|
||||
glEnableVertexAttribArray(shader->positionLocation);
|
||||
glVertexAttribPointer(shader->positionLocation, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glBindVertexArray(0);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
shader->vao = -1;
|
||||
}
|
||||
|
||||
@ -527,9 +537,11 @@ void mGLES2ShaderDeinit(struct mGLES2Shader* shader) {
|
||||
glDeleteShader(shader->fragmentShader);
|
||||
glDeleteProgram(shader->program);
|
||||
glDeleteFramebuffers(1, &shader->fbo);
|
||||
#ifdef BUILD_GLES3
|
||||
if (shader->vao != (GLuint) -1) {
|
||||
glDeleteVertexArrays(1, &shader->vao);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void mGLES2ShaderAttach(struct mGLES2Context* context, struct mGLES2Shader* shaders, size_t nShaders) {
|
||||
@ -547,16 +559,20 @@ void mGLES2ShaderAttach(struct mGLES2Context* context, struct mGLES2Shader* shad
|
||||
glClearColor(0.f, 0.f, 0.f, 1.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
#ifdef BUILD_GLES3
|
||||
if (context->shaders[i].vao != (GLuint) -1) {
|
||||
glBindVertexArray(context->shaders[i].vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, context->vbo);
|
||||
glEnableVertexAttribArray(context->shaders[i].positionLocation);
|
||||
glVertexAttribPointer(context->shaders[i].positionLocation, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef BUILD_GLES3
|
||||
if (context->initialShader.vao != (GLuint) -1) {
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
#endif
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@ CXX_GUARD_START
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#elif defined(BUILD_GLES3)
|
||||
#include <GLES3/gl3.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@ include("${VITASDK}/share/vita.cmake" REQUIRED)
|
||||
find_program(OBJCOPY ${cross_prefix}objcopy)
|
||||
find_file(NIDDB db.json PATHS ${VITASDK} ${VITASDK}/bin ${VITASDK}/share)
|
||||
|
||||
set(OS_DEFINES IOAPI_NO_64)
|
||||
set(OS_DEFINES IOAPI_NO_64 _GNU_SOURCE)
|
||||
set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
|
||||
|
||||
file(GLOB OS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/psp2-*.c)
|
||||
|
@ -90,7 +90,7 @@ struct VFile* VFileOpenSce(const char* path, int flags, SceMode mode) {
|
||||
|
||||
bool _vfsceClose(struct VFile* vf) {
|
||||
struct VFileSce* vfsce = (struct VFileSce*) vf;
|
||||
sceIoSyncByFd(vfsce->fd);
|
||||
sceIoSyncByFd(vfsce->fd, 0);
|
||||
return sceIoClose(vfsce->fd) >= 0;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size) {
|
||||
sceIoLseek(vfsce->fd, 0, SEEK_SET);
|
||||
sceIoWrite(vfsce->fd, memory, size);
|
||||
sceIoLseek(vfsce->fd, cur, SEEK_SET);
|
||||
sceIoSyncByFd(vfsce->fd);
|
||||
sceIoSyncByFd(vfsce->fd, 0);
|
||||
mappedMemoryFree(memory, size);
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ bool _vfsceSync(struct VFile* vf, void* buffer, size_t size) {
|
||||
sceIoLseek(vfsce->fd, cur, SEEK_SET);
|
||||
return res == size;
|
||||
}
|
||||
return sceIoSyncByFd(vfsce->fd) >= 0;
|
||||
return sceIoSyncByFd(vfsce->fd, 0) >= 0;
|
||||
}
|
||||
|
||||
struct VDir* VDirOpen(const char* path) {
|
||||
|
@ -44,8 +44,7 @@ ApplicationUpdater::ApplicationUpdater(ConfigController* config, QObject* parent
|
||||
config->setQtOption("lastUpdateCheck", m_lastCheck);
|
||||
|
||||
if (available && currentVersion() < updateInfo()) {
|
||||
#ifdef Q_OS_WIN
|
||||
// Only works on Windows at the moment
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
ApplicationUpdatePrompt* prompt = new ApplicationUpdatePrompt;
|
||||
connect(prompt, &QDialog::accepted, GBAApp::app(), &GBAApp::restartForUpdate);
|
||||
prompt->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
@ -24,7 +24,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets Network Multimedia)
|
||||
|
||||
if(NOT BUILD_GL AND NOT BUILD_GLES2)
|
||||
if(NOT BUILD_GL AND NOT BUILD_GLES2 AND NOT BUILD_GLES3)
|
||||
message(WARNING "OpenGL is recommended to build the Qt port")
|
||||
endif()
|
||||
|
||||
@ -310,6 +310,9 @@ set_target_properties(${BINARY_NAME}-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CM
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(${BINARY_NAME}-qt PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(${BINARY_NAME}-qt -municode)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND QT_LIBRARIES Qt5::Widgets Qt5::Network)
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "Display.h"
|
||||
|
||||
#include "CoreController.h"
|
||||
#include "ConfigController.h"
|
||||
#include "DisplayGL.h"
|
||||
#include "DisplayQt.h"
|
||||
@ -14,23 +15,23 @@
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
Display::Driver Display::s_driver = Display::Driver::OPENGL;
|
||||
#else
|
||||
Display::Driver Display::s_driver = Display::Driver::QT;
|
||||
#endif
|
||||
|
||||
Display* Display::create(QWidget* parent) {
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
QSurfaceFormat format;
|
||||
format.setSwapInterval(1);
|
||||
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
|
||||
#endif
|
||||
|
||||
switch (s_driver) {
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
case Driver::OPENGL:
|
||||
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
|
||||
format.setVersion(2, 0);
|
||||
} else {
|
||||
@ -65,7 +66,7 @@ Display* Display::create(QWidget* parent) {
|
||||
return new DisplayQt(parent);
|
||||
|
||||
default:
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
return new DisplayGL(format, parent);
|
||||
#else
|
||||
return new DisplayQt(parent);
|
||||
@ -101,7 +102,7 @@ void Display::configure(ConfigController* config) {
|
||||
interframeBlending(opts->interframeBlending);
|
||||
filter(opts->resampleVideo);
|
||||
config->updateOption("showOSD");
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (opts->shader) {
|
||||
struct VDir* shader = VDirOpen(opts->shader);
|
||||
if (shader && supportsShaders()) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "DisplayGL.h"
|
||||
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMutexLocker>
|
||||
@ -24,7 +24,7 @@
|
||||
#ifdef BUILD_GL
|
||||
#include "platform/opengl/gl.h"
|
||||
#endif
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
#include "platform/opengl/gles2.h"
|
||||
#ifdef _WIN32
|
||||
#include <epoxy/wgl.h>
|
||||
@ -294,13 +294,13 @@ void PainterGL::create() {
|
||||
#ifdef BUILD_GL
|
||||
mGLContext* glBackend;
|
||||
#endif
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
mGLES2Context* gl2Backend;
|
||||
#endif
|
||||
|
||||
m_window = std::make_unique<QOpenGLPaintDevice>();
|
||||
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
auto version = m_format.version();
|
||||
if (version >= qMakePair(2, 0)) {
|
||||
gl2Backend = static_cast<mGLES2Context*>(malloc(sizeof(mGLES2Context)));
|
||||
@ -326,7 +326,7 @@ void PainterGL::create() {
|
||||
};
|
||||
|
||||
m_backend->init(m_backend, 0);
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_supportsShaders) {
|
||||
m_shader.preprocessShader = static_cast<void*>(&reinterpret_cast<mGLES2Context*>(m_backend)->initialShader);
|
||||
}
|
||||
@ -343,7 +343,7 @@ void PainterGL::destroy() {
|
||||
return;
|
||||
}
|
||||
makeCurrent();
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_shader.passes) {
|
||||
mGLES2ShaderFree(&m_shader);
|
||||
}
|
||||
@ -420,7 +420,7 @@ void PainterGL::filter(bool filter) {
|
||||
void PainterGL::start() {
|
||||
makeCurrent();
|
||||
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_supportsShaders && m_shader.passes) {
|
||||
mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses);
|
||||
}
|
||||
@ -598,7 +598,7 @@ void PainterGL::setShaders(struct VDir* dir) {
|
||||
if (!supportsShaders()) {
|
||||
return;
|
||||
}
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_shader.passes) {
|
||||
mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend));
|
||||
mGLES2ShaderFree(&m_shader);
|
||||
@ -612,7 +612,7 @@ void PainterGL::clearShaders() {
|
||||
if (!supportsShaders()) {
|
||||
return;
|
||||
}
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (m_shader.passes) {
|
||||
mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend));
|
||||
mGLES2ShaderFree(&m_shader);
|
||||
@ -625,7 +625,7 @@ VideoShader* PainterGL::shaders() {
|
||||
}
|
||||
|
||||
int PainterGL::glTex() {
|
||||
#ifdef BUILD_GLES2
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (supportsShaders()) {
|
||||
mGLES2Context* gl2Backend = reinterpret_cast<mGLES2Context*>(m_backend);
|
||||
return gl2Backend->tex;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#pragma once
|
||||
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
|
||||
#include "Display.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ CXX_GUARD_START
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
#include "gl-common.h"
|
||||
#include "platform/opengl/gles2.h"
|
||||
#endif
|
||||
@ -72,7 +72,7 @@ struct mSDLRenderer {
|
||||
#ifdef BUILD_GL
|
||||
struct mGLContext gl;
|
||||
#endif
|
||||
#if defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3) || defined(USE_EPOXY)
|
||||
struct mGLES2Context gl2;
|
||||
#endif
|
||||
|
||||
|
@ -715,7 +715,11 @@ static struct VDir* _makeOutDir(const char* testName) {
|
||||
strncpy(pathEnd, testName, len);
|
||||
pathEnd += len;
|
||||
|
||||
#ifndef _WIN32
|
||||
mkdir(path, 0777);
|
||||
#else
|
||||
mkdir(path);
|
||||
#endif
|
||||
|
||||
if (!pos) {
|
||||
break;
|
||||
|
@ -83,8 +83,8 @@ static Socket _server = INVALID_SOCKET;
|
||||
int main(int argc, char** argv) {
|
||||
#ifdef _3DS
|
||||
UNUSED(_mPerfShutdown);
|
||||
gfxInitDefault();
|
||||
osSetSpeedupEnable(true);
|
||||
gfxInitDefault();
|
||||
osSetSpeedupEnable(true);
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
#elif defined(__SWITCH__)
|
||||
UNUSED(_mPerfShutdown);
|
||||
|
Loading…
Reference in New Issue
Block a user