mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 23:37:46 -04:00
(Win32) Works now with Win32 Mingw - had to implement mmap implementation
with malloc and mfree with free
This commit is contained in:
parent
e8b6193660
commit
51e4662411
1 changed files with 2 additions and 12 deletions
|
@ -78,17 +78,7 @@ void* mmap(void *desired_addr,
|
||||||
HANDLE fd,
|
HANDLE fd,
|
||||||
size_t off)
|
size_t off)
|
||||||
{
|
{
|
||||||
HANDLE fmh;
|
return malloc(len);
|
||||||
void *base_addr;
|
|
||||||
SECURITY_ATTRIBUTES sa;
|
|
||||||
sa.nLength = sizeof(sa);
|
|
||||||
sa.lpSecurityDescriptor = NULL;
|
|
||||||
sa.bInheritHandle = TRUE;
|
|
||||||
fmh = CreateFileMapping(fd, &sa, PAGE_WRITECOPY , 0, len, NULL);
|
|
||||||
if (fmh == NULL){ return NULL; }
|
|
||||||
base_addr = MapViewOfFileEx(fmh, FILE_MAP_WRITE|FILE_MAP_READ, 0, off, len, desired_addr);
|
|
||||||
CloseHandle(fmh);
|
|
||||||
return base_addr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void munmap(
|
void munmap(
|
||||||
|
@ -96,7 +86,7 @@ void munmap(
|
||||||
size_t len
|
size_t len
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(base_addr);
|
free(base_addr);
|
||||||
}
|
}
|
||||||
#define MAP_FAILED 0
|
#define MAP_FAILED 0
|
||||||
#define PROT_READ 0
|
#define PROT_READ 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue