omf2097 / openomf

One Must Fall 2097 Remake
http://www.openomf.org
MIT License
362 stars 35 forks source link

Crash when setting custom keyboard controls #351

Closed ibara closed 5 years ago

ibara commented 6 years ago

Hi --

When attempting to set custom keyboard controls, the game locks up. You can enter the custom keyboard menu, select a key to change but once you press the new key to map to, the game locks up. Unfortunately, I could not get anything useful from the game itself to help narrow this down.

This is on OpenBSD/amd64 (and to note from #59, OpenBSD requires no patches to play).

Other than that, OpenOMF works great and is on its way to having an official OpenBSD package.

Thanks!

Vagabond commented 6 years ago

It seems to have to do with a disabled component hanging in menu_action.

I'm not sure how to fix it properly, but this patch seems to help:

diff --git a/src/game/gui/menu.c b/src/game/gui/menu.c
index d4aa430..9679ab1 100644
--- a/src/game/gui/menu.c
+++ b/src/game/gui/menu.c
@@ -157,7 +157,7 @@ static int menu_action(component *mc, int action) {
                 // Update selected component
                 c = sizer_get(mc, m->selected);

-            } while(component_is_disabled(c));
+            } while(component_is_disabled(c) && c->supports_disable);
             // Play menu sound
             sound_play(19, 0.5f, 0.0f, 2.0f);
             component_select(c, 1);
ibara commented 6 years ago

That does the trick for me.

katajakasa commented 5 years ago

Now fixed in master @ 73b63423c03690395c03a4551801a40b7edd4849