mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 09:35:09 +02:00
Minor memory safety fixes
This commit is contained in:
@@ -222,6 +222,13 @@ void DeveloperToolsScreen::CreateTestsTab(UI::LinearLayout *list) {
|
||||
if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) {
|
||||
list->Add(new Choice(dev->T("GPU Driver Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnGPUDriverTest);
|
||||
}
|
||||
|
||||
auto memmapTest = list->Add(new Choice(dev->T("Memory map test")));
|
||||
memmapTest->OnClick.Add([this](UI::EventParams &e) {
|
||||
MemoryMapTest();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
memmapTest->SetEnabled(PSP_IsInited());
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::CreateDumpFileTab(UI::LinearLayout *list) {
|
||||
@@ -613,6 +620,18 @@ void DeveloperToolsScreen::update() {
|
||||
canAllowDebugger_ = !WebServerStopping(WebServerFlags::DEBUGGER);
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::MemoryMapTest() {
|
||||
int sum = 0;
|
||||
for (uint64_t addr = 0; addr < 0x100000000ULL; addr += 0x1000) {
|
||||
const u32 addr32 = (u32)addr;
|
||||
if (Memory::IsValidAddress(addr32)) {
|
||||
sum += Memory::ReadUnchecked_U32(addr32);
|
||||
}
|
||||
}
|
||||
// Just to force the compiler to do things properly.
|
||||
INFO_LOG(Log::JIT, "Total sum: %08x", sum);
|
||||
}
|
||||
|
||||
static bool RunMemstickTest(std::string *error) {
|
||||
Path testRoot = GetSysDirectory(PSPDirectories::DIRECTORY_CACHE) / "test";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user