mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 08:20:05 +00:00
Fix crashes when loading with cameras active
This commit is contained in:
parent
e74b44042b
commit
3278a4d7ef
@ -30,6 +30,19 @@ void Module::serialize(Archive& ar, const unsigned int) {
|
||||
ar& cameras;
|
||||
ar& ports;
|
||||
ar& is_camera_reload_pending;
|
||||
if (Archive::is_loading::value) {
|
||||
for (int i = 0; i < NumCameras; i++) {
|
||||
LoadCameraImplementation(cameras[i], i);
|
||||
}
|
||||
for (std::size_t i = 0; i < ports.size(); i++) {
|
||||
if (ports[i].is_busy) {
|
||||
cameras[ports[i].camera_id].impl->StartCapture();
|
||||
}
|
||||
if (ports[i].is_receiving) {
|
||||
StartReceiving(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SERIALIZE_IMPL(Module)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <boost/serialization/deque.hpp>
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/unique_ptr.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/swap.h"
|
||||
#include "core/global.h"
|
||||
@ -792,8 +793,12 @@ private:
|
||||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
ar& impl;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
// For compatibility: put a nullptr here
|
||||
if (file_version == 0) {
|
||||
std::unique_ptr<Camera::CameraInterface> x;
|
||||
ar& x;
|
||||
}
|
||||
ar& contexts;
|
||||
ar& current_context;
|
||||
ar& frame_rate;
|
||||
@ -883,3 +888,4 @@ void InstallInterfaces(Core::System& system);
|
||||
} // namespace Service::CAM
|
||||
|
||||
SERVICE_CONSTRUCT(Service::CAM::Module)
|
||||
BOOST_CLASS_VERSION(Service::CAM::Module::CameraConfig, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user