Code review actions (plus hopefully fix the linux CI)

This commit is contained in:
Hamish Milne 2020-03-31 17:54:28 +01:00
parent 9bd189a155
commit 92640fc29c
46 changed files with 155 additions and 109 deletions

View File

@ -31,8 +31,10 @@ if (MSVC)
# /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates # /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
# /Zc:inline - Let codegen omit inline functions in object files # /Zc:inline - Let codegen omit inline functions in object files
# /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null # /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
# /external:* - Suppress warnings from external headers
add_compile_options( add_compile_options(
/W3 /W3
/MP
/Zi /Zi
/Zo /Zo
/permissive- /permissive-
@ -40,17 +42,12 @@ if (MSVC)
/volatile:iso /volatile:iso
/Zc:externConstexpr /Zc:externConstexpr
/Zc:inline /Zc:inline
)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(
/MP
/Zc:throwingNew /Zc:throwingNew
/experimental:external /experimental:external
/external:I "${CMAKE_SOURCE_DIR}/externals" /external:I "${CMAKE_SOURCE_DIR}/externals"
/external:anglebrackets /external:anglebrackets
/external:W0 /external:W0
) )
endif()
# /GS- - No stack buffer overflow checks # /GS- - No stack buffer overflow checks
add_compile_options("$<$<CONFIG:Release>:/GS->") add_compile_options("$<$<CONFIG:Release>:/GS->")

View File

@ -45,6 +45,7 @@ void DspHle::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<DspInterface>(*this); ar& boost::serialization::base_object<DspInterface>(*this);
ar&* impl.get(); ar&* impl.get();
} }
SERIALIZE_IMPL(DspHle)
static constexpr u64 audio_frame_ticks = 1310252ull; ///< Units: ARM11 cycles static constexpr u64 audio_frame_ticks = 1310252ull; ///< Units: ARM11 cycles

View File

@ -5,8 +5,8 @@
#pragma once #pragma once
#include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_iarchive.hpp>
#include "boost/archive/binary_oarchive.hpp" #include <boost/archive/binary_oarchive.hpp>
#include "boost/serialization/export.hpp" #include <boost/serialization/export.hpp>
using iarchive = boost::archive::binary_iarchive; using iarchive = boost::archive::binary_iarchive;
using oarchive = boost::archive::binary_oarchive; using oarchive = boost::archive::binary_oarchive;

View File

@ -41,13 +41,17 @@ public:
} }
std::size_t GetSize() const override { std::size_t GetSize() const override {
return static_cast<u32>(data.size()); return data.size();
} }
std::vector<u8>& Vector() { std::vector<u8>& Vector() {
return data; return data;
} }
const std::vector<u8>& Vector() const {
return data;
}
private: private:
std::vector<u8> data; std::vector<u8> data;

View File

@ -1,3 +1,7 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once #pragma once
#include <atomic> #include <atomic>

View File

@ -1,33 +1,37 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once #pragma once
#include "common/common_types.h"
#include <boost/icl/discrete_interval.hpp> #include <boost/icl/discrete_interval.hpp>
#include "common/common_types.h"
namespace boost::serialization { namespace boost::serialization {
template <class Archive, class DomainT, ICL_COMPARE Compare> template <class Archive, class DomainT, ICL_COMPARE Compare>
void save(Archive& ar, const boost::icl::discrete_interval<DomainT, Compare>& obj, const unsigned int file_version) void save(Archive& ar, const boost::icl::discrete_interval<DomainT, Compare>& obj,
{ const unsigned int file_version) {
ar << obj.lower(); ar << obj.lower();
ar << obj.upper(); ar << obj.upper();
ar << obj.bounds()._bits; ar << obj.bounds()._bits;
} }
template <class Archive, class DomainT, ICL_COMPARE Compare> template <class Archive, class DomainT, ICL_COMPARE Compare>
void load(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj, const unsigned int file_version) void load(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj,
{ const unsigned int file_version) {
DomainT upper, lower; DomainT upper, lower;
boost::icl::bound_type bounds; boost::icl::bound_type bounds;
ar >> upper;
ar >> lower; ar >> lower;
ar >> upper;
ar >> bounds; ar >> bounds;
obj = boost::icl::discrete_interval(upper, lower, boost::icl::interval_bounds(bounds)); obj = boost::icl::discrete_interval(upper, lower, boost::icl::interval_bounds(bounds));
} }
template <class Archive, class DomainT, ICL_COMPARE Compare> template <class Archive, class DomainT, ICL_COMPARE Compare>
void serialize(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj, const unsigned int file_version) void serialize(Archive& ar, boost::icl::discrete_interval<DomainT, Compare>& obj,
{ const unsigned int file_version) {
boost::serialization::split_free(ar, obj, file_version); boost::serialization::split_free(ar, obj, file_version);
} }
} } // namespace boost::serialization

