android: native.cpp: rename is_running to stop_run and invert uses

This commit is contained in:
SachinVin 2021-04-09 00:19:13 +05:30 committed by bunnei
parent f8dbaa2044
commit 8b7055f33e

View File

@ -47,7 +47,7 @@ ANativeWindow* s_surf;
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::mutex paused_mutex;
@ -214,7 +214,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
auto& telemetry_session = Core::System::GetInstance().TelemetrySession();
telemetry_session.AddField(Telemetry::FieldType::App, "Frontend", "SDL");
is_running = true;
stop_run = false;
pause_emulation = false;
LoadDiskCacheProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
@ -224,7 +224,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
cpu_context->MakeCurrent();
}
system.Renderer().Rasterizer()->LoadDiskResources(!is_running, &LoadDiskCacheProgress);
system.Renderer().Rasterizer()->LoadDiskResources(stop_run, &LoadDiskCacheProgress);
if (Settings::values.use_asynchronous_gpu_emulation) {
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);
// Start running emulation
while (is_running) {
while (!stop_run) {
if (!pause_emulation) {
const auto result = system.RunLoop();
if (result == Core::System::ResultStatus::Success) {
@ -273,7 +273,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
Settings::values.volume = 0;
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();
}
}
@ -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) {
if (!is_running || pause_emulation) {
if (stop_run || pause_emulation) {
return;
}
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,
[[maybe_unused]] jclass clazz) {
is_running = false;
stop_run = true;
pause_emulation = false;
window->StopPresenting();
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,
[[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,
@ -619,8 +619,8 @@ void Java_org_citra_citra_1emu_NativeLibrary_Run__Ljava_lang_String_2(JNIEnv* en
jstring j_path) {
const std::string path = GetJString(env, j_path);
if (is_running) {
is_running = false;
if (!stop_run) {
stop_run = true;
running_cv.notify_all();
}