citra-emu
/
citra-canary
Archived
1
0
Fork 0

Minor frontend fixes to savestates (#5430)

This commit is contained in:
Pengfei Zhu 2020-09-03 06:04:23 +08:00 committed by GitHub
parent 66846836bc
commit 6a77547bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

View File

@ -413,10 +413,16 @@ void GMainWindow::InitializeSaveStateMenuActions() {
ui.menu_Save_State->addAction(actions_save_state[i]);
}
connect(ui.action_Load_from_Newest_Slot, &QAction::triggered,
[this] { actions_load_state[newest_slot - 1]->trigger(); });
connect(ui.action_Save_to_Oldest_Slot, &QAction::triggered,
[this] { actions_save_state[oldest_slot - 1]->trigger(); });
connect(ui.action_Load_from_Newest_Slot, &QAction::triggered, [this] {
UpdateSaveStates();
if (newest_slot != 0) {
actions_load_state[newest_slot - 1]->trigger();
}
});
connect(ui.action_Save_to_Oldest_Slot, &QAction::triggered, [this] {
UpdateSaveStates();
actions_save_state[oldest_slot - 1]->trigger();
});
connect(ui.menu_Load_State->menuAction(), &QAction::hovered, this,
&GMainWindow::UpdateSaveStates);

View File

@ -26,11 +26,16 @@ SERVICE_CONSTRUCT_IMPL(Service::CAM::Module)
namespace Service::CAM {
template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) {
void Module::serialize(Archive& ar, const unsigned int file_version) {
ar& cameras;
ar& ports;
ar& is_camera_reload_pending;
if (Archive::is_loading::value) {
if (file_version > 0) {
ar& initialized;
} else {
initialized = true;
}
if (Archive::is_loading::value && initialized) {
for (int i = 0; i < NumCameras; i++) {
LoadCameraImplementation(cameras[i], i);
}
@ -1077,6 +1082,8 @@ void Module::Interface::DriverInitialize(Kernel::HLERequestContext& ctx) {
port.Clear();
}
cam->initialized = true;
rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_CAM, "called");
@ -1093,6 +1100,8 @@ void Module::Interface::DriverFinalize(Kernel::HLERequestContext& ctx) {
camera.impl = nullptr;
}
cam->initialized = false;
rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_CAM, "called");

View File

@ -757,6 +757,7 @@ private:
void LoadCameraImplementation(CameraConfig& camera, int camera_id);
Core::System& system;
bool initialized{};
std::array<CameraConfig, NumCameras> cameras;
std::array<PortConfig, 2> ports;
Core::TimingEventType* completion_event_callback;
@ -764,7 +765,7 @@ private:
std::atomic<bool> is_camera_reload_pending{false};
template <class Archive>
void serialize(Archive& ar, const unsigned int);
void serialize(Archive& ar, const unsigned int file_version);
friend class boost::serialization::access;
};
@ -775,4 +776,5 @@ void InstallInterfaces(Core::System& system);
} // namespace Service::CAM
SERVICE_CONSTRUCT(Service::CAM::Module)
BOOST_CLASS_VERSION(Service::CAM::Module, 1)
BOOST_CLASS_VERSION(Service::CAM::Module::CameraConfig, 1)