mirror of
https://github.com/libretro/RetroArch
synced 2025-02-14 15:39:59 +00:00
Use flags pt3 (#14491)
* (Vulkan) Use flags for vulkan_emulated_mailbox * Use flags for vk_texture * dispgfx_widget - use flags instead of bools * (Autoconfig) Use flags
This commit is contained in:
parent
c51b1491ef
commit
f40d157571
10
driver.c
10
driver.c
@ -462,7 +462,7 @@ void drivers_init(
|
|||||||
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
|
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
|
||||||
|
|
||||||
/* By default, we want display widgets to persist through driver reinits. */
|
/* By default, we want display widgets to persist through driver reinits. */
|
||||||
dispwidget_get_ptr()->persisting = true;
|
dispwidget_get_ptr()->flags |= DISPGFX_WIDGET_FLAG_PERSISTING;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
@ -708,9 +708,9 @@ void driver_uninit(int flags)
|
|||||||
/* This absolutely has to be done before video_driver_free_internal()
|
/* This absolutely has to be done before video_driver_free_internal()
|
||||||
* is called/completes, otherwise certain menu drivers
|
* is called/completes, otherwise certain menu drivers
|
||||||
* (e.g. Vulkan) will segfault */
|
* (e.g. Vulkan) will segfault */
|
||||||
if (dispwidget_get_ptr()->inited)
|
if (dispwidget_get_ptr()->flags & DISPGFX_WIDGET_FLAG_INITED)
|
||||||
{
|
{
|
||||||
gfx_widgets_deinit(dispwidget_get_ptr()->persisting);
|
gfx_widgets_deinit(dispwidget_get_ptr()->flags & DISPGFX_WIDGET_FLAG_PERSISTING);
|
||||||
dispwidget_get_ptr()->active = false;
|
dispwidget_get_ptr()->active = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -804,10 +804,10 @@ void retroarch_deinit_drivers(struct retro_callbacks *cbs)
|
|||||||
* in case the handle is lost in the threaded
|
* in case the handle is lost in the threaded
|
||||||
* video driver in the meantime
|
* video driver in the meantime
|
||||||
* (breaking video_driver_has_widgets) */
|
* (breaking video_driver_has_widgets) */
|
||||||
if (dispwidget_get_ptr()->inited)
|
if (dispwidget_get_ptr()->flags & DISPGFX_WIDGET_FLAG_INITED)
|
||||||
{
|
{
|
||||||
gfx_widgets_deinit(
|
gfx_widgets_deinit(
|
||||||
dispwidget_get_ptr()->persisting);
|
dispwidget_get_ptr()->flags & DISPGFX_WIDGET_FLAG_PERSISTING);
|
||||||
dispwidget_get_ptr()->active = false;
|
dispwidget_get_ptr()->active = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,7 +104,7 @@ static void vulkan_emulated_mailbox_deinit(
|
|||||||
if (mailbox->thread)
|
if (mailbox->thread)
|
||||||
{
|
{
|
||||||
slock_lock(mailbox->lock);
|
slock_lock(mailbox->lock);
|
||||||
mailbox->dead = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_DEAD;
|
||||||
scond_signal(mailbox->cond);
|
scond_signal(mailbox->cond);
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
sthread_join(mailbox->thread);
|
sthread_join(mailbox->thread);
|
||||||
@ -126,20 +126,20 @@ static VkResult vulkan_emulated_mailbox_acquire_next_image(
|
|||||||
|
|
||||||
slock_lock(mailbox->lock);
|
slock_lock(mailbox->lock);
|
||||||
|
|
||||||
if (!mailbox->has_pending_request)
|
if (!(mailbox->flags & VK_MAILBOX_FLAG_HAS_PENDING_REQUEST))
|
||||||
{
|
{
|
||||||
mailbox->request_acquire = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_REQUEST_ACQUIRE;
|
||||||
scond_signal(mailbox->cond);
|
scond_signal(mailbox->cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
mailbox->has_pending_request = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_HAS_PENDING_REQUEST;
|
||||||
|
|
||||||
if (mailbox->acquired)
|
if (mailbox->flags & VK_MAILBOX_FLAG_ACQUIRED)
|
||||||
{
|
{
|
||||||
res = mailbox->result;
|
res = mailbox->result;
|
||||||
*index = mailbox->index;
|
*index = mailbox->index;
|
||||||
mailbox->has_pending_request = false;
|
mailbox->flags &= ~(VK_MAILBOX_FLAG_HAS_PENDING_REQUEST
|
||||||
mailbox->acquired = false;
|
| VK_MAILBOX_FLAG_ACQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
@ -154,21 +154,21 @@ static VkResult vulkan_emulated_mailbox_acquire_next_image_blocking(
|
|||||||
|
|
||||||
slock_lock(mailbox->lock);
|
slock_lock(mailbox->lock);
|
||||||
|
|
||||||
if (!mailbox->has_pending_request)
|
if (!(mailbox->flags & VK_MAILBOX_FLAG_HAS_PENDING_REQUEST))
|
||||||
{
|
{
|
||||||
mailbox->request_acquire = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_REQUEST_ACQUIRE;
|
||||||
scond_signal(mailbox->cond);
|
scond_signal(mailbox->cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
mailbox->has_pending_request = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_HAS_PENDING_REQUEST;
|
||||||
|
|
||||||
while (!mailbox->acquired)
|
while (!(mailbox->flags & VK_MAILBOX_FLAG_ACQUIRED))
|
||||||
scond_wait(mailbox->cond, mailbox->lock);
|
scond_wait(mailbox->cond, mailbox->lock);
|
||||||
|
|
||||||
if ((res = mailbox->result) == VK_SUCCESS)
|
if ((res = mailbox->result) == VK_SUCCESS)
|
||||||
*index = mailbox->index;
|
*index = mailbox->index;
|
||||||
mailbox->has_pending_request = false;
|
mailbox->flags &= ~(VK_MAILBOX_FLAG_HAS_PENDING_REQUEST
|
||||||
mailbox->acquired = false;
|
| VK_MAILBOX_FLAG_ACQUIRED);
|
||||||
|
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
return res;
|
return res;
|
||||||
@ -193,16 +193,17 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
slock_lock(mailbox->lock);
|
slock_lock(mailbox->lock);
|
||||||
while (!mailbox->dead && !mailbox->request_acquire)
|
while ( !(mailbox->flags & VK_MAILBOX_FLAG_DEAD)
|
||||||
|
&& !(mailbox->flags & VK_MAILBOX_FLAG_REQUEST_ACQUIRE))
|
||||||
scond_wait(mailbox->cond, mailbox->lock);
|
scond_wait(mailbox->cond, mailbox->lock);
|
||||||
|
|
||||||
if (mailbox->dead)
|
if (mailbox->flags & VK_MAILBOX_FLAG_DEAD)
|
||||||
{
|
{
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mailbox->request_acquire = false;
|
mailbox->flags &= ~VK_MAILBOX_FLAG_REQUEST_ACQUIRE;
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
|
|
||||||
|
|
||||||
@ -228,7 +229,7 @@ static void vulkan_emulated_mailbox_loop(void *userdata)
|
|||||||
vkResetFences(mailbox->device, 1, &fence);
|
vkResetFences(mailbox->device, 1, &fence);
|
||||||
|
|
||||||
slock_lock(mailbox->lock);
|
slock_lock(mailbox->lock);
|
||||||
mailbox->acquired = true;
|
mailbox->flags |= VK_MAILBOX_FLAG_ACQUIRED;
|
||||||
scond_signal(mailbox->cond);
|
scond_signal(mailbox->cond);
|
||||||
slock_unlock(mailbox->lock);
|
slock_unlock(mailbox->lock);
|
||||||
}
|
}
|
||||||
@ -251,10 +252,7 @@ static bool vulkan_emulated_mailbox_init(
|
|||||||
mailbox->swapchain = swapchain;
|
mailbox->swapchain = swapchain;
|
||||||
mailbox->index = 0;
|
mailbox->index = 0;
|
||||||
mailbox->result = VK_SUCCESS;
|
mailbox->result = VK_SUCCESS;
|
||||||
mailbox->acquired = false;
|
mailbox->flags = 0;
|
||||||
mailbox->request_acquire = false;
|
|
||||||
mailbox->dead = false;
|
|
||||||
mailbox->has_pending_request = false;
|
|
||||||
|
|
||||||
if (!(mailbox->cond = scond_new()))
|
if (!(mailbox->cond = scond_new()))
|
||||||
return false;
|
return false;
|
||||||
@ -452,7 +450,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
|||||||
* static textures, samplers can be used to enable it dynamically.
|
* static textures, samplers can be used to enable it dynamically.
|
||||||
*/
|
*/
|
||||||
info.mipLevels = vulkan_num_miplevels(width, height);
|
info.mipLevels = vulkan_num_miplevels(width, height);
|
||||||
tex.mipmap = true;
|
tex.flags |= VK_TEX_FLAG_MIPMAP;
|
||||||
retro_assert(initial && "Static textures must have initial data.\n");
|
retro_assert(initial && "Static textures must have initial data.\n");
|
||||||
info.tiling = VK_IMAGE_TILING_OPTIMAL;
|
info.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||||
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT |
|
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||||
@ -529,9 +527,10 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
|||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
|
||||||
|
|
||||||
tex.need_manual_cache_management =
|
if ((vk->context->memory_properties.memoryTypes
|
||||||
(vk->context->memory_properties.memoryTypes[alloc.memoryTypeIndex].propertyFlags &
|
[alloc.memoryTypeIndex].propertyFlags &
|
||||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0;
|
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0)
|
||||||
|
tex.flags |= VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT;
|
||||||
|
|
||||||
/* If the texture is STREAMED and it's not DEVICE_LOCAL, we expect to hit a slower path,
|
/* If the texture is STREAMED and it's not DEVICE_LOCAL, we expect to hit a slower path,
|
||||||
* so fallback to copy path. */
|
* so fallback to copy path. */
|
||||||
@ -681,8 +680,8 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
|||||||
for (y = 0; y < tex.height; y++, dst += tex.stride, src += stride)
|
for (y = 0; y < tex.height; y++, dst += tex.stride, src += stride)
|
||||||
memcpy(dst, src, width * bpp);
|
memcpy(dst, src, width * bpp);
|
||||||
|
|
||||||
if ( tex.need_manual_cache_management &&
|
if ( (tex.flags & VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT)
|
||||||
tex.memory != VK_NULL_HANDLE)
|
&& (tex.memory != VK_NULL_HANDLE))
|
||||||
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, tex.memory);
|
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, tex.memory);
|
||||||
vkUnmapMemory(device, tex.memory);
|
vkUnmapMemory(device, tex.memory);
|
||||||
}
|
}
|
||||||
@ -692,7 +691,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
|||||||
VkBufferImageCopy region;
|
VkBufferImageCopy region;
|
||||||
VkCommandBuffer staging;
|
VkCommandBuffer staging;
|
||||||
enum VkImageLayout layout_fmt =
|
enum VkImageLayout layout_fmt =
|
||||||
tex.mipmap
|
(tex.flags & VK_TEX_FLAG_MIPMAP)
|
||||||
? VK_IMAGE_LAYOUT_GENERAL
|
? VK_IMAGE_LAYOUT_GENERAL
|
||||||
: VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
: VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||||
struct vk_texture tmp = vulkan_create_texture(vk, NULL,
|
struct vk_texture tmp = vulkan_create_texture(vk, NULL,
|
||||||
@ -734,7 +733,7 @@ struct vk_texture vulkan_create_texture(vk_t *vk,
|
|||||||
vkCmdCopyBufferToImage(staging, tmp.buffer,
|
vkCmdCopyBufferToImage(staging, tmp.buffer,
|
||||||
tex.image, layout_fmt, 1, ®ion);
|
tex.image, layout_fmt, 1, ®ion);
|
||||||
|
|
||||||
if (tex.mipmap)
|
if (tex.flags & VK_TEX_FLAG_MIPMAP)
|
||||||
{
|
{
|
||||||
for (i = 1; i < info.mipLevels; i++)
|
for (i = 1; i < info.mipLevels; i++)
|
||||||
{
|
{
|
||||||
@ -848,9 +847,7 @@ void vulkan_destroy_texture(
|
|||||||
vulkan_track_dealloc(tex->image);
|
vulkan_track_dealloc(tex->image);
|
||||||
#endif
|
#endif
|
||||||
tex->type = VULKAN_TEXTURE_STREAMED;
|
tex->type = VULKAN_TEXTURE_STREAMED;
|
||||||
tex->default_smooth = false;
|
tex->flags = 0;
|
||||||
tex->need_manual_cache_management = false;
|
|
||||||
tex->mipmap = false;
|
|
||||||
tex->memory_type = 0;
|
tex->memory_type = 0;
|
||||||
tex->width = 0;
|
tex->width = 0;
|
||||||
tex->height = 0;
|
tex->height = 0;
|
||||||
|
@ -165,6 +165,14 @@ typedef struct vulkan_context
|
|||||||
|
|
||||||
} vulkan_context_t;
|
} vulkan_context_t;
|
||||||
|
|
||||||
|
enum vulkan_emulated_mailbox_flags
|
||||||
|
{
|
||||||
|
VK_MAILBOX_FLAG_ACQUIRED = (1 << 0),
|
||||||
|
VK_MAILBOX_FLAG_REQUEST_ACQUIRE = (1 << 1),
|
||||||
|
VK_MAILBOX_FLAG_DEAD = (1 << 2),
|
||||||
|
VK_MAILBOX_FLAG_HAS_PENDING_REQUEST = (1 << 3)
|
||||||
|
};
|
||||||
|
|
||||||
struct vulkan_emulated_mailbox
|
struct vulkan_emulated_mailbox
|
||||||
{
|
{
|
||||||
sthread_t *thread;
|
sthread_t *thread;
|
||||||
@ -175,10 +183,7 @@ struct vulkan_emulated_mailbox
|
|||||||
|
|
||||||
unsigned index;
|
unsigned index;
|
||||||
VkResult result; /* enum alignment */
|
VkResult result; /* enum alignment */
|
||||||
bool acquired;
|
uint8_t flags;
|
||||||
bool request_acquire;
|
|
||||||
bool dead;
|
|
||||||
bool has_pending_request;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct gfx_ctx_vulkan_data
|
typedef struct gfx_ctx_vulkan_data
|
||||||
@ -232,6 +237,13 @@ struct vk_image
|
|||||||
VkDeviceMemory memory; /* ptr alignment */
|
VkDeviceMemory memory; /* ptr alignment */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum vk_texture_flags
|
||||||
|
{
|
||||||
|
VK_TEX_FLAG_DEFAULT_SMOOTH = (1 << 0),
|
||||||
|
VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT = (1 << 1),
|
||||||
|
VK_TEX_FLAG_MIPMAP = (1 << 2)
|
||||||
|
};
|
||||||
|
|
||||||
struct vk_texture
|
struct vk_texture
|
||||||
{
|
{
|
||||||
VkDeviceSize memory_size; /* uint64_t alignment */
|
VkDeviceSize memory_size; /* uint64_t alignment */
|
||||||
@ -251,9 +263,7 @@ struct vk_texture
|
|||||||
VkImageLayout layout; /* enum alignment */
|
VkImageLayout layout; /* enum alignment */
|
||||||
VkFormat format; /* enum alignment */
|
VkFormat format; /* enum alignment */
|
||||||
enum vk_texture_type type;
|
enum vk_texture_type type;
|
||||||
bool default_smooth;
|
uint8_t flags;
|
||||||
bool need_manual_cache_management;
|
|
||||||
bool mipmap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vk_buffer
|
struct vk_buffer
|
||||||
@ -707,11 +717,11 @@ void vulkan_destroy_texture(
|
|||||||
* changes in resolution, so this seems like the sanest and
|
* changes in resolution, so this seems like the sanest and
|
||||||
* simplest solution. */
|
* simplest solution. */
|
||||||
#define VULKAN_SYNC_TEXTURE_TO_GPU_COND_PTR(vk, tex) \
|
#define VULKAN_SYNC_TEXTURE_TO_GPU_COND_PTR(vk, tex) \
|
||||||
if ((tex)->need_manual_cache_management && (tex)->memory != VK_NULL_HANDLE) \
|
if (((tex)->flags & VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT) && (tex)->memory != VK_NULL_HANDLE) \
|
||||||
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, (tex)->memory) \
|
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, (tex)->memory) \
|
||||||
|
|
||||||
#define VULKAN_SYNC_TEXTURE_TO_GPU_COND_OBJ(vk, tex) \
|
#define VULKAN_SYNC_TEXTURE_TO_GPU_COND_OBJ(vk, tex) \
|
||||||
if ((tex).need_manual_cache_management && (tex).memory != VK_NULL_HANDLE) \
|
if (((tex).flags & VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT) && (tex).memory != VK_NULL_HANDLE) \
|
||||||
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, (tex).memory) \
|
VULKAN_SYNC_TEXTURE_TO_GPU(vk->context->device, (tex).memory) \
|
||||||
|
|
||||||
/* VBO will be written to here. */
|
/* VBO will be written to here. */
|
||||||
|
@ -2394,21 +2394,17 @@ static bool vulkan_frame(void *data, const void *frame,
|
|||||||
quad.texture = optimal;
|
quad.texture = optimal;
|
||||||
|
|
||||||
if (menu_linear_filter)
|
if (menu_linear_filter)
|
||||||
{
|
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||||
quad.sampler = optimal->mipmap ?
|
|
||||||
vk->samplers.mipmap_linear : vk->samplers.linear;
|
vk->samplers.mipmap_linear : vk->samplers.linear;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||||
quad.sampler = optimal->mipmap ?
|
|
||||||
vk->samplers.mipmap_nearest : vk->samplers.nearest;
|
vk->samplers.mipmap_nearest : vk->samplers.nearest;
|
||||||
}
|
|
||||||
|
|
||||||
quad.mvp = &vk->mvp_no_rot;
|
quad.mvp = &vk->mvp_no_rot;
|
||||||
quad.color.r = 1.0f;
|
quad.color.r = 1.0f;
|
||||||
quad.color.g = 1.0f;
|
quad.color.g = 1.0f;
|
||||||
quad.color.b = 1.0f;
|
quad.color.b = 1.0f;
|
||||||
quad.color.a = vk->menu.alpha;
|
quad.color.a = vk->menu.alpha;
|
||||||
vulkan_draw_quad(vk, &quad);
|
vulkan_draw_quad(vk, &quad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3128,21 +3124,22 @@ static uintptr_t vulkan_load_texture(void *video_data, void *data,
|
|||||||
};
|
};
|
||||||
#undef T0
|
#undef T0
|
||||||
#undef T1
|
#undef T1
|
||||||
*texture = vulkan_create_texture(vk, NULL,
|
*texture = vulkan_create_texture(vk, NULL,
|
||||||
8, 8, VK_FORMAT_B8G8R8A8_UNORM,
|
8, 8, VK_FORMAT_B8G8R8A8_UNORM,
|
||||||
checkerboard, NULL, VULKAN_TEXTURE_STATIC);
|
checkerboard, NULL, VULKAN_TEXTURE_STATIC);
|
||||||
texture->default_smooth = false;
|
texture->flags &= ~(VK_TEX_FLAG_DEFAULT_SMOOTH
|
||||||
texture->mipmap = false;
|
| VK_TEX_FLAG_MIPMAP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*texture = vulkan_create_texture(vk, NULL,
|
*texture = vulkan_create_texture(vk, NULL,
|
||||||
image->width, image->height, VK_FORMAT_B8G8R8A8_UNORM,
|
image->width, image->height, VK_FORMAT_B8G8R8A8_UNORM,
|
||||||
image->pixels, NULL, VULKAN_TEXTURE_STATIC);
|
image->pixels, NULL, VULKAN_TEXTURE_STATIC);
|
||||||
|
if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR || filter_type ==
|
||||||
texture->default_smooth =
|
TEXTURE_FILTER_LINEAR)
|
||||||
filter_type == TEXTURE_FILTER_MIPMAP_LINEAR || filter_type == TEXTURE_FILTER_LINEAR;
|
texture->flags |= VK_TEX_FLAG_DEFAULT_SMOOTH;
|
||||||
texture->mipmap = filter_type == TEXTURE_FILTER_MIPMAP_LINEAR;
|
if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR)
|
||||||
|
texture->flags |= VK_TEX_FLAG_MIPMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uintptr_t)texture;
|
return (uintptr_t)texture;
|
||||||
@ -3320,8 +3317,8 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
|
|||||||
vkMapMemory(vk->context->device, staging->memory,
|
vkMapMemory(vk->context->device, staging->memory,
|
||||||
staging->offset, staging->size, 0, (void**)&src);
|
staging->offset, staging->size, 0, (void**)&src);
|
||||||
|
|
||||||
if (staging->need_manual_cache_management
|
if ( (staging->flags & VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT)
|
||||||
&& staging->memory != VK_NULL_HANDLE)
|
&& (staging->memory != VK_NULL_HANDLE))
|
||||||
VULKAN_SYNC_TEXTURE_TO_CPU(vk->context->device, staging->memory);
|
VULKAN_SYNC_TEXTURE_TO_CPU(vk->context->device, staging->memory);
|
||||||
|
|
||||||
ctx->in_stride = staging->stride;
|
ctx->in_stride = staging->stride;
|
||||||
@ -3362,8 +3359,8 @@ static bool vulkan_read_viewport(void *data, uint8_t *buffer, bool is_idle)
|
|||||||
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, staging);
|
VK_MAP_PERSISTENT_TEXTURE(vk->context->device, staging);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (staging->need_manual_cache_management
|
if ( (staging->flags & VK_TEX_FLAG_NEED_MANUAL_CACHE_MANAGEMENT)
|
||||||
&& staging->memory != VK_NULL_HANDLE)
|
&& (staging->memory != VK_NULL_HANDLE))
|
||||||
VULKAN_SYNC_TEXTURE_TO_CPU(vk->context->device, staging->memory);
|
VULKAN_SYNC_TEXTURE_TO_CPU(vk->context->device, staging->memory);
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -3501,8 +3498,8 @@ static void vulkan_render_overlay(vk_t *vk, unsigned width,
|
|||||||
call.vbo = ⦥
|
call.vbo = ⦥
|
||||||
call.texture = &vk->overlay.images[i];
|
call.texture = &vk->overlay.images[i];
|
||||||
call.pipeline = vk->display.pipelines[3]; /* Strip with blend */
|
call.pipeline = vk->display.pipelines[3]; /* Strip with blend */
|
||||||
call.sampler = call.texture->mipmap ?
|
call.sampler = (call.texture->flags & VK_TEX_FLAG_MIPMAP)
|
||||||
vk->samplers.mipmap_linear : vk->samplers.linear;
|
? vk->samplers.mipmap_linear : vk->samplers.linear;
|
||||||
vulkan_draw_triangles(vk, &call);
|
vulkan_draw_triangles(vk, &call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,9 +254,9 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
(vk->display.blend << 0);
|
(vk->display.blend << 0);
|
||||||
call.pipeline = vk->display.pipelines[disp_pipeline];
|
call.pipeline = vk->display.pipelines[disp_pipeline];
|
||||||
call.texture = texture;
|
call.texture = texture;
|
||||||
call.sampler = texture->mipmap ?
|
call.sampler = (texture->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||||
vk->samplers.mipmap_linear :
|
vk->samplers.mipmap_linear :
|
||||||
(texture->default_smooth ? vk->samplers.linear
|
((texture->flags & VK_TEX_FLAG_DEFAULT_SMOOTH) ? vk->samplers.linear
|
||||||
: vk->samplers.nearest);
|
: vk->samplers.nearest);
|
||||||
call.uniform = draw->matrix_data
|
call.uniform = draw->matrix_data
|
||||||
? draw->matrix_data : &vk->mvp_no_rot;
|
? draw->matrix_data : &vk->mvp_no_rot;
|
||||||
|
@ -242,7 +242,7 @@ void gfx_widgets_msg_queue_push(
|
|||||||
msg_widget->hourglass_timer = 0.0f;
|
msg_widget->hourglass_timer = 0.0f;
|
||||||
msg_widget->flags = 0;
|
msg_widget->flags = 0;
|
||||||
|
|
||||||
if (!p_dispwidget->msg_queue_has_icons)
|
if (!(p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS))
|
||||||
{
|
{
|
||||||
msg_widget->flags |= DISPWIDG_FLAG_UNFOLDED;
|
msg_widget->flags |= DISPWIDG_FLAG_UNFOLDED;
|
||||||
msg_widget->flags &= ~DISPWIDG_FLAG_UNFOLDING;
|
msg_widget->flags &= ~DISPWIDG_FLAG_UNFOLDING;
|
||||||
@ -402,7 +402,7 @@ static void gfx_widgets_unfold_end(void *userdata)
|
|||||||
dispgfx_widget_t *p_dispwidget = &dispwidget_st;
|
dispgfx_widget_t *p_dispwidget = &dispwidget_st;
|
||||||
|
|
||||||
unfold->flags &= ~DISPWIDG_FLAG_UNFOLDING;
|
unfold->flags &= ~DISPWIDG_FLAG_UNFOLDING;
|
||||||
p_dispwidget->moving = false;
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_widgets_move_end(void *userdata)
|
static void gfx_widgets_move_end(void *userdata)
|
||||||
@ -428,7 +428,7 @@ static void gfx_widgets_move_end(void *userdata)
|
|||||||
unfold->flags |= DISPWIDG_FLAG_UNFOLDING;
|
unfold->flags |= DISPWIDG_FLAG_UNFOLDING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p_dispwidget->moving = false;
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_widgets_msg_queue_expired(void *userdata)
|
static void gfx_widgets_msg_queue_expired(void *userdata)
|
||||||
@ -477,7 +477,7 @@ static void gfx_widgets_msg_queue_move(dispgfx_widget_t *p_dispwidget)
|
|||||||
|
|
||||||
gfx_animation_push(&entry);
|
gfx_animation_push(&entry);
|
||||||
|
|
||||||
p_dispwidget->moving = true;
|
p_dispwidget->flags |= DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ static void gfx_widgets_msg_queue_free(
|
|||||||
if (msg->msg_new)
|
if (msg->msg_new)
|
||||||
free(msg->msg_new);
|
free(msg->msg_new);
|
||||||
|
|
||||||
p_dispwidget->moving = false;
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_widgets_msg_queue_kill_end(void *userdata)
|
static void gfx_widgets_msg_queue_kill_end(void *userdata)
|
||||||
@ -569,7 +569,7 @@ static void gfx_widgets_msg_queue_kill(
|
|||||||
if (!msg)
|
if (!msg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p_dispwidget->moving = true;
|
p_dispwidget->flags |= DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
msg->flags |= DISPWIDG_FLAG_DYING;
|
msg->flags |= DISPWIDG_FLAG_DYING;
|
||||||
|
|
||||||
p_dispwidget->msg_queue_kill = idx;
|
p_dispwidget->msg_queue_kill = idx;
|
||||||
@ -847,7 +847,7 @@ static void gfx_widgets_layout(
|
|||||||
|
|
||||||
p_dispwidget->msg_queue_height = p_dispwidget->gfx_widget_fonts.msg_queue.line_height * 2.5f * (BASE_FONT_SIZE / MSG_QUEUE_FONT_SIZE);
|
p_dispwidget->msg_queue_height = p_dispwidget->gfx_widget_fonts.msg_queue.line_height * 2.5f * (BASE_FONT_SIZE / MSG_QUEUE_FONT_SIZE);
|
||||||
|
|
||||||
if (p_dispwidget->msg_queue_has_icons)
|
if (p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
p_dispwidget->msg_queue_icon_size_y = p_dispwidget->msg_queue_height
|
p_dispwidget->msg_queue_icon_size_y = p_dispwidget->msg_queue_height
|
||||||
@ -871,7 +871,7 @@ static void gfx_widgets_layout(
|
|||||||
p_dispwidget->msg_queue_icon_offset_y = (p_dispwidget->msg_queue_icon_size_y - p_dispwidget->msg_queue_height) / 2;
|
p_dispwidget->msg_queue_icon_offset_y = (p_dispwidget->msg_queue_icon_size_y - p_dispwidget->msg_queue_height) / 2;
|
||||||
p_dispwidget->msg_queue_scissor_start_x = p_dispwidget->msg_queue_spacing + p_dispwidget->msg_queue_icon_size_x - (p_dispwidget->msg_queue_icon_size_x * 0.28928571428f);
|
p_dispwidget->msg_queue_scissor_start_x = p_dispwidget->msg_queue_spacing + p_dispwidget->msg_queue_icon_size_x - (p_dispwidget->msg_queue_icon_size_x * 0.28928571428f);
|
||||||
|
|
||||||
if (p_dispwidget->msg_queue_has_icons)
|
if (p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS)
|
||||||
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding / 2;
|
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding / 2;
|
||||||
else
|
else
|
||||||
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding;
|
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding;
|
||||||
@ -971,7 +971,7 @@ void gfx_widgets_iterate(
|
|||||||
|
|
||||||
/* Consume one message if available */
|
/* Consume one message if available */
|
||||||
if ((FIFO_READ_AVAIL_NONPTR(p_dispwidget->msg_queue) > 0)
|
if ((FIFO_READ_AVAIL_NONPTR(p_dispwidget->msg_queue) > 0)
|
||||||
&& !p_dispwidget->moving
|
&& !(p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MOVING)
|
||||||
&& (p_dispwidget->current_msgs_size < ARRAY_SIZE(p_dispwidget->current_msgs)))
|
&& (p_dispwidget->current_msgs_size < ARRAY_SIZE(p_dispwidget->current_msgs)))
|
||||||
{
|
{
|
||||||
disp_widget_msg_t *msg_widget = NULL;
|
disp_widget_msg_t *msg_widget = NULL;
|
||||||
@ -1046,8 +1046,8 @@ void gfx_widgets_iterate(
|
|||||||
if (!(msg_widget->flags & DISPWIDG_FLAG_EXPIRATION_TIMER_STARTED))
|
if (!(msg_widget->flags & DISPWIDG_FLAG_EXPIRATION_TIMER_STARTED))
|
||||||
gfx_widgets_start_msg_expiration_timer(msg_widget, TASK_FINISHED_DURATION);
|
gfx_widgets_start_msg_expiration_timer(msg_widget, TASK_FINISHED_DURATION);
|
||||||
|
|
||||||
if ( (msg_widget->flags & DISPWIDG_FLAG_EXPIRED)
|
if ( (msg_widget->flags & DISPWIDG_FLAG_EXPIRED)
|
||||||
&& !p_dispwidget->moving)
|
&& !(p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MOVING))
|
||||||
{
|
{
|
||||||
gfx_widgets_msg_queue_kill(p_dispwidget,
|
gfx_widgets_msg_queue_kill(p_dispwidget,
|
||||||
(unsigned)i);
|
(unsigned)i);
|
||||||
@ -1456,7 +1456,7 @@ static void gfx_widgets_draw_regular_msg(
|
|||||||
video_width, video_height);
|
video_width, video_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_dispwidget->msg_queue_has_icons)
|
if (p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS)
|
||||||
{
|
{
|
||||||
if (dispctx && dispctx->blend_begin)
|
if (dispctx && dispctx->blend_begin)
|
||||||
dispctx->blend_begin(userdata);
|
dispctx->blend_begin(userdata);
|
||||||
@ -1802,7 +1802,7 @@ static void gfx_widgets_free(dispgfx_widget_t *p_dispwidget)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
p_dispwidget->inited = false;
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_INITED;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(widgets); i++)
|
for (i = 0; i < ARRAY_SIZE(widgets); i++)
|
||||||
{
|
{
|
||||||
@ -1930,10 +1930,12 @@ static void gfx_widgets_context_reset(
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
p_dispwidget->msg_queue_has_icons =
|
if ( p_dispwidget->msg_queue_icon
|
||||||
p_dispwidget->msg_queue_icon &&
|
&& p_dispwidget->msg_queue_icon_outline
|
||||||
p_dispwidget->msg_queue_icon_outline &&
|
&& p_dispwidget->msg_queue_icon_rect)
|
||||||
p_dispwidget->msg_queue_icon_rect;
|
p_dispwidget->flags |= DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS;
|
||||||
|
else
|
||||||
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(widgets); i++)
|
for (i = 0; i < ARRAY_SIZE(widgets); i++)
|
||||||
{
|
{
|
||||||
@ -2009,7 +2011,7 @@ bool gfx_widgets_init(
|
|||||||
p_dispwidget->msg_queue_bg[14] = HEX_B(color);
|
p_dispwidget->msg_queue_bg[14] = HEX_B(color);
|
||||||
p_dispwidget->msg_queue_bg[15] = 1.0f;
|
p_dispwidget->msg_queue_bg[15] = 1.0f;
|
||||||
|
|
||||||
if (!p_dispwidget->inited)
|
if (!(p_dispwidget->flags & DISPGFX_WIDGET_FLAG_INITED))
|
||||||
{
|
{
|
||||||
char theme_path[PATH_MAX_LENGTH];
|
char theme_path[PATH_MAX_LENGTH];
|
||||||
p_dispwidget->gfx_widgets_frame_count = 0;
|
p_dispwidget->gfx_widgets_frame_count = 0;
|
||||||
@ -2072,7 +2074,7 @@ bool gfx_widgets_init(
|
|||||||
settings->paths.directory_assets, "pkg",
|
settings->paths.directory_assets, "pkg",
|
||||||
sizeof(p_dispwidget->assets_pkg_dir));
|
sizeof(p_dispwidget->assets_pkg_dir));
|
||||||
|
|
||||||
p_dispwidget->inited = true;
|
p_dispwidget->flags |= DISPGFX_WIDGET_FLAG_INITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_widgets_context_reset(
|
gfx_widgets_context_reset(
|
||||||
|
@ -151,6 +151,16 @@ typedef struct disp_widget_msg
|
|||||||
uint8_t task_count;
|
uint8_t task_count;
|
||||||
} disp_widget_msg_t;
|
} disp_widget_msg_t;
|
||||||
|
|
||||||
|
/* There can only be one message animation at a time to
|
||||||
|
* avoid confusing users */
|
||||||
|
enum dispgfx_widget_flags
|
||||||
|
{
|
||||||
|
DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS = (1 << 0),
|
||||||
|
DISPGFX_WIDGET_FLAG_PERSISTING = (1 << 1),
|
||||||
|
DISPGFX_WIDGET_FLAG_MOVING = (1 << 2),
|
||||||
|
DISPGFX_WIDGET_FLAG_INITED = (1 << 3)
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct dispgfx_widget
|
typedef struct dispgfx_widget
|
||||||
{
|
{
|
||||||
uint64_t gfx_widgets_frame_count;
|
uint64_t gfx_widgets_frame_count;
|
||||||
@ -217,6 +227,8 @@ typedef struct dispgfx_widget
|
|||||||
unsigned ai_service_overlay_height;
|
unsigned ai_service_overlay_height;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uint8_t flags;
|
||||||
|
|
||||||
char assets_pkg_dir[PATH_MAX_LENGTH];
|
char assets_pkg_dir[PATH_MAX_LENGTH];
|
||||||
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
|
char xmb_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from XMB */
|
||||||
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
char ozone_path[PATH_MAX_LENGTH]; /* TODO/FIXME - decouple from Ozone */
|
||||||
@ -227,18 +239,12 @@ typedef struct dispgfx_widget
|
|||||||
char gfx_widgets_path[PATH_MAX_LENGTH];
|
char gfx_widgets_path[PATH_MAX_LENGTH];
|
||||||
char gfx_widgets_status_text[255];
|
char gfx_widgets_status_text[255];
|
||||||
|
|
||||||
/* There can only be one message animation at a time to
|
|
||||||
* avoid confusing users */
|
|
||||||
bool moving;
|
|
||||||
bool inited;
|
|
||||||
bool active;
|
bool active;
|
||||||
bool persisting;
|
|
||||||
bool msg_queue_has_icons;
|
|
||||||
} dispgfx_widget_t;
|
} dispgfx_widget_t;
|
||||||
|
|
||||||
|
|
||||||
/* A widget */
|
/* A widget */
|
||||||
/* TODO: cleanup all unused parameters */
|
/* TODO/FIXME: cleanup all unused parameters */
|
||||||
struct gfx_widget
|
struct gfx_widget
|
||||||
{
|
{
|
||||||
/* called when the widgets system is initialized
|
/* called when the widgets system is initialized
|
||||||
|
@ -3686,7 +3686,7 @@ void main_exit(void *args)
|
|||||||
|
|
||||||
#if defined(HAVE_GFX_WIDGETS)
|
#if defined(HAVE_GFX_WIDGETS)
|
||||||
/* Do not want display widgets to live any more. */
|
/* Do not want display widgets to live any more. */
|
||||||
dispwidget_get_ptr()->persisting = false;
|
dispwidget_get_ptr()->flags &= ~DISPGFX_WIDGET_FLAG_PERSISTING;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
/* Do not want menu context to live any more. */
|
/* Do not want menu context to live any more. */
|
||||||
|
@ -37,6 +37,12 @@
|
|||||||
#include "../input/include/blissbox.h"
|
#include "../input/include/blissbox.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum autoconfig_handle_flags
|
||||||
|
{
|
||||||
|
AUTOCONF_FLAG_AUTOCONFIG_ENABLED = (1 << 0),
|
||||||
|
AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS = (1 << 1)
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *dir_autoconfig;
|
char *dir_autoconfig;
|
||||||
@ -44,8 +50,7 @@ typedef struct
|
|||||||
config_file_t *autoconfig_file;
|
config_file_t *autoconfig_file;
|
||||||
unsigned port;
|
unsigned port;
|
||||||
input_device_info_t device_info; /* unsigned alignment */
|
input_device_info_t device_info; /* unsigned alignment */
|
||||||
bool autoconfig_enabled;
|
uint8_t flags;
|
||||||
bool suppress_notifcations;
|
|
||||||
} autoconfig_handle_t;
|
} autoconfig_handle_t;
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
@ -442,9 +447,9 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
|
|||||||
|
|
||||||
autoconfig_handle = (autoconfig_handle_t*)task->state;
|
autoconfig_handle = (autoconfig_handle_t*)task->state;
|
||||||
|
|
||||||
if (!autoconfig_handle ||
|
if ( !autoconfig_handle
|
||||||
string_is_empty(autoconfig_handle->device_info.name) ||
|
|| string_is_empty(autoconfig_handle->device_info.name)
|
||||||
!autoconfig_handle->autoconfig_enabled)
|
|| !(autoconfig_handle->flags & AUTOCONF_FLAG_AUTOCONFIG_ENABLED))
|
||||||
goto task_finished;
|
goto task_finished;
|
||||||
|
|
||||||
/* Annoyingly, we have to scan all the autoconfig
|
/* Annoyingly, we have to scan all the autoconfig
|
||||||
@ -522,7 +527,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task)
|
|||||||
if (match_found)
|
if (match_found)
|
||||||
{
|
{
|
||||||
/* A valid autoconfig was applied */
|
/* A valid autoconfig was applied */
|
||||||
if (!autoconfig_handle->suppress_notifcations)
|
if (!(autoconfig_handle->flags & AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS))
|
||||||
{
|
{
|
||||||
size_t _len = strlcpy(task_title,
|
size_t _len = strlcpy(task_title,
|
||||||
device_display_name, sizeof(task_title));
|
device_display_name, sizeof(task_title));
|
||||||
@ -632,7 +637,8 @@ bool input_autoconfigure_connect(
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Configure handle */
|
/* Configure handle */
|
||||||
if (!(autoconfig_handle = (autoconfig_handle_t*)malloc(sizeof(autoconfig_handle_t))))
|
if (!(autoconfig_handle = (autoconfig_handle_t*)
|
||||||
|
malloc(sizeof(autoconfig_handle_t))))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
autoconfig_handle->port = port;
|
autoconfig_handle->port = port;
|
||||||
@ -645,8 +651,10 @@ bool input_autoconfigure_connect(
|
|||||||
autoconfig_handle->device_info.joypad_driver[0] = '\0';
|
autoconfig_handle->device_info.joypad_driver[0] = '\0';
|
||||||
autoconfig_handle->device_info.autoconfigured = false;
|
autoconfig_handle->device_info.autoconfigured = false;
|
||||||
autoconfig_handle->device_info.name_index = 0;
|
autoconfig_handle->device_info.name_index = 0;
|
||||||
autoconfig_handle->autoconfig_enabled = autoconfig_enabled;
|
if (autoconfig_enabled)
|
||||||
autoconfig_handle->suppress_notifcations = !notification_show_autoconfig;
|
autoconfig_handle->flags |= AUTOCONF_FLAG_AUTOCONFIG_ENABLED;
|
||||||
|
if (!notification_show_autoconfig)
|
||||||
|
autoconfig_handle->flags |= AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS;
|
||||||
autoconfig_handle->dir_autoconfig = NULL;
|
autoconfig_handle->dir_autoconfig = NULL;
|
||||||
autoconfig_handle->dir_driver_autoconfig = NULL;
|
autoconfig_handle->dir_driver_autoconfig = NULL;
|
||||||
autoconfig_handle->autoconfig_file = NULL;
|
autoconfig_handle->autoconfig_file = NULL;
|
||||||
@ -659,8 +667,7 @@ bool input_autoconfigure_connect(
|
|||||||
strlcpy(autoconfig_handle->device_info.display_name, display_name,
|
strlcpy(autoconfig_handle->device_info.display_name, display_name,
|
||||||
sizeof(autoconfig_handle->device_info.display_name));
|
sizeof(autoconfig_handle->device_info.display_name));
|
||||||
|
|
||||||
driver_valid = !string_is_empty(driver);
|
if ((driver_valid = !string_is_empty(driver)))
|
||||||
if (driver_valid)
|
|
||||||
strlcpy(autoconfig_handle->device_info.joypad_driver,
|
strlcpy(autoconfig_handle->device_info.joypad_driver,
|
||||||
driver, sizeof(autoconfig_handle->device_info.joypad_driver));
|
driver, sizeof(autoconfig_handle->device_info.joypad_driver));
|
||||||
|
|
||||||
@ -706,8 +713,8 @@ bool input_autoconfigure_connect(
|
|||||||
* task status messages
|
* task status messages
|
||||||
* > Can skip this check if autoconfig notifications
|
* > Can skip this check if autoconfig notifications
|
||||||
* have been disabled by the user */
|
* have been disabled by the user */
|
||||||
if (!autoconfig_handle->suppress_notifcations &&
|
if ( !(autoconfig_handle->flags & AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS)
|
||||||
!string_is_empty(autoconfig_handle->device_info.name))
|
&& !string_is_empty(autoconfig_handle->device_info.name))
|
||||||
{
|
{
|
||||||
const char *last_device_name = input_config_get_device_name(port);
|
const char *last_device_name = input_config_get_device_name(port);
|
||||||
uint16_t last_vid = input_config_get_device_vid(port);
|
uint16_t last_vid = input_config_get_device_vid(port);
|
||||||
@ -720,7 +727,7 @@ bool input_autoconfigure_connect(
|
|||||||
(autoconfig_handle->device_info.vid == last_vid) &&
|
(autoconfig_handle->device_info.vid == last_vid) &&
|
||||||
(autoconfig_handle->device_info.pid == last_pid) &&
|
(autoconfig_handle->device_info.pid == last_pid) &&
|
||||||
last_autoconfigured)
|
last_autoconfigured)
|
||||||
autoconfig_handle->suppress_notifcations = true;
|
autoconfig_handle->flags |= AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure task */
|
/* Configure task */
|
||||||
@ -823,7 +830,7 @@ static void input_autoconfigure_disconnect_handler(retro_task_t *task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
task_free_title(task);
|
task_free_title(task);
|
||||||
if (!autoconfig_handle->suppress_notifcations)
|
if (!(autoconfig_handle->flags & AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS))
|
||||||
task_set_title(task, strdup(task_title));
|
task_set_title(task, strdup(task_title));
|
||||||
|
|
||||||
task_finished:
|
task_finished:
|
||||||
@ -885,17 +892,16 @@ bool input_autoconfigure_disconnect(unsigned port, const char *name)
|
|||||||
if (!autoconfig_handle)
|
if (!autoconfig_handle)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
autoconfig_handle->port = port;
|
autoconfig_handle->port = port;
|
||||||
autoconfig_handle->suppress_notifcations = !notification_show_autoconfig;
|
if (!notification_show_autoconfig)
|
||||||
|
autoconfig_handle->flags |= AUTOCONF_FLAG_SUPPRESS_NOTIFICATIONS;
|
||||||
|
|
||||||
if (!string_is_empty(name))
|
if (!string_is_empty(name))
|
||||||
strlcpy(autoconfig_handle->device_info.name,
|
strlcpy(autoconfig_handle->device_info.name,
|
||||||
name, sizeof(autoconfig_handle->device_info.name));
|
name, sizeof(autoconfig_handle->device_info.name));
|
||||||
|
|
||||||
/* Configure task */
|
/* Configure task */
|
||||||
task = task_init();
|
if (!(task = task_init()))
|
||||||
|
|
||||||
if (!task)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
task->handler = input_autoconfigure_disconnect_handler;
|
task->handler = input_autoconfigure_disconnect_handler;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user