mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
VideoBackends:Vulkan: Allow loading custom drivers on Android
... using libadrenotools
This commit is contained in:
@ -163,3 +163,10 @@
|
||||
|
||||
// Subdirs in Config
|
||||
#define GRAPHICSMOD_CONFIG_DIR "GraphicMods"
|
||||
|
||||
// GPU drivers
|
||||
#define GPU_DRIVERS "GpuDrivers"
|
||||
#define GPU_DRIVERS_EXTRACTED "Extracted"
|
||||
#define GPU_DRIVERS_TMP "Tmp"
|
||||
#define GPU_DRIVERS_HOOK "Hook"
|
||||
#define GPU_DRIVERS_FILE_REDIRECT "FileRedirect"
|
||||
|
@ -24,11 +24,22 @@ DynamicLibrary::DynamicLibrary(const char* filename)
|
||||
Open(filename);
|
||||
}
|
||||
|
||||
DynamicLibrary::DynamicLibrary(void* handle)
|
||||
{
|
||||
m_handle = handle;
|
||||
}
|
||||
|
||||
DynamicLibrary::~DynamicLibrary()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
DynamicLibrary& DynamicLibrary::operator=(void* handle)
|
||||
{
|
||||
m_handle = handle;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string DynamicLibrary::GetUnprefixedFilename(const char* filename)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
// Automatically loads the specified library. Call IsOpen() to check validity before use.
|
||||
DynamicLibrary(const char* filename);
|
||||
|
||||
DynamicLibrary(void* handle);
|
||||
|
||||
// Closes the library.
|
||||
~DynamicLibrary();
|
||||
|
||||
@ -30,6 +32,8 @@ public:
|
||||
DynamicLibrary& operator=(const DynamicLibrary&) = delete;
|
||||
DynamicLibrary& operator=(DynamicLibrary&&) = delete;
|
||||
|
||||
DynamicLibrary& operator=(void*);
|
||||
|
||||
// Returns the specified library name with the platform-specific suffix added.
|
||||
static std::string GetUnprefixedFilename(const char* filename);
|
||||
|
||||
|
@ -66,6 +66,8 @@ namespace File
|
||||
{
|
||||
#ifdef ANDROID
|
||||
static std::string s_android_sys_directory;
|
||||
static std::string s_android_driver_directory;
|
||||
static std::string s_android_lib_directory;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
@ -796,6 +798,34 @@ void SetSysDirectory(const std::string& path)
|
||||
s_android_sys_directory);
|
||||
s_android_sys_directory = path;
|
||||
}
|
||||
|
||||
void SetGpuDriverDirectories(const std::string& path, const std::string& lib_path)
|
||||
{
|
||||
INFO_LOG_FMT(COMMON, "Setting Driver directory to {} and library path to {}", path, lib_path);
|
||||
ASSERT_MSG(COMMON, s_android_driver_directory.empty(), "Driver directory already set to {}",
|
||||
s_android_driver_directory);
|
||||
ASSERT_MSG(COMMON, s_android_lib_directory.empty(), "Library directory already set to {}",
|
||||
s_android_lib_directory);
|
||||
s_android_driver_directory = path;
|
||||
s_android_lib_directory = lib_path;
|
||||
}
|
||||
|
||||
const std::string GetGpuDriverDirectory(unsigned int dir_index)
|
||||
{
|
||||
switch (dir_index)
|
||||
{
|
||||
case D_GPU_DRIVERS_EXTRACTED:
|
||||
return s_android_driver_directory + DIR_SEP GPU_DRIVERS_EXTRACTED DIR_SEP;
|
||||
case D_GPU_DRIVERS_TMP:
|
||||
return s_android_driver_directory + DIR_SEP GPU_DRIVERS_TMP DIR_SEP;
|
||||
case D_GPU_DRIVERS_HOOKS:
|
||||
return s_android_lib_directory;
|
||||
case D_GPU_DRIVERS_FILE_REDIRECT:
|
||||
return s_android_driver_directory + DIR_SEP GPU_DRIVERS_FILE_REDIRECT DIR_SEP;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static std::string s_user_paths[NUM_PATH_INDICES];
|
||||
|
@ -67,6 +67,10 @@ enum
|
||||
D_GBAUSER_IDX,
|
||||
D_GBASAVES_IDX,
|
||||
D_WIISDCARDSYNCFOLDER_IDX,
|
||||
D_GPU_DRIVERS_EXTRACTED,
|
||||
D_GPU_DRIVERS_TMP,
|
||||
D_GPU_DRIVERS_HOOKS,
|
||||
D_GPU_DRIVERS_FILE_REDIRECT,
|
||||
FIRST_FILE_USER_PATH_IDX,
|
||||
F_DOLPHINCONFIG_IDX = FIRST_FILE_USER_PATH_IDX,
|
||||
F_GCPADCONFIG_IDX,
|
||||
@ -228,6 +232,8 @@ const std::string& GetSysDirectory();
|
||||
|
||||
#ifdef ANDROID
|
||||
void SetSysDirectory(const std::string& path);
|
||||
void SetGpuDriverDirectories(const std::string& path, const std::string& lib_path);
|
||||
const std::string GetGpuDriverDirectory(unsigned int dir_index);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
Reference in New Issue
Block a user