Fix code for Android

This commit is contained in:
JusicP
2021-08-20 19:56:20 +03:00
parent 557c300975
commit 7a91fbebd9
19 changed files with 405 additions and 18 deletions
+15 -4
View File
@@ -304,15 +304,26 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
#ifdef POSIX
struct stat statBuf;
#ifdef ANDROID
Q_snprintf(szModuleName, sizeof(szModuleName), "lib/lib%s", pModuleName);
#else
Q_snprintf(szModuleName, sizeof(szModuleName), "bin/lib%s", pModuleName);
#endif
bUseLibPrefix |= stat(szModuleName, &statBuf) == 0;
#endif
if( bUseLibPrefix )
Q_snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/bin/lib%s", szCwd, pModuleName );
else
Q_snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/bin/%s", szCwd, pModuleName );
#ifdef ANDROID
char* szModulePath = "%s/lib/lib%s";
if (!bUseLibPrefix)
szModulePath = "%s/lib/%s";
#else
char* szModulePath = "%s/bin/lib%s";
if (!bUseLibPrefix)
szModulePath = "%s/bin/%s";
#endif
Q_snprintf( szAbsoluteModuleName, sizeof(szAbsoluteModuleName), szModulePath, szCwd, pModuleName );
hDLL = Sys_LoadLibrary( szAbsoluteModuleName, flags );
}
+4 -3
View File
@@ -750,7 +750,7 @@ extern "C" {
return CALL(freopen)( mpath, mode, stream );
}
#ifndef ANDROID
WRAP(fopen, FILE *, const char *path, const char *mode)
{
// if mode does not have w, a, or +, it's open for read.
@@ -788,7 +788,7 @@ extern "C" {
{
return __wrap_open( pathname, O_CREAT|O_WRONLY|O_TRUNC, mode );
}
#endif
int __wrap_access(const char *pathname, int mode)
{
return __real_access( CWrap( pathname, false ), mode );
@@ -815,6 +815,7 @@ extern "C" {
{
return CALL(opendir)( CWrap( name, false ) );
}
#ifndef ANDROID
WRAP(__xstat, int, int __ver, __const char *__filename, struct stat *__stat_buf)
{
@@ -835,7 +836,7 @@ extern "C" {
{
return CALL(__lxstat64)( __ver, CWrap( __filename, false), __stat_buf );
}
#endif
WRAP(chmod, int, const char *path, mode_t mode)
{
return CALL(chmod)( CWrap( path, false), mode );
+4
View File
@@ -47,7 +47,11 @@
#include <stdarg.h>
#ifdef POSIX
#ifdef ANDROID
#include <../thirdparty/libiconv-1.14/include/iconv.h>
#else
#include <iconv.h>
#endif
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>