Skip to content

Commit

Permalink
Fix aktivating the texture patch
Browse files Browse the repository at this point in the history
Changed flag to `--texture-patch`
  • Loading branch information
ChristopherHX committed Jul 4, 2021
1 parent cfac268 commit f859c37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions src/fake_egl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,19 @@ void FakeEGL::installLibrary() {
syms["eglSwapInterval"] = (void *) fake_egl::eglSwapInterval;
syms["eglQuerySurface"] = (void *) fake_egl::eglQuerySurface;
syms["eglGetProcAddress"] = (void *) fake_egl::eglGetProcAddress;
linker::load_library("libEGL.so", syms);
}

void FakeEGL::setupGLOverrides() {
#ifdef USE_ARMHF_SUPPORT
ArmhfSupport::install(fake_egl::hostProcOverrides);
#endif
fake_egl::hostProcOverrides["glInvalidateFramebuffer"] = (void *) +[]() {}; // Stub for a NVIDIA bug
if (FakeEGL::enableTexturePatch) {
// Minecraft Intel/Amd Texture Bug 1.16.210-1.17.2 and beyond
// This patch reduces the visual glitch of blocks, does not work with high resolution textures
// TODO improve Bugdetection
syms["glTexSubImage2D"] = (void *) +[](unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void * data) {
fake_egl::hostProcOverrides["glTexSubImage2D"] = (void *) +[](unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void * data) {
if (width == 1024 && height == 1024) {
size_t z = 0;
for (long long y = 0; y < height; ++y) {
Expand Down Expand Up @@ -243,14 +250,5 @@ void FakeEGL::installLibrary() {
((void(*)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void * data))(fake_egl::hostProcAddrFn("glTexSubImage2D"))) (target, level, xoffset, yoffset, width, height, format, type, data);
};
}
linker::load_library("libEGL.so", syms);
}

void FakeEGL::setupGLOverrides() {
#ifdef USE_ARMHF_SUPPORT
ArmhfSupport::install(fake_egl::hostProcOverrides);
#endif
fake_egl::hostProcOverrides["glInvalidateFramebuffer"] = (void *) +[]() {}; // Stub for a NVIDIA bug

GLCorePatch::installGL(fake_egl::hostProcOverrides, fake_egl::eglGetProcAddress);
}
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
argparser::arg<bool> forceEgl (p, "--force-opengles", "-fes", "Force creating an OpenGL ES surface instead of using the glcorepatch hack", !GLCorePatch::mustUseDesktopGL());
argparser::arg<bool> forceGooglePlayStoreUnverified(p, "--force-google-play-store-unverified", "-fguv", "Force telling the game that the license isn't verified, Google Play Store version", false);
argparser::arg<bool> forceAmazonAppStoreUnverified(p, "--force-amazon-app-store-unverified", "-fauv", "Force telling the game that the license isn't verified, Amazon App Store version", false);
argparser::arg<bool> texturePatch(p, "--texturepatch", "-tp", "Rewrite textures of the game for Minecraft 1.16.210-1.17.2",
argparser::arg<bool> texturePatch(p, "--texture-patch", "-tp", "Rewrite textures of the game for Minecraft 1.16.210-1.17.2",
#if defined(__i386__) || defined(__x86_64__)
true
#else
Expand Down

0 comments on commit f859c37

Please sign in to comment.