mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 06:54:15 +01:00
Pass native library dir to OS + reorder OS init order so paths are first
This is required for integrating libadrenotools, which needs access to library and app directories in the GPU class constructor.
This commit is contained in:
parent
900d00a876
commit
dd91d063a5
@ -74,6 +74,7 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication(
|
||||
jint preferenceFd,
|
||||
jint systemLanguage,
|
||||
jstring appFilesPathJstring,
|
||||
jstring nativeLibraryPathJstring,
|
||||
jobject assetManager
|
||||
) {
|
||||
skyline::signal::ScopedStackBlocker stackBlocker; // We do not want anything to unwind past JNI code as there are invalid stack frames which can lead to a segmentation fault
|
||||
@ -98,10 +99,13 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication(
|
||||
perfetto::TrackEvent::Register();
|
||||
|
||||
try {
|
||||
skyline::JniString nativeLibraryPath(env, nativeLibraryPathJstring);
|
||||
|
||||
auto os{std::make_shared<skyline::kernel::OS>(
|
||||
jvmManager,
|
||||
settings,
|
||||
appFilesPath,
|
||||
nativeLibraryPath,
|
||||
GetTimeZoneName(),
|
||||
static_cast<skyline::language::SystemLanguage>(systemLanguage),
|
||||
std::make_shared<skyline::vfs::AndroidAssetFileSystem>(AAssetManager_fromJava(env, assetManager))
|
||||
|
@ -17,11 +17,13 @@ namespace skyline::kernel {
|
||||
std::shared_ptr<JvmManager> &jvmManager,
|
||||
std::shared_ptr<Settings> &settings,
|
||||
std::string appFilesPath,
|
||||
std::string nativeLibraryPath,
|
||||
std::string deviceTimeZone,
|
||||
language::SystemLanguage systemLanguage,
|
||||
std::shared_ptr<vfs::FileSystem> assetFileSystem)
|
||||
: state(this, jvmManager, settings),
|
||||
: nativeLibraryPath(std::move(nativeLibraryPath)),
|
||||
appFilesPath(std::move(appFilesPath)),
|
||||
state(this, jvmManager, settings),
|
||||
deviceTimeZone(std::move(deviceTimeZone)),
|
||||
assetFileSystem(std::move(assetFileSystem)),
|
||||
serviceManager(state),
|
||||
|
@ -14,8 +14,9 @@ namespace skyline::kernel {
|
||||
*/
|
||||
class OS {
|
||||
public:
|
||||
DeviceState state;
|
||||
std::string nativeLibraryPath; //!< The full path to the app's native library directory
|
||||
std::string appFilesPath; //!< The full path to the app's files directory
|
||||
DeviceState state;
|
||||
std::string deviceTimeZone; //!< The timezone name (e.g. Europe/London)
|
||||
std::shared_ptr<vfs::FileSystem> assetFileSystem; //!< A filesystem to be used for accessing emulator assets (like tzdata)
|
||||
service::ServiceManager serviceManager;
|
||||
@ -30,6 +31,7 @@ namespace skyline::kernel {
|
||||
std::shared_ptr<Settings> &settings,
|
||||
std::string appFilesPath,
|
||||
std::string deviceTimeZone,
|
||||
std::string nativeLibraryPath,
|
||||
language::SystemLanguage systemLanguage,
|
||||
std::shared_ptr<vfs::FileSystem> assetFileSystem
|
||||
);
|
||||
|
@ -70,9 +70,10 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
* @param romFd The file descriptor of the ROM object
|
||||
* @param preferenceFd The file descriptor of the Preference XML
|
||||
* @param appFilesPath The full path to the app files directory
|
||||
* @param nativeLibraryPath The full path to the app native library directory
|
||||
* @param assetManager The asset manager used for accessing app assets
|
||||
*/
|
||||
private external fun executeApplication(romUri : String, romType : Int, romFd : Int, preferenceFd : Int, language : Int, appFilesPath : String, assetManager : AssetManager)
|
||||
private external fun executeApplication(romUri : String, romType : Int, romFd : Int, preferenceFd : Int, language : Int, appFilesPath : String, nativeLibraryPath : String, assetManager : AssetManager)
|
||||
|
||||
/**
|
||||
* @param join If the function should only return after all the threads join or immediately
|
||||
@ -211,7 +212,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
|
||||
val preferenceFd = ParcelFileDescriptor.open(File("${applicationInfo.dataDir}/shared_prefs/${applicationInfo.packageName}_preferences.xml"), ParcelFileDescriptor.MODE_READ_WRITE)
|
||||
|
||||
emulationThread = Thread {
|
||||
executeApplication(rom.toString(), romType, romFd.detachFd(), preferenceFd.detachFd(), settings.systemLanguage, applicationContext.filesDir.canonicalPath + "/", assets)
|
||||
executeApplication(rom.toString(), romType, romFd.detachFd(), preferenceFd.detachFd(), settings.systemLanguage, applicationContext.filesDir.canonicalPath + "/", applicationInfo.nativeLibraryDir + "/", assets)
|
||||
returnFromEmulation()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user