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:
std::shared_ptr<BackingMem> backing_mem;
u32 offset;
std::shared_ptr<BackingMem> backing_mem = nullptr;
u32 offset = 0;
// Cached values for speed
u8* cptr;
u32 csize;
u8* cptr = nullptr;
u32 csize = 0;
void Init() {
cptr = backing_mem->GetPtr() + offset;
csize = static_cast<u32>(backing_mem->GetSize() - offset);
if (backing_mem) {
cptr = backing_mem->GetPtr() + offset;
csize = static_cast<u32>(backing_mem->GetSize() - offset);
} else {
cptr = nullptr;
csize = 0;
}
}
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>();
kernel = std::make_unique<Kernel::KernelSystem>(
*memory, *timing, [this] { PrepareReschedule(); }, system_mode);
kernel = std::make_unique<Kernel::KernelSystem>(*memory, *timing,
[this] { PrepareReschedule(); }, system_mode);
if (Settings::values.use_cpu_jit) {
#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::MboxIcon:
case CecDataPathType::MboxTitle:
default: {
}
default: {}
}
}

View file

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