mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Added boost serialization
This commit is contained in:
		
							parent
							
								
									f106e76132
								
							
						
					
					
						commit
						6940c99ed6
					
				
					 8 changed files with 89 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								src/common/archives.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/common/archives.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include "boost/archive/binary_iarchive.hpp" | ||||
| #include "boost/archive/binary_oarchive.hpp" | ||||
| 
 | ||||
| #define SERIALIZE_IMPL(A) template void A::serialize<boost::archive::binary_iarchive>( \ | ||||
|     boost::archive::binary_iarchive & ar, \ | ||||
|     const unsigned int file_version \ | ||||
| ); \ | ||||
| template void A::serialize<boost::archive::binary_oarchive>( \ | ||||
|     boost::archive::binary_oarchive & ar, \ | ||||
|     const unsigned int file_version \ | ||||
| ); | ||||
|  | @ -465,7 +465,7 @@ endif() | |||
| create_target_directory_groups(core) | ||||
| 
 | ||||
| target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) | ||||
| target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives) | ||||
| target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp fmt open_source_archives boost_libs) | ||||
| if (ENABLE_WEB_SERVICE) | ||||
|     target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE) | ||||
|     target_link_libraries(core PRIVATE web_service) | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include <memory> | ||||
| #include <utility> | ||||
| #include <vector> | ||||
| #include "boost/serialization/split_member.hpp" | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/result.h" | ||||
| #include "core/memory.h" | ||||
|  | @ -193,6 +194,31 @@ public: | |||
|     Memory::PageTable page_table; | ||||
| 
 | ||||
| private: | ||||
|     friend class boost::serialization::access; | ||||
|     template<class Archive> | ||||
|     void save(Archive & ar, const unsigned int file_version) | ||||
|     { | ||||
|         for (int i = 0; i < page_table.pointers.size(); i++) { | ||||
|             ar << memory.GetFCRAMOffset(page_table.pointers[i]); | ||||
|         } | ||||
|         ar & page_table.special_regions; | ||||
|         ar & page_table.attributes; | ||||
|     } | ||||
| 
 | ||||
|     template<class Archive> | ||||
|     void load(Archive & ar, const unsigned int file_version) | ||||
|     { | ||||
|         for (int i = 0; i < page_table.pointers.size(); i++) { | ||||
|             u32 offset{}; | ||||
|             ar >> offset; | ||||
|             page_table.pointers[i] = memory.GetFCRAMPointer(offset); | ||||
|         } | ||||
|         ar & page_table.special_regions; | ||||
|         ar & page_table.attributes; | ||||
|     } | ||||
| 
 | ||||
|     BOOST_SERIALIZATION_SPLIT_MEMBER() | ||||
| 
 | ||||
|     using VMAIter = decltype(vma_map)::iterator; | ||||
| 
 | ||||
|     /// Converts a VMAHandle to a mutable VMAIter.
 | ||||
|  |  | |||
|  | @ -4,7 +4,9 @@ | |||
| 
 | ||||
| #include <array> | ||||
| #include <cstring> | ||||
| #include "boost/serialization/split_member.hpp" | ||||
| #include "audio_core/dsp_interface.h" | ||||
| #include "common/archives.h" | ||||
| #include "common/assert.h" | ||||
| #include "common/common_types.h" | ||||
| #include "common/logging/log.h" | ||||
|  | @ -67,8 +69,37 @@ public: | |||
|     std::vector<PageTable*> page_table_list; | ||||
| 
 | ||||
|     AudioCore::DspInterface* dsp = nullptr; | ||||
| 
 | ||||
| private: | ||||
|     friend class boost::serialization::access; | ||||
|     template<class Archive> | ||||
|     void save(Archive & ar, const unsigned int file_version) const | ||||
|     { | ||||
|         // TODO: Skip n3ds ram when not used?
 | ||||
|         ar.save_binary(fcram.get(), Memory::FCRAM_N3DS_SIZE); | ||||
|         ar.save_binary(vram.get(), Memory::VRAM_SIZE); | ||||
|         ar.save_binary(n3ds_extra_ram.get(), Memory::N3DS_EXTRA_RAM_SIZE); | ||||
|         // ar & cache_marker;
 | ||||
|         // ar & page_table_list;
 | ||||
|         // ar & current_page_table;
 | ||||
|     } | ||||
| 
 | ||||
|     template<class Archive> | ||||
|     void load(Archive & ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar.load_binary(fcram.get(), Memory::FCRAM_N3DS_SIZE); | ||||
|         ar.load_binary(vram.get(), Memory::VRAM_SIZE); | ||||
|         ar.load_binary(n3ds_extra_ram.get(), Memory::N3DS_EXTRA_RAM_SIZE); | ||||
|         // ar & cache_marker;
 | ||||
|         // ar & page_table_list;
 | ||||
|         // ar & current_page_table;
 | ||||
|     } | ||||
| 
 | ||||
|     BOOST_SERIALIZATION_SPLIT_MEMBER() | ||||
| }; | ||||
| 
 | ||||
| SERIALIZE_IMPL(MemorySystem::Impl) | ||||
| 
 | ||||
| MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {} | ||||
| MemorySystem::~MemorySystem() = default; | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| #include "boost/serialization/split_member.hpp" | ||||
| #include "common/common_types.h" | ||||
| #include "core/mmio.h" | ||||
| 
 | ||||
|  | @ -52,6 +53,14 @@ struct SpecialRegion { | |||
|     VAddr base; | ||||
|     u32 size; | ||||
|     MMIORegionPointer handler; | ||||
| 
 | ||||
|     template<class Archive> | ||||
|     void serialize(Archive & ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar & base; | ||||
|         ar & size; | ||||
|         ar & handler; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue