From 6bca3a8c050819be4fabae09fe98cb470c995d52 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Mon, 4 Oct 2021 07:04:26 +0200 Subject: [PATCH] early-access version 2105 --- README.md | 2 +- src/core/memory.cpp | 6 +++++- src/yuzu/main.cpp | 39 --------------------------------------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index b73995abe..0562f5080 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2104. +This is the source code for early-access 2105. ## Legal Notice diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 51c4dea26..88d6ec908 100755 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -587,7 +587,11 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) { bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { const Kernel::KProcess& process = *system.CurrentProcess(); const auto& page_table = process.PageTable().PageTableImpl(); - const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType(); + const size_t page = vaddr >> PAGE_BITS; + if (page >= page_table.pointers.size()) { + return false; + } + const auto [pointer, type] = page_table.pointers[page].PointerType(); return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 389851f37..552c2cc63 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -59,7 +59,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include #include #include -#include #include #include #include @@ -3458,41 +3457,6 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { #undef main #endif -static void SetHighDPIAttributes(int argc, char* argv[]) { - // Create a temporary QApplication as a workaround to get the current screen geometry. - QApplication* temp_app = new QApplication(argc, argv); - - const QScreen* primary_screen = temp_app->primaryScreen(); - const QRect screen_rect = primary_screen->geometry(); - const int real_width = screen_rect.width(); - const int real_height = screen_rect.height(); - const float real_ratio = primary_screen->logicalDotsPerInch() / 96.0f; - - delete temp_app; - - // Recommended minimum width and height for proper window fit. - // Any screen with a lower resolution than this will still have a scale of 1. - constexpr float minimum_width = 1350.0f; - constexpr float minimum_height = 900.0f; - - const float width_ratio = std::max(1.0f, real_width / minimum_width); - const float height_ratio = std::max(1.0f, real_height / minimum_height); - - // Get the lower of the 2 ratios and truncate, this is the maximum integer scale. - const float max_ratio = std::trunc(std::min(width_ratio, height_ratio)); - - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); - - if (max_ratio > real_ratio) { - QApplication::setHighDpiScaleFactorRoundingPolicy( - Qt::HighDpiScaleFactorRoundingPolicy::Round); - } else { - QApplication::setHighDpiScaleFactorRoundingPolicy( - Qt::HighDpiScaleFactorRoundingPolicy::Floor); - } -} - int main(int argc, char* argv[]) { Common::DetachedTasks detached_tasks; MicroProfileOnThreadCreate("Frontend"); @@ -3525,11 +3489,8 @@ int main(int argc, char* argv[]) { } #endif - SetHighDPIAttributes(argc, argv); - // Enables the core to make the qt created contexts current on std::threads QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); - QApplication app(argc, argv); // Qt changes the locale and causes issues in float conversion using std::to_string() when