yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

android: jni: Ensure system is only initialized once.

- Fixes likelihood that fastmem allocation succeeds.
This commit is contained in:
bunnei 2023-02-20 03:19:51 -08:00
parent ff2f370946
commit 0276197744
4 changed files with 8 additions and 8 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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,

View File

@ -86,7 +86,7 @@ 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,
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,