1
0
Fork 0

dsp_dsp.cpp: fix registering Interrupt handler on loading savestates (#7055)

This commit is contained in:
SachinVin 2023-10-11 01:22:57 +05:30 committed by GitHub
parent 4220f69c06
commit 1acb03b579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -114,8 +114,7 @@ private:
ar& dsp_memory.raw_memory;
ar& sources;
ar& mixers;
// interrupt_handler is function pointer and cant be serialised, fortunately though, it
// should be registerd before the game has started
// interrupt_handler is reregistered when loading state from DSP_DSP
}
friend class boost::serialization::access;
};

View File

@ -394,6 +394,12 @@ DSP_DSP::DSP_DSP(Core::System& system)
semaphore_event->SetHLENotifier(
[this]() { this->system.DSP().SetSemaphore(preset_semaphore); });
system.DSP().SetInterruptHandler([dsp_ref = this](InterruptType type, DspPipe pipe) {
if (dsp_ref) {
dsp_ref->SignalInterrupt(type, pipe);
}
});
}
DSP_DSP::~DSP_DSP() {
@ -405,12 +411,6 @@ void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
auto dsp = std::make_shared<DSP_DSP>(system);
dsp->InstallAsService(service_manager);
system.DSP().SetInterruptHandler(
[dsp_ref = std::weak_ptr<DSP_DSP>(dsp)](InterruptType type, DspPipe pipe) {
if (auto locked = dsp_ref.lock()) {
locked->SignalInterrupt(type, pipe);
}
});
}
} // namespace Service::DSP