Mercurial > repos > blastem
diff config.c @ 2528:90a40be940f7
Implement read-only SC-3000 cassette support
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 25 Nov 2024 22:26:45 -0800 |
parents | 8cf7cadc17ee |
children |
line wrap: on
line diff
--- a/config.c Sat Oct 26 14:31:21 2024 -0700 +++ b/config.c Mon Nov 25 22:26:45 2024 -0800 @@ -316,7 +316,7 @@ *pads = tern_insert_node(*pads, key, val.ptrval); } -#define CONFIG_VERSION 10 +#define CONFIG_VERSION 11 static tern_node *migrate_config(tern_node *config, int from_version) { tern_node *def_config = parse_bundled_config("default.cfg"); @@ -517,6 +517,22 @@ config = tern_insert_path(config, "ui\0extensions\0", (tern_val){.ptrval = combined}, TVAL_PTR); break; } + case 10: { + //Add default bindings for cassette actions + char *bind = tern_find_path(config, "bindings\0keys\0f2\0", TVAL_PTR).ptrval; + if (!bind) { + config = tern_insert_path(config, "bindings\0keys\0f2\0", (tern_val){.ptrval = strdup("cassette.play")}, TVAL_PTR); + } + bind = tern_find_path(config, "bindings\0keys\0f3\0", TVAL_PTR).ptrval; + if (!bind) { + config = tern_insert_path(config, "bindings\0keys\0f3\0", (tern_val){.ptrval = strdup("cassette.stop")}, TVAL_PTR); + } + bind = tern_find_path(config, "bindings\0keys\0f4\0", TVAL_PTR).ptrval; + if (!bind) { + config = tern_insert_path(config, "bindings\0keys\0f4\0", (tern_val){.ptrval = strdup("cassette.rewind")}, TVAL_PTR); + } + break; + } } char buffer[16]; sprintf(buffer, "%d", CONFIG_VERSION);