Fix --disable-menu errors

pull/15593/head
libretroadmin 2023-08-14 23:36:19 +02:00
parent ae78395d83
commit c8e6506687
10 changed files with 387 additions and 367 deletions

View File

@ -14,18 +14,21 @@
*/
#include <math.h>
#include <memalign.h>
#include <audio/conversion/s16_to_float.h>
#include <audio/conversion/float_to_s16.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#include <audio/conversion/dual_mono.h>
#include "microphone_driver.h"
#include "audio_defines.h"
#include "../configuration.h"
#include "../driver.h"
#include "../verbosity.h"
#include "../runloop.h"
#include "memalign.h"
#include "audio/conversion/s16_to_float.h"
#include "audio/conversion/float_to_s16.h"
#include "../list_special.h"
#include "retro_assert.h"
#include "string/stdstring.h"
#include "audio/conversion/dual_mono.h"
#include "../runloop.h"
#include "../verbosity.h"
static microphone_driver_state_t mic_driver_st;
@ -857,4 +860,4 @@ bool microphone_driver_get_devices_list(void **data)
return false;
*ptr = mic_driver_st.devices_list;
return true;
}
}

View File

@ -13,9 +13,13 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <features/features_cpu.h>
#include <retro_assert.h>
#include "cheevos_locals.h"
#include "../gfx/gfx_display.h"
#include "../file_path_special.h"
#ifdef HAVE_MENU
@ -23,13 +27,9 @@
#include "../deps/rcheevos/include/rc_runtime_types.h"
#include "../file_path_special.h"
#include "../menu/menu_driver.h"
#include "../menu/menu_entries.h"
#include <features/features_cpu.h>
#include <retro_assert.h>
enum rcheevos_menuitem_bucket
{
RCHEEVOS_MENUITEM_BUCKET_UNKNOWN = 0,
@ -98,7 +98,7 @@ static void rcheevos_menu_update_buckets(void)
{
const rcheevos_locals_t *rcheevos_locals = get_rcheevos_locals();
rcheevos_racheevo_t *cheevo = rcheevos_locals->game.achievements;
rcheevos_racheevo_t *stop = cheevo +
rcheevos_racheevo_t *stop = cheevo +
rcheevos_locals->game.achievement_count;
while (cheevo < stop)
@ -261,7 +261,7 @@ static void rcheevos_menu_update_badge(rcheevos_racheevo_t* cheevo)
cheevo->menu_badge_texture = new_badge_texture;
cheevo->menu_badge_grayscale = badge_grayscale;
}
/* menu_badge_grayscale is overloaded such
/* menu_badge_grayscale is overloaded such
* that any value greater than 1 indicates
* the server default image is being used */
else if (cheevo->menu_badge_grayscale < 2)
@ -594,7 +594,7 @@ void rcheevos_menu_populate(void* data)
unsigned idx = 0;
/* convert to menu entries */
rcheevos_menuitem_t* menuitem = rcheevos_locals->menuitems;
rcheevos_menuitem_t* stop = menuitem +
rcheevos_menuitem_t* stop = menuitem +
rcheevos_locals->menuitem_count;
do
@ -671,7 +671,7 @@ uintptr_t rcheevos_get_badge_texture(const char *badge, bool locked)
_len = strlcpy(badge_file, badge, sizeof(badge_file));
_len += strlcpy(badge_file + _len, locked ? "_lock" : "",
sizeof(badge_file) - _len);
strlcpy(badge_file + _len, FILE_PATH_PNG_EXTENSION,
strlcpy(badge_file + _len, ".png",
sizeof(badge_file) - _len);
fill_pathname_application_special(fullpath, sizeof(fullpath),

View File

@ -35,6 +35,7 @@
#endif
#include "../font_driver.h"
#include "../gfx_display.h"
#include "../../configuration.h"
#include "../../retroarch.h"
@ -60,7 +61,7 @@ HDC win32_gdi_hdc;
static void *dinput_gdi;
/*
* DISPLAY DRIVER
* DISPLAY DRIVER
*/
static const float *gfx_display_gdi_get_default_vertices(void)
@ -162,7 +163,7 @@ gfx_display_ctx_driver_t gfx_display_ctx_gdi = {
};
/*
* FONT DRIVER
* FONT DRIVER
*/
typedef struct
@ -341,7 +342,7 @@ font_renderer_t gdi_font = {
};
/*
* VIDEO DRIVER
* VIDEO DRIVER
*/
static void gfx_ctx_gdi_get_video_size(
@ -932,7 +933,7 @@ static uintptr_t gdi_load_texture(void *video_data, void *data,
return (uintptr_t)texture;
}
static void gdi_unload_texture(void *data,
static void gdi_unload_texture(void *data,
bool threaded, uintptr_t handle)
{
struct gdi_texture *texture = (struct gdi_texture*)handle;

View File

@ -490,7 +490,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
break;
case VULKAN_TEXTURE_STAGING:
buffer_info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT
buffer_info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
info.initialLayout = VK_IMAGE_LAYOUT_GENERAL;
info.tiling = VK_IMAGE_TILING_LINEAR;
@ -538,7 +538,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
break;
default:
/* Try to find a memory type which is cached,
/* Try to find a memory type which is cached,
* even if it means manual cache management. */
alloc.memoryTypeIndex = vulkan_find_memory_type_fallback(
&vk->context->memory_properties,
@ -637,7 +637,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
if (tex.buffer)
vkBindBufferMemory(device, tex.buffer, tex.memory, 0);
if ( type != VULKAN_TEXTURE_STAGING
if ( type != VULKAN_TEXTURE_STAGING
&& type != VULKAN_TEXTURE_READBACK)
{
VkImageViewCreateInfo view;
@ -667,7 +667,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
else
tex.view = VK_NULL_HANDLE;
if ( tex.image
if ( tex.image
&& info.tiling == VK_IMAGE_TILING_LINEAR)
vkGetImageSubresourceLayout(device, tex.image, &subresource, &layout);
else if (tex.buffer)
@ -723,7 +723,7 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
VkSubmitInfo submit_info;
VkCommandBufferBeginInfo begin_info;
VkCommandBufferAllocateInfo cmd_info;
enum VkImageLayout layout_fmt =
enum VkImageLayout layout_fmt =
(tex.flags & VK_TEX_FLAG_MIPMAP)
? VK_IMAGE_LAYOUT_GENERAL
: VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
@ -746,10 +746,10 @@ static struct vk_texture vulkan_create_texture(vk_t *vk,
vkBeginCommandBuffer(staging, &begin_info);
/* If doing mipmapping on upload, keep in general
/* If doing mipmapping on upload, keep in general
* so we can easily do transfers to
* and transfers from the images without having to
* mess around with lots of extra transitions at
* mess around with lots of extra transitions at
* per-level granularity.
*/
VULKAN_IMAGE_LAYOUT_TRANSITION(
@ -1131,7 +1131,7 @@ static void gfx_display_vk_draw_pipeline(
case VIDEO_SHADER_MENU_4:
case VIDEO_SHADER_MENU_5:
draw->backend_data = ubo_scratch_data;
draw->backend_data_size = sizeof(math_matrix_4x4)
draw->backend_data_size = sizeof(math_matrix_4x4)
+ 4 * sizeof(float);
/* Match UBO layout in shader. */
@ -1146,9 +1146,9 @@ static void gfx_display_vk_draw_pipeline(
if (draw->pipeline_id == VIDEO_SHADER_MENU_5)
yflip = -1.0f;
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
+ 2 * sizeof(float), &t, sizeof(t));
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
+ 3 * sizeof(float), &yflip, sizeof(yflip));
draw->coords = &blank_coords;
blank_coords.vertices = 4;
@ -1248,8 +1248,8 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
default:
{
struct vk_draw_triangles call;
unsigned
disp_pipeline =
unsigned
disp_pipeline =
((draw->prim_type == GFX_DISPLAY_PRIM_TRIANGLESTRIP) << 1)
| (((vk->flags & VK_FLAG_DISPLAY_BLEND) > 0) << 0);
call.pipeline = vk->display.pipelines[disp_pipeline];
@ -1995,7 +1995,7 @@ static void vulkan_init_render_pass(
subpass.pPreserveAttachments = NULL;
/* Finally, create the renderpass. */
rp_info.sType =
rp_info.sType =
VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
rp_info.pNext = NULL;
rp_info.flags = 0;
@ -2080,7 +2080,7 @@ static void vulkan_init_pipeline_layout(
bindings[1].descriptorCount = 1;
bindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
bindings[1].pImmutableSamplers = NULL;
bindings[2].binding = 2;
bindings[2].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
bindings[2].descriptorCount = 1;
@ -2099,7 +2099,7 @@ static void vulkan_init_pipeline_layout(
bindings[4].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
bindings[4].pImmutableSamplers = NULL;
set_layout_info.sType =
set_layout_info.sType =
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
set_layout_info.pNext = NULL;
set_layout_info.flags = 0;
@ -2109,7 +2109,7 @@ static void vulkan_init_pipeline_layout(
vkCreateDescriptorSetLayout(vk->context->device,
&set_layout_info, NULL, &vk->pipelines.set_layout);
layout_info.sType =
layout_info.sType =
VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
layout_info.pNext = NULL;
layout_info.flags = 0;
@ -2367,10 +2367,10 @@ static void vulkan_init_pipelines(vk_t *vk)
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->display.pipelines[i]);
}
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);
blend_attachment.blendEnable = VK_TRUE;
blend_attachment.blendEnable = VK_TRUE;
#endif /* VULKAN_HDR_SWAPCHAIN */
vkDestroyShaderModule(vk->context->device, shader_stages[0].module, NULL);
@ -2602,7 +2602,7 @@ static void vulkan_init_textures(vk_t *vk)
static void vulkan_deinit_textures(vk_t *vk)
{
int i;
video_driver_state_t *video_st = video_state_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
/* Avoid memcpying from a destroyed/unmapped texture later on. */
const void *cached_frame = video_st->frame_cache_data;
if (vulkan_is_mapped_swapchain_texture_ptr(vk, cached_frame))
@ -2756,8 +2756,8 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
vk->filter_chain = vulkan_filter_chain_create_default(
&info,
vk->video.smooth
? GLSLANG_FILTER_CHAIN_LINEAR
vk->video.smooth
? GLSLANG_FILTER_CHAIN_LINEAR
: GLSLANG_FILTER_CHAIN_NEAREST);
if (!vk->filter_chain)
@ -2770,17 +2770,17 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
if (vk->context->flags & VK_CTX_FLAG_HDR_ENABLE)
{
struct video_shader* shader_preset = vulkan_filter_chain_get_preset(
vk->filter_chain);
vk->filter_chain);
VkFormat rt_format = (shader_preset && shader_preset->passes)
? vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1)
? vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1)
: VK_FORMAT_UNDEFINED;
bool emits_hdr10 = shader_preset && shader_preset->passes && vulkan_filter_chain_emits_hdr10(vk->filter_chain);
switch (rt_format)
{
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
/* If the last shader pass uses a RGB10A2 back buffer
* and HDR has been enabled, assume we want to skip
/* If the last shader pass uses a RGB10A2 back buffer
* and HDR has been enabled, assume we want to skip
* the inverse tonemapper and HDR10 conversion.
* If we just inherited HDR10 format based on backbuffer,
* we would have used RGBA8, and thus we should do inverse tonemap as expected. */
@ -2789,8 +2789,8 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_R16G16B16A16_SFLOAT:
/* If the last shader pass uses a RGBA16 backbuffer
* and HDR has been enabled, assume we want to
/* If the last shader pass uses a RGBA16 backbuffer
* and HDR has been enabled, assume we want to
* skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, true);
@ -2802,7 +2802,7 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
vulkan_set_hdr10(vk, true);
break;
}
}
}
#endif /* VULKAN_HDR_SWAPCHAIN */
return true;
@ -2830,7 +2830,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
vk->filter_chain = vulkan_filter_chain_create_from_preset(
&info, shader_path,
vk->video.smooth
? GLSLANG_FILTER_CHAIN_LINEAR
? GLSLANG_FILTER_CHAIN_LINEAR
: GLSLANG_FILTER_CHAIN_NEAREST);
if (!vk->filter_chain)
@ -2842,17 +2842,17 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
#ifdef VULKAN_HDR_SWAPCHAIN
if (vk->context->flags & VK_CTX_FLAG_HDR_ENABLE)
{
struct video_shader* shader_preset = vulkan_filter_chain_get_preset(vk->filter_chain);
VkFormat rt_format = (shader_preset && shader_preset->passes)
? vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1)
struct video_shader* shader_preset = vulkan_filter_chain_get_preset(vk->filter_chain);
VkFormat rt_format = (shader_preset && shader_preset->passes)
? vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1)
: VK_FORMAT_UNDEFINED;
bool emits_hdr10 = shader_preset && shader_preset->passes && vulkan_filter_chain_emits_hdr10(vk->filter_chain);
switch (rt_format)
{
case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
/* If the last shader pass uses a RGB10A2 backbuffer
* and HDR has been enabled, assume we want to
/* If the last shader pass uses a RGB10A2 backbuffer
* and HDR has been enabled, assume we want to
* skip the inverse tonemapper and HDR10 conversion
* If we just inherited HDR10 format based on backbuffer,
* we would have used RGBA8, and thus we should do inverse tonemap as expected. */
@ -2861,8 +2861,8 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
vk->flags |= VK_FLAG_SHOULD_RESIZE;
break;
case VK_FORMAT_R16G16B16A16_SFLOAT:
/* If the last shader pass uses a RGBA16 backbuffer
* and HDR has been enabled, assume we want to
/* If the last shader pass uses a RGBA16 backbuffer
* and HDR has been enabled, assume we want to
* skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, true);
@ -2874,7 +2874,7 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
vulkan_set_hdr10(vk, true);
break;
}
}
}
#endif /* VULKAN_HDR_SWAPCHAIN */
return true;
@ -3171,7 +3171,7 @@ static void vulkan_init_readback(vk_t *vk, settings_t *settings)
* driver.recording_data, because recording is
* not initialized yet.
*/
recording_state_t
recording_state_t
*recording_st = recording_state_get_ptr();
bool recording_enabled = recording_st->enable;
bool video_gpu_record = settings->bools.video_gpu_record;
@ -3251,7 +3251,7 @@ static void *vulkan_init(const video_info_t *video,
vk->ctx_driver = ctx_driver;
video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver);
RARCH_LOG("[Vulkan]: Found vulkan context: \"%s\".\n", ctx_driver->ident);
if (vk->ctx_driver->get_video_size)
@ -3341,7 +3341,7 @@ static void *vulkan_init(const video_info_t *video,
mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->mvp = vk->mvp_no_rot;
mapped_ubo->mvp = vk->mvp_no_rot;
mapped_ubo->max_nits = settings->floats.video_hdr_max_nits;
mapped_ubo->paper_white_nits = settings->floats.video_hdr_paper_white_nits;
mapped_ubo->contrast = VIDEO_HDR_MAX_CONTRAST - settings->floats.video_hdr_display_contrast;
@ -3380,11 +3380,11 @@ static void *vulkan_init(const video_info_t *video,
vulkan_create_descriptor_manager(
vk->context->device,
pool_sizes, 4, vk->pipelines.set_layout);
vk->swapchain[i].vbo =
vk->swapchain[i].vbo =
vulkan_buffer_chain_init(
VULKAN_BUFFER_BLOCK_SIZE, 16,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT);
vk->swapchain[i].ubo =
vk->swapchain[i].ubo =
vulkan_buffer_chain_init(
VULKAN_BUFFER_BLOCK_SIZE,
vk->context->gpu_properties.limits.minUniformBufferOffsetAlignment,
@ -3924,6 +3924,7 @@ static void vulkan_inject_black_frame(vk_t *vk, video_frame_info_t *video_info)
#endif
}
#if defined(HAVE_MENU)
/* VBO will be written to here. */
static void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
{
@ -4043,6 +4044,7 @@ static void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
/* Draw the quad */
vkCmdDraw(vk->cmd, 6, 1, 0, 0);
}
#endif
static bool vulkan_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height,
@ -4104,10 +4106,10 @@ static bool vulkan_frame(void *data, const void *frame,
/* Start recording the command buffer. */
vk->cmd = chain->cmd;
begin_info.sType =
begin_info.sType =
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
begin_info.pNext = NULL;
begin_info.flags =
begin_info.flags =
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
begin_info.pInheritanceInfo = NULL;
@ -4127,10 +4129,10 @@ static bool vulkan_frame(void *data, const void *frame,
for (i = 0; i < 16; i++)
vk->tracker.mvp.data[i] = 0.0f;
waits_for_semaphores =
waits_for_semaphores =
(vk->flags & VK_FLAG_HW_ENABLE)
&& frame
&& !vk->hw.num_cmd
&& !vk->hw.num_cmd
&& (vk->flags & VK_FLAG_HW_VALID_SEMAPHORE);
if ( waits_for_semaphores
@ -4251,7 +4253,7 @@ static bool vulkan_frame(void *data, const void *frame,
else
{
/* Fall back to the default, black texture.
* This can happen if we restart the video
* This can happen if we restart the video
* driver while in the menu. */
input.width = vk->default_texture.width;
input.height = vk->default_texture.height;
@ -4267,7 +4269,7 @@ static bool vulkan_frame(void *data, const void *frame,
else
{
struct vk_texture *tex = &vk->swapchain[vk->last_valid_index].texture;
if (vk->swapchain[vk->last_valid_index].texture_optimal.memory
if (vk->swapchain[vk->last_valid_index].texture_optimal.memory
!= VK_NULL_HANDLE)
tex = &vk->swapchain[vk->last_valid_index].texture_optimal;
else if (tex->image)
@ -4431,7 +4433,7 @@ static bool vulkan_frame(void *data, const void *frame,
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->mvp = vk->mvp_no_rot;
mapped_ubo->mvp = vk->mvp_no_rot;
rp_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
rp_info.pNext = NULL;
@ -4460,7 +4462,7 @@ static bool vulkan_frame(void *data, const void *frame,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
/* Begin render pass and set up viewport */
vkCmdBeginRenderPass(vk->cmd, &rp_info, VK_SUBPASS_CONTENTS_INLINE);
@ -4469,7 +4471,7 @@ static bool vulkan_frame(void *data, const void *frame,
if (vk->pipelines.hdr != vk->tracker.pipeline)
{
vkCmdBindPipeline(vk->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, vk->pipelines.hdr);
vk->tracker.pipeline = vk->pipelines.hdr;
/* Changing pipeline invalidates dynamic state. */
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
@ -4481,14 +4483,14 @@ static bool vulkan_frame(void *data, const void *frame,
VkDescriptorImageInfo image_info;
VkDescriptorSet set = vulkan_descriptor_manager_alloc(
vk->context->device,
&vk->chain->descriptor_manager);
&vk->chain->descriptor_manager);
VULKAN_SET_UNIFORM_BUFFER(vk->context->device,
set,
0,
vk->hdr.ubo.buffer,
0,
vk->hdr.ubo.size);
vk->hdr.ubo.size);
image_info.sampler = vk->samplers.nearest;
image_info.imageView = vk->main_buffer.view;
@ -4504,9 +4506,9 @@ static bool vulkan_frame(void *data, const void *frame,
write.pImageInfo = &image_info;
write.pBufferInfo = NULL;
write.pTexelBufferView = NULL;
vkUpdateDescriptorSets(vk->context->device, 1, &write, 0, NULL);
vkCmdBindDescriptorSets(vk->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS,
vk->pipelines.layout, 0,
1, &set, 0, NULL);
@ -4547,14 +4549,14 @@ static bool vulkan_frame(void *data, const void *frame,
color.r = 1.0f;
color.g = 1.0f;
color.b = 1.0f;
color.a = 1.0f;
color.a = 1.0f;
VULKAN_WRITE_QUAD_VBO(pv, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, &color);
}
vkCmdBindVertexBuffers(vk->cmd, 0, 1,
&range.buffer, &range.offset);
}
}
vkCmdDraw(vk->cmd, 6, 1, 0, 0);
@ -4568,19 +4570,19 @@ static bool vulkan_frame(void *data, const void *frame,
*/
vulkan_filter_chain_end_frame((vulkan_filter_chain_t*)vk->filter_chain, vk->cmd);
if (
if (
(backbuffer->image != VK_NULL_HANDLE)
&& (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN)
)
{
if ( (vk->flags & VK_FLAG_READBACK_PENDING)
if ( (vk->flags & VK_FLAG_READBACK_PENDING)
|| (vk->flags & VK_FLAG_READBACK_STREAMED))
{
/* We cannot safely read back from an image which
* has already been presented as we need to
* maintain the PRESENT_SRC_KHR layout.
*
* If we're reading back,
* If we're reading back,
* perform the readback before presenting.
*/
VULKAN_IMAGE_LAYOUT_TRANSITION(
@ -4703,7 +4705,7 @@ static bool vulkan_frame(void *data, const void *frame,
submit_info.signalSemaphoreCount = 0;
if ((vk->context->swapchain_semaphores[swapchain_index]
if ((vk->context->swapchain_semaphores[swapchain_index]
!= VK_NULL_HANDLE)
&& (vk->context->flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN))
signal_semaphores[submit_info.signalSemaphoreCount++] = vk->context->swapchain_semaphores[swapchain_index];
@ -4739,7 +4741,7 @@ static bool vulkan_frame(void *data, const void *frame,
#ifdef VULKAN_HDR_SWAPCHAIN
bool video_hdr_enable = video_info->hdr_enable;
if ( (vk->flags & VK_FLAG_SHOULD_RESIZE)
|| (((vk->context->flags & VK_CTX_FLAG_HDR_ENABLE) > 0)
|| (((vk->context->flags & VK_CTX_FLAG_HDR_ENABLE) > 0)
!= video_hdr_enable))
#else
if (vk->flags & VK_FLAG_SHOULD_RESIZE)
@ -4865,7 +4867,7 @@ static bool vulkan_frame(void *data, const void *frame,
}
if (vk->context->flags & VK_CTX_FLAG_INVALID_SWAPCHAIN)
vulkan_check_swapchain(vk);
vulkan_check_swapchain(vk);
/* Disable BFI during fast forward, slow-motion,
* and pause to prevent flicker. */
@ -4877,7 +4879,7 @@ static bool vulkan_frame(void *data, const void *frame,
&& !runloop_is_slowmotion
&& !runloop_is_paused
&& (!(vk->flags & VK_FLAG_MENU_ENABLE)))
{
{
int n;
for (n = 0; n < (int) black_frame_insertion; ++n)
{
@ -4887,7 +4889,7 @@ static bool vulkan_frame(void *data, const void *frame,
}
}
/* Vulkan doesn't directly support swap_interval > 1,
/* Vulkan doesn't directly support swap_interval > 1,
* so we fake it by duping out more frames. */
if ( (vk->context->swap_interval > 1)
&& (!(vk->context->flags & VK_CTX_FLAG_SWAP_INTERVAL_EMULATION_LOCK)))
@ -5032,7 +5034,7 @@ static void vulkan_set_texture_frame(void *data,
vkGetPhysicalDeviceFormatProperties(vk->context->gpu, VK_FORMAT_B4G4R4A4_UNORM_PACK16, &formatProperties);
if (formatProperties.optimalTilingFeatures != 0)
{
static const VkComponentMapping br_swizzle =
static const VkComponentMapping br_swizzle =
{VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_A};
/* B4G4R4A4 must be supported, but R4G4B4A4 is optional,
* just apply the swizzle in the image view instead. */
@ -5048,16 +5050,16 @@ static void vulkan_set_texture_frame(void *data,
texture_optimal = &vk->menu.textures_optimal[idx];
*texture = vulkan_create_texture(vk,
texture->memory
? texture
texture->memory
? texture
: NULL,
width,
height,
fmt,
NULL,
ptr_swizzle,
texture_optimal->memory
? VULKAN_TEXTURE_STAGING
texture_optimal->memory
? VULKAN_TEXTURE_STAGING
: VULKAN_TEXTURE_STREAMED);
vkMapMemory(vk->context->device, texture->memory,
@ -5096,8 +5098,8 @@ static void vulkan_set_texture_frame(void *data,
if (texture->type == VULKAN_TEXTURE_STAGING)
*texture_optimal = vulkan_create_texture(vk,
texture_optimal->memory
? texture_optimal
texture_optimal->memory
? texture_optimal
: NULL,
width,
height,
@ -5179,7 +5181,7 @@ static uintptr_t vulkan_load_texture(void *video_data, void *data,
return (uintptr_t)texture;
}
static void vulkan_unload_texture(void *data,
static void vulkan_unload_texture(void *data,
bool threaded, uintptr_t handle)
{
vk_t *vk = (vk_t*)data;
@ -5270,7 +5272,7 @@ static const video_poke_interface_t vulkan_poke_interface = {
vulkan_get_current_shader,
vulkan_get_current_sw_framebuffer,
vulkan_get_hw_render_interface,
#ifdef VULKAN_HDR_SWAPCHAIN
#ifdef VULKAN_HDR_SWAPCHAIN
vulkan_set_hdr_max_nits,
vulkan_set_hdr_paper_white_nits,
vulkan_set_hdr_contrast,

View File

@ -56,7 +56,7 @@
#include "drivers_shader/slang_process.h"
#endif
/* Maximum depth of chain of referenced shader presets.
/* Maximum depth of chain of referenced shader presets.
* 16 seems to be a very large number of references at the moment. */
#define SHADER_MAX_REFERENCE_DEPTH 16
#define SHADER_NUM_WILDCARDS 15
@ -94,13 +94,13 @@ static path_change_data_t *file_change_data = NULL;
* Takes a path and returns an absolute path.
* It will expand it if the path was using the root path format.
* e.g. :\shaders
* If the path was relative it will take this path and get the
* If the path was relative it will take this path and get the
* absolute path using in_refpath as the path to extract a base path.
*
* out_path is filled with the absolute path
**/
static void fill_pathname_expanded_and_absolute(char *out_path,
const char *in_refpath,
const char *in_refpath,
const char *in_path)
{
char expanded_path[PATH_MAX_LENGTH];
@ -123,24 +123,24 @@ static void fill_pathname_expanded_and_absolute(char *out_path,
/**
* video_shader_replace_wildcards:
*
*
* @param inout_absolute_path
* Absolute path to replace wildcards in
*
*
* @param in_preset_path
* Path of the preset that this path is being used in
*
* All the wildcards are replaced by the live values which come from retroarch
* or the preset context
*
*
* Possible wildcards/tokens to be replaced:
*
*
* $CONTENT-DIR$ -> Content Directory of the game rom
*
*
* $CORE$ -> Core name
*
*
* $GAME$ -> Game ROM's name
*
*
* $VID-DRV$ -> Video Driver: Currently active driver, possible replacement values:
* glcore
* gl
@ -148,58 +148,58 @@ static void fill_pathname_expanded_and_absolute(char *out_path,
* d3d11
* d3d9_hlsl
* "N/A"
*
*
* $VID-DRV-SHADER-EXT$ -> Video Driver Shader File Extension: The extension of shaders type supported by the current video driver:
* cg
* glsl
* slang
*
*
* $VID-DRV-PRESET-EXT$ -> Video Driver Preset File Extension: The extension of shaders type supported by the current video driver:
* cgp
* glslp
* slangp
*
*
* $CORE-REQ-ROT$ -> Core Requested Rotation: Rotation the core is requesting, possible replacement values:
* CORE-REQ-ROT-0
* CORE-REQ-ROT-90
* CORE-REQ-ROT-180
* CORE-REQ-ROT-270
*
*
* $VID-ALLOW-CORE-ROT$ -> Video Allow Core Rotation: Reflect's Retroarch's setting allowing the core requested rotation to affect the final rotation:
* VID-ALLOW-CORE-ROT-OFF
* VID-ALLOW-CORE-ROT-ON
*
*
* $VID-USER-ROT$ -> Video User Rotation: Rotation the core is requesting, possible replacement values, does not affect the UI:
* VID-USER-ROT-0
* VID-USER-ROT-90
* VID-USER-ROT-180
* VID-USER-ROT-270
*
*
* $VID-FINAL-ROT$ -> Video Final Rotation: Rotation which is the sum of the user rotation and the core rotation if it has been allowed, does not affect the UI:
* VID-FINAL-ROT-0
* VID-FINAL-ROT-90
* VID-FINAL-ROT-180
* VID-FINAL-ROT-270
*
*
* $SCREEN-ORIENT$ -> Screen Orientation: User adjusted screen orientation, will change windows from landscape to portrait, including the Retroarch UI:
* SCREEN-ORIENT-0
* SCREEN-ORIENT-90
* SCREEN-ORIENT-180
* SCREEN-ORIENT-270
*
*
* $VIEW-ASPECT-ORIENT$ -> Viewport Aspect Orientation: Orientation of the aspect ratio of the retroarch viewport
* VIEW-ASPECT-ORIENT-HORZ
* VIEW-ASPECT-ORIENT-VERT
*
*
* $CORE-ASPECT-ORIENT$ -> Core Aspect Orientation: Orientation of the aspect ratio requested by the core
* CORE-ASPECT-ORIENT-HORZ
* CORE-ASPECT-ORIENT-VERT
*
*
* $PRESET_DIR$ -> Preset directory's name
*
*
* $PRESET$ -> Preset's name
*
* If no wildcards are found within the path, or the path
*
* If no wildcards are found within the path, or the path
* after replacing the wildcards does not exist on disk,
* the path returned will be uneffected.
**/
@ -213,9 +213,9 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
return;
strlcpy(replaced_path, inout_absolute_path, sizeof(replaced_path));
/* Step through the wildcards while we can still find the
* delimiter in the replaced path
* delimiter in the replaced path
*/
for (i = 0; (i < SHADER_NUM_WILDCARDS) && (strstr(replaced_path, RARCH_WILDCARD_DELIMITER)); i++)
{
@ -226,13 +226,13 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
switch (wildcard_tokens[i].token_id)
{
case RARCH_WILDCARD_CONTENT_DIR:
case RARCH_WILDCARD_CONTENT_DIR:
{
char content_dir_name[PATH_MAX_LENGTH] = "";
const char* rarch_path_basename = path_get(RARCH_PATH_BASENAME);
if (rarch_path_basename)
fill_pathname_parent_dir_name(content_dir_name,
rarch_path_basename,
fill_pathname_parent_dir_name(content_dir_name,
rarch_path_basename,
sizeof(content_dir_name));
if (string_is_not_equal_fast(content_dir_name, "", sizeof("")))
strlcpy(content_dir_name,
@ -245,7 +245,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
strlcpy(replace_text, content_dir_name, sizeof(replace_text));
}
break;
case RARCH_WILDCARD_CORE:
case RARCH_WILDCARD_CORE:
strlcpy(replace_text, runloop_state_get_ptr()->system.info.library_name, sizeof(replace_text));
break;
case RARCH_WILDCARD_GAME:
@ -316,9 +316,9 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
case RARCH_WILDCARD_CORE_ASPECT_ORIENTATION:
{
const int requested_rotation = retroarch_get_core_requested_rotation();
strlcpy(replace_text, (video_driver_get_core_aspect() < 1 || requested_rotation == 1 || requested_rotation == 3) ?
"CORE-ASPECT-ORIENT-VERT" :
"CORE-ASPECT-ORIENT-HORZ",
strlcpy(replace_text, (video_driver_get_core_aspect() < 1 || requested_rotation == 1 || requested_rotation == 3) ?
"CORE-ASPECT-ORIENT-VERT" :
"CORE-ASPECT-ORIENT-HORZ",
sizeof(replace_text));
}
break;
@ -327,9 +327,9 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
unsigned viewport_width = 0;
unsigned viewport_height = 0;
video_driver_get_size(&viewport_width, &viewport_height);
strlcpy(replace_text, ((float)viewport_width / viewport_height < 1) ?
"VIEW-ASPECT-ORIENT-VERT" :
"VIEW-ASPECT-ORIENT-HORZ",
strlcpy(replace_text, ((float)viewport_width / viewport_height < 1) ?
"VIEW-ASPECT-ORIENT-VERT" :
"VIEW-ASPECT-ORIENT-HORZ",
sizeof(replace_text));
}
break;
@ -380,7 +380,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
strlen(replace_text));
strlcpy(replaced_path, replace_output, PATH_MAX_LENGTH);
free(replace_output);
}
}
@ -401,7 +401,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
/**
* video_shader_gather_reference_path_list:
*
*
* @param path_linked_list
* List of paths which accrues as we move down the chain of references
* @param path
@ -412,8 +412,8 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
* @return void
**/
static void video_shader_gather_reference_path_list(
struct path_linked_list *in_path_linked_list,
char *path,
struct path_linked_list *in_path_linked_list,
char *path,
int reference_depth)
{
config_file_t *conf = NULL;
@ -528,7 +528,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
struct config_entry_list *entry = NULL;
scale_type[0] = scale_type_x[0] =
scale_type_y[0] = '\0';
scale_type_y[0] = '\0';
formatted_num[0] = shader_var[0] = '\0';
snprintf(formatted_num, sizeof(formatted_num), "%u", i);
@ -559,7 +559,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
/* Wrapping mode */
_len = strlcpy(shader_var, "wrap_mode", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if ((entry = config_get_entry(conf, shader_var))
if ((entry = config_get_entry(conf, shader_var))
&& !string_is_empty(entry->value))
pass->wrap = video_shader_wrap_str_to_mode(entry->value);
entry = NULL;
@ -567,7 +567,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
/* Frame count mod */
_len = strlcpy(shader_var, "frame_count_mod", sizeof(shader_var));
strlcpy(shader_var + _len, formatted_num, sizeof(shader_var) - _len);
if ((entry = config_get_entry(conf, shader_var))
if ((entry = config_get_entry(conf, shader_var))
&& !string_is_empty(entry->value))
pass->frame_count_mod = (unsigned)strtoul(entry->value, NULL, 0);
entry = NULL;
@ -790,8 +790,8 @@ static bool video_shader_parse_textures(config_file_t *conf,
strlcpy(idx + _len, "_linear", sizeof(idx) - _len);
if (config_get_bool(conf, idx, &smooth))
shader->lut[shader->luts].filter = smooth
? RARCH_FILTER_LINEAR
shader->lut[shader->luts].filter = smooth
? RARCH_FILTER_LINEAR
: RARCH_FILTER_NEAREST;
else
shader->lut[shader->luts].filter = RARCH_FILTER_UNSPEC;
@ -804,7 +804,7 @@ static bool video_shader_parse_textures(config_file_t *conf,
strlcpy(idx + _len, "_wrap_mode", sizeof(idx) - _len);
entry = NULL;
if ((entry = config_get_entry(conf, idx))
if ((entry = config_get_entry(conf, idx))
&& !string_is_empty(entry->value))
shader->lut[shader->luts].wrap = video_shader_wrap_str_to_mode(entry->value);
entry = NULL;
@ -850,7 +850,7 @@ static struct video_shader_parameter *video_shader_parse_find_parameter(
*
* Resolves all shader parameters belonging to shaders
* from the #pragma parameter lines in the shader for each pass.
*
*
**/
void video_shader_resolve_parameters(struct video_shader *shader)
{
@ -876,18 +876,18 @@ void video_shader_resolve_parameters(struct video_shader *shader)
if (!path_is_valid(path))
continue;
/* First try to use the more robust slang implementation
/* First try to use the more robust slang implementation
* to support #includes. */
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
/* FIXME: The check for slang can be removed
* if it's sufficiently tested for GLSL/Cg as well,
* it should be the same implementation.
* The problem with switching currently is that it looks
* for a #version string in the first line of the file
* if it's sufficiently tested for GLSL/Cg as well,
* it should be the same implementation.
* The problem with switching currently is that it looks
* for a #version string in the first line of the file
* which glsl doesn't have */
if ( string_is_equal(path_get_extension(path), "slang")
if ( string_is_equal(path_get_extension(path), "slang")
&& slang_preprocess_parse_parameters(path, shader))
continue;
#endif
@ -913,11 +913,11 @@ void video_shader_resolve_parameters(struct video_shader *shader)
if (!lines_inited)
continue;
/* Even though the pass is set in the loop too,
/* Even though the pass is set in the loop too,
* not all passes have parameters */
param->pass = (int)i;
while ((shader->num_parameters < ARRAY_SIZE(shader->parameters))
while ((shader->num_parameters < ARRAY_SIZE(shader->parameters))
&& (line_index < lines.size))
{
int ret;
@ -984,13 +984,13 @@ bool video_shader_load_current_parameter_values(
for (i = 0; i < shader->num_parameters; i++)
{
const struct config_entry_list *entry = config_get_entry(conf, shader->parameters[i].id);
/* Only try to load the parameter value if an entry exists in the config */
if (entry)
{
struct video_shader_parameter *parameter = (struct video_shader_parameter*)
video_shader_parse_find_parameter(shader->parameters,
shader->num_parameters,
video_shader_parse_find_parameter(shader->parameters,
shader->num_parameters,
shader->parameters[i].id);
/* Log each parameter read */
@ -1025,7 +1025,7 @@ static const char *video_shader_scale_type_to_str(enum gfx_scale_type type)
static void video_shader_write_scale_dim(config_file_t *conf,
const char *dim,
const char *formatted_num,
enum gfx_scale_type type,
enum gfx_scale_type type,
float scale,
unsigned absolute)
{
@ -1071,7 +1071,7 @@ static void video_shader_write_fbo(config_file_t *conf,
* @shader : Shader passes handle.
* @preset_path : Optional path to where the preset will be written.
*
* Writes preset and all associated state (passes, textures, imports,
* Writes preset and all associated state (passes, textures, imports,
* etc) into @conf.
* If @preset_path is not NULL, shader paths are saved relative to it.
**/
@ -1194,7 +1194,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
char k[128];
size_t _len = strlcpy(k, shader->lut[i].id, sizeof(k));
strlcpy(k + _len, "_linear", sizeof(k) - _len);
config_set_string(conf, k,
config_set_string(conf, k,
(shader->lut[i].filter == RARCH_FILTER_LINEAR)
? "true"
: "false");
@ -1245,9 +1245,9 @@ static config_file_t *video_shader_get_root_preset_config(const char *path)
{
/* If we have reached the max depth of nested references,
* stop attempting to read the next reference,
* because we are likely in a self referential loop.
* because we are likely in a self referential loop.
*
* SHADER_MAX_REFERENCE_DEPTH references deep seems
* SHADER_MAX_REFERENCE_DEPTH references deep seems
* like more than enough depth for expected usage */
if (reference_depth > SHADER_MAX_REFERENCE_DEPTH)
{
@ -1285,33 +1285,33 @@ static config_file_t *video_shader_get_root_preset_config(const char *path)
/**
* video_shader_check_reference_chain:
* @param path_to_save
* Path of the preset we want to validate is safe to save as
* Path of the preset we want to validate is safe to save as
* a simple preset.
* @param reference_path
* Path of the reference which we would want to write into
* Path of the reference which we would want to write into
* the new preset.
*
* Checks to see if we can save a valid simple preset
*
* Checks to see if we can save a valid simple preset
* (preset with a #reference in it) to this path.
*
* This takes into account reference links which can't be
* loaded and if saving this file would create a creating
*
* This takes into account reference links which can't be
* loaded and if saving this file would create a creating
* circular reference chain, because some link in
* the chain references the file path we want to save to.
*
*
* Checks each preset in the chain of presets with #reference
* Starts with reference_path. If it has no reference, then
* Starts with reference_path. If it has no reference, then
* our check is valid.
* If it has a #reference, then check that the reference path
* If it has a #reference, then check that the reference path
* is not the same as path_to_save.
* If it is not the same path, then go the the next nested reference
*
* Continues this until it finds a preset without #reference in it,
*
* Continues this until it finds a preset without #reference in it,
* or it hits the maximum recursion depth (at that point
* it is probably in a self referential cycle)
*
* @return true (1) if it was able to load all presets and
*
* @return true (1) if it was able to load all presets and
* found a full preset, otherwise false (0).
**/
static bool video_shader_check_reference_chain_for_save(
@ -1335,7 +1335,7 @@ static bool video_shader_check_reference_chain_for_save(
while (conf->references)
{
/* If we have reached the max depth of nested references stop attempting to read
/* If we have reached the max depth of nested references stop attempting to read
* the next reference because we are likely in a self referential loop. */
if (ref_depth > SHADER_MAX_REFERENCE_DEPTH)
{
@ -1349,7 +1349,7 @@ static bool video_shader_check_reference_chain_for_save(
fill_pathname_expanded_and_absolute(nested_ref_path, conf->path, conf->references->path);
video_shader_replace_wildcards(nested_ref_path, PATH_MAX_LENGTH, conf->path);
/* If one of the reference paths is the same as the file we want to save then this reference chain would be
/* If one of the reference paths is the same as the file we want to save then this reference chain would be
* self-referential / cyclical and we can't save this as a simple preset*/
if (string_is_equal(nested_ref_path, path_to_save_conformed))
{
@ -1400,8 +1400,8 @@ static bool video_shader_check_reference_chain_for_save(
*
* Writes a referenced preset to disk
* A referenced preset is a preset which includes the #reference directive
* as it's first line to specify a root preset and can also
* include parameter and texture values to override the values
* as it's first line to specify a root preset and can also
* include parameter and texture values to override the values
* of the root preset
*
* @return false if a referenced preset cannot be saved
@ -1434,9 +1434,9 @@ static bool video_shader_write_referenced_preset(
path_basedir(new_preset_basedir);
/* Get the retroarch config dir where the automatically
/* Get the retroarch config dir where the automatically
* loaded presets are located
* and where Save Game Preset, Save Core Preset,
* and where Save Game Preset, Save Core Preset,
* Save Global Preset save to */
fill_pathname_application_special(config_dir, PATH_MAX_LENGTH,
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
@ -1450,7 +1450,7 @@ static bool video_shader_write_referenced_preset(
goto end;
}
/* If the initial preset loaded is the ever-changing retroarch
/* If the initial preset loaded is the ever-changing retroarch
* preset don't save a reference
* TODO/FIXME - remove once we don't write this preset anymore */
if (!strncmp(path_basename_nocompression(shader->loaded_preset_path),
@ -1467,7 +1467,7 @@ static bool video_shader_write_referenced_preset(
pathname_conform_slashes_to_os(path_to_ref);
/* Get a config from the file we want to make a reference to */
/* If the original preset can't be loaded, probably because
/* If the original preset can't be loaded, probably because
* it isn't there anymore */
if (!(ref_conf = config_file_new_from_path_to_string(path_to_ref)))
{
@ -1477,17 +1477,17 @@ static bool video_shader_write_referenced_preset(
goto end;
}
/* If we are trying to save on top the path referenced in the
/* If we are trying to save on top the path referenced in the
* initially loaded preset.
*
* E.G. Preset_B references Preset_A, I load Preset_B do some
* parameter adjustments,
* then I save on top of Preset_A, we want to get a preset
* just like the original Preset_A with the new parameter
* E.G. Preset_B references Preset_A, I load Preset_B do some
* parameter adjustments,
* then I save on top of Preset_A, we want to get a preset
* just like the original Preset_A with the new parameter
* adjustments.
*
* If there is a reference in the initially loaded preset,
* we should check it against the preset path we are currently
* we should check it against the preset path we are currently
* trying to save */
if (ref_conf->references)
{
@ -1497,7 +1497,7 @@ static bool video_shader_write_referenced_preset(
pathname_conform_slashes_to_os(abs_tmp_ref_path);
/* If the reference is the same as the path we are trying to save to
/* If the reference is the same as the path we are trying to save to
then this should be used as the reference to save */
if (string_is_equal(abs_tmp_ref_path, path_to_save_conformed))
{
@ -1508,23 +1508,23 @@ static bool video_shader_write_referenced_preset(
}
}
/*
* If
* The new preset file we are trying to save is the
/*
* If
* The new preset file we are trying to save is the
* same as the initially loaded preset
* or
* The initially loaded preset was located under the
* The initially loaded preset was located under the
* retroarch config folder
* this means that it was likely saved from inside the retroarch UI
* Then
* We should not save a preset with a reference to the initially loaded
* preset file itself, instead we need to save a new preset with
* preset file itself, instead we need to save a new preset with
* the same reference as was in the initially loaded preset.
*/
/* If the reference path is the same as the path we want to save
/* If the reference path is the same as the path we want to save
* or the reference path is in the config (auto shader) folder */
if ( string_is_equal(path_to_ref, path_to_save_conformed)
if ( string_is_equal(path_to_ref, path_to_save_conformed)
|| !strncmp(config_dir, path_to_ref, strlen(config_dir)))
{
/* If the config from the reference path has a reference in it,
@ -1535,8 +1535,8 @@ static bool video_shader_write_referenced_preset(
fill_pathname_expanded_and_absolute(path_to_ref, ref_conf->path, ref_conf->references->path);
video_shader_replace_wildcards(path_to_ref, PATH_MAX_LENGTH, ref_conf->path);
/* If the reference path is also the same as what
* we are trying to save
/* If the reference path is also the same as what
* we are trying to save
This can easily happen
E.G.
- Save Preset As
@ -1566,7 +1566,7 @@ static bool video_shader_write_referenced_preset(
}
}
}
/* If there is no reference in the initial preset we need to
/* If there is no reference in the initial preset we need to
* save a full preset */
else
{
@ -1578,7 +1578,7 @@ static bool video_shader_write_referenced_preset(
}
}
/* Check the reference chain that we would be saving to make sure it
/* Check the reference chain that we would be saving to make sure it
* is valid */
if (!video_shader_check_reference_chain_for_save(
path_to_save_conformed, path_to_ref))
@ -1613,13 +1613,13 @@ static bool video_shader_write_referenced_preset(
/* Add the reference path to the config */
config_file_add_reference(conf, path_to_ref);
/* Set modified to true so when you run config_file_write
/* Set modified to true so when you run config_file_write
* it will save a file */
conf->modified = true;
/*
Compare the shader to a shader created from the referenced
config to see if we can save a referenced preset and what
/*
Compare the shader to a shader created from the referenced
config to see if we can save a referenced preset and what
parameters and textures of the root_config are overridden
*/
@ -1632,13 +1632,13 @@ static bool video_shader_write_referenced_preset(
continue_saving_ref = false;
}
/* Compare all passes from the shader, if anything is different
* then we should not save a reference and instead save a
/* Compare all passes from the shader, if anything is different
* then we should not save a reference and instead save a
* full preset instead.
*/
if (continue_saving_ref)
{
/* Step through each pass comparing all the properties to
/* Step through each pass comparing all the properties to
* make sure they match */
for (i = 0; (i < shader->passes && continue_saving_ref);
i++)
@ -1728,7 +1728,7 @@ static bool video_shader_write_referenced_preset(
continue_saving_ref = false;
}
if ( continue_saving_ref
if ( continue_saving_ref
&& (fbo->flags & FBO_SCALE_FLAG_FP_FBO) != (root_fbo->flags & FBO_SCALE_FLAG_FP_FBO))
{
#ifdef DEBUG
@ -1737,7 +1737,7 @@ static bool video_shader_write_referenced_preset(
continue_saving_ref = false;
}
if (continue_saving_ref
if (continue_saving_ref
&& (fbo->flags & FBO_SCALE_FLAG_SRGB_FBO) != (root_fbo->flags &
FBO_SCALE_FLAG_SRGB_FBO))
{
@ -1747,7 +1747,7 @@ static bool video_shader_write_referenced_preset(
continue_saving_ref = false;
}
if (continue_saving_ref
if (continue_saving_ref
&& ((fbo->flags & FBO_SCALE_FLAG_VALID) != (root_fbo->flags & FBO_SCALE_FLAG_VALID)))
{
#ifdef DEBUG
@ -1788,10 +1788,10 @@ static bool video_shader_write_referenced_preset(
{
for (i = 0; i < shader->num_parameters; i++)
{
/* If the parameter's current value is different
* than the referenced shader then write the value
/* If the parameter's current value is different
* than the referenced shader then write the value
* into the new preset */
if ( shader->parameters[i].current
if ( shader->parameters[i].current
!= ref_shader->parameters[i].current)
config_set_float(conf, shader->parameters[i].id,
shader->parameters[i].current);
@ -1803,8 +1803,8 @@ static bool video_shader_write_referenced_preset(
{
for (i = 0; i < shader->luts; i++)
{
/* If the current shader texture path is different
* than the referenced shader texture then write the
/* If the current shader texture path is different
* than the referenced shader texture then write the
* current path into the new preset */
if (!string_is_equal(ref_shader->lut[i].path,
shader->lut[i].path))
@ -1852,13 +1852,13 @@ end:
* @param shader
* Shader handle.
*
* Loads preset file and all associated state
* Loads preset file and all associated state
* (passes, textures, imports, etc).
*
* @return true (1) if successful, otherwise false (0).
**/
static bool video_shader_load_root_config_into_shader(
config_file_t *conf,
config_file_t *conf,
settings_t *settings,
struct video_shader *shader)
{
@ -1882,20 +1882,20 @@ static bool video_shader_load_root_config_into_shader(
/* Set the path of the root preset for this shader */
strlcpy(shader->path, conf->path, sizeof(shader->path));
/* Set the path of the original preset which was loaded, for
* a full preset config this is the same as the root config
* For simple presets (using #reference) this different than
* the root preset and it is the path to the
* simple preset originally loaded, but that is set inside
/* Set the path of the original preset which was loaded, for
* a full preset config this is the same as the root config
* For simple presets (using #reference) this different than
* the root preset and it is the path to the
* simple preset originally loaded, but that is set inside
* video_shader_load_preset_into_shader*/
strlcpy(shader->loaded_preset_path,
strlcpy(shader->loaded_preset_path,
conf->path,
sizeof(shader->loaded_preset_path));
if (watch_files)
{
union string_list_elem_attr attr;
int flags =
int flags =
PATH_CHANGE_TYPE_MODIFIED |
PATH_CHANGE_TYPE_WRITE_FILE_CLOSED |
PATH_CHANGE_TYPE_FILE_MOVED |
@ -1977,24 +1977,24 @@ static bool video_shader_override_values(config_file_t *override_conf,
size_t i;
bool return_val = false;
if (!shader || !override_conf)
if (!shader || !override_conf)
return 0;
/* If the shader has parameters */
if (shader->num_parameters)
{
/* Step through the parameters in the shader and
/* Step through the parameters in the shader and
* see if there is an entry for each in the override config */
for (i = 0; i < shader->num_parameters; i++)
{
/* If the parameter is in the reference config */
if (config_get_entry(override_conf, shader->parameters[i].id))
{
struct video_shader_parameter *parameter =
struct video_shader_parameter *parameter =
(struct video_shader_parameter*)
video_shader_parse_find_parameter(
shader->parameters,
shader->num_parameters,
shader->parameters,
shader->num_parameters,
shader->parameters[i].id);
/* Set the shader's parameter value */
@ -2003,7 +2003,7 @@ static bool video_shader_override_values(config_file_t *override_conf,
#ifdef DEBUG
RARCH_DBG("[Shaders]: Parameter: \"%s\" = %f.\n",
shader->parameters[i].id,
shader->parameters[i].id,
shader->parameters[i].current);
#endif
@ -2021,7 +2021,7 @@ static bool video_shader_override_values(config_file_t *override_conf,
{
char *override_tex_path = (char*)malloc(PATH_MAX_LENGTH);
/* Step through the textures in the shader and see if there is an entry
/* Step through the textures in the shader and see if there is an entry
* for each in the override config */
for (i = 0; i < shader->luts; i++)
{
@ -2041,7 +2041,7 @@ static bool video_shader_override_values(config_file_t *override_conf,
#ifdef DEBUG
RARCH_DBG("[Shaders]: Texture: \"%s\" = %s.\n",
shader->lut[i].id,
shader->lut[i].id,
shader->lut[i].path);
#endif
@ -2068,8 +2068,8 @@ static bool video_shader_combine_shaders(
combined_shader->pass[i] = first_shader->pass[i];
combined_shader->passes += 1;
}
for (i = 0;
i < second_shader->passes && first_shader->passes + i <= GFX_MAX_SHADERS;
for (i = 0;
i < second_shader->passes && first_shader->passes + i <= GFX_MAX_SHADERS;
i++)
{
combined_shader->pass[first_shader->passes + i] = second_shader->pass[i];
@ -2147,15 +2147,15 @@ static bool video_shader_combine_shaders(
* @param shader
* Shader to write
* @param reference
* Whether a simple preset should be written
* Whether a simple preset should be written
* with the #reference to another preset in it.
*
* Writes a preset to disk. Can be written as a simple preset
* Writes a preset to disk. Can be written as a simple preset
* (With the #reference directive in it) or a full preset.
* @return true on success, otherwise false on failure
**/
bool video_shader_write_preset(const char *path,
const struct video_shader *shader,
const struct video_shader *shader,
bool reference)
{
if (!shader || string_is_empty(path))
@ -2181,12 +2181,12 @@ bool video_shader_write_preset(const char *path,
/**
* video_shader_load_preset_into_shader:
* @param path
* Path to preset file, could be a
* Path to preset file, could be a
* Simple Preset (including a #reference) or Full Preset.
* @param shader
* Shader.
*
* Loads preset file to a shader including passes, textures
* Loads preset file to a shader including passes, textures
* and parameters
*
* @return true on success, otherwise false on failure.
@ -2208,9 +2208,9 @@ bool video_shader_load_preset_into_shader(const char *path,
goto end;
}
/* Check if the root preset is a valid shader chain
If the config has a shaders entry then it is considered
a shader chain config, vs a config which may only have
/* Check if the root preset is a valid shader chain
If the config has a shaders entry then it is considered
a shader chain config, vs a config which may only have
parameter values and texture overrides
*/
if (!config_get_entry(root_conf, "shaders"))
@ -2221,7 +2221,7 @@ bool video_shader_load_preset_into_shader(const char *path,
goto end;
}
/* If the root_conf path matches the original path then
/* If the root_conf path matches the original path then
* there are no references so we just load it and go to the end */
if (string_is_equal(root_conf->path, path))
{
@ -2229,9 +2229,9 @@ bool video_shader_load_preset_into_shader(const char *path,
video_shader_load_root_config_into_shader(root_conf, config_get_ptr(), shader);
goto end;
}
/* Get the config from the initial preset file
* We don't need to check it's validity because it must
/* Get the config from the initial preset file
* We don't need to check it's validity because it must
* have been valid to get the root preset */
conf = config_file_new_from_path_to_string(path);
@ -2240,7 +2240,7 @@ bool video_shader_load_preset_into_shader(const char *path,
#endif
/**
* Check references starting with the second to make sure
* Check references starting with the second to make sure
* they do not have a shader chains in them
**/
path_list_tmp = (struct path_linked_list*)conf->references->next;
@ -2256,8 +2256,8 @@ bool video_shader_load_preset_into_shader(const char *path,
if ((tmp_conf = video_shader_get_root_preset_config(path_to_ref)))
{
/* Check if the config is a valid shader chain config
If the config has a shaders entry then it is considered
a shader chain config, vs a config which may only have
If the config has a shaders entry then it is considered
a shader chain config, vs a config which may only have
parameter values and texture overrides
*/
if (config_get_entry(tmp_conf, "shaders"))
@ -2292,9 +2292,9 @@ bool video_shader_load_preset_into_shader(const char *path,
override_paths_list = path_linked_list_new();
video_shader_gather_reference_path_list(override_paths_list, conf->path, 0);
/*
/*
* Step through the references and apply overrides for each one
* Start on the second item since the first is empty
* Start on the second item since the first is empty
*/
path_list_tmp = (struct path_linked_list*)override_paths_list;
while (path_list_tmp)
@ -2307,7 +2307,7 @@ bool video_shader_load_preset_into_shader(const char *path,
config_file_free(override_conf);
path_list_tmp = path_list_tmp->next;
}
#ifdef DEBUG
RARCH_DBG("[Shaders]: End apply overrides.\n\n");
#endif
@ -2913,7 +2913,7 @@ bool video_shader_combine_preset_and_apply(
const char *preset_ext = video_shader_get_preset_extension(type);
struct video_shader *shader_to_append = (struct video_shader*) calloc(1, sizeof(*shader_to_append));
struct video_shader *combined_shader = (struct video_shader*) calloc(1, sizeof(*combined_shader));
size_t _len = strlcpy(combined_preset_name, "retroarch", sizeof(combined_preset_name));
size_t _len = strlcpy(combined_preset_name, "retroarch", sizeof(combined_preset_name));
strlcpy(combined_preset_name + _len, preset_ext, sizeof(combined_preset_name) - _len);
fill_pathname_join(combined_preset_path, temp_dir, combined_preset_name, sizeof(combined_preset_path));
@ -2927,8 +2927,12 @@ bool video_shader_combine_preset_and_apply(
/* We save to the always changing retroarch.slangp, retroarch.glsp...
then load it so that it is similar to Apply Preset */
video_shader_write_preset(combined_preset_path, combined_shader, false);
#ifdef HAVE_MENU
ret = menu_shader_manager_set_preset(menu_shader, type, combined_preset_path, true);
#else
ret = true;
#endif
free(shader_to_append);
free(combined_shader);
@ -3069,7 +3073,7 @@ const char *video_shader_get_current_shader_preset(void)
return runloop_st->runtime_shader_preset_path;
/* load auto-shader once, --set-shader works like a global auto-shader */
if ( (video_st->flags & VIDEO_FLAG_SHADER_PRESETS_NEED_RELOAD)
if ( (video_st->flags & VIDEO_FLAG_SHADER_PRESETS_NEED_RELOAD)
&& !cli_shader_disable)
{
video_st->flags &= ~VIDEO_FLAG_SHADER_PRESETS_NEED_RELOAD;
@ -3103,17 +3107,19 @@ const char *video_shader_get_current_shader_preset(void)
void video_shader_toggle(settings_t *settings)
{
bool toggle = !settings->bools.video_shader_enable;
struct video_shader *shader = menu_shader_get();
#ifdef HAVE_MENU
struct video_shader *menu_shdr = menu_shader_get();
struct menu_state *menu_st = menu_state_get_ptr();
shader->flags |= SHDR_FLAG_MODIFIED;
menu_shdr->flags |= SHDR_FLAG_MODIFIED;
if (toggle)
shader->flags &= ~SHDR_FLAG_DISABLED;
menu_shdr->flags &= ~SHDR_FLAG_DISABLED;
else
shader->flags |= SHDR_FLAG_DISABLED;
menu_shdr->flags |= SHDR_FLAG_DISABLED;
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
| MENU_ST_FLAG_PREVENT_POPULATE;
#endif
command_event(CMD_EVENT_SHADERS_APPLY_CHANGES, NULL);

View File

@ -30,6 +30,7 @@ extern "C" {
#endif
#include <compat/strl.h>
#include <string/stdstring.h>
#ifndef _XBOX
#include "../../gfx/common/win32_common.h"
@ -74,7 +75,7 @@ typedef struct
double view_abs_ratio_y;
HWND window;
/* Dummy head for easier iteration */
struct winraw_pointer_status pointer_head;
struct winraw_pointer_status pointer_head;
RECT active_rect; /* Needed for checking for a windows size change */
RECT prev_rect; /* Needed for checking for a windows size change */
int rect_delay; /* Needed to delay resize of window */
@ -101,7 +102,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc)
wc.lpfnWndProc = wnd_proc;
wc.lpszClassName = "winraw-input";
if ( !RegisterClassA(&wc)
if ( !RegisterClassA(&wc)
&& GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
return NULL;
@ -286,7 +287,7 @@ static int16_t winraw_lightgun_aiming_state(winraw_input_t *wr,
&res_x, &res_y, &res_screen_x, &res_screen_y)))
return 0;
inside = (res_x >= -edge_detect)
inside = (res_x >= -edge_detect)
&& (res_y >= -edge_detect)
&& (res_x <= edge_detect)
&& (res_y <= edge_detect);
@ -359,7 +360,7 @@ static void winraw_init_mouse_xy_mapping(winraw_input_t *wr)
}
}
static void winraw_update_mouse_state(winraw_input_t *wr,
static void winraw_update_mouse_state(winraw_input_t *wr,
winraw_mouse_t *mouse, RAWMOUSE *state)
{
POINT crs_pos;
@ -675,7 +676,7 @@ static void winraw_poll(void *data)
/* Prevent LAlt sticky after unfocusing with Alt-Tab */
if ( !winraw_focus
&& wr->keyboard.keys[SC_LALT]
&& wr->keyboard.keys[SC_LALT]
&& !(GetKeyState(VK_MENU) & 0x8000))
{
wr->keyboard.keys[SC_LALT] = 0;
@ -742,7 +743,7 @@ static int16_t winraw_input_state(
if (port < MAX_USERS)
{
bool process_mouse =
bool process_mouse =
(device == RETRO_DEVICE_JOYPAD)
|| (device == RETRO_DEVICE_MOUSE)
|| (device == RARCH_DEVICE_MOUSE_SCREEN)
@ -792,7 +793,7 @@ static int16_t winraw_input_state(
{
if (binds[port][i].valid)
{
if ((binds[port][i].key < RETROK_LAST) &&
if ((binds[port][i].key < RETROK_LAST) &&
WINRAW_KEYBOARD_PRESSED(wr, binds[port][i].key))
ret |= (1 << i);
}
@ -807,9 +808,9 @@ static int16_t winraw_input_state(
if (binds[port][id].valid)
{
if (
(binds[port][id].key < RETROK_LAST)
(binds[port][id].key < RETROK_LAST)
&& WINRAW_KEYBOARD_PRESSED(wr, binds[port][id].key)
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
|| !keyboard_mapping_blocked)
)
return 1;
@ -1001,7 +1002,7 @@ static int16_t winraw_input_state(
joyport, (uint16_t)joykey))
return 1;
if (joyaxis != AXIS_NONE &&
((float)abs(joypad->axis(joyport, joyaxis))
((float)abs(joypad->axis(joyport, joyaxis))
/ 0x8000) > axis_threshold)
return 1;
else if (

View File

@ -1787,7 +1787,7 @@ static bool input_overlay_add_inputs_inner(overlay_desc_t *desc,
else
{
unsigned index = (desc->type == OVERLAY_TYPE_ANALOG_RIGHT)
? RETRO_DEVICE_INDEX_ANALOG_RIGHT
? RETRO_DEVICE_INDEX_ANALOG_RIGHT
: RETRO_DEVICE_INDEX_ANALOG_LEFT;
int16_t analog_x = input_state_internal(input_st, settings, port, RETRO_DEVICE_ANALOG,
index, RETRO_DEVICE_ID_ANALOG_X);
@ -1849,8 +1849,8 @@ static bool input_overlay_add_inputs(input_overlay_t *ol,
button_pressed |= input_overlay_add_inputs_inner(
desc, input_st,
settings,
show_touched
? ol_state
show_touched
? ol_state
: NULL,
port);
}
@ -3240,7 +3240,7 @@ void osk_update_last_codepoint(
/* combine 3 korean elements. make utf8 character */
static unsigned get_kr_utf8( int c1,int c2,int c3)
{
int uv = c1 * (28 * 21) + c2 * 28 + c3 + 0xac00;
int uv = c1 * (28 * 21) + c2 * 28 + c3 + 0xac00;
int tv = (uv >> 12) | ((uv & 0x0f00) << 2) | ((uv & 0xc0) << 2) | ((uv & 0x3f) << 16);
return (tv | 0x8080e0);
}
@ -3250,9 +3250,9 @@ static unsigned get_kr_composition( char* pcur, char* padd)
{
size_t _len;
static char cc1[] = {"ㄱㄱㄲ ㄷㄷㄸ ㅂㅂㅃ ㅅㅅㅆ ㅈㅈㅉ"};
static char cc2[] = {"ㅗㅏㅘ ㅗㅐㅙ ㅗㅣㅚ ㅜㅓㅝ ㅜㅔㅞ ㅜㅣㅟ ㅡㅣㅢ"};
static char cc2[] = {"ㅗㅏㅘ ㅗㅐㅙ ㅗㅣㅚ ㅜㅓㅝ ㅜㅔㅞ ㅜㅣㅟ ㅡㅣㅢ"};
static char cc3[] = {"ㄱㄱㄲ ㄱㅅㄳ ㄴㅈㄵ ㄴㅎㄶ ㄹㄱㄺ ㄹㅁㄻ ㄹㅂㄼ ㄹㅅㄽ ㄹㅌㄾ ㄹㅍㄿ ㄹㅎㅀ ㅂㅅㅄ ㅅㅅㅆ"};
static char s1[] = {"ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣㆍㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ"};
static char s1[] = {"ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣㆍㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ"};
char *tmp1 = NULL;
char *tmp2 = NULL;
int c1 = -1;
@ -3279,17 +3279,17 @@ static unsigned get_kr_composition( char* pcur, char* padd)
strlcpy(utf8 + _len, padd, sizeof(utf8) - _len);
if ((tmp2 = strstr(cc1, utf8)))
{
{
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0;
}
else if ((tmp2 = strstr(cc2, utf8)))
{
{
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0;
}
if (tmp2 && tmp2 < cc2 + sizeof(cc2) - 10)
{
{
*((unsigned*)padd) = *((unsigned*)(tmp2 + 6)) & 0xffffff;
return 0;
}
@ -3310,7 +3310,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
if (c1 == -1 && c2 == -1 && c3 == 0)
return ret;
if (c2 == -1 && c3 == 0)
{
/* 2nd element attach */
@ -3334,7 +3334,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
strlcpy(utf8, s1 + (19 + c2) * 3, 4);
utf8[3] = 0;
strlcat(utf8, padd, sizeof(utf8));
if ( !(tmp2 = strstr(cc2, utf8))
if ( !(tmp2 = strstr(cc2, utf8))
|| (tmp2 >= cc2 + sizeof(cc2) - 10))
return ret;
strlcpy(utf8, tmp2 + 6, 4);
@ -3347,13 +3347,13 @@ static unsigned get_kr_composition( char* pcur, char* padd)
else
if (c3 > 0)
{
strlcpy(utf8, s1 + (19 + 21 + c3) * 3, 4);
strlcpy(utf8, s1 + (19 + 21 + c3) * 3, 4);
utf8[3] = 0;
if (nv < 19)
{
/* 3rd element transform */
strlcat(utf8, padd, sizeof(utf8));
if ( !(tmp2 = strstr(cc3, utf8))
if ( !(tmp2 = strstr(cc3, utf8))
|| (tmp2 >= cc3 + sizeof(cc3) - 10))
return ret;
strlcpy(utf8, tmp2 + 6, 4);
@ -3363,7 +3363,7 @@ static unsigned get_kr_composition( char* pcur, char* padd)
c3 = (int)((tmp1 - s1) / 3 - 19 - 21);
}
else
{
{
int tv = 0;
if ((tmp2 = strstr(cc3, utf8)))
tv = (tmp2 - cc3) % 10;
@ -3420,23 +3420,23 @@ static bool input_keyboard_line_event(
/* reset composition, when edit box is opened. */
if (state->size == 0)
composition = 0;
/* reset composition, when 1 byte(=english) input */
/* reset composition, when 1 byte(=english) input */
if (character && character < 0xff)
composition = 0;
if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character))
{
size_t len = strlen((char*)&composition);
if (composition && state->buffer && state->size >= len && state->ptr >= len)
{
{
memmove(state->buffer + state->ptr-len, state->buffer + state->ptr, len + 1);
state->ptr -= len;
state->size -= len;
}
if (IS_COMPOSITION_KR(character) && composition)
{
{
unsigned new_comp;
character = character & 0xffffff;
new_comp = get_kr_composition((char*)&composition, (char*)&character);
new_comp = get_kr_composition((char*)&composition, (char*)&character);
if (new_comp)
input_keyboard_line_append(state, (char*)&new_comp, 3);
composition = character;
@ -3444,13 +3444,13 @@ static bool input_keyboard_line_event(
else
{
if (IS_END_COMPOSITION(character))
composition = 0;
composition = 0;
else
composition = character & 0xffffff;
character &= 0xffffff;
}
if (len && composition == 0)
word = state->buffer;
word = state->buffer;
if (character)
input_keyboard_line_append(state, (char*)&character, strlen((char*)&character));
word = state->buffer;
@ -4595,7 +4595,9 @@ static void input_overlay_loaded(retro_task_t *task,
input_driver_state_t *input_st = &input_driver_st;
bool enable_overlay = !input_overlay_want_hidden()
&& settings->bools.input_overlay_enable;
#ifdef HAVE_MENU
uint16_t overlay_types;
#endif
if (err)
return;
@ -4609,7 +4611,9 @@ static void input_overlay_loaded(retro_task_t *task,
ol->flags |= INPUT_OVERLAY_ALIVE;
if (data->flags & OVERLAY_LOADER_IS_OSK)
ol->flags |= INPUT_OVERLAY_IS_OSK;
#ifdef HAVE_MENU
overlay_types = data->overlay_types;
#endif
free(data);
@ -5317,8 +5321,8 @@ bool replay_set_serialized_data(void* buf)
bool recording = input_st->bsv_movie_state.flags & BSV_FLAG_MOVIE_RECORDING;
/* If there is no current replay, ignore this entirely.
TODO/FIXME: Later, consider loading up the replay
and allow the user to continue it?
TODO/FIXME: Later, consider loading up the replay
and allow the user to continue it?
Or would that be better done from the replay hotkeys?
*/
if (!(playback || recording))
@ -5369,7 +5373,7 @@ bool replay_set_serialized_data(void* buf)
This can truncate the current recording, so beware!
TODO/FIXME: Figure out what to do about rewinding across load
TODO/FIXME: Figure out what to do about rewinding across load
*/
if (loaded_len > handle_idx)
{
@ -5391,7 +5395,7 @@ bool replay_set_serialized_data(void* buf)
1, 180, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
RARCH_ERR("[Replay] %s.\n", str);
return false;
return false;
}
if (playback)

View File

@ -1152,7 +1152,7 @@ static void netplay_handshake_ready(netplay_t *netplay,
connection->nick);
RARCH_LOG("[Netplay] %s\n", msg);
/* Useful notification to the client in figuring out
/* Useful notification to the client in figuring out
if a connection was successfully made before an error,
but not as useful to the server.
Let it be optional if server. */
@ -1546,7 +1546,7 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
{
if (!netplay->is_server)
{
const char *dmsg =
const char *dmsg =
msg_hash_to_str(MSG_NETPLAY_INCORRECT_PASSWORD);
RARCH_ERR("[Netplay] %s\n", dmsg);
runloop_msg_queue_push(dmsg, 1, 180, false, NULL,
@ -1570,7 +1570,7 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
cmd_size = ntohl(info_buf.cmd[1]);
if (cmd_size != sizeof(info_buf) - sizeof(info_buf.cmd))
{
/* Either the host doesn't have anything loaded,
/* Either the host doesn't have anything loaded,
or this is just screwy */
if (cmd_size)
{
@ -2276,8 +2276,8 @@ bool netplay_send(
if (buf_remaining(sbuf) < len)
{
/* Can only be that this is simply too big
* for our buffer, in which case we just
/* Can only be that this is simply too big
* for our buffer, in which case we just
* need to do a blocking send */
if (!socket_send_all_blocking(sockfd, buf, len, true))
return false;
@ -2485,7 +2485,7 @@ copy:
/**
* netplay_recv_reset
*
* Reset our recv buffer so that future netplay_recvs
* Reset our recv buffer so that future netplay_recvs
* will read the same data again.
*/
void netplay_recv_reset(struct socket_buffer *sbuf)
@ -2669,7 +2669,7 @@ static void netplay_update_unread_ptr(netplay_t *netplay)
}
}
if ( !netplay->is_server &&
if ( !netplay->is_server &&
netplay->server_frame_count < new_unread_frame_count)
{
new_unread_ptr = netplay->server_ptr;
@ -2699,7 +2699,7 @@ static void netplay_update_unread_ptr(netplay_t *netplay)
netplay_input_state_t netplay_device_client_state(netplay_t *netplay,
struct delta_frame *simframe, uint32_t device, uint32_t client)
{
uint32_t dsize =
uint32_t dsize =
netplay_expected_input_size(netplay, 1 << device);
netplay_input_state_t simstate =
netplay_input_state_for(
@ -3543,7 +3543,7 @@ static struct netplay_connection *allocate_connection(netplay_t *netplay)
memset(connection, 0, sizeof(*connection));
else if (!netplay->connections_size)
{
netplay->connections =
netplay->connections =
(struct netplay_connection*)calloc(1, sizeof(*netplay->connections));
if (!netplay->connections)
return NULL;
@ -4058,7 +4058,7 @@ static void remote_unpaused(netplay_t *netplay,
for (i = 0; i < netplay->connections_size; i++)
{
struct netplay_connection *sc = &netplay->connections[i];
if (sc->flags &
if (sc->flags &
((NETPLAY_CONN_FLAG_ACTIVE | NETPLAY_CONN_FLAG_PAUSED)
== (NETPLAY_CONN_FLAG_ACTIVE | NETPLAY_CONN_FLAG_PAUSED)))
{
@ -4155,8 +4155,8 @@ static void netplay_hangup(netplay_t *netplay,
uint32_t client_num = (uint32_t)
(connection - netplay->connections + 1);
/* This special mode keeps the connection object
alive long enough to send the disconnection
/* This special mode keeps the connection object
alive long enough to send the disconnection
message at the correct time */
connection->mode = NETPLAY_CONNECTION_DELAYED_DISCONNECT;
connection->delay_frame = netplay->read_frame_count[client_num];
@ -4178,7 +4178,7 @@ static void netplay_hangup(netplay_t *netplay,
/**
* netplay_delayed_state_change:
*
* Handle any pending state changes which are ready
* Handle any pending state changes which are ready
* as of the beginning of the current frame.
*/
static void netplay_delayed_state_change(netplay_t *netplay)
@ -4547,7 +4547,7 @@ static void announce_play_spectate(netplay_t *netplay,
}
else
{
/* Multiple devices, so step one is to make the
/* Multiple devices, so step one is to make the
device string listing them all */
pdevice_str = device_str;
for (device = 0; device < MAX_INPUT_DEVICES; device++)
@ -4968,55 +4968,6 @@ bool netplay_cmd_mode(netplay_t *netplay,
cmd, payload, cmd_size);
}
static bool chat_check(netplay_t *netplay)
{
if (!netplay)
return false;
/* Do nothing if we don't have a nickname. */
if (string_is_empty(netplay->nick))
return false;
/* Do nothing if we are not playing. */
if (netplay->self_mode != NETPLAY_CONNECTION_PLAYING &&
netplay->self_mode != NETPLAY_CONNECTION_SLAVE)
return false;
/* If we are the server,
check if someone is able to read us. */
if (netplay->is_server)
{
size_t i;
for (i = 0; i < netplay->connections_size; i++)
{
struct netplay_connection *connection = &netplay->connections[i];
if (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
continue;
if ( (connection->mode == NETPLAY_CONNECTION_PLAYING)
|| (connection->mode == NETPLAY_CONNECTION_SLAVE))
{
REQUIRE_PROTOCOL_VERSION(connection, 6)
return true;
}
}
}
/* Otherwise, just check whether our connection is active
and the server is running protocol 6+. */
else
{
if (netplay->connections[0].flags & NETPLAY_CONN_FLAG_ACTIVE)
{
REQUIRE_PROTOCOL_VERSION(&netplay->connections[0], 6)
return true;
}
}
return false;
}
static void relay_chat(netplay_t *netplay, const char *nick, const char *msg)
{
size_t i;
@ -5086,6 +5037,55 @@ static void show_chat(netplay_t *netplay, const char *nick, const char *msg)
}
#ifdef HAVE_MENU
static bool chat_check(netplay_t *netplay)
{
if (!netplay)
return false;
/* Do nothing if we don't have a nickname. */
if (string_is_empty(netplay->nick))
return false;
/* Do nothing if we are not playing. */
if ( netplay->self_mode != NETPLAY_CONNECTION_PLAYING
&& netplay->self_mode != NETPLAY_CONNECTION_SLAVE)
return false;
/* If we are the server,
check if someone is able to read us. */
if (netplay->is_server)
{
size_t i;
for (i = 0; i < netplay->connections_size; i++)
{
struct netplay_connection *connection = &netplay->connections[i];
if (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
continue;
if ( (connection->mode == NETPLAY_CONNECTION_PLAYING)
|| (connection->mode == NETPLAY_CONNECTION_SLAVE))
{
REQUIRE_PROTOCOL_VERSION(connection, 6)
return true;
}
}
}
/* Otherwise, just check whether our connection is active
and the server is running protocol 6+. */
else
{
if (netplay->connections[0].flags & NETPLAY_CONN_FLAG_ACTIVE)
{
REQUIRE_PROTOCOL_VERSION(&netplay->connections[0], 6)
return true;
}
}
return false;
}
static void send_chat(void *userdata, const char *line)
{
char msg[NETPLAY_CHAT_MAX_SIZE];
@ -5150,7 +5150,7 @@ static bool handle_chat(netplay_t *netplay,
const char *nick, const char *msg)
{
if ( (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
|| string_is_empty(nick)
|| string_is_empty(nick)
|| string_is_empty(msg))
return false;
@ -5412,7 +5412,7 @@ static bool netplay_get_cmd(netplay_t *netplay,
if (cmd_size != sizeof(frame))
{
RARCH_ERR("[Netplay] NETPLAY_CMD_NOINPUT received"
RARCH_ERR("[Netplay] NETPLAY_CMD_NOINPUT received"
" an unexpected payload size.\n");
return netplay_cmd_nak(netplay, connection);
}
@ -7188,7 +7188,7 @@ static netplay_t *netplay_new(const char *server, const char *mitm,
netplay->allow_pausing =
settings->bools.netplay_allow_pausing;
netplay->input_latency_frames_min =
netplay->input_latency_frames_min =
settings->uints.netplay_input_latency_frames_min;
if (settings->bools.run_ahead_enabled)
netplay->input_latency_frames_min -=
@ -7284,7 +7284,7 @@ static void netplay_send_savestate(netplay_t *netplay,
for (i = 0; i < netplay->connections_size; i++)
{
struct netplay_connection *connection = &netplay->connections[i];
if ( (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
if ( (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
|| (connection->mode < NETPLAY_CONNECTION_CONNECTED)
|| (connection->compression_supported != cx))
continue;
@ -7324,7 +7324,7 @@ static void netplay_frontend_paused(netplay_t *netplay, bool paused)
for (i = 0; i < netplay->connections_size; i++)
{
struct netplay_connection *connection = &netplay->connections[i];
if (connection->flags &
if (connection->flags &
((NETPLAY_CONN_FLAG_ACTIVE | NETPLAY_CONN_FLAG_PAUSED)
== (NETPLAY_CONN_FLAG_ACTIVE | NETPLAY_CONN_FLAG_PAUSED)))
paused_ct++;
@ -8912,7 +8912,7 @@ static bool kick_client_by_id(netplay_t *netplay, int client_id, bool ban)
connection = &netplay->connections[client_id];
/* We can only kick connected clients. */
if ( (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
if ( (!(connection->flags & NETPLAY_CONN_FLAG_ACTIVE))
|| (connection->mode < NETPLAY_CONNECTION_CONNECTED))
return false;
@ -9133,7 +9133,7 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
break;
case RARCH_NETPLAY_CTL_IS_CONNECTED:
ret = ( netplay
ret = ( netplay
&& (!(netplay->is_server))
&& (netplay->self_mode >= NETPLAY_CONNECTION_CONNECTED));
break;
@ -9180,7 +9180,7 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
break;
case RARCH_NETPLAY_CTL_PAUSE:
if ( netplay
if ( netplay
&& (!(netplay->local_paused)))
netplay_frontend_paused(netplay, true);
break;
@ -9594,7 +9594,7 @@ static void gfx_widget_netplay_chat_frame(void *data, void *userdata)
formatted_nick_len = (size_t)snprintf(
formatted_nick, sizeof(formatted_nick),
"%s: ", nick);
strlcpy(formatted_msg, msg, sizeof(formatted_msg)
strlcpy(formatted_msg, msg, sizeof(formatted_msg)
- formatted_nick_len);
formatted_nick_width = font_driver_get_message_width(
font->font, formatted_nick, formatted_nick_len, 1.0f);

View File

@ -41,6 +41,8 @@
#include "../menu/menu_driver.h"
#endif
#include "../runloop.h"
enum autoconfig_handle_flags
{
AUTOCONF_FLAG_AUTOCONFIG_ENABLED = (1 << 0),
@ -115,7 +117,7 @@ static unsigned input_autoconfigure_get_config_file_affinity(
uint16_t config_pid = 0;
bool pid_match = false;
unsigned affinity = 0;
struct config_entry_list
struct config_entry_list
*entry = NULL;
/* Parse config file */

View File

@ -38,6 +38,7 @@
#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
#endif
#include "../runloop.h"
#endif
enum manual_scan_status
@ -208,7 +209,7 @@ static void task_manual_content_scan_handler(retro_task_t *task)
manual_scan->task_config->file_exts, "|");
/* Get content list */
if (!(manual_scan->content_list
if (!(manual_scan->content_list
= manual_content_scan_get_content_list(
manual_scan->task_config)))
{
@ -246,7 +247,7 @@ static void task_manual_content_scan_handler(retro_task_t *task)
playlist_clear(manual_scan->playlist);
/* Get initial playlist size */
manual_scan->playlist_size =
manual_scan->playlist_size =
playlist_size(manual_scan->playlist);
/* Set default core, if required */
@ -503,9 +504,9 @@ static void task_manual_content_scan_handler(retro_task_t *task)
task_set_progress(task, 100);
goto task_finished;
}
return;
task_finished:
if (task)