forked from Popn_Tools/popnhax
Compare commits
4 Commits
main
...
wip_pollin
Author | SHA1 | Date | |
---|---|---|---|
d4f47bf9b4 | |||
98ba8de780 | |||
5eacda584e | |||
2f9d25df05 |
@ -44,6 +44,7 @@ struct popnhax_config {
|
||||
uint8_t debounce;
|
||||
bool enhanced_polling_stats;
|
||||
int8_t enhanced_polling_priority;
|
||||
uint32_t enhanced_polling_nb_iter;
|
||||
uint8_t hispeed_auto;
|
||||
uint16_t hispeed_default_bpm;
|
||||
uint8_t survival_gauge;
|
||||
|
@ -166,6 +166,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, translation_de
|
||||
"/popnhax/translation_debug")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, enhanced_polling,
|
||||
"/popnhax/enhanced_polling")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U32, struct popnhax_config, enhanced_polling_nb_iter,
|
||||
"/popnhax/enhanced_polling_nb_iter")
|
||||
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,
|
||||
@ -2202,6 +2204,20 @@ static bool patch_add_to_base_offset(int8_t delta) {
|
||||
bool g_enhanced_poll_ready = false;
|
||||
int (*usbPadRead)(uint32_t*);
|
||||
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
static uint32_t __inline wait_a_little(uint32_t nb_iter)
|
||||
{
|
||||
uint32_t j=0;
|
||||
for (uint32_t i=0; i<nb_iter; i++)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
return timeGetTime();
|
||||
}
|
||||
#pragma GCC pop_options
|
||||
|
||||
uint32_t g_poll_rate_avg = 0;
|
||||
uint32_t g_last_button_state = 0;
|
||||
uint8_t g_debounce = 0;
|
||||
@ -2239,14 +2255,16 @@ static unsigned int __stdcall enhanced_polling_stats_proc(void *ctx)
|
||||
/* ensure at least 1ms has elapsed between polls
|
||||
* (beware of SD cab hardware compatibility)
|
||||
*/
|
||||
|
||||
curr_poll_time = timeGetTime();
|
||||
if (curr_poll_time == prev_poll_time)
|
||||
{
|
||||
curr_poll_time++;
|
||||
Sleep(1);
|
||||
}
|
||||
prev_poll_time = curr_poll_time;
|
||||
|
||||
{
|
||||
do {
|
||||
curr_poll_time = wait_a_little(config.enhanced_polling_nb_iter);
|
||||
while (curr_poll_time == prev_poll_time);
|
||||
}
|
||||
prev_poll_time = curr_poll_time;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
count_time = curr_poll_time;
|
||||
|
Loading…
Reference in New Issue
Block a user