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.
|
// Boot system.
|
||||||
bool boot_result = false;
|
bool boot_result = false;
|
||||||
if (resume_state)
|
if (resume_state && boot_params.filename.empty())
|
||||||
{
|
boot_result = ResumeSystemFromMostRecentState();
|
||||||
if (boot_params.filename.empty())
|
else if (resume_state && CanResumeSystemFromFile(boot_params.filename.c_str()))
|
||||||
boot_result = ResumeSystemFromMostRecentState();
|
boot_result = ResumeSystemFromState(boot_params.filename.c_str(), true);
|
||||||
else
|
|
||||||
boot_result = ResumeSystemFromState(boot_params.filename.c_str(), true);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
boot_result = BootSystem(boot_params);
|
boot_result = BootSystem(boot_params);
|
||||||
}
|
|
||||||
|
|
||||||
if (boot_result)
|
if (boot_result)
|
||||||
{
|
{
|
||||||
|
@ -784,8 +779,8 @@ void AndroidHostInterface::SetControllerVibration(u32 controller_index, float sm
|
||||||
DebugAssert(env);
|
DebugAssert(env);
|
||||||
|
|
||||||
env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_setInputDeviceVibration,
|
env->CallVoidMethod(m_emulation_activity_object, s_EmulationActivity_method_setInputDeviceVibration,
|
||||||
static_cast<jint>(controller_index), static_cast<jfloat>(small_motor),
|
static_cast<jint>(controller_index), static_cast<jfloat>(small_motor),
|
||||||
static_cast<jfloat>(large_motor));
|
static_cast<jfloat>(large_motor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidHostInterface::SetFastForwardEnabled(bool enabled)
|
void AndroidHostInterface::SetFastForwardEnabled(bool enabled)
|
||||||
|
@ -1193,10 +1188,11 @@ DEFINE_JNI_ARGS_METHOD(jobjectArray, AndroidHostInterface_getControllerAxisNames
|
||||||
return name_array;
|
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 =
|
std::optional<ControllerType> type =
|
||||||
Settings::ParseControllerTypeName(AndroidHelpers::JStringToString(env, controller_type).c_str());
|
Settings::ParseControllerTypeName(AndroidHelpers::JStringToString(env, controller_type).c_str());
|
||||||
if (!type)
|
if (!type)
|
||||||
return 0;
|
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 we're not running, boot the system, otherwise swap discs
|
||||||
if (!m_emulation_running)
|
if (!m_emulation_running)
|
||||||
{
|
{
|
||||||
if (m_host_interface->GetBoolSettingValue("Main", "SaveStateOnExit", true) &&
|
if (m_host_interface->CanResumeSystemFromFile(path.c_str()))
|
||||||
!m_host_interface->IsCheevosChallengeModeActive())
|
m_host_interface->resumeSystemFromState(QString::fromStdString(path), true);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
|
m_host_interface->bootSystem(std::make_shared<const SystemBootParameters>(path));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -706,6 +706,20 @@ bool CommonHostInterface::SaveState(bool global, s32 slot)
|
||||||
return true;
|
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)
|
bool CommonHostInterface::ResumeSystemFromState(const char* filename, bool boot_on_failure)
|
||||||
{
|
{
|
||||||
SystemBootParameters boot_params;
|
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.
|
/// Saves the current emulation state to a file. Specifying a slot of -1 saves the "resume" save state.
|
||||||
bool SaveState(bool global, s32 slot);
|
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.
|
/// 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);
|
bool ResumeSystemFromState(const char* filename, bool boot_on_failure);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue