Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <OpenGLES/ES2/gl.h>
- #include <OpenGLES/ES2/glext.h>
- #include "dlfcn.h"
- void (*_glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void *indices);
- GLint (*_glGetUniformLocation)(GLuint program,const GLchar *name);
- GLint $glGetUniformLocation(GLuint program,const GLchar *name)
- {
- NSLog(@"%s",name);
- return _glGetUniformLocation(program,name);
- }
- //disable metal framework for unity
- %hook NSBundle
- + (id)bundleWithPath:(NSString *)fullPath
- {
- if ([fullPath isEqual:@"/System/Library/Frameworks/Metal.framework"])
- {
- NSLog(@"distable metal framework");
- return NULL;
- }
- return %orig(fullPath);
- }
- %end
- void $glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) {
- _glDrawElements(mode, count, type, indices);
- if (mode != GL_TRIANGLES || count < 1000) return;{
- GLint currProgram;
- glGetIntegerv(GL_CURRENT_PROGRAM, &currProgram);
- GLint id = _glGetUniformLocation(currProgram, "_BumpMap");
- if (id == -1) return;
- // draw elements on 2d screen coordinates level
- glDepthRangef(1, 0.5);
- #define _DRAW_RGB_3 0,255,0
- // enable and write rgb into frame buffer
- glColorMask (_DRAW_RGB_3, 0);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- // draw chams on elements
- if([switches isSwitchOn:@"Highlight Players"]) {
- _glDrawElements(mode, count, type, indices);
- }
- // now cleaning up
- glDepthRangef(0.5, 1);
- glColorMask(1, 1, 1, 1);
- glDisable(GL_BLEND);
- }
- }
- %ctor {
- MSHookFunction((dlsym(RTLD_DEFAULT, "glDrawElements")), (void *)$glDrawElements, (void **)&_glDrawElements);
- MSHookFunction((dlsym(RTLD_DEFAULT, "glGetUniformLocation")), (void *)$glGetUniformLocation, (void **)&_glGetUniformLocation);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement