Make the tests pass

This commit is contained in:
Hamish Milne 2020-01-05 13:26:16 +00:00 committed by zhupengfei
parent 65d96bf6c1
commit e4afa8e512
4 changed files with 25 additions and 20 deletions

View file

@ -91,15 +91,20 @@ public:
} }
private: private:
std::shared_ptr<BackingMem> backing_mem; std::shared_ptr<BackingMem> backing_mem = nullptr;
u32 offset; u32 offset = 0;
// Cached values for speed // Cached values for speed
u8* cptr; u8* cptr = nullptr;
u32 csize; u32 csize = 0;
void Init() { void Init() {
cptr = backing_mem->GetPtr() + offset; if (backing_mem) {
csize = static_cast<u32>(backing_mem->GetSize() - offset); cptr = backing_mem->GetPtr() + offset;
csize = static_cast<u32>(backing_mem->GetSize() - offset);
} else {
cptr = nullptr;
csize = 0;
}
} }
template <class Archive> template <class Archive>

View file

@ -214,8 +214,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
timing = std::make_unique<Timing>(); timing = std::make_unique<Timing>();
kernel = std::make_unique<Kernel::KernelSystem>( kernel = std::make_unique<Kernel::KernelSystem>(*memory, *timing,
*memory, *timing, [this] { PrepareReschedule(); }, system_mode); [this] { PrepareReschedule(); }, system_mode);
if (Settings::values.use_cpu_jit) { if (Settings::values.use_cpu_jit) {
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64

View file

@ -1352,8 +1352,7 @@ void Module::CheckAndUpdateFile(const CecDataPathType path_type, const u32 ncch_
case CecDataPathType::MboxData: case CecDataPathType::MboxData:
case CecDataPathType::MboxIcon: case CecDataPathType::MboxIcon:
case CecDataPathType::MboxTitle: case CecDataPathType::MboxTitle:
default: { default: {}
}
} }
} }

View file

@ -98,7 +98,7 @@ public:
std::shared_ptr<BackingMem> n3ds_extra_ram_mem; std::shared_ptr<BackingMem> n3ds_extra_ram_mem;
std::shared_ptr<BackingMem> dsp_mem; std::shared_ptr<BackingMem> dsp_mem;
MemorySystem::Impl(); Impl();
virtual u8* GetPtr(Region r) { virtual u8* GetPtr(Region r) {
switch (r) { switch (r) {
@ -157,16 +157,17 @@ private:
template <Region R> template <Region R>
class MemorySystem::BackingMemImpl : public BackingMem { class MemorySystem::BackingMemImpl : public BackingMem {
public: public:
BackingMemImpl() : system(Core::Global<Core::System>().Memory()) {} BackingMemImpl() : impl(*Core::Global<Core::System>().Memory().impl) {}
BackingMemImpl(MemorySystem::Impl& impl_) : impl(impl_) {}
virtual u8* GetPtr() { virtual u8* GetPtr() {
return system.impl->GetPtr(R); return impl.GetPtr(R);
} }
virtual u32 GetSize() const { virtual u32 GetSize() const {
return system.impl->GetSize(R); return impl.GetSize(R);
} }
private: private:
MemorySystem& system; MemorySystem::Impl& impl;
template <class Archive> template <class Archive>
void serialize(Archive& ar, const unsigned int) {} void serialize(Archive& ar, const unsigned int) {}
@ -174,10 +175,10 @@ private:
}; };
MemorySystem::Impl::Impl() MemorySystem::Impl::Impl()
: fcram_mem(std::make_shared<BackingMemImpl<Region::FCRAM>>()), : fcram_mem(std::make_shared<BackingMemImpl<Region::FCRAM>>(*this)),
vram_mem(std::make_shared<BackingMemImpl<Region::VRAM>>()), vram_mem(std::make_shared<BackingMemImpl<Region::VRAM>>(*this)),
n3ds_extra_ram_mem(std::make_shared<BackingMemImpl<Region::N3DS>>()), n3ds_extra_ram_mem(std::make_shared<BackingMemImpl<Region::N3DS>>(*this)),
dsp_mem(std::make_shared<BackingMemImpl<Region::DSP>>()) {} dsp_mem(std::make_shared<BackingMemImpl<Region::DSP>>(*this)) {}
MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {} MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {}
MemorySystem::~MemorySystem() = default; MemorySystem::~MemorySystem() = default;
@ -219,7 +220,7 @@ void MemorySystem::MapPages(PageTable& page_table, u32 base, u32 size, MemoryRef
} }
base += 1; base += 1;
if (memory != nullptr) if (memory != nullptr && memory.GetSize() > PAGE_SIZE)
memory += PAGE_SIZE; memory += PAGE_SIZE;
} }
} }