mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07:00
Copy at3plusdecoder.so to internal memory to solve android permission issues on devices with no-exec mounted SD cards.
This commit is contained in:
@@ -113,6 +113,7 @@ public:
|
||||
std::string currentDirectory;
|
||||
std::string memCardDirectory;
|
||||
std::string flashDirectory;
|
||||
std::string internalDataDirectory;
|
||||
|
||||
void Load(const char *iniFileName = "ppsspp.ini");
|
||||
void Save();
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#ifdef ANDROID
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
|
||||
#include <string.h>
|
||||
@@ -11,6 +14,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
extern std::string externalDirectory;
|
||||
|
||||
@@ -46,16 +50,29 @@ namespace Atrac3plus_Decoder {
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
std::string filename = "at3plusdecoder.so";
|
||||
|
||||
#if defined(ANDROID) && defined(ARM)
|
||||
|
||||
std::string sdFilename;
|
||||
std::string internalFilename = g_Config.internalDataDirectory + "libat3plusdecoder.so";
|
||||
#if ARMEABI_V7A
|
||||
filename = g_Config.memCardDirectory + "PSP/libs/armeabi-v7a/lib" + filename;
|
||||
sdFilename = g_Config.memCardDirectory + "PSP/libs/armeabi-v7a/libat3plusdecoder.so";
|
||||
#else
|
||||
filename = g_Config.memCardDirectory + "PSP/libs/armeabi/lib" + filename;
|
||||
sdFilename = g_Config.memCardDirectory + "PSP/libs/armeabi/libat3plusdecoder.so";
|
||||
#endif
|
||||
|
||||
// SD cards are often mounted no-exec.
|
||||
if (!File::Exists(internalFilename)) {
|
||||
if (!File::Copy(sdFilename, internalFilename)) {
|
||||
ELOG("Failed to copy %s to %s", sdFilename.c_str(), internalFilename.c_str());
|
||||
return -1;
|
||||
}
|
||||
if (chmod(internalFilename.c_str(), 0777) < 0) {
|
||||
ELOG("Failed to chmod %s, continuing anyway", internalFilename.c_str());
|
||||
}
|
||||
}
|
||||
std::string filename = internalFilename;
|
||||
#else
|
||||
std::string filename = "libat3plusdecoder.so";
|
||||
#endif
|
||||
|
||||
ILOG("Attempting to load atrac3plus decoder from %s", filename.c_str());
|
||||
|
||||
@@ -295,6 +295,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
}
|
||||
|
||||
#if defined(ANDROID)
|
||||
g_Config.internalDataDirectory = savegame_directory;
|
||||
// Maybe there should be an option to use internal memory instead, but I think
|
||||
// that for most people, using external memory (SDCard/USB Storage) makes the
|
||||
// most sense.
|
||||
|
||||
Reference in New Issue
Block a user