From f2ccd1d6481adec88ecac4fc89d3fb21be906540 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 5 Mar 2017 02:21:25 +0100 Subject: [PATCH] Assorted Windows-on-ARM fixes --- Common/ArmCPUDetect.cpp | 7 +++++++ Common/MemoryUtil.cpp | 14 ++++++++++++-- Common/MsgHandler.cpp | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Common/ArmCPUDetect.cpp b/Common/ArmCPUDetect.cpp index c6de1abdb1..cb4992b466 100644 --- a/Common/ArmCPUDetect.cpp +++ b/Common/ArmCPUDetect.cpp @@ -208,6 +208,13 @@ void CPUInfo::Detect() #endif strcpy(brand_string, "Apple A"); num_cores = 2; +#elif PPSSPP_PLATFORM(UWP) + strcpy(brand_string, "Unknown"); + isVFP3 = true; + isVFP4 = false; + SYSTEM_INFO sysInfo; + GetSystemInfo(&sysInfo); + num_cores = sysInfo.dwNumberOfProcessors; #else // !PPSSPP_PLATFORM(IOS) strcpy(brand_string, "Unknown"); num_cores = 1; diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index b127a26b2b..9d33abfe0b 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -120,10 +120,10 @@ void *AllocateExecutableMemory(size_t size) { DWORD prot = PAGE_EXECUTE_READWRITE; if (PlatformIsWXExclusive()) prot = PAGE_READWRITE; + if (sys_info.dwPageSize == 0) + GetSystemInfo(&sys_info); #if defined(_M_X64) if ((uintptr_t)&hint_location > 0xFFFFFFFFULL) { - if (sys_info.dwPageSize == 0) - GetSystemInfo(&sys_info); size_t aligned_size = round_page(size); ptr = SearchForFreeMem(aligned_size); @@ -142,7 +142,11 @@ void *AllocateExecutableMemory(size_t size) { else #endif { +#if PPSSPP_PLATFORM(UWP) + ptr = VirtualAllocFromApp(0, size, MEM_RESERVE | MEM_COMMIT, prot); +#else ptr = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT, prot); +#endif } #else static char *map_hint = 0; @@ -202,9 +206,15 @@ void *AllocateExecutableMemory(size_t size) { void *AllocateMemoryPages(size_t size, uint32_t memProtFlags) { size = round_page(size); + if (sys_info.dwPageSize == 0) + GetSystemInfo(&sys_info); #ifdef _WIN32 uint32_t protect = ConvertProtFlagsWin32(memProtFlags); +#if PPSSPP_PLATFORM(UWP) + void* ptr = VirtualAllocFromApp(0, size, MEM_COMMIT, protect); +#else void* ptr = VirtualAlloc(0, size, MEM_COMMIT, protect); +#endif if (!ptr) PanicAlert("Failed to allocate raw memory"); #else diff --git a/Common/MsgHandler.cpp b/Common/MsgHandler.cpp index e63b981fcb..0ca54ecfec 100644 --- a/Common/MsgHandler.cpp +++ b/Common/MsgHandler.cpp @@ -15,8 +15,11 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "ppsspp_config.h" + #include "Common.h" // Local #include "StringUtils.h" +#include "base/logging.h" #include "util/text/utf8.h" #include @@ -76,6 +79,9 @@ bool MsgHandler(const char* caption, const char* text, bool yes_no, int Style) std::wstring wcaption = ConvertUTF8ToWString(caption); return IDYES == MessageBox(0, wtext.c_str(), wcaption.c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK)); +#elif PPSSPP_PLATFORM(UWP) + OutputDebugStringUTF8(text); + return true; #else printf("%s\n", text); return true;