mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-01 04:00:32 +00:00
Declare variables at top
This commit is contained in:
parent
25536735a8
commit
1d45517d48
@ -183,9 +183,9 @@ bool main_load_content(int argc, char **argv, args_type() args,
|
|||||||
environment_get_t environ_get,
|
environment_get_t environ_get,
|
||||||
process_args_t process_args)
|
process_args_t process_args)
|
||||||
{
|
{
|
||||||
|
unsigned i;
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
int ret = 0, rarch_argc = 0;
|
int ret = 0, rarch_argc = 0;
|
||||||
unsigned i;
|
|
||||||
char *rarch_argv[MAX_ARGS] = {NULL};
|
char *rarch_argv[MAX_ARGS] = {NULL};
|
||||||
char *argv_copy [MAX_ARGS] = {NULL};
|
char *argv_copy [MAX_ARGS] = {NULL};
|
||||||
char **rarch_argv_ptr = (char**)argv;
|
char **rarch_argv_ptr = (char**)argv;
|
||||||
|
@ -129,6 +129,7 @@ static bool gfx_init_dwm(void)
|
|||||||
|
|
||||||
void gfx_set_dwm(void)
|
void gfx_set_dwm(void)
|
||||||
{
|
{
|
||||||
|
HRESULT ret;
|
||||||
if (!gfx_init_dwm())
|
if (!gfx_init_dwm())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -143,7 +144,7 @@ void gfx_set_dwm(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT ret = composition_enable(!g_settings.video.disable_composition);
|
ret = composition_enable(!g_settings.video.disable_composition);
|
||||||
if (FAILED(ret))
|
if (FAILED(ret))
|
||||||
RARCH_ERR("Failed to set composition state ...\n");
|
RARCH_ERR("Failed to set composition state ...\n");
|
||||||
dwm_composition_disabled = g_settings.video.disable_composition;
|
dwm_composition_disabled = g_settings.video.disable_composition;
|
||||||
@ -153,8 +154,7 @@ void gfx_set_dwm(void)
|
|||||||
void gfx_scale_integer(struct rarch_viewport *vp, unsigned width,
|
void gfx_scale_integer(struct rarch_viewport *vp, unsigned width,
|
||||||
unsigned height, float aspect_ratio, bool keep_aspect)
|
unsigned height, float aspect_ratio, bool keep_aspect)
|
||||||
{
|
{
|
||||||
int padding_x = 0;
|
int padding_x = 0, padding_y = 0;
|
||||||
int padding_y = 0;
|
|
||||||
|
|
||||||
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||||
{
|
{
|
||||||
@ -169,9 +169,11 @@ void gfx_scale_integer(struct rarch_viewport *vp, unsigned width,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned base_height, base_width;
|
||||||
|
|
||||||
/* Use system reported sizes as these define the
|
/* Use system reported sizes as these define the
|
||||||
* geometry for the "normal" case. */
|
* geometry for the "normal" case. */
|
||||||
unsigned base_height = g_extern.system.av_info.geometry.base_height;
|
base_height = g_extern.system.av_info.geometry.base_height;
|
||||||
|
|
||||||
if (base_height == 0)
|
if (base_height == 0)
|
||||||
base_height = 1;
|
base_height = 1;
|
||||||
@ -182,7 +184,7 @@ void gfx_scale_integer(struct rarch_viewport *vp, unsigned width,
|
|||||||
*
|
*
|
||||||
* If square pixels are used, base_height will be equal to
|
* If square pixels are used, base_height will be equal to
|
||||||
* g_extern.system.av_info.base_height. */
|
* g_extern.system.av_info.base_height. */
|
||||||
unsigned base_width = (unsigned)roundf(base_height * aspect_ratio);
|
base_width = (unsigned)roundf(base_height * aspect_ratio);
|
||||||
|
|
||||||
/* Make sure that we don't get 0x scale ... */
|
/* Make sure that we don't get 0x scale ... */
|
||||||
if (width >= base_width && height >= base_height)
|
if (width >= base_width && height >= base_height)
|
||||||
@ -248,7 +250,7 @@ char rotation_lut[4][32] =
|
|||||||
|
|
||||||
void gfx_set_square_pixel_viewport(unsigned width, unsigned height)
|
void gfx_set_square_pixel_viewport(unsigned width, unsigned height)
|
||||||
{
|
{
|
||||||
unsigned len, highest, i;
|
unsigned len, highest, i, aspect_x, aspect_y;
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -260,8 +262,8 @@ void gfx_set_square_pixel_viewport(unsigned width, unsigned height)
|
|||||||
highest = i;
|
highest = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned aspect_x = width / highest;
|
aspect_x = width / highest;
|
||||||
unsigned aspect_y = height / highest;
|
aspect_y = height / highest;
|
||||||
|
|
||||||
snprintf(aspectratio_lut[ASPECT_RATIO_SQUARE].name,
|
snprintf(aspectratio_lut[ASPECT_RATIO_SQUARE].name,
|
||||||
sizeof(aspectratio_lut[ASPECT_RATIO_SQUARE].name),
|
sizeof(aspectratio_lut[ASPECT_RATIO_SQUARE].name),
|
||||||
|
@ -297,8 +297,10 @@ unsigned state_get_uniform(state_tracker_t *tracker,
|
|||||||
struct state_tracker_uniform *uniforms,
|
struct state_tracker_uniform *uniforms,
|
||||||
unsigned elem, unsigned frame_count)
|
unsigned elem, unsigned frame_count)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i, elems = elem;
|
||||||
unsigned elems = tracker->info_elem < elem ? tracker->info_elem : elem;
|
|
||||||
|
if (tracker->info_elem < elem)
|
||||||
|
elems = tracker->info_elem;
|
||||||
|
|
||||||
update_input(tracker);
|
update_input(tracker);
|
||||||
|
|
||||||
|
@ -52,10 +52,11 @@ static void filter_thread_loop(void *data)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
bool die;
|
||||||
slock_lock(thr->lock);
|
slock_lock(thr->lock);
|
||||||
while (thr->done && !thr->die)
|
while (thr->done && !thr->die)
|
||||||
scond_wait(thr->cond, thr->lock);
|
scond_wait(thr->cond, thr->lock);
|
||||||
bool die = thr->die;
|
die = thr->die;
|
||||||
slock_unlock(thr->lock);
|
slock_unlock(thr->lock);
|
||||||
|
|
||||||
if (die)
|
if (die)
|
||||||
@ -97,6 +98,7 @@ static const struct softfilter_implementation *
|
|||||||
softfilter_find_implementation(rarch_softfilter_t *filt, const char *ident)
|
softfilter_find_implementation(rarch_softfilter_t *filt, const char *ident)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < filt->num_plugs; i++)
|
for (i = 0; i < filt->num_plugs; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(filt->plugs[i].impl->short_ident, ident))
|
if (!strcmp(filt->plugs[i].impl->short_ident, ident))
|
||||||
@ -121,13 +123,12 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
|
|||||||
softfilter_simd_mask_t cpu_features,
|
softfilter_simd_mask_t cpu_features,
|
||||||
unsigned threads)
|
unsigned threads)
|
||||||
{
|
{
|
||||||
unsigned input_fmts, input_fmt, output_fmts;
|
unsigned input_fmts, input_fmt, output_fmts, i;
|
||||||
char key[64];
|
char key[64], name[64];
|
||||||
struct config_file_userdata userdata;
|
struct config_file_userdata userdata;
|
||||||
|
|
||||||
snprintf(key, sizeof(key), "filter");
|
snprintf(key, sizeof(key), "filter");
|
||||||
|
|
||||||
char name[64];
|
|
||||||
if (!config_get_array(filt->conf, key, name, sizeof(name)))
|
if (!config_get_array(filt->conf, key, name, sizeof(name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -214,7 +215,6 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
|
|||||||
return false;
|
return false;
|
||||||
filt->threads = threads;
|
filt->threads = threads;
|
||||||
|
|
||||||
unsigned i;
|
|
||||||
for (i = 0; i < threads; i++)
|
for (i = 0; i < threads; i++)
|
||||||
{
|
{
|
||||||
filt->thread_data[i].userdata = filt->impl_data;
|
filt->thread_data[i].userdata = filt->impl_data;
|
||||||
@ -245,19 +245,24 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
|
|||||||
|
|
||||||
for (i = 0; i < list->size; i++)
|
for (i = 0; i < list->size; i++)
|
||||||
{
|
{
|
||||||
|
softfilter_get_implementation_t cb;
|
||||||
|
const struct softfilter_implementation *impl = NULL;
|
||||||
|
struct rarch_soft_plug *new_plugs = NULL;
|
||||||
dylib_t lib = dylib_load(list->elems[i].data);
|
dylib_t lib = dylib_load(list->elems[i].data);
|
||||||
|
|
||||||
if (!lib)
|
if (!lib)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
softfilter_get_implementation_t cb = (softfilter_get_implementation_t)
|
cb = (softfilter_get_implementation_t)
|
||||||
dylib_proc(lib, "softfilter_get_implementation");
|
dylib_proc(lib, "softfilter_get_implementation");
|
||||||
|
|
||||||
if (!cb)
|
if (!cb)
|
||||||
{
|
{
|
||||||
dylib_close(lib);
|
dylib_close(lib);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct softfilter_implementation *impl = cb(mask);
|
impl = cb(mask);
|
||||||
if (!impl)
|
if (!impl)
|
||||||
{
|
{
|
||||||
dylib_close(lib);
|
dylib_close(lib);
|
||||||
@ -270,7 +275,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rarch_soft_plug *new_plugs = (struct rarch_soft_plug*)
|
new_plugs = (struct rarch_soft_plug*)
|
||||||
realloc(filt->plugs, sizeof(*filt->plugs) * (filt->num_plugs + 1));
|
realloc(filt->plugs, sizeof(*filt->plugs) * (filt->num_plugs + 1));
|
||||||
if (!new_plugs)
|
if (!new_plugs)
|
||||||
{
|
{
|
||||||
@ -325,8 +330,10 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt,
|
|||||||
|
|
||||||
filt->plugs = (struct rarch_soft_plug*)
|
filt->plugs = (struct rarch_soft_plug*)
|
||||||
calloc(ARRAY_SIZE(soft_plugs_builtin), sizeof(*filt->plugs));
|
calloc(ARRAY_SIZE(soft_plugs_builtin), sizeof(*filt->plugs));
|
||||||
|
|
||||||
if (!filt->plugs)
|
if (!filt->plugs)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
filt->num_plugs = ARRAY_SIZE(soft_plugs_builtin);
|
filt->num_plugs = ARRAY_SIZE(soft_plugs_builtin);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(soft_plugs_builtin); i++)
|
for (i = 0; i < ARRAY_SIZE(soft_plugs_builtin); i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user