Skip to content

Commit

Permalink
fix in-game scale zink crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirosakiMio committed Apr 6, 2024
1 parent fa92cc2 commit c618621
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions FCLauncher/src/main/jni/glfw/include/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// distribution.
//
//========================================================================
#ifndef INTERNAL_H
#define INTERNAL_H

#pragma once

Expand Down Expand Up @@ -767,3 +769,4 @@ char* _glfw_strdup(const char* source);
float _glfw_fminf(float a, float b);
float _glfw_fmaxf(float a, float b);

#endif
12 changes: 5 additions & 7 deletions FCLauncher/src/main/jni/glfw/osmesa_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ static void makeContextCurrentOSMesa(_GLFWwindow* window)
window->context.Clear = (PFNGLCLEAR) window->context.getProcAddress("glClear");
window->context.ClearColor = (PFNGLCLEARCOLOR) window->context.getProcAddress("glClearColor");
window->context.ReadPixels = (PFNGLREADPIXELS) window->context.getProcAddress("glReadPixels");
if (!window->context.Clear || !window->context.ClearColor || !window->context.ReadPixels) {
window->context.Finish = (PFNGLFINISH) window->context.getProcAddress("glFinish");
if (!window->context.Clear || !window->context.ClearColor || !window->context.ReadPixels || !window->context.Finish) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
return;
}
Expand Down Expand Up @@ -121,11 +122,6 @@ static void destroyContextOSMesa(_GLFWwindow* window)

static void swapBuffersOSMesa(_GLFWwindow* window)
{
window->context.Finish = (PFNGLFINISH) window->context.getProcAddress("glFinish");
if (!window->context.Finish) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
return;
}
if (strcmp(getenv("LIBGL_STRING"), "VirGLRenderer") == 0) {
window->context.Finish();
vtest_swap_buffers();
Expand All @@ -135,7 +131,9 @@ static void swapBuffersOSMesa(_GLFWwindow* window)
printf("OSMesa: attempted to swap buffers without context!");
return;
}
OSMesaMakeCurrent(context, buf.bits, GL_UNSIGNED_BYTE, window->context.osmesa.width, window->context.osmesa.height);
OSMesaMakeCurrent(context, buf.bits, GL_UNSIGNED_BYTE, buf.width, buf.height);
if (stride != buf.stride) OSMesaPixelStore(OSMESA_ROW_LENGTH, buf.stride);
stride = buf.stride;
window->context.Finish();
ANativeWindow_unlockAndPost(window->fcl.handle);
ANativeWindow_lock(window->fcl.handle, &buf, NULL);
Expand Down

0 comments on commit c618621

Please sign in to comment.