mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Implemented querying file size on POSIX. Also fixed size rounding of mmap() on POSIX.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@321 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fdf02ce331
commit
8e69d942e9
@ -108,7 +108,8 @@ bool CMappedFile::Open(const char* filename)
|
||||
size = (u64)low | ((u64)high << 32);
|
||||
#elif POSIX
|
||||
fd = open(filename, O_RDONLY);
|
||||
size = 0; //TODO
|
||||
size = lseek(fd, 0, SEEK_END);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
#endif
|
||||
|
||||
return(true);
|
||||
@ -167,7 +168,7 @@ u8* CMappedFile::Lock(u64 offset, u64 size)
|
||||
{
|
||||
u64 realOffset = offset & ~(granularity - 1);
|
||||
s64 difference = offset - realOffset;
|
||||
u64 fake_size = ((offset & 4095) + size + 4095) & 4095;
|
||||
u64 fake_size = (difference + size + granularity - 1) & ~(granularity - 1);
|
||||
#ifdef _WIN32
|
||||
u8* realPtr = (u8*)MapViewOfFile(hFileMapping, FILE_MAP_READ, (DWORD)(realOffset >> 32), (DWORD)realOffset, (SIZE_T)(size));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user