mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
android: jni: Ensure system is only initialized once.
- Fixes likelihood that fastmem allocation succeeds.
This commit is contained in:
parent
ff2f370946
commit
0276197744
|
@ -185,8 +185,7 @@ public final class NativeLibrary {
|
|||
|
||||
public static native boolean ReloadKeys();
|
||||
|
||||
// Create the config.ini file.
|
||||
public static native void CreateConfigFile();
|
||||
public static native void InitializeEmulation();
|
||||
|
||||
public static native int DefaultCPUCore();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class DirectoryInitialization {
|
|||
|
||||
if (directoryState != DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED) {
|
||||
initializeInternalStorage(context);
|
||||
NativeLibrary.CreateConfigFile();
|
||||
NativeLibrary.InitializeEmulation();
|
||||
directoryState = DirectoryInitializationState.YUZU_DIRECTORIES_INITIALIZED;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ namespace {
|
|||
class EmulationSession final {
|
||||
public:
|
||||
EmulationSession() {
|
||||
m_system.Initialize();
|
||||
m_vfs = std::make_shared<FileSys::RealVfsFilesystem>();
|
||||
}
|
||||
|
||||
|
@ -126,7 +125,6 @@ public:
|
|||
|
||||
// Initialize system.
|
||||
m_system.SetShuttingDown(false);
|
||||
m_system.Initialize();
|
||||
m_system.ApplySettings();
|
||||
m_system.HIDCore().ReloadInputDevices();
|
||||
m_system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
|
||||
|
@ -498,9 +496,12 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_GetGitRevision([[maybe_unused]] JN
|
|||
return {};
|
||||
}
|
||||
|
||||
void Java_org_yuzu_yuzu_1emu_NativeLibrary_CreateConfigFile
|
||||
void Java_org_yuzu_yuzu_1emu_NativeLibrary_InitializeEmulation
|
||||
[[maybe_unused]] (JNIEnv* env, [[maybe_unused]] jclass clazz) {
|
||||
// Create the default config.ini.
|
||||
Config{};
|
||||
// Initialize the emulated system.
|
||||
EmulationSession::GetInstance().System().Initialize();
|
||||
}
|
||||
|
||||
jint Java_org_yuzu_yuzu_1emu_NativeLibrary_DefaultCPUCore([[maybe_unused]] JNIEnv* env,
|
||||
|
|
|
@ -86,8 +86,8 @@ JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_SetSysDirectory(JNI
|
|||
jclass clazz,
|
||||
jstring path);
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_CreateConfigFile(JNIEnv* env,
|
||||
jclass clazz);
|
||||
JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_InitializeEmulation(JNIEnv* env,
|
||||
jclass clazz);
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_DefaultCPUCore(JNIEnv* env,
|
||||
jclass clazz);
|
||||
|
|
Loading…
Reference in a new issue