give up qpc

This commit is contained in:
CrazyRedMachine 2023-07-20 17:47:47 +02:00
parent c98b1e6072
commit 64aef456fe

View File

@ -36,7 +36,8 @@ const char *g_config_fn = NULL;
FILE *g_log_fp = NULL;
#define DEBUG 1
#define DEBUG 0
#define POLLING_DEBUG 1
#if DEBUG == 1
double g_multiplier = 1.;
@ -1913,7 +1914,7 @@ bool g_enhanced_poll_ready = false;
int (*usbPadRead)(uint32_t*);
int (*usbPadReadLast)(unsigned char*);
#if DEBUG >=1
#if POLLING_DEBUG >=1
FILE *debug_fp;
#endif
@ -1922,7 +1923,7 @@ uint8_t g_debounce = 0;
int32_t g_button_state[9] = {0};
static unsigned int __stdcall enhanced_polling_proc(void *ctx)
{
#if DEBUG >=1
#if POLLING_DEBUG >=1
debug_fp = fopen("polling.log", "w");
#endif
HMODULE hinstLib = GetModuleHandleA("ezusb.dll");
@ -1944,27 +1945,24 @@ static unsigned int __stdcall enhanced_polling_proc(void *ctx)
}
uint32_t curr_time = 0;
#if DEBUG >= 1
uint32_t end_time = 0;
#if POLLING_DEBUG >= 1
uint32_t count = 0;
uint32_t count_time = timeGetTime();
#endif
while (g_enhanced_poll_ready)
{
__int64 time1 = 0, time2 = 0, freq = 0;
QueryPerformanceCounter((LARGE_INTEGER *) &time1);
QueryPerformanceFrequency((LARGE_INTEGER *)&freq);
curr_time = timeGetTime();
#if DEBUG >= 1
#if POLLING_DEBUG >= 1
if (count == 0)
{
count_time = timeGetTime();
count_time = curr_time;
}
#endif
uint32_t pad_bits;
//usbPadReadLast(history);
#if DEBUG == 2
#if POLLING_DEBUG == 2
fprintf(stderr, "history : ");
for (int i = 0; i<40; i++)
{
@ -2005,19 +2003,21 @@ static unsigned int __stdcall enhanced_polling_proc(void *ctx)
}
}
}
#if DEBUG >= 1
end_time = timeGetTime();
#if POLLING_DEBUG >= 1
count++;
if (count == 100000)
{
fprintf(debug_fp, "did 100000 iterations in %ld milliseconds\n", timeGetTime() - count_time);
fprintf(debug_fp, "did 100000 iterations in %u milliseconds\n", end_time - count_time);
count = 0;
}
fflush(debug_fp);
#endif
/* wait until a millisecond has elapsed */
do {
QueryPerformanceCounter((LARGE_INTEGER *) &time2);
} while((time2-time1) < 1000*freq/1000000);
while(end_time == curr_time) {
Sleep(0);
end_time = timeGetTime();
}
}
return 0;