mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
VMManager: Fix read from moved-from string boot_params.filename
This commit is contained in:
parent
3a33400ca6
commit
0cd14c9919
@ -1448,7 +1448,7 @@ void FullscreenUI::DoStartPath(const std::string& path, std::optional<s32> state
|
||||
if (VMManager::HasValidVM())
|
||||
return;
|
||||
|
||||
if (VMManager::Initialize(std::move(params)))
|
||||
if (VMManager::Initialize(params))
|
||||
VMManager::SetState(VMState::Running);
|
||||
});
|
||||
}
|
||||
@ -1472,7 +1472,7 @@ void FullscreenUI::DoStartBIOS()
|
||||
return;
|
||||
|
||||
VMBootParameters params;
|
||||
if (VMManager::Initialize(std::move(params)))
|
||||
if (VMManager::Initialize(params))
|
||||
VMManager::SetState(VMState::Running);
|
||||
else
|
||||
SwitchToLanding();
|
||||
@ -7628,7 +7628,7 @@ void FullscreenUI::DoLoadState(std::string path)
|
||||
VMBootParameters params;
|
||||
params.filename = std::move(boot_path);
|
||||
params.save_state = std::move(path);
|
||||
if (VMManager::Initialize(std::move(params)))
|
||||
if (VMManager::Initialize(params))
|
||||
VMManager::SetState(VMState::Running);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1267,7 +1267,7 @@ void VMManager::PrecacheCDVDFile()
|
||||
}
|
||||
}
|
||||
|
||||
bool VMManager::Initialize(VMBootParameters boot_params)
|
||||
bool VMManager::Initialize(const VMBootParameters& boot_params)
|
||||
{
|
||||
const Common::Timer init_timer;
|
||||
pxAssertRel(s_state.load(std::memory_order_acquire) == VMState::Shutdown, "VM is shutdown");
|
||||
@ -1303,9 +1303,9 @@ bool VMManager::Initialize(VMBootParameters boot_params)
|
||||
|
||||
std::string state_to_load;
|
||||
|
||||
s_elf_override = std::move(boot_params.elf_override);
|
||||
s_elf_override = boot_params.elf_override;
|
||||
if (!boot_params.save_state.empty())
|
||||
state_to_load = std::move(boot_params.save_state);
|
||||
state_to_load = boot_params.save_state;
|
||||
|
||||
// if we're loading an indexed save state, we need to get the serial/crc from the disc.
|
||||
if (boot_params.state_index.has_value())
|
||||
@ -1345,7 +1345,7 @@ bool VMManager::Initialize(VMBootParameters boot_params)
|
||||
}
|
||||
|
||||
// Use specified source type.
|
||||
CDVDsys_SetFile(boot_params.source_type.value(), std::move(boot_params.filename));
|
||||
CDVDsys_SetFile(boot_params.source_type.value(), boot_params.filename);
|
||||
CDVDsys_ChangeSource(boot_params.source_type.value());
|
||||
}
|
||||
else
|
||||
@ -1431,17 +1431,17 @@ bool VMManager::Initialize(VMBootParameters boot_params)
|
||||
Achievements::ResetHardcoreMode(true);
|
||||
if (Achievements::IsHardcoreModeActive())
|
||||
{
|
||||
auto confirm_hc_mode_disable = [&boot_params, &state_to_load](const char* trigger) mutable {
|
||||
auto confirm_hc_mode_disable = [&boot_params](const char* trigger) mutable {
|
||||
if (FullscreenUI::IsInitialized())
|
||||
{
|
||||
boot_params.elf_override = std::move(s_elf_override);
|
||||
boot_params.save_state = std::move(state_to_load);
|
||||
boot_params.disable_achievements_hardcore_mode = true;
|
||||
s_elf_override = {};
|
||||
|
||||
VMBootParameters new_boot_params = boot_params;
|
||||
new_boot_params.disable_achievements_hardcore_mode = true;
|
||||
|
||||
Achievements::ConfirmHardcoreModeDisableAsync(trigger,
|
||||
[boot_params = std::move(boot_params)](bool approved) mutable {
|
||||
if (approved && Initialize(std::move(boot_params)))
|
||||
[new_boot_params = std::move(new_boot_params)](bool approved) mutable {
|
||||
if (approved && Initialize(new_boot_params))
|
||||
SetState(VMState::Running);
|
||||
});
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ namespace VMManager
|
||||
const std::string& GetCurrentELF();
|
||||
|
||||
/// Initializes all system components.
|
||||
bool Initialize(VMBootParameters boot_params);
|
||||
bool Initialize(const VMBootParameters& boot_params);
|
||||
|
||||
/// Destroys all system components.
|
||||
void Shutdown(bool save_resume_state);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user