mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-01 12:45:56 +00:00
Replaces the source-text guard with a runtime test that tracks the largest allocation and registers windows_entry_stub_bounds on every host. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
17 lines
507 B
C++
17 lines
507 B
C++
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <new>
|
|
|
|
namespace WindowsEntryStubAllocation {
|
|
std::size_t largest = 0;
|
|
}
|
|
|
|
void* operator new(std::size_t size) {
|
|
if (size > WindowsEntryStubAllocation::largest) WindowsEntryStubAllocation::largest = size;
|
|
if (void* memory = std::malloc(size == 0 ? 1 : size)) return memory;
|
|
throw std::bad_alloc();
|
|
}
|
|
|
|
void operator delete(void* memory) noexcept { std::free(memory); }
|
|
void operator delete(void* memory, std::size_t) noexcept { std::free(memory); }
|