View File

@ -1,3 +1,7 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once #pragma once
#include <boost/container/flat_set.hpp> #include <boost/container/flat_set.hpp>

View File

@ -0,0 +1,20 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <boost/icl/interval_set.hpp>
#include "common/serialization/boost_discrete_interval.hpp"
namespace boost::serialization {
template <class Archive, class T>
void serialize(Archive& ar, boost::icl::interval_set<T>& obj, const unsigned int file_version) {
using IntervalSet = boost::icl::interval_set<T>;
// This works because interval_set has exactly one member of type ImplSetT
static_assert(std::is_standard_layout_v<IntervalSet>);
ar&*(reinterpret_cast<typename IntervalSet::ImplSetT*>(&obj));
}
} // namespace boost::serialization

View File

@ -186,7 +186,7 @@ private:
void save(Archive& ar, const unsigned int file_version) const { void save(Archive& ar, const unsigned int file_version) const {
const s64 idx = ToIndex(first); const s64 idx = ToIndex(first);
ar << idx; ar << idx;
for (size_t i = 0; i < NUM_QUEUES; i++) { for (std::size_t i = 0; i < NUM_QUEUES; i++) {
const s64 idx1 = ToIndex(queues[i].next_nonempty); const s64 idx1 = ToIndex(queues[i].next_nonempty);
ar << idx1; ar << idx1;
ar << queues[i].data; ar << queues[i].data;
@ -198,7 +198,7 @@ private:
s64 idx; s64 idx;
ar >> idx; ar >> idx;
first = ToPointer(idx); first = ToPointer(idx);
for (auto i = 0; i < NUM_QUEUES; i++) { for (std::size_t i = 0; i < NUM_QUEUES; i++) {
ar >> idx; ar >> idx;
queues[i].next_nonempty = ToPointer(idx); queues[i].next_nonempty = ToPointer(idx);
ar >> queues[i].data; ar >> queues[i].data;

View File

@ -6,15 +6,13 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/split_member.hpp> #include <boost/serialization/split_member.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/arm_regformat.h"
#include "core/arm/skyeye_common/vfp/asm_vfp.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/memory.h"
namespace Memory {
struct PageTable;
}
/// Generic ARM11 CPU interface /// Generic ARM11 CPU interface
class ARM_Interface : NonCopyable { class ARM_Interface : NonCopyable {
@ -28,11 +26,11 @@ public:
template <class Archive> template <class Archive>
void save(Archive& ar, const unsigned int file_version) const { void save(Archive& ar, const unsigned int file_version) const {
for (size_t i = 0; i < 16; i++) { for (std::size_t i = 0; i < 16; i++) {
const auto r = GetCpuRegister(i); const auto r = GetCpuRegister(i);
ar << r; ar << r;
} }
for (size_t i = 0; i < 16; i++) { for (std::size_t i = 0; i < 16; i++) {
const auto r = GetFpuRegister(i); const auto r = GetFpuRegister(i);
ar << r; ar << r;
} }
@ -47,11 +45,11 @@ public:
template <class Archive> template <class Archive>
void load(Archive& ar, const unsigned int file_version) { void load(Archive& ar, const unsigned int file_version) {
u32 r; u32 r;
for (size_t i = 0; i < 16; i++) { for (std::size_t i = 0; i < 16; i++) {
ar >> r; ar >> r;
SetCpuRegister(i, r); SetCpuRegister(i, r);
} }
for (size_t i = 0; i < 16; i++) { for (std::size_t i = 0; i < 16; i++) {
ar >> r; ar >> r;
SetFpuRegister(i, r); SetFpuRegister(i, r);
} }
@ -120,8 +118,6 @@ public:
/// Notify CPU emulation that page tables have changed /// Notify CPU emulation that page tables have changed
virtual void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) = 0; virtual void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) = 0;
virtual std::shared_ptr<Memory::PageTable> GetPageTable() const = 0;
/** /**
* Set the Program Counter to an address * Set the Program Counter to an address
* @param addr Address to set PC to * @param addr Address to set PC to
@ -234,6 +230,9 @@ public:
} }
protected: protected:
// This us used for serialization. Returning nullptr is valid if page tables are not used.
virtual std::shared_ptr<Memory::PageTable> GetPageTable() const = 0;
std::shared_ptr<Core::Timing::Timer> timer; std::shared_ptr<Core::Timing::Timer> timer;
private: private:
@ -259,11 +258,11 @@ private:
const auto r = GetVFPReg(i); const auto r = GetVFPReg(i);
ar << r; ar << r;
} }
for (size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) { for (std::size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) {
const auto r = GetVFPSystemReg(static_cast<VFPSystemRegister>(i)); const auto r = GetVFPSystemReg(static_cast<VFPSystemRegister>(i));
ar << r; ar << r;
} }
for (size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) { for (std::size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) {
const auto r = GetCP15Register(static_cast<CP15Register>(i)); const auto r = GetCP15Register(static_cast<CP15Register>(i));
ar << r; ar << r;
} }
@ -290,11 +289,11 @@ private:
ar >> r; ar >> r;
SetVFPReg(i, r); SetVFPReg(i, r);
} }
for (size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) { for (std::size_t i = 0; i < VFPSystemRegister::VFP_SYSTEM_REGISTER_COUNT; i++) {
ar >> r; ar >> r;
SetVFPSystemReg(static_cast<VFPSystemRegister>(i), r); SetVFPSystemReg(static_cast<VFPSystemRegister>(i), r);
} }
for (size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) { for (std::size_t i = 0; i < CP15Register::CP15_REGISTER_COUNT; i++) {
ar >> r; ar >> r;
SetCP15Register(static_cast<CP15Register>(i), r); SetCP15Register(static_cast<CP15Register>(i), r);
} }

View File

@ -53,9 +53,11 @@ public:
void ClearInstructionCache() override; void ClearInstructionCache() override;
void InvalidateCacheRange(u32 start_address, std::size_t length) override; void InvalidateCacheRange(u32 start_address, std::size_t length) override;
void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override; void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override;
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
void PurgeState() override; void PurgeState() override;
protected:
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
private: private:
friend class DynarmicUserCallbacks; friend class DynarmicUserCallbacks;
Core::System& system; Core::System& system;

View File

@ -49,10 +49,12 @@ public:
void LoadContext(const std::unique_ptr<ThreadContext>& arg) override; void LoadContext(const std::unique_ptr<ThreadContext>& arg) override;
void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override; void SetPageTable(const std::shared_ptr<Memory::PageTable>& page_table) override;
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
void PrepareReschedule() override; void PrepareReschedule() override;
void PurgeState() override; void PurgeState() override;
protected:
std::shared_ptr<Memory::PageTable> GetPageTable() const override;
private: private:
void ExecuteInstructions(u64 num_instructions); void ExecuteInstructions(u64 num_instructions);

View File

@ -1,4 +1,3 @@
#pragma optimize("", off)
// Copyright 2014 Citra Emulator Project // Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -184,12 +183,14 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
LOG_INFO(Core, "Begin load"); LOG_INFO(Core, "Begin load");
System::LoadState(param); System::LoadState(param);
LOG_INFO(Core, "Load completed"); LOG_INFO(Core, "Load completed");
} break; break;
}
case Signal::Save: { case Signal::Save: {
LOG_INFO(Core, "Begin save"); LOG_INFO(Core, "Begin save");
System::SaveState(param); System::SaveState(param);
LOG_INFO(Core, "Save completed"); LOG_INFO(Core, "Save completed");
} break; break;
}
default: default:
break; break;
} }
@ -551,19 +552,11 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
// NOTE: DSP doesn't like being destroyed and recreated. So instead we do an inline // NOTE: DSP doesn't like being destroyed and recreated. So instead we do an inline
// serialization; this means that the DSP Settings need to match for loading to work. // serialization; this means that the DSP Settings need to match for loading to work.
bool dsp_type = Settings::values.enable_dsp_lle;
ar& dsp_type;
if (dsp_type != Settings::values.enable_dsp_lle) {
throw std::runtime_error(
"Incorrect DSP type - please change this in Settings before loading");
}
auto dsp_hle = dynamic_cast<AudioCore::DspHle*>(dsp_core.get()); auto dsp_hle = dynamic_cast<AudioCore::DspHle*>(dsp_core.get());
if (dsp_hle) { if (dsp_hle) {
ar&* dsp_hle; ar&* dsp_hle;
} } else {
auto dsp_lle = dynamic_cast<AudioCore::DspLle*>(dsp_core.get()); throw std::runtime_error("LLE audio not supported for save states");
if (dsp_lle) {
ar&* dsp_lle;
} }
ar&* memory.get(); ar&* memory.get();

View File

@ -7,7 +7,6 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include "boost/serialization/access.hpp"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/custom_tex_cache.h" #include "core/custom_tex_cache.h"
#include "core/frontend/applets/mii_selector.h" #include "core/frontend/applets/mii_selector.h"

View File

@ -183,11 +183,10 @@ void Timing::Timer::Advance(s64 max_slice_length) {
Event evt = std::move(event_queue.front()); Event evt = std::move(event_queue.front());
std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>()); std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<>());
event_queue.pop_back(); event_queue.pop_back();
if (evt.type->callback == nullptr) {
LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
}
if (evt.type->callback != nullptr) { if (evt.type->callback != nullptr) {
evt.type->callback(evt.userdata, executed_ticks - evt.time); evt.type->callback(evt.userdata, executed_ticks - evt.time);
} else {
LOG_ERROR(Core, "Event '{}' has no callback", *evt.type->name);
} }
} }

View File

@ -9,6 +9,7 @@
#include <boost/serialization/base_object.hpp> #include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp> #include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"

View File

@ -7,6 +7,8 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"

View File

@ -9,6 +9,7 @@
#include <boost/serialization/base_object.hpp> #include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/result.h" #include "core/hle/result.h"

View File

@ -4,7 +4,9 @@
#pragma once #pragma once
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"

View File

@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h" #include "common/archives.h"
#include "common/serialization/atomic.h" #include "common/serialization/atomic.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"

View File

@ -11,9 +11,6 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/memory.h" #include "core/hle/kernel/memory.h"
#include "core/hle/result.h" #include "core/hle/result.h"

View File

@ -5,10 +5,11 @@
#pragma once #pragma once
#include <optional> #include <optional>
#include <type_traits>
#include <boost/icl/interval_set.hpp> #include <boost/icl/interval_set.hpp>
#include <boost/serialization/set.hpp> #include <boost/serialization/set.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/serialization/boost_discrete_interval.hpp" #include "common/serialization/boost_interval_set.hpp"
namespace Kernel { namespace Kernel {
@ -70,8 +71,7 @@ private:
ar& base; ar& base;
ar& size; ar& size;
ar& used; ar& used;
// This works because interval_set has exactly one member of type ImplSetT ar& free_blocks;
ar&*(reinterpret_cast<IntervalSet::ImplSetT*>(&free_blocks));
} }
}; };

View File

@ -7,6 +7,9 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"

View File

@ -104,7 +104,7 @@ BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::Object)
#define CONSTRUCT_KERNEL_OBJECT(T) \ #define CONSTRUCT_KERNEL_OBJECT(T) \
namespace boost::serialization { \ namespace boost::serialization { \
template <class Archive> \ template <class Archive> \
inline void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \ void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \
::new (t) T(Core::Global<Kernel::KernelSystem>()); \ ::new (t) T(Core::Global<Kernel::KernelSystem>()); \
} \ } \
} }

View File

@ -7,7 +7,9 @@
#include <array> #include <array>
#include <memory> #include <memory>
#include <boost/serialization/array.hpp> #include <boost/serialization/array.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp> #include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"

View File

@ -5,7 +5,9 @@
#pragma once #pragma once
#include <string> #include <string>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include <queue> #include <queue>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"

View File

@ -3,6 +3,10 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <tuple> #include <tuple>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/string.hpp>
#include "common/archives.h" #include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"

View File

@ -7,10 +7,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"

View File

@ -3,8 +3,10 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <tuple> #include <tuple>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include "common/archives.h" #include "common/archives.h"
#include "core/global.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
@ -16,6 +18,18 @@ SERIALIZE_EXPORT_IMPL(Kernel::ServerSession)
namespace Kernel { namespace Kernel {
template <class Archive>
void ServerSession::serialize(Archive& ar, const unsigned int file_version) {
ar& boost::serialization::base_object<WaitObject>(*this);
ar& name;
ar& parent;
ar& hle_handler;
ar& pending_requesting_threads;
ar& currently_handling;
ar& mapped_buffer_context;
}
SERIALIZE_IMPL(ServerSession)
ServerSession::ServerSession(KernelSystem& kernel) : WaitObject(kernel), kernel(kernel) {} ServerSession::ServerSession(KernelSystem& kernel) : WaitObject(kernel), kernel(kernel) {}
ServerSession::~ServerSession() { ServerSession::~ServerSession() {
// This destructor will be called automatically when the last ServerSession handle is closed by // This destructor will be called automatically when the last ServerSession handle is closed by

View File

@ -7,8 +7,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/kernel/ipc.h" #include "core/hle/kernel/ipc.h"
@ -110,15 +108,7 @@ private:
friend class boost::serialization::access; friend class boost::serialization::access;
template <class Archive> template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) { void serialize(Archive& ar, const unsigned int file_version);
ar& boost::serialization::base_object<WaitObject>(*this);
ar& name;
ar& parent;
ar& hle_handler;
ar& pending_requesting_threads;
ar& currently_handling;
ar& mapped_buffer_context;
}
}; };
} // namespace Kernel } // namespace Kernel

View File

@ -6,7 +6,6 @@
#include "common/archives.h" #include "common/archives.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/session.h" #include "core/hle/kernel/session.h"

View File

@ -5,7 +5,6 @@
#include <cstring> #include <cstring>
#include "common/archives.h" #include "common/archives.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/global.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/memory.h" #include "core/hle/kernel/memory.h"
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"

View File

@ -6,7 +6,9 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/memory_ref.h" #include "common/memory_ref.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
@ -118,7 +120,7 @@ private:
ar& owner_process; ar& owner_process;
ar& base_address; ar& base_address;
ar& name; ar& name;
ar&*(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory)); ar& holding_memory;
} }
friend class boost::serialization::access; friend class boost::serialization::access;
}; };

View File

@ -13,6 +13,7 @@
#include <chrono> #include <chrono>
#include <ctime> #include <ctime>
#include <memory> #include <memory>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/binary_object.hpp> #include <boost/serialization/binary_object.hpp>
#include <boost/serialization/export.hpp> #include <boost/serialization/export.hpp>
#include "common/bit_field.h" #include "common/bit_field.h"

View File

@ -6,6 +6,7 @@
#include <list> #include <list>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <boost/serialization/string.hpp>
#include "common/archives.h" #include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -15,7 +16,6 @@
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/armstate.h"
#include "core/core.h" #include "core/core.h"
#include "core/global.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"

View File

@ -8,7 +8,6 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/global.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <boost/serialization/string.hpp>
#include <boost/serialization/unordered_map.hpp> #include <boost/serialization/unordered_map.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core_timing.h" #include "core/core_timing.h"

View File

@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/serialization/map.hpp> #include <boost/serialization/map.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/split_member.hpp> #include <boost/serialization/split_member.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/memory_ref.h" #include "common/memory_ref.h"

View File

@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -16,6 +17,15 @@
namespace Kernel { namespace Kernel {
template <class Archive>
void WaitObject::serialize(Archive& ar, const unsigned int file_version) {
ar& boost::serialization::base_object<Object>(*this);
ar& waiting_threads;
// NB: hle_notifier *not* serialized since it's a callback!
// Fortunately it's only used in one place (DSP) so we can reconstruct it there
}
SERIALIZE_IMPL(WaitObject)
void WaitObject::AddWaitingThread(std::shared_ptr<Thread> thread) { void WaitObject::AddWaitingThread(std::shared_ptr<Thread> thread) {
auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread);
if (itr == waiting_threads.end()) if (itr == waiting_threads.end())

View File

@ -69,12 +69,7 @@ private:
private: private:
friend class boost::serialization::access; friend class boost::serialization::access;
template <class Archive> template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) { void serialize(Archive& ar, const unsigned int file_version);
ar& boost::serialization::base_object<Object>(*this);
ar& waiting_threads;
// NB: hle_notifier *not* serialized since it's a callback!
// Fortunately it's only used in one place (DSP) so we can reconstruct it there
}
}; };
// Specialization of DynamicObjectCast for WaitObjects // Specialization of DynamicObjectCast for WaitObjects

View File

@ -210,10 +210,6 @@ void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) {
next_accelerometer_index = (next_accelerometer_index + 1) % mem->accelerometer.entries.size(); next_accelerometer_index = (next_accelerometer_index + 1) % mem->accelerometer.entries.size();
Common::Vec3<float> accel; Common::Vec3<float> accel;
if (!motion_device) {
is_device_reload_pending.store(true);
return;
}
std::tie(accel, std::ignore) = motion_device->GetStatus(); std::tie(accel, std::ignore) = motion_device->GetStatus();
accel *= accelerometer_coef; accel *= accelerometer_coef;
// TODO(wwylele): do a time stretch like the one in UpdateGyroscopeCallback // TODO(wwylele): do a time stretch like the one in UpdateGyroscopeCallback
@ -261,10 +257,6 @@ void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) {
GyroscopeDataEntry& gyroscope_entry = mem->gyroscope.entries[mem->gyroscope.index]; GyroscopeDataEntry& gyroscope_entry = mem->gyroscope.entries[mem->gyroscope.index];
Common::Vec3<float> gyro; Common::Vec3<float> gyro;
if (!motion_device) {
is_device_reload_pending.store(true);
return;
}
std::tie(std::ignore, gyro) = motion_device->GetStatus(); std::tie(std::ignore, gyro) = motion_device->GetStatus();
double stretch = system.perf_stats->GetLastFrameTimeScale(); double stretch = system.perf_stats->GetLastFrameTimeScale();
gyro *= gyroscope_coef * static_cast<float>(stretch); gyro *= gyroscope_coef * static_cast<float>(stretch);

View File

@ -71,7 +71,9 @@ private:
void serialize(Archive& ar, const unsigned int) { void serialize(Archive& ar, const unsigned int) {
ar& hid_period; ar& hid_period;
ar& calibration_data; // This isn't writeable for now, but might be in future ar& calibration_data; // This isn't writeable for now, but might be in future
RequestInputDevicesReload(); // zl, zr, c_stick are loaded here if (Archive::is_loading::value) {
LoadInputDevices(); // zl, zr, c_stick are loaded here
}
} }
friend class boost::serialization::access; friend class boost::serialization::access;
}; };

View File

@ -4,9 +4,9 @@
#include <array> #include <array>
#include <cstring> #include <cstring>
#include <boost/serialization/array.hpp>
#include <boost/serialization/binary_object.hpp>
#include "audio_core/dsp_interface.h" #include "audio_core/dsp_interface.h"
#include "boost/serialization/array.hpp"
#include "boost/serialization/binary_object.hpp"
#include "common/archives.h" #include "common/archives.h"
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"

View File

@ -9,7 +9,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/serialization/access.hpp>
#include <boost/serialization/array.hpp> #include <boost/serialization/array.hpp>
#include <boost/serialization/vector.hpp> #include <boost/serialization/vector.hpp>
#include "common/common_types.h" #include "common/common_types.h"
@ -86,12 +85,12 @@ struct PageTable {
struct Entry { struct Entry {
Entry(Pointers& pointers_, VAddr idx_) : pointers(pointers_), idx(idx_) {} Entry(Pointers& pointers_, VAddr idx_) : pointers(pointers_), idx(idx_) {}
inline void operator=(MemoryRef value) { void operator=(MemoryRef value) {
pointers.refs[idx] = value; pointers.refs[idx] = value;
pointers.raw[idx] = value.GetPtr(); pointers.raw[idx] = value.GetPtr();
} }
inline operator u8*() { operator u8*() {
return pointers.raw[idx]; return pointers.raw[idx];
} }
@ -100,15 +99,15 @@ struct PageTable {
VAddr idx; VAddr idx;
}; };
inline Entry operator[](VAddr idx) { Entry operator[](VAddr idx) {
return Entry(*this, idx); return Entry(*this, idx);
} }
inline u8* operator[](VAddr idx) const { u8* operator[](VAddr idx) const {
return raw[idx]; return raw[idx];
} }
inline Entry operator[](std::size_t idx) { Entry operator[](std::size_t idx) {
return Entry(*this, static_cast<VAddr>(idx)); return Entry(*this, static_cast<VAddr>(idx));
} }
@ -133,7 +132,7 @@ struct PageTable {
*/ */
std::array<PageType, PAGE_TABLE_NUM_ENTRIES> attributes; std::array<PageType, PAGE_TABLE_NUM_ENTRIES> attributes;
inline std::array<u8*, PAGE_TABLE_NUM_ENTRIES>& GetPointerArray() { std::array<u8*, PAGE_TABLE_NUM_ENTRIES>& GetPointerArray() {
return pointers.raw; return pointers.raw;
} }

View File

@ -385,7 +385,6 @@ void GeometryPipeline::serialize(Archive& ar, const unsigned int version) {
} // namespace Pica } // namespace Pica
BOOST_SERIALIZATION_ASSUME_ABSTRACT(Pica::GeometryPipelineBackend)
SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_Point) SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_Point)
SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_VariablePrimitive) SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_VariablePrimitive)
SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_FixedPrimitive) SERIALIZE_EXPORT_IMPL(Pica::GeometryPipeline_FixedPrimitive)

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <array> #include <array>
#include <boost/serialization/array.hpp>
#include <boost/serialization/split_member.hpp> #include <boost/serialization/split_member.hpp>
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/common_types.h" #include "common/common_types.h"