enhanced_polling_priority

This commit is contained in:
CrazyRedMachine 2023-07-29 12:27:43 +02:00
parent 8b105d1e50
commit e640b4c06e
3 changed files with 35 additions and 17 deletions

View File

@ -1,5 +1,14 @@
<?xml version='1.0' encoding='shift-jis'?>
<popnhax>
<!-- Databases -->
<!-- Enable database modifications (omnimix, custom tracks) -->
<patch_db __type="bool">0</patch_db>
<!-- Force unlock music, charts, and characters -->
<force_unlocks __type="bool">0</force_unlocks>
<!-- Force unlock deco parts (avoid using this on later games without deco) -->
<force_unlock_deco __type="bool">0</force_unlock_deco>
<!-- Classic patches -->
<!-- Prevent crash on boot when using a different default audio source (aka HDMI audio patch) -->
<audio_source_fix __type="bool">0</audio_source_fix>
@ -19,7 +28,6 @@
<!-- Stage management -->
<!-- Premium free (unlimited stages per credit) -->
<pfree __type="bool">0</pfree>
<!-- Press numpad 9 in song to retire instantly, or on result screen to leave game session (thank you for playing) -->
<!-- quick_retire with pfree also enables quick retry: hold numpad 7 to retry -->
<quick_retire __type="bool">0</quick_retire>
@ -31,7 +39,7 @@
<!-- Visual offset -->
<!-- Hidden+ setting (press 0 for advanced options) is now a visual offset adjust (negative means you have to hit earlier) -->
<hidden_is_offset __type="bool">0</hidden_is_offset>
<!-- Display offset adjust on score result screen (requires hidden_is_offset, won't be sent over network) -->
<!-- Display offset adjust value on score result screen (requires hidden_is_offset, won't be sent over network) -->
<show_offset __type="bool">0</show_offset>
<!-- Display fast/slow counter on result screen even on judge+ off/lost/panic -->
<show_fast_slow __type="bool">0</show_fast_slow>
@ -48,19 +56,6 @@
<!-- 1000Hz polling stats (display onscreen info to check performance on your system) -->
<enhanced_polling_stats __type="bool">0</enhanced_polling_stats>
<!-- Databases -->
<!-- Force unlock music, charts, and characters -->
<force_unlocks __type="bool">0</force_unlocks>
<!-- Force unlock deco parts (avoid using this on later games without deco) -->
<force_unlock_deco __type="bool">0</force_unlock_deco>
<!-- Enable database modifications (omnimix, custom tracks) -->
<patch_db __type="bool">0</patch_db>
<!-- Auto select patch file from data_mods folder (will detect datecode from ea3-config or force_datecode option) -->
<patch_xml_auto __type="bool">1</patch_xml_auto>
<!-- Manually set XML file containing patches (requires patch_xml_auto to be disabled) -->
<patch_xml_filename __type="str"></patch_xml_filename>
<!-- LCD mod on CRT cabs -->
<!-- HD timing for pcb_type=0 -->
<force_hd_timing __type="bool">0</force_hd_timing>
@ -92,8 +87,20 @@
<beam_brightness __type="s8">0</beam_brightness>
<!-- Disable the builtin frame limiter (faster/smoother animations at 120fps+) -->
<fps_uncap __type="bool">0</fps_uncap>
<!-- 1000Hz polling thread priority (for enhanced_polling only, might cause crashes on some systems if set too high)
values THREAD_PRIORITY_LOWEST -2
THREAD_PRIORITY_BELOW_NORMAL -1
THREAD_PRIORITY_NORMAL 0
THREAD_PRIORITY_ABOVE_NORMAL 1
THREAD_PRIORITY_HIGHEST 2
THREAD_PRIORITY_TIME_CRITICAL 15 -->
<enhanced_polling_priority __type="s8">0</enhanced_polling_priority>
<!-- Song db patches -->
<!-- Auto select patch file from data_mods folder (will detect datecode from ea3-config or force_datecode option) -->
<patch_xml_auto __type="bool">1</patch_xml_auto>
<!-- Manually set XML file containing patches (requires patch_xml_auto to be disabled) -->
<patch_xml_filename __type="str"></patch_xml_filename>
<!-- Force the newly created buffers to be the same size as the original buffers -->
<disable_expansions __type="bool">0</disable_expansions>
<!-- Copy the new table information over top the old tables (automatically enables disable_expansions) -->

View File

@ -41,6 +41,7 @@ struct popnhax_config {
bool enhanced_polling;
uint8_t debounce;
bool enhanced_polling_stats;
int8_t enhanced_polling_priority;
};
#endif

View File

@ -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;