mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
System.cpp: Add system_state::loading
This commit is contained in:
parent
07df91d4e8
commit
68c58281e5
@ -808,10 +808,13 @@ bool Emulator::BootRsxCapture(const std::string& path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_state = system_state::loading;
|
||||||
|
|
||||||
fs::file in_file(path);
|
fs::file in_file(path);
|
||||||
|
|
||||||
if (!in_file)
|
if (!in_file)
|
||||||
{
|
{
|
||||||
|
m_state = system_state::stopped;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,6 +841,7 @@ bool Emulator::BootRsxCapture(const std::string& path)
|
|||||||
|
|
||||||
if (load.data.empty())
|
if (load.data.empty())
|
||||||
{
|
{
|
||||||
|
m_state = system_state::stopped;
|
||||||
sys_log.error("Failed to unzip rsx capture file!");
|
sys_log.error("Failed to unzip rsx capture file!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -851,18 +855,22 @@ bool Emulator::BootRsxCapture(const std::string& path)
|
|||||||
|
|
||||||
if (frame->magic != rsx::c_fc_magic)
|
if (frame->magic != rsx::c_fc_magic)
|
||||||
{
|
{
|
||||||
|
m_state = system_state::stopped;
|
||||||
sys_log.error("Invalid rsx capture file!");
|
sys_log.error("Invalid rsx capture file!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->version != rsx::c_fc_version)
|
if (frame->version != rsx::c_fc_version)
|
||||||
{
|
{
|
||||||
|
m_state = system_state::stopped;
|
||||||
sys_log.error("Rsx capture file version not supported! Expected %d, found %d", +rsx::c_fc_version, frame->version);
|
sys_log.error("Rsx capture file version not supported! Expected %d, found %d", +rsx::c_fc_version, frame->version);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->LE_format != u32{std::endian::little == std::endian::native})
|
if (frame->LE_format != u32{std::endian::little == std::endian::native})
|
||||||
{
|
{
|
||||||
|
m_state = system_state::stopped;
|
||||||
|
|
||||||
static constexpr std::string_view machines[2]{"Big-Endian", "Little-Endian"};
|
static constexpr std::string_view machines[2]{"Big-Endian", "Little-Endian"};
|
||||||
|
|
||||||
sys_log.error("Rsx capture byte endianness not supported! Expected %s format, found %s format"
|
sys_log.error("Rsx capture byte endianness not supported! Expected %s format, found %s format"
|
||||||
@ -994,6 +1002,24 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
|
|||||||
return game_boot_result::still_running;
|
return game_boot_result::still_running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct cleanup_t
|
||||||
|
{
|
||||||
|
Emulator* _this;
|
||||||
|
bool cleanup = true;
|
||||||
|
|
||||||
|
~cleanup_t() noexcept
|
||||||
|
{
|
||||||
|
_this->m_state.compare_and_swap_test(system_state::loading, system_state::stopped);
|
||||||
|
|
||||||
|
if (cleanup && _this->IsStopped())
|
||||||
|
{
|
||||||
|
_this->Kill(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} cleanup{this};
|
||||||
|
|
||||||
|
ensure(m_state.compare_and_swap_test(system_state::stopped, system_state::loading));
|
||||||
|
|
||||||
const auto guard = MakeEmulationStateGuard();
|
const auto guard = MakeEmulationStateGuard();
|
||||||
|
|
||||||
// Enable logging
|
// Enable logging
|
||||||
@ -1076,20 +1102,6 @@ game_boot_result Emulator::Load(const std::string& title_id, bool is_disc_patch,
|
|||||||
sys_log.notice("Selected config: mode=%s, path=\"%s\"", m_config_mode, m_config_path);
|
sys_log.notice("Selected config: mode=%s, path=\"%s\"", m_config_mode, m_config_path);
|
||||||
sys_log.notice("Path: %s", m_path);
|
sys_log.notice("Path: %s", m_path);
|
||||||
|
|
||||||
struct cleanup_t
|
|
||||||
{
|
|
||||||
Emulator* _this;
|
|
||||||
bool cleanup = true;
|
|
||||||
|
|
||||||
~cleanup_t()
|
|
||||||
{
|
|
||||||
if (cleanup && _this->IsStopped())
|
|
||||||
{
|
|
||||||
_this->Kill(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} cleanup{this};
|
|
||||||
|
|
||||||
std::string inherited_ps3_game_path;
|
std::string inherited_ps3_game_path;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@ namespace cfg
|
|||||||
enum class system_state : u32
|
enum class system_state : u32
|
||||||
{
|
{
|
||||||
stopped,
|
stopped,
|
||||||
|
loading,
|
||||||
stopping,
|
stopping,
|
||||||
running,
|
running,
|
||||||
paused,
|
paused,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user