New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemArena: Use memory placeholders for fastmem on Windows to ensure nothing allocates within the fastmem space. #9544
MemArena: Use memory placeholders for fastmem on Windows to ensure nothing allocates within the fastmem space. #9544
Conversation
5f522e4
to
d20a699
Compare
|
Alright, I think I'm at a point where I want some external input on this. Lemme have it. And for reference, yes, this does appear to fix at least one variant of the large texture pack issue. Though it's hard to say exactly due to the sporadic nature of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something for later, it doesn't seem like many class methods with #ifdef in them share code, would it make sense to split the class into OS-specific implementations rather than having everything in the same implementation?
f5a13f3
to
4a70d11
Compare
4a70d11
to
40fba31
Compare
|
Okay, I've updated this:
As far as I'm concerned, this is done now, but it still needs testing on an old Windows system that does not have VirtualAlloc2 and MapViewOfFile3. A Linux and Android implementation of a similar thing would also be good, but I'd leave that to a followup PR if that's okay. |
40fba31
to
483b1bb
Compare
483b1bb
to
1587f3a
Compare
1587f3a
to
6daf5df
Compare
6daf5df
to
e953ee1
Compare
e953ee1
to
25e0a91
Compare
25e0a91
to
cf2813d
Compare
cf2813d
to
c1efc0a
Compare
|
I've asked a few people with the issue with texture packs to use this build and every one of them has had success in resolving the issue. They were all modern windows users though. EDIT: I'll check if this works with Windows 7 |
c1efc0a
to
f336131
Compare
|
Apart from my comments above, the first two commits look good. I don't know enough about the Windows API to say that the 3rd commit is good, but nothing seems wrong with it either. |
f336131
to
888f05b
Compare
|
Appreciate it. |
754ef77
to
84fe882
Compare
b622417
to
5389cfb
Compare
5389cfb
to
69ef844
Compare
5c6c2aa
to
0586b2f
Compare
0586b2f
to
79405de
Compare
|
This has been sitting for a very long time and no one else has reviewed it. Some of the most popular modern texture packs, like the Wind Waker Hytapia one. I continue to see people on the unofficial discord running into this crash, so I think it's about time that we merged it. I'll leave this for a few more hours to give people a chance, but if no one speaks up that they plan on reviewing it, I'll just merge. Performance shouldn't be lower, and games seem to crash less. |
|
Much appreciated. |
"I'll check if this works with Windows 7" Minimum supported client | Windows 8 (https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-unmapviewoffileex) |

This allocates and handles our fastmem address region as a placeholder on Windows. This avoids the possibility that something else allocates memory within the fastmem address region after it has been set up.
This should fix the bug (on Windows at least) where large texture packs break emulation, such as 12404 or 11994, but I cannot 100% confirm it.
References:
Test code
Docs on VirtualAlloc2
Docs on VirtualFree
Docs on MapViewOfFile3
Docs on UnmapViewOfFileEx