Attempt to fix soft lock in stick conf. screen

This commit is contained in:
Nguyễn Quốc Hưng
2024-08-09 10:45:48 +07:00
parent 52f0e5323f
commit 0a5bc1476d

View File

@@ -72,14 +72,12 @@ function StickConfigScene:onInputPress(e)
if e.type == "key" then
-- function keys, escape, and tab are reserved and can't be remapped
if e.scancode == "escape" or (self.input_state > #configurable_inputs and e.input == "menu_back") then
SCENE = InputConfigScene()
SCENE = InputConfigScene(SETTINGS.firstTime)
elseif self.input_state > #configurable_inputs then
if e.scancode == "return" or e.input == "" then
-- save new input, then load next scene
local had_config = SETTINGS.input ~= nil
if not SETTINGS.input then SETTINGS.input = {} end
SETTINGS.input.joysticks = self.new_input
SCENE = had_config and InputConfigScene() or TitleScene()
if e.scancode == "return" or e.input == "menu_decide" then
SETTINGS.input.keys = self.new_input
SCENE = SETTINGS.firstTime and TitleScene() or InputConfigScene()
SETTINGS.firstTime = false
elseif e.scancode == "delete" or e.scancode == "backspace" then
-- retry
self.input_state = 1