Add more stubs

This commit is contained in:
Swung0x48 2024-10-10 17:54:35 +08:00
parent 921bfcb58e
commit d0baf94440
17 changed files with 1409 additions and 1156 deletions

View File

@ -29,9 +29,10 @@ add_library(${CMAKE_PROJECT_NAME} SHARED
native-lib.cpp
init.cpp
main.c
gl.c
egl.cpp
gles3.h
gl/gl.c
egl/egl.c
egl/loader.c
gles/loader.c
)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ./includes)

View File

@ -1,30 +0,0 @@
//
// Created by Swung 0x48 on 2024/10/8.
//
#ifndef FOLD_CRAFT_LAUNCHER_EGL_H
#define FOLD_CRAFT_LAUNCHER_EGL_H
#include <EGL/egl.h>
typedef __eglMustCastToProperFunctionPointerType (EGLGETPROCADDRESSPROC) (const char *procname);
typedef EGLGETPROCADDRESSPROC* EGLGETPROCADDRESSPROCP;
typedef EGLContext (EGLCREATECONTEXTPROC) (EGLDisplay, EGLConfig, EGLContext, const EGLint *);
typedef EGLCREATECONTEXTPROC* EGLCREATECONTEXTPROCP;
typedef EGLBoolean (EGLDESTROYCONTEXTPROC) (EGLDisplay, EGLContext);
typedef EGLDESTROYCONTEXTPROC* EGLDESTROYCONTEXTPROCP;
typedef EGLBoolean (EGLMAKECURRENTPROC)(EGLDisplay, EGLSurface, EGLSurface, EGLContext);
typedef EGLMAKECURRENTPROC* EGLMAKECURRENTPROCP;
struct egl_func_t {
EGLGETPROCADDRESSPROCP eglGetProcAddress;
EGLCREATECONTEXTPROCP eglCreateContext;
EGLDESTROYCONTEXTPROCP eglDestroyContext;
EGLMAKECURRENTPROCP eglMakeCurrent;
};
struct context_t {
EGLContext context;
};
#endif //FOLD_CRAFT_LAUNCHER_EGL_H

View File

@ -1,48 +1,29 @@
//
// Created by Swung 0x48 on 2024/10/8.
// Created by Swung0x48 on 2024/10/10.
//
#ifdef __cplusplus
extern "C" {
#endif
#include "egl.h"
#include "includes.h"
#include <EGL/egl.h>
#ifdef __cplusplus
}
#endif
#include <unordered_map>
static std::unordered_map<EGLContext, context_t> g_context;
#include "../includes.h"
EGLContext mglues_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"%s @ %s(...)", RENDERERNAME, __FUNCTION__);
g_egl_func.eglCreateContext =
(EGLCREATECONTEXTPROCP)g_egl_func.eglGetProcAddress("eglCreateContext");
EGLContext ctx = g_egl_func.eglCreateContext(dpy, config, share_context, attrib_list);
g_context[ctx] = { .context = ctx };
EGLContext ctx = g_egl_func.eglCreateContext(dpy, config, share_context, attrib_list);
return ctx;
}
EGLBoolean mglues_eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
if (g_context.find(ctx) == g_context.end())
return EGL_FALSE;
EGLBoolean b = g_egl_func.eglDestroyContext(dpy, ctx);
if (b)
g_context.erase(ctx);
return b;
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"%s @ %s(...)", RENDERERNAME, __FUNCTION__);
return g_egl_func.eglDestroyContext(dpy, ctx);
// return EGL_TRUE;
}
EGLBoolean mglues_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"%s @ %s(...)", RENDERERNAME, __FUNCTION__);
return g_egl_func.eglMakeCurrent(dpy, draw, read, ctx);
// return EGL_TRUE;
}

57
src/main/cpp/egl/egl.h Normal file
View File

