Actually Fix Screen Rendering When GUI is Hidden
This commit is contained in:
parent
279b101e46
commit
96baf9627a
@ -40,8 +40,6 @@ extern "C" {
|
|||||||
#define GL_FOG_MODE 0xb65
|
#define GL_FOG_MODE 0xb65
|
||||||
#define GL_FOG_COLOR 0xb66
|
#define GL_FOG_COLOR 0xb66
|
||||||
#define GL_BLEND 0xbe2
|
#define GL_BLEND 0xbe2
|
||||||
#define GL_ONE 1
|
|
||||||
#define GL_ZERO 0
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -116,42 +116,29 @@ static void Inventory_selectSlot_injection(unsigned char *inventory, int32_t slo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Translucent Toolbar
|
// Translucent Toolbar
|
||||||
static GLenum blend_sfactor = GL_ONE;
|
|
||||||
static GLenum blend_dfactor = GL_ZERO;
|
|
||||||
HOOK(glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) {
|
|
||||||
blend_sfactor = sfactor;
|
|
||||||
blend_dfactor = dfactor;
|
|
||||||
ensure_glBlendFunc();
|
|
||||||
(*real_glBlendFunc)(sfactor, dfactor);
|
|
||||||
}
|
|
||||||
static GLfloat reset_red;
|
|
||||||
static GLfloat reset_green;
|
|
||||||
static GLfloat reset_blue;
|
|
||||||
static GLfloat reset_alpha;
|
|
||||||
static void Gui_renderToolBar_injection(unsigned char *gui, float param_1, int32_t param_2, int32_t param_3) {
|
static void Gui_renderToolBar_injection(unsigned char *gui, float param_1, int32_t param_2, int32_t param_3) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
int was_blend_enabled = glIsEnabled(GL_BLEND);
|
int was_blend_enabled = glIsEnabled(GL_BLEND);
|
||||||
if (!was_blend_enabled) {
|
if (!was_blend_enabled) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
}
|
}
|
||||||
GLenum old_sfactor = blend_sfactor;
|
|
||||||
GLenum old_dfactor = blend_dfactor;
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
(*Gui_renderToolBar)(gui, param_1, param_2, param_3);
|
(*Gui_renderToolBar)(gui, param_1, param_2, param_3);
|
||||||
glColor4f(reset_red, reset_green, reset_blue, reset_alpha);
|
|
||||||
glBlendFunc(old_sfactor, old_dfactor);
|
|
||||||
if (!was_blend_enabled) {
|
if (!was_blend_enabled) {
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
|
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, __attribute__((unused)) GLfloat alpha) {
|
||||||
// Fix Alpha
|
// Fix Alpha
|
||||||
glColor4f(red, green, blue, 1.0f);
|
glColor4f(red, green, blue, 1.0f);
|
||||||
// Stroe For Reset
|
}
|
||||||
reset_red = red;
|
|
||||||
reset_green = green;
|
// Fix Screen Rendering When GUI is Hidden
|
||||||
reset_blue = blue;
|
static void Screen_render_injection(unsigned char *screen, int32_t param_1, int32_t param_2, float param_3) {
|
||||||
reset_alpha = alpha;
|
// Fix
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
// Call Original Method
|
||||||
|
(*Screen_render)(screen, param_1, param_2, param_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize Username
|
// Sanitize Username
|
||||||
@ -343,6 +330,9 @@ void init_misc() {
|
|||||||
overwrite_call((void *) 0x26c5c, (void *) Gui_renderToolBar_glColor4f_injection);
|
overwrite_call((void *) 0x26c5c, (void *) Gui_renderToolBar_glColor4f_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix Screen Rendering When GUI is Hidden
|
||||||
|
overwrite_calls((void *) Screen_render, (void *) Screen_render_injection);
|
||||||
|
|
||||||
// Sanitize Username
|
// Sanitize Username
|
||||||
patch_address(LoginPacket_read_vtable_addr, (void *) LoginPacket_read_injection);
|
patch_address(LoginPacket_read_vtable_addr, (void *) LoginPacket_read_injection);
|
||||||
|
|
||||||
|
@ -545,6 +545,7 @@ typedef void (*Screen_init_t)(unsigned char *screen);
|
|||||||
typedef void (*Screen_tick_t)(unsigned char *screen);
|
typedef void (*Screen_tick_t)(unsigned char *screen);
|
||||||
|
|
||||||
typedef void (*Screen_render_t)(unsigned char *screen, int32_t param_1, int32_t param_2, float param_3);
|
typedef void (*Screen_render_t)(unsigned char *screen, int32_t param_1, int32_t param_2, float param_3);
|
||||||
|
static Screen_render_t Screen_render = (Screen_render_t) 0x28a00;
|
||||||
|
|
||||||
typedef int32_t (*Screen_handleBackEvent_t)(unsigned char *screen, bool param_1);
|
typedef int32_t (*Screen_handleBackEvent_t)(unsigned char *screen, bool param_1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user