Assorted cleanup, UWP memory map fixes. PSPFlower runs in both 32-bit and 64-bit.

This commit is contained in:
Henrik Rydgard authored and Henrik Rydgård committed 2017-03-23 10:02:28 +01:00
1 parent c0f6a24a21
commit ff2b6b3fca
31 files changed
+258 -138

No files matched your search

+13 -2
View File
@@ -152,7 +152,10 @@ static bool Memory_TryBase(u32 flags) {
if (view.flags & MV_MIRROR_PREVIOUS) {
position = last_position;
}
#if PPSSPP_ARCH(64BIT)
#if PPSSPP_PLATFORM(UWP)
// For both 32-bit and 64-bit, we need to use address masking.
*(view.out_ptr) = (u8*)VirtualAllocFromApp(base + (view.virtual_address & MEMVIEW32_MASK), view.size, MEM_COMMIT, PAGE_READWRITE);
#elif PPSSPP_ARCH(64BIT)
*view.out_ptr = (u8*)g_arena.CreateView(
position, view.size, base + view.virtual_address);
if (!*view.out_ptr) {
@@ -177,7 +180,7 @@ static bool Memory_TryBase(u32 flags) {
}
return true;
#if !PPSSPP_PLATFORM(UWP)
bail:
// Argh! ERROR! Free what we grabbed so far so we can try again.
for (int j = 0; j <= i; j++) {
@@ -192,9 +195,16 @@ bail:
}
}
return false;
#endif
}
bool MemoryMap_Setup(u32 flags) {
#if PPSSPP_PLATFORM(UWP)
// We just grab all 256MB.
// We should be able to avoid COMMIT-ing here, TODO.
base = (u8*)VirtualAllocFromApp(0, 0x10000000, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
return true;
#else
// Figure out how much memory we need to allocate in total.
size_t total_mem = 0;
for (int i = 0; i < num_views; i++) {
@@ -242,6 +252,7 @@ bool MemoryMap_Setup(u32 flags) {
// Should return true...
return Memory_TryBase(flags);
#endif
}
void MemoryMap_Shutdown(u32 flags) {