Android: Add manual disc change from file

This commit is contained in:
Connor McLaughlin
2021-01-24 16:54:19 +10:00
parent 59810bf8db
commit b107cdee53
5 changed files with 66 additions and 28 deletions

View File

@ -1503,4 +1503,22 @@ DEFINE_JNI_ARGS_METHOD(jboolean, AndroidHostInterface_setMediaPlaylistIndex, job
});
return true;
}
}
DEFINE_JNI_ARGS_METHOD(jboolean, AndroidHostInterface_setMediaFilename, jstring obj, jstring filename)
{
if (!System::IsValid() || !filename)
return false;
std::string filename_str(AndroidHelpers::JStringToString(env, filename));
AndroidHostInterface* hi = AndroidHelpers::GetNativeClass(env, obj);
hi->RunOnEmulationThread([filename_str, hi]() {
if (System::IsValid())
{
if (!System::InsertMedia(filename_str.c_str()))
hi->AddOSDMessage("Disc switch failed. Please make sure the file exists and is a supported disc image.");
}
});
return true;
}