1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-03 00:38:44 +00:00

Revert "Move static functions to top of files"

This reverts commit 02b542e2a5.
This commit is contained in:
twinaphex 2020-06-26 18:40:26 +02:00
parent efd98108c6
commit 021625fd4a
9 changed files with 3577 additions and 3572 deletions

View File

@ -506,6 +506,42 @@ static core_info_list_t *core_info_list_new(const char *path,
return core_info_list;
}
/* Shallow-copies internal state.
*
* Data in *info is invalidated when the
* core_info_list is freed. */
bool core_info_list_get_info(core_info_list_t *core_info_list,
core_info_t *out_info, const char *path)
{
size_t i;
const char *core_filename = NULL;
if (!core_info_list || !out_info || string_is_empty(path))
return false;
core_filename = path_basename(path);
if (string_is_empty(core_filename))
return false;
memset(out_info, 0, sizeof(*out_info));
for (i = 0; i < core_info_list->count; i++)
{
const core_info_t *info = &core_info_list->list[i];
if (!info || (info->core_file_id.len == 0))
continue;
if (!strncmp(info->core_file_id.str, core_filename, info->core_file_id.len))
{
*out_info = *info;
return true;
}
}
return false;
}
#ifdef HAVE_COMPRESSION
static bool core_info_does_support_any_file(const core_info_t *core,
const struct string_list *list)
@ -627,125 +663,6 @@ static bool core_info_list_update_missing_firmware_internal(
return true;
}
static int core_info_qsort_func_path(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->path) || string_is_empty(b->path))
return 0;
return strcasecmp(a->path, b->path);
}
static int core_info_qsort_func_display_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->display_name) || string_is_empty(b->display_name))
return 0;
return strcasecmp(a->display_name, b->display_name);
}
static int core_info_qsort_func_core_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->core_name) || string_is_empty(b->core_name))
return 0;
return strcasecmp(a->core_name, b->core_name);
}
static int core_info_qsort_func_system_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->systemname) || string_is_empty(b->systemname))
return 0;
return strcasecmp(a->systemname, b->systemname);
}
static bool core_info_compare_api_version(int sys_major, int sys_minor, int major, int minor, enum compare_op op)
{
switch (op)
{
case COMPARE_OP_EQUAL:
if (sys_major == major && sys_minor == minor)
return true;
break;
case COMPARE_OP_NOT_EQUAL:
if (!(sys_major == major && sys_minor == minor))
return true;
break;
case COMPARE_OP_LESS:
if (sys_major < major || (sys_major == major && sys_minor < minor))
return true;
break;
case COMPARE_OP_LESS_EQUAL:
if (sys_major < major || (sys_major == major && sys_minor <= minor))
return true;
break;
case COMPARE_OP_GREATER:
if (sys_major > major || (sys_major == major && sys_minor > minor))
return true;
break;
case COMPARE_OP_GREATER_EQUAL:
if (sys_major > major || (sys_major == major && sys_minor >= minor))
return true;
break;
default:
break;
}
return false;
}
/* Shallow-copies internal state.
*
* Data in *info is invalidated when the
* core_info_list is freed. */
bool core_info_list_get_info(core_info_list_t *core_info_list,
core_info_t *out_info, const char *path)
{
size_t i;
const char *core_filename = NULL;
if (!core_info_list || !out_info || string_is_empty(path))
return false;
core_filename = path_basename(path);
if (string_is_empty(core_filename))
return false;
memset(out_info, 0, sizeof(*out_info));
for (i = 0; i < core_info_list->count; i++)
{
const core_info_t *info = &core_info_list->list[i];
if (!info || (info->core_file_id.len == 0))
continue;
if (!strncmp(info->core_file_id.str, core_filename, info->core_file_id.len))
{
*out_info = *info;
return true;
}
}
return false;
}
void core_info_free_current_core(core_info_state_t *p_coreinfo)
{
if (p_coreinfo->current)
@ -1195,6 +1112,54 @@ void core_info_free_core_updater_info(core_updater_info_t *info)
info = NULL;
}
static int core_info_qsort_func_path(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->path) || string_is_empty(b->path))
return 0;
return strcasecmp(a->path, b->path);
}
static int core_info_qsort_func_display_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->display_name) || string_is_empty(b->display_name))
return 0;
return strcasecmp(a->display_name, b->display_name);
}
static int core_info_qsort_func_core_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->core_name) || string_is_empty(b->core_name))
return 0;
return strcasecmp(a->core_name, b->core_name);
}
static int core_info_qsort_func_system_name(const core_info_t *a,
const core_info_t *b)
{
if (!a || !b)
return 0;
if (string_is_empty(a->systemname) || string_is_empty(b->systemname))
return 0;
return strcasecmp(a->systemname, b->systemname);
}
void core_info_qsort(core_info_list_t *core_info_list,
enum core_info_list_qsort_type qsort_type)
{
@ -1239,6 +1204,41 @@ void core_info_qsort(core_info_list_t *core_info_list,
}
}
static bool core_info_compare_api_version(int sys_major, int sys_minor, int major, int minor, enum compare_op op)
{
switch (op)
{
case COMPARE_OP_EQUAL:
if (sys_major == major && sys_minor == minor)
return true;
break;
case COMPARE_OP_NOT_EQUAL:
if (!(sys_major == major && sys_minor == minor))
return true;
break;
case COMPARE_OP_LESS:
if (sys_major < major || (sys_major == major && sys_minor < minor))
return true;
break;
case COMPARE_OP_LESS_EQUAL:
if (sys_major < major || (sys_major == major && sys_minor <= minor))
return true;
break;
case COMPARE_OP_GREATER:
if (sys_major > major || (sys_major == major && sys_minor > minor))
return true;
break;
case COMPARE_OP_GREATER_EQUAL:
if (sys_major > major || (sys_major == major && sys_minor >= minor))
return true;
break;
default:
break;
}
return false;
}
bool core_info_hw_api_supported(core_info_t *info)
{
#ifdef RARCH_INTERNAL

View File

@ -1042,187 +1042,6 @@ static void gfx_delayed_animation_cb(void *userdata)
free(delayed_animation);
}
static void gfx_animation_update_time_default(
float *ticker_pixel_increment,
unsigned video_width, unsigned video_height)
{
/* By default, this should be a NOOP */
}
static void gfx_animation_update_time(
gfx_animation_t *p_anim,
retro_time_t current_time,
bool timedate_enable,
unsigned video_width, unsigned video_height,
float _ticker_speed)
{
const bool ticker_is_active = p_anim->ticker_is_active;
static retro_time_t last_clock_update = 0;
static retro_time_t last_ticker_update = 0;
static retro_time_t last_ticker_slow_update = 0;
/* Horizontal smooth ticker parameters */
static float ticker_pixel_accumulator = 0.0f;
unsigned ticker_pixel_accumulator_uint = 0;
float ticker_pixel_increment = 0.0f;
/* Vertical (line) smooth ticker parameters */
static float ticker_pixel_line_accumulator = 0.0f;
unsigned ticker_pixel_line_accumulator_uint = 0;
float ticker_pixel_line_increment = 0.0f;
/* Adjust ticker speed */
float speed_factor =
(_ticker_speed > 0.0001f) ? _ticker_speed : 1.0f;
unsigned ticker_speed =
(unsigned)(((float)TICKER_SPEED / speed_factor) + 0.5);
unsigned ticker_slow_speed =
(unsigned)(((float)TICKER_SLOW_SPEED / speed_factor) + 0.5);
/* Note: cur_time & old_time are in us (microseconds),
* delta_time is in ms */
p_anim->cur_time = current_time;
p_anim->delta_time = (p_anim->old_time == 0)
? 0.0f
: (float)(p_anim->cur_time - p_anim->old_time) / 1000.0f;
p_anim->old_time = p_anim->cur_time;
if (((p_anim->cur_time - last_clock_update) > 1000000) /* 1000000 us == 1 second */
&& timedate_enable)
{
p_anim->animation_is_active = true;
last_clock_update = p_anim->cur_time;
}
if (ticker_is_active)
{
/* Update non-smooth ticker indices */
if (p_anim->cur_time - last_ticker_update >= ticker_speed)
{
p_anim->ticker_idx++;
last_ticker_update = p_anim->cur_time;
}
if (p_anim->cur_time - last_ticker_slow_update >= ticker_slow_speed)
{
p_anim->ticker_slow_idx++;
last_ticker_slow_update = p_anim->cur_time;
}
/* Pixel tickers (horizontal + vertical/line) update
* every frame (regardless of time delta), so require
* special handling */
/* > Get base increment size (+1 every ticker_pixel_period ms) */
ticker_pixel_increment = p_anim->delta_time / ticker_pixel_period;
/* > Apply ticker speed adjustment */
ticker_pixel_increment *= speed_factor;
/* At this point we diverge:
* > Vertical (line) ticker is based upon text
* characteristics (number of characters per
* line) - it is therefore independent of display
* size/scaling, so speed-adjusted pixel increment
* is used directly */
ticker_pixel_line_increment = ticker_pixel_increment;
/* > Horizontal ticker is based upon physical line
* width - it is therefore very much dependent upon
* display size/scaling. Each menu driver is free
* to handle video scaling as it pleases - a callback
* function set by the menu driver is thus used to
* perform menu-specific scaling adjustments */
update_time_callback(&ticker_pixel_increment,
video_width, video_height);
/* > Update accumulators */
ticker_pixel_accumulator += ticker_pixel_increment;
ticker_pixel_accumulator_uint = (unsigned)ticker_pixel_accumulator;
ticker_pixel_line_accumulator += ticker_pixel_line_increment;
ticker_pixel_line_accumulator_uint = (unsigned)ticker_pixel_line_accumulator;
/* > Check whether we've accumulated enough
* for an idx update */
if (ticker_pixel_accumulator_uint > 0)
{
p_anim->ticker_pixel_idx += ticker_pixel_accumulator_uint;
ticker_pixel_accumulator -= (float)ticker_pixel_accumulator_uint;
}
if (ticker_pixel_accumulator_uint > 0)
{
p_anim->ticker_pixel_line_idx += ticker_pixel_line_accumulator_uint;
ticker_pixel_line_accumulator -= (float)ticker_pixel_line_accumulator_uint;
}
}
}
static void build_ticker_loop_string(
const char* src_str, const char *spacer,
unsigned char_offset1, unsigned num_chars1,
unsigned char_offset2, unsigned num_chars2,
unsigned char_offset3, unsigned num_chars3,
char *dest_str, size_t dest_str_len)
{
char tmp[PATH_MAX_LENGTH];
tmp[0] = '\0';
dest_str[0] = '\0';
/* Copy 'trailing' chunk of source string, if required */
if (num_chars1 > 0)
utf8cpy(
dest_str, dest_str_len,
utf8skip(src_str, char_offset1), num_chars1);
/* Copy chunk of spacer string, if required */
if (num_chars2 > 0)
{
utf8cpy(
tmp, sizeof(tmp),
utf8skip(spacer, char_offset2), num_chars2);
strlcat(dest_str, tmp, dest_str_len);
}
/* Copy 'leading' chunk of source string, if required */
if (num_chars3 > 0)
{
utf8cpy(
tmp, sizeof(tmp),
utf8skip(src_str, char_offset3), num_chars3);
strlcat(dest_str, tmp, dest_str_len);
}
}
static void build_line_ticker_string(
size_t num_display_lines, size_t line_offset,
struct string_list *lines,
char *dest_str, size_t dest_str_len)
{
size_t i;
for (i = 0; i < num_display_lines; i++)
{
size_t offset = i + line_offset;
size_t line_index = offset % (lines->size + 1);
bool line_valid = true;
if (line_index >= lines->size)
line_valid = false;
if (line_valid)
strlcat(dest_str, lines->elems[line_index].data, dest_str_len);
if (i < num_display_lines - 1)
strlcat(dest_str, "\n", dest_str_len);
}
}
void gfx_animation_push_delayed(
unsigned delay, gfx_animation_ctx_entry_t *entry)
{
@ -1387,6 +1206,13 @@ bool gfx_animation_push(gfx_animation_ctx_entry_t *entry)
return true;
}
static void gfx_animation_update_time_default(
float *ticker_pixel_increment,
unsigned video_width, unsigned video_height)
{
/* By default, this should be a NOOP */
}
void gfx_animation_set_update_time_cb(update_time_cb cb)
{
update_time_callback = cb;
@ -1397,6 +1223,117 @@ void gfx_animation_unset_update_time_cb(void)
update_time_callback = gfx_animation_update_time_default;
}
static void gfx_animation_update_time(
gfx_animation_t *p_anim,
retro_time_t current_time,
bool timedate_enable,
unsigned video_width, unsigned video_height,
float _ticker_speed)
{
const bool ticker_is_active = p_anim->ticker_is_active;
static retro_time_t last_clock_update = 0;
static retro_time_t last_ticker_update = 0;
static retro_time_t last_ticker_slow_update = 0;
/* Horizontal smooth ticker parameters */
static float ticker_pixel_accumulator = 0.0f;
unsigned ticker_pixel_accumulator_uint = 0;
float ticker_pixel_increment = 0.0f;
/* Vertical (line) smooth ticker parameters */
static float ticker_pixel_line_accumulator = 0.0f;
unsigned ticker_pixel_line_accumulator_uint = 0;
float ticker_pixel_line_increment = 0.0f;
/* Adjust ticker speed */
float speed_factor =
(_ticker_speed > 0.0001f) ? _ticker_speed : 1.0f;
unsigned ticker_speed =
(unsigned)(((float)TICKER_SPEED / speed_factor) + 0.5);
unsigned ticker_slow_speed =
(unsigned)(((float)TICKER_SLOW_SPEED / speed_factor) + 0.5);
/* Note: cur_time & old_time are in us (microseconds),
* delta_time is in ms */
p_anim->cur_time = current_time;
p_anim->delta_time = (p_anim->old_time == 0)
? 0.0f
: (float)(p_anim->cur_time - p_anim->old_time) / 1000.0f;
p_anim->old_time = p_anim->cur_time;
if (((p_anim->cur_time - last_clock_update) > 1000000) /* 1000000 us == 1 second */
&& timedate_enable)
{
p_anim->animation_is_active = true;
last_clock_update = p_anim->cur_time;
}
if (ticker_is_active)
{
/* Update non-smooth ticker indices */
if (p_anim->cur_time - last_ticker_update >= ticker_speed)
{
p_anim->ticker_idx++;
last_ticker_update = p_anim->cur_time;
}
if (p_anim->cur_time - last_ticker_slow_update >= ticker_slow_speed)
{
p_anim->ticker_slow_idx++;
last_ticker_slow_update = p_anim->cur_time;
}
/* Pixel tickers (horizontal + vertical/line) update
* every frame (regardless of time delta), so require
* special handling */
/* > Get base increment size (+1 every ticker_pixel_period ms) */
ticker_pixel_increment = p_anim->delta_time / ticker_pixel_period;
/* > Apply ticker speed adjustment */
ticker_pixel_increment *= speed_factor;
/* At this point we diverge:
* > Vertical (line) ticker is based upon text
* characteristics (number of characters per
* line) - it is therefore independent of display
* size/scaling, so speed-adjusted pixel increment
* is used directly */
ticker_pixel_line_increment = ticker_pixel_increment;
/* > Horizontal ticker is based upon physical line
* width - it is therefore very much dependent upon
* display size/scaling. Each menu driver is free
* to handle video scaling as it pleases - a callback
* function set by the menu driver is thus used to
* perform menu-specific scaling adjustments */
update_time_callback(&ticker_pixel_increment,
video_width, video_height);
/* > Update accumulators */
ticker_pixel_accumulator += ticker_pixel_increment;
ticker_pixel_accumulator_uint = (unsigned)ticker_pixel_accumulator;
ticker_pixel_line_accumulator += ticker_pixel_line_increment;
ticker_pixel_line_accumulator_uint = (unsigned)ticker_pixel_line_accumulator;
/* > Check whether we've accumulated enough
* for an idx update */
if (ticker_pixel_accumulator_uint > 0)
{
p_anim->ticker_pixel_idx += ticker_pixel_accumulator_uint;
ticker_pixel_accumulator -= (float)ticker_pixel_accumulator_uint;
}
if (ticker_pixel_accumulator_uint > 0)
{
p_anim->ticker_pixel_line_idx += ticker_pixel_line_accumulator_uint;
ticker_pixel_line_accumulator -= (float)ticker_pixel_line_accumulator_uint;
}
}
}
bool gfx_animation_update(
retro_time_t current_time,
bool timedate_enable,
@ -1472,6 +1409,45 @@ bool gfx_animation_update(
return p_anim->animation_is_active;
}
static void build_ticker_loop_string(
const char* src_str, const char *spacer,
unsigned char_offset1, unsigned num_chars1,
unsigned char_offset2, unsigned num_chars2,
unsigned char_offset3, unsigned num_chars3,
char *dest_str, size_t dest_str_len)
{
char tmp[PATH_MAX_LENGTH];
tmp[0] = '\0';
dest_str[0] = '\0';
/* Copy 'trailing' chunk of source string, if required */
if (num_chars1 > 0)
utf8cpy(
dest_str, dest_str_len,
utf8skip(src_str, char_offset1), num_chars1);
/* Copy chunk of spacer string, if required */
if (num_chars2 > 0)
{
utf8cpy(
tmp, sizeof(tmp),
utf8skip(spacer, char_offset2), num_chars2);
strlcat(dest_str, tmp, dest_str_len);
}
/* Copy 'leading' chunk of source string, if required */
if (num_chars3 > 0)
{
utf8cpy(
tmp, sizeof(tmp),
utf8skip(src_str, char_offset3), num_chars3);
strlcat(dest_str, tmp, dest_str_len);
}
}
bool gfx_animation_ticker(gfx_animation_ctx_ticker_t *ticker)
{
gfx_animation_t *p_anim = anim_get_ptr();
@ -1937,6 +1913,30 @@ end:
return is_active;
}
static void build_line_ticker_string(
size_t num_display_lines, size_t line_offset,
struct string_list *lines,
char *dest_str, size_t dest_str_len)
{
size_t i;
for (i = 0; i < num_display_lines; i++)
{
size_t offset = i + line_offset;
size_t line_index = offset % (lines->size + 1);
bool line_valid = true;
if (line_index >= lines->size)
line_valid = false;
if (line_valid)
strlcat(dest_str, lines->elems[line_index].data, dest_str_len);
if (i < num_display_lines - 1)
strlcat(dest_str, "\n", dest_str_len);
}
}
bool gfx_animation_line_ticker(gfx_animation_ctx_line_ticker_t *line_ticker)
{
char *wrapped_str = NULL;

View File

@ -265,6 +265,7 @@ static bool gfx_display_check_compatibility(
return false;
}
void gfx_display_set_driver_id(enum menu_driver_id_type type)
{
gfx_display_t *p_disp = disp_get_ptr();

File diff suppressed because it is too large Load Diff

View File

@ -30,130 +30,7 @@
#if defined(HAVE_VIDEOCORE)
#include "include/userland/interface/vmcs_host/vc_vchi_gencmd.h"
static void crt_rpi_switch(int width, int height, float hz, int xoffset)
{
char buffer[1024];
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection = NULL;
static char output[250] = {0};
static char output1[250] = {0};
static char output2[250] = {0};
static char set_hdmi[250] = {0};
static char set_hdmi_timing[250] = {0};
int i = 0;
int hfp = 0;
int hsp = 0;
int hbp = 0;
int vfp = 0;
int vsp = 0;
int vbp = 0;
int hmax = 0;
int vmax = 0;
int pdefault = 8;
int pwidth = 0;
int ip_flag = 0;
float roundw = 0.0f;
float roundh = 0.0f;
float pixel_clock = 0.0f;
/* set core refresh from hz */
video_monitor_set_refresh_rate(hz);
/* following code is the mode line generator */
hsp = (width * 0.117) - (xoffset*4);
if (width < 700)
{
hfp = (width * 0.065);
hbp = width * 0.35-hsp-hfp;
}
else
{
hfp = (width * 0.033) + (width / 112);
hbp = (width * 0.225) + (width /58);
xoffset = xoffset*2;
}
hmax = hbp;
if (height < 241)
vmax = 261;
if (height < 241 && hz > 56 && hz < 58)
vmax = 280;
if (height < 241 && hz < 55)
vmax = 313;
if (height > 250 && height < 260 && hz > 54)
vmax = 296;
if (height > 250 && height < 260 && hz > 52 && hz < 54)
vmax = 285;
if (height > 250 && height < 260 && hz < 52)
vmax = 313;
if (height > 260 && height < 300)
vmax = 318;
if (height > 400 && hz > 56)
vmax = 533;
if (height > 520 && hz < 57)
vmax = 580;
if (height > 300 && hz < 56)
vmax = 615;
if (height > 500 && hz < 56)
vmax = 624;
if (height > 300)
pdefault = pdefault * 2;
vfp = (height + ((vmax - height) / 2) - pdefault) - height;
if (height < 300)
vsp = vfp + 3; /* needs to be 3 for progressive */
if (height > 300)
vsp = vfp + 6; /* needs to be 6 for interlaced */
vsp = 3;
vbp = (vmax-height)-vsp-vfp;
hmax = width+hfp+hsp+hbp;
if (height < 300)
{
pixel_clock = (hmax * vmax * hz) ;
ip_flag = 0;
}
if (height > 300)
{
pixel_clock = (hmax * vmax * (hz/2)) /2 ;
ip_flag = 1;
}
/* above code is the modeline generator */
snprintf(set_hdmi_timing, sizeof(set_hdmi_timing),
"hdmi_timings %d 1 %d %d %d %d 1 %d %d %d 0 0 0 %f %d %f 1 ",
width, hfp, hsp, hbp, height, vfp,vsp, vbp,
hz, ip_flag, pixel_clock);
vcos_init();
vchi_initialise(&vchi_instance);
vchi_connect(NULL, 0, vchi_instance);
vc_vchi_gencmd_init(vchi_instance, &vchi_connection, 1);
vc_gencmd(buffer, sizeof(buffer), set_hdmi_timing);
vc_gencmd_stop();
vchi_disconnect(vchi_instance);
snprintf(output1, sizeof(output1),
"tvservice -e \"DMT 87\" > /dev/null");
system(output1);
snprintf(output2, sizeof(output1),
"fbset -g %d %d %d %d 24 > /dev/null",
width, height, width, height);
system(output2);
}
static void crt_rpi_switch(int width, int height, float hz, int xoffset);
#endif
static void switch_crt_hz(videocrt_switch_t *p_switch)
@ -370,3 +247,129 @@ void crt_switch_res_core(
video_driver_apply_state_changes();
}
}
#if defined(HAVE_VIDEOCORE)
static void crt_rpi_switch(int width, int height, float hz, int xoffset)
{
char buffer[1024];
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection = NULL;
static char output[250] = {0};
static char output1[250] = {0};
static char output2[250] = {0};
static char set_hdmi[250] = {0};
static char set_hdmi_timing[250] = {0};
int i = 0;
int hfp = 0;
int hsp = 0;
int hbp = 0;
int vfp = 0;
int vsp = 0;
int vbp = 0;
int hmax = 0;
int vmax = 0;
int pdefault = 8;
int pwidth = 0;
int ip_flag = 0;
float roundw = 0.0f;
float roundh = 0.0f;
float pixel_clock = 0.0f;
/* set core refresh from hz */
video_monitor_set_refresh_rate(hz);
/* following code is the mode line generator */
hsp = (width * 0.117) - (xoffset*4);
if (width < 700)
{
hfp = (width * 0.065);
hbp = width * 0.35-hsp-hfp;
}
else
{
hfp = (width * 0.033) + (width / 112);
hbp = (width * 0.225) + (width /58);
xoffset = xoffset*2;
}
hmax = hbp;
if (height < 241)
vmax = 261;
if (height < 241 && hz > 56 && hz < 58)
vmax = 280;
if (height < 241 && hz < 55)
vmax = 313;
if (height > 250 && height < 260 && hz > 54)
vmax = 296;
if (height > 250 && height < 260 && hz > 52 && hz < 54)
vmax = 285;
if (height > 250 && height < 260 && hz < 52)
vmax = 313;
if (height > 260 && height < 300)
vmax = 318;
if (height > 400 && hz > 56)
vmax = 533;
if (height > 520 && hz < 57)
vmax = 580;
if (height > 300 && hz < 56)
vmax = 615;
if (height > 500 && hz < 56)
vmax = 624;
if (height > 300)
pdefault = pdefault * 2;
vfp = (height + ((vmax - height) / 2) - pdefault) - height;
if (height < 300)
vsp = vfp + 3; /* needs to be 3 for progressive */
if (height > 300)
vsp = vfp + 6; /* needs to be 6 for interlaced */
vsp = 3;
vbp = (vmax-height)-vsp-vfp;
hmax = width+hfp+hsp+hbp;
if (height < 300)
{
pixel_clock = (hmax * vmax * hz) ;
ip_flag = 0;
}
if (height > 300)
{
pixel_clock = (hmax * vmax * (hz/2)) /2 ;
ip_flag = 1;
}
/* above code is the modeline generator */
snprintf(set_hdmi_timing, sizeof(set_hdmi_timing),
"hdmi_timings %d 1 %d %d %d %d 1 %d %d %d 0 0 0 %f %d %f 1 ",
width, hfp, hsp, hbp, height, vfp,vsp, vbp,
hz, ip_flag, pixel_clock);
vcos_init();
vchi_initialise(&vchi_instance);
vchi_connect(NULL, 0, vchi_instance);
vc_vchi_gencmd_init(vchi_instance, &vchi_connection, 1);
vc_gencmd(buffer, sizeof(buffer), set_hdmi_timing);
vc_gencmd_stop();
vchi_disconnect(vchi_instance);
snprintf(output1, sizeof(output1),
"tvservice -e \"DMT 87\" > /dev/null");
system(output1);
snprintf(output2, sizeof(output1),
"fbset -g %d %d %d %d 24 > /dev/null",
width, height, width, height);
system(output2);
}
#endif

View File

@ -32,12 +32,16 @@
#include "../retroarch.h"
#include "../verbosity.h"
bool video_layout_load_internal(view_array_t *view_array,
rxml_document_t *doc);
typedef struct io
{
char *name;
int base_value;
int value;
} io_t;
}
io_t;
typedef struct video_layout_state
{
@ -59,79 +63,12 @@ typedef struct video_layout_state
bool is_archive;
bool view_changed;
} video_layout_state_t;
}
video_layout_state_t;
/* TODO/FIXME - global state - perhaps move outside this file */
static video_layout_state_t *video_layout_state = NULL;
/* Forward declarations */
bool video_layout_load_internal(view_array_t *view_array,
rxml_document_t *doc);
static int video_layout_load_image(const char *path)
{
struct texture_image image;
void *handle;
int index;
image.supports_rgba = video_driver_supports_rgba();
if (video_layout_state->is_archive)
{
void *buf;
int64_t len;
char respath[PATH_MAX_LENGTH];
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
strlcat(respath, path, sizeof(respath));
if (!file_archive_compressed_read(respath, &buf, NULL, &len))
{
RARCH_LOG("video_layout: failed to decompress image: %s\n", respath);
return 0;
}
if (!image_texture_load_buffer(&image,
image_texture_get_type(path), buf, (size_t)len))
{
free(buf);
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
return 0;
}
free(buf);
}
else
{
char respath[PATH_MAX_LENGTH];
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
strlcat(respath, path, sizeof(respath));
if (!image_texture_load(&image, respath))
{
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
return 0;
}
}
handle = video_layout_state->render->take_image(
video_layout_state->render_info.video_driver_data, image);
if (!handle)
return 0;
index = video_layout_state->images_count;
vec_size((void**)&video_layout_state->images,
sizeof(void*), ++video_layout_state->images_count);
video_layout_state->images[index] = handle;
return index;
}
void video_layout_init(void *video_driver_data,
const video_layout_render_interface_t *render)
{
@ -276,6 +213,70 @@ bool video_layout_valid(void)
return video_layout_state && video_layout_state->view;
}
static int video_layout_load_image(const char *path)
{
struct texture_image image;
void *handle;
int index;
image.supports_rgba = video_driver_supports_rgba();
if (video_layout_state->is_archive)
{
void *buf;
int64_t len;
char respath[PATH_MAX_LENGTH];
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
strlcat(respath, path, sizeof(respath));
if (!file_archive_compressed_read(respath, &buf, NULL, &len))
{
RARCH_LOG("video_layout: failed to decompress image: %s\n", respath);
return 0;
}
if (!image_texture_load_buffer(&image,
image_texture_get_type(path), buf, (size_t)len))
{
free(buf);
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
return 0;
}
free(buf);
}
else
{
char respath[PATH_MAX_LENGTH];
strlcpy(respath, video_layout_state->base_path, sizeof(respath));
strlcat(respath, path, sizeof(respath));
if (!image_texture_load(&image, respath))
{
RARCH_LOG("video_layout: failed to load image: %s\n", respath);
return 0;
}
}
handle = video_layout_state->render->take_image(
video_layout_state->render_info.video_driver_data, image);
if (!handle)
return 0;
index = video_layout_state->images_count;
vec_size((void**)&video_layout_state->images,
sizeof(void*), ++video_layout_state->images_count);
video_layout_state->images[index] = handle;
return index;
}
int video_layout_view_count(void)
{
return video_layout_state->view_array.views_count;

View File

@ -408,76 +408,6 @@ static struct video_shader_parameter *video_shader_parse_find_parameter(
return NULL;
}
/* CGP store */
static const char *scale_type_to_str(enum gfx_scale_type type)
{
switch (type)
{
case RARCH_SCALE_INPUT:
return "source";
case RARCH_SCALE_VIEWPORT:
return "viewport";
case RARCH_SCALE_ABSOLUTE:
return "absolute";
default:
break;
}
return "?";
}
static void shader_write_scale_dim(config_file_t *conf,
const char *dim,
enum gfx_scale_type type, float scale,
unsigned absolute, unsigned i)
{
char key[64];
key[0] = '\0';
snprintf(key, sizeof(key), "scale_type_%s%u", dim, i);
config_set_string(conf, key, scale_type_to_str(type));
snprintf(key, sizeof(key), "scale_%s%u", dim, i);
if (type == RARCH_SCALE_ABSOLUTE)
config_set_int(conf, key, absolute);
else
config_set_float(conf, key, scale);
}
static void shader_write_fbo(config_file_t *conf,
const struct gfx_fbo_scale *fbo, unsigned i)
{
char key[64];
key[0] = '\0';
snprintf(key, sizeof(key), "float_framebuffer%u", i);
config_set_bool(conf, key, fbo->fp_fbo);
snprintf(key, sizeof(key), "srgb_framebuffer%u", i);
config_set_bool(conf, key, fbo->srgb_fbo);
if (!fbo->valid)
return;
shader_write_scale_dim(conf, "x", fbo->type_x,
fbo->scale_x, fbo->abs_x, i);
shader_write_scale_dim(conf, "y", fbo->type_y,
fbo->scale_y, fbo->abs_y, i);
}
#ifdef _WIN32
static void make_relative_path_portable(char *path)
{
/* use '/' instead of '\' for maximum portability */
char *p;
for (p = path; *p; p++)
if (*p == '\\')
*p = '/';
}
#endif
/**
* video_shader_set_current_parameters:
* @conf : Preset file to read from.
@ -957,6 +887,75 @@ bool video_shader_read_conf_preset(config_file_t *conf,
return video_shader_parse_textures(conf, shader);
}
/* CGP store */
static const char *scale_type_to_str(enum gfx_scale_type type)
{
switch (type)
{
case RARCH_SCALE_INPUT:
return "source";
case RARCH_SCALE_VIEWPORT:
return "viewport";
case RARCH_SCALE_ABSOLUTE:
return "absolute";
default:
break;
}
return "?";
}
static void shader_write_scale_dim(config_file_t *conf,
const char *dim,
enum gfx_scale_type type, float scale,
unsigned absolute, unsigned i)
{
char key[64];
key[0] = '\0';
snprintf(key, sizeof(key), "scale_type_%s%u", dim, i);
config_set_string(conf, key, scale_type_to_str(type));
snprintf(key, sizeof(key), "scale_%s%u", dim, i);
if (type == RARCH_SCALE_ABSOLUTE)
config_set_int(conf, key, absolute);
else
config_set_float(conf, key, scale);
}
static void shader_write_fbo(config_file_t *conf,
const struct gfx_fbo_scale *fbo, unsigned i)
{
char key[64];
key[0] = '\0';
snprintf(key, sizeof(key), "float_framebuffer%u", i);
config_set_bool(conf, key, fbo->fp_fbo);
snprintf(key, sizeof(key), "srgb_framebuffer%u", i);
config_set_bool(conf, key, fbo->srgb_fbo);
if (!fbo->valid)
return;
shader_write_scale_dim(conf, "x", fbo->type_x,
fbo->scale_x, fbo->abs_x, i);
shader_write_scale_dim(conf, "y", fbo->type_y,
fbo->scale_y, fbo->abs_y, i);
}
#ifdef _WIN32
static void make_relative_path_portable(char *path)
{
/* use '/' instead of '\' for maximum portability */
char *p;
for (p = path; *p; p++)
if (*p == '\\')
*p = '/';
}
#endif
/**
* video_shader_write_conf_preset:
* @conf : Preset file to write to.

3951
playlist.c

File diff suppressed because it is too large Load Diff

View File

@ -265,39 +265,6 @@ end:
filestream_close(file);
}
static void last_played_strftime(runtime_log_t *runtime_log, char *str, size_t len, const char *format)
{
struct tm time_info;
char *local = NULL;
if (!runtime_log)
return;
/* Get time */
runtime_log_get_last_played_time(runtime_log, &time_info);
/* Ensure correct locale is set */
setlocale(LC_TIME, "");
/* Generate string */
#if defined(__linux__) && !defined(ANDROID)
strftime(str, len, format, &time_info);
#else
strftime(str, len, format, &time_info);
local = local_to_utf8_string_alloc(str);
if (!string_is_empty(local))
strlcpy(str, local, len);
if (local)
{
free(local);
local = NULL;
}
#endif
}
/* Initialise runtime log, loading current parameters
* if log file exists. Returned object must be free()'d.
* Returns NULL if content_path and/or core_path are invalid */
@ -667,6 +634,38 @@ void runtime_log_get_last_played_time(runtime_log_t *runtime_log, struct tm *tim
mktime(time_info);
}
static void last_played_strftime(runtime_log_t *runtime_log, char *str, size_t len, const char *format)
{
struct tm time_info;
char *local = NULL;
if (!runtime_log)
return;
/* Get time */
runtime_log_get_last_played_time(runtime_log, &time_info);
/* Ensure correct locale is set */
setlocale(LC_TIME, "");
/* Generate string */
#if defined(__linux__) && !defined(ANDROID)
strftime(str, len, format, &time_info);
#else
strftime(str, len, format, &time_info);
local = local_to_utf8_string_alloc(str);
if (!string_is_empty(local))
strlcpy(str, local, len);
if (local)
{
free(local);
local = NULL;
}
#endif
}
/* Gets last played entry value as a pre-formatted string */
void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
char *str, size_t len,