mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-06-03 18:30:49 +00:00
Number of small tweaks
including world scale
This commit is contained in:
parent
581b8829af
commit
3826eb86c4
17 changed files with 75 additions and 197 deletions
|
@ -48,162 +48,6 @@ char *Sys_ConsoleInput(void)
|
|||
return CON_Input( );
|
||||
}
|
||||
|
||||
#if defined( DO_LOADDLL_WRAP )
|
||||
void *Sys_LoadDll_Wrapped( const char *name,
|
||||
int( **entryPoint ) ( int, ... ),
|
||||
int ( *systemcalls )( int, ... ) )
|
||||
#else
|
||||
void *Sys_LoadDll( const char *name)
|
||||
#endif
|
||||
{
|
||||
void *libHandle;
|
||||
//void ( *dllEntry )( intptr_t ( *syscallptr )( intptr_t, ... ) );
|
||||
char fname[MAX_OSPATH];
|
||||
char *homepath;
|
||||
char *basepath;
|
||||
char *pwdpath;
|
||||
char *gamedir;
|
||||
char *fn;
|
||||
const char* err = NULL; // bk001206 // rb0101023 - now const
|
||||
|
||||
// bk001206 - let's have some paranoia
|
||||
assert( name );
|
||||
|
||||
snprintf( fname, sizeof( fname ), "../%sarm.so", name );
|
||||
|
||||
// bk001129 - was RTLD_LAZY
|
||||
#define Q_RTLD RTLD_NOW
|
||||
|
||||
homepath = Cvar_VariableString( "fs_homepath" );
|
||||
basepath = Cvar_VariableString( "fs_basepath" );
|
||||
gamedir = Cvar_VariableString( "fs_game" );
|
||||
|
||||
pwdpath = Sys_Cwd();
|
||||
fn = FS_BuildOSPath( pwdpath, gamedir, fname );
|
||||
// bk001206 - verbose
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
|
||||
#ifdef __ANDROID__
|
||||
char path[500];
|
||||
char *libdir = (char*)getenv("RTCW_GAMELIBDIR");
|
||||
|
||||
#ifdef WOLF_SP_DEMO
|
||||
snprintf( path, sizeof( path ), "%s/lib%sarm_d.so", getLibPath(), name );
|
||||
#else
|
||||
snprintf( path, sizeof( path ), "%s/lib%sarm.so", libdir, name );
|
||||
#endif
|
||||
|
||||
//LOGI("Trying to load Android lib: %s",path);
|
||||
libHandle = dlopen (path, RTLD_LAZY );
|
||||
|
||||
|
||||
#else
|
||||
// bk001129 - from cvs1.17 (mkv), was fname not fn
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
#endif
|
||||
|
||||
|
||||
if ( !libHandle ) {
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
// homepath
|
||||
fn = FS_BuildOSPath( homepath, gamedir, fname );
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
|
||||
if ( !libHandle ) {
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
// basepath
|
||||
fn = FS_BuildOSPath( basepath, gamedir, fname );
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
|
||||
if ( !libHandle ) {
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
|
||||
if ( strlen( gamedir ) && Q_stricmp( gamedir, BASEGAME ) ) { // begin BASEGAME != fs_game section
|
||||
|
||||
// media-only mods: no DLL whatsoever in the fs_game
|
||||
// start the loop again using the hardcoded BASEDIRNAME
|
||||
fn = FS_BuildOSPath( pwdpath, BASEGAME, fname );
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
|
||||
if ( !libHandle ) {
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
// homepath
|
||||
fn = FS_BuildOSPath( homepath, BASEGAME, fname );
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
|
||||
if ( !libHandle ) {
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
// homepath
|
||||
fn = FS_BuildOSPath( basepath, BASEGAME, fname );
|
||||
Com_Printf( "Sys_LoadDll(%s)... ", fn );
|
||||
libHandle = dlopen( fn, Q_RTLD );
|
||||
|
||||
if ( !libHandle ) {
|
||||
// ok, this time things are really fucked
|
||||
Com_Printf( "failed (%s)\n", dlerror() );
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
} // end BASEGAME != fs_game section
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
} else {
|
||||
Com_Printf( "ok\n" );
|
||||
}
|
||||
|
||||
if ( !libHandle ) {
|
||||
#ifndef NDEBUG // in debug, abort on failure
|
||||
Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed dlopen() completely!\n", name );
|
||||
#else
|
||||
Com_Printf( "Sys_LoadDll(%s) failed dlopen() completely!\n", name );
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Com_Printf( "Sys_LoadDll handle = %p", libHandle );
|
||||
|
||||
typedef void QDECL DllEntryProc( SystemCallProc *syscallptr );
|
||||
|
||||
DllEntryProc *dllEntry = (DllEntryProc *)dlsym( libHandle, "dllEntry" );
|
||||
void *entryPoint = dlsym( libHandle, "vmMain" );
|
||||
|
||||
|
||||
// dllEntry = dlsym( libHandle, "dllEntry" );
|
||||
// *entryPoint = dlsym( libHandle, "vmMain" );
|
||||
if ( !entryPoint || !dllEntry ) {
|
||||
err = dlerror();
|
||||
#ifndef NDEBUG // bk001206 - in debug abort on failure
|
||||
Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed dlsym(vmMain):\n\"%s\" !\n", name, err );
|
||||
#else
|
||||
Com_Printf( "Sys_LoadDll(%s) failed dlsym(vmMain):\n\"%s\" !\n", name, err );
|
||||
#endif
|
||||
dlclose( libHandle );
|
||||
err = dlerror();
|
||||
if ( err != NULL ) {
|
||||
Com_Printf( "Sys_LoadDll(%s) failed dlcose:\n\"%s\"\n", name, err );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
Com_Printf( "Sys_LoadDll(%s) found **vmMain** at %p \n", name, entryPoint ); // bk001212
|
||||
//dllEntry( systemcalls );
|
||||
Com_Printf( "Sys_LoadDll(%s) succeeded!\n", name );
|
||||
return libHandle;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue