1.1 --- a/src/hotkeys.c Sat Jun 13 00:50:48 2009 +0000
1.2 +++ b/src/hotkeys.c Thu Jun 25 21:21:18 2009 +0000
1.4 static void hotkey_state_save_callback( void *mdev, uint32_t value, uint32_t pressure, gboolean isKeyDown );
1.5 static void hotkey_state_load_callback( void *mdev, uint32_t value, uint32_t pressure, gboolean isKeyDown );
1.7 -static char *set_current_state_filename(int filenum);
1.9 -static char *current_save_state;
1.11 struct lxdream_config_entry hotkeys_config[] = {
1.12 {"resume", N_("Resume emulation"), CONFIG_TYPE_KEY},
1.14 {"exit", N_("Exit emulator"), CONFIG_TYPE_KEY},
1.15 {"save", N_("Save current quick save"), CONFIG_TYPE_KEY},
1.16 {"load", N_("Load current quick save"), CONFIG_TYPE_KEY},
1.17 + {"state0", N_("Select quick save state 0"), CONFIG_TYPE_KEY},
1.18 {"state1", N_("Select quick save state 1"), CONFIG_TYPE_KEY},
1.19 {"state2", N_("Select quick save state 2"), CONFIG_TYPE_KEY},
1.20 {"state3", N_("Select quick save state 3"), CONFIG_TYPE_KEY},
1.22 {NULL, CONFIG_TYPE_NONE}
1.25 -void hotkeys_init() {
1.27 - char *home = getenv("HOME");
1.28 - char *save_path = g_strdup_printf("%s/.lxdream", home);
1.29 - mkdir(save_path, S_IRWXU);
1.30 - g_free(save_path);
1.32 - set_current_state_filename(1);
1.34 +void hotkeys_init()
1.36 hotkeys_register_keys();
1.40 input_register_key(hotkeys_config[3].value, &hotkey_exit_callback, NULL, 0);
1.41 input_register_key(hotkeys_config[4].value, &hotkey_state_save_callback, NULL, 0);
1.42 input_register_key(hotkeys_config[5].value, &hotkey_state_load_callback, NULL, 0);
1.43 - for (int i = 0; i < 9; i++)
1.44 + for (int i = 0; i < 10; i++)
1.46 input_register_key(hotkeys_config[6 + i].value, &hotkey_state_select_callback, NULL, i);
1.49 input_unregister_key(hotkeys_config[3].value, &hotkey_exit_callback, NULL, 0);
1.50 input_unregister_key(hotkeys_config[4].value, &hotkey_state_save_callback, NULL, 0);
1.51 input_unregister_key(hotkeys_config[5].value, &hotkey_state_load_callback, NULL, 0);
1.52 - for (int i = 0; i < 9; i++)
1.53 + for (int i = 0; i < 10; i++)
1.55 input_unregister_key(hotkeys_config[6 + i].value, &hotkey_state_select_callback, NULL, i);
1.57 @@ -136,33 +127,22 @@
1.58 static void hotkey_state_select_callback( void *mdev, uint32_t value, uint32_t pressure, gboolean isKeyDown )
1.61 - INFO("state select callback called (%d)", value);
1.62 - assert(value > 0 && value <= 9);
1.63 - set_current_state_filename(value);
1.64 + dreamcast_set_quick_state(value);
1.68 static void hotkey_state_save_callback( void *mdev, uint32_t value, uint32_t pressure, gboolean isKeyDown )
1.71 - if (current_save_state != NULL)
1.72 - dreamcast_save_state(current_save_state);
1.73 + dreamcast_quick_save();
1.77 static void hotkey_state_load_callback( void *mdev, uint32_t value, uint32_t pressure, gboolean isKeyDown )
1.80 - if (current_save_state != NULL)
1.81 - dreamcast_load_state(current_save_state);
1.82 + dreamcast_quick_load();
1.86 -static char *set_current_state_filename(int filenum)
1.88 - char *home = getenv("HOME");
1.89 - if (current_save_state != NULL)
1.90 - g_free(current_save_state);
1.91 - current_save_state = g_strdup_printf("%s/.lxdream/quicksave%d.dst", home, filenum);