Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
beetle-pce-libretro
Commits
970a3360
Commit
970a3360
authored
Oct 14, 2020
by
negativeExponent
Browse files
Update libretro-common
parent
a05266cb
Changes
56
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile.common
View file @
970a3360
...
...
@@ -235,5 +235,6 @@ ifneq ($(STATIC_LINKING), 1)
$(LIBRETRO_COMM_DIR)
/encodings/encoding_crc32.c
\
$(LIBRETRO_COMM_DIR)
/vfs/vfs_implementation.c
\
$(LIBRETRO_COMM_DIR)
/memmap/memalign.c
\
$(LIBRETRO_COMM_DIR)
/string/stdstring.c
$(LIBRETRO_COMM_DIR)
/string/stdstring.c
\
$(LIBRETRO_COMM_DIR)
/time/rtime.c
endif
libretro-common/cdrom/cdrom.c
View file @
970a3360
/* Copyright (C) 2010-20
19
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (cdrom.c).
...
...
@@ -29,6 +29,7 @@
#include <stdio.h>
#include <string.h>
#include <compat/strl.h>
#include <compat/strcasestr.h>
#include <retro_math.h>
#include <retro_timers.h>
#include <streams/file_stream.h>
...
...
@@ -96,6 +97,7 @@ void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame)
*
frame
=
(
*
frame
<
74
)
?
(
*
frame
+
1
)
:
0
;
}
#ifdef CDROM_DEBUG
static
void
cdrom_print_sense_data
(
const
unsigned
char
*
sense
,
size_t
len
)
{
unsigned
i
;
...
...
@@ -252,6 +254,7 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
fflush
(
stdout
);
}
#endif
#if defined(_WIN32) && !defined(_XBOX)
static
int
cdrom_send_command_win32
(
const
libretro_vfs_implementation_file
*
stream
,
CDROM_CMD_Direction
dir
,
void
*
buf
,
size_t
len
,
unsigned
char
*
cmd
,
size_t
cmd_len
,
unsigned
char
*
sense
,
size_t
sense_len
)
...
...
@@ -519,7 +522,9 @@ retry:
}
else
{
#ifdef CDROM_DEBUG
cdrom_print_sense_data
(
sense
,
sizeof
(
sense
));
#endif
/* INQUIRY/TEST/SENSE should never fail, don't retry. */
/* READ ATIP seems to fail outright on some drives with pressed discs, skip retries. */
...
...
@@ -672,7 +677,9 @@ int cdrom_get_sense(libretro_vfs_implementation_file *stream, unsigned char *sen
if
(
rv
)
return
1
;
#ifdef CDROM_DEBUG
cdrom_print_sense_data
(
buf
,
sizeof
(
buf
));
#endif
return
0
;
}
...
...
@@ -931,23 +938,23 @@ int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf
if
(
/*(control == 4 || control == 6) && */
adr
==
1
&&
tno
==
0
&&
point
>=
1
&&
point
<=
99
)
{
printf
(
"[CDROM] - Session#: %d TNO %d POINT %d "
,
session_num
,
tno
,
point
);
printf
(
"
[CDROM]
Track start time: (MSF %02u:%02u:%02u) "
,
(
unsigned
)
pmin
,
(
unsigned
)
psec
,
(
unsigned
)
pframe
);
printf
(
"Track start time: (
a
MSF %02u:%02u:%02u) "
,
(
unsigned
)
pmin
,
(
unsigned
)
psec
,
(
unsigned
)
pframe
);
}
else
if
(
/*(control == 4 || control == 6) && */
adr
==
1
&&
tno
==
0
&&
point
==
0xA0
)
{
printf
(
"[CDROM] - Session#: %d TNO %d POINT %d "
,
session_num
,
tno
,
point
);
printf
(
"
[CDROM]
First Track Number: %d "
,
pmin
);
printf
(
"
[CDROM]
Disc Type: %d "
,
psec
);
printf
(
"First Track Number: %d "
,
pmin
);
printf
(
"Disc Type: %d "
,
psec
);
}
else
if
(
/*(control == 4 || control == 6) && */
adr
==
1
&&
tno
==
0
&&
point
==
0xA1
)
{
printf
(
"[CDROM] - Session#: %d TNO %d POINT %d "
,
session_num
,
tno
,
point
);
printf
(
"
[CDROM]
Last Track Number: %d "
,
pmin
);
printf
(
"Last Track Number: %d "
,
pmin
);
}
else
if
(
/*(control == 4 || control == 6) && */
adr
==
1
&&
tno
==
0
&&
point
==
0xA2
)
{
printf
(
"[CDROM] - Session#: %d TNO %d POINT %d "
,
session_num
,
tno
,
point
);
printf
(
"
[CDROM]
Lead-out
run
time: (MSF %02u:%02u:%02u) "
,
(
unsigned
)
pmin
,
(
unsigned
)
psec
,
(
unsigned
)
pframe
);
printf
(
"Lead-out
start
time: (
a
MSF %02u:%02u:%02u) "
,
(
unsigned
)
pmin
,
(
unsigned
)
psec
,
(
unsigned
)
pframe
);
}
printf
(
"
\n
"
);
...
...
@@ -1336,22 +1343,26 @@ struct string_list* cdrom_get_available_drives(void)
for
(
i
=
0
;
i
<
(
int
)
dir_list
->
size
;
i
++
)
{
if
(
strstr
(
dir_list
->
elems
[
i
].
data
,
"/dev/sg"
))
if
(
string_starts_with_size
(
dir_list
->
elems
[
i
].
data
,
"/dev/sg"
,
STRLEN_CONST
(
"/dev/sg"
)))
{
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
(
dir_list
->
elems
[
i
].
data
,
RETRO_VFS_FILE_ACCESS_READ
,
0
);
libretro_vfs_implementation_file
*
stream
;
bool
is_cdrom
=
false
;
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
(
dir_list
->
elems
[
i
].
data
,
RETRO_VFS_FILE_ACCESS_READ
,
0
);
bool
is_cdrom
=
false
;
found
=
true
;
if
(
!
file
)
{
#ifdef CDROM_DEBUG
printf
(
"[CDROM] Could not open %s, please check permissions.
\n
"
,
dir_list
->
elems
[
i
].
data
);
fflush
(
stdout
);
#endif
continue
;
}
...
...
@@ -1362,10 +1373,11 @@ struct string_list* cdrom_get_available_drives(void)
if
(
!
is_cdrom
)
continue
;
sscanf
(
dir_list
->
elems
[
i
].
data
+
strlen
(
"/dev/sg"
),
"%d"
,
&
dev_index
);
sscanf
(
dir_list
->
elems
[
i
].
data
+
STRLEN_CONST
(
"/dev/sg"
),
"%d"
,
&
dev_index
);
dev_index
=
'0'
+
dev_index
;
attr
.
i
=
dev_index
;
attr
.
i
=
dev_index
;
if
(
!
string_is_empty
(
drive_model
))
strlcat
(
drive_string
,
drive_model
,
sizeof
(
drive_string
));
...
...
@@ -1378,29 +1390,34 @@ struct string_list* cdrom_get_available_drives(void)
if
(
!
found
)
{
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
int64_t
len
=
0
;
if
(
filestream_read_file
(
"/proc/modules"
,
(
void
**
)
&
buf
,
&
len
))
{
struct
string_list
*
mods
=
string_split
(
buf
,
"
\n
"
);
bool
found
=
false
;
#ifdef CDROM_DEBUG
bool
found
=
false
;
#endif
struct
string_list
mods
=
{
0
};
if
(
mods
)
string_list_initialize
(
&
mods
);
if
(
string_split_noalloc
(
&
mods
,
buf
,
"
\n
"
))
{
for
(
i
=
0
;
i
<
mods
->
size
;
i
++
)
for
(
i
=
0
;
i
<
mods
.
size
;
i
++
)
{
if
(
strcasestr
(
mods
->
elems
[
i
].
data
,
"sg "
))
if
(
strcasestr
(
mods
.
elems
[
i
].
data
,
"sg "
))
{
#ifdef CDROM_DEBUG
found
=
true
;
#endif
break
;
}
}
string_list_free
(
mods
);
}
string_list_deinitialize
(
&
mods
);
#ifdef CDROM_DEBUG
if
(
found
)
{
printf
(
"[CDROM] No sg devices found but kernel module is loaded.
\n
"
);
...
...
@@ -1411,12 +1428,15 @@ struct string_list* cdrom_get_available_drives(void)
printf
(
"[CDROM] No sg devices found and sg kernel module is not loaded.
\n
"
);
fflush
(
stdout
);
}
#endif
}
#ifdef CDROM_DEBUG
else
{
printf
(
"[CDROM] No sg devices found, could not check if sg kernel module is loaded.
\n
"
);
fflush
(
stdout
);
}
#endif
}
string_list_free
(
dir_list
);
...
...
@@ -1494,9 +1514,7 @@ bool cdrom_is_media_inserted(libretro_vfs_implementation_file *stream)
bool
cdrom_drive_has_media
(
const
char
drive
)
{
RFILE
*
file
;
char
cdrom_path_bin
[
256
];
cdrom_path_bin
[
0
]
=
'\0'
;
char
cdrom_path_bin
[
256
]
=
{
0
};
cdrom_device_fillpath
(
cdrom_path_bin
,
sizeof
(
cdrom_path_bin
),
drive
,
1
,
false
);
...
...
@@ -1690,8 +1708,11 @@ void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char tra
#ifdef __linux__
pos
=
strlcpy
(
path
,
"cdrom://drive"
,
len
);
if
(
len
>
pos
)
if
(
len
>
pos
+
1
)
{
path
[
pos
++
]
=
drive
;
path
[
pos
]
=
'\0'
;
}
pos
=
strlcat
(
path
,
".cue"
,
len
);
#endif
...
...
@@ -1702,8 +1723,11 @@ void cdrom_device_fillpath(char *path, size_t len, char drive, unsigned char tra
#ifdef _WIN32
pos
=
strlcpy
(
path
,
"cdrom://"
,
len
);
if
(
len
>
pos
)
if
(
len
>
pos
+
1
)
{
path
[
pos
++
]
=
drive
;
path
[
pos
]
=
'\0'
;
}
pos
+=
snprintf
(
path
+
pos
,
len
-
pos
,
":/drive-track%02d.bin"
,
track
);
#else
...
...
libretro-common/compat/compat_posix_string.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_posix_string.c).
...
...
libretro-common/compat/compat_snprintf.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_snprintf.c).
...
...
@@ -33,12 +33,12 @@
#if _MSC_VER < 1300
#define _vscprintf c89_vscprintf_retro__
static
int
c89_vscprintf_retro__
(
const
char
*
f
orma
t
,
va_list
pargs
)
static
int
c89_vscprintf_retro__
(
const
char
*
f
m
t
,
va_list
pargs
)
{
int
retval
;
va_list
argcopy
;
va_copy
(
argcopy
,
pargs
);
retval
=
vsnprintf
(
NULL
,
0
,
f
orma
t
,
argcopy
);
retval
=
vsnprintf
(
NULL
,
0
,
f
m
t
,
argcopy
);
va_end
(
argcopy
);
return
retval
;
}
...
...
@@ -46,38 +46,36 @@ static int c89_vscprintf_retro__(const char *format, va_list pargs)
/* http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */
int
c99_vsnprintf_retro__
(
char
*
outBuf
,
size_t
size
,
const
char
*
f
orma
t
,
va_list
ap
)
int
c99_vsnprintf_retro__
(
char
*
s
,
size_t
len
,
const
char
*
f
m
t
,
va_list
ap
)
{
int
count
=
-
1
;
if
(
size
!=
0
)
if
(
len
!=
0
)
{
#if (_MSC_VER <= 1310)
count
=
_vsnprintf
(
outBuf
,
size
-
1
,
f
orma
t
,
ap
);
count
=
_vsnprintf
(
s
,
len
-
1
,
f
m
t
,
ap
);
#else
count
=
_vsnprintf_s
(
outBuf
,
size
,
size
-
1
,
f
orma
t
,
ap
);
count
=
_vsnprintf_s
(
s
,
len
,
len
-
1
,
f
m
t
,
ap
);
#endif
}
if
(
count
==
-
1
)
count
=
_vscprintf
(
f
orma
t
,
ap
);
count
=
_vscprintf
(
f
m
t
,
ap
);
if
(
count
==
size
)
{
/* there was no room for a NULL, so truncate the last character */
outBuf
[
size
-
1
]
=
'\0'
;
}
/* there was no room for a NULL, so truncate the last character */
if
(
count
==
len
&&
len
)
s
[
len
-
1
]
=
'\0'
;
return
count
;
}
int
c99_snprintf_retro__
(
char
*
outBuf
,
size_t
size
,
const
char
*
f
orma
t
,
...)
int
c99_snprintf_retro__
(
char
*
s
,
size_t
len
,
const
char
*
f
m
t
,
...)
{
int
count
;
va_list
ap
;
va_start
(
ap
,
f
orma
t
);
count
=
c99_vsnprintf_retro__
(
outBuf
,
size
,
forma
t
,
ap
);
va_start
(
ap
,
f
m
t
);
count
=
c99_vsnprintf_retro__
(
s
,
len
,
fm
t
,
ap
);
va_end
(
ap
);
return
count
;
...
...
libretro-common/compat/compat_strcasestr.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_strcasestr.c).
...
...
libretro-common/compat/compat_strl.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (compat_strl.c).
...
...
libretro-common/compat/fopen_utf8.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (fopen_utf8.c).
...
...
libretro-common/encodings/encoding_crc32.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (encoding_crc32.c).
...
...
@@ -117,7 +117,7 @@ uint32_t file_crc32(uint32_t crc, const char *path)
if
(
!
buf
)
goto
error
;
for
(
i
=
0
;
i
<
CRC32_MAX_MB
;
i
++
)
for
(
i
=
0
;
i
<
CRC32_MAX_MB
;
i
++
)
{
int64_t
nread
=
filestream_read
(
file
,
buf
,
CRC32_BUFFER_SIZE
);
if
(
nread
<
0
)
...
...
libretro-common/encodings/encoding_utf.c
View file @
970a3360
/* Copyright (C) 2010-20
18
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (encoding_utf.c).
...
...
@@ -37,6 +37,8 @@
#include <xtl.h>
#endif
#define UTF8_WALKBYTE(string) (*((*(string))++))
static
unsigned
leading_ones
(
uint8_t
c
)
{
unsigned
ones
=
0
;
...
...
@@ -89,13 +91,14 @@ size_t utf8_conv_utf32(uint32_t *out, size_t out_chars,
bool
utf16_conv_utf8
(
uint8_t
*
out
,
size_t
*
out_chars
,
const
uint16_t
*
in
,
size_t
in_size
)
{
static
uint8_t
kUtf8Limits
[
5
]
=
{
0xC0
,
0xE0
,
0xF0
,
0xF8
,
0xFC
};
size_t
out_pos
=
0
;
size_t
in_pos
=
0
;
size_t
out_pos
=
0
;
size_t
in_pos
=
0
;
static
const
uint8_t
utf8_limits
[
5
]
=
{
0xC0
,
0xE0
,
0xF0
,
0xF8
,
0xFC
};
for
(;;)
{
unsigned
num
A
dds
;
unsigned
num
_a
dds
;
uint32_t
value
;
if
(
in_pos
==
in_size
)
...
...
@@ -124,21 +127,21 @@ bool utf16_conv_utf8(uint8_t *out, size_t *out_chars,
value
=
(((
value
-
0xD800
)
<<
10
)
|
(
c2
-
0xDC00
))
+
0x10000
;
}
for
(
num
A
dds
=
1
;
num
A
dds
<
5
;
num
A
dds
++
)
if
(
value
<
(((
uint32_t
)
1
)
<<
(
num
A
dds
*
5
+
6
)))
for
(
num
_a
dds
=
1
;
num
_a
dds
<
5
;
num
_a
dds
++
)
if
(
value
<
(((
uint32_t
)
1
)
<<
(
num
_a
dds
*
5
+
6
)))
break
;
if
(
out
)
out
[
out_pos
]
=
(
char
)(
kU
tf8
L
imits
[
num
A
dds
-
1
]
+
(
value
>>
(
6
*
num
A
dds
)));
out
[
out_pos
]
=
(
char
)(
u
tf8
_l
imits
[
num
_a
dds
-
1
]
+
(
value
>>
(
6
*
num
_a
dds
)));
out_pos
++
;
do
{
num
A
dds
--
;
num
_a
dds
--
;
if
(
out
)
out
[
out_pos
]
=
(
char
)(
0x80
+
((
value
>>
(
6
*
num
A
dds
))
&
0x3F
));
+
((
value
>>
(
6
*
num
_a
dds
))
&
0x3F
));
out_pos
++
;
}
while
(
num
A
dds
!=
0
);
}
while
(
num
_a
dds
!=
0
);
}
*
out_chars
=
out_pos
;
...
...
@@ -166,13 +169,15 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars)
while
(
*
sb
&&
chars
--
>
0
)
{
sb
++
;
while
((
*
sb
&
0xC0
)
==
0x80
)
sb
++
;
while
((
*
sb
&
0xC0
)
==
0x80
)
sb
++
;
}
if
((
size_t
)(
sb
-
sb_org
)
>
d_len
-
1
/* NUL */
)
{
sb
=
sb_org
+
d_len
-
1
;
while
((
*
sb
&
0xC0
)
==
0x80
)
sb
--
;
while
((
*
sb
&
0xC0
)
==
0x80
)
sb
--
;
}
memcpy
(
d
,
sb_org
,
sb
-
sb_org
);
...
...
@@ -184,14 +189,18 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars)
const
char
*
utf8skip
(
const
char
*
str
,
size_t
chars
)
{
const
uint8_t
*
strb
=
(
const
uint8_t
*
)
str
;
if
(
!
chars
)
return
str
;
do
{
strb
++
;
while
((
*
strb
&
0xC0
)
==
0x80
)
strb
++
;
while
((
*
strb
&
0xC0
)
==
0x80
)
strb
++
;
chars
--
;
}
while
(
chars
);
}
while
(
chars
);
return
(
const
char
*
)
strb
;
}
...
...
@@ -211,24 +220,22 @@ size_t utf8len(const char *string)
return
ret
;
}
#define utf8_walkbyte(string) (*((*(string))++))
/* Does not validate the input, returns garbage if it's not UTF-8. */
uint32_t
utf8_walk
(
const
char
**
string
)
{
uint8_t
first
=
utf8_walkbyte
(
string
);
uint8_t
first
=
UTF8_WALKBYTE
(
string
);
uint32_t
ret
=
0
;
if
(
first
<
128
)
return
first
;
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
ret
=
(
ret
<<
6
)
|
(
UTF8_WALKBYTE
(
string
)
&
0x3F
);
if
(
first
>=
0xE0
)
{
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
ret
=
(
ret
<<
6
)
|
(
UTF8_WALKBYTE
(
string
)
&
0x3F
);
if
(
first
>=
0xF0
)
{
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
ret
=
(
ret
<<
6
)
|
(
UTF8_WALKBYTE
(
string
)
&
0x3F
);
return
ret
|
(
first
&
7
)
<<
18
;
}
return
ret
|
(
first
&
15
)
<<
12
;
...
...
@@ -277,9 +284,7 @@ bool utf16_to_char_string(const uint16_t *in, char *s, size_t len)
static
char
*
mb_to_mb_string_alloc
(
const
char
*
str
,
enum
CodePage
cp_in
,
enum
CodePage
cp_out
)
{
char
*
path_buf
=
NULL
;
wchar_t
*
path_buf_wide
=
NULL
;
int
path_buf_len
=
0
;
int
path_buf_wide_len
=
MultiByteToWideChar
(
cp_in
,
0
,
str
,
-
1
,
NULL
,
0
);
/* Windows 95 will return 0 from these functions with
...
...
@@ -292,54 +297,51 @@ static char *mb_to_mb_string_alloc(const char *str,
* MultiByteToWideChar also supports CP_UTF7 and CP_UTF8.
*/
if
(
path_buf_wide_len
)
if
(
!
path_buf_wide_len
)
return
strdup
(
str
);
path_buf_wide
=
(
wchar_t
*
)
calloc
(
path_buf_wide_len
+
sizeof
(
wchar_t
),
sizeof
(
wchar_t
));
if
(
path_buf_wide
)
{
path_buf_wide
=
(
wchar_t
*
)
calloc
(
path_buf_wide
_len
+
sizeof
(
wchar_t
),
sizeof
(
wchar_t
)
);
MultiByteToWideChar
(
cp_in
,
0
,
str
,
-
1
,
path_buf_wide
,
path_buf_wide_len
);
if
(
path_buf_wide
)
if
(
*
path_buf_wide
)
{
MultiByteToWideChar
(
cp_
in
,
0
,
str
,
-
1
,
path_buf_wide
,
path_buf_wide_len
);
int
path_buf_len
=
WideCharToMultiByte
(
cp_
out
,
0
,
path_buf_wide
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
*
path_buf_
wide
)
if
(
path_buf_
len
)
{
path_buf
_len
=
WideCharToMultiByte
(
cp_out
,
0
,
path_buf_
wide
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
path_buf
=
(
char
*
)
calloc
(
path_buf_
len
+
sizeof
(
char
),
sizeof
(
char
)
);
if
(
path_buf
_len
)
if
(
path_buf
)
{
path_buf
=
(
char
*
)
calloc
(
path_buf_len
+
sizeof
(
char
),
sizeof
(
char
));
WideCharToMultiByte
(
cp_out
,
0
,
path_buf_wide
,
-
1
,
path_buf
,
path_buf_len
,
NULL
,
NULL
);
if
(
path_buf
)
{
WideCharToMultiByte
(
cp_out
,
0
,
path_buf_wide
,
-
1
,
path_buf
,
path_buf_len
,
NULL
,
NULL
);
free
(
path_buf_wide
);
free
(
path_buf_wide
);
if
(
*
path_buf
)
return
path_buf
;
if
(
*
path_buf
)
return
path_buf
;
free
(
path_buf
);
return
NULL
;
}
}
else
{
free
(
path_buf_wide
);
return
strdup
(
str
);
free
(
path_buf
);
return
NULL
;
}
}
else
{
free
(
path_buf_wide
);
return
strdup
(
str
);
}
}
}
else
return
strdup
(
str
);
if
(
path_buf_wide
)
free
(
path_buf_wide
);
}
return
NULL
;
}
...
...
@@ -379,13 +381,13 @@ char* local_to_utf8_string_alloc(const char *str)
wchar_t
*
utf8_to_utf16_string_alloc
(
const
char
*
str
)
{
#ifdef _WIN32
int
len
=
0
;
int
out_len
=
0
;
int
len
=
0
;
int
out_len
=
0
;
#else
size_t
len
=
0
;
size_t
len
=
0
;
size_t
out_len
=
0
;
#endif
wchar_t
*
buf
=
NULL
;
wchar_t
*
buf
=
NULL
;
if
(
!
str
||
!*
str
)
return
NULL
;
...
...
libretro-common/file/file_path.c
View file @
970a3360
This diff is collapsed.
Click to expand it.
libretro-common/file/retro_dirent.c
View file @
970a3360
/* Copyright (C) 2010-20
19
The RetroArch team
/* Copyright (C) 2010-20
20
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_dirent.c).
...
...
@@ -31,37 +31,41 @@
#define VFS_FRONTEND
#include <vfs/vfs_implementation.h>
static
retro_vfs_opendir_t
dirent_opendir_cb
=
NULL
;
static
retro_vfs_readdir_t
dirent_readdir_cb
=
NULL
;
/* TODO/FIXME - static globals */
static
retro_vfs_opendir_t
dirent_opendir_cb
=
NULL
;
static
retro_vfs_readdir_t
dirent_readdir_cb
=
NULL
;
static
retro_vfs_dirent_get_name_t
dirent_dirent_get_name_cb
=
NULL
;
static
retro_vfs_dirent_is_dir_t
dirent_dirent_is_dir_cb
=
NULL
;
static
retro_vfs_closedir_t
dirent_closedir_cb
=
NULL
;
static
retro_vfs_dirent_is_dir_t
dirent_dirent_is_dir_cb
=
NULL
;
static
retro_vfs_closedir_t
dirent_closedir_cb
=
NULL
;
void
dirent_vfs_init
(
const
struct
retro_vfs_interface_info
*
vfs_info
)
{
const
struct
retro_vfs_interface
*
vfs_iface
;
dirent_opendir_cb
=
NULL
;
dirent_readdir_cb
=
NULL
;