Android: Attach CPU thread to JVM early
This commit is contained in:
parent
3a0917371e
commit
e86d713600
|
@ -583,6 +583,11 @@ if (APPLE)
|
||||||
${IOB_LIBRARY}
|
${IOB_LIBRARY}
|
||||||
${IOK_LIBRARY}
|
${IOK_LIBRARY}
|
||||||
)
|
)
|
||||||
|
elseif (ANDROID)
|
||||||
|
target_link_libraries(core
|
||||||
|
PRIVATE
|
||||||
|
androidcommon
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LIBUSB_FOUND)
|
if(LIBUSB_FOUND)
|
||||||
|
|
|
@ -85,6 +85,10 @@
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include "jni/AndroidCommon/IDCache.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
static bool s_wants_determinism;
|
static bool s_wants_determinism;
|
||||||
|
@ -335,6 +339,12 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
||||||
// This needs to be delayed until after the video backend is ready.
|
// This needs to be delayed until after the video backend is ready.
|
||||||
DolphinAnalytics::Instance().ReportGameStart();
|
DolphinAnalytics::Instance().ReportGameStart();
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
// For some reason, calling the JNI function AttachCurrentThread from the CPU thread after a
|
||||||
|
// certain point causes a crash if fastmem is enabled. Let's call it early to avoid that problem.
|
||||||
|
static_cast<void>(IDCache::GetEnvForThread());
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_CoreParameter.bFastmem)
|
if (_CoreParameter.bFastmem)
|
||||||
EMM::InstallExceptionHandler(); // Let's run under memory watch
|
EMM::InstallExceptionHandler(); // Let's run under memory watch
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue