mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
refactor: move carrier plugins around
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
/* Busy sleep with time register
|
||||
|
||||
This function will busy sleep for the given amount of time.
|
||||
It uses the kernel time register, which is not affected by
|
||||
the sleep function (memory address 0x7ffe0004).
|
||||
|
||||
This may defeat the AV emulator (maximum time).
|
||||
*/
|
||||
|
||||
int get_time_raw() {
|
||||
ULONG* PUserSharedData_TickCountMultiplier = (PULONG)0x7ffe0004;
|
||||
LONG* PUserSharedData_High1Time = (PLONG)0x7ffe0324;
|
||||
ULONG* PUserSharedData_LowPart = (PULONG)0x7ffe0320;
|
||||
DWORD kernelTime = (*PUserSharedData_TickCountMultiplier) * (*PUserSharedData_High1Time << 8) +
|
||||
((*PUserSharedData_LowPart) * (unsigned __int64)(*PUserSharedData_TickCountMultiplier) >> 24);
|
||||
return kernelTime;
|
||||
}
|
||||
|
||||
|
||||
int sleep_ms(DWORD sleeptime) {
|
||||
DWORD start = get_time_raw();
|
||||
while (get_time_raw() - start < sleeptime) {}
|
||||
}
|
||||
|
||||
|
||||
void antiemulation() {
|
||||
sleep_ms(3000);
|
||||
}
|
||||
Reference in New Issue
Block a user