mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-22 17:46:08 -04:00
fix(android): prevent RomFS/ExeFS dump while emulation is running
Add safety checks to prevent dumping game files while emulation is active, which could cause crashes or data corruption. - Check EmulationSession.IsRunning() before starting dump in native.cpp - Check NativeLibrary.isRunning() in GamePropertiesFragment.kt - Show user-friendly toast message when dump is blocked
This commit is contained in:
@@ -496,6 +496,16 @@ class GamePropertiesFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun performRomFSDump(dumpPathUri: String?) {
|
||||
// Check if emulation is running - cannot dump while game is active
|
||||
if (NativeLibrary.isRunning()) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
R.string.dump_failed_emulation_running,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
return
|
||||
}
|
||||
|
||||
ProgressDialogFragment.newInstance(
|
||||
requireActivity(),
|
||||
R.string.dump_romfs_extracting,
|
||||
@@ -539,6 +549,16 @@ class GamePropertiesFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun performExeFSDump(dumpPathUri: String?) {
|
||||
// Check if emulation is running - cannot dump while game is active
|
||||
if (NativeLibrary.isRunning()) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
R.string.dump_failed_emulation_running,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
return
|
||||
}
|
||||
|
||||
ProgressDialogFragment.newInstance(
|
||||
requireActivity(),
|
||||
R.string.dump_exefs_extracting,
|
||||
|
||||
@@ -884,6 +884,12 @@ jboolean Java_org_citron_citron_1emu_NativeLibrary_areKeysPresent(JNIEnv* env, j
|
||||
jboolean Java_org_citron_citron_1emu_NativeLibrary_dumpRomFS(JNIEnv* env, jobject jobj,
|
||||
jstring jgamePath, jstring jprogramId,
|
||||
jstring jdumpPath, jobject jcallback) {
|
||||
// Check if emulation is running - dumping while emulation is active can cause crashes
|
||||
if (EmulationSession::GetInstance().IsRunning()) {
|
||||
LOG_ERROR(Frontend, "Cannot dump RomFS while emulation is running. Please close the game first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto game_path = Common::Android::GetJString(env, jgamePath);
|
||||
const auto program_id = EmulationSession::GetProgramId(env, jprogramId);
|
||||
|
||||
@@ -1040,6 +1046,12 @@ jboolean Java_org_citron_citron_1emu_NativeLibrary_dumpRomFS(JNIEnv* env, jobjec
|
||||
jboolean Java_org_citron_citron_1emu_NativeLibrary_dumpExeFS(JNIEnv* env, jobject jobj,
|
||||
jstring jgamePath, jstring jprogramId,
|
||||
jstring jdumpPath, jobject jcallback) {
|
||||
// Check if emulation is running - dumping while emulation is active can cause crashes
|
||||
if (EmulationSession::GetInstance().IsRunning()) {
|
||||
LOG_ERROR(Frontend, "Cannot dump ExeFS while emulation is running. Please close the game first.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto game_path = Common::Android::GetJString(env, jgamePath);
|
||||
const auto program_id = EmulationSession::GetProgramId(env, jprogramId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user