mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 00:39:40 +00:00
This reverts commit eaa6bc0852
.
This commit is contained in:
parent
eaa6bc0852
commit
6f0ef7be0a
@ -1346,9 +1346,9 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
if (string_starts_with_size(dir_list->elems[i].data, "/dev/sg",
|
||||
STRLEN_CONST("/dev/sg")))
|
||||
{
|
||||
char drive_string[33];
|
||||
libretro_vfs_implementation_file *stream;
|
||||
char drive_model[32] = {0};
|
||||
char drive_string[33] = {0};
|
||||
union string_list_elem_attr attr = {0};
|
||||
int dev_index = 0;
|
||||
RFILE *file = filestream_open(
|
||||
@ -1380,9 +1380,9 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
attr.i = dev_index;
|
||||
|
||||
if (!string_is_empty(drive_model))
|
||||
strlcpy(drive_string, drive_model, sizeof(drive_string));
|
||||
strlcat(drive_string, drive_model, sizeof(drive_string));
|
||||
else
|
||||
strlcpy(drive_string, "Unknown Drive", sizeof(drive_string));
|
||||
strlcat(drive_string, "Unknown Drive", sizeof(drive_string));
|
||||
|
||||
string_list_append(list, drive_string, attr);
|
||||
}
|
||||
@ -1404,7 +1404,7 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
|
||||
if (string_split_noalloc(&mods, buf, "\n"))
|
||||
{
|
||||
for (i = 0; i < (int)mods.size; i++)
|
||||
for (i = 0; i < mods.size; i++)
|
||||
{
|
||||
if (strcasestr(mods.elems[i].data, "sg "))
|
||||
{
|
||||
@ -1446,13 +1446,13 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
DWORD drive_mask = GetLogicalDrives();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)(sizeof(DWORD) * 8); i++)
|
||||
for (i = 0; i < sizeof(DWORD) * 8; i++)
|
||||
{
|
||||
char path[] = {"a:\\"};
|
||||
char path[] = {"a:\\"};
|
||||
char cdrom_path[] = {"cdrom://a:/drive-track01.bin"};
|
||||
|
||||
path[0] += i;
|
||||
cdrom_path[8] += i;
|
||||
path[0] += i;
|
||||
cdrom_path[8] += i;
|
||||
|
||||
/* this drive letter doesn't exist */
|
||||
if (!(drive_mask & (1 << i)))
|
||||
@ -1460,14 +1460,15 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
|
||||
if (GetDriveType(path) != DRIVE_CDROM)
|
||||
continue;
|
||||
|
||||
else
|
||||
{
|
||||
char drive_string[33];
|
||||
libretro_vfs_implementation_file *stream;
|
||||
bool is_cdrom = false;
|
||||
char drive_model[32] = {0};
|
||||
char drive_model[32] = {0};
|
||||
char drive_string[33] = {0};
|
||||
union string_list_elem_attr attr = {0};
|
||||
RFILE *file = filestream_open(cdrom_path, RETRO_VFS_FILE_ACCESS_READ, 0);
|
||||
libretro_vfs_implementation_file *stream;
|
||||
bool is_cdrom = false;
|
||||
|
||||
if (!file)
|
||||
continue;
|
||||
|
||||
@ -1481,9 +1482,9 @@ struct string_list* cdrom_get_available_drives(void)
|
||||
attr.i = path[0];
|
||||
|
||||
if (!string_is_empty(drive_model))
|
||||
strlcpy(drive_string, drive_model, sizeof(drive_string));
|
||||
strlcat(drive_string, drive_model, sizeof(drive_string));
|
||||
else
|
||||
strlcpy(drive_string, "Unknown Drive", sizeof(drive_string));
|
||||
strlcat(drive_string, "Unknown Drive", sizeof(drive_string));
|
||||
|
||||
string_list_append(list, drive_string, attr);
|
||||
}
|
||||
@ -1523,7 +1524,9 @@ bool cdrom_drive_has_media(const char drive)
|
||||
if (file)
|
||||
{
|
||||
libretro_vfs_implementation_file *stream = filestream_get_vfs_handle(file);
|
||||
bool has_media = cdrom_is_media_inserted(stream);
|
||||
bool has_media = false;
|
||||
|
||||
has_media = cdrom_is_media_inserted(stream);
|
||||
|
||||
filestream_close(file);
|
||||
|
||||
@ -1535,14 +1538,14 @@ bool cdrom_drive_has_media(const char drive)
|
||||
|
||||
bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled)
|
||||
{
|
||||
int i;
|
||||
/* MMC Command: MODE SENSE (10) and MODE SELECT (10) */
|
||||
unsigned char cdb_sense_changeable[] = {0x5A, 0, 0x48, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char cdb_sense[] = {0x5A, 0, 0x8, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char cdb_select[] = {0x55, 0x10, 0, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char buf[20] = {0};
|
||||
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf),
|
||||
cdb_sense_changeable, sizeof(cdb_sense_changeable), 0);
|
||||
unsigned char cdb_sense[] = {0x5A, 0, 0x8, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char cdb_select[] = {0x55, 0x10, 0, 0, 0, 0, 0, 0, 0x14, 0};
|
||||
unsigned char buf[20] = {0};
|
||||
int rv, i;
|
||||
|
||||
rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb_sense_changeable, sizeof(cdb_sense_changeable), 0);
|
||||
|
||||
#ifdef CDROM_DEBUG
|
||||
printf("[CDROM] mode sense changeable status code %d\n", rv);
|
||||
@ -1578,7 +1581,9 @@ bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled
|
||||
printf("Mode sense data for caching mode page: ");
|
||||
|
||||
for (i = 0; i < (int)sizeof(buf); i++)
|
||||
{
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
@ -1591,7 +1596,7 @@ bool cdrom_set_read_cache(libretro_vfs_implementation_file *stream, bool enabled
|
||||
if (enabled)
|
||||
buf[10] &= ~1;
|
||||
else
|
||||
buf[10] |= 1;
|
||||
buf[10] |= 1;
|
||||
|
||||
rv = cdrom_send_command(stream, DIRECTION_OUT, buf, sizeof(buf), cdb_select, sizeof(cdb_select), 0);
|
||||
|
||||
@ -1640,7 +1645,9 @@ bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_ti
|
||||
printf("Mode sense data for timeout groups: ");
|
||||
|
||||
for (i = 0; i < (int)sizeof(buf); i++)
|
||||
{
|
||||
printf("%02X ", buf[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
@ -1662,8 +1669,8 @@ bool cdrom_get_timeouts(libretro_vfs_implementation_file *stream, cdrom_group_ti
|
||||
bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
|
||||
{
|
||||
/* MMC Command: READ TOC/PMA/ATIP */
|
||||
unsigned char cdb[] = {0x43, 0x2, 0x4, 0, 0, 0, 0, 0x9, 0x30, 0};
|
||||
unsigned char buf[32] = {0};
|
||||
unsigned char cdb[] = {0x43, 0x2, 0x4, 0, 0, 0, 0, 0x9, 0x30, 0};
|
||||
unsigned char buf[32] = {0};
|
||||
unsigned short atip_len = 0;
|
||||
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
|
||||
|
||||
@ -1673,10 +1680,7 @@ bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
|
||||
atip_len = buf[0] << 8 | buf[1];
|
||||
|
||||
#ifdef CDROM_DEBUG
|
||||
printf("ATIP Length %d, Disc Type %d, Disc Sub-Type %d\n",
|
||||
atip_len,
|
||||
(buf[6] >> 6) & 0x1,
|
||||
((buf[6] >> 5) & 0x1) << 2 | ((buf[6] >> 4) & 0x1) << 1 | ((buf[6] >> 3) & 0x1) << 0);
|
||||
printf("ATIP Length %d, Disc Type %d, Disc Sub-Type %d\n", atip_len, (buf[6] >> 6) & 0x1, ((buf[6] >> 5) & 0x1) << 2 | ((buf[6] >> 4) & 0x1) << 1 | ((buf[6] >> 3) & 0x1) << 0);
|
||||
#endif
|
||||
|
||||
if (atip_len < 5)
|
||||
@ -1687,23 +1691,30 @@ bool cdrom_has_atip(libretro_vfs_implementation_file *stream)
|
||||
|
||||
void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char track, bool is_cue)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
if (!path || len == 0)
|
||||
return;
|
||||
|
||||
if (is_cue)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
size_t pos = strlcpy(path, "cdrom://", len);
|
||||
pos = strlcpy(path, "cdrom://", len);
|
||||
|
||||
if (len > pos)
|
||||
path[pos++] = drive;
|
||||
|
||||
pos = strlcat(path, ":/drive.cue", len);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
size_t pos = strlcpy(path, "cdrom://drive", len);
|
||||
pos = strlcpy(path, "cdrom://drive", len);
|
||||
|
||||
if (len > pos + 1)
|
||||
{
|
||||
path[pos++] = drive;
|
||||
path[pos] = '\0';
|
||||
path[pos] = '\0';
|
||||
}
|
||||
|
||||
pos = strlcat(path, ".cue", len);
|
||||
#endif
|
||||
#endif
|
||||
@ -1711,18 +1722,22 @@ void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char tra
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
size_t pos = strlcpy(path, "cdrom://", len);
|
||||
pos = strlcpy(path, "cdrom://", len);
|
||||
|
||||
if (len > pos + 1)
|
||||
{
|
||||
path[pos++] = drive;
|
||||
path[pos] = '\0';
|
||||
path[pos] = '\0';
|
||||
}
|
||||
|
||||
pos += snprintf(path + pos, len - pos, ":/drive-track%02d.bin", track);
|
||||
#else
|
||||
#ifdef __linux__
|
||||
size_t pos = strlcpy(path, "cdrom://drive", len);
|
||||
pos = strlcpy(path, "cdrom://drive", len);
|
||||
|
||||
if (len > pos)
|
||||
path[pos++] = drive;
|
||||
|
||||
pos += snprintf(path + pos, len - pos, "-track%02d.bin", track);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -60,3 +60,10 @@ size_t strlcat(char *dest, const char *source, size_t size)
|
||||
return len + strlcpy(dest, source, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *strldup(const char *s, size_t n)
|
||||
{
|
||||
char *dst = (char*)malloc(sizeof(char) * (n + 1));
|
||||
strlcpy(dst, s, n);
|
||||
return dst;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -69,31 +68,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
/* Time format strings with AM-PM designation require special
|
||||
* handling due to platform dependence */
|
||||
void strftime_am_pm(char *s, size_t len, const char* format,
|
||||
const void *ptr)
|
||||
{
|
||||
char *local = NULL;
|
||||
const struct tm *timeptr = (const struct tm*)ptr;
|
||||
|
||||
/* Ensure correct locale is set
|
||||
* > Required for localised AM/PM strings */
|
||||
setlocale(LC_TIME, "");
|
||||
|
||||
strftime(s, len, format, timeptr);
|
||||
#if !(defined(__linux__) && !defined(ANDROID))
|
||||
if ((local = local_to_utf8_string_alloc(s)))
|
||||
{
|
||||
if (!string_is_empty(local))
|
||||
strlcpy(s, local, len);
|
||||
|
||||
free(local);
|
||||
local = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new linked list with one node in it
|
||||
* The path on this node will be set to NULL
|
||||
@ -198,9 +172,9 @@ const char *path_get_archive_delim(const char *path)
|
||||
string_to_lower(buf);
|
||||
|
||||
/* Check if this is a '.zip', '.apk' or '.7z' file */
|
||||
if ( string_is_equal(buf, ".zip")
|
||||
|| string_is_equal(buf, ".apk")
|
||||
|| string_is_equal(buf + 1, ".7z"))
|
||||
if (string_is_equal(buf, ".zip") ||
|
||||
string_is_equal(buf, ".apk") ||
|
||||
string_is_equal(buf + 1, ".7z"))
|
||||
return delim;
|
||||
}
|
||||
else if (delim - path > 3)
|
||||
@ -328,16 +302,14 @@ bool path_is_compressed_file(const char* path)
|
||||
size_t fill_pathname(char *out_path, const char *in_path,
|
||||
const char *replace, size_t size)
|
||||
{
|
||||
size_t _len;
|
||||
char tmp_path[PATH_MAX_LENGTH];
|
||||
char *tok = NULL;
|
||||
strlcpy(tmp_path, in_path, sizeof(tmp_path));
|
||||
if ((tok = (char*)strrchr(path_basename(tmp_path), '.')))
|
||||
*tok = '\0';
|
||||
|
||||
_len = strlcpy(out_path, tmp_path, size);
|
||||
_len += strlcpy(out_path + _len, replace, size - _len);
|
||||
return _len;
|
||||
strlcpy(out_path, tmp_path, size);
|
||||
return strlcat(out_path, replace, size);
|
||||
}
|
||||
|
||||
|
||||
@ -347,20 +319,21 @@ size_t fill_pathname(char *out_path, const char *in_path,
|
||||
* @size : size of path
|
||||
*
|
||||
* Find last slash in path. Tries to find
|
||||
* a backslash as used for Windows paths,
|
||||
* otherwise checks for a regular slash.
|
||||
* a backslash on Windows too which takes precedence
|
||||
* over regular slash.
|
||||
|
||||
* @return pointer to last slash/backslash found in @str.
|
||||
**/
|
||||
char *find_last_slash(const char *str)
|
||||
{
|
||||
const char *slash = strrchr(str, '/');
|
||||
#ifdef _WIN32
|
||||
const char *backslash = strrchr(str, '\\');
|
||||
|
||||
if (!slash || (backslash > slash))
|
||||
return (char*)backslash;
|
||||
else
|
||||
return (char*)slash;
|
||||
#endif
|
||||
return (char*)slash;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -371,20 +344,24 @@ char *find_last_slash(const char *str)
|
||||
* Assumes path is a directory. Appends a slash
|
||||
* if not already there.
|
||||
**/
|
||||
size_t fill_pathname_slash(char *path, size_t size)
|
||||
void fill_pathname_slash(char *path, size_t size)
|
||||
{
|
||||
size_t path_len;
|
||||
const char *last_slash = find_last_slash(path);
|
||||
|
||||
if (!last_slash)
|
||||
return strlcat(path, PATH_DEFAULT_SLASH(), size);
|
||||
path_len = strlen(path);
|
||||
{
|
||||
strlcat(path, PATH_DEFAULT_SLASH(), size);
|
||||
return;
|
||||
}
|
||||
|
||||
path_len = strlen(path);
|
||||
/* Try to preserve slash type. */
|
||||
if (last_slash != (path + path_len - 1))
|
||||
{
|
||||
path[ path_len] = last_slash[0];
|
||||
path[++path_len] = '\0';
|
||||
path[path_len] = last_slash[0];
|
||||
path[path_len+1] = '\0';
|
||||
}
|
||||
return path_len;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,11 +384,12 @@ size_t fill_pathname_slash(char *path, size_t size)
|
||||
size_t fill_pathname_dir(char *in_dir, const char *in_basename,
|
||||
const char *replace, size_t size)
|
||||
{
|
||||
size_t _len = fill_pathname_slash(in_dir, size);
|
||||
const char *base = path_basename(in_basename);
|
||||
_len += strlcpy(in_dir + _len, base, size - _len);
|
||||
_len += strlcpy(in_dir + _len, replace, size - _len);
|
||||
return _len;
|
||||
const char *base = NULL;
|
||||
|
||||
fill_pathname_slash(in_dir, size);
|
||||
base = path_basename(in_basename);
|
||||
strlcat(in_dir, base, size);
|
||||
return strlcat(in_dir, replace, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -536,14 +514,14 @@ void fill_pathname_parent_dir(char *out_dir,
|
||||
size_t fill_dated_filename(char *out_filename,
|
||||
const char *ext, size_t size)
|
||||
{
|
||||
size_t _len;
|
||||
struct tm tm_;
|
||||
time_t cur_time = time(NULL);
|
||||
struct tm tm_;
|
||||
|
||||
rtime_localtime(&cur_time, &tm_);
|
||||
_len = strftime(out_filename, size,
|
||||
|
||||
strftime(out_filename, size,
|
||||
"RetroArch-%m%d-%H%M%S", &tm_);
|
||||
_len += strlcpy(out_filename + _len, ext, size - _len);
|
||||
return _len;
|
||||
return strlcat(out_filename, ext, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -564,24 +542,21 @@ size_t fill_dated_filename(char *out_filename,
|
||||
size_t fill_str_dated_filename(char *out_filename,
|
||||
const char *in_str, const char *ext, size_t size)
|
||||
{
|
||||
struct tm tm_;
|
||||
char format[NAME_MAX_LENGTH];
|
||||
size_t _len = 0;
|
||||
struct tm tm_;
|
||||
time_t cur_time = time(NULL);
|
||||
|
||||
rtime_localtime(&cur_time, &tm_);
|
||||
_len = strlcpy(out_filename, in_str, size);
|
||||
|
||||
strlcpy(out_filename, in_str, size);
|
||||
if (string_is_empty(ext))
|
||||
{
|
||||
strftime(format, sizeof(format), "-%y%m%d-%H%M%S", &tm_);
|
||||
_len += strlcpy(out_filename + _len, format, size - _len);
|
||||
return strlcat(out_filename, format, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", &tm_);
|
||||
_len += strlcpy(out_filename + _len, format, size - _len);
|
||||
_len += strlcpy(out_filename + _len, ext, size - _len);
|
||||
}
|
||||
return _len;
|
||||
strftime(format, sizeof(format), "-%y%m%d-%H%M%S.", &tm_);
|
||||
strlcat(out_filename, format, size);
|
||||
return strlcat(out_filename, ext, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -651,12 +626,18 @@ void path_parent_dir(char *path, size_t len)
|
||||
**/
|
||||
const char *path_basename(const char *path)
|
||||
{
|
||||
/* We cut either at the first compression-related hash,
|
||||
* or we cut at the last slash */
|
||||
const char *ptr = NULL;
|
||||
if ( (ptr = path_get_archive_delim(path))
|
||||
|| (ptr = find_last_slash(path)))
|
||||
return ptr + 1;
|
||||
/* We cut at the first compression-related hash */
|
||||
const char *delim = path_get_archive_delim(path);
|
||||
if (delim)
|
||||
return delim + 1;
|
||||
|
||||
{
|
||||
/* We cut at the last slash */
|
||||
const char *last = find_last_slash(path);
|
||||
if (last)
|
||||
return last + 1;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@ -689,23 +670,24 @@ const char *path_basename_nocompression(const char *path)
|
||||
**/
|
||||
bool path_is_absolute(const char *path)
|
||||
{
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
if (path[0] == '/')
|
||||
return true;
|
||||
if (string_is_empty(path))
|
||||
return false;
|
||||
|
||||
if (path[0] == '/')
|
||||
return true;
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Many roads lead to Rome...
|
||||
* Note: Drive letter can only be 1 character long */
|
||||
return ( string_starts_with_size(path, "\\\\", STRLEN_CONST("\\\\"))
|
||||
|| string_starts_with_size(path + 1, ":/", STRLEN_CONST(":/"))
|
||||
|| string_starts_with_size(path + 1, ":\\", STRLEN_CONST(":\\")));
|
||||
/* Many roads lead to Rome...
|
||||
* Note: Drive letter can only be 1 character long */
|
||||
return ( string_starts_with_size(path, "\\\\", STRLEN_CONST("\\\\"))
|
||||
|| string_starts_with_size(path + 1, ":/", STRLEN_CONST(":/"))
|
||||
|| string_starts_with_size(path + 1, ":\\", STRLEN_CONST(":\\")));
|
||||
#elif defined(__wiiu__) || defined(VITA)
|
||||
{
|
||||
const char *seperator = strchr(path, ':');
|
||||
return (seperator && (seperator[1] == '/'));
|
||||
}
|
||||
#endif
|
||||
{
|
||||
const char *seperator = strchr(path, ':');
|
||||
return (seperator && (seperator[1] == '/'));
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -731,7 +713,7 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
||||
{
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
#ifdef _WIN32
|
||||
char *ret = NULL;
|
||||
char *ret = NULL;
|
||||
wchar_t *rel_path = utf8_to_utf16_string_alloc(buf);
|
||||
|
||||
if (rel_path)
|
||||
@ -785,13 +767,13 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
||||
{
|
||||
size_t len;
|
||||
/* rebase on working directory */
|
||||
if (!getcwd(tmp, PATH_MAX_LENGTH - 1))
|
||||
if (!getcwd(tmp, PATH_MAX_LENGTH-1))
|
||||
return NULL;
|
||||
|
||||
len = strlen(tmp);
|
||||
t += len;
|
||||
t += len;
|
||||
|
||||
if (tmp[len - 1] != '/')
|
||||
if (tmp[len-1] != '/')
|
||||
tmp[t++] = '/';
|
||||
|
||||
if (string_is_empty(buf))
|
||||
@ -822,8 +804,8 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
||||
return NULL;
|
||||
|
||||
/* delete previous segment in tmp by adjusting size t
|
||||
* tmp[t - 1] == '/', find '/' before that */
|
||||
t -= 2;
|
||||
* tmp[t-1] == '/', find '/' before that */
|
||||
t = t-2;
|
||||
while (tmp[t] != '/')
|
||||
t--;
|
||||
t++;
|
||||
@ -835,7 +817,7 @@ char *path_resolve_realpath(char *buf, size_t size, bool resolve_symlinks)
|
||||
else
|
||||
{
|
||||
/* fail when truncating */
|
||||
if (t + next - p + 1 > PATH_MAX_LENGTH - 1)
|
||||
if (t + next-p+1 > PATH_MAX_LENGTH-1)
|
||||
return NULL;
|
||||
|
||||
while (p <= next)
|
||||
@ -954,13 +936,11 @@ void fill_pathname_resolve_relative(char *out_path,
|
||||
size_t fill_pathname_join(char *out_path,
|
||||
const char *dir, const char *path, size_t size)
|
||||
{
|
||||
size_t _len = 0;
|
||||
if (out_path != dir)
|
||||
_len = strlcpy(out_path, dir, size);
|
||||
strlcpy(out_path, dir, size);
|
||||
if (*out_path)
|
||||
_len = fill_pathname_slash(out_path, size);
|
||||
_len += strlcpy(out_path + _len, path, size - _len);
|
||||
return _len;
|
||||
fill_pathname_slash(out_path, size);
|
||||
return strlcat(out_path, path, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -994,19 +974,18 @@ size_t fill_pathname_join_special(char *out_path,
|
||||
/* Try to preserve slash type. */
|
||||
if (last_slash != (out_path + len - 1))
|
||||
{
|
||||
out_path[ len] = last_slash[0];
|
||||
out_path[++len] = '\0';
|
||||
out_path[len] = last_slash[0];
|
||||
out_path[len+1] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out_path[ len] = PATH_DEFAULT_SLASH_C();
|
||||
out_path[++len] = '\0';
|
||||
out_path[len] = PATH_DEFAULT_SLASH_C();
|
||||
out_path[len+1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
len += strlcpy(out_path + len, path, size - len);
|
||||
return len;
|
||||
return strlcat(out_path, path, size);
|
||||
}
|
||||
|
||||
size_t fill_pathname_join_special_ext(char *out_path,
|
||||
@ -1014,12 +993,12 @@ size_t fill_pathname_join_special_ext(char *out_path,
|
||||
const char *last, const char *ext,
|
||||
size_t size)
|
||||
{
|
||||
size_t _len = fill_pathname_join(out_path, dir, path, size);
|
||||
fill_pathname_join(out_path, dir, path, size);
|
||||
if (*out_path)
|
||||
_len = fill_pathname_slash(out_path, size);
|
||||
_len += strlcpy(out_path + _len, last, size - _len);
|
||||
_len += strlcpy(out_path + _len, ext, size - _len);
|
||||
return _len;
|
||||
fill_pathname_slash(out_path, size);
|
||||
|
||||
strlcat(out_path, last, size);
|
||||
return strlcat(out_path, ext, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1036,19 +1015,19 @@ size_t fill_pathname_join_special_ext(char *out_path,
|
||||
size_t fill_pathname_join_delim(char *out_path, const char *dir,
|
||||
const char *path, const char delim, size_t size)
|
||||
{
|
||||
size_t _len;
|
||||
/* Behavior of strlcpy is undefined if dst and src overlap */
|
||||
size_t copied;
|
||||
/* behavior of strlcpy is undefined if dst and src overlap */
|
||||
if (out_path == dir)
|
||||
_len = strlen(dir);
|
||||
copied = strlen(dir);
|
||||
else
|
||||
_len = strlcpy(out_path, dir, size);
|
||||
copied = strlcpy(out_path, dir, size);
|
||||
|
||||
out_path[_len] = delim;
|
||||
out_path[_len+1] = '\0';
|
||||
out_path[copied] = delim;
|
||||
out_path[copied+1] = '\0';
|
||||
|
||||
if (path)
|
||||
return strlcat(out_path, path, size);
|
||||
return _len;
|
||||
return copied;
|
||||
}
|
||||
|
||||
size_t fill_pathname_expand_special(char *out_path,
|
||||
@ -1156,12 +1135,12 @@ size_t fill_pathname_abbreviate_special(char *out_path,
|
||||
*
|
||||
* Leaf function.
|
||||
*
|
||||
* Changes the slashes to the correct kind for the OS
|
||||
* Changes the slashes to the correct kind for the os
|
||||
* So forward slash on linux and backslash on Windows
|
||||
**/
|
||||
void pathname_conform_slashes_to_os(char *path)
|
||||
{
|
||||
/* Conform slashes to OS standard so we get proper matching */
|
||||
/* Conform slashes to os standard so we get proper matching */
|
||||
char *p;
|
||||
for (p = path; *p; p++)
|
||||
if (*p == '/' || *p == '\\')
|
||||
@ -1179,7 +1158,7 @@ void pathname_conform_slashes_to_os(char *path)
|
||||
**/
|
||||
void pathname_make_slashes_portable(char *path)
|
||||
{
|
||||
/* Conform slashes to OS standard so we get proper matching */
|
||||
/* Conform slashes to os standard so we get proper matching */
|
||||
char *p;
|
||||
for (p = path; *p; p++)
|
||||
if (*p == '/' || *p == '\\')
|
||||
@ -1355,8 +1334,8 @@ void fill_pathname_application_path(char *s, size_t len)
|
||||
if (realpath(s, resolved_bundle_dir_buf))
|
||||
{
|
||||
size_t _len = strlcpy(s, resolved_bundle_dir_buf, len - 1);
|
||||
s[ _len] = '/';
|
||||
s[++_len] = '\0';
|
||||
s[_len ] = '/';
|
||||
s[_len+1] = '\0';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -131,6 +131,7 @@ struct gl_cached_state
|
||||
GLenum func;
|
||||
} depthfunc;
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
bool used;
|
||||
@ -167,7 +168,7 @@ struct gl_cached_state
|
||||
GLenum mode;
|
||||
} frontface;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
bool used;
|
||||
GLenum mode;
|
||||
@ -193,7 +194,7 @@ struct gl_cached_state
|
||||
GLuint vao;
|
||||
GLuint framebuf;
|
||||
GLuint array_buffer;
|
||||
GLuint program;
|
||||
GLuint program;
|
||||
GLenum active_texture;
|
||||
int cap_state[SGL_CAP_MAX];
|
||||
int cap_translate[SGL_CAP_MAX];
|
||||
@ -334,6 +335,7 @@ void rglTexSubImage2D(
|
||||
width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
|
||||
void rglGetBufferSubData( GLenum target,
|
||||
GLintptr offset,
|
||||
GLsizeiptr size,
|
||||
@ -468,7 +470,7 @@ void rglFrontFace(GLenum mode)
|
||||
glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL);
|
||||
glFrontFace(mode);
|
||||
gl_state.frontface.used = true;
|
||||
gl_state.frontface.mode = mode;
|
||||
gl_state.frontface.mode = mode;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -644,25 +646,25 @@ void rglBlendFunc(GLenum sfactor, GLenum dfactor)
|
||||
* Core in:
|
||||
* OpenGL : 1.4
|
||||
*/
|
||||
void rglBlendFuncSeparate(GLenum sfactor, GLenum dfactor)
|
||||
void rglBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
||||
{
|
||||
#ifdef GLSM_DEBUG
|
||||
log_cb(RETRO_LOG_INFO, "glBlendFuncSeparate.\n");
|
||||
#endif
|
||||
glsm_ctl(GLSM_CTL_IMM_VBO_DRAW, NULL);
|
||||
gl_state.blendfunc_separate.used = true;
|
||||
gl_state.blendfunc_separate.srcRGB = sfactor;
|
||||
gl_state.blendfunc_separate.dstRGB = dfactor;
|
||||
gl_state.blendfunc_separate.srcAlpha = sfactor;
|
||||
gl_state.blendfunc_separate.dstAlpha = dfactor;
|
||||
glBlendFunc(sfactor, dfactor);
|
||||
gl_state.blendfunc_separate.srcRGB = srcRGB;
|
||||
gl_state.blendfunc_separate.dstRGB = dstRGB;
|
||||
gl_state.blendfunc_separate.srcAlpha = srcAlpha;
|
||||
gl_state.blendfunc_separate.dstAlpha = dstAlpha;
|
||||
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
/*
|
||||
* Category: Textures
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.3
|
||||
* OpenGL : 1.3
|
||||
*/
|
||||
void rglActiveTexture(GLenum texture)
|
||||
{
|
||||
@ -723,7 +725,7 @@ void rglEnable(GLenum cap)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUseProgram(GLuint program)
|
||||
{
|
||||
@ -828,7 +830,7 @@ void rglLinkProgram(GLuint program)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglFramebufferTexture2D(GLenum target, GLenum attachment,
|
||||
@ -892,10 +894,11 @@ void rglCompressedTexImage2D(GLenum target, GLint level,
|
||||
#ifdef GLSM_DEBUG
|
||||
log_cb(RETRO_LOG_INFO, "glCompressedTexImage2D.\n");
|
||||
#endif
|
||||
glCompressedTexImage2D(target, level, internalformat,
|
||||
glCompressedTexImage2D(target, level, internalformat,
|
||||
width, height, border, imageSize, data);
|
||||
}
|
||||
|
||||
|
||||
void rglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
|
||||
{
|
||||
#ifdef GLSM_DEBUG
|
||||
@ -915,7 +918,7 @@ void rglDeleteTextures(GLsizei n, const GLuint *textures)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGLES : 2.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglRenderbufferStorage(GLenum target, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height)
|
||||
@ -931,7 +934,7 @@ void rglRenderbufferStorage(GLenum target, GLenum internalFormat,
|
||||
* Core in:
|
||||
*
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 2.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglBindRenderbuffer(GLenum target, GLuint renderbuffer)
|
||||
{
|
||||
@ -945,7 +948,7 @@ void rglBindRenderbuffer(GLenum target, GLuint renderbuffer)
|
||||
*
|
||||
* Core in:
|
||||
*
|
||||
* OpenGLES : 2.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
{
|
||||
@ -960,7 +963,7 @@ void rglDeleteRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
* Core in:
|
||||
*
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 2.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
{
|
||||
@ -975,7 +978,7 @@ void rglGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
* Core in:
|
||||
*
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 2.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglGenerateMipmap(GLenum target)
|
||||
{
|
||||
@ -989,7 +992,7 @@ void rglGenerateMipmap(GLenum target)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
*/
|
||||
GLenum rglCheckFramebufferStatus(GLenum target)
|
||||
{
|
||||
@ -1003,7 +1006,7 @@ GLenum rglCheckFramebufferStatus(GLenum target)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 2.0
|
||||
*/
|
||||
void rglFramebufferRenderbuffer(GLenum target, GLenum attachment,
|
||||
@ -1019,7 +1022,7 @@ void rglFramebufferRenderbuffer(GLenum target, GLenum attachment,
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
*/
|
||||
void rglBindFragDataLocation(GLuint program, GLuint colorNumber,
|
||||
const char * name)
|
||||
@ -1027,16 +1030,17 @@ void rglBindFragDataLocation(GLuint program, GLuint colorNumber,
|
||||
#ifdef GLSM_DEBUG
|
||||
log_cb(RETRO_LOG_INFO, "glBindFragDataLocation.\n");
|
||||
#endif
|
||||
#if !defined(HAVE_OPENGLES2)
|
||||
#if !defined(HAVE_OPENGLES2) && !defined(HAVE_OPENGLES3)
|
||||
glBindFragDataLocation(program, colorNumber, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params)
|
||||
{
|
||||
@ -1050,7 +1054,7 @@ void rglGetProgramiv(GLuint shader, GLenum pname, GLint *params)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 4.1
|
||||
* OpenGL : 4.1
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglProgramParameteri( GLuint program,
|
||||
@ -1070,7 +1074,7 @@ void rglProgramParameteri( GLuint program,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
|
||||
GLsizei *length, GLint *size, GLenum *type, GLchar *name)
|
||||
@ -1136,12 +1140,13 @@ void rglEndQuery( GLenum target)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Category: UBO
|
||||
*
|
||||
* Core in:
|
||||
*
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglGetActiveUniformBlockiv(GLuint program,
|
||||
@ -1273,7 +1278,7 @@ void rglUniformBlockBinding( GLuint program,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglUniform1ui(GLint location, GLuint v)
|
||||
@ -1289,7 +1294,7 @@ void rglUniform1ui(GLint location, GLuint v)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglUniform2ui(GLint location, GLuint v0, GLuint v1)
|
||||
@ -1305,7 +1310,7 @@ void rglUniform2ui(GLint location, GLuint v0, GLuint v1)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
|
||||
@ -1321,7 +1326,7 @@ void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
|
||||
@ -1337,7 +1342,7 @@ void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value)
|
||||
@ -1352,7 +1357,7 @@ void rglUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglDetachShader(GLuint program, GLuint shader)
|
||||
{
|
||||
@ -1366,7 +1371,7 @@ void rglDetachShader(GLuint program, GLuint shader)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params)
|
||||
{
|
||||
@ -1380,7 +1385,7 @@ void rglGetShaderiv(GLuint shader, GLenum pname, GLint *params)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglAttachShader(GLuint program, GLuint shader)
|
||||
{
|
||||
@ -1393,7 +1398,7 @@ void rglAttachShader(GLuint program, GLuint shader)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
GLint rglGetAttribLocation(GLuint program, const GLchar *name)
|
||||
{
|
||||
@ -1407,7 +1412,7 @@ GLint rglGetAttribLocation(GLuint program, const GLchar *name)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglShaderSource(GLuint shader, GLsizei count,
|
||||
const GLchar **string, const GLint *length)
|
||||
@ -1422,7 +1427,7 @@ void rglShaderSource(GLuint shader, GLsizei count,
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglCompileShader(GLuint shader)
|
||||
{
|
||||
@ -1436,7 +1441,7 @@ void rglCompileShader(GLuint shader)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
GLuint rglCreateProgram(void)
|
||||
{
|
||||
@ -1449,7 +1454,7 @@ GLuint rglCreateProgram(void)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.1
|
||||
* OpenGL : 1.1
|
||||
*/
|
||||
void rglGenTextures(GLsizei n, GLuint *textures)
|
||||
{
|
||||
@ -1462,7 +1467,7 @@ void rglGenTextures(GLsizei n, GLuint *textures)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglGetShaderInfoLog(GLuint shader, GLsizei maxLength,
|
||||
GLsizei *length, GLchar *infoLog)
|
||||
@ -1476,7 +1481,7 @@ void rglGetShaderInfoLog(GLuint shader, GLsizei maxLength,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglGetProgramInfoLog(GLuint shader, GLsizei maxLength,
|
||||
GLsizei *length, GLchar *infoLog)
|
||||
@ -1490,7 +1495,7 @@ void rglGetProgramInfoLog(GLuint shader, GLsizei maxLength,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
GLboolean rglIsProgram(GLuint program)
|
||||
{
|
||||
@ -1500,6 +1505,7 @@ GLboolean rglIsProgram(GLuint program)
|
||||
return glIsProgram(program);
|
||||
}
|
||||
|
||||
|
||||
void rglTexCoord2f(GLfloat s, GLfloat t)
|
||||
{
|
||||
#ifdef HAVE_LEGACY_GL
|
||||
@ -1514,7 +1520,7 @@ void rglTexCoord2f(GLfloat s, GLfloat t)
|
||||
* Category: Generic vertex attributes
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*
|
||||
*/
|
||||
void rglDisableVertexAttribArray(GLuint index)
|
||||
@ -1530,7 +1536,7 @@ void rglDisableVertexAttribArray(GLuint index)
|
||||
* Category: Generic vertex attributes
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglEnableVertexAttribArray(GLuint index)
|
||||
{
|
||||
@ -1546,7 +1552,7 @@ void rglEnableVertexAttribArray(GLuint index)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglVertexAttribIPointer(
|
||||
GLuint index,
|
||||
@ -1582,7 +1588,7 @@ void rglVertexAttribLPointer(
|
||||
* Category: Generic vertex attributes
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglVertexAttribPointer(GLuint name, GLint size,
|
||||
GLenum type, GLboolean normalized, GLsizei stride,
|
||||
@ -1605,7 +1611,7 @@ void rglVertexAttribPointer(GLuint name, GLint size,
|
||||
* Category: Generic vertex attributes
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
|
||||
{
|
||||
@ -1618,7 +1624,7 @@ void rglBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y,
|
||||
GLfloat z, GLfloat w)
|
||||
@ -1632,7 +1638,7 @@ void rglVertexAttrib4f(GLuint name, GLfloat x, GLfloat y,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglVertexAttrib4fv(GLuint name, GLfloat* v)
|
||||
{
|
||||
@ -1646,7 +1652,7 @@ void rglVertexAttrib4fv(GLuint name, GLfloat* v)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
GLuint rglCreateShader(GLenum shaderType)
|
||||
{
|
||||
@ -1660,7 +1666,7 @@ GLuint rglCreateShader(GLenum shaderType)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglDeleteProgram(GLuint program)
|
||||
{
|
||||
@ -1674,7 +1680,7 @@ void rglDeleteProgram(GLuint program)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglDeleteShader(GLuint shader)
|
||||
{
|
||||
@ -1688,7 +1694,7 @@ void rglDeleteShader(GLuint shader)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
GLint rglGetUniformLocation(GLuint program, const GLchar *name)
|
||||
{
|
||||
@ -1702,7 +1708,7 @@ GLint rglGetUniformLocation(GLuint program, const GLchar *name)
|
||||
* Category: VBO and PBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.5
|
||||
* OpenGL : 1.5
|
||||
*/
|
||||
void rglDeleteBuffers(GLsizei n, const GLuint *buffers)
|
||||
{
|
||||
@ -1716,7 +1722,7 @@ void rglDeleteBuffers(GLsizei n, const GLuint *buffers)
|
||||
* Category: VBO and PBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.5
|
||||
* OpenGL : 1.5
|
||||
*/
|
||||
void rglGenBuffers(GLsizei n, GLuint *buffers)
|
||||
{
|
||||
@ -1730,7 +1736,7 @@ void rglGenBuffers(GLsizei n, GLuint *buffers)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform1f(GLint location, GLfloat v0)
|
||||
{
|
||||
@ -1744,7 +1750,7 @@ void rglUniform1f(GLint location, GLfloat v0)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
{
|
||||
@ -1758,7 +1764,7 @@ void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform1iv(GLint location, GLsizei count, const GLint *value)
|
||||
{
|
||||
@ -1793,7 +1799,7 @@ void rglTexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
const GLubyte* rglGetStringi(GLenum name, GLuint index)
|
||||
@ -1824,7 +1830,7 @@ void rglClearBufferfi( GLenum buffer,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglRenderbufferStorageMultisample( GLenum target,
|
||||
@ -1845,7 +1851,7 @@ void rglRenderbufferStorageMultisample( GLenum target,
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform1i(GLint location, GLint v0)
|
||||
{
|
||||
@ -1859,7 +1865,7 @@ void rglUniform1i(GLint location, GLint v0)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform2f(GLint location, GLfloat v0, GLfloat v1)
|
||||
{
|
||||
@ -1873,7 +1879,7 @@ void rglUniform2f(GLint location, GLfloat v0, GLfloat v1)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform2i(GLint location, GLint v0, GLint v1)
|
||||
{
|
||||
@ -1887,7 +1893,7 @@ void rglUniform2i(GLint location, GLint v0, GLint v1)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
{
|
||||
@ -1901,7 +1907,7 @@ void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
|
||||
{
|
||||
@ -1915,7 +1921,7 @@ void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
{
|
||||
@ -1943,7 +1949,7 @@ void rglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
|
||||
{
|
||||
@ -1957,7 +1963,7 @@ void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3
|
||||
* Category: Shaders
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
{
|
||||
@ -1967,10 +1973,11 @@ void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value)
|
||||
glUniform4fv(location, count, value);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.0
|
||||
* OpenGL : 1.0
|
||||
*/
|
||||
void rglPolygonOffset(GLfloat factor, GLfloat units)
|
||||
{
|
||||
@ -1988,7 +1995,7 @@ void rglPolygonOffset(GLfloat factor, GLfloat units)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
*/
|
||||
void rglGenFramebuffers(GLsizei n, GLuint *ids)
|
||||
{
|
||||
@ -2002,7 +2009,7 @@ void rglGenFramebuffers(GLsizei n, GLuint *ids)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
*/
|
||||
void rglBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||
{
|
||||
@ -2018,7 +2025,7 @@ void rglBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglDrawBuffers(GLsizei n, const GLenum *bufs)
|
||||
@ -2035,7 +2042,7 @@ void rglDrawBuffers(GLsizei n, const GLenum *bufs)
|
||||
* Category: FBO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void *rglMapBufferRange( GLenum target,
|
||||
@ -2104,7 +2111,7 @@ void rglDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsiz
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 4.2
|
||||
* OpenGL : 4.2
|
||||
* OpenGLES : 3.1
|
||||
*/
|
||||
void rglMemoryBarrier( GLbitfield barriers)
|
||||
@ -2122,7 +2129,7 @@ void rglMemoryBarrier( GLbitfield barriers)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 4.2
|
||||
* OpenGL : 4.2
|
||||
* OpenGLES : 3.1
|
||||
*/
|
||||
void rglBindImageTexture( GLuint unit,
|
||||
@ -2201,6 +2208,7 @@ void rglTexImage2DMultisample( GLenum target,
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void rglTexImage3D( GLenum target,
|
||||
GLint level,
|
||||
GLint internalFormat,
|
||||
@ -2223,7 +2231,7 @@ void rglTexImage3D( GLenum target,
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.5
|
||||
* OpenGL : 1.5
|
||||
*/
|
||||
void * rglMapBuffer( GLenum target, GLenum access)
|
||||
{
|
||||
@ -2240,7 +2248,7 @@ void * rglMapBuffer( GLenum target, GLenum access)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 1.5
|
||||
* OpenGL : 1.5
|
||||
*/
|
||||
GLboolean rglUnmapBuffer( GLenum target)
|
||||
{
|
||||
@ -2274,7 +2282,7 @@ void rglBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||
* Category: Blending
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
*/
|
||||
void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
|
||||
{
|
||||
@ -2287,7 +2295,7 @@ void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
|
||||
/*
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 2.0
|
||||
* OpenGL : 2.0
|
||||
* OpenGLES : 3.2
|
||||
*/
|
||||
void rglCopyImageSubData( GLuint srcName,
|
||||
@ -2332,7 +2340,7 @@ void rglCopyImageSubData( GLuint srcName,
|
||||
* Category: VAO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglBindVertexArray(GLuint array)
|
||||
@ -2349,7 +2357,7 @@ void rglBindVertexArray(GLuint array)
|
||||
* Category: VAO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglGenVertexArrays(GLsizei n, GLuint *arrays)
|
||||
@ -2366,7 +2374,7 @@ void rglGenVertexArrays(GLsizei n, GLuint *arrays)
|
||||
* Category: VAO
|
||||
*
|
||||
* Core in:
|
||||
* OpenGL : 3.0
|
||||
* OpenGL : 3.0
|
||||
* OpenGLES : 3.0
|
||||
*/
|
||||
void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays)
|
||||
@ -2593,7 +2601,7 @@ static void glsm_state_setup(void)
|
||||
default_framebuffer = glsm_get_current_framebuffer();
|
||||
gl_state.framebuf = default_framebuffer;
|
||||
gl_state.cullface.mode = GL_BACK;
|
||||
gl_state.frontface.mode = GL_CCW;
|
||||
gl_state.frontface.mode = GL_CCW;
|
||||
|
||||
gl_state.blendfunc_separate.used = false;
|
||||
gl_state.blendfunc_separate.srcRGB = GL_ONE;
|
||||
@ -2602,7 +2610,7 @@ static void glsm_state_setup(void)
|
||||
gl_state.blendfunc_separate.dstAlpha = GL_ZERO;
|
||||
|
||||
gl_state.depthfunc.used = false;
|
||||
|
||||
|
||||
gl_state.colormask.used = false;
|
||||
gl_state.colormask.red = GL_TRUE;
|
||||
gl_state.colormask.green = GL_TRUE;
|
||||
|
@ -323,10 +323,10 @@ size_t fill_dated_filename(char *out_filename,
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls time
|
||||
* - Calls rtime_localtime()
|
||||
* - Calls strlcpy 2x
|
||||
* - Calls strlcpy
|
||||
* - Calls string_is_empty()
|
||||
* - Calls strftime
|
||||
* - Calls strlcat
|
||||
* - Calls strlcat at least 2x
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
**/
|
||||
@ -369,7 +369,7 @@ char *find_last_slash(const char *str);
|
||||
* Hidden non-leaf function cost:
|
||||
* - Calls fill_pathname_slash()
|
||||
* - Calls path_basename()
|
||||
* - Calls strlcpy 2x
|
||||
* - Calls strlcat 2x
|
||||
**/
|
||||
size_t fill_pathname_dir(char *in_dir, const char *in_basename,
|
||||
const char *replace, size_t size);
|
||||
@ -470,8 +470,9 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
|
||||
* between directory and path.
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - calls strlcpy at least once
|
||||
* - calls strlcpy
|
||||
* - calls fill_pathname_slash()
|
||||
* - calls strlcat
|
||||
*
|
||||
* Deprecated. Use fill_pathname_join_special() instead
|
||||
* if you can ensure @dir != @out_path
|
||||
@ -498,8 +499,9 @@ size_t fill_pathname_join(char *out_path, const char *dir,
|
||||
* between directory and path.
|
||||
*
|
||||
* Hidden non-leaf function cost:
|
||||
* - calls strlcpy 2x
|
||||
* - calls strlcpy
|
||||
* - calls find_last_slash()
|
||||
* - calls strlcat
|
||||
*
|
||||
* @return Length of the string copied into @out_path
|
||||
**/
|
||||
@ -625,7 +627,7 @@ void path_basedir_wrapper(char *path);
|
||||
* - can call strlcat once if it returns false
|
||||
* - calls strlen
|
||||
**/
|
||||
size_t fill_pathname_slash(char *path, size_t size);
|
||||
void fill_pathname_slash(char *path, size_t size);
|
||||
|
||||
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
|
||||
void fill_pathname_application_path(char *buf, size_t size);
|
||||
@ -662,11 +664,6 @@ bool path_mkdir(const char *dir);
|
||||
*/
|
||||
bool path_is_directory(const char *path);
|
||||
|
||||
/* Time format strings with AM-PM designation require special
|
||||
* handling due to platform dependence */
|
||||
void strftime_am_pm(char *s, size_t len, const char* format,
|
||||
const void* timeptr);
|
||||
|
||||
bool path_is_character_special(const char *path);
|
||||
|
||||
int path_stat(const char *path);
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
#if defined(HAVE_OPENGLES2) || defined(HAVE_OPENGLES3)
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
#endif
|
||||
|
@ -291,7 +291,6 @@ enum retro_language
|
||||
RETRO_LANGUAGE_CATALAN = 29,
|
||||
RETRO_LANGUAGE_BRITISH_ENGLISH = 30,
|
||||
RETRO_LANGUAGE_HUNGARIAN = 31,
|
||||
RETRO_LANGUAGE_BELARUSIAN = 32,
|
||||
RETRO_LANGUAGE_LAST,
|
||||
|
||||
/* Ensure sizeof(enum) == sizeof(int) */
|
||||
@ -929,6 +928,8 @@ enum retro_mod
|
||||
* anything else.
|
||||
* It is recommended to expose all relevant pointers through
|
||||
* retro_get_memory_* as well.
|
||||
*
|
||||
* Can be called from retro_init and retro_load_game.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_SET_GEOMETRY 37
|
||||
/* const struct retro_game_geometry * --
|
||||
@ -1792,63 +1793,6 @@ enum retro_mod
|
||||
* this environment call to query support.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_JIT_CAPABLE 74
|
||||
/* bool * --
|
||||
* Result is set to true if the frontend has already verified JIT can be
|
||||
* used, mainly for use iOS/tvOS. On other platforms the result is true.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_MICROPHONE_INTERFACE (75 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_microphone_interface * --
|
||||
* Returns an interface that can be used to receive input from the microphone driver.
|
||||
*
|
||||
* Returns true if microphone support is available,
|
||||
* even if no microphones are plugged in.
|
||||
* Returns false if mic support is disabled or unavailable.
|
||||
*
|
||||
* This callback can be invoked at any time,
|
||||
* even before the microphone driver is ready.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE 76
|
||||
/* const struct retro_netpacket_callback * --
|
||||
* When set, a core gains control over network packets sent and
|
||||
* received during a multiplayer session. This can be used to
|
||||
* emulate multiplayer games that were originally played on two
|
||||
* or more separate consoles or computers connected together.
|
||||
*
|
||||
* The frontend will take care of connecting players together,
|
||||
* and the core only needs to send the actual data as needed for
|
||||
* the emulation, while handshake and connection management happen
|
||||
* in the background.
|
||||
*
|
||||
* When two or more players are connected and this interface has
|
||||
* been set, time manipulation features (such as pausing, slow motion,
|
||||
* fast forward, rewinding, save state loading, etc.) are disabled to
|
||||
* avoid interrupting communication.
|
||||
*
|
||||
* Should be set in either retro_init or retro_load_game, but not both.
|
||||
*
|
||||
* When not set, a frontend may use state serialization-based
|
||||
* multiplayer, where a deterministic core supporting multiple
|
||||
* input devices does not need to take any action on its own.
|
||||
*/
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_DEVICE_POWER (77 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* struct retro_device_power * --
|
||||
* Returns the device's current power state as reported by the frontend.
|
||||
* This is useful for emulating the battery level in handheld consoles,
|
||||
* or for reducing power consumption when on battery power.
|
||||
*
|
||||
* The return value indicates whether the frontend can provide this information,
|
||||
* even if the parameter is NULL.
|
||||
*
|
||||
* If the frontend does not support this functionality,
|
||||
* then the provided argument will remain unchanged.
|
||||
*
|
||||
* Note that this environment call describes the power state for the entire device,
|
||||
* not for individual peripherals like controllers.
|
||||
*/
|
||||
|
||||
/* VFS functionality */
|
||||
|
||||
@ -2024,13 +1968,13 @@ struct retro_vfs_interface_info
|
||||
|
||||
enum retro_hw_render_interface_type
|
||||
{
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
|
||||
RETRO_HW_RENDER_INTERFACE_VULKAN = 0,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D9 = 1,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D10 = 2,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D11 = 3,
|
||||
RETRO_HW_RENDER_INTERFACE_D3D12 = 4,
|
||||
RETRO_HW_RENDER_INTERFACE_GSKIT_PS2 = 5,
|
||||
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
|
||||
RETRO_HW_RENDER_INTERFACE_DUMMY = INT_MAX
|
||||
};
|
||||
|
||||
/* Base struct. All retro_hw_render_interface_* types
|
||||
@ -2806,17 +2750,9 @@ enum retro_hw_context_type
|
||||
/* Vulkan, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE. */
|
||||
RETRO_HW_CONTEXT_VULKAN = 6,
|
||||
|
||||
/* Direct3D11, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||
RETRO_HW_CONTEXT_D3D11 = 7,
|
||||
|
||||
/* Direct3D10, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||
RETRO_HW_CONTEXT_D3D10 = 8,
|
||||
|
||||
/* Direct3D12, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||
RETRO_HW_CONTEXT_D3D12 = 9,
|
||||
|
||||
/* Direct3D9, see RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||
RETRO_HW_CONTEXT_D3D9 = 10,
|
||||
/* Direct3D, set version_major to select the type of interface
|
||||
* returned by RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE */
|
||||
RETRO_HW_CONTEXT_DIRECT3D = 7,
|
||||
|
||||
RETRO_HW_CONTEXT_DUMMY = INT_MAX
|
||||
};
|
||||
@ -3071,100 +3007,6 @@ struct retro_disk_control_ext_callback
|
||||
retro_get_image_label_t get_image_label; /* Optional - may be NULL */
|
||||
};
|
||||
|
||||
/* Definitions for RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE.
|
||||
* A core can set it if sending and receiving custom network packets
|
||||
* during a multiplayer session is desired.
|
||||
*/
|
||||
|
||||
/* Netpacket flags for retro_netpacket_send_t */
|
||||
#define RETRO_NETPACKET_UNRELIABLE 0 /* Packet to be sent unreliable, depending on network quality it might not arrive. */
|
||||
#define RETRO_NETPACKET_RELIABLE (1 << 0) /* Reliable packets are guaranteed to arrive at the target in the order they were send. */
|
||||
#define RETRO_NETPACKET_UNSEQUENCED (1 << 1) /* Packet will not be sequenced with other packets and may arrive out of order. Cannot be set on reliable packets. */
|
||||
|
||||
/* Used by the core to send a packet to one or more connected players.
|
||||
* A single packet sent via this interface can contain up to 64 KB of data.
|
||||
*
|
||||
* The broadcast flag can be set to true to send to multiple connected clients.
|
||||
* In a broadcast, the client_id argument indicates 1 client NOT to send the
|
||||
* packet to (pass 0xFFFF to send to everyone). Otherwise, the client_id
|
||||
* argument indicates a single client to send the packet to.
|
||||
*
|
||||
* A frontend must support sending reliable packets (RETRO_NETPACKET_RELIABLE).
|
||||
* Unreliable packets might not be supported by the frontend, but the flags can
|
||||
* still be specified. Reliable transmission will be used instead.
|
||||
*
|
||||
* If this function is called passing NULL for buf, it will instead flush all
|
||||
* previously buffered outgoing packets and instantly read any incoming packets.
|
||||
* During such a call, retro_netpacket_receive_t and retro_netpacket_stop_t can
|
||||
* be called. The core can perform this in a loop to do a blocking read, i.e.,
|
||||
* wait for incoming data, but needs to handle stop getting called and also
|
||||
* give up after a short while to avoid freezing on a connection problem.
|
||||
*
|
||||
* This function is not guaranteed to be thread-safe and must be called during
|
||||
* retro_run or any of the netpacket callbacks passed with this interface.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_send_t)(int flags, const void* buf, size_t len, uint16_t client_id, bool broadcast);
|
||||
|
||||
/* Called by the frontend to signify that a multiplayer session has started.
|
||||
* If client_id is 0 the local player is the host of the session and at this
|
||||
* point no other player has connected yet.
|
||||
*
|
||||
* If client_id is > 0 the local player is a client connected to a host and
|
||||
* at this point is already fully connected to the host.
|
||||
*
|
||||
* The core must store the retro_netpacket_send_t function pointer provided
|
||||
* here and use it whenever it wants to send a packet. This function pointer
|
||||
* remains valid until the frontend calls retro_netpacket_stop_t.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_start_t)(uint16_t client_id, retro_netpacket_send_t send_fn);
|
||||
|
||||
/* Called by the frontend when a new packet arrives which has been sent from
|
||||
* another player with retro_netpacket_send_t. The client_id argument indicates
|
||||
* who has sent the packet.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_receive_t)(const void* buf, size_t len, uint16_t client_id);
|
||||
|
||||
/* Called by the frontend when the multiplayer session has ended.
|
||||
* Once this gets called the retro_netpacket_send_t function pointer passed
|
||||
* to retro_netpacket_start_t will not be valid anymore.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_stop_t)(void);
|
||||
|
||||
/* Called by the frontend every frame (between calls to retro_run while
|
||||
* updating the state of the multiplayer session.
|
||||
* This is a good place for the core to call retro_netpacket_send_t from.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_poll_t)(void);
|
||||
|
||||
/* Called by the frontend when a new player connects to the hosted session.
|
||||
* This is only called on the host side, not for clients connected to the host.
|
||||
* If this function returns false, the newly connected player gets dropped.
|
||||
* This can be used for example to limit the number of players.
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_netpacket_connected_t)(uint16_t client_id);
|
||||
|
||||
/* Called by the frontend when a player leaves or disconnects from the hosted session.
|
||||
* This is only called on the host side, not for clients connected to the host.
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_netpacket_disconnected_t)(uint16_t client_id);
|
||||
|
||||
/**
|
||||
* A callback interface for giving a core the ability to send and receive custom
|
||||
* network packets during a multiplayer session between two or more instances
|
||||
* of a libretro frontend.
|
||||
*
|
||||
* @see RETRO_ENVIRONMENT_SET_NETPACKET_INTERFACE
|
||||
*/
|
||||
struct retro_netpacket_callback
|
||||
{
|
||||
retro_netpacket_start_t start;
|
||||
retro_netpacket_receive_t receive;
|
||||
retro_netpacket_stop_t stop; /* Optional - may be NULL */
|
||||
retro_netpacket_poll_t poll; /* Optional - may be NULL */
|
||||
retro_netpacket_connected_t connected; /* Optional - may be NULL */
|
||||
retro_netpacket_disconnected_t disconnected; /* Optional - may be NULL */
|
||||
};
|
||||
|
||||
enum retro_pixel_format
|
||||
{
|
||||
/* 0RGB1555, native endian.
|
||||
@ -3967,289 +3809,6 @@ struct retro_throttle_state
|
||||
float rate;
|
||||
};
|
||||
|
||||
/**
|
||||
* Opaque handle to a microphone that's been opened for use.
|
||||
* The underlying object is accessed or created with \c retro_microphone_interface_t.
|
||||
*/
|
||||
typedef struct retro_microphone retro_microphone_t;
|
||||
|
||||
/**
|
||||
* Parameters for configuring a microphone.
|
||||
* Some of these might not be honored,
|
||||
* depending on the available hardware and driver configuration.
|
||||
*/
|
||||
typedef struct retro_microphone_params
|
||||
{
|
||||
/**
|
||||
* The desired sample rate of the microphone's input, in Hz.
|
||||
* The microphone's input will be resampled,
|
||||
* so cores can ask for whichever frequency they need.
|
||||
*
|
||||
* If zero, some reasonable default will be provided by the frontend
|
||||
* (usually from its config file).
|
||||
*
|
||||
* @see retro_get_mic_rate_t
|
||||
*/
|
||||
unsigned rate;
|
||||
} retro_microphone_params_t;
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::open_mic
|
||||
*/
|
||||
typedef retro_microphone_t *(RETRO_CALLCONV *retro_open_mic_t)(const retro_microphone_params_t *params);
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::close_mic
|
||||
*/
|
||||
typedef void (RETRO_CALLCONV *retro_close_mic_t)(retro_microphone_t *microphone);
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::get_params
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_mic_params_t)(const retro_microphone_t *microphone, retro_microphone_params_t *params);
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::set_mic_state
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_set_mic_state_t)(retro_microphone_t *microphone, bool state);
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::get_mic_state
|
||||
*/
|
||||
typedef bool (RETRO_CALLCONV *retro_get_mic_state_t)(const retro_microphone_t *microphone);
|
||||
|
||||
/**
|
||||
* @copydoc retro_microphone_interface::read_mic
|
||||
*/
|
||||
typedef int (RETRO_CALLCONV *retro_read_mic_t)(retro_microphone_t *microphone, int16_t* samples, size_t num_samples);
|
||||
|
||||
/**
|
||||
* The current version of the microphone interface.
|
||||
* Will be incremented whenever \c retro_microphone_interface or \c retro_microphone_params_t
|
||||
* receive new fields.
|
||||
*
|
||||
* Frontends using cores built against older mic interface versions
|
||||
* should not access fields introduced in newer versions.
|
||||
*/
|
||||
#define RETRO_MICROPHONE_INTERFACE_VERSION 1
|
||||
|
||||
/**
|
||||
* An interface for querying the microphone and accessing data read from it.
|
||||
*
|
||||
* @see RETRO_ENVIRONMENT_GET_MICROPHONE_INTERFACE
|
||||
*/
|
||||
struct retro_microphone_interface
|
||||
{
|
||||
/**
|
||||
* The version of this microphone interface.
|
||||
* Set by the core to request a particular version,
|
||||
* and set by the frontend to indicate the returned version.
|
||||
* 0 indicates that the interface is invalid or uninitialized.
|
||||
*/
|
||||
unsigned interface_version;
|
||||
|
||||
/**
|
||||
* Initializes a new microphone.
|
||||
* Assuming that microphone support is enabled and provided by the frontend,
|
||||
* cores may call this function whenever necessary.
|
||||
* A microphone could be opened throughout a core's lifetime,
|
||||
* or it could wait until a microphone is plugged in to the emulated device.
|
||||
*
|
||||
* The returned handle will be valid until it's freed,
|
||||
* even if the audio driver is reinitialized.
|
||||
*
|
||||
* This function is not guaranteed to be thread-safe.
|
||||
*
|
||||
* @param args[in] Parameters used to create the microphone.
|
||||
* May be \c NULL, in which case the default value of each parameter will be used.
|
||||
*
|
||||
* @returns Pointer to the newly-opened microphone,
|
||||
* or \c NULL if one couldn't be opened.
|
||||
* This likely means that no microphone is plugged in and recognized,
|
||||
* or the maximum number of supported microphones has been reached.
|
||||
*
|
||||
* @note Microphones are \em inactive by default;
|
||||
* to begin capturing audio, call \c set_mic_state.
|
||||
* @see retro_microphone_params_t
|
||||
*/
|
||||
retro_open_mic_t open_mic;
|
||||
|
||||
/**
|
||||
* Closes a microphone that was initialized with \c open_mic.
|
||||
* Calling this function will stop all microphone activity
|
||||
* and free up the resources that it allocated.
|
||||
* Afterwards, the handle is invalid and must not be used.
|
||||
*
|
||||
* A frontend may close opened microphones when unloading content,
|
||||
* but this behavior is not guaranteed.
|
||||
* Cores should close their microphones when exiting, just to be safe.
|
||||
*
|
||||
* @param microphone Pointer to the microphone that was allocated by \c open_mic.
|
||||
* If \c NULL, this function does nothing.
|
||||
*
|
||||
* @note The handle might be reused if another microphone is opened later.
|
||||
*/
|
||||
retro_close_mic_t close_mic;
|
||||
|
||||
/**
|
||||
* Returns the configured parameters of this microphone.
|
||||
* These may differ from what was requested depending on
|
||||
* the driver and device configuration.
|
||||
*
|
||||
* Cores should check these values before they start fetching samples.
|
||||
*
|
||||
* Will not change after the mic was opened.
|
||||
*
|
||||
* @param microphone[in] Opaque handle to the microphone
|
||||
* whose parameters will be retrieved.
|
||||
* @param params[out] The parameters object that the
|
||||
* microphone's parameters will be copied to.
|
||||
*
|
||||
* @return \c true if the parameters were retrieved,
|
||||
* \c false if there was an error.
|
||||
*/
|
||||
retro_get_mic_params_t get_params;
|
||||
|
||||
/**
|
||||
* Enables or disables the given microphone.
|
||||
* Microphones are disabled by default
|
||||
* and must be explicitly enabled before they can be used.
|
||||
* Disabled microphones will not process incoming audio samples,
|
||||
* and will therefore have minimal impact on overall performance.
|
||||
* Cores may enable microphones throughout their lifetime,
|
||||
* or only for periods where they're needed.
|
||||
*
|
||||
* Cores that accept microphone input should be able to operate without it;
|
||||
* we suggest substituting silence in this case.
|
||||
*
|
||||
* @param microphone Opaque handle to the microphone
|
||||
* whose state will be adjusted.
|
||||
* This will have been provided by \c open_mic.
|
||||
* @param state \c true if the microphone should receive audio input,
|
||||
* \c false if it should be idle.
|
||||
* @returns \c true if the microphone's state was successfully set,
|
||||
* \c false if \c microphone is invalid
|
||||
* or if there was an error.
|
||||
*/
|
||||
retro_set_mic_state_t set_mic_state;
|
||||
|
||||
/**
|
||||
* Queries the active state of a microphone at the given index.
|
||||
* Will return whether the microphone is enabled,
|
||||
* even if the driver is paused.
|
||||
*
|
||||
* @param microphone Opaque handle to the microphone
|
||||
* whose state will be queried.
|
||||
* @return \c true if the provided \c microphone is valid and active,
|
||||
* \c false if not or if there was an error.
|
||||
*/
|
||||
retro_get_mic_state_t get_mic_state;
|
||||
|
||||
/**
|
||||
* Retrieves the input processed by the microphone since the last call.
|
||||
* \em Must be called every frame unless \c microphone is disabled,
|
||||
* similar to how \c retro_audio_sample_batch_t works.
|
||||
*
|
||||
* @param[in] microphone Opaque handle to the microphone
|
||||
* whose recent input will be retrieved.
|
||||
* @param[out] samples The buffer that will be used to store the microphone's data.
|
||||
* Microphone input is in mono (i.e. one number per sample).
|
||||
* Should be large enough to accommodate the expected number of samples per frame;
|
||||
* for example, a 44.1kHz sample rate at 60 FPS would require space for 735 samples.
|
||||
* @param[in] num_samples The size of the data buffer in samples (\em not bytes).
|
||||
* Microphone input is in mono, so a "frame" and a "sample" are equivalent in length here.
|
||||
*
|
||||
* @return The number of samples that were copied into \c samples.
|
||||
* If \c microphone is pending driver initialization,
|
||||
* this function will copy silence of the requested length into \c samples.
|
||||
*
|
||||
* Will return -1 if the microphone is disabled,
|
||||
* the audio driver is paused,
|
||||
* or there was an error.
|
||||
*/
|
||||
retro_read_mic_t read_mic;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes how a device is being powered.
|
||||
* @see RETRO_ENVIRONMENT_GET_DEVICE_POWER
|
||||
*/
|
||||
enum retro_power_state
|
||||
{
|
||||
/**
|
||||
* Indicates that the frontend cannot report its power state at this time,
|
||||
* most likely due to a lack of support.
|
||||
*
|
||||
* \c RETRO_ENVIRONMENT_GET_DEVICE_POWER will not return this value;
|
||||
* instead, the environment callback will return \c false.
|
||||
*/
|
||||
RETRO_POWERSTATE_UNKNOWN = 0,
|
||||
|
||||
/**
|
||||
* Indicates that the device is running on its battery.
|
||||
* Usually applies to portable devices such as handhelds, laptops, and smartphones.
|
||||
*/
|
||||
RETRO_POWERSTATE_DISCHARGING,
|
||||
|
||||
/**
|
||||
* Indicates that the device's battery is currently charging.
|
||||
*/
|
||||
RETRO_POWERSTATE_CHARGING,
|
||||
|
||||
/**
|
||||
* Indicates that the device is connected to a power source
|
||||
* and that its battery has finished charging.
|
||||
*/
|
||||
RETRO_POWERSTATE_CHARGED,
|
||||
|
||||
/**
|
||||
* Indicates that the device is connected to a power source
|
||||
* and that it does not have a battery.
|
||||
* This usually suggests a desktop computer or a non-portable game console.
|
||||
*/
|
||||
RETRO_POWERSTATE_PLUGGED_IN
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates that an estimate is not available for the battery level or time remaining,
|
||||
* even if the actual power state is known.
|
||||
*/
|
||||
#define RETRO_POWERSTATE_NO_ESTIMATE (-1)
|
||||
|
||||
/**
|
||||
* Describes the power state of the device running the frontend.
|
||||
* @see RETRO_ENVIRONMENT_GET_DEVICE_POWER
|
||||
*/
|
||||
struct retro_device_power
|
||||
{
|
||||
/**
|
||||
* The current state of the frontend's power usage.
|
||||
*/
|
||||
enum retro_power_state state;
|
||||
|
||||
/**
|
||||
* A rough estimate of the amount of time remaining (in seconds)
|
||||
* before the device powers off.
|
||||
* This value depends on a variety of factors,
|
||||
* so it is not guaranteed to be accurate.
|
||||
*
|
||||
* Will be set to \c RETRO_POWERSTATE_NO_ESTIMATE if \c state does not equal \c RETRO_POWERSTATE_DISCHARGING.
|
||||
* May still be set to \c RETRO_POWERSTATE_NO_ESTIMATE if the frontend is unable to provide an estimate.
|
||||
*/
|
||||
int seconds;
|
||||
|
||||
/**
|
||||
* The approximate percentage of battery charge,
|
||||
* ranging from 0 to 100 (inclusive).
|
||||
* The device may power off before this reaches 0.
|
||||
*
|
||||
* The user might have configured their device
|
||||
* to stop charging before the battery is full,
|
||||
* so do not assume that this will be 100 in the \c RETRO_POWERSTATE_CHARGED state.
|
||||
*/
|
||||
int8_t percent;
|
||||
};
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
/* Environment callback. Gives implementations a way of performing
|
||||
|
@ -85,15 +85,6 @@ bool dir_list_initialize(struct string_list *list,
|
||||
**/
|
||||
void dir_list_sort(struct string_list *list, bool dir_first);
|
||||
|
||||
/**
|
||||
* dir_list_sort_ignore_ext:
|
||||
* @list : pointer to the directory listing.
|
||||
* @dir_first : move the directories in the listing to the top?
|
||||
*
|
||||
* Sorts a directory listing. File extensions are ignored.
|
||||
**/
|
||||
void dir_list_sort_ignore_ext(struct string_list *list, bool dir_first);
|
||||
|
||||
/**
|
||||
* dir_list_free:
|
||||
* @list : pointer to the directory listing
|
||||
|
@ -101,26 +101,6 @@ typedef int ssize_t;
|
||||
#define STRING_REP_UINT64 "%" PRIu64
|
||||
#define STRING_REP_USIZE "%" PRIuPTR
|
||||
|
||||
/* Wrap a declaration in RETRO_DEPRECATED() to produce a compiler warning when
|
||||
it's used. This is intended for developer machines, so it won't work on ancient
|
||||
or obscure compilers */
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1400 /* Visual C 2005 or later */
|
||||
#define RETRO_DEPRECATED(decl) __declspec(deprecated) decl
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#if __GNUC__ >= 3 /* GCC 3 or later */
|
||||
#define RETRO_DEPRECATED(decl) decl __attribute__((deprecated))
|
||||
#endif
|
||||
#elif defined(__clang__)
|
||||
#if __clang_major__ >= 3 /* clang 3 or later */
|
||||
#define RETRO_DEPRECATED(decl) decl __attribute__((deprecated))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef RETRO_DEPRECATED /* Unsupported compilers */
|
||||
#define RETRO_DEPRECATED(decl) decl
|
||||
#endif
|
||||
|
||||
/*
|
||||
I would like to see retro_inline.h moved in here; possibly boolean too.
|
||||
|
||||
|
@ -49,10 +49,6 @@
|
||||
#include <compat/msvc.h>
|
||||
#endif
|
||||
|
||||
#ifdef IOS
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
static INLINE void bits_or_bits(uint32_t *a, uint32_t *b, uint32_t count)
|
||||
{
|
||||
uint32_t i;
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
#elif defined(_3DS)
|
||||
#include <3ds.h>
|
||||
#elif defined(EMSCRIPTEN)
|
||||
#include <emscripten/emscripten.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
@ -101,8 +99,6 @@ static int nanosleepDOS(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
#define retro_sleep(msec) (usleep(1000 * (msec)))
|
||||
#elif defined(WIIU)
|
||||
#define retro_sleep(msec) (OSSleepTicks(ms_to_ticks((msec))))
|
||||
#elif defined(EMSCRIPTEN)
|
||||
#define retro_sleep(msec) (emscripten_sleep(msec))
|
||||
#else
|
||||
static INLINE void retro_sleep(unsigned msec)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ RETRO_BEGIN_DECLS
|
||||
#define TOUPPER(c) ((c) & ~(lr_char_props[(unsigned char)(c)] & 0x20))
|
||||
|
||||
/* C standard says \f \v are space, but this one disagrees */
|
||||
#define ISSPACE(c) (lr_char_props[(unsigned char)(c)] & 0x80)
|
||||
#define ISSPACE(c) (lr_char_props[(unsigned char)(c)] & 0x80)
|
||||
|
||||
#define ISDIGIT(c) (lr_char_props[(unsigned char)(c)] & 0x40)
|
||||
#define ISALPHA(c) (lr_char_props[(unsigned char)(c)] & 0x20)
|
||||
@ -204,7 +204,7 @@ char *string_trim_whitespace(char *const s);
|
||||
* correctly any text containing so-called 'wide' Unicode
|
||||
* characters (e.g. CJK languages, emojis, etc.).
|
||||
**/
|
||||
size_t word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len,
|
||||
void word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len,
|
||||
int line_width, int wideglyph_width, unsigned max_lines);
|
||||
|
||||
/**
|
||||
@ -241,7 +241,7 @@ size_t word_wrap(char *dst, size_t dst_size, const char *src, size_t src_len,
|
||||
* on-screen pixel width deviates greatly from the set
|
||||
* @wideglyph_width value.
|
||||
**/
|
||||
size_t word_wrap_wideglyph(
|
||||
void word_wrap_wideglyph(
|
||||
char *dst, size_t dst_size,
|
||||
const char *src, size_t src_len,
|
||||
int line_width, int wideglyph_width,
|
||||
@ -331,7 +331,7 @@ int string_count_occurrences_single_character(const char *str, char c);
|
||||
|
||||
/**
|
||||
* string_replace_whitespace_with_single_character:
|
||||
*
|
||||
*
|
||||
* Leaf function.
|
||||
*
|
||||
* Replaces all spaces with given character @c.
|
||||
|
@ -46,22 +46,6 @@ static int qstrcmp_plain(const void *a_, const void *b_)
|
||||
return strcasecmp(a->data, b->data);
|
||||
}
|
||||
|
||||
static int qstrcmp_plain_noext(const void *a_, const void *b_)
|
||||
{
|
||||
const struct string_list_elem *a = (const struct string_list_elem*)a_;
|
||||
const struct string_list_elem *b = (const struct string_list_elem*)b_;
|
||||
|
||||
const char *ext_a = path_get_extension(a->data);
|
||||
size_t l_a = string_is_empty(ext_a) ? strlen(a->data) : (ext_a - a->data - 1);
|
||||
const char *ext_b = path_get_extension(b->data);
|
||||
size_t l_b = string_is_empty(ext_b) ? strlen(b->data) : (ext_b - b->data - 1);
|
||||
|
||||
int rv = strncasecmp(a->data, b->data, MIN(l_a, l_b));
|
||||
if (rv == 0 && l_a != l_b)
|
||||
return (int)(l_a - l_b);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int qstrcmp_dir(const void *a_, const void *b_)
|
||||
{
|
||||
const struct string_list_elem *a = (const struct string_list_elem*)a_;
|
||||
@ -75,19 +59,6 @@ static int qstrcmp_dir(const void *a_, const void *b_)
|
||||
return strcasecmp(a->data, b->data);
|
||||
}
|
||||
|
||||
static int qstrcmp_dir_noext(const void *a_, const void *b_)
|
||||
{
|
||||
const struct string_list_elem *a = (const struct string_list_elem*)a_;
|
||||
const struct string_list_elem *b = (const struct string_list_elem*)b_;
|
||||
int a_type = a->attr.i;
|
||||
int b_type = b->attr.i;
|
||||
|
||||
/* Sort directories before files. */
|
||||
if (a_type != b_type)
|
||||
return b_type - a_type;
|
||||
return qstrcmp_plain_noext(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* dir_list_sort:
|
||||
* @list : pointer to the directory listing.
|
||||
@ -102,20 +73,6 @@ void dir_list_sort(struct string_list *list, bool dir_first)
|
||||
dir_first ? qstrcmp_dir : qstrcmp_plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* dir_list_sort_ignore_ext:
|
||||
* @list : pointer to the directory listing.
|
||||
* @dir_first : move the directories in the listing to the top?
|
||||
*
|
||||
* Sorts a directory listing. File extensions are ignored.
|
||||
**/
|
||||
void dir_list_sort_ignore_ext(struct string_list *list, bool dir_first)
|
||||
{
|
||||
if (list)
|
||||
qsort(list->elems, list->size, sizeof(struct string_list_elem),
|
||||
dir_first ? qstrcmp_dir_noext : qstrcmp_plain_noext);
|
||||
}
|
||||
|
||||
/**
|
||||
* dir_list_free:
|
||||
* @list : pointer to the directory listing
|
||||
@ -184,11 +141,6 @@ static int dir_list_read(const char *dir,
|
||||
|
||||
if (retro_dirent_is_dir(entry, NULL))
|
||||
{
|
||||
/* Exclude this frequent hidden dir on platforms which can not handle hidden attribute */
|
||||
#ifndef _WIN32
|
||||
if (!include_hidden && strcmp(name, "System Volume Information") == 0)
|
||||
continue;
|
||||
#endif
|
||||
if (recursive)
|
||||
dir_list_read(file_path, list, ext_list, include_dirs,
|
||||
include_hidden, include_compressed, recursive);
|
||||
|
@ -476,18 +476,17 @@ int string_list_find_elem(const struct string_list *list, const char *elem)
|
||||
bool string_list_find_elem_prefix(const struct string_list *list,
|
||||
const char *prefix, const char *elem)
|
||||
{
|
||||
if (list)
|
||||
size_t i;
|
||||
char prefixed[255];
|
||||
if (!list)
|
||||
return false;
|
||||
strlcpy(prefixed, prefix, sizeof(prefixed));
|
||||
strlcat(prefixed, elem, sizeof(prefixed));
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
size_t i;
|
||||
char prefixed[255];
|
||||
size_t _len = strlcpy(prefixed, prefix, sizeof(prefixed));
|
||||
strlcpy(prefixed + _len, elem, sizeof(prefixed) - _len);
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
if ( string_is_equal_noncase(list->elems[i].data, elem)
|
||||
|| string_is_equal_noncase(list->elems[i].data, prefixed))
|
||||
return true;
|
||||
}
|
||||
if ( string_is_equal_noncase(list->elems[i].data, elem)
|
||||
|| string_is_equal_noncase(list->elems[i].data, prefixed))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -495,19 +494,21 @@ bool string_list_find_elem_prefix(const struct string_list *list,
|
||||
struct string_list *string_list_clone(const struct string_list *src)
|
||||
{
|
||||
size_t i;
|
||||
struct string_list_elem *elems = NULL;
|
||||
struct string_list *dest = (struct string_list*)
|
||||
struct string_list_elem
|
||||
*elems = NULL;
|
||||
struct string_list
|
||||
*dest = (struct string_list*)
|
||||
malloc(sizeof(struct string_list));
|
||||
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
dest->elems = NULL;
|
||||
dest->size = src->size;
|
||||
dest->elems = NULL;
|
||||
dest->size = src->size;
|
||||
if (src->cap < dest->size)
|
||||
dest->cap = dest->size;
|
||||
dest->cap = dest->size;
|
||||
else
|
||||
dest->cap = src->cap;
|
||||
dest->cap = src->cap;
|
||||
|
||||
if (!(elems = (struct string_list_elem*)
|
||||
calloc(dest->cap, sizeof(struct string_list_elem))))
|
||||
@ -516,7 +517,7 @@ struct string_list *string_list_clone(const struct string_list *src)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dest->elems = elems;
|
||||
dest->elems = elems;
|
||||
|
||||
for (i = 0; i < src->size; i++)
|
||||
{
|
||||
|
@ -203,12 +203,14 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda
|
||||
data->func = thread_func;
|
||||
data->userdata = userdata;
|
||||
|
||||
thread->id = 0;
|
||||
#ifdef USE_WIN32_THREADS
|
||||
thread->id = 0;
|
||||
thread->thread = CreateThread(NULL, 0, thread_wrap,
|
||||
data, 0, &thread->id);
|
||||
thread_created = !!thread->thread;
|
||||
#else
|
||||
thread->id = 0;
|
||||
|
||||
#ifdef HAVE_THREAD_ATTR
|
||||
pthread_attr_init(&thread_attr);
|
||||
|
||||
@ -222,27 +224,23 @@ sthread_t *sthread_create_with_priority(void (*thread_func)(void*), void *userda
|
||||
|
||||
thread_attr_needed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(VITA)
|
||||
pthread_attr_setstacksize(&thread_attr , 0x10000 );
|
||||
thread_attr_needed = true;
|
||||
#elif defined(__APPLE__)
|
||||
/* Default stack size on Apple is 512Kb;
|
||||
* for PS2 disc scanning and other reasons, we'd like 2MB. */
|
||||
pthread_attr_setstacksize(&thread_attr , 0x200000 );
|
||||
thread_attr_needed = true;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_THREAD_ATTR
|
||||
if (thread_attr_needed)
|
||||
thread_created = pthread_create(&thread->id, &thread_attr, thread_wrap, data) == 0;
|
||||
else
|
||||
#endif
|
||||
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
|
||||
|
||||
#ifdef HAVE_THREAD_ATTR
|
||||
pthread_attr_destroy(&thread_attr);
|
||||
#else
|
||||
thread_created = pthread_create(&thread->id, NULL, thread_wrap, data) == 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (thread_created)
|
||||
|
@ -217,24 +217,27 @@ char *string_trim_whitespace(char *const s)
|
||||
* correctly any text containing so-called 'wide' Unicode
|
||||
* characters (e.g. CJK languages, emojis, etc.).
|
||||
**/
|
||||
size_t word_wrap(
|
||||
void word_wrap(
|
||||
char *dst, size_t dst_size,
|
||||
const char *src, size_t src_len,
|
||||
int line_width, int wideglyph_width, unsigned max_lines)
|
||||
{
|
||||
char *last_space = NULL;
|
||||
char *lastspace = NULL;
|
||||
unsigned counter = 0;
|
||||
unsigned lines = 1;
|
||||
const char *src_end = src + src_len;
|
||||
|
||||
/* Prevent buffer overflow */
|
||||
if (dst_size < src_len + 1)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
/* Early return if src string length is less
|
||||
* than line width */
|
||||
if (src_len < (size_t)line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
|
||||
while (*src != '\0')
|
||||
{
|
||||
@ -242,18 +245,21 @@ size_t word_wrap(
|
||||
counter++;
|
||||
|
||||
if (*src == ' ')
|
||||
last_space = dst; /* Remember the location of the whitespace */
|
||||
lastspace = dst; /* Remember the location of the whitespace */
|
||||
else if (*src == '\n')
|
||||
{
|
||||
/* If newlines embedded in the input,
|
||||
* reset the index */
|
||||
lines++;
|
||||
counter = 0;
|
||||
counter = 0;
|
||||
|
||||
/* Early return if remaining src string
|
||||
* length is less than line width */
|
||||
if (src_end - src <= line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (char_len--)
|
||||
@ -263,27 +269,29 @@ size_t word_wrap(
|
||||
{
|
||||
counter = 0;
|
||||
|
||||
if (last_space && (max_lines == 0 || lines < max_lines))
|
||||
if (lastspace && (max_lines == 0 || lines < max_lines))
|
||||
{
|
||||
/* Replace nearest (previous) whitespace
|
||||
* with newline character */
|
||||
*last_space = '\n';
|
||||
*lastspace = '\n';
|
||||
lines++;
|
||||
|
||||
src -= dst - last_space - 1;
|
||||
dst = last_space + 1;
|
||||
last_space = NULL;
|
||||
src -= dst - lastspace - 1;
|
||||
dst = lastspace + 1;
|
||||
lastspace = NULL;
|
||||
|
||||
/* Early return if remaining src string
|
||||
* length is less than line width */
|
||||
if (src_end - src < line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,7 +327,7 @@ size_t word_wrap(
|
||||
* on-screen pixel width deviates greatly from the set
|
||||
* @wideglyph_width value.
|
||||
**/
|
||||
size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
void word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
const char *src, size_t src_len, int line_width,
|
||||
int wideglyph_width, unsigned max_lines)
|
||||
{
|
||||
@ -351,11 +359,14 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
unsigned counter_normalized = 0;
|
||||
int line_width_normalized = line_width * 100;
|
||||
int additional_counter_normalized = wideglyph_width - 100;
|
||||
|
||||
|
||||
/* Early return if src string length is less
|
||||
* than line width */
|
||||
if (src_end - src < line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
|
||||
while (*src != '\0')
|
||||
{
|
||||
@ -378,7 +389,10 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
/* Early return if remaining src string
|
||||
* length is less than line width */
|
||||
if (src_end - src <= line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (char_len >= 3)
|
||||
{
|
||||
@ -410,7 +424,10 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
/* Early return if remaining src string
|
||||
* length is less than line width */
|
||||
if (src_end - src <= line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (lastspace)
|
||||
{
|
||||
@ -425,13 +442,15 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||
/* Early return if remaining src string
|
||||
* length is less than line width */
|
||||
if (src_end - src < line_width)
|
||||
return strlcpy(dst, src, dst_size);
|
||||
{
|
||||
strlcpy(dst, src, dst_size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,7 +592,7 @@ unsigned string_hex_to_unsigned(const char *str)
|
||||
if (str[0] != '\0' && str[1] != '\0')
|
||||
{
|
||||
if ( (str[0] == '0') &&
|
||||
((str[1] == 'x') ||
|
||||
((str[1] == 'x') ||
|
||||
(str[1] == 'X')))
|
||||
{
|
||||
hex_str = str + 2;
|
||||
@ -616,7 +635,7 @@ int string_count_occurrences_single_character(const char *str, char c)
|
||||
|
||||
/**
|
||||
* string_replace_whitespace_with_single_character:
|
||||
*
|
||||
*
|
||||
* Leaf function.
|
||||
*
|
||||
* Replaces all spaces with given character @c.
|
||||
|
@ -301,7 +301,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
|
||||
{
|
||||
int flags = 0;
|
||||
const char *mode_str = NULL;
|
||||
libretro_vfs_implementation_file *stream =
|
||||
libretro_vfs_implementation_file *stream =
|
||||
(libretro_vfs_implementation_file*)
|
||||
malloc(sizeof(*stream));
|
||||
|
||||
@ -452,14 +452,14 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
|
||||
*
|
||||
* https://www.freebsd.org/cgi/man.cgi?query=setvbuf&apropos=0&sektion=0&manpath=FreeBSD+11.1-RELEASE&arch=default&format=html
|
||||
*
|
||||
* If the size argument is not zero but buf is NULL,
|
||||
* If the size argument is not zero but buf is NULL,
|
||||
* a buffer of the given size will be allocated immediately, and
|
||||
* released on close. This is an extension to ANSI C.
|
||||
*
|
||||
* Since C89 does not support specifying a NULL buffer
|
||||
* Since C89 does not support specifying a NULL buffer
|
||||
* with a non-zero size, we create and track our own buffer for it.
|
||||
*/
|
||||
/* TODO: this is only useful for a few platforms,
|
||||
/* TODO: this is only useful for a few platforms,
|
||||
* find which and add ifdef */
|
||||
#if defined(_3DS)
|
||||
if (stream->scheme != VFS_SCHEME_CDROM)
|
||||
@ -648,7 +648,7 @@ int64_t retro_vfs_file_tell_impl(libretro_vfs_implementation_file *stream)
|
||||
#ifdef HAVE_MMAP
|
||||
/* Need to check stream->mapped because this function
|
||||
* is called in filestream_open() */
|
||||
if (stream->mapped && stream->hints &
|
||||
if (stream->mapped && stream->hints &
|
||||
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS)
|
||||
return stream->mappos;
|
||||
#endif
|
||||
@ -699,8 +699,8 @@ int64_t retro_vfs_file_read_impl(libretro_vfs_implementation_file *stream,
|
||||
|
||||
int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, const void *s, uint64_t len)
|
||||
{
|
||||
int64_t pos = 0;
|
||||
ssize_t result = -1;
|
||||
int64_t pos = 0;
|
||||
size_t result = -1;
|
||||
|
||||
if (!stream)
|
||||
return -1;
|
||||
@ -738,40 +738,39 @@ int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream)
|
||||
|
||||
int retro_vfs_file_remove_impl(const char *path)
|
||||
{
|
||||
if (path && *path)
|
||||
{
|
||||
int ret = -1;
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
/* Win32 (no Xbox) */
|
||||
/* Win32 (no Xbox) */
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500
|
||||
char *path_local = NULL;
|
||||
if ((path_local = utf8_to_local_string_alloc(path)))
|
||||
{
|
||||
/* We need to check if path is a directory */
|
||||
if ((retro_vfs_stat_impl(path, NULL) & RETRO_VFS_STAT_IS_DIRECTORY) != 0)
|
||||
ret = _rmdir(path_local);
|
||||
else
|
||||
ret = remove(path_local);
|
||||
free(path_local);
|
||||
}
|
||||
char *path_local = NULL;
|
||||
#else
|
||||
wchar_t *path_wide = NULL;
|
||||
if ((path_wide = utf8_to_utf16_string_alloc(path)))
|
||||
{
|
||||
/* We need to check if path is a directory */
|
||||
if ((retro_vfs_stat_impl(path, NULL) & RETRO_VFS_STAT_IS_DIRECTORY) != 0)
|
||||
ret = _wrmdir(path_wide);
|
||||
else
|
||||
ret = _wremove(path_wide);
|
||||
free(path_wide);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
ret = remove(path);
|
||||
wchar_t *path_wide = NULL;
|
||||
#endif
|
||||
if (!path || !*path)
|
||||
return -1;
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500
|
||||
if ((path_local = utf8_to_local_string_alloc(path)))
|
||||
{
|
||||
int ret = remove(path_local);
|
||||
free(path_local);
|
||||
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
if ((path_wide = utf8_to_utf16_string_alloc(path)))
|
||||
{
|
||||
int ret = _wremove(path_wide);
|
||||
free(path_wide);
|
||||
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if (remove(path) == 0)
|
||||
return 0;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -843,118 +842,132 @@ const char *retro_vfs_file_get_path_impl(
|
||||
|
||||
int retro_vfs_stat_impl(const char *path, int32_t *size)
|
||||
{
|
||||
int ret = RETRO_VFS_STAT_IS_VALID;
|
||||
bool is_dir = false;
|
||||
bool is_character_special = false;
|
||||
#if defined(VITA)
|
||||
/* Vita / PSP */
|
||||
SceIoStat buf;
|
||||
int dir_ret;
|
||||
char *tmp = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
if (!path || !*path)
|
||||
return 0;
|
||||
{
|
||||
#if defined(VITA)
|
||||
/* Vita / PSP */
|
||||
SceIoStat stat_buf;
|
||||
int dir_ret;
|
||||
char *tmp = strdup(path);
|
||||
size_t len = strlen(tmp);
|
||||
if (tmp[len-1] == '/')
|
||||
tmp[len-1] = '\0';
|
||||
|
||||
dir_ret = sceIoGetstat(tmp, &stat_buf);
|
||||
free(tmp);
|
||||
if (dir_ret < 0)
|
||||
return 0;
|
||||
tmp = strdup(path);
|
||||
len = strlen(tmp);
|
||||
if (tmp[len-1] == '/')
|
||||
tmp[len-1] = '\0';
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
dir_ret = sceIoGetstat(tmp, &buf);
|
||||
free(tmp);
|
||||
if (dir_ret < 0)
|
||||
return 0;
|
||||
|
||||
if (FIO_S_ISDIR(stat_buf.st_mode))
|
||||
ret |= RETRO_VFS_STAT_IS_DIRECTORY;
|
||||
if (size)
|
||||
*size = (int32_t)buf.st_size;
|
||||
|
||||
is_dir = FIO_S_ISDIR(buf.st_mode);
|
||||
#elif defined(__PSL1GHT__) || defined(__PS3__)
|
||||
/* Lowlevel Lv2 */
|
||||
sysFSStat stat_buf;
|
||||
/* Lowlevel Lv2 */
|
||||
sysFSStat buf;
|
||||
|
||||
if (sysFsStat(path, &stat_buf) < 0)
|
||||
return 0;
|
||||
if (!path || !*path)
|
||||
return 0;
|
||||
if (sysFsStat(path, &buf) < 0)
|
||||
return 0;
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
if (size)
|
||||
*size = (int32_t)buf.st_size;
|
||||
|
||||
if ((stat_buf.st_mode & S_IFMT) == S_IFDIR)
|
||||
ret |= RETRO_VFS_STAT_IS_DIRECTORY;
|
||||
is_dir = ((buf.st_mode & S_IFMT) == S_IFDIR);
|
||||
#elif defined(_WIN32)
|
||||
/* Windows */
|
||||
struct _stat stat_buf;
|
||||
/* Windows */
|
||||
DWORD file_info;
|
||||
struct _stat buf;
|
||||
#if defined(LEGACY_WIN32)
|
||||
char *path_local = utf8_to_local_string_alloc(path);
|
||||
DWORD file_info = GetFileAttributes(path_local);
|
||||
|
||||
if (!string_is_empty(path_local))
|
||||
_stat(path_local, &stat_buf);
|
||||
|
||||
if (path_local)
|
||||
free(path_local);
|
||||
char *path_local = NULL;
|
||||
#else
|
||||
wchar_t *path_wide = utf8_to_utf16_string_alloc(path);
|
||||
DWORD file_info = GetFileAttributesW(path_wide);
|
||||
|
||||
_wstat(path_wide, &stat_buf);
|
||||
|
||||
if (path_wide)
|
||||
free(path_wide);
|
||||
wchar_t *path_wide = NULL;
|
||||
#endif
|
||||
if (file_info == INVALID_FILE_ATTRIBUTES)
|
||||
return 0;
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
if (!path || !*path)
|
||||
return 0;
|
||||
|
||||
#if defined(LEGACY_WIN32)
|
||||
path_local = utf8_to_local_string_alloc(path);
|
||||
file_info = GetFileAttributes(path_local);
|
||||
|
||||
if (!string_is_empty(path_local))
|
||||
_stat(path_local, &buf);
|
||||
|
||||
if (path_local)
|
||||
free(path_local);
|
||||
#else
|
||||
path_wide = utf8_to_utf16_string_alloc(path);
|
||||
file_info = GetFileAttributesW(path_wide);
|
||||
|
||||
_wstat(path_wide, &buf);
|
||||
|
||||
if (path_wide)
|
||||
free(path_wide);
|
||||
#endif
|
||||
|
||||
if (file_info == INVALID_FILE_ATTRIBUTES)
|
||||
return 0;
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)buf.st_size;
|
||||
|
||||
is_dir = (file_info & FILE_ATTRIBUTE_DIRECTORY);
|
||||
|
||||
if (file_info & FILE_ATTRIBUTE_DIRECTORY)
|
||||
ret |= RETRO_VFS_STAT_IS_DIRECTORY;
|
||||
#elif defined(GEKKO)
|
||||
/* On GEKKO platforms, paths cannot have
|
||||
* trailing slashes - we must therefore
|
||||
* remove them */
|
||||
size_t len;
|
||||
char *path_buf = NULL;
|
||||
struct stat stat_buf;
|
||||
/* On GEKKO platforms, paths cannot have
|
||||
* trailing slashes - we must therefore
|
||||
* remove them */
|
||||
char *path_buf = NULL;
|
||||
int stat_ret = -1;
|
||||
struct stat stat_buf;
|
||||
size_t len;
|
||||
|
||||
if (!(path_buf = strdup(path)))
|
||||
return 0;
|
||||
if (string_is_empty(path))
|
||||
return 0;
|
||||
|
||||
if ((len = strlen(path_buf)) > 0)
|
||||
if (path_buf[len - 1] == '/')
|
||||
path_buf[len - 1] = '\0';
|
||||
if (!(path_buf = strdup(path)))
|
||||
return 0;
|
||||
|
||||
if (stat(path_buf, &stat_buf) < 0)
|
||||
{
|
||||
free(path_buf);
|
||||
return 0;
|
||||
}
|
||||
if ((len = strlen(path_buf)) > 0)
|
||||
if (path_buf[len - 1] == '/')
|
||||
path_buf[len - 1] = '\0';
|
||||
|
||||
free(path_buf);
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
stat_ret = stat(path_buf, &stat_buf);
|
||||
free(path_buf);
|
||||
|
||||
if (stat_ret < 0)
|
||||
return 0;
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
|
||||
is_dir = S_ISDIR(stat_buf.st_mode);
|
||||
is_character_special = S_ISCHR(stat_buf.st_mode);
|
||||
|
||||
if (S_ISDIR(stat_buf.st_mode))
|
||||
ret |= RETRO_VFS_STAT_IS_DIRECTORY;
|
||||
if (S_ISCHR(stat_buf.st_mode))
|
||||
ret |= RETRO_VFS_STAT_IS_CHARACTER_SPECIAL;
|
||||
#else
|
||||
/* Every other platform */
|
||||
struct stat stat_buf;
|
||||
/* Every other platform */
|
||||
struct stat buf;
|
||||
|
||||
if (stat(path, &stat_buf) < 0)
|
||||
return 0;
|
||||
if (!path || !*path)
|
||||
return 0;
|
||||
if (stat(path, &buf) < 0)
|
||||
return 0;
|
||||
|
||||
if (size)
|
||||
*size = (int32_t)stat_buf.st_size;
|
||||
if (size)
|
||||
*size = (int32_t)buf.st_size;
|
||||
|
||||
if (S_ISDIR(stat_buf.st_mode))
|
||||
ret |= RETRO_VFS_STAT_IS_DIRECTORY;
|
||||
if (S_ISCHR(stat_buf.st_mode))
|
||||
ret |= RETRO_VFS_STAT_IS_CHARACTER_SPECIAL;
|
||||
is_dir = S_ISDIR(buf.st_mode);
|
||||
is_character_special = S_ISCHR(buf.st_mode);
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
return RETRO_VFS_STAT_IS_VALID | (is_dir ? RETRO_VFS_STAT_IS_DIRECTORY : 0) | (is_character_special ? RETRO_VFS_STAT_IS_CHARACTER_SPECIAL : 0);
|
||||
}
|
||||
|
||||
#if defined(VITA)
|
||||
|
Loading…
Reference in New Issue
Block a user