| 21 | } |
| 22 | |
| 23 | uint32_t StatAlloc::FrontendAllocateSlots(uint32_t NewSize) { |
| 24 | if (CurrentSize == MAX_STATS_SIZE || !UsingNTQueryPath) { |
| 25 | LogMan::Msg::DFmt("Ran out of slots. Can't allocate more"); |
| 26 | return CurrentSize; |
| 27 | } |
| 28 | |
| 29 | MEMORY_FEX_STATS_SHM_INFORMATION Info { |
| 30 | .shm_base = nullptr, |
| 31 | .map_size = std::min(CurrentSize * 2, MAX_STATS_SIZE), |
| 32 | .max_size = MAX_STATS_SIZE, |
| 33 | }; |
| 34 | size_t Length {}; |
| 35 | auto Result = NtQueryVirtualMemory(NtCurrentProcess(), nullptr, MemoryFexStatsShm, &Info, sizeof(Info), &Length); |
| 36 | if (!Result) { |
| 37 | CurrentSize = Info.map_size; |
| 38 | } |
| 39 | |
| 40 | return CurrentSize; |
| 41 | } |
| 42 | |
| 43 | StatAlloc::StatAlloc(FEXCore::SHMStats::AppType AppType) { |
| 44 | // Try wine+fex magic path. |