comparison 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
comparison
equal deleted inserted replaced
2524:25e40370e0e4 2528:90a40be940f7
314 val.ptrval = tern_insert_node(val.ptrval, "axes", axes); 314 val.ptrval = tern_insert_node(val.ptrval, "axes", axes);
315 } 315 }
316 *pads = tern_insert_node(*pads, key, val.ptrval); 316 *pads = tern_insert_node(*pads, key, val.ptrval);
317 } 317 }
318 318
319 #define CONFIG_VERSION 10 319 #define CONFIG_VERSION 11
320 static tern_node *migrate_config(tern_node *config, int from_version) 320 static tern_node *migrate_config(tern_node *config, int from_version)
321 { 321 {
322 tern_node *def_config = parse_bundled_config("default.cfg"); 322 tern_node *def_config = parse_bundled_config("default.cfg");
323 switch(from_version) 323 switch(from_version)
324 { 324 {
515 } 515 }
516 char *combined = alloc_join(new_size, (char const **)ext_list, ' '); 516 char *combined = alloc_join(new_size, (char const **)ext_list, ' ');
517 config = tern_insert_path(config, "ui\0extensions\0", (tern_val){.ptrval = combined}, TVAL_PTR); 517 config = tern_insert_path(config, "ui\0extensions\0", (tern_val){.ptrval = combined}, TVAL_PTR);
518 break; 518 break;
519 } 519 }
520 case 10: {
521 //Add default bindings for cassette actions
522 char *bind = tern_find_path(config, "bindings\0keys\0f2\0", TVAL_PTR).ptrval;
523 if (!bind) {
524 config = tern_insert_path(config, "bindings\0keys\0f2\0", (tern_val){.ptrval = strdup("cassette.play")}, TVAL_PTR);
525 }
526 bind = tern_find_path(config, "bindings\0keys\0f3\0", TVAL_PTR).ptrval;
527 if (!bind) {
528 config = tern_insert_path(config, "bindings\0keys\0f3\0", (tern_val){.ptrval = strdup("cassette.stop")}, TVAL_PTR);
529 }
530 bind = tern_find_path(config, "bindings\0keys\0f4\0", TVAL_PTR).ptrval;
531 if (!bind) {
532 config = tern_insert_path(config, "bindings\0keys\0f4\0", (tern_val){.ptrval = strdup("cassette.rewind")}, TVAL_PTR);
533 }
534 break;
535 }
520 } 536 }
521 char buffer[16]; 537 char buffer[16];
522 sprintf(buffer, "%d", CONFIG_VERSION); 538 sprintf(buffer, "%d", CONFIG_VERSION);
523 return tern_insert_ptr(config, "version", strdup(buffer)); 539 return tern_insert_ptr(config, "version", strdup(buffer));
524 } 540 }