mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +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())
|
||||
boot_result = ResumeSystemFromMostRecentState();
|
||||
else
|
||||
boot_result = ResumeSystemFromState(boot_params.filename.c_str(), true);
|
||||
}
|
||||
if (resume_state && boot_params.filename.empty())
|
||||
boot_result = ResumeSystemFromMostRecentState();
|
||||
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)
|
||||
{
|
||||
|
@ -784,8 +779,8 @@ void AndroidHostInterface::SetControllerVibration(u32 controller_index, float sm
|
|||
DebugAssert(env);
|
||||
|
||||
env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_setInputDeviceVibration,
|
||||
static_cast<jint>(controller_index), static_cast<jfloat>(small_motor),
|
||||
static_cast<jfloat>(large_motor));
|
||||
static_cast<jint>(controller_index), static_cast<jfloat>(small_motor),
|
||||
static_cast<jfloat>(large_motor));
|
||||
}
|
||||
|
||||
void AndroidHostInterface::SetFastForwardEnabled(bool enabled)
|
||||
|
@ -1193,10 +1188,11 @@ 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());
|
||||
Settings::ParseControllerTypeName(AndroidHelpers::JStringToString(env, controller_type).c_str());
|
||||
if (!type)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -939,20 +939,10 @@ 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())
|
||||
{
|
||||
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_host_interface->CanResumeSystemFromFile(path.c_str()))
|
||||
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
||||
else
|
||||
{
|
||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -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