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
tyrquake
Commits
05abc43a
Commit
05abc43a
authored
Dec 27, 2019
by
Libretro-Admin
Browse files
Update libretro-common
parent
bf8adcbd
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile.common
View file @
05abc43a
...
...
@@ -102,14 +102,16 @@ endif
ifneq
($(STATIC_LINKING),1)
SOURCES_C
+=
\
$(CORE_DIR)
/libretro-common/file/retro_dirent.c
\
$(CORE_DIR)
/libretro-common/encodings/encoding_utf.c
\
$(CORE_DIR)
/libretro-common/string/stdstring.c
\
$(CORE_DIR)
/libretro-common/file/file_path.c
\
$(CORE_DIR)
/libretro-common/compat/compat_strl.c
\
$(CORE_DIR)
/libretro-common/compat/compat_posix_string.c
\
$(CORE_DIR)
/libretro-common/compat/compat_strcasestr.c
\
$(CORE_DIR)
/libretro-common/compat/compat_snprintf.c
$(LIBRETRO_COMM_DIR)
/file/retro_dirent.c
\
$(LIBRETRO_COMM_DIR)
/encodings/encoding_utf.c
\
$(LIBRETRO_COMM_DIR)
/string/stdstring.c
\
$(LIBRETRO_COMM_DIR)
/streams/file_stream.c
\
$(LIBRETRO_COMM_DIR)
/vfs/vfs_implementation.c
\
$(LIBRETRO_COMM_DIR)
/file/file_path.c
\
$(LIBRETRO_COMM_DIR)
/compat/compat_strl.c
\
$(LIBRETRO_COMM_DIR)
/compat/compat_posix_string.c
\
$(LIBRETRO_COMM_DIR)
/compat/compat_strcasestr.c
\
$(LIBRETRO_COMM_DIR)
/compat/compat_snprintf.c
endif
ifeq
($(HAVE_NETWORKING),1)
...
...
@@ -119,8 +121,8 @@ SOURCES_C += $(CORE_DIR)/common/net_dgrm.c \
ifneq
($(STATIC_LINKING),1)
SOURCES_C
+=
\
$(
CORE_DIR)
/libretro-common
/net/net_compat.c
\
$(
CORE_DIR)
/libretro-common
/net/net_socket.c
$(
LIBRETRO_COMM_DIR)
/net/net_compat.c
\
$(
LIBRETRO_COMM_DIR)
/net/net_socket.c
endif
else
SOURCES_C
+=
$(CORE_DIR)
/common/net_none.c
...
...
libretro-common/compat/compat_snprintf.c
View file @
05abc43a
...
...
@@ -49,7 +49,7 @@ static int c89_vscprintf_retro__(const char *format, va_list pargs)
int
c99_vsnprintf_retro__
(
char
*
outBuf
,
size_t
size
,
const
char
*
format
,
va_list
ap
)
{
int
count
=
-
1
;
if
(
size
!=
0
)
{
#if (_MSC_VER <= 1310)
...
...
libretro-common/encodings/encoding_utf.c
View file @
05abc43a
...
...
@@ -211,10 +211,7 @@ size_t utf8len(const char *string)
return
ret
;
}
static
uint8_t
utf8_walkbyte
(
const
char
**
string
)
{
return
*
((
*
string
)
++
);
}
#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
)
...
...
@@ -227,14 +224,16 @@ uint32_t utf8_walk(const char **string)
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
if
(
first
>=
0xE0
)
{
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
if
(
first
>=
0xF0
)
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
if
(
first
>=
0xF0
)
return
ret
|
(
first
&
7
)
<<
18
;
if
(
first
>=
0xE0
)
if
(
first
>=
0xF0
)
{
ret
=
(
ret
<<
6
)
|
(
utf8_walkbyte
(
string
)
&
0x3F
);
return
ret
|
(
first
&
7
)
<<
18
;
}
return
ret
|
(
first
&
15
)
<<
12
;
}
return
ret
|
(
first
&
31
)
<<
6
;
}
...
...
@@ -273,37 +272,25 @@ bool utf16_to_char_string(const uint16_t *in, char *s, size_t len)
return
ret
;
}
#if defined(_WIN32) && !defined(_XBOX) && !defined(UNICODE)
/* Returned pointer MUST be freed by the caller if non-NULL. */
static
char
*
mb_to_mb_string_alloc
(
const
char
*
str
,
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
=
0
;
if
(
!
str
||
!*
str
)
return
NULL
;
(
void
)
path_buf
;
(
void
)
path_buf_wide
;
(
void
)
path_buf_len
;
(
void
)
path_buf_wide_len
;
#if !defined(_WIN32) || defined(_XBOX)
/* assume string needs no modification if not on Windows */
return
strdup
(
str
);
#else
#ifdef UNICODE
/* TODO/FIXME: Not implemented. */
return
strdup
(
str
);
#else
/* Windows 95 will return 0 from these functions with a UTF8 codepage set without MSLU. From an unknown MSDN version (others omit this info):
* - CP_UTF8 Windows 98/Me, Windows NT 4.0 and later: Translate using UTF-8. When this is set, dwFlags must be zero.
* - Windows 95: Under the Microsoft Layer for Unicode, MultiByteToWideChar also supports CP_UTF7 and CP_UTF8.
int
path_buf_wide_len
=
MultiByteToWideChar
(
cp_in
,
0
,
str
,
-
1
,
NULL
,
0
);
/* Windows 95 will return 0 from these functions with
* a UTF8 codepage set without MSLU.
*
* From an unknown MSDN version (others omit this info):
* - CP_UTF8 Windows 98/Me, Windows NT 4.0 and later:
* Translate using UTF-8. When this is set, dwFlags must be zero.
* - Windows 95: Under the Microsoft Layer for Unicode,
* MultiByteToWideChar also supports CP_UTF7 and CP_UTF8.
*/
path_buf_wide_len
=
MultiByteToWideChar
(
cp_in
,
0
,
str
,
-
1
,
NULL
,
0
);
if
(
path_buf_wide_len
)
{
...
...
@@ -355,20 +342,37 @@ static char* mb_to_mb_string_alloc(const char *str,
free
(
path_buf_wide
);
return
NULL
;
#endif
#endif
}
#endif
/* Returned pointer MUST be freed by the caller if non-NULL. */
char
*
utf8_to_local_string_alloc
(
const
char
*
str
)
{
return
mb_to_mb_string_alloc
(
str
,
CODEPAGE_UTF8
,
CODEPAGE_LOCAL
);
if
(
str
&&
*
str
)
{
#if defined(_WIN32) && !defined(_XBOX) && !defined(UNICODE)
return
mb_to_mb_string_alloc
(
str
,
CODEPAGE_UTF8
,
CODEPAGE_LOCAL
);
#else
/* assume string needs no modification if not on Windows */
return
strdup
(
str
);
#endif
}
return
NULL
;
}
/* Returned pointer MUST be freed by the caller if non-NULL. */
char
*
local_to_utf8_string_alloc
(
const
char
*
str
)
{
return
mb_to_mb_string_alloc
(
str
,
CODEPAGE_LOCAL
,
CODEPAGE_UTF8
);
if
(
str
&&
*
str
)
{
#if defined(_WIN32) && !defined(_XBOX) && !defined(UNICODE)
return
mb_to_mb_string_alloc
(
str
,
CODEPAGE_LOCAL
,
CODEPAGE_UTF8
);
#else
/* assume string needs no modification if not on Windows */
return
strdup
(
str
);
#endif
}
return
NULL
;
}
/* Returned pointer MUST be freed by the caller if non-NULL. */
...
...
@@ -447,52 +451,44 @@ wchar_t* utf8_to_utf16_string_alloc(const char *str)
char
*
utf16_to_utf8_string_alloc
(
const
wchar_t
*
str
)
{
#ifdef _WIN32
int
len
=
0
;
int
out_len
=
0
;
int
len
=
0
;
#else
size_t
len
=
0
;
size_t
out_len
=
0
;
size_t
len
=
0
;
#endif
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
if
(
!
str
||
!*
str
)
return
NULL
;
#ifdef _WIN32
len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
len
)
{
UINT
code_page
=
CP_UTF8
;
len
=
WideCharToMultiByte
(
code_page
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
/* fallback to ANSI codepage instead */
if
(
!
len
)
{
code_page
=
CP_ACP
;
len
=
WideCharToMultiByte
(
code_page
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
}
buf
=
(
char
*
)
calloc
(
len
,
sizeof
(
char
));
if
(
!
buf
)
return
NULL
;
out_len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
str
,
-
1
,
buf
,
len
,
NULL
,
NULL
);
}
else
{
/* fallback to ANSI codepage instead */
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
len
)
if
(
WideCharToMultiByte
(
code_page
,
0
,
str
,
-
1
,
buf
,
len
,
NULL
,
NULL
)
<
0
)
{
buf
=
(
char
*
)
calloc
(
len
,
sizeof
(
char
));
if
(
!
buf
)
return
NULL
;
out_len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
buf
,
len
,
NULL
,
NULL
);
free
(
buf
);
return
NULL
;
}
}
if
(
out_len
<
0
)
{
free
(
buf
);
return
NULL
;
}
#else
/* NOTE: For now, assume non-Windows platforms' locale is already UTF-8. */
/* NOTE: For now, assume non-Windows platforms'
* locale is already UTF-8. */
len
=
wcstombs
(
NULL
,
str
,
0
)
+
1
;
if
(
len
)
...
...
@@ -502,13 +498,11 @@ char* utf16_to_utf8_string_alloc(const wchar_t *str)
if
(
!
buf
)
return
NULL
;
out_len
=
wcstombs
(
buf
,
str
,
len
);
}
if
(
out_len
==
(
size_t
)
-
1
)
{
free
(
buf
);
return
NULL
;
if
(
wcstombs
(
buf
,
str
,
len
)
==
(
size_t
)
-
1
)
{
free
(
buf
);
return
NULL
;
}
}
#endif
...
...
libretro-common/file/file_path.c
View file @
05abc43a
This diff is collapsed.
Click to expand it.
libretro-common/file/retro_dirent.c
View file @
05abc43a
/* Copyright (C) 2010-201
8
The RetroArch team
/* Copyright (C) 2010-201
9
The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_dirent.c).
...
...
@@ -28,293 +28,91 @@
#include <boolean.h>
#include <retro_dirent.h>
#include <encodings/utf.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#define VFS_FRONTEND
#include <vfs/vfs_implementation.h>
#if defined(_WIN32)
# ifdef _MSC_VER
# define setmode _setmode
# endif
#include <sys/stat.h>
# ifdef _XBOX
# include <xtl.h>
# define INVALID_FILE_ATTRIBUTES -1
# else
# include <io.h>
# include <fcntl.h>
# include <direct.h>
# include <windows.h>
# endif
#elif defined(VITA)
# include <psp2/io/fcntl.h>
# include <psp2/io/dirent.h>
# include <psp2/io/stat.h>
#else
# if defined(PSP)
# include <pspiofilemgr.h>
# endif
# if defined(PS2)
# include <fileXio_rpc.h>
# endif
# include <sys/types.h>
# include <sys/stat.h>
# include <dirent.h>
# include <unistd.h>
#endif
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
;
#ifdef __CELLOS_LV2__
#include <cell/cell_fs.h>
#endif
#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP) || defined(PS2)
#include <unistd.h>
/* stat() is defined here */
#endif
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX)
#ifndef LEGACY_WIN32
#define LEGACY_WIN32
#endif
#endif
struct
RDIR
{
#if defined(_WIN32)
#if defined(LEGACY_WIN32)
WIN32_FIND_DATA
entry
;
#else
WIN32_FIND_DATAW
entry
;
#endif
HANDLE
directory
;
bool
next
;
char
path
[
PATH_MAX_LENGTH
];
#elif defined(VITA) || defined(PSP)
SceUID
directory
;
SceIoDirent
entry
;
#elif defined(PS2)
int
directory
;
iox_dirent_t
entry
;
#elif defined(__CELLOS_LV2__)
CellFsErrno
error
;
int
directory
;
CellFsDirent
entry
;
#else
DIR
*
directory
;
const
struct
dirent
*
entry
;
#endif
};
struct
RDIR
*
retro_opendir
(
const
char
*
name
)
void
dirent_vfs_init
(
const
struct
retro_vfs_interface_info
*
vfs_info
)
{
#if defined(_WIN32)
char
path_buf
[
1024
];
char
*
path_local
=
NULL
;
wchar_t
*
path_wide
=
NULL
;
unsigned
path_len
;
#endif
struct
RDIR
*
rdir
;
/*Reject null or empty string paths*/
if
(
!
name
||
(
*
name
==
0
))
return
NULL
;
/*Allocate RDIR struct. Tidied later with retro_closedir*/
rdir
=
(
struct
RDIR
*
)
calloc
(
1
,
sizeof
(
*
rdir
));
if
(
!
rdir
)
return
NULL
;
const
struct
retro_vfs_interface
*
vfs_iface
;
#if defined(_WIN32)
(
void
)
path_wide
;
(
void
)
path_local
;
dirent_opendir_cb
=
NULL
;
dirent_readdir_cb
=
NULL
;
dirent_dirent_get_name_cb
=
NULL
;
dirent_dirent_is_dir_cb
=
NULL
;
dirent_closedir_cb
=
NULL
;
path_buf
[
0
]
=
'\0'
;
path_len
=
strlen
(
name
);
vfs_iface
=
vfs_info
->
iface
;
/* Non-NT platforms don't like extra slashes in the path */
if
(
name
[
path_len
-
1
]
==
'\\'
)
snprintf
(
path_buf
,
sizeof
(
path_buf
),
"%s*"
,
name
);
else
snprintf
(
path_buf
,
sizeof
(
path_buf
),
"%s
\\
*"
,
name
);
#if defined(LEGACY_WIN32)
path_local
=
utf8_to_local_string_alloc
(
path_buf
);
rdir
->
directory
=
FindFirstFile
(
path_local
,
&
rdir
->
entry
);
if
(
path_local
)
free
(
path_local
);
#else
path_wide
=
utf8_to_utf16_string_alloc
(
path_buf
);
rdir
->
directory
=
FindFirstFileW
(
path_wide
,
&
rdir
->
entry
);
if
(
path_wide
)
free
(
path_wide
);
#endif
if
(
vfs_info
->
required_interface_version
<
DIRENT_REQUIRED_VFS_VERSION
||
!
vfs_iface
)
return
;
#elif defined(VITA) || defined(PSP)
rdir
->
directory
=
sceIoDopen
(
name
);
#elif defined(PS2)
rdir
->
directory
=
fileXioDopen
(
name
);
#elif defined(_3DS)
rdir
->
directory
=
!
string_is_empty
(
name
)
?
opendir
(
name
)
:
NULL
;
rdir
->
entry
=
NULL
;
#elif defined(__CELLOS_LV2__)
rdir
->
error
=
cellFsOpendir
(
name
,
&
rdir
->
directory
);
#else
rdir
->
directory
=
opendir
(
name
);
rdir
->
entry
=
NULL
;
#endif
dirent_opendir_cb
=
vfs_iface
->
opendir
;
dirent_readdir_cb
=
vfs_iface
->
readdir
;
dirent_dirent_get_name_cb
=
vfs_iface
->
dirent_get_name
;
dirent_dirent_is_dir_cb
=
vfs_iface
->
dirent_is_dir
;
dirent_closedir_cb
=
vfs_iface
->
closedir
;
}
if
(
rdir
->
directory
)
return
rdir
;
struct
RDIR
*
retro_opendir_include_hidden
(
const
char
*
name
,
bool
include_hidden
)
{
if
(
dirent_opendir_cb
!=
NULL
)
return
(
struct
RDIR
*
)
dirent_opendir_cb
(
name
,
include_hidden
);
return
(
struct
RDIR
*
)
retro_vfs_opendir_impl
(
name
,
include_hidden
);
}
free
(
rdir
);
return
NULL
;
struct
RDIR
*
retro_opendir
(
const
char
*
name
)
{
return
retro_opendir_include_hidden
(
name
,
false
);
}
bool
retro_dirent_error
(
struct
RDIR
*
rdir
)
{
#if defined(_WIN32)
return
(
rdir
->
directory
==
INVALID_HANDLE_VALUE
);
#elif defined(VITA) || defined(PSP) || defined(PS2)
return
(
rdir
->
directory
<
0
);
#elif defined(__CELLOS_LV2__)
return
(
rdir
->
error
!=
CELL_FS_SUCCEEDED
);
#else
return
!
(
rdir
->
directory
);
#endif
/* Left for compatibility */
return
false
;
}
int
retro_readdir
(
struct
RDIR
*
rdir
)
{
#if defined(_WIN32)
if
(
rdir
->
next
)
#if defined(LEGACY_WIN32)
return
(
FindNextFile
(
rdir
->
directory
,
&
rdir
->
entry
)
!=
0
);
#else
return
(
FindNextFileW
(
rdir
->
directory
,
&
rdir
->
entry
)
!=
0
);
#endif
rdir
->
next
=
true
;
return
(
rdir
->
directory
!=
INVALID_HANDLE_VALUE
);
#elif defined(VITA) || defined(PSP)
return
(
sceIoDread
(
rdir
->
directory
,
&
rdir
->
entry
)
>
0
);
#elif defined(PS2)
iox_dirent_t
record
;
int
ret
=
fileXioDread
(
rdir
->
directory
,
&
record
);
rdir
->
entry
=
record
;
return
(
ret
>
0
);
#elif defined(__CELLOS_LV2__)
uint64_t
nread
;
rdir
->
error
=
cellFsReaddir
(
rdir
->
directory
,
&
rdir
->
entry
,
&
nread
);
return
(
nread
!=
0
);
#else
return
((
rdir
->
entry
=
readdir
(
rdir
->
directory
))
!=
NULL
);
#endif
if
(
dirent_readdir_cb
!=
NULL
)
return
dirent_readdir_cb
((
struct
retro_vfs_dir_handle
*
)
rdir
);
return
retro_vfs_readdir_impl
((
struct
retro_vfs_dir_handle
*
)
rdir
);
}
const
char
*
retro_dirent_get_name
(
struct
RDIR
*
rdir
)
{
#if defined(_WIN32)
#if defined(LEGACY_WIN32)
char
*
name_local
=
local_to_utf8_string_alloc
(
rdir
->
entry
.
cFileName
);
memset
(
rdir
->
entry
.
cFileName
,
0
,
sizeof
(
rdir
->
entry
.
cFileName
));
strlcpy
(
rdir
->
entry
.
cFileName
,
name_local
,
sizeof
(
rdir
->
entry
.
cFileName
));
if
(
name_local
)
free
(
name_local
);
#else
char
*
name
=
utf16_to_utf8_string_alloc
(
rdir
->
entry
.
cFileName
);
memset
(
rdir
->
entry
.
cFileName
,
0
,
sizeof
(
rdir
->
entry
.
cFileName
));
strlcpy
((
char
*
)
rdir
->
entry
.
cFileName
,
name
,
sizeof
(
rdir
->
entry
.
cFileName
));
if
(
name
)
free
(
name
);
#endif
return
(
char
*
)
rdir
->
entry
.
cFileName
;
#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__)
return
rdir
->
entry
.
d_name
;
#elif defined(PS2)
return
rdir
->
entry
.
name
;
#else
return
rdir
->
entry
->
d_name
;
#endif
if
(
dirent_dirent_get_name_cb
!=
NULL
)
return
dirent_dirent_get_name_cb
((
struct
retro_vfs_dir_handle
*
)
rdir
);
return
retro_vfs_dirent_get_name_impl
((
struct
retro_vfs_dir_handle
*
)
rdir
);
}
/**
*
* retro_dirent_is_dir:
* @rdir : pointer to the directory entry.
* @
path
:
path to the directory entry.
* @
unused
:
deprecated, included for compatibility reasons, pass NULL
*
* Is the directory listing entry a directory?
*
* Returns: true if directory listing entry is
* a directory, false if not.
*/
bool
retro_dirent_is_dir
(
struct
RDIR
*
rdir
,
const
char
*
path
)
bool
retro_dirent_is_dir
(
struct
RDIR
*
rdir
,
const
char
*
unused
)
{
#if defined(_WIN32)
const
WIN32_FIND_DATA
*
entry
=
(
const
WIN32_FIND_DATA
*
)
&
rdir
->
entry
;
return
entry
->
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
;
#elif defined(PSP) || defined(VITA)
const
SceIoDirent
*
entry
=
(
const
SceIoDirent
*
)
&
rdir
->
entry
;
#if defined(PSP)
return
(
entry
->
d_stat
.
st_attr
&
FIO_SO_IFDIR
)
==
FIO_SO_IFDIR
;
#elif defined(VITA)
return
SCE_S_ISDIR
(
entry
->
d_stat
.
st_mode
);
#endif
#elif defined(PS2)
const
iox_dirent_t
*
entry
=
(
const
iox_dirent_t
*
)
&
rdir
->
entry
;
return
FIO_S_ISDIR
(
entry
->
stat
.
mode
);
#elif defined(__CELLOS_LV2__)
CellFsDirent
*
entry
=
(
CellFsDirent
*
)
&
rdir
->
entry
;
return
(
entry
->
d_type
==
CELL_FS_TYPE_DIRECTORY
);
#else
struct
stat
buf
;
#if defined(DT_DIR)
const
struct
dirent
*
entry
=
(
const
struct
dirent
*
)
rdir
->
entry
;
if
(
entry
->
d_type
==
DT_DIR
)
return
true
;
/* This can happen on certain file systems. */
if
(
!
(
entry
->
d_type
==
DT_UNKNOWN
||
entry
->
d_type
==
DT_LNK
))
return
false
;
#endif
/* dirent struct doesn't have d_type, do it the slow way ... */
if
(
stat
(
path
,
&
buf
)
<
0
)
return
false
;
return
S_ISDIR
(
buf
.
st_mode
);
#endif
}
void
retro_dirent_include_hidden
(
struct
RDIR
*
rdir
,
bool
include_hidden
)
{
#ifdef _WIN32
if
(
include_hidden
)
rdir
->
entry
.
dwFileAttributes
|=
FILE_ATTRIBUTE_HIDDEN
;
else
rdir
->
entry
.
dwFileAttributes
&=
~
FILE_ATTRIBUTE_HIDDEN
;
#endif
if
(
dirent_dirent_is_dir_cb
!=
NULL
)
return
dirent_dirent_is_dir_cb
((
struct
retro_vfs_dir_handle
*
)
rdir
);
return
retro_vfs_dirent_is_dir_impl
((
struct
retro_vfs_dir_handle
*
)
rdir
);
}
void
retro_closedir
(
struct
RDIR
*
rdir
)
{
if
(
!
rdir
)
return
;
#if defined(_WIN32)
if
(
rdir
->
directory
!=
INVALID_HANDLE_VALUE
)
FindClose
(
rdir
->
directory
);
#elif defined(VITA) || defined(PSP)
sceIoDclose
(
rdir
->
directory
);
#elif defined(PS2)
fileXioDclose
(
rdir
->
directory
);
#elif defined(__CELLOS_LV2__)
rdir
->
error
=
cellFsClosedir
(
rdir
->
directory
);
#else
if
(
rdir
->
directory
)
closedir
(
rdir
->
directory
);
#endif
free
(
rdir
);
if
(
dirent_closedir_cb
!=
NULL
)
dirent_closedir_cb
((
struct
retro_vfs_dir_handle
*
)
rdir
);
else
retro_vfs_closedir_impl
((
struct
retro_vfs_dir_handle
*
)
rdir
);
}