Version: [42.19]
Mode: Singleplayer
Server settings: N/A
Mods: None
Save: New Save
Reproduction steps:
Start a game using controller
Inspect print media (like a brochure or a flyer)
Observe the missing icons for the buttons (at the bottom of the print media window).
Observe that the focus is _not_ on the print media window
The Infinite Loop Breakdown
The Trigger: The vanilla game's controller logic attempts to manage joypad focus (e.g., when a player opens a map or reads media) via setJoypadFocus(playerID, control). In JoyPadSetup.lua logic, it calls control:toString().
Lua -> Java: The control UI element is actually a Java zombie.ui.AtomUI object wrapped inside a Lua table. When Lua calls control:toString(), Kahlua forwards the call to the underlying Java object's toString() method.
Java -> Lua: To allow for custom UI names, the Java AtomUI.toString() method checks if its corresponding Lua table has a custom toString function attached to it, calling back into the Lua engine to retrieve it.
The Loop: Because the UI element natively lacks a custom toString function in its Lua definition, Kahlua resolves the Java-side request by falling back to the default wrapper method. This invokes the Java AtomUI.toString() again, which calls Lua, which calls Java... over and over infinitely.
The Crash: The JVM quickly runs out of stack memory and throws a java.lang.StackOverflowError. Instead of crashing the whole game, Kahlua silently aborts the execution of the Lua thread. Because this silent abortion happens midway through setJoypadFocus, the focus is never actually updated, leaving the player's controller stuck on whatever they were focused on before (like the inventory).
@ZacCongo, this is the other bug I mentioned.
Oh, I will. There is another nasty bug that I was about to report. There is an infinite recursion in JoyPadSetup.lua that results in a stack overflow and manifest itself in a weird controller focus behaviour. I will create a separate thread for that.
I also noticed that I can't check Player 1's health, and Player 1 can't check mine either. The option itself is displayed, but nothing happens when I click on it.