From 7a91fbebd9bef4c1a47747ef71960d646ab90d8d Mon Sep 17 00:00:00 2001 From: JusicP Date: Fri, 20 Aug 2021 19:56:20 +0300 Subject: [PATCH] Fix code for Android --- appframework/sdlmgr.cpp | 8 + common/freetype/config/ftconfig.h | 4 + filesystem/basefilesystem.cpp | 10 +- filesystem/filesystem_stdio.cpp | 4 + game/client/mumble.cpp | 2 + launcher/launcher.cpp | 319 +++++++++++++++++++- public/filesystem_init.cpp | 10 +- public/tier0/memoverride.cpp | 10 + scripts/waifulib/compiler_optimizations.pyc | Bin 0 -> 4663 bytes scripts/waifulib/fwgslib.pyc | Bin 0 -> 5667 bytes scripts/waifulib/xcompile.pyc | Bin 0 -> 15030 bytes tier0/assert_dialog.cpp | 2 +- tier0/dbg.cpp | 12 + tier0/platform_posix.cpp | 3 + tier0/threadtools.cpp | 5 + tier1/interface.cpp | 19 +- tier1/pathmatch.cpp | 7 +- tier1/strtools.cpp | 4 + togl/linuxwin/glentrypoints.cpp | 4 +- 19 files changed, 405 insertions(+), 18 deletions(-) create mode 100644 scripts/waifulib/compiler_optimizations.pyc create mode 100644 scripts/waifulib/fwgslib.pyc create mode 100644 scripts/waifulib/xcompile.pyc diff --git a/appframework/sdlmgr.cpp b/appframework/sdlmgr.cpp index 7234f4d1..74566da5 100644 --- a/appframework/sdlmgr.cpp +++ b/appframework/sdlmgr.cpp @@ -482,6 +482,14 @@ InitReturnVal_t CSDLMgr::Init() fprintf(stderr, "SDL video target is '%s'\n", SDL_GetCurrentVideoDriver()); Msg("SDL video target is '%s'\n", SDL_GetCurrentVideoDriver()); + + SDL_version compiled; + SDL_version linked; + + SDL_VERSION(&compiled); + SDL_GetVersion(&linked); + + Msg("SDL compiled version: %d.%d.%d, linked: %d.%d.%d\n", compiled.major, compiled.minor, compiled.patch, linked.major, linked.minor, linked.patch); m_bForbidMouseGrab = true; if ( !CommandLine()->FindParm("-nomousegrab") && CommandLine()->FindParm("-mousegrab") ) diff --git a/common/freetype/config/ftconfig.h b/common/freetype/config/ftconfig.h index 8d4a074b..5e19c414 100644 --- a/common/freetype/config/ftconfig.h +++ b/common/freetype/config/ftconfig.h @@ -1,7 +1,11 @@ #ifndef __FTCONFIG_H__MULTILIB #define __FTCONFIG_H__MULTILIB +#ifdef ANDROID +#include +#else #include +#endif #if __WORDSIZE == 32 # include "ftconfig-32.h" diff --git a/filesystem/basefilesystem.cpp b/filesystem/basefilesystem.cpp index 4423cb4c..4bd5dfbd 100644 --- a/filesystem/basefilesystem.cpp +++ b/filesystem/basefilesystem.cpp @@ -3770,8 +3770,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID { #ifdef WIN32 if( buf.st_mode & _S_IWRITE ) -#elif LINUX +#elif defined (LINUX) && !defined (ANDROID) if( buf.st_mode & S_IWRITE ) +#elif ANDROID + if( buf.st_mode & S_IWUSR ) #else if( buf.st_mode & S_IWRITE ) #endif @@ -3792,8 +3794,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID { #ifdef WIN32 if ( buf.st_mode & _S_IWRITE ) -#elif LINUX +#elif defined (LINUX) && !defined (ANDROID) if ( buf.st_mode & S_IWRITE ) +#elif ANDROID + if ( buf.st_mode & S_IWUSR ) #else if ( buf.st_mode & S_IWRITE ) #endif @@ -3812,6 +3816,8 @@ bool CBaseFileSystem::SetFileWritable( char const *pFileName, bool writable, con #ifdef _WIN32 int pmode = writable ? ( _S_IWRITE | _S_IREAD ) : ( _S_IREAD ); +#elif ANDROID + int pmode = writable ? ( S_IWUSR | S_IRUSR ) : ( S_IRUSR ); #else int pmode = writable ? ( S_IWRITE | S_IREAD ) : ( S_IREAD ); #endif diff --git a/filesystem/filesystem_stdio.cpp b/filesystem/filesystem_stdio.cpp index 43916fe3..3bb7c5b5 100644 --- a/filesystem/filesystem_stdio.cpp +++ b/filesystem/filesystem_stdio.cpp @@ -972,7 +972,11 @@ void CStdioFile::FS_fclose() AUTO_LOCK( m_MutexLockedFD ); struct _stat buf; +#ifdef ANDROID + int fd = fileno( m_pFile ); // need to test this +#else int fd = fileno_unlocked( m_pFile ); +#endif fstat( fd, &buf ); fflush( m_pFile ); diff --git a/game/client/mumble.cpp b/game/client/mumble.cpp index 8e58bc22..9d16acc5 100644 --- a/game/client/mumble.cpp +++ b/game/client/mumble.cpp @@ -98,6 +98,8 @@ void CMumbleSystem::LevelInitPostEntity() g_hMapObject = NULL; return; } +#elif defined( ANDROID ) + return; // TODO: implement #elif defined( POSIX ) char memname[256]; V_sprintf_safe( memname, "/MumbleLink.%d", getuid() ); diff --git a/launcher/launcher.cpp b/launcher/launcher.cpp index d34ae113..890b76e1 100644 --- a/launcher/launcher.cpp +++ b/launcher/launcher.cpp @@ -642,6 +642,8 @@ void ReportDirtyDiskNoMaterialSystem() //----------------------------------------------------------------------------- bool CSourceAppSystemGroup::Create() { + Warning( "CSourceAppSystemGroup::Create\n" ); + IFileSystem *pFileSystem = (IFileSystem*)FindSystem( FILESYSTEM_INTERFACE_VERSION ); pFileSystem->InstallDirtyDiskReportFunc( ReportDirtyDiskNoMaterialSystem ); @@ -674,13 +676,18 @@ bool CSourceAppSystemGroup::Create() { "", "" } // Required to terminate the list }; + Warning( "PreAddSystem\n" ); + #if defined( USE_SDL ) AddSystem( (IAppSystem *)CreateSDLMgr(), SDLMGR_INTERFACE_VERSION ); #endif + Warning( "PreAddSystems\n" ); + if ( !AddSystems( appSystems ) ) return false; - + + Warning( "PostAddSystems\n" ); // This will be NULL for games that don't support VR. That's ok. Just don't load the DLL AppModule_t sourceVRModule = LoadModule( "sourcevr" DLL_EXT_STRING ); @@ -757,6 +764,8 @@ bool CSourceAppSystemGroup::Create() bool CSourceAppSystemGroup::PreInit() { + Warning( "CSourceAppSystemGroup::PreInit\n" ); + CreateInterfaceFn factory = GetFactory(); ConnectTier1Libraries( &factory, 1 ); ConVar_Register( ); @@ -934,7 +943,9 @@ bool GrabSourceMutex() CRC32_ProcessBuffer( &gameCRC, (void *)pchGameParam, Q_strlen( pchGameParam ) ); CRC32_Final( &gameCRC ); -#ifdef LINUX +#ifdef ANDROID + return true; +#elif defined (LINUX) /* * Linux */ @@ -1166,6 +1177,306 @@ static const char *BuildCommand() return (const char *)build.Base(); } +#ifdef ANDROID +#include +#include "jni.h" + +char dataDir[512]; + +const char *LauncherArgv[512]; +char javaArgv[2048]; +char gameName[512]; +char startArgs[256][128]; +char language[1024] = "english"; +int iLastArgs = 0; +static int scr_width,scr_height; + +bool bClient_loaded = false; +bool bShowTouch = true; +void *libclient; + +static struct jnimethods_s +{ + jclass actcls; + JavaVM *vm; + JNIEnv *env; + jmethodID enableTextInput; +} jni; + + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setMainPackFilePath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setMainPackFilePath" ); + return setenv( "VALVE_PAK0_PATH", env->GetStringUTFChars(str, NULL), 1 ); +} +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setPatchPackFilePath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setPatchPackFilePath" ); + return setenv( "VALVE_PAK1_PATH", env->GetStringUTFChars(str, NULL), 1 ); +} +DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_setCacheDirectoryPath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setCacheDirectoryPath" ); + //return setenv( "VALVE_CACHE_PATH", env->GetStringUTFChars(str, NULL), 1 ); +} +DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_gpgsStart() +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_gpgsStart" ); +} +DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_nativeOnActivityResult() +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_nativeOnActivityResult" ); +} + +DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_setNativeLibPath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setNativeLibPath" ); +// snprintf(dataDir, sizeof dataDir, env->GetStringUTFChars(str, NULL)); +} +DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_setLanguage(JNIEnv *env, jclass *clazz, jstring str) +{ + snprintf(language, sizeof language, "%s", env->GetStringUTFChars(str, NULL)); + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setLanguage" ); +} +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setDocumentDirectoryPath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setDocumentDirectoryPath" ); + setenv( "HOME", env->GetStringUTFChars(str, NULL), 1); + return setenv( "VALVE_CACHE_PATH", env->GetStringUTFChars(str, NULL), 1 ); +} +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setDropMip(int a1, int a2, signed int a3) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setDropMip" ); +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_saveGame() +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_saveGame" ); +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setDataDirectoryPath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity_setDataDirectoryPath" ); + snprintf(dataDir, sizeof dataDir, env->GetStringUTFChars(str, NULL)); +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setExtrasPackFilePath(JNIEnv *env, jclass *clazz, jstring str) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity2_setExtrasPackFilePath" ); + return setenv( "VALVE_PAK2_PATH", env->GetStringUTFChars(str, NULL), 1 ); +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setenv(JNIEnv *jenv, jclass *jclass, jstring env, jstring value, jint over) +{ + __android_log_print( ANDROID_LOG_DEBUG, "SourceSDK2013", "Java_com_valvesoftware_ValveActivity2_setenv %s=%s", jenv->GetStringUTFChars(env, NULL),jenv->GetStringUTFChars(value, NULL) ); + return setenv( jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL), over ); +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setGame(JNIEnv *jenv, jclass *jclass, jstring game) +{ + snprintf(gameName, sizeof dataDir, "-game %s", jenv->GetStringUTFChars(game, NULL)); + return setenv( "VALVE_MOD", jenv->GetStringUTFChars(game, NULL), 1); +} + +typedef void (*t_TouchEvent)(int finger, int x, int y, int act); +t_TouchEvent TouchEvent; + +DLL_EXPORT void clientLoaded( void ) +{ + bClient_loaded = true; + libclient = dlopen("libclient.so",0); + TouchEvent = (t_TouchEvent)dlsym(libclient, "TouchEvent"); + ((void (*)(bool, int, int))dlsym(libclient, "showTouch"))(bShowTouch, scr_width, scr_height); +} + +DLL_EXPORT void showKeyboard( int show ) +{ + jni.env->CallStaticVoidMethod( jni.actcls, jni.enableTextInput, show ); +} + +DLL_EXPORT void JNICALL Java_com_valvesoftware_ValveActivity2_showTouch(JNIEnv *env, jobject obj, jboolean show_touch, jint width, jint height) +{ + scr_width = width; + scr_height = height; + bShowTouch = show_touch; +} + +DLL_EXPORT void JNICALL Java_com_valvesoftware_ValveActivity2_TouchEvent(JNIEnv *env, jobject obj, jint fingerid, jint x, jint y, jint action) +{ + if( !bClient_loaded ) + return; + + TouchEvent( fingerid, x, y, action ); +} + +DLL_EXPORT const char* getSystemLanguage() +{ + return language; +} + +typedef void (*t_SDL_Android_Init)(JNIEnv* env, jclass cls); +t_SDL_Android_Init SDL_Android_Init; + +//typedef void *(*t_SDL_StartTextInput)(); +//t_SDL_StartTextInput SDL_StartTextInput; + +typedef void (*t_egl_init)(); +t_egl_init egl_init; + +bool bUseGL; + +void SetRenderer() +{ + if ( bUseGL ) + { + //setenv("USE_BIG_GL", "1", 1); + } + else + { + setenv("REGAL_LOG", "0", 1); + setenv("REGAL_LOG_ERROR", "0", 1); + setenv("REGAL_LOG_WARNING", "0", 1); + setenv("REGAL_LOG_INFO", "0", 1); + setenv("REGAL_LOG_HTTP", "0", 1); + setenv("REGAL_LOG_JSON", "0", 1); + setenv("REGAL_LOG_CALLBACK", "0", 1); + setenv("REGAL_LOG_ONCE", "0", 1); + setenv("REGAL_LOG_POINTERS", "0", 1); + setenv("REGAL_LOG_THREAD", "0", 1); + setenv("REGAL_LOG_PROCESS", "0", 1); + setenv("REGAL_LOG_ALL", "0", 1); + setenv("REGAL_DEBUG", "0", 1); + setenv("REGAL_ERROR", "0", 1); + setenv("REGAL_LOG_FILE", "/dev/null", 1); + setenv("REGAL_EMU_SO", "0", 1); + setenv("REGAL_THREAD_LOCKING", "0", 1); + setenv("REGAL_FORCE_ES2_PROFILE", "1", 1); + setenv("REGAL_SYS_GLX", "0", 1); + setenv("REGAL_SYS_ES2", "1", 1); + setenv("REGAL_SYS_EGL", "1", 1); + setenv("REGAL_SYS_GL", "0", 1); + setenv("REGAL_GL_VERSION", "2.1", 1); + setenv("REGAL_GL_EXTENSIONS", "GL_EXT_framebuffer_object GL_EXT_framebuffer_blit GL_OES_mapbuffer GL_EXT_texture_sRGB_decode GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1", 1); + } +} + +void SetArg( const char *arg ) +{ + char *pch; + char str[1024]; + strncpy( str, arg, sizeof str ); + pch = strtok (str," "); + while (pch != NULL) + { + strncpy( startArgs[iLastArgs], pch, sizeof startArgs[0] ); + LauncherArgv[iLastArgs] = startArgs[iLastArgs]; + iLastArgs++; + pch = strtok (NULL, " "); + } +} + +DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setArgs(JNIEnv *env, jclass *clazz, jstring str) +{ + snprintf( javaArgv, sizeof javaArgv, env->GetStringUTFChars(str, NULL) ); +} + +void SetStartArgs() +{ + char lang[2048]; + snprintf(lang, sizeof lang, "-language %s +cc_lang %s", language, language); + + SetArg(dataDir); + SetArg(lang); + SetArg(gameName); + SetArg(javaArgv); + SetArg("-window " + "-nosteam " + "-nouserclip " + "+sv_unlockedchapters 99 " + "+mat_queue_mode 2 " + "-ignoredxsupportcfg " + "-regal " + "+gl_rt_forcergba 1 " + "+mat_antialias 1 " + "-mat_antialias 1 " + "+r_flashlightdepthtexture 1 " + "+gl_dropmips 1 " + "-insecure"); + + if( bUseGL ) + SetArg("-userclip " + "-gl_disablesamplerobjects " +// "-egl " + "+gl_enabletexsubimage 1 " + "+gl_blitmode 1 " + "+gl_supportMapBuffer 0 " + "-gl_separatedepthstencil 0 " + "-gl_nodepthtexture 0 " + "+r_flashlight_version2 0 " + "+gl_emurgba16 0 " + "+gl_emunooverwrite 0"); + else + SetArg("-nouserclip " + "-gl_disablesamplerobjects " + "+gl_enabletexsubimage 0 " + "+mat_reducefillrate 1 " + "+gl_blitmode 1 " + "+gl_supportMapBuffer 1 " + "-gl_separatedepthstencil 0 "// default is 1 + "-gl_nodepthtexture 1 " + "+r_flashlight_version2 1 " + "+gl_emurgba16 1 " + "+gl_emunooverwrite 1"); +} + +int LauncherMain( int argc, char **argv ); + +DLL_EXPORT int SDL_main() +{ + // init sdl + void *sdlHandle = dlopen("libSDL2.so", 0); + + SDL_Android_Init = (t_SDL_Android_Init)dlsym(sdlHandle, "SDL_Android_Init"); + SDL_Android_Init(env, cls); + + //SDL_StartTextInput = (t_SDL_StartTextInput)dlsym(sdlHandle, "SDL_StartTextInput"); + //SDL_StartTextInput(); + + chdir(dataDir); + getcwd(dataDir, sizeof dataDir); + setenv( "VALVE_GAME_PATH", dataDir, 1 ); + snprintf(dataDir, sizeof dataDir, "%s/hl2_linux", dataDir); + + bUseGL = false; + + SetRenderer(); + SetStartArgs(); + + void *engineHandle = dlopen("libengine.so", 0); + void *launcherHandle = dlopen("liblauncher.so", 0); + +#ifdef GL4ES + + void *glHandle = dlopen("libRegal.so", 0); + egl_init = (t_egl_init)dlsym(glHandle, "egl_init"); + if( egl_init ) + egl_init(); +#endif + + jni.env = env; + jni.actcls = env->FindClass("org/libsdl/app/SDLActivity"); + jni.enableTextInput = env->GetStaticMethodID(jni.actcls, "showKeyboard", "(I)V"); + + LauncherMain(iLastArgs, LauncherArgv); + + dlclose(launcherHandle); + dlclose(engineHandle); + + return 0; +} + +#endif + //----------------------------------------------------------------------------- // Purpose: The real entry point for the application // Input : hInstance - @@ -1175,7 +1486,7 @@ static const char *BuildCommand() // Output : int APIENTRY //----------------------------------------------------------------------------- #ifdef WIN32 -extern "C" __declspec(dllexport) int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) +extern "C" __declspec(DLL_EXPORT) int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) #else DLL_EXPORT int LauncherMain( int argc, char **argv ) #endif @@ -1229,7 +1540,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) { return -1; } - + const char *filename; #ifdef WIN32 CommandLine()->CreateCmdLine( IsPC() ? VCRHook_GetCommandLine() : lpCmdLine ); diff --git a/public/filesystem_init.cpp b/public/filesystem_init.cpp index d6126578..10006487 100644 --- a/public/filesystem_init.cpp +++ b/public/filesystem_init.cpp @@ -341,14 +341,20 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen ) Q_FixSlashes( exedir ); +#ifdef ANDROID + const char* libDir = "lib"; +#else + const char* libDir = "bin"; +#endif + // Return the bin directory as the executable dir if it's not in there // because that's really where we're running from... char ext[MAX_PATH]; Q_StrRight( exedir, 4, ext, sizeof( ext ) ); - if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, "bin" ) != 0 ) + if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, libDir ) != 0 ) { Q_strncat( exedir, CORRECT_PATH_SEPARATOR_S, exeDirLen, COPY_ALL_CHARACTERS ); - Q_strncat( exedir, "bin", exeDirLen, COPY_ALL_CHARACTERS ); + Q_strncat( exedir, libDir, exeDirLen, COPY_ALL_CHARACTERS ); Q_FixSlashes( exedir ); } diff --git a/public/tier0/memoverride.cpp b/public/tier0/memoverride.cpp index 925f9d2a..c0f8e2af 100644 --- a/public/tier0/memoverride.cpp +++ b/public/tier0/memoverride.cpp @@ -392,6 +392,8 @@ extern "C" #ifndef NO_MEMOVERRIDE_NEW_DELETE #ifdef OSX void *__cdecl operator new( size_t nSize ) throw (std::bad_alloc) +#elif ANDROID +void *__cdecl operator new( size_t nSize ) throw (std::bad_alloc) #else void *__cdecl operator new( size_t nSize ) #endif @@ -406,6 +408,8 @@ void *__cdecl operator new( size_t nSize, int nBlockUse, const char *pFileName, #ifdef OSX void __cdecl operator delete( void *pMem ) throw() +#elif ANDROID +void __cdecl operator delete( void *pMem ) throw() #else void __cdecl operator delete( void *pMem ) #endif @@ -415,6 +419,8 @@ void __cdecl operator delete( void *pMem ) #ifdef OSX void operator delete(void*pMem, std::size_t) +#elif ANDROID +void operator delete(void*pMem, std::size_t) #else void operator delete(void*pMem, std::size_t) throw() #endif @@ -424,6 +430,8 @@ void operator delete(void*pMem, std::size_t) throw() #ifdef OSX void *__cdecl operator new[]( size_t nSize ) throw (std::bad_alloc) +#elif ANDROID +void *__cdecl operator new[]( size_t nSize ) throw (std::bad_alloc) #else void *__cdecl operator new[]( size_t nSize ) #endif @@ -438,6 +446,8 @@ void *__cdecl operator new[] ( size_t nSize, int nBlockUse, const char *pFileNam #ifdef OSX void __cdecl operator delete[]( void *pMem ) throw() +#elif ANDROID +void __cdecl operator delete[]( void *pMem ) throw() #else void __cdecl operator delete[]( void *pMem ) #endif diff --git a/scripts/waifulib/compiler_optimizations.pyc b/scripts/waifulib/compiler_optimizations.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a672032de5ab423ba9248a7aee708fade9fe8a12 GIT binary patch literal 4663 zcmcInOH&-l5zZb!Fo>64XwhTU!j{FZX-4Sj#midKfMjB4K`|i7i^DO|boDe1J>3&s z)gU(3C)pRD{2zSw-M_+Thy62r^uhiztA`o14%-K>6jNQ5nU$H9Z-)LpIX?8aTYf<0 zziE7*;-~*nAv(E6iby$>5Oo~db*NLJ-3mEx)0^ZtPKg{ki%cE*1!F3d3{z)>c1K7k zhbTEmol)8y#d(<22&r?VMoEp4s*)O~2)HqdD-;irI!}>9YJwiCN!d+dH!Zsv>@Lt_ z(5Z{0E>VQdWx!4kOj@PKyH$!uDTbsgq-IH7CG`=hIf@{d`QmZcN!_3b()d2kIDi@7 zze(z2Qnv)z69`T&soO#W2CTq5sUOJshq!Zx)Q?Er6%c3_0Af~mL~E8XFFS^h;Q9yb z`1&UU9H6DW4QTI)eFno|0KHw|$ghDWpOX493s;N6#v`>vsz&M_sby04Nj;!wk`zCu z&*+?G^zf9?BT|n^Jt6fIil8D>KRVTW)aw0^)Mq_2sFj`{pbu*d2G$j&UHiA;6gJwR zEOs&*WDNcq7svnfRFltT$1Lp*Cfq$QG^_uSW`bi#eQ|pGXQZC?Ot=dJJfq(b?M{(; zE}LlzVe2~Y-y_IpNUhQK!a9;5{wMw|AQ8x1z!HU~)lU3KxAsn2=A;{%D<49GtkaE? zFkf)^(lC}FOWXZZBa5^d2e|EPllmq;3WbV~W)$!|OhR9WW(0c`?iGz4xS=%YYi1k8JzEP7s=c}1$icASRF3;`Skfo9zq z&78B;)y5AFS063kKNJqxaS#~hiWhaVR9|N5c2Dr?DLX5rkMNbsL#;*sAo0^kZr0XX zueUcgU$)*XFW+lzuYLJsxusc=+HP#WFShk1IR`6dKM#Gi?YF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co>cXR&Z+X|>}p2(OFF&KIdB z_qup^(3_Y??0}SATb1TU@^{exa2Vn&Ak`66*!ochXG(u_0T$ULi%_m9Ym|Rrg%Obb z>~jcz2c2G=@FJgif<7y$jI+_Ahx2{Fa6V>2jy!C%@iz|#(AGwpCer%Qqlq+QsL}9j z#*h-rV$!uMoZn+RhVGA5r3aG;W})sF6apMGCx~M2f`LBD(diFs_S4Y$A({>w0p|b{ zufe6wPhp(jAPz`JW%ak2g--e$KH``CBD*?)&h1^bQS2~K7SDHLAvpuh%P&T&hwD=Vsuww*foD#XSwqy^CKk=#GvY zCwxIylYj(+bWqH3qxXd86ByLE@y0tNYz8zyqN2bbda;*;Cc*B7c?KyuMw1#3EwHVP z+(i$V#kd!TJ(U85^$o)h&sSm+QzjF(NKs9h)t_64-~*KcySQAKU0SefQS+A-{W(!y z1?R`;C$^9C5pv?ciLjKzDH0REQt*-_7I#K8HnHL+_!XEm*BVK^kp}qFLzgaQKDW3k zuAEm#;J*)?!9o-B!UzINM^UqaW@0U>`GEihiUk%A&+g$!QL-r(0;;ASn5%1?XTw2p8cjFriW6&;oWYF`-rJ{5lh#$xBRLVM6vb%8G(X zgovCv=MPx?LnN|({C-0y_#@W-F_S-H@+VCG6p7hn;4!$|5UdP~+665)asSR6=k)-5 z6r?rIU!kT=6v@4a6Wa%Hx6FOcZC*X;w~=Jk35y^8Mu7K13<(-)-E*9^da}oVrq1Ff Y #endif -#if defined( USE_SDL ) +#if defined( LINUX ) || defined( USE_SDL ) // We lazily load the SDL shared object, and only reference functions if it's // available, so this can be included on the dedicated server too. diff --git a/tier0/dbg.cpp b/tier0/dbg.cpp index ce01801f..9bbe1348 100644 --- a/tier0/dbg.cpp +++ b/tier0/dbg.cpp @@ -31,6 +31,10 @@ #include "xbox/xbox_console.h" #endif +#ifdef ANDROID +#include +#endif + #include "tier0/etwprof.h" #ifndef STEAM @@ -313,6 +317,10 @@ static SpewRetval_t _SpewMessage( SpewType_t spewType, const char *pGroupName, i ret = s_SpewOutputFunc( spewType, pTempBuffer ); g_pSpewInfo = (int)NULL; +#ifdef ANDROID + __android_log_print( ANDROID_LOG_INFO, "SRCENGINE", "%s", pTempBuffer ); +#endif + switch (ret) { // Asserts put the break into the macro so it occurs in the right place @@ -903,6 +911,10 @@ void COM_TimestampedLog( char const *fmt, ... ) XBX_rTimeStampLog( curStamp, string ); #endif +#ifdef ANDROID + __android_log_print( ANDROID_LOG_INFO, "SRCENGINE", "%s", string ); +#endif + if ( IsPC() ) { // If ETW profiling is enabled then do it only. diff --git a/tier0/platform_posix.cpp b/tier0/platform_posix.cpp index ba2783a5..9a12bc3b 100644 --- a/tier0/platform_posix.cpp +++ b/tier0/platform_posix.cpp @@ -28,6 +28,9 @@ #include #include #endif +#ifdef ANDROID +#include +#endif #include "tier0/memdbgon.h" // Benchmark mode uses this heavy-handed method diff --git a/tier0/threadtools.cpp b/tier0/threadtools.cpp index caafef6c..99da9d66 100644 --- a/tier0/threadtools.cpp +++ b/tier0/threadtools.cpp @@ -23,8 +23,13 @@ #elif defined(POSIX) #if !defined(OSX) +#if defined(ANDROID) + #include + #include +#else #include #include +#endif #define sem_unlink( arg ) #define OS_TO_PTHREAD(x) (x) #else diff --git a/tier1/interface.cpp b/tier1/interface.cpp index 3c91cc30..45ba5c90 100644 --- a/tier1/interface.cpp +++ b/tier1/interface.cpp @@ -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 ); } diff --git a/tier1/pathmatch.cpp b/tier1/pathmatch.cpp index bd8d3cbd..8e439dfe 100644 --- a/tier1/pathmatch.cpp +++ b/tier1/pathmatch.cpp @@ -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 ); diff --git a/tier1/strtools.cpp b/tier1/strtools.cpp index cfef6b13..09a95cba 100644 --- a/tier1/strtools.cpp +++ b/tier1/strtools.cpp @@ -47,7 +47,11 @@ #include #ifdef POSIX +#ifdef ANDROID +#include <../thirdparty/libiconv-1.14/include/iconv.h> +#else #include +#endif #include #include #include diff --git a/togl/linuxwin/glentrypoints.cpp b/togl/linuxwin/glentrypoints.cpp index 25e49ab3..fad300d7 100644 --- a/togl/linuxwin/glentrypoints.cpp +++ b/togl/linuxwin/glentrypoints.cpp @@ -43,7 +43,7 @@ #include "tier1.h" #include "tier2/tier2.h" -#ifdef _LINUX +#if defined(_LINUX) && !defined(__ANDROID__) #include #endif @@ -296,7 +296,7 @@ static bool CheckOpenGLExtension_internal(const char *ext, const int coremajor, return false; } } -#elif !defined ( OSX ) +#elif !defined ( OSX ) && !defined( __ANDROID__ ) if (!ptr) { static CDynamicFunctionOpenGL< true, Display *( APIENTRY *)( ), Display* > glXGetCurrentDisplay("glXGetCurrentDisplay");