{"id":64,"date":"2025-07-14T15:39:33","date_gmt":"2025-07-14T15:39:33","guid":{"rendered":"https:\/\/blogs.scummvm.org\/prime\/?p=64"},"modified":"2025-07-14T15:40:26","modified_gmt":"2025-07-14T15:40:26","slug":"week-6-efh-keymapper-and-pr-cleanups","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/prime\/2025\/07\/14\/week-6-efh-keymapper-and-pr-cleanups\/","title":{"rendered":"Week 6: EFH Keymapper and PR Cleanups"},"content":{"rendered":"<p data-start=\"166\" data-end=\"415\">This week, I focused on implementing keymapper support for the <em data-start=\"229\" data-end=\"247\">Escape from Hell<\/em> (EFH) engine and addressing feedback on my previous PRs. I also had three of my earlier PRs merged: <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6750\"><strong data-start=\"347\" data-end=\"360\">Tetraedge<\/strong><\/a>, <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6770\"><strong data-start=\"362\" data-end=\"373\">Sword25<\/strong><\/a>, and <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6772\"><strong data-start=\"379\" data-end=\"392\">Teenagent<\/strong><\/a>.<\/p>\n<hr \/>\n<h3 data-start=\"417\" data-end=\"431\">EFH Engine<\/h3>\n<p data-start=\"433\" data-end=\"726\">EFH was by far the most involved keymapper implementation I\u2019ve done so far. Unlike other engines, EFH is controlled entirely via the keyboard\u2014there\u2019s no mouse support at all. This meant that without a proper keymapper, the game was essentially unplayable on devices without physical keyboards.<\/p>\n<p data-start=\"728\" data-end=\"991\">I started by listing out all the keys used in various gameplay scenarios and organizing them into <strong data-start=\"826\" data-end=\"849\">11 distinct keymaps<\/strong>. To make switching between these keymaps easier, I wrote a helper function that takes an enum and switches the keymapper context accordingly.<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-51\" src=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-16-54.png\" alt=\"\" width=\"623\" height=\"229\" srcset=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-16-54.png 623w, https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-16-54-300x110.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/p>\n<p data-start=\"993\" data-end=\"1232\">What made this implementation even trickier was that a previous contributor had partially implemented keymapper support\u2014mainly for movement and a few other actions. While their work gave me a helpful starting point, I noticed a few issues:<\/p>\n<ul data-start=\"1233\" data-end=\"1350\">\n<li data-start=\"1233\" data-end=\"1288\">\n<p data-start=\"1235\" data-end=\"1288\">Some important keys were missing or not fully mapped.<\/p>\n<\/li>\n<li data-start=\"1289\" data-end=\"1350\">\n<p data-start=\"1291\" data-end=\"1350\">The partial mapping led to conflicts with unmapped actions.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1352\" data-end=\"1654\">To resolve this, I reviewed their commits to recover any missed inputs and reworked the implementation to cover all keyboard actions comprehensively. Once everything was mapped properly, the conflicts disappeared, and the engine behaved as expected. It took a while, but the process was smooth overall.<\/p>\n<hr data-start=\"1534\" data-end=\"1537\" \/>\n<h3 data-start=\"1539\" data-end=\"1564\">Fixes to Previous PRs<\/h3>\n<p data-start=\"1566\" data-end=\"1661\">Alongside EFH, I also fixed some minor typos in the action descriptions across a few older PRs.<\/p>\n<p data-start=\"1663\" data-end=\"1994\">More importantly, I revisited the workaround I had written for the <strong data-start=\"1730\" data-end=\"1747\">Access engine<\/strong> last week. That engine uses internal numeric codes for verbs rather than relying on keycodes, so I had initially matched keymapper actions to verb codes by relying on the <strong data-start=\"1919\" data-end=\"1928\">order<\/strong> of actions\u2014calculating the verb code by subtracting a base value.<\/p>\n<p data-start=\"1996\" data-end=\"2429\">A mentor correctly pointed out that this was dangerous. If someone ever changed the action order in the future, it would silently break. To fix this, I replaced the order-based logic with a proper <strong data-start=\"2191\" data-end=\"2208\">mapping table<\/strong> that explicitly associates each action with its corresponding verb code. The function now loops through this table and passes the appropriate internal code only when a match is found\u2014much safer and more maintainable.<\/p>\n<p data-start=\"1996\" data-end=\"2429\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-53\" src=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-23-42-300x155.png\" alt=\"\" width=\"300\" height=\"155\" srcset=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-23-42-300x155.png 300w, https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-23-42.png 409w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-54 size-full\" src=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-24-58.png\" alt=\"\" width=\"500\" height=\"185\" srcset=\"https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-24-58.png 500w, https:\/\/blogs.scummvm.org\/prime\/wp-content\/uploads\/sites\/80\/2025\/07\/Screenshot-from-2025-07-14-20-24-58-300x111.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p style=\"text-align: left\" data-start=\"1996\" data-end=\"2429\">Another improvement based on mentor feedback: I removed all engine-specific key bindings for the GMM (Global Main Menu). Since it&#8217;s already mapped in the global keymap, duplicating it in engine keymaps is unnecessary and could lead to confusion.<\/p>\n<p>&nbsp;<\/p>\n<hr data-start=\"2678\" data-end=\"2681\" \/>\n<h3 data-start=\"2683\" data-end=\"2694\">Wrap-Up<\/h3>\n<p data-start=\"2696\" data-end=\"2709\">This week, I:<\/p>\n<ul data-start=\"2711\" data-end=\"3096\">\n<li>Implemented keymapper support for the EFH engine<\/li>\n<li>Updated my previous keymapper PRs<\/li>\n<li>Got my <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6750\"><strong data-start=\"347\" data-end=\"360\">Tetraedge<\/strong><\/a>, <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6770\"><strong data-start=\"362\" data-end=\"373\">Sword25<\/strong><\/a>, and <a href=\"https:\/\/github.com\/scummvm\/scummvm\/pull\/6772\"><strong data-start=\"379\" data-end=\"392\">Teenagent<\/strong><\/a>\u00a0keymapper PRs merged \ud83c\udf89<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This week, I focused on implementing keymapper support for the Escape from Hell (EFH) engine and addressing feedback on my previous PRs. I also had three of my earlier PRs merged: Tetraedge, Sword25, and Teenagent. EFH Engine EFH was by far the most involved keymapper implementation I\u2019ve done so far. Unlike other engines, EFH is [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-week-6"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":2,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"predecessor-version":[{"id":66,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/posts\/64\/revisions\/66"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/prime\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}