Hotfix
minecraft-pi-reborn/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2022-07-15 22:08:12 -04:00
parent c3c7d22006
commit b190851d36
6 changed files with 52 additions and 3 deletions

View File

@ -10,6 +10,7 @@
* Add ``Add Buckets`` Feature Flag (Enabled By Default) * Add ``Add Buckets`` Feature Flag (Enabled By Default)
* Add ``Classic HUD`` Feature Flag (Enabled By Default) * Add ``Classic HUD`` Feature Flag (Enabled By Default)
* Add ``Translucent Toolbar`` Feature Flag (Enabled By Default) * Add ``Translucent Toolbar`` Feature Flag (Enabled By Default)
* Add ``Force EGL`` Feature Flag (Disabled By Default)
* Fix Sound Pitch/Volume/Attenuation * Fix Sound Pitch/Volume/Attenuation
* Fix Holding Left-Click When Attacking * Fix Holding Left-Click When Attacking
* Don't Force EGL (Should Fix Some NVIDIA Systems) * Don't Force EGL (Should Fix Some NVIDIA Systems)

View File

@ -41,3 +41,4 @@ FALSE Remove Forced GUI Lag (Can Break Joining Servers)
TRUE Add Buckets TRUE Add Buckets
TRUE Classic HUD TRUE Classic HUD
TRUE Translucent Toolbar TRUE Translucent Toolbar
FALSE Force EGL

View File

@ -251,6 +251,15 @@ void media_disable_vsync() {
#endif #endif
} }
// Force EGL
static int force_egl = 0;
void media_force_egl() {
if (force_egl == -1) {
IMPOSSIBLE();
}
force_egl = 1;
}
// Init Media Layer // Init Media Layer
#define GL_VERSION 0x1f02 #define GL_VERSION 0x1f02
typedef const unsigned char *(*glGetString_t)(unsigned int name); typedef const unsigned char *(*glGetString_t)(unsigned int name);
@ -273,6 +282,11 @@ void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *ic
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
#endif #endif
// Use EGL
if (force_egl) {
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
}
force_egl = -1;
// Extra Settings // Extra Settings
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE); glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
glfwWindowHint(GLFW_ALPHA_BITS, 0); // Fix Transparent Window On Wayland glfwWindowHint(GLFW_ALPHA_BITS, 0); // Fix Transparent Window On Wayland

View File

@ -16,6 +16,7 @@ void media_cleanup();
void media_get_framebuffer_size(int *width, int *height); void media_get_framebuffer_size(int *width, int *height);
void media_set_interactable(int is_interactable); void media_set_interactable(int is_interactable);
void media_disable_vsync(); void media_disable_vsync();
void media_force_egl();
void media_set_raw_mouse_motion_enabled(int enabled); void media_set_raw_mouse_motion_enabled(int enabled);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -339,3 +339,15 @@ CALL(64, media_set_raw_mouse_motion_enabled, void, (int enabled)) {
media_set_raw_mouse_motion_enabled(enabled); media_set_raw_mouse_motion_enabled(enabled);
#endif #endif
} }
CALL(66, media_force_egl, void, ()) {
#if defined(MEDIA_LAYER_PROXY_SERVER)
// Lock Proxy
start_proxy_call();
// Release Proxy
end_proxy_call();
#else
// Run
media_force_egl();
#endif
}

View File

@ -116,16 +116,31 @@ static void Inventory_selectSlot_injection(unsigned char *inventory, int32_t slo
} }
// Translucent Toolbar // Translucent Toolbar
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
glEnable(GL_BLEND); int was_blend_enabled = glIsEnabled(GL_BLEND);
if (!was_blend_enabled) {
glEnable(GL_BLEND);
}
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);
glDisable(GL_BLEND); glColor4f(reset_red, reset_green, reset_blue, reset_alpha);
if (!was_blend_enabled) {
glDisable(GL_BLEND);
}
} }
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, __attribute__((unused)) GLfloat alpha) { static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, 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;
reset_blue = blue;
reset_alpha = alpha;
} }
// Sanitize Username // Sanitize Username
@ -353,6 +368,11 @@ void init_misc() {
media_disable_vsync(); media_disable_vsync();
} }
// Force EGL
if (feature_has("Force EGL", server_disabled)) {
media_force_egl();
}
// Remove Forced GUI Lag // Remove Forced GUI Lag
if (feature_has("Remove Forced GUI Lag (Can Break Joining Servers)", server_enabled)) { if (feature_has("Remove Forced GUI Lag (Can Break Joining Servers)", server_enabled)) {
overwrite_calls((void *) sleepMs, (void *) nop); overwrite_calls((void *) sleepMs, (void *) nop);