Make KernelState::TerminateTitle try to terminate XThreads safely.

This commit is contained in:
Dr. Chat
2015-12-06 21:02:12 -06:00
committed by Ben Vanik
parent 3007a98d2d
commit 24f8295daa
4 changed files with 16 additions and 5 deletions

View File

@@ -358,8 +358,6 @@ bool Emulator::SaveToFile(const std::wstring& path) {
}
bool Emulator::RestoreFromFile(const std::wstring& path) {
auto lock = global_critical_region::AcquireDirect();
// Restore the emulator state from a file
auto map = MappedMemory::Open(path, MappedMemory::Mode::kReadWrite);
if (!map) {
@@ -372,6 +370,7 @@ bool Emulator::RestoreFromFile(const std::wstring& path) {
Pause();
kernel_state_->TerminateTitle();
auto lock = global_critical_region::AcquireDirect();
ByteStream stream(map->data(), map->size());
if (stream.Read<uint32_t>() != 'XSAV') {
return false;