mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Correct exports; add some file serialization; fix service base object serialization
This commit is contained in:
		
							parent
							
								
									f2de70c3fb
								
							
						
					
					
						commit
						996aba39fe
					
				
					 52 changed files with 197 additions and 33 deletions
				
			
		|  | @ -10,5 +10,6 @@ using oarchive = boost::archive::binary_oarchive; | |||
|     template void A::serialize<oarchive>(oarchive & ar, const unsigned int file_version); | ||||
| 
 | ||||
| #define SERIALIZE_EXPORT_IMPL(A)                                                                   \ | ||||
|     BOOST_CLASS_EXPORT_IMPLEMENT(A)                                                                \ | ||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(iarchive)                                                 \ | ||||
|     BOOST_SERIALIZATION_REGISTER_ARCHIVE(oarchive) | ||||
|  |  | |||
|  | @ -901,10 +901,18 @@ IOFile& IOFile::operator=(IOFile&& other) { | |||
| void IOFile::Swap(IOFile& other) { | ||||
|     std::swap(m_file, other.m_file); | ||||
|     std::swap(m_good, other.m_good); | ||||
|     std::swap(filename, other.filename); | ||||
|     std::swap(openmode, other.openmode); | ||||
|     std::swap(flags, other.flags); | ||||
| } | ||||
| 
 | ||||
| bool IOFile::Open(const std::string& filename, const char openmode[], int flags) { | ||||
|     Close(); | ||||
| 
 | ||||
|     this->filename = filename; | ||||
|     this->openmode = openmode; | ||||
|     this->flags = flags; | ||||
| 
 | ||||
| #ifdef _WIN32 | ||||
|     if (flags != 0) { | ||||
|         m_file = _wfsopen(Common::UTF8ToUTF16W(filename).c_str(), | ||||
|  |  | |||
|  | @ -14,6 +14,8 @@ | |||
| #include <string_view> | ||||
| #include <type_traits> | ||||
| #include <vector> | ||||
| #include <boost/serialization/split_member.hpp> | ||||
| #include <boost/serialization/string.hpp> | ||||
| #include "common/common_types.h" | ||||
| #ifdef _MSC_VER | ||||
| #include "common/string_util.h" | ||||
|  | @ -221,7 +223,6 @@ public: | |||
| 
 | ||||
|     void Swap(IOFile& other); | ||||
| 
 | ||||
|     bool Open(const std::string& filename, const char openmode[], int flags = 0); | ||||
|     bool Close(); | ||||
| 
 | ||||
|     template <typename T> | ||||
|  | @ -305,8 +306,34 @@ public: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     bool Open(const std::string& filename, const char openmode[], int flags = 0); | ||||
| 
 | ||||
|     std::FILE* m_file = nullptr; | ||||
|     bool m_good = true; | ||||
| 
 | ||||
|     std::string filename; | ||||
|     std::string openmode; | ||||
|     u32 flags; | ||||
| 
 | ||||
|     template <class Archive> | ||||
|     void save(Archive& ar, const unsigned int) const { | ||||
|         ar << filename; | ||||
|         ar << openmode; | ||||
|         ar << flags; | ||||
|         ar << Tell(); | ||||
|     } | ||||
| 
 | ||||
|     template <class Archive> | ||||
|     void load(Archive& ar, const unsigned int) { | ||||
|         ar >> filename; | ||||
|         ar >> openmode; | ||||
|         ar >> flags; | ||||
|         u64 pos; | ||||
|         ar >> pos; | ||||
|         Seek(pos, SEEK_SET); | ||||
|     } | ||||
| 
 | ||||
|     BOOST_SERIALIZATION_SPLIT_MEMBER() | ||||
| }; | ||||
| 
 | ||||
| } // namespace FileUtil
 | ||||
|  |  | |||
|  | @ -14,6 +14,11 @@ public: | |||
|     virtual ~BackingMem() = default; | ||||
|     virtual u8* GetPtr() = 0; | ||||
|     virtual u32 GetSize() const = 0; | ||||
| 
 | ||||
| private: | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int) {} | ||||
|     friend class boost::serialization::access; | ||||
| }; | ||||
| 
 | ||||
| /// Backing memory implemented by a local buffer
 | ||||
|  | @ -39,6 +44,7 @@ private: | |||
| 
 | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int) { | ||||
|         ar& boost::serialization::base_object<BackingMem>(*this); | ||||
|         ar& data; | ||||
|     } | ||||
|     friend class boost::serialization::access; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue