1
0
Fork 0

Added CSND serialization

This commit is contained in:
Hamish Milne 2019-12-26 17:56:44 +00:00 committed by zhupengfei
parent 17b9cbefef
commit a0c3b91785
3 changed files with 75 additions and 2 deletions

7
TODO
View File

@ -15,6 +15,7 @@
☐ Settings
☐ Telemetry session
☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
☐ Review constructor/initialization code
✔ HW @done(19-08-13 15:41)
✔ GPU regs @done(19-08-13 15:41)
✔ LCD regs @done(19-08-13 15:41)
@ -69,8 +70,10 @@
☐ CAM @started(19-12-26 10:37)
Need to check capture_result
☐ CECD
☐ CGF
☐ CSND
☐ Archive backend / file handles
☐ CFG
Also needs archive backend..
✔ CSND @started(19-12-26 17:51) @done(19-12-26 17:56) @lasted(5m30s)
☐ DLP
☐ DSP
☐ ERR

View File

@ -3,11 +3,25 @@
// Refer to the license.txt file included.
#include "common/alignment.h"
#include "common/archives.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/result.h"
#include "core/hle/service/csnd/csnd_snd.h"
namespace boost::serialization {
template <class Archive>
void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int)
{
::new(t)Service::CSND::CSND_SND(Core::Global<Core::System>());
}
template
void load_construct_data<iarchive>(iarchive& ar, Service::CSND::CSND_SND* t, const unsigned int);
}
SERIALIZE_EXPORT_IMPL(Service::CSND::CSND_SND)
namespace Service::CSND {
enum class CommandId : u16 {

View File

@ -5,6 +5,8 @@
#pragma once
#include <memory>
#include <boost/serialization/array.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/service.h"
@ -33,6 +35,15 @@ enum class LoopMode : u8 {
struct AdpcmState {
s16 predictor = 0;
u8 step_index = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & predictor;
ar & step_index;
}
friend class boost::serialization::access;
};
struct Channel {
@ -52,6 +63,29 @@ struct Channel {
LoopMode loop_mode = LoopMode::Manual;
Encoding encoding = Encoding::Pcm8;
u8 psg_duty = 0;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & block1_address;
ar & block2_address;
ar & block1_size;
ar & block2_size;
ar & block1_adpcm_state;
ar & block2_adpcm_state;
ar & block2_adpcm_reload;
ar & left_channel_volume;
ar & right_channel_volume;
ar & left_capture_volume;
ar & right_capture_volume;
ar & sample_rate;
ar & linear_interpolation;
ar & loop_mode;
ar & encoding;
ar & psg_duty;
}
friend class boost::serialization::access;
};
class CSND_SND final : public ServiceFramework<CSND_SND> {
@ -222,9 +256,31 @@ private:
u32 type1_command_offset = 0;
u32 acquired_channel_mask = 0;
template <class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar & mutex;
ar & shared_memory;
ar & capture_units;
ar & channels;
ar & master_state_offset;
ar & channel_state_offset;
ar & capture_state_offset;
ar & type1_command_offset;
ar & acquired_channel_mask;
}
friend class boost::serialization::access;
};
/// Initializes the CSND_SND Service
void InstallInterfaces(Core::System& system);
} // namespace Service::CSND
BOOST_CLASS_EXPORT_KEY(Service::CSND::CSND_SND)
namespace boost::serialization {
template <class Archive>
void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int);
}