gl: clear w, h on reinit
[libpicofe.git] / input.h
diff --git a/input.h b/input.h
index e87e6ea..ba6c15f 100644 (file)
--- a/input.h
+++ b/input.h
@@ -21,6 +21,7 @@
 #define PBTN_MENU  (1 << 10)
 
 #define PBTN_CHAR  (1 << 11)   /* character (text input) */
+#define PBTN_RDRAW (1 << 12)   /* redraw event */
 
 // TODO: move to pico
 #if 0
@@ -70,18 +71,21 @@ enum {
        IN_BINDTYPE_NONE = -1,
        IN_BINDTYPE_EMU = 0,
        IN_BINDTYPE_PLAYER12,
+       IN_BINDTYPE_PLAYER34,
        IN_BINDTYPE_COUNT
 };
 
 #define IN_BIND_OFFS(key, btype) \
        ((key) * IN_BINDTYPE_COUNT + (btype))
 
-typedef struct {
+typedef struct InputDriver in_drv_t;
+
+struct InputDriver {
        const char *prefix;
-       void (*probe)(void);
+       void (*probe)(const in_drv_t *drv);
        void (*free)(void *drv_data);
        const char * const *
-            (*get_key_names)(int *count);
+            (*get_key_names)(const in_drv_t *drv, int *count);
        int  (*clean_binds)(void *drv_data, int *binds, int *def_finds);
        int  (*get_config)(void *drv_data, int what, int *val);
        int  (*set_config)(void *drv_data, int what, int val);
@@ -94,7 +98,8 @@ typedef struct {
        const char * (*get_key_name)(int keycode);
 
        const struct in_default_bind *defbinds;
-} in_drv_t;
+       const void *pdata;
+};
 
 struct in_default_bind {
        unsigned short code;
@@ -102,8 +107,23 @@ struct in_default_bind {
        unsigned char bit;
 };
 
+struct menu_keymap {
+       short key;
+       short pbtn;
+};
+
+struct in_pdata {
+       const struct in_default_bind *defbinds;
+       const struct menu_keymap *key_map;
+       size_t kmap_size;
+       const struct menu_keymap *joy_map;
+       size_t jmap_size;
+       const char * const *key_names;
+};
+
 /* to be called by drivers */
-int  in_register_driver(const in_drv_t *drv, const struct in_default_bind *defbinds);
+int  in_register_driver(const in_drv_t *drv,
+                       const struct in_default_bind *defbinds, const void *pdata);
 void in_register(const char *nname, int drv_fd_hnd, void *drv_data,
                int key_count, const char * const *key_names, int combos);
 void in_combos_find(const int *binds, int last_key, int *combo_keys, int *combo_acts);