/
cereal.cpp
49 lines (42 loc) · 1.1 KB
/
cereal.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "util/cereal.hpp"
#include <string>
#include "Utilities/StrFmt.h"
#include "Emu/RSX/RSXThread.h"
#include "Emu/RSX/Capture/rsx_capture.h"
#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Weffc++"
#endif
#include "cereal/archives/binary.hpp"
#include <cereal/types/vector.hpp>
#include <cereal/types/array.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/utility.hpp>
#include <cereal/types/unordered_set.hpp>
#include <cereal/types/unordered_map.hpp>
#include <sstream>
namespace cereal
{
[[noreturn]] void throw_exception(const std::string& err)
{
fmt::throw_exception("%s", err);
}
[[noreturn]] void throw_exception(const char* err)
{
fmt::throw_exception("%s", err);
}
}
template <>
std::string cereal_serialize<rsx::frame_capture_data>(const rsx::frame_capture_data& data)
{
std::ostringstream os;
cereal::BinaryOutputArchive archive(os);
archive(data);
return os.str();
}
template <>
void cereal_deserialize<rsx::frame_capture_data>(rsx::frame_capture_data& data, const std::string& src)
{
std::istringstream is(src);
cereal::BinaryInputArchive archive(is);
archive(data);
}