Adventure: save preview can show the menu instead of the world (driver-dependent)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start by reading WorldSave.requestPreview() and its callers, especially GameStage.openMenu() and the quick save path. Check how GuiBase.getInterface().isGuiThread() and Gdx.app.postRunnable are used elsewhere, then run the relevant preview and save tests if available. Done means menu previews show the world across drivers and quick saves capture the current preview.
Written by the indexing model from the issue text.
Description
Adventure: save preview can show the menu instead of the world (driver-dependent)
Some players' save slots show a picture of the pause/save menu instead of the world map. It depends on the GPU driver; on an AMD RX 7900 XTX the preview is correct.
Cause: WorldSave.requestPreview() only captures at once on the first call of a session (firstCapture). Every later call is deferred with Gdx.app.postRunnable (from "fix preview spam", 647b5eac951).
GameStage.openMenu()callsrequestPreview()and thenForge.switchScene(StartScene)in the same frame.- On LWJGL3,
Lwjgl3Application.loop()runs posted runnables afterLwjgl3Window.update(). That update renders the frame (now the menu) and callsglfwSwapBuffers. - The deferred
ScreenUtil.getThumbnailPreview()then runsglReadPixelson the back buffer after the swap. Its contents are undefined in OpenGL at that point:- drivers that flip buffers hand back an older frame (the world, correct by luck)
- drivers that copy on swap hand back the frame just drawn (the menu)
- Android runs posted runnables at the start of the next
onDrawFrame, which is also after a swap.
Side effects of the same deferral:
- Quick save (F5) posts the capture and then saves at once, so the quick save always stores the previous preview.
- The blurred menu backdrop (
Forge.lastPreview) comes from the same capture.
Suggested fix (about 5 lines): in requestPreview(), capture at once when the call is already on the GL thread (GuiBase.getInterface().isGuiThread()), which covers every current caller. Keep the 800 ms cooldown for the spam case, and keep postRunnable only as the fallback for calls from other threads. At input time the menu hasn't been drawn yet, so the back buffer holds a world frame on every driver. That is also why the first capture of a session already works.
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 19h 28m
- Merged PRs (30d)
- 316
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Card-Forge/forge
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Card-Forge/forge#13173 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Card-Forge/forge#13092 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Card-Forge/forge#12877 ·
Maintainers usually reply within 1 day
-
Shandalar "The Drunken Plea" quest completes prematurelyMay be free again @Simisays claimed this 37 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Card-Forge/forge#12306 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Card-Forge/forge#12206 ·
Maintainers usually reply within 1 day
All issues in Card-Forge/forge
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
HexaHexes/neoforge-mod-template#124 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
OpenLiberty/open-liberty#36410 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
erkamyaman/rust-anything#1153 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day