android: native.cpp: rename is_running
to stop_run
and invert uses
This commit is contained in:
parent
f8dbaa2044
commit
8b7055f33e
@ -47,7 +47,7 @@ ANativeWindow* s_surf;
|
|||||||
|
|
||||||
std::unique_ptr<EmuWindow_Android> window;
|
std::unique_ptr<EmuWindow_Android> window;
|
||||||
|
|
||||||
std::atomic<bool> is_running{false};
|
std::atomic<bool> stop_run{true};
|
||||||
std::atomic<bool> pause_emulation{false};
|
std::atomic<bool> pause_emulation{false};
|
||||||
|
|
||||||
std::mutex paused_mutex;
|
std::mutex paused_mutex;
|
||||||
@ -214,7 +214,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
auto& telemetry_session = Core::System::GetInstance().TelemetrySession();
|
auto& telemetry_session = Core::System::GetInstance().TelemetrySession();
|
||||||
telemetry_session.AddField(Telemetry::FieldType::App, "Frontend", "SDL");
|
telemetry_session.AddField(Telemetry::FieldType::App, "Frontend", "SDL");
|
||||||
|
|
||||||
is_running = true;
|
stop_run = false;
|
||||||
pause_emulation = false;
|
pause_emulation = false;
|
||||||
|
|
||||||
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
|
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
|
||||||
@ -224,7 +224,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
cpu_context->MakeCurrent();
|
cpu_context->MakeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
system.Renderer().Rasterizer()->LoadDiskResources(!is_running, &LoadDiskCacheProgress);
|
system.Renderer().Rasterizer()->LoadDiskResources(stop_run, &LoadDiskCacheProgress);
|
||||||
|
|
||||||
if (Settings::values.use_asynchronous_gpu_emulation) {
|
if (Settings::values.use_asynchronous_gpu_emulation) {
|
||||||
cpu_context->DoneCurrent();
|
cpu_context->DoneCurrent();
|
||||||
@ -250,7 +250,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
system.CoreTiming().ScheduleEvent(audio_stretching_ticks, audio_stretching_event);
|
system.CoreTiming().ScheduleEvent(audio_stretching_ticks, audio_stretching_event);
|
||||||
|
|
||||||
// Start running emulation
|
// Start running emulation
|
||||||
while (is_running) {
|
while (!stop_run) {
|
||||||
if (!pause_emulation) {
|
if (!pause_emulation) {
|
||||||
const auto result = system.RunLoop();
|
const auto result = system.RunLoop();
|
||||||
if (result == Core::System::ResultStatus::Success) {
|
if (result == Core::System::ResultStatus::Success) {
|
||||||
@ -273,7 +273,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
Settings::values.volume = 0;
|
Settings::values.volume = 0;
|
||||||
|
|
||||||
std::unique_lock<std::mutex> pause_lock(paused_mutex);
|
std::unique_lock<std::mutex> pause_lock(paused_mutex);
|
||||||
running_cv.wait(pause_lock, [] { return !pause_emulation || !is_running; });
|
running_cv.wait(pause_lock, [] { return !pause_emulation || stop_run; });
|
||||||
window->PollEvents();
|
window->PollEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_DoFrame(JNIEnv* env, [[maybe_unused]] jclass clazz) {
|
void Java_org_citra_citra_1emu_NativeLibrary_DoFrame(JNIEnv* env, [[maybe_unused]] jclass clazz) {
|
||||||
if (!is_running || pause_emulation) {
|
if (stop_run || pause_emulation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window->TryPresenting();
|
window->TryPresenting();
|
||||||
@ -391,7 +391,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_PauseEmulation(JNIEnv* env,
|
|||||||
|
|
||||||
void Java_org_citra_citra_1emu_NativeLibrary_StopEmulation(JNIEnv* env,
|
void Java_org_citra_citra_1emu_NativeLibrary_StopEmulation(JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
is_running = false;
|
stop_run = true;
|
||||||
pause_emulation = false;
|
pause_emulation = false;
|
||||||
window->StopPresenting();
|
window->StopPresenting();
|
||||||
running_cv.notify_all();
|
running_cv.notify_all();
|
||||||
@ -399,7 +399,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_StopEmulation(JNIEnv* env,
|
|||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_IsRunning(JNIEnv* env,
|
jboolean Java_org_citra_citra_1emu_NativeLibrary_IsRunning(JNIEnv* env,
|
||||||
[[maybe_unused]] jclass clazz) {
|
[[maybe_unused]] jclass clazz) {
|
||||||
return static_cast<jboolean>(is_running);
|
return static_cast<jboolean>(!stop_run);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadEvent(JNIEnv* env,
|
jboolean Java_org_citra_citra_1emu_NativeLibrary_onGamePadEvent(JNIEnv* env,
|
||||||
@ -619,8 +619,8 @@ void Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2(JNIEnv* en
|
|||||||
jstring j_path) {
|
jstring j_path) {
|
||||||
const std::string path = GetJString(env, j_path);
|
const std::string path = GetJString(env, j_path);
|
||||||
|
|
||||||
if (is_running) {
|
if (!stop_run) {
|
||||||
is_running = false;
|
stop_run = true;
|
||||||
running_cv.notify_all();
|
running_cv.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user