add additional logging information
This commit is contained in:
parent
f11087b83a
commit
3e19d26a72
@ -206,8 +206,6 @@ void *VoidFnPtrLookup_GlMgr(const char *fn, bool &okay, const bool bRequired, vo
|
|||||||
{
|
{
|
||||||
retval = _glGetProcAddress(fn);
|
retval = _glGetProcAddress(fn);
|
||||||
|
|
||||||
Msg("_glGetProcAddress(%s) = %x\n", fn, retval);
|
|
||||||
|
|
||||||
if( !retval && l_gles )
|
if( !retval && l_gles )
|
||||||
retval = dlsym( l_gles, fn );
|
retval = dlsym( l_gles, fn );
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ GNU General Public License for more details.
|
|||||||
#include <SDL_version.h>
|
#include <SDL_version.h>
|
||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include "tier0/threadtools.h"
|
#include "tier0/threadtools.h"
|
||||||
|
#include <sys/system_properties.h>
|
||||||
|
|
||||||
char *LauncherArgv[512];
|
char *LauncherArgv[512];
|
||||||
char java_args[4096];
|
char java_args[4096];
|
||||||
@ -33,13 +34,13 @@ extern void InitCrashHandler();
|
|||||||
|
|
||||||
DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setenv(JNIEnv *jenv, jclass *jclass, jstring env, jstring value, jint over)
|
DLL_EXPORT int Java_com_valvesoftware_ValveActivity2_setenv(JNIEnv *jenv, jclass *jclass, jstring env, jstring value, jint over)
|
||||||
{
|
{
|
||||||
Msg( "Java_com_valvesoftware_ValveActivity2_setenv %s=%s", jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL) );
|
Msg( "Java_com_valvesoftware_ValveActivity2_setenv %s=%s\n", jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL) );
|
||||||
return setenv( jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL), over );
|
return setenv( jenv->GetStringUTFChars(env, NULL), jenv->GetStringUTFChars(value, NULL), over );
|
||||||
}
|
}
|
||||||
|
|
||||||
DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_nativeOnActivityResult()
|
DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_nativeOnActivityResult()
|
||||||
{
|
{
|
||||||
Msg( "Java_com_valvesoftware_ValveActivity_nativeOnActivityResult" );
|
// Msg( "Java_com_valvesoftware_ValveActivity_nativeOnActivityResult\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_setArgs(JNIEnv *env, jclass *clazz, jstring str)
|
DLL_EXPORT void Java_com_valvesoftware_ValveActivity2_setArgs(JNIEnv *env, jclass *clazz, jstring str)
|
||||||
@ -55,7 +56,6 @@ void SetLauncherArgs()
|
|||||||
|
|
||||||
static char binPath[2048];
|
static char binPath[2048];
|
||||||
snprintf(binPath, sizeof binPath, "%s/hl2_linux", getenv("APP_DATA_PATH") );
|
snprintf(binPath, sizeof binPath, "%s/hl2_linux", getenv("APP_DATA_PATH") );
|
||||||
Msg(binPath);
|
|
||||||
D(binPath);
|
D(binPath);
|
||||||
|
|
||||||
D("-nouserclip");
|
D("-nouserclip");
|
||||||
@ -77,12 +77,50 @@ void SetLauncherArgs()
|
|||||||
#undef D
|
#undef D
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GetTotalMemory()
|
||||||
|
{
|
||||||
|
int64_t mem = 0;
|
||||||
|
|
||||||
|
char meminfo[8196] = { 0 };
|
||||||
|
FILE *f = fopen("/proc/meminfo", "r");
|
||||||
|
if( !f )
|
||||||
|
return 0.f;
|
||||||
|
|
||||||
|
size_t size = fread(meminfo, 1, sizeof(meminfo), f);
|
||||||
|
if( !size )
|
||||||
|
return 0.f;
|
||||||
|
|
||||||
|
char *s = strstr(meminfo, "MemTotal:");
|
||||||
|
|
||||||
|
if( !s ) return 0.f;
|
||||||
|
|
||||||
|
sscanf(s+9, "%lld", &mem);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
return mem/1024/1024.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void android_property_print(const char *name)
|
||||||
|
{
|
||||||
|
char value[1024];
|
||||||
|
|
||||||
|
if( __system_property_get( name, value ) != 0 )
|
||||||
|
Msg("prop %s=%s\n", name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DLL_EXPORT int LauncherMainAndroid( int argc, char **argv )
|
DLL_EXPORT int LauncherMainAndroid( int argc, char **argv )
|
||||||
{
|
{
|
||||||
SDL_version ver;
|
SDL_version ver;
|
||||||
SDL_GetVersion( &ver );
|
SDL_GetVersion( &ver );
|
||||||
|
|
||||||
Msg("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
|
Msg("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
|
||||||
|
Msg("GetTotalMemory() = %.2f GiB\n", GetTotalMemory());
|
||||||
|
android_property_print("ro.build.version.sdk");
|
||||||
|
android_property_print("ro.product.system.device");
|
||||||
|
android_property_print("ro.product.system.manufacturer");
|
||||||
|
android_property_print("ro.product.system.model");
|
||||||
|
android_property_print("ro.product.system.name");
|
||||||
|
|
||||||
InitCrashHandler();
|
InitCrashHandler();
|
||||||
SetLauncherArgs();
|
SetLauncherArgs();
|
||||||
|
@ -767,6 +767,8 @@ bool CSourceAppSystemGroup::PreInit()
|
|||||||
{
|
{
|
||||||
if ( !CommandLine()->FindParm( "-nolog" ) )
|
if ( !CommandLine()->FindParm( "-nolog" ) )
|
||||||
DebugLogger()->Init("engine.log");
|
DebugLogger()->Init("engine.log");
|
||||||
|
else
|
||||||
|
DebugLogger()->Disable();
|
||||||
|
|
||||||
CreateInterfaceFn factory = GetFactory();
|
CreateInterfaceFn factory = GetFactory();
|
||||||
ConnectTier1Libraries( &factory, 1 );
|
ConnectTier1Libraries( &factory, 1 );
|
||||||
|
@ -53,6 +53,7 @@ class IDbgLogger
|
|||||||
public:
|
public:
|
||||||
virtual void Init(const char *logfile) = 0;
|
virtual void Init(const char *logfile) = 0;
|
||||||
virtual void Write(const char *data) = 0;
|
virtual void Write(const char *data) = 0;
|
||||||
|
virtual void Disable() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
PLATFORM_INTERFACE IDbgLogger *DebugLogger();
|
PLATFORM_INTERFACE IDbgLogger *DebugLogger();
|
||||||
|
@ -365,6 +365,23 @@ const tchar* GetProcessorVendorId()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the build's architecture
|
||||||
|
const tchar* GetProcessorArchName()
|
||||||
|
{
|
||||||
|
#if defined( __x86_64__) || defined(_M_X64)
|
||||||
|
return "amd64";
|
||||||
|
#elif defined(__i386__) || defined(_X86_) || defined(_M_IX86)
|
||||||
|
return "i386";
|
||||||
|
#elif defined __aarch64__
|
||||||
|
return "aarch64";
|
||||||
|
#elif defined __arm__ || defined _M_ARM
|
||||||
|
return "arm";
|
||||||
|
#else
|
||||||
|
#error "Unknown architecture"
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns non-zero if Hyper-Threading Technology is supported on the processors and zero if not. This does not mean that
|
// Returns non-zero if Hyper-Threading Technology is supported on the processors and zero if not. This does not mean that
|
||||||
// Hyper-Threading Technology is necessarily enabled.
|
// Hyper-Threading Technology is necessarily enabled.
|
||||||
static bool HTSupported(void)
|
static bool HTSupported(void)
|
||||||
|
@ -50,6 +50,10 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
extern const tchar* GetProcessorArchName();
|
||||||
|
|
||||||
|
#define MAX_MSGS 4196
|
||||||
|
|
||||||
class CDbgLogger : public IDbgLogger
|
class CDbgLogger : public IDbgLogger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -58,18 +62,35 @@ public:
|
|||||||
|
|
||||||
void Init(const char *logfile);
|
void Init(const char *logfile);
|
||||||
void Write(const char *data);
|
void Write(const char *data);
|
||||||
|
void Disable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE *file;
|
FILE *file;
|
||||||
float flStartTime;
|
float flStartTime;
|
||||||
bool bShouldLog;
|
bool bShouldLog;
|
||||||
|
|
||||||
|
char *pMsgs[MAX_MSGS];
|
||||||
|
size_t iMsg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
CDbgLogger::CDbgLogger()
|
CDbgLogger::CDbgLogger()
|
||||||
{
|
{
|
||||||
bShouldLog = false;
|
bShouldLog = true;
|
||||||
flStartTime = Plat_FloatTime();
|
flStartTime = Plat_FloatTime();
|
||||||
|
file = NULL;
|
||||||
|
iMsg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDbgLogger::Disable()
|
||||||
|
{
|
||||||
|
bShouldLog = false;
|
||||||
|
|
||||||
|
while( iMsg > 0 )
|
||||||
|
{
|
||||||
|
delete[] pMsgs[iMsg];
|
||||||
|
iMsg--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbgLogger::Init(const char *logfile)
|
void CDbgLogger::Init(const char *logfile)
|
||||||
@ -86,13 +107,33 @@ void CDbgLogger::Init(const char *logfile)
|
|||||||
Plat_ctime( &timeCur, szTime, sizeof(szTime) );
|
Plat_ctime( &timeCur, szTime, sizeof(szTime) );
|
||||||
|
|
||||||
file = fopen(logfile, "w+");
|
file = fopen(logfile, "w+");
|
||||||
fprintf(file, ">>> Engine started at %s\n", szTime);
|
if( file )
|
||||||
fflush(file);
|
{
|
||||||
|
#ifdef GIT_COMMIT_HASH
|
||||||
|
fprintf(file, ">>> Engine(arch:%s commit:" GIT_COMMIT_HASH ") started at %s\n", GetProcessorArchName(), szTime);
|
||||||
|
#else
|
||||||
|
fprintf(file, ">>> Engine(arch:%s) started at %s\n", GetProcessorArchName(), szTime);
|
||||||
|
#endif
|
||||||
|
fflush(file);
|
||||||
|
|
||||||
|
for( int i = 0; i < iMsg; i++ )
|
||||||
|
{
|
||||||
|
Write(pMsgs[i]);
|
||||||
|
delete[] pMsgs[i];
|
||||||
|
}
|
||||||
|
iMsg = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbgLogger::~CDbgLogger()
|
CDbgLogger::~CDbgLogger()
|
||||||
{
|
{
|
||||||
if( !bShouldLog )
|
while( iMsg > 0 )
|
||||||
|
{
|
||||||
|
delete[] pMsgs[iMsg];
|
||||||
|
iMsg--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !file )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
time_t timeCur;
|
time_t timeCur;
|
||||||
@ -113,9 +154,21 @@ void CDbgLogger::Write(const char *data)
|
|||||||
if( !bShouldLog )
|
if( !bShouldLog )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(file, "[%.4f] ", Plat_FloatTime() - flStartTime);
|
size_t len = strlen(data);
|
||||||
fprintf(file, "%s", data);
|
|
||||||
fflush(file);
|
if( file )
|
||||||
|
{
|
||||||
|
fprintf(file, "[%.4f] ", Plat_FloatTime() - flStartTime);
|
||||||
|
fprintf(file, "%s", data);
|
||||||
|
fflush(file);
|
||||||
|
}
|
||||||
|
else if( iMsg < MAX_MSGS )
|
||||||
|
{
|
||||||
|
pMsgs[iMsg] = new char[len+8];
|
||||||
|
memcpy(pMsgs[iMsg], data, len);
|
||||||
|
pMsgs[iMsg][len] = 0;
|
||||||
|
iMsg++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CDbgLogger g_DbgLogger;
|
static CDbgLogger g_DbgLogger;
|
||||||
|
@ -212,7 +212,16 @@ static void GetOpenGLVersion(int *major, int *minor, int *patch)
|
|||||||
const char *version = (const char *) glGetString(GL_VERSION);
|
const char *version = (const char *) glGetString(GL_VERSION);
|
||||||
if (version)
|
if (version)
|
||||||
{
|
{
|
||||||
sscanf( version, "%d.%d.%d", major, minor, patch );
|
const char *s = version;
|
||||||
|
while( *s )
|
||||||
|
{
|
||||||
|
if( *s >= '0' && *s <= '9' )
|
||||||
|
{
|
||||||
|
sscanf( s, "%d.%d", major, minor );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,8 +249,8 @@ static int GetOpenGLVersionPatch()
|
|||||||
|
|
||||||
static bool CheckBaseOpenGLVersion()
|
static bool CheckBaseOpenGLVersion()
|
||||||
{
|
{
|
||||||
const int NEED_MAJOR = 2;
|
const int NEED_MAJOR = 3;
|
||||||
const int NEED_MINOR = 0;
|
const int NEED_MINOR = 2;
|
||||||
const int NEED_PATCH = 0;
|
const int NEED_PATCH = 0;
|
||||||
|
|
||||||
int major, minor, patch;
|
int major, minor, patch;
|
||||||
@ -251,7 +260,7 @@ static bool CheckBaseOpenGLVersion()
|
|||||||
const int have = GLVERNUM(major, minor, patch);
|
const int have = GLVERNUM(major, minor, patch);
|
||||||
if (have < need)
|
if (have < need)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "PROBLEM: You appear to have OpenGL %d.%d.%d, but we need at least %d.%d.%d!\n",
|
Warning("PROBLEM: You appear to have OpenGL %d.%d.%d, but we need at least %d.%d.%d!\n",
|
||||||
major, minor, patch, NEED_MAJOR, NEED_MINOR, NEED_PATCH);
|
major, minor, patch, NEED_MAJOR, NEED_MINOR, NEED_PATCH);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -381,9 +390,11 @@ COpenGLEntryPoints::COpenGLEntryPoints()
|
|||||||
pszString = ( const char * )glGetString(GL_EXTENSIONS);
|
pszString = ( const char * )glGetString(GL_EXTENSIONS);
|
||||||
m_pGLDriverStrings[cGLExtensionsString] = strdup( pszString ? pszString : "" );
|
m_pGLDriverStrings[cGLExtensionsString] = strdup( pszString ? pszString : "" );
|
||||||
|
|
||||||
printf( "OpenGL: %s %s (%d.%d.%d)\n", m_pGLDriverStrings[ cGLRendererString ], m_pGLDriverStrings[ cGLVersionString ],
|
Msg( "GL_RENDERER=\"%s\" GL_VERSION=\"%s\" GL_VENDOR=\"%s\" (%d.%d.%d)\n", m_pGLDriverStrings[ cGLRendererString ], m_pGLDriverStrings[ cGLVersionString ], m_pGLDriverStrings[ cGLVendorString ],
|
||||||
m_nOpenGLVersionMajor, m_nOpenGLVersionMinor, m_nOpenGLVersionPatch );
|
m_nOpenGLVersionMajor, m_nOpenGLVersionMinor, m_nOpenGLVersionPatch );
|
||||||
|
|
||||||
|
Msg("GL_EXTENSIONS=\"%s\"\n", m_pGLDriverStrings[cGLExtensionsString]);
|
||||||
|
|
||||||
// !!! FIXME: Alfred says the original GL_APPLE_fence code only exists to
|
// !!! FIXME: Alfred says the original GL_APPLE_fence code only exists to
|
||||||
// !!! FIXME: hint Apple's drivers and not because we rely on the
|
// !!! FIXME: hint Apple's drivers and not because we rely on the
|
||||||
// !!! FIXME: functionality. If so, just remove this check (and the
|
// !!! FIXME: functionality. If so, just remove this check (and the
|
||||||
|
2
wscript
2
wscript
@ -282,7 +282,9 @@ def configure(conf):
|
|||||||
conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install waf_unit_test enforce_pic')
|
conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install waf_unit_test enforce_pic')
|
||||||
if conf.env.DEST_OS == 'win32' and conf.env.DEST_CPU == 'amd64':
|
if conf.env.DEST_OS == 'win32' and conf.env.DEST_CPU == 'amd64':
|
||||||
conf.load('masm')
|
conf.load('masm')
|
||||||
|
|
||||||
define_platform(conf)
|
define_platform(conf)
|
||||||
|
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
|
||||||
|
|
||||||
if conf.env.TOGLES:
|
if conf.env.TOGLES:
|
||||||
projects['game'] += ['togles']
|
projects['game'] += ['togles']
|
||||||
|
Loading…
Reference in New Issue
Block a user