diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28a2deb..8bc0f93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,34 +51,6 @@ jobs: - name: Display Downloaded Artifacts run: find ./artifacts/ - # # Step 3: Calculate the next tag version - # - name: Calculate Next Tag - # id: calculate_tag # Give the step an ID to potentially reference outputs elsewhere if needed - # run: | - # echo "Fetching tags..." - # git fetch --tags # Ensure all tags are fetched - - # LATEST_TAG=$(git tag --sort=-creatordate | head -n 1) - - # if [[ -z "$LATEST_TAG" ]]; then - # # No tags found, start with v1 - # NEXT_TAG="v1" - # echo "No previous tags found. Starting with $NEXT_TAG" - # else - # echo "Latest tag found: $LATEST_TAG" - # # Assuming tag format is 'v' followed by a number (e.g., v1, v123) - # # Remove 'v' prefix - # CURRENT_VERSION=$(echo $LATEST_TAG | sed 's/^v//') - # # Increment the version number - # NEXT_VERSION=$((CURRENT_VERSION + 1)) - # # Add 'v' prefix back - # NEXT_TAG="v$NEXT_VERSION" - # echo "Calculated next tag: $NEXT_TAG" - # fi - - # # Set the calculated tag as an environment variable for subsequent steps - # echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_ENV - # Step 3: Extract the latest version from changelog.md - name: Extract Version from Changelog id: get_version diff --git a/docs/changelog b/docs/changelog index e6641b1..8b90f37 100644 --- a/docs/changelog +++ b/docs/changelog @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. +## [2.0.13] +### Added + - Clear window when the game is loading to prevent ghosting in SDL + - Prevent the created windows to resize/maximize. + - Version in github now matches the version in the changelog. +### Fixed + - Fixed a bug in Let's Go Jungle Special Resolution Patch. + - Cleaned unnecessary global variables in resolution.c + - Fixed a bug in that prevented the loader to start when the current folder contained spaces and lindbergh.so was there. + ## [2.0.12] ### Added - AppImage support. diff --git a/src/lindbergh/lindbergh.c b/src/lindbergh/lindbergh.c index 91732e6..2e2dfc1 100644 --- a/src/lindbergh/lindbergh.c +++ b/src/lindbergh/lindbergh.c @@ -240,14 +240,15 @@ char *findPreloadLibrary(const char *originalDir, const char *gameDir) const char *folderCandidates[] = {"/app/lib32", appImageLib, originalDir, "/usr/lib/i386-linux-gnu", "/usr/lib/i686-linux-gnu", "/usr/lib32", "/usr/lib", NULL}; + if (fileExists(PRELOAD_FILE_NAME)) + return PRELOAD_FILE_NAME; + for (int i = 0; i < sizeof(folderCandidates) / sizeof(folderCandidates[0]); i++) { snprintf(result, MAX_PATH_LENGTH, "%s/%s", folderCandidates[i], PRELOAD_FILE_NAME); if (fileExists(result)) return result; } - if (fileExists(PRELOAD_FILE_NAME)) - return PRELOAD_FILE_NAME; return NULL; } diff --git a/src/lindbergh/resolution.c b/src/lindbergh/resolution.c index 0f741cb..727f67f 100644 --- a/src/lindbergh/resolution.c +++ b/src/lindbergh/resolution.c @@ -48,11 +48,6 @@ float newReducedWidthABC, newReducedHeightABC; float newHalfWidthABC, newHalfHeightABC; float newWidthRangeABC, newHeightRangeABC; double new410ABC, new330ABC, new280ABC, new200ABC; -uint32_t *newWidthRangePtr_CEI_ABC, *newHeightRangePtr_CEI_ABC; -uint32_t *newWidthPtrABC, *newHeightPtrABC; -uint32_t *newReducedWidthPtrABC, *newReducedHeightPtrABC; -uint32_t *newHalfWidthPtrABC, *newHalfHeightPtrABC; -uint32_t *new410PtrABC, *new330PtrABC, *new280PtrABC, *new200PtrABC; float angleABC; float newVT3, newVT3HW, newVT3HH; @@ -68,6 +63,9 @@ int idTextShift = 0; float id4NewCaptionY; float idShiftX = 0.0; float isShiftY = 0.0; + +float newHeightLGJ, newWidth2LGJ, newWidthHLGJ, newWidthSLGJ; + bool myEnableScaling = false; int hummerRespatch() @@ -1062,15 +1060,15 @@ void patchABCMarkers(uint32_t addrCtrlEnemyInfo, uint32_t addrCtrlPlayerRivalFon new280ABC = (gWidth / 2.0) - 40.0; // 280 new200ABC = (gHeight / 2.0) - 40.0; // 200 - newWidthPtrABC = (uint32_t *)&newWidthABC; - newHeightPtrABC = (uint32_t *)&newHeightABC; + uint32_t *newWidthPtrABC = (uint32_t *)&newWidthABC; + uint32_t *newHeightPtrABC = (uint32_t *)&newHeightABC; setVariable(addrCtrlPlayerRivalFont + 0x15b, (size_t)newWidthPtrABC); // 640 setVariable(addrCtrlPlayerRivalFont + 0x163, (size_t)newHeightPtrABC); // 480 setVariable(addrCtrlEnemyPursuit2d + 0x80, (size_t)newWidthPtrABC); // 640 setVariable(addrCtrlEnemyPursuit2d + 0x88, (size_t)newHeightPtrABC); // 480 - newReducedWidthPtrABC = (uint32_t *)&newReducedWidthABC; - newReducedHeightPtrABC = (uint32_t *)&newReducedHeightABC; + uint32_t *newReducedWidthPtrABC = (uint32_t *)&newReducedWidthABC; + uint32_t *newReducedHeightPtrABC = (uint32_t *)&newReducedHeightABC; setVariable(addrCtrlPlayerRivalFont + 0x272, (size_t)newReducedWidthPtrABC); // 600 setVariable(addrCtrlPlayerRivalFont + 0x29f, (size_t)newReducedHeightPtrABC); // 440 setVariable(addrCtrlPlayerRivalFont + 0x8ff, *(uint32_t *)&newReducedHeightABC); // 440 @@ -1081,8 +1079,8 @@ void patchABCMarkers(uint32_t addrCtrlEnemyInfo, uint32_t addrCtrlPlayerRivalFon setVariable(addrCtrlEnemyPursuit2d + 0x7b3, *(uint32_t *)&newReducedHeightABC); // 440 setVariable(addrCtrlEnemyPursuit2d + 0x812, *(uint32_t *)&newReducedHeightABC); // 440 - newHalfWidthPtrABC = (uint32_t *)&newHalfWidthABC; - newHalfHeightPtrABC = (uint32_t *)&newHalfHeightABC; + uint32_t *newHalfWidthPtrABC = (uint32_t *)&newHalfWidthABC; + uint32_t *newHalfHeightPtrABC = (uint32_t *)&newHalfHeightABC; setVariable(addrCtrlPlayerRivalFont + 0x346, (size_t)newHalfWidthPtrABC); // 320 setVariable(addrCtrlPlayerRivalFont + 0x34e, (size_t)newHalfHeightPtrABC); // 240 setVariable(addrCtrlPlayerRivalFont + 0x4cb, (size_t)newHalfWidthPtrABC); // 320 @@ -1108,10 +1106,10 @@ void patchABCMarkers(uint32_t addrCtrlEnemyInfo, uint32_t addrCtrlPlayerRivalFon setVariable(addrCtrlEnemyPursuit2d + 0x4ea, *(uint32_t *)&newWidthRangeABC); // 730 setVariable(addrCtrlEnemyPursuit2d + 0x77b, *(uint32_t *)&newHeightRangeABC); // 570 - new410PtrABC = (uint32_t *)&new410ABC; - new330PtrABC = (uint32_t *)&new330ABC; - new280PtrABC = (uint32_t *)&new280ABC; - new200PtrABC = (uint32_t *)&new200ABC; + uint32_t *new410PtrABC = (uint32_t *)&new410ABC; + uint32_t *new330PtrABC = (uint32_t *)&new330ABC; + uint32_t *new280PtrABC = (uint32_t *)&new280ABC; + uint32_t *new200PtrABC = (uint32_t *)&new200ABC; setVariable(addrCtrlPlayerRivalFont + 0x40e, (size_t)new410PtrABC); // 410 setVariable(addrCtrlPlayerRivalFont + 0x44a, (size_t)new330PtrABC); // 330 setVariable(addrCtrlPlayerRivalFont + 0x5de, (size_t)new280PtrABC); // 280 @@ -2436,23 +2434,18 @@ int initResolutionPatches() setVariable(0x080d6ea0, gWidth); // 800 setVariable(0x080d6eaa, gHeight); // 600 + patchMemory(0x08303c27, "01"); // FSAA - setVariable(0x080cf6ac, gWidth); // 800 - setVariable(0x080cf6b9, gHeight); // 600 - patchMemory(0x08303c27, "01"); // FSAA - - float newWidthLGJ = (float)gWidth; - float newHeightLGJ = (float)gHeight; - uint32_t *newWidthPtrLGJ = (uint32_t *)&newWidthLGJ; + newHeightLGJ = (float)gHeight; uint32_t *newHeightPtrLGJ = (uint32_t *)&newHeightLGJ; - float newWidth2LGJ = (float)gWidth * 2.0; + newWidth2LGJ = (float)gWidth * 2.0; uint32_t *newWidth2PtrLGJ = (uint32_t *)&newWidth2LGJ; unsigned int address = 0x080cb730; - float newWidthHLGJ = (float)gWidth / 2.0; + newWidthHLGJ = (float)gWidth / 2.0; uint32_t *newWidthHPtrLGJ = (uint32_t *)&newWidthHLGJ; - float newWidthSLGJ = 1360.0 / (float)gWidth; + newWidthSLGJ = 1360.0 / (float)gWidth; uint32_t *newWidthSPtrLGJ = (uint32_t *)&newWidthSLGJ; unsigned int addressC = 0x080cb3be; diff --git a/src/lindbergh/sdlcalls.c b/src/lindbergh/sdlcalls.c index 946e1c0..d1e9a24 100644 --- a/src/lindbergh/sdlcalls.c +++ b/src/lindbergh/sdlcalls.c @@ -119,7 +119,7 @@ void initSDL(int *argcp, char **argv) SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); } - uint32_t windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; + uint32_t windowFlags = SDL_WINDOW_OPENGL; strcat(SDLgameTitle, getGameName()); @@ -156,6 +156,16 @@ void initSDL(int *argcp, char **argv) fprintf(stderr, "OpenGL context could not be created! SDL_Error: %s\n", SDL_GetError()); exit(1); } + + glClearColor(0.1f, 0.1f, 0.1f, 1.0f); // Your bg color + + // Force initial clear + glClear(GL_COLOR_BUFFER_BIT); + SDL_GL_SwapWindow(SDLwindow); + + // Now show the window + SDL_ShowWindow(SDLwindow); + printf(" SDL RESOLUTION: %dx%d\n\n", getConfig()->width, getConfig()->height); if (getConfig()->fullscreen) diff --git a/src/lindbergh/x11hooks.c b/src/lindbergh/x11hooks.c index 5760548..8767d62 100644 --- a/src/lindbergh/x11hooks.c +++ b/src/lindbergh/x11hooks.c @@ -60,6 +60,20 @@ Display *XOpenDisplay(const char *display_name) return x11Display; } +void setWindowProperties(Display *display, Window window) +{ + XSizeHints *hints = XAllocSizeHints(); + + hints->flags = PMinSize | PMaxSize; + hints->min_width = hints->max_width = getConfig()->width; + hints->min_height = hints->max_height = getConfig()->height; + XSetWMNormalHints(display, window, hints); + XFree(hints); + Atom hintsAtom = XInternAtom(display, "_MOTIF_WM_HINTS", False); + XMapWindow(display, window); + XFlush(display); +} + Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int class, Visual *visual, unsigned long valueMask, XSetWindowAttributes *attributes) { @@ -98,9 +112,21 @@ Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int { window = x11Window; } + + // Eliminate the maximize window button and no more resizing + if (!gettingGPUVendor && !creatingWindow) + setWindowProperties(display, window); + return window; } +// Here we prevent the games to change the window properties +void XSetWMProperties(Display *display, Window w, XTextProperty *window_name, XTextProperty *icon_name, char **argv, int argc, + XSizeHints *normal_hints, XWMHints *wm_hints, XClassHint *class_hints) +{ + return; +} + int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) {