summaryrefslogtreecommitdiffhomepage
path: root/src/loader/sel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/sel.c')
-rw-r--r--src/loader/sel.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/loader/sel.c b/src/loader/sel.c
index c4303a4..acdc783 100644
--- a/src/loader/sel.c
+++ b/src/loader/sel.c
@@ -4,17 +4,47 @@
#include <cfg.h>
#include <def.h>
#include <log.h>
+#include <pnc.h>
#include <sel.h>
-static u8 sel_entry(struct cfg_entry *entry)
+struct {
+ struct cfg_entry *cfg;
+} sel_entries[16] = { 0 };
+
+static u8 sel_entry_add(struct cfg_entry *entry)
{
- vga_log("> '%s' (%s)\n", entry->name, entry->path);
+ static u8 index = 0;
+ assert(index + 1 < (u8)sizeof(sel_entries));
+
+ sel_entries[index].cfg = entry;
+
+ index++;
return 0;
}
+// TODO: Keyboard listener
+static void sel_entry_select(u8 entry)
+{
+ cfg_exec(sel_entries[entry].cfg);
+}
+
+static void sel_entries_draw(void)
+{
+ for (u8 i = 0; i < COUNT(sel_entries); i++) {
+ if (!sel_entries[i].cfg)
+ break;
+
+ vga_log("> '%s' (%s)\n", sel_entries[i].cfg->name, sel_entries[i].cfg->path);
+ }
+}
+
void sel_draw(void)
{
vga_clear();
- cfg_foreach(&sel_entry);
+ cfg_foreach(&sel_entry_add);
+ sel_entries_draw();
+
+ // Just for testing
+ sel_entry_select(0);
}