diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 16:55:46 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 16:55:46 -0500 |
| commit | 4c52ce27a6cf4af2bbf07a343ede39c5f1572b8d (patch) | |
| tree | 434bb716af27e048d3279b48dacff23ed82e071d /runtime/shims/xmem.cpp | |
| parent | dac28e6b19c3f70ccd157d60d2e44f4f3f52995a (diff) | |
Seven fixes from an outside contributor (sent as patches, applied without the author's name)
- rdna2spirv: declare each packed vertex input register once; a register whose elements disagree on the component
type is refused (SHADER-644).
- runtime: a title's VirtualAlloc drops the console's MEM_GRAPHICS / MEM_TITLE type bits the host rejects (RT-217).
- runtime: XPersistentLocalStorageImpl is served from <overlay>\persistent with the package's 2048 MB quota
(RT-219; layout from the public docs, not measured in a caller).
- runtime: G:\ names the package and T:\ a scratch folder in the overlay; paths under the configured folders and
every path with no folders configured stay host paths (RT-218).
- winhttp_offline: header blocks and timeouts the host WinHTTP rejects are rejected the same way.
- cfg_structure.run: a limit of zero or less runs no blocks.
- shader_meta: an s_movk_i32 with a register operand and a float immediate beyond float32 are left unknown instead
of raising.
Each comes with a test that fails on the old code. Conflicts with main resolved here (internal_dir() hides T:'s
folder; both file_system_test blocks kept).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/xmem.cpp')
| -rw-r--r-- | runtime/shims/xmem.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/shims/xmem.cpp b/runtime/shims/xmem.cpp index 7d4a1bcfd..e925d3ee4 100644 --- a/runtime/shims/xmem.cpp +++ b/runtime/shims/xmem.cpp | |||
| @@ -179,8 +179,37 @@ UINT WINAPI XMemResetWriteWatch(void* base_address, SIZE_T region_size) { | |||
| 179 | return ResetWriteWatch(base_address, region_size); | 179 | return ResetWriteWatch(base_address, region_size); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | // kernel32!VirtualAlloc as a title calls it. The console's allocation type has two bits of its own, MEM_GRAPHICS | ||
| 183 | // (0x10000000, memory the GPU reads) and MEM_TITLE (0x40000000, the title's own heap). On a PC the host rejects both | ||
| 184 | // with ERROR_INVALID_PARAMETER (measured on Windows 11 26200: VirtualAlloc(NULL, 64 KiB, MEM_COMMIT | MEM_RESERVE | | ||
| 185 | // 0x10000000, PAGE_READWRITE) returns NULL; so does 0x40000000), so an engine allocating its heaps this way gets | ||
| 186 | // NULL at boot. Both are hints about where the memory lives; the host has no such split, so they are dropped and | ||
| 187 | // the rest is passed through. Not done: the console protection bits, and whether graphics memory has to come from | ||
| 188 | // an arena the D3D12 layer can see (#313). | ||
| 189 | constexpr DWORD kMemGraphics = 0x10000000; | ||
| 190 | constexpr DWORD kMemTitle = 0x40000000; | ||
| 191 | |||
| 192 | LPVOID WINAPI TitleVirtualAlloc(LPVOID address, SIZE_T size, DWORD allocation_type, DWORD protect) { | ||
| 193 | return VirtualAlloc(address, size, allocation_type & ~(kMemGraphics | kMemTitle), protect); | ||
| 194 | } | ||
| 195 | |||
| 182 | } // namespace | 196 | } // namespace |
| 183 | 197 | ||
| 198 | #define TITLE_VIRTUAL_ALLOC(dll) {dll, "VirtualAlloc", reinterpret_cast<void*>(&TitleVirtualAlloc)} | ||
| 199 | |||
| 200 | // The classic libraries and the memory api sets a title's imports name. | ||
| 201 | SHIM_TABLE(title_memory, | ||
| 202 | TITLE_VIRTUAL_ALLOC("kernel32.dll"), | ||
| 203 | TITLE_VIRTUAL_ALLOC("kernelbase.dll"), | ||
| 204 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-0.dll"), | ||
| 205 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-1.dll"), | ||
| 206 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-2.dll"), | ||
| 207 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-3.dll"), | ||
| 208 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-4.dll"), | ||
| 209 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-5.dll"), | ||
| 210 | TITLE_VIRTUAL_ALLOC("api-ms-win-core-memory-l1-1-6.dll"), | ||
| 211 | ); | ||
| 212 | |||
| 184 | SHIM_TABLE(xmem, | 213 | SHIM_TABLE(xmem, |
| 185 | {"xmem.dll", "XMemAlloc", reinterpret_cast<void*>(&XMemAlloc)}, | 214 | {"xmem.dll", "XMemAlloc", reinterpret_cast<void*>(&XMemAlloc)}, |
| 186 | {"xmem.dll", "XMemFree", reinterpret_cast<void*>(&XMemFree)}, | 215 | {"xmem.dll", "XMemFree", reinterpret_cast<void*>(&XMemFree)}, |