From 572ae3f340247025777677546ba9acd43a39b7f9 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 12 Aug 2023 20:19:47 +0100 Subject: [PATCH] Look in current dir for game library --- .../jni/OpenJK/shared/sys/sys_main.cpp | 3 +++ .../jni/OpenJK/shared/sys/sys_public.h | 1 + .../jni/OpenJK/shared/sys/sys_win32.cpp | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/Projects/Android/jni/OpenJK/shared/sys/sys_main.cpp b/Projects/Android/jni/OpenJK/shared/sys/sys_main.cpp index b5ea6d3..a1b32dc 100644 --- a/Projects/Android/jni/OpenJK/shared/sys/sys_main.cpp +++ b/Projects/Android/jni/OpenJK/shared/sys/sys_main.cpp @@ -646,7 +646,10 @@ void *Sys_LoadGameDll( const char *name, GetModuleAPIProc **moduleAPI ) char *apppath = Cvar_VariableString( "fs_apppath" ); #endif + const char* current_dir = Sys_CurrentDirname(); + const char *searchPaths[] = { + current_dir, homepath, #ifdef MACOS_X apppath, diff --git a/Projects/Android/jni/OpenJK/shared/sys/sys_public.h b/Projects/Android/jni/OpenJK/shared/sys/sys_public.h index bad8218..9d7a8bd 100644 --- a/Projects/Android/jni/OpenJK/shared/sys/sys_public.h +++ b/Projects/Android/jni/OpenJK/shared/sys/sys_public.h @@ -143,6 +143,7 @@ char *Sys_DefaultAppPath(void); char *Sys_DefaultHomePath(void); const char *Sys_Dirname( char *path ); const char *Sys_Basename( char *path ); +const char * Sys_CurrentDirname(); bool Sys_PathCmp( const char *path1, const char *path2 ); diff --git a/Projects/Android/jni/OpenJK/shared/sys/sys_win32.cpp b/Projects/Android/jni/OpenJK/shared/sys/sys_win32.cpp index 5b6c234..92d3943 100644 --- a/Projects/Android/jni/OpenJK/shared/sys/sys_win32.cpp +++ b/Projects/Android/jni/OpenJK/shared/sys/sys_win32.cpp @@ -25,6 +25,7 @@ along with this program; if not, see . #include #include #include +#include #define MEM_THRESHOLD (128*1024*1024) @@ -84,6 +85,28 @@ const char *Sys_Dirname( char *path ) return dir; } +/* +============== +Sys_Dirname +============== +*/ +const char *Sys_CurrentDirname( ) +{ + static char dir[ MAX_OSPATH ] = { 0 }; + + GetCurrentDirectory( + MAX_OSPATH, + dir + ); + + while( length > 0 && dir[ length ] != '\\' ) + length--; + + dir[ length ] = '\0'; + + return dir; +} + /* ================ Sys_Milliseconds