KetamineAddict / freedom

osu! difficulty changer & bot
MIT License
2 stars 1 forks source link

Holdtime distribution #5

Open yuoyunie opened 5 months ago

yuoyunie commented 5 months ago

So, thanks to people from osureport I found out about a new method of detecting cheats (especially relax) Here is this site https://analyzer.assist.games There's a graph that's very sus for freedom image As it says it means time that you hold key on circle. Here it almost all time 0 ms when normaly(i think) its like 30-100 ms I tried add like std::this_thread::sleep_for(std::chrono::milliseconds(duration)); to imput but it cause lags in game Sadly im not that good at coding in c++ so maybe you can do this

yuoyunie commented 5 months ago

i made something that somehow works its very simple but i hope you can improve it and make better

this is new

#include <cstdlib>
 #include <ctime> 

    int generate_random_delay(int min_delay, int max_delay, int preferred_min, int preferred_max, double preferred_probability) {
    srand(time(NULL)); 

    int delay;
    if ((double)rand() / RAND_MAX < preferred_probability) {
        delay = preferred_min + rand() % (preferred_max - preferred_min + 1);
    }
    else {
        do {
            delay = min_delay + rand() % (max_delay - min_delay + 1);
        } while (delay >= preferred_min && delay <= preferred_max);
    }
    return delay;
   }

this is a modified

 void update_relax(Circle& circle, const int32_t audio_time)
   {
    static double keydown_time = 0.0;
    static double keyup_delay = 0.0;
    static double last_key_action_time = 0.0;
    static bool first_click = true;

    if (cfg_relax_lock)
    {
        calc_od_timing();

        auto current_time = audio_time + od_check_ms;
        auto valid_timing = current_time >= circle.start_time;
        auto mouse_pos = mouse_position();
        Vector2 screen_pos = playfield_to_screen(circle.position);
        auto scalar_dist = sqrt((mouse_pos.x - screen_pos.x) * (mouse_pos.x - screen_pos.x) + (mouse_pos.y - screen_pos.y) * (mouse_pos.y - screen_pos.y));

        if (valid_timing)
        {
            if (!circle.clicked)
            {
                if (first_click || (ImGui::GetTime() - last_key_action_time) >= 0.3)
                {
                    current_click = right_click[0];
                    first_click = false;
                }
                else if (cfg_relax_style == 'a')
                {
                    current_click = current_click == left_click[0] ? right_click[0] : left_click[0];
                }

                if (circle.type == HitObjectType::Slider || circle.type == HitObjectType::Spinner)
                {
                    keyup_delay = (circle.end_time ? circle.end_time - circle.start_time : 0.5) + (generate_random_delay(20, 80, 30, 50, 0.8)) / 2;
                }
                else
                {
                    keyup_delay = (circle.end_time ? circle.end_time - circle.start_time : 0.5) + (generate_random_delay(20, 80, 30, 50, 0.8));
                }
                send_keyboard_input(current_click, 0);
                FR_INFO("Relax hit %d!, %d %d", current_beatmap.hit_object_idx, circle.start_time, circle.end_time);
                keydown_time = ImGui::GetTime();

                if (cfg_timewarp_enabled)
                {
                    double timewarp_playback_rate_div_100 = cfg_timewarp_playback_rate / 100.0;
                    keyup_delay /= timewarp_playback_rate_div_100;
                }
                else if (circle.type == HitObjectType::Slider or circle.type == HitObjectType::Spinner)
                {
                    if (current_beatmap.mods & Mods::DoubleTime)
                        keyup_delay /= 1.5;
                    else if (current_beatmap.mods & Mods::HalfTime)
                        keyup_delay /= 0.75;
                }
                last_key_action_time = ImGui::GetTime();
                circle.clicked = true;
                od_check_ms = .0f;

                key_press_times.push_back(std::chrono::steady_clock::now());
            }
        }
    }
    if (cfg_relax_lock && keydown_time && ((ImGui::GetTime() - keydown_time) * 1000.0 > keyup_delay))
    {
        send_keyboard_input(current_click, KEYEVENTF_KEYUP); 
        keydown_time = 0.0; 
    }
}

so it makes holdtime distribution in the range of 20-80 ms with a priority range of 30-50 ms with a 80% i think you could make it customizable also

here is how it looks image

GamebP commented 5 months ago

👍 Would like to see this be released in next update

KetamineAddict commented 5 days ago

Yea this is on the list as well Will add when i update