@ -0,0 +1,57 @@
//
// Created by Swung 0x48 on 2024/10/8.
//
#ifndef FOLD_CRAFT_LAUNCHER_EGL_H
#define FOLD_CRAFT_LAUNCHER_EGL_H
#include <EGL/egl.h>
typedef __eglMustCastToProperFunctionPointerType (*EGLGETPROCADDRESSPROCP) (const char *procname);
typedef EGLint (*EGLGETERRORPROCP)(void);
typedef EGLDisplay (*EGLGETDISPLAYP)(EGLNativeDisplayType display_id);
typedef EGLBoolean (*EGLINITIALIZEPROCP)(EGLDisplay dpy, EGLint *major, EGLint *minor);
typedef EGLBoolean (*EGLTERMINATEPROCP)(EGLDisplay dpy);
typedef const char * (*EGLQUERYSTRINGPROCP)(EGLDisplay dpy, EGLint name);
typedef EGLBoolean (*EGLGETCONFIGSPROCP)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean (*EGLCHOOSECONFIGPROCP)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLBoolean (*EGLGETCONFIGATTRIBPROCP)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
typedef
typedef EGLSurface (*EGLCREATEWINDOWSURFACEPROCP)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
typedef EGLSurface (*EGLCREATEPBUFFERSURFACEPROCP)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
typedef EGLSurface (*EGLCREATEPIXMAPSURFACEPROCP)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
typedef EGLBoolean (*EGLDESTROYSURFACEPROCP)(EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (*EGLQUERYSURFACEPROCP)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
typedef EGLBoolean (*EGLBINDAPIPROCP)(EGLenum api);
typedef EGLenum (*EGLQUERYAPIPROCP)(void);
typedef
typedef EGLBoolean (*EGLWAITCLIENTPROCP)(void);
typedef EGLBoolean (*EGLRELEASETHREADPROCP)(void);
typedef EGLSurface (*EGLCREATEPBUFFERFROMCLIENTBUFFERPROCP)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
typedef EGLBoolean (*EGLSURFACEATTRIBPROCP)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
typedef EGLBoolean (*EGLBINDTEXIMAGEPROCP)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean (*EGLRELEASETEXIMAGEPROCP)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLBoolean (*EGLSWAPINTERVALPROCP)(EGLDisplay dpy, EGLint interval);
typedef EGLContext (*EGLCREATECONTEXTPROCP)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
typedef EGLBoolean (*EGLDESTROYCONTEXTPROCP)(EGLDisplay dpy, EGLContext ctx);
typedef EGLBoolean (*EGLMAKECURRENTPROCP)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
typedef EGLContext (*EGLGETCURRENTCONTEXTPROCP)(void);
typedef EGLSurface (*EGLGETCURRENTSURFACEPROCP)(EGLint readdraw);
typedef EGLDisplay (*EGLGETCURRENTDISPLAYPROCP)(void);
typedef EGLDisplay (*EGLGETPLATFORMDISPLAYPROCP)(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
typedef EGLBoolean (*EGLQUERYCONTEXTPROCP)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
typedef EGLBoolean (*EGLWAITGLPROCP)(void);
typedef EGLBoolean (*EGLWAITNATIVEPROCP)(EGLint engine);
typedef EGLBoolean (*EGLSWAPBUFFERSPROCP)(EGLDisplay dpy, EGLSurface surface);
typedef EGLBoolean (*EGLCOPYBUFFERSPROCP)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
// Undocumented libmali internals, needed for ODROID Go Ultra
//NativePixmapType (*EGL_CREATE_PIXMAP_ID_MAPPINGPROCP)(void *pixmap);
//NativePixmapType (*EGL_DESTROY_PIXMAP_ID_MAPPINGPROCP)(int id);
// Undocumented libmali internals, needed for ODROID Go Ultra
//NativePixmapType (*EGL_CREATE_PIXMAP_ID_MAPPINGPROCP)(void *pixmap);
//NativePixmapType (*EGL_DESTROY_PIXMAP_ID_MAPPINGPROCP)(int id);
#endif //FOLD_CRAFT_LAUNCHER_EGL_H

24
src/main/cpp/egl/loader.c Normal file
View File

@ -0,0 +1,24 @@
//
// Created by Swung0x48 on 2024/10/10.
//
#include "loader.h"
#include "../includes.h"
#define EGL_LOAD_FUNC(name) g_egl_func.name = (void*)g_egl_func.eglGetProcAddress(#name);
void init_target_egl() {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Initializing %s @ %s", RENDERERNAME, __FUNCTION__);
// g_egl_func.eglCreateContext = (EGLCREATECONTEXTPROCP)g_egl_func.eglGetProcAddress("eglCreateContext");
EGL_LOAD_FUNC(eglCreateContext);
EGL_LOAD_FUNC(eglDestroyContext);
EGL_LOAD_FUNC(eglMakeCurrent);
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglCreateContext @ 0x%lx", g_egl_func.eglCreateContext);
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglDestroyContext @ 0x%lx", g_egl_func.eglDestroyContext);
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglMakeCurrent @ 0x%lx", g_egl_func.eglMakeCurrent);
}

24
src/main/cpp/egl/loader.h Normal file
View File

@ -0,0 +1,24 @@
//
// Created by Swung 0x48 on 2024/10/10.
//
#ifndef FOLD_CRAFT_LAUNCHER_EGL_LOADER_H
#define FOLD_CRAFT_LAUNCHER_EGL_LOADER_H
#include "egl.h"
struct egl_func_t {
EGLGETPROCADDRESSPROCP eglGetProcAddress;
EGLCREATECONTEXTPROCP eglCreateContext;
EGLDESTROYCONTEXTPROCP eglDestroyContext;
EGLMAKECURRENTPROCP eglMakeCurrent;
};
void init_target_egl();
EGLContext mglues_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
EGLBoolean mglues_eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
EGLBoolean mglues_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
#endif //FOLD_CRAFT_LAUNCHER_EGL_LOADER_H

View File

@ -2,8 +2,9 @@
// Created by Swung0x48 on 2024/10/8.
//
#include "includes.h"
#include <GL/gl.h>
#include "../includes.h"
#include "gl.h"
#include "glcorearb.h"
/*
* Miscellaneous
@ -139,8 +140,10 @@ GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ) {
return "Swung0x48";
case GL_RENDERER:
return "4.6 MobileGlues";
case GL_VERSION:
return "4.6.0";
}
return "";
return "NotSupported_GLenum";
}
GLAPI void GLAPIENTRY glFinish( void ) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
@ -1050,3 +1053,174 @@ GLAPI void GLAPIENTRY glPushName( GLuint name ) { __android_log_print(ANDROID_LO
GLAPI void GLAPIENTRY glPopName( void ) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
// OpenGL 3.1
GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glEnablei (GLenum target, GLuint index) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glDisablei (GLenum target, GLuint index) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glEndTransformFeedback (void) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glEndConditionalRender (void) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGenerateMipmap (GLenum target) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glBindVertexArray (GLuint array) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }
GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array) { __android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Unimplemented function: %s @ %s(...)", RENDERERNAME, __FUNCTION__); }

View File

@ -2047,7 +2047,7 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
#else /* GL_GLEXT_LEGACY */
#include <GL/glext.h>
#include "glext.h"
#endif /* GL_GLEXT_LEGACY */

5
src/main/cpp/gl/loader.c Normal file
View File

@ -0,0 +1,5 @@
//
// Created by Swung0x48 on 2024/10/10.
//
#include "../includes.h"

10
src/main/cpp/gl/loader.h Normal file
View File

@ -0,0 +1,10 @@
//
// Created by Swung 0x48 on 2024/10/10.
//
#ifndef FOLD_CRAFT_LAUNCHER_GL_LOADER_H
#define FOLD_CRAFT_LAUNCHER_GL_LOADER_H
#endif //FOLD_CRAFT_LAUNCHER_GL_LOADER_H

View File

@ -0,0 +1,11 @@
//
// Created by Swung 0x48 on 2024/10/10.
//
#include "loader.h"
#include "../includes.h"
void init_target_gles() {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Initializing %s @ %s", RENDERERNAME, __FUNCTION__);
}

View File

@ -0,0 +1,14 @@
//
// Created by Swung 0x48 on 2024/10/10.
//
#ifndef FOLD_CRAFT_LAUNCHER_GLES_LOADER_H
#define FOLD_CRAFT_LAUNCHER_GLES_LOADER_H
struct gles_func_t {
};
void init_target_gles();
#endif //FOLD_CRAFT_LAUNCHER_GLES_LOADER_H

View File

@ -6,7 +6,7 @@
#define FOLD_CRAFT_LAUNCHER_GLES3_H
#include <GLES3/gl32.h>
#include <GL/gl.h>
#include "GL/gl.h"
struct es3_functions_t
{

View File

@ -12,7 +12,8 @@
#include <EGL/egl.h>
#include <GLES3/gl32.h>
#include "egl.h"
#include "egl/egl.h"
#include "egl/loader.h"
#define _mglues_dlopen(name) dlopen(name, RTLD_LAZY)
#define _mglues_dlclose(handle) dlclose(handle)
@ -27,7 +28,7 @@ EGLContext mglues_eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext
EGLBoolean mglues_eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
EGLBoolean mglues_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
static struct egl_func_t g_egl_func;
extern struct egl_func_t g_egl_func;
#endif //MOBILEGLUES_INCLUDES_H

View File

@ -4,14 +4,17 @@
#include <string.h>
#include "includes.h"
#include <GL/gl.h>
#include "gl/gl.h"
#include "egl/egl.h"
#include "egl/loader.h"
#include "gles/loader.h"
#ifdef __cplusplus
extern "C" {
#endif
void init_target_egl();
void init_target_gles();
struct egl_func_t g_egl_func;
__eglMustCastToProperFunctionPointerType prehook(const char *procname);
__eglMustCastToProperFunctionPointerType posthook(const char *procname);
@ -25,6 +28,8 @@ void proc_init() {
"Cannot load system libEGL.so!");
g_egl_func.eglGetProcAddress = _mglues_dlsym(handle, "eglGetProcAddress");
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglGetProcAddress @ 0x%lx", g_egl_func.eglGetProcAddress);
init_target_egl();
init_target_gles();
@ -32,30 +37,6 @@ void proc_init() {
g_initialized = 1;
}
void init_target_egl() {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Initializing %s @ %s", RENDERERNAME, __FUNCTION__);
g_egl_func.eglCreateContext =
(EGLCREATECONTEXTPROCP)g_egl_func.eglGetProcAddress("eglCreateContext");
g_egl_func.eglDestroyContext =
(EGLDESTROYCONTEXTPROCP) g_egl_func.eglGetProcAddress("eglDestroyContext");
g_egl_func.eglMakeCurrent =
(EGLMAKECURRENTPROCP) g_egl_func.eglGetProcAddress("eglMakeCurrent");
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglCreateContext @ 0x%lx", g_egl_func.eglCreateContext);
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglDestroyContext @ 0x%lx", g_egl_func.eglDestroyContext);
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Got target eglMakeCurrent @ 0x%lx", g_egl_func.eglMakeCurrent);
}
void init_target_gles() {
__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME,
"Initializing %s @ %s", RENDERERNAME, __FUNCTION__);
}
#define MAP_FUNC(name) if (strcmp(procname, #name) == 0) \
return (__eglMustCastToProperFunctionPointerType) name;
@ -64,18 +45,18 @@ void init_target_gles() {
__eglMustCastToProperFunctionPointerType prehook(const char *procname) {
if (!g_initialized)
proc_init();
// if (!g_initialized)
// proc_init();
if (!strncmp(procname, "egl", 3)) {
// MAP_FUNC_MGLUES(eglCreateContext);
// MAP_FUNC_MGLUES(eglDestroyContext);
// MAP_FUNC_MGLUES(eglMakeCurrent);
if (strcmp(procname, "eglCreateContext") == 0)
return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglCreateContext;
if (strcmp(procname, "eglDestroyContext") == 0)
return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglDestroyContext;
if (strcmp(procname, "eglMakeCurrent") == 0)
return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglMakeCurrent;
MAP_FUNC_MGLUES(eglCreateContext);
MAP_FUNC_MGLUES(eglDestroyContext);
MAP_FUNC_MGLUES(eglMakeCurrent);
// if (strcmp(procname, "eglCreateContext") == 0)
// return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglCreateContext;
// if (strcmp(procname, "eglDestroyContext") == 0)
// return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglDestroyContext;
// if (strcmp(procname, "eglMakeCurrent") == 0)
// return (__eglMustCastToProperFunctionPointerType) g_egl_func.eglMakeCurrent;
}
// OpenGL 1.1