summaryrefslogtreecommitdiff
path: root/apps/main.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-04-02 21:34:29 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2022-02-23 08:47:12 -0500
commitf7bb9e21672566308ab837c370f27c10c154e6fc (patch)
tree688aa4e1a44572452ee192838b0af510b57ce770 /apps/main.c
parent7952687185aa27fcecc0924efa45c0e64e0ed4fe (diff)
downloadrockbox-f7bb9e21672566308ab837c370f27c10c154e6fc.tar.gz
rockbox-f7bb9e21672566308ab837c370f27c10c154e6fc.zip
Add custom action mapping to core
results of an idea I discussed in IRC changed the way the lookup in the remap file works.. entries consist of 3 int [action, button, prebtn] context look up table is at the beginning action_code contains the (context | CONTEXT_REMAPPED) button_code contains the index of the first remapped action for the matched context [0] CORE_CONTEXT_REMAP(ctx1) offset1=(3), count=(1) [1] CORE_CONTEXT_REMAP(ctx2, offset2=(5), count=(1) [2] sentinel, 0, 0 [3] act0, btn, 0 [4] sentinel 0, 0 [5] act1, btn, 0 [6] sentinel, 0, 0 Note: last entry of each group is always the sentinel [CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE] contexts must match exactly -- re-mapped contexts run before the built in w/ fall through contexts ie. you can't remap std_context and expect it to match std_context actions from the WPS context. -- Done -- Code for reading core remap entries -- Done -- import of core remap entires from disk -- Done -- plugin to set new key mapping (the hard part) The plugin is started and FULLY functional you can add actions and contexts you can change context, action, button, prebtn delete keymap files load keymapfiles save user keymaps test keymaps before applying them loading keymaps to core still requires restart ----------------------------------------------------------------------------------------------- Change-Id: Ib8b88c5ae91af4d540e1829de5db32669cd68203
Diffstat (limited to 'apps/main.c')
-rw-r--r--apps/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/main.c b/apps/main.c
index a88cd73ef7..2f3b246210 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -31,6 +31,7 @@
31#include "led.h" 31#include "led.h"
32#include "../kernel-internal.h" 32#include "../kernel-internal.h"
33#include "button.h" 33#include "button.h"
34#include "core_keymap.h"
34#include "tree.h" 35#include "tree.h"
35#include "filetypes.h" 36#include "filetypes.h"
36#include "panic.h" 37#include "panic.h"
@@ -175,6 +176,15 @@ int main(void)
175 usb_start_monitoring(); 176 usb_start_monitoring();
176#endif 177#endif
177 178
179#if !defined(DISABLE_ACTION_REMAP) && defined(CORE_KEYREMAP_FILE)
180 if (file_exists(CORE_KEYREMAP_FILE))
181 {
182 int mapct = core_load_key_remap(CORE_KEYREMAP_FILE);
183 if (mapct <= 0)
184 splashf(HZ, "key remap failed: %d, %s", mapct, CORE_KEYREMAP_FILE);
185 }
186#endif
187
178#ifdef AUTOROCK 188#ifdef AUTOROCK
179 { 189 {
180 char filename[MAX_PATH]; 190 char filename[MAX_PATH];