diff --git a/dist/popnhax/popnhax.xml b/dist/popnhax/popnhax.xml index efb3d18..f4e1a58 100644 --- a/dist/popnhax/popnhax.xml +++ b/dist/popnhax/popnhax.xml @@ -1,5 +1,14 @@ + + + 0 + + + 0 + + 0 + 0 @@ -19,7 +28,6 @@ 0 - 0 @@ -31,7 +39,7 @@ 0 - + 0 0 @@ -48,19 +56,6 @@ 0 - - - 0 - - 0 - - - 0 - - 1 - - - 0 @@ -92,8 +87,20 @@ 0 0 + + 0 + + 1 + + 0 diff --git a/popnhax/config.h b/popnhax/config.h index f635a6d..995fcb9 100644 --- a/popnhax/config.h +++ b/popnhax/config.h @@ -41,6 +41,7 @@ struct popnhax_config { bool enhanced_polling; uint8_t debounce; bool enhanced_polling_stats; + int8_t enhanced_polling_priority; }; #endif diff --git a/popnhax/dllmain.cc b/popnhax/dllmain.cc index 0aec683..dc03166 100644 --- a/popnhax/dllmain.cc +++ b/popnhax/dllmain.cc @@ -160,6 +160,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, debounce, "/popnhax/debounce") PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, enhanced_polling_stats, "/popnhax/enhanced_polling_stats") +PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_S8, struct popnhax_config, enhanced_polling_priority, + "/popnhax/enhanced_polling_priority") PSMAP_END enum BufferIndexes { @@ -1938,7 +1940,11 @@ static unsigned int __stdcall enhanced_polling_stats_proc(void *ctx) Sleep(500); } - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); + if (config.enhanced_polling_priority) + { + SetThreadPriority(GetCurrentThread(), config.enhanced_polling_priority); + fprintf(stderr, "[Enhanced polling] Thread priority set to %d\n", GetThreadPriority(GetCurrentThread())); + } uint32_t count = 0; uint32_t count_time = 0; @@ -2023,7 +2029,11 @@ static unsigned int __stdcall enhanced_polling_proc(void *ctx) Sleep(500); } - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); + if (config.enhanced_polling_priority) + { + SetThreadPriority(GetCurrentThread(), config.enhanced_polling_priority); + fprintf(stderr, "[Enhanced polling] Thread priority set to %d\n", GetThreadPriority(GetCurrentThread())); + } uint32_t curr_poll_time = 0; uint32_t prev_poll_time = 0;