mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Fix crash bugs
This commit is contained in:
		
							parent
							
								
									116d22d562
								
							
						
					
					
						commit
						f2de70c3fb
					
				
					 8 changed files with 32 additions and 21 deletions
				
			
		|  | @ -11,5 +11,4 @@ using oarchive = boost::archive::binary_oarchive; | |||
| 
 | ||||
| #define SERIALIZE_EXPORT_IMPL(A)                                                                   \ | ||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive)                                                 \ | ||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive)                                                 \ | ||||
|     BOOST_CLASS_EXPORT_IMPLEMENT(A) | ||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) | ||||
|  |  | |||
|  | @ -44,6 +44,8 @@ | |||
| #include "network/network.h" | ||||
| #include "video_core/video_core.h" | ||||
| 
 | ||||
| #include "core/hle/service/pm/pm_app.h" | ||||
| 
 | ||||
| namespace Core { | ||||
| 
 | ||||
| /*static*/ System System::s_instance; | ||||
|  | @ -214,8 +216,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo | |||
| 
 | ||||
|     timing = std::make_unique<Timing>(); | ||||
| 
 | ||||
|     kernel = std::make_unique<Kernel::KernelSystem>(*memory, *timing, | ||||
|                                                     [this] { PrepareReschedule(); }, system_mode); | ||||
|     kernel = std::make_unique<Kernel::KernelSystem>( | ||||
|         *memory, *timing, [this] { PrepareReschedule(); }, system_mode); | ||||
| 
 | ||||
|     if (Settings::values.use_cpu_jit) { | ||||
| #ifdef ARCHITECTURE_x86_64 | ||||
|  | @ -420,11 +422,17 @@ void System::serialize(Archive& ar, const unsigned int file_version) { | |||
| } | ||||
| 
 | ||||
| void System::Save(std::ostream& stream) const { | ||||
|     { | ||||
|         oarchive oa{stream}; | ||||
|         oa&* this; | ||||
|     try { | ||||
| 
 | ||||
|         { | ||||
|             oarchive oa{stream}; | ||||
|             oa&* this; | ||||
|         } | ||||
|         VideoCore::Save(stream); | ||||
| 
 | ||||
|     } catch (const std::exception& e) { | ||||
|         LOG_ERROR(Core, "Error saving: {}", e.what()); | ||||
|     } | ||||
|     VideoCore::Save(stream); | ||||
| } | ||||
| 
 | ||||
| void System::Load(std::istream& stream) { | ||||
|  |  | |||
|  | @ -198,7 +198,7 @@ private: | |||
|  * id of the memory interface and let kernel convert it back to client vaddr. No real unmapping is | ||||
|  * needed in this case, though. | ||||
|  */ | ||||
| class HLERequestContext : std::enable_shared_from_this<HLERequestContext> { | ||||
| class HLERequestContext : public std::enable_shared_from_this<HLERequestContext> { | ||||
| public: | ||||
|     HLERequestContext(KernelSystem& kernel, std::shared_ptr<ServerSession> session, | ||||
|                       std::shared_ptr<Thread> thread); | ||||
|  |  | |||
|  | @ -75,10 +75,11 @@ ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) { | |||
|         kernel.memory.ReadBlock(*current_process, thread->GetCommandBufferAddress(), cmd_buf.data(), | ||||
|                                 cmd_buf.size() * sizeof(u32)); | ||||
| 
 | ||||
|         Kernel::HLERequestContext context(kernel, SharedFrom(this), thread); | ||||
|         context.PopulateFromIncomingCommandBuffer(cmd_buf.data(), current_process); | ||||
|         auto context = | ||||
|             std::make_shared<Kernel::HLERequestContext>(kernel, SharedFrom(this), thread); | ||||
|         context->PopulateFromIncomingCommandBuffer(cmd_buf.data(), current_process); | ||||
| 
 | ||||
|         hle_handler->HandleSyncRequest(context); | ||||
|         hle_handler->HandleSyncRequest(*context); | ||||
| 
 | ||||
|         ASSERT(thread->status == Kernel::ThreadStatus::Running || | ||||
|                thread->status == Kernel::ThreadStatus::WaitHleEvent); | ||||
|  | @ -86,7 +87,7 @@ ResultCode ServerSession::HandleSyncRequest(std::shared_ptr<Thread> thread) { | |||
|         // put the thread to sleep then the writing of the command buffer will be deferred to the
 | ||||
|         // wakeup callback.
 | ||||
|         if (thread->status == Kernel::ThreadStatus::Running) { | ||||
|             context.WriteToOutgoingCommandBuffer(cmd_buf.data(), *current_process); | ||||
|             context->WriteToOutgoingCommandBuffer(cmd_buf.data(), *current_process); | ||||
|             kernel.memory.WriteBlock(*current_process, thread->GetCommandBufferAddress(), | ||||
|                                      cmd_buf.data(), cmd_buf.size() * sizeof(u32)); | ||||
|         } | ||||
|  |  | |||
|  | @ -452,6 +452,9 @@ MemoryRef MemorySystem::GetPhysicalRef(PAddr address) { | |||
|     default: | ||||
|         UNREACHABLE(); | ||||
|     } | ||||
|     if (offset_into_region >= target_mem->GetSize()) { | ||||
|         return {nullptr}; | ||||
|     } | ||||
| 
 | ||||
|     return {target_mem, offset_into_region}; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue