mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Qt: Fix double-clicking psexes/psfs in game list
This commit is contained in:
parent
299ba60b8d
commit
a0086851ce
|
@ -412,17 +412,12 @@ void AndroidHostInterface::EmulationThreadEntryPoint(JNIEnv* env, jobject emulat
|
|||
|
||||
// Boot system.
|
||||
bool boot_result = false;
|
||||
if (resume_state)
|
||||
{
|
||||
if (boot_params.filename.empty())
|
||||
if (resume_state && boot_params.filename.empty())
|
||||
boot_result = ResumeSystemFromMostRecentState();
|
||||
else
|
||||
else if (resume_state && CanResumeSystemFromFile(boot_params.filename.c_str()))
|
||||
boot_result = ResumeSystemFromState(boot_params.filename.c_str(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
boot_result = BootSystem(boot_params);
|
||||
}
|
||||
|
||||
if (boot_result)
|
||||
{
|
||||
|
@ -1193,7 +1188,8 @@ DEFINE_JNI_ARGS_METHOD(jobjectArray, AndroidHostInterface_getControllerAxisNames
|
|||
return name_array;
|
||||
}
|
||||
|
||||
DEFINE_JNI_ARGS_METHOD(jint, AndroidHostInterface_getControllerVibrationMotorCount, jobject unused, jstring controller_type)
|
||||
DEFINE_JNI_ARGS_METHOD(jint, AndroidHostInterface_getControllerVibrationMotorCount, jobject unused,
|
||||
jstring controller_type)
|
||||
{
|
||||
std::optional<ControllerType> type =
|
||||
Settings::ParseControllerTypeName(AndroidHelpers::JStringToString(env, controller_type).c_str());
|
||||
|
|
|
@ -939,21 +939,11 @@ void MainWindow::startGameOrChangeDiscs(const std::string& path)
|
|||
// if we're not running, boot the system, otherwise swap discs
|
||||
if (!m_emulation_running)
|
||||
{
|
||||
if (m_host_interface->GetBoolSettingValue("Main", "SaveStateOnExit", true) &&
|
||||
!m_host_interface->IsCheevosChallengeModeActive())
|
||||
{
|
||||
const GameListEntry* entry = m_host_interface->getGameList()->GetEntryForPath(path.c_str());
|
||||
if ((entry && !entry->code.empty()) || !System::GetGameCodeForPath(path.c_str(), true).empty())
|
||||
{
|
||||
if (m_host_interface->CanResumeSystemFromFile(path.c_str()))
|
||||
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_host_interface->changeDisc(QString::fromStdString(path));
|
||||
|
|
|
@ -706,6 +706,20 @@ bool CommonHostInterface::SaveState(bool global, s32 slot)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CommonHostInterface::CanResumeSystemFromFile(const char* filename)
|
||||
{
|
||||
if (GetBoolSettingValue("Main", "SaveStateOnExit", true) && !IsCheevosChallengeModeActive())
|
||||
{
|
||||
const GameListEntry* entry = m_game_list->GetEntryForPath(filename);
|
||||
if (entry)
|
||||
return !entry->code.empty();
|
||||
else
|
||||
return !System::GetGameCodeForPath(filename, true).empty();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CommonHostInterface::ResumeSystemFromState(const char* filename, bool boot_on_failure)
|
||||
{
|
||||
SystemBootParameters boot_params;
|
||||
|
|
|
@ -180,6 +180,9 @@ public:
|
|||
/// Saves the current emulation state to a file. Specifying a slot of -1 saves the "resume" save state.
|
||||
bool SaveState(bool global, s32 slot);
|
||||
|
||||
/// Returns true if the specified file/disc image is resumable.
|
||||
bool CanResumeSystemFromFile(const char* filename);
|
||||
|
||||
/// Loads the resume save state for the given game. Optionally boots the game anyway if loading fails.
|
||||
bool ResumeSystemFromState(const char* filename, bool boot_on_failure);
|
||||
|
||||
|
|
Loading…
Reference in a new issue