diff --git a/libretro.c b/libretro.c index 1b37e81..2f8fc34 100644 --- a/libretro.c +++ b/libretro.c @@ -58,8 +58,7 @@ static unsigned g_DISK_INDEX = 0; static unsigned g_DISK_TOTAL = 0; static bool g_DISK_TRAY_OPEN = false; -static struct retro_disk_control_callback g_DISK_CONTROL_CB; -static struct retro_disk_control_ext_callback g_DISK_CONTROL_EXT_CB; +static struct retro_disk_control_ext_callback g_DISK_CONTROL; static bool @@ -571,31 +570,26 @@ init_disk_control_interface(void) { unsigned dci_version = 0; - g_DISK_CONTROL_CB.set_eject_state = disk_set_eject_state; - g_DISK_CONTROL_CB.get_eject_state = disk_get_eject_state; - g_DISK_CONTROL_CB.set_image_index = disk_set_image_index; - g_DISK_CONTROL_CB.get_image_index = disk_get_image_index; - g_DISK_CONTROL_CB.get_num_images = disk_get_num_images; - g_DISK_CONTROL_CB.add_image_index = disk_add_image_index; - g_DISK_CONTROL_CB.replace_image_index = disk_replace_image_index; - - g_DISK_CONTROL_EXT_CB.set_eject_state = disk_set_eject_state; - g_DISK_CONTROL_EXT_CB.get_eject_state = disk_get_eject_state; - g_DISK_CONTROL_EXT_CB.set_image_index = disk_set_image_index; - g_DISK_CONTROL_EXT_CB.get_image_index = disk_get_image_index; - g_DISK_CONTROL_EXT_CB.get_num_images = disk_get_num_images; - g_DISK_CONTROL_EXT_CB.add_image_index = disk_add_image_index; - g_DISK_CONTROL_EXT_CB.replace_image_index = disk_replace_image_index; - g_DISK_CONTROL_EXT_CB.set_initial_image = disk_set_initial_image; - g_DISK_CONTROL_EXT_CB.get_image_path = disk_get_image_path; - g_DISK_CONTROL_EXT_CB.get_image_label = disk_get_image_label; + g_DISK_CONTROL.set_eject_state = disk_set_eject_state; + g_DISK_CONTROL.get_eject_state = disk_get_eject_state; + g_DISK_CONTROL.set_image_index = disk_set_image_index; + g_DISK_CONTROL.get_image_index = disk_get_image_index; + g_DISK_CONTROL.get_num_images = disk_get_num_images; + g_DISK_CONTROL.add_image_index = disk_add_image_index; + g_DISK_CONTROL.replace_image_index = disk_replace_image_index; + g_DISK_CONTROL.set_initial_image = disk_set_initial_image; + g_DISK_CONTROL.get_image_path = disk_get_image_path; + g_DISK_CONTROL.get_image_label = disk_get_image_label; g_DISK_INITIAL_INDEX = 0; g_DISK_INITIAL_PATH[0] = '\0'; - if (retro_environment_cb(RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION, &dci_version) && (dci_version >= 1)) - retro_environment_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE, &g_DISK_CONTROL_EXT_CB); - else - retro_environment_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &g_DISK_CONTROL_CB); + + retro_environment_cb(RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION, + &dci_version); + + retro_environment_cb(dci_version >= 1 ? RETRO_ENVIRONMENT_SET_DISK_CONTROL_EXT_INTERFACE + : RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, + &g_DISK_CONTROL); } bool