]> git.sesse.net Git - pistorm/blobdiff - config_file/config_file.h
handle keyboard/mouse autoconnect
[pistorm] / config_file / config_file.h
index 4a3e5f407b7686a6761b925e1f5f2b1a35daf6c8..54931aece0cb27357bb73105a28defc72ecf2762 100644 (file)
@@ -1,4 +1,9 @@
-#include "../m68k.h"
+#ifndef _CONFIG_FILE_H
+#define _CONFIG_FILE_H
+
+#include "m68k.h"
+
+#include <unistd.h>
 
 #define MAX_NUM_MAPPED_ITEMS 8
 #define SIZE_KILO 1024
@@ -34,6 +39,7 @@ typedef enum {
   CONFITEM_KEYBOARD,
   CONFITEM_PLATFORM,
   CONFITEM_SETVAR,
+  CONFITEM_KBFILE,
   CONFITEM_NUM,
 } config_items;
 
@@ -49,20 +55,20 @@ struct emulator_config {
   unsigned int cpu_type;
 
   unsigned char map_type[MAX_NUM_MAPPED_ITEMS];
-  long map_offset[MAX_NUM_MAPPED_ITEMS];
-  long map_high[MAX_NUM_MAPPED_ITEMS];
+  unsigned long map_offset[MAX_NUM_MAPPED_ITEMS];
+  unsigned long map_high[MAX_NUM_MAPPED_ITEMS];
   unsigned int map_size[MAX_NUM_MAPPED_ITEMS];
   unsigned int rom_size[MAX_NUM_MAPPED_ITEMS];
   unsigned char *map_data[MAX_NUM_MAPPED_ITEMS];
-  int map_mirror[MAX_NUM_MAPPED_ITEMS];
+  unsigned int map_mirror[MAX_NUM_MAPPED_ITEMS];
   char *map_id[MAX_NUM_MAPPED_ITEMS];
 
   struct platform_config *platform;
 
-  char *mouse_file;
+  char *mouse_file, *keyboard_file;
 
   char mouse_toggle_key, keyboard_toggle_key;
-  unsigned char mouse_enabled, keyboard_enabled;
+  unsigned char mouse_enabled, mouse_autoconnect, keyboard_enabled, keyboard_grab, keyboard_autoconnect;
 
   unsigned int loop_cycles;
   unsigned int mapped_low, mapped_high;
@@ -82,7 +88,7 @@ struct platform_config {
   int (*platform_initial_setup)(struct emulator_config *cfg);
   void (*handle_reset)(struct emulator_config *cfg);
   void (*shutdown)(struct emulator_config *cfg);
-  void (*setvar)(char *var, char *val);
+  void (*setvar)(struct emulator_config *cfg, char *var, char *val);
 };
 
 unsigned int get_m68k_cpu_type(char *name);
@@ -91,4 +97,7 @@ struct emulator_config *load_config_file(char *filename);
 int handle_mapped_read(struct emulator_config *cfg, unsigned int addr, unsigned int *val, unsigned char type);
 int handle_mapped_write(struct emulator_config *cfg, unsigned int addr, unsigned int value, unsigned char type);
 int get_named_mapped_item(struct emulator_config *cfg, char *name);
+int get_mapped_item_by_address(struct emulator_config *cfg, uint32_t address);
 unsigned int get_int(char *str);
+
+#endif /* _CONFIG_FILE_H */