Browse Source

android: remove some jni functions, use APP_LIB_PATH instead of APP_DATA_PATH

pull/77/head
nillerusr 2 years ago
parent
commit
ff99055be1
  1. 17
      launcher/android.cpp
  2. 8
      public/filesystem_init.cpp
  3. 4
      public/materialsystem/imesh.h
  4. 8
      tier1/interface.cpp

17
launcher/android.cpp

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#ifdef ANDROID
#include <android/log.h>
#include <SDL_version.h>
#define TAG "SRCENG"
#define PRIO ANDROID_LOG_DEBUG
@ -69,18 +70,6 @@ int iLastArgs = 0; @@ -69,18 +70,6 @@ int iLastArgs = 0;
#define LogPrintf(...) do { __android_log_print(PRIO, TAG, __VA_ARGS__); printf( __VA_ARGS__); } while( 0 );
#define DLLEXPORT extern "C" __attribute__((visibility("default")))
DLLEXPORT void Java_com_valvesoftware_ValveActivity2_setDataDirectoryPath(JNIEnv *env, jclass *clazz, jstring path)
{
setenv( "APP_DATA_PATH", env->GetStringUTFChars(path, NULL), 1);
LogPrintf( "Java_com_valvesoftware_ValveActivity2_setDataDirectoryPath: %s", getenv("APP_DATA_PATH") );
}
DLLEXPORT void Java_com_valvesoftware_ValveActivity2_setGameDirectoryPath(JNIEnv *env, jclass *clazz, jstring path)
{
LogPrintf( "Java_com_valvesoftware_ValveActivity2_setGameDirectoryPath" );
setenv( "VALVE_GAME_PATH", env->GetStringUTFChars(path, NULL), 1 );
}
DLLEXPORT int Java_com_valvesoftware_ValveActivity2_setenv(JNIEnv *jenv, jclass *jclass, jstring env, jstring value, jint over)
{
LogPrintf( "Java_com_valvesoftware_ValveActivity2_setenv %s=%s", jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL) );
@ -133,6 +122,10 @@ void SetLauncherArgs() @@ -133,6 +122,10 @@ void SetLauncherArgs()
DLLEXPORT int LauncherMainAndroid( int argc, char **argv )
{
SDL_version ver;
SDL_GetVersion( &ver );
LogPrintf("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
SetLauncherArgs();

8
public/filesystem_init.cpp

@ -307,6 +307,9 @@ static bool Sys_GetExecutableName( char *out, int len ) @@ -307,6 +307,9 @@ static bool Sys_GetExecutableName( char *out, int len )
bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
{
#ifdef ANDROID
Q_snprintf( exedir, exeDirLen, "%s", getenv("APP_LIB_PATH") );
#else
exedir[0] = 0;
if ( s_bUseVProjectBinDir )
@ -341,11 +344,7 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen ) @@ -341,11 +344,7 @@ 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...
@ -357,6 +356,7 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen ) @@ -357,6 +356,7 @@ bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
Q_strncat( exedir, libDir, exeDirLen, COPY_ALL_CHARACTERS );
Q_FixSlashes( exedir );
}
#endif
return true;
}

4
public/materialsystem/imesh.h

@ -1156,7 +1156,7 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n ) @@ -1156,7 +1156,7 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n )
//-----------------------------------------------------------------------------
inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex )
{
#if defined(__arm__) || defined(__arm64__)
#if defined(__arm__) || defined(__aarch64__)
FastVertexSSE( vertex );
#else
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
@ -1326,7 +1326,7 @@ inline void CVertexBuilder::Fast4VerticesSSE( @@ -1326,7 +1326,7 @@ inline void CVertexBuilder::Fast4VerticesSSE(
inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex )
{
#if defined(__arm__) || defined(__arm64__)
#if defined(__arm__) || defined(__aarch64__)
FastVertexSSE( vertex );
#else
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed

8
tier1/interface.cpp

@ -306,7 +306,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO @@ -306,7 +306,7 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
#ifdef ANDROID
struct stat statBuf;
char *dataPath = getenv("APP_DATA_PATH");
char *libPath = getenv("APP_LIB_PATH");
char *modLibPath = getenv("APP_MOD_LIB");
if( modLibPath && *modLibPath ) // first load library from mod launcher
@ -314,13 +314,13 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO @@ -314,13 +314,13 @@ CSysModule *Sys_LoadModule( const char *pModuleName, Sys_Flags flags /* = SYS_NO
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib%s", modLibPath, pModuleName);
if( stat(szAbsoluteModuleName, &statBuf) != 0 )
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/%s", modLibPath, pModuleName);
hDLL = Sys_LoadLibrary(szAbsoluteModuleName, flags);
}
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib/lib%s", dataPath ,pModuleName);
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib%s", libPath ,pModuleName);
if( stat(szAbsoluteModuleName, &statBuf) != 0 )
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/lib/%s", dataPath ,pModuleName);
Q_snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/%s", libPath ,pModuleName);
#else
#ifdef POSIX
struct stat statBuf;

Loading…
Cancel
Save