Simplify mapping code

This commit is contained in:
tomcw 2024-03-29 22:02:36 +00:00
parent 578271ea8a
commit 443d9cad10

View File

@ -1548,16 +1548,15 @@ static LPBYTE AllocMemImage(void)
if (res)
{
res = false;
const UINT num64KRegions = 2;
UINT retry = 10;
do
{
res = false;
const UINT num64KRegions = 2;
const SIZE_T totalVirtualSize = _6502_MEM_LEN * num64KRegions;
baseAddr = (LPBYTE)VirtualAlloc(0, totalVirtualSize, MEM_RESERVE, PAGE_NOACCESS);
if (baseAddr)
{
if (baseAddr == NULL)
break;
VirtualFree(baseAddr, 0, MEM_RELEASE);
// Create a file mapping object of [64K] size that is backed by the system paging file.
@ -1583,7 +1582,6 @@ static LPBYTE AllocMemImage(void)
// Failed this time, so clean-up and retry...
FreeMemImage();
}
}
while (retry--);
#if 1