Skip to content

Commit

Permalink
relax, aimbot, window improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciremun committed Jan 30, 2024
1 parent 934405c commit 9759cd9
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 43 deletions.
2 changes: 1 addition & 1 deletion freedom/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bool cfg_flashlight_enabled = false;
bool cfg_timewarp_enabled = false;
double cfg_timewarp_playback_rate = 200.0;
bool cfg_relax_checks_od = true;
bool cfg_jumping_window = true;
bool cfg_jumping_window = false;
bool cfg_relax_lock = false;
bool cfg_aimbot_lock = false;
bool cfg_hidden_remover_enabled = false;
Expand Down
2 changes: 2 additions & 0 deletions freedom/dll/dll_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ HRESULT __stdcall d3d9_update(IDirect3DDevice9 *pDevice)
{
init = true;

srand(time(NULL));
g_process = GetCurrentProcess();
g_d3d9_device = pDevice;

Expand All @@ -96,6 +97,7 @@ __declspec(naked) void opengl_update()
{
init = true;

srand(time(NULL));
g_process = GetCurrentProcess();
g_hwnd = WindowFromDC(wglGetCurrentDC());

Expand Down
1 change: 1 addition & 0 deletions freedom/features/aimbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void update_aimbot(Circle &circle, const int32_t audio_time)
uintptr_t hit_objects_list_ptr = *(uintptr_t *)(hit_manager_ptr + OSU_HIT_MANAGER_HIT_OBJECTS_LIST_OFFSET);
uintptr_t hit_objects_list_items_ptr = *(uintptr_t *)(hit_objects_list_ptr + 0x4);
uintptr_t hit_object_ptr = *(uintptr_t *)(hit_objects_list_items_ptr + 0x8 + 0x4 * current_beatmap.hit_object_idx);
if (!hit_object_ptr) return;
uintptr_t animation_ptr = *(uintptr_t *)(hit_object_ptr + OSU_HIT_OBJECT_ANIMATION_OFFSET);
float slider_ball_x = *(float *)(animation_ptr + OSU_ANIMATION_SLIDER_BALL_X_OFFSET);
float slider_ball_y = *(float *)(animation_ptr + OSU_ANIMATION_SLIDER_BALL_Y_OFFSET);
Expand Down
18 changes: 4 additions & 14 deletions freedom/features/relax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ float od_check_ms = .0f;

float jumping_window_offset = .0f;

int wait_hitobjects_min = 10;
int wait_hitobjects_max = 25;

bool debug_relax = false;
int wait_hitobjects_min = 2;
int wait_hitobjects_max = 5;

static char current_click = cfg_relax_style == 'a' ? right_click[0] : left_click[0];

Expand Down Expand Up @@ -73,17 +71,9 @@ void update_relax(Circle &circle, const int32_t audio_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));
auto valid_position = scalar_dist <= current_beatmap.scaled_hit_object_radius;

if (debug_relax)
{
ImGui::GetBackgroundDrawList()->AddCircleFilled(
ImVec2(screen_pos.x, screen_pos.y),
current_beatmap.scaled_hit_object_radius,
ImColor( 0, 255, 255, 100 ) );
}
// auto valid_position = scalar_dist <= current_beatmap.scaled_hit_object_radius;

if (valid_timing /* && valid_position */)
if (valid_timing)
{
if (!circle.clicked)
{
Expand Down
10 changes: 7 additions & 3 deletions freedom/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ void init_input()
FR_INFO_FMT("Left Click: %c", left_click[0]);
FR_INFO_FMT("Right Click: %c", right_click[0]);

primary_monitor.x = (float)GetSystemMetrics(SM_CXSCREEN);
primary_monitor.y = (float)GetSystemMetrics(SM_CYSCREEN);
if (!calc_playfield_from_window())
calc_playfield_manual(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
calc_playfield_manual(primary_monitor.x, primary_monitor.y);
}

void send_keyboard_input(char wVk, DWORD dwFlags)
Expand All @@ -46,10 +48,12 @@ void send_keyboard_input(char wVk, DWORD dwFlags)

void move_mouse_to(int x, int y)
{
x += client_offset.x;
y += client_offset.y;
INPUT inputs[1];
inputs[0].type = INPUT_MOUSE;
inputs[0].mi.dx = (x * (0xFFFF / window_size.x));
inputs[0].mi.dy = (y * (0xFFFF / window_size.y));
inputs[0].mi.dx = (x * (0xFFFF / primary_monitor.x));
inputs[0].mi.dy = (y * (0xFFFF / primary_monitor.y));
inputs[0].mi.mouseData = 0;
inputs[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
inputs[0].mi.time = 0;
Expand Down
17 changes: 17 additions & 0 deletions freedom/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ bool parse_beatmap(uintptr_t osu_manager_ptr, BeatmapData &beatmap_data)
// return false;
// }

calc_playfield_from_window();

uintptr_t hit_manager_ptr = *(uintptr_t *)(osu_manager + OSU_MANAGER_HIT_MANAGER_OFFSET);
uintptr_t hit_objects_list_ptr = *(uintptr_t *)(hit_manager_ptr + OSU_HIT_MANAGER_HIT_OBJECTS_LIST_OFFSET);
uintptr_t hit_objects_list_items_ptr = *(uintptr_t *)(hit_objects_list_ptr + 0x4);
Expand Down Expand Up @@ -111,6 +113,19 @@ bool parse_beatmap(uintptr_t osu_manager_ptr, BeatmapData &beatmap_data)
if (beatmap_data.mods & Mods::DoubleTime) od_window *= 0.67f;
else if (beatmap_data.mods & Mods::HalfTime) od_window *= 1.33f;

// FIXME(Ciremun): refactor
static const auto rand_range_f = [](float f_min, float f_max) -> float
{
float scale = rand() / (float)RAND_MAX;
return f_min + scale * (f_max - f_min);
};

extern float od_window_left_offset;
extern float od_window_right_offset;
srand(time(NULL));
od_window_left_offset = -(od_window * rand_range_f(0.35f, 0.65f));
od_window_right_offset = od_window * rand_range_f(0.15f, 0.85f);

beatmap_data.ready = true;
return true;
}
Expand Down Expand Up @@ -182,6 +197,8 @@ bool parse_replay(uintptr_t selected_replay_ptr, ReplayData &replay)
if (!replay_beatmap_name(replay.song_name_u8))
memcpy(replay.song_name_u8, "Unknown Beatmap", sizeof("Unknown Beatmap"));

calc_playfield_from_window();

uintptr_t author_str_obj = *(uintptr_t *)(selected_replay_ptr + OSU_REPLAY_AUTHOR_OFFSET);
uint32_t author_str_length = *(uint32_t *)(author_str_obj + 0x4);
wchar_t *author_str = (wchar_t *)(author_str_obj + 0x8);
Expand Down
13 changes: 7 additions & 6 deletions freedom/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ static void scan_for_code_starts()
nt_user_send_input_dispatch_table_id_found = true;
if (all_code_starts_found())
{
FR_INFO_FMT("Memory Scan Took: %lfs", ImGui::GetTime() - s);
memory_scan_progress = 1.f;
return;
}
Expand Down Expand Up @@ -272,12 +273,12 @@ static void try_find_hook_offsets()
}
});
}
// if (window_manager_code_start)
// {
// window_manager_offset = pattern::find<window_manager_sig>({ (uint8_t *)window_manager_code_start, 0xC0A + 0x50});
// if (window_manager_offset)
// window_manager_ptr = *(uintptr_t *)(window_manager_offset + window_manager_sig.size());
// }
if (window_manager_code_start)
{
window_manager_offset = pattern::find<window_manager_sig>({ (uint8_t *)window_manager_code_start, 0x55});
if (window_manager_offset)
window_manager_ptr = *(uintptr_t *)(window_manager_offset + 0x2);
}

if (score_multiplier_code_start)
{
Expand Down
14 changes: 10 additions & 4 deletions freedom/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,13 @@ void update_ui()
if (ImGui::Checkbox("Variable Unstable Rate", &cfg_relax_checks_od))
ImGui::SaveIniSettingsToDisk(ImGui::GetIO().IniFilename);
ImGui::Dummy(ImVec2(.0f, 5.f));
ImGui::Checkbox("Debug", &debug_relax);
bool relax_checks_od = cfg_relax_checks_od;
if (!relax_checks_od)
ImGui::BeginDisabled();
if (ImGui::Checkbox("Jumping Unstable Rate Window", &cfg_jumping_window))
ImGui::SaveIniSettingsToDisk(ImGui::GetIO().IniFilename);
if (!relax_checks_od)
ImGui::EndDisabled();
}
if (selected_tab == MenuTab::Aimbot)
{
Expand Down Expand Up @@ -603,13 +609,13 @@ void update_ui()
}
if (ImGui::CollapsingHeader("Hook Jumps", ImGuiTreeNodeFlags_None))
{
colored_if_null("Discord Rich Presence: %08X", discord_rich_presence_jump_back);
colored_if_null("AR Hook: %08X", ar_hook_jump_back);
colored_if_null("CS Hook: %08X", cs_hook_jump_back);
colored_if_null("OD Hook: %08X", od_hook_jump_back);
colored_if_null("Discord Rich Presence: %08X", discord_rich_presence_jump_back);
colored_if_null("Beatmap Onload: %08X", beatmap_onload_hook_jump_back);
colored_if_null("Check Timewarp 1: %08X", check_timewarp_hook_1_jump_back);
colored_if_null("Check Timewarp 2: %08X", check_timewarp_hook_2_jump_back);
colored_if_null("CS Hook: %08X", cs_hook_jump_back);
colored_if_null("OD Hook: %08X", od_hook_jump_back);
colored_if_null("Score Multiplier: %08X", score_multiplier_hook_jump_back);
colored_if_null("Selected Replay: %08X", selected_replay_hook_jump_back);
colored_if_null("Set Playback Rate: %08X", set_playback_rate_jump_back);
Expand Down
17 changes: 9 additions & 8 deletions freedom/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ uintptr_t window_manager_ptr = 0;
Vector2<float> window_size(.0f, .0f);
Vector2<float> playfield_size(.0f, .0f);
Vector2<float> playfield_position(.0f, .0f);
Vector2<float> client_offset(.0f, .0f);
Vector2<float> primary_monitor(.0f, .0f);

float window_ratio = .0f;
float playfield_ratio = .0f;
Expand All @@ -32,13 +34,12 @@ bool calc_playfield_from_window()
if (!window_manager)
return false;

uintptr_t window_size_ptr = *(uintptr_t *)(window_manager + 0x4);
window_size.x = (float)(*(uint32_t *)(window_size_ptr + 0x4));
window_size.y = (float)(*(uint32_t *)(window_size_ptr + 0x8));
playfield_size.x = *(float *)(window_manager + 0x8);
playfield_size.y = *(float *)(window_manager + 0xC);
playfield_position.x = *(float *)(window_manager + 0x18);
playfield_position.y = *(float *)(window_manager + 0x1C);
playfield_ratio = playfield_size.y / 384.0f;
primary_monitor.x = (float)GetSystemMetrics(SM_CXSCREEN);
primary_monitor.y = (float)GetSystemMetrics(SM_CYSCREEN);
client_offset.x = (float)(*(int32_t *)(window_manager + 0x4));
client_offset.y = (float)(*(int32_t *)(window_manager + 0x8));
calc_playfield_manual((float)(*(int32_t *)(window_manager + 0xC)),
(float)(*(int32_t *)(window_manager + 0x10)));

return true;
}
6 changes: 3 additions & 3 deletions include/baked_utils_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ static const unsigned int utils_dll_data[8704/4] =
{
0x00905a4d, 0x00000003, 0x00000004, 0x0000ffff, 0x000000b8, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x0eba1f0e, 0xcd09b400, 0x4c01b821, 0x685421cd, 0x70207369, 0x72676f72, 0x63206d61, 0x6f6e6e61,
0x65622074, 0x6e757220, 0x206e6920, 0x20534f44, 0x65646f6d, 0x0a0d0d2e, 0x00000024, 0x00000000, 0x00004550, 0x0003014c, 0x65b83a2b, 0x00000000,
0x65622074, 0x6e757220, 0x206e6920, 0x20534f44, 0x65646f6d, 0x0a0d0d2e, 0x00000024, 0x00000000, 0x00004550, 0x0003014c, 0x65b98208, 0x00000000,
0x00000000, 0x202200e0, 0x0030010b, 0x00001a00, 0x00000600, 0x00000000, 0x0000394e, 0x00002000, 0x00004000, 0x10000000, 0x00002000, 0x00000200,
0x00000004, 0x00000000, 0x00000004, 0x00000000, 0x00008000, 0x00000200, 0x00000000, 0x85400003, 0x00100000, 0x00001000, 0x00100000, 0x00001000,
0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x000038fc, 0x0000004f, 0x00004000, 0x00000298, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
Expand Down Expand Up @@ -134,8 +134,8 @@ static const unsigned int utils_dll_data[8704/4] =
0x00550066, 0x00420042, 0x00680075, 0x005a0047, 0x00480024, 0x005a0079, 0x004c0030, 0x006e0041, 0x00510066, 0x003d003d, 0x00232f00, 0x007a003d,
0x0024006e, 0x004d004b, 0x004f0038, 0x00420050, 0x00560033, 0x00330044, 0x00450045, 0x00680051, 0x00410058, 0x003d003d, 0x00231700, 0x007a003d,
0x005f0072, 0x0035005f, 0x00300054, 0x003d006f, 0x00233f00, 0x007a003d, 0x00300045, 0x00440056, 0x0066005a, 0x004a0077, 0x00480045, 0x007a0033,
0x00440036, 0x00580033, 0x00710047, 0x0054006d, 0x0044006b, 0x00460052, 0x0077006b, 0x00470066, 0x00000100, 0x9d1432db, 0x49322d18, 0xc973c39d,
0xb3fbfadd, 0x01200400, 0x20030801, 0x20050100, 0x11110101, 0x01012005, 0x07041d11, 0x04311101, 0x59120000, 0x12012005, 0x20050e35, 0x0e391201,
0x00440036, 0x00580033, 0x00710047, 0x0054006d, 0x0044006b, 0x00460052, 0x0077006b, 0x00470066, 0x00000100, 0xb3d15345, 0x48fa0b27, 0xd582028b,
0xc34a44cd, 0x01200400, 0x20030801, 0x20050100, 0x11110101, 0x01012005, 0x07041d11, 0x04311101, 0x59120000, 0x12012005, 0x20050e35, 0x0e391201,
0x11002004, 0x00200331, 0x01000418, 0x07061808, 0x112d1102, 0x1215072d, 0x110e0229, 0x0120052d, 0x06001302, 0x01130120, 0x00050013, 0x08181802,
0x11020007, 0x65111c2d, 0x01022007, 0x01130013, 0x11010704, 0x0307082d, 0x0824111d, 0x20032411, 0x20030e00, 0x070e0800, 0x113d1106, 0x113d113d,
0x41121d3d, 0x00200408, 0x20043d11, 0x04511100, 0x35120020, 0x02020007, 0x35123512, 0x1d002005, 0x07154112, 0x121d080a, 0x35120835, 0x0839121d,
Expand Down
2 changes: 0 additions & 2 deletions include/features/relax.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ extern float jumping_window_offset;
extern int wait_hitobjects_min;
extern int wait_hitobjects_max;

extern bool debug_relax;

void relax_on_beatmap_load();
void update_relax(Circle &circle, const int32_t audio_time);
4 changes: 2 additions & 2 deletions include/signatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ constexpr auto audio_time_func_sig { pattern::build<"55 8B EC 83 E4 F8
constexpr auto osu_manager_func_sig { pattern::build<"55 8B EC 57 56 53 83 EC 14 80 3D"> };
constexpr auto binding_manager_func_sig { pattern::build<"55 8B EC 57 56 83 EC 58 8B F1 8D 7D A0"> };
constexpr auto selected_replay_func_sig { pattern::build<"55 8B EC 57 56 53 81 EC A0 00 00 00 8B F1 8D BD 68 FF FF FF B9 22 00 00 00 33 C0 F3 AB 8B CE 8B F1 8D 7D E0"> };
constexpr auto window_manager_func_sig { pattern::build<"57 56 53 83 EC 6C 8B F1 8D 7D A8 B9 12 00 00 00 33 C0 F3 AB 8B CE 89 4D 94"> };
constexpr auto window_manager_func_sig { pattern::build<"55 8B EC 57 56 53 50 8B 15 . . . . 8B 7A 04 8B 05"> };
constexpr auto update_timing_func_sig { pattern::build<"55 8B EC 83 E4 F8 57 56 83 EC 18 8B F9 8B 0D"> };
constexpr auto check_timewarp_func_sig { pattern::build<"55 8B EC 57 56 53 81 EC B0 01 00 00 8B F1 8D BD 50 FE FF FF B9 68 00 00 00 33 C0"> };
constexpr auto osu_client_id_func_sig { pattern::build<"8B F1 8D 7D C4 B9 0C 00 00 00 33 C0 F3 AB 8B CE 89 4D C0 8B 15"> };
Expand All @@ -32,7 +32,7 @@ constexpr auto osu_manager_sig { pattern::build<"85 C9"> };
constexpr auto binding_manager_sig { pattern::build<"8D 45 D8 50 8B 0D"> };
constexpr auto selected_replay_sig { pattern::build<"8B 46 38 83 78 30 00"> };
constexpr auto osu_username_sig { pattern::build<"8B 01 8B 40 28 FF 50 18 8B 15"> };
constexpr auto window_manager_sig { pattern::build<"83 C2 04 8B 0D"> };
constexpr auto window_manager_sig { pattern::build<"8B 15 . . . . 83 C2 04 39 09 E8 . . . . 59"> };
constexpr auto score_multiplier_sig { pattern::build<"8B F1 D9 E8 83 FA 04 0F 83"> };
constexpr auto update_timing_sig { pattern::build<"D9 C0 DD 05"> };
constexpr auto update_timing_sig_2 { pattern::build<"DE E9 DD 1D"> };
Expand Down
2 changes: 2 additions & 0 deletions include/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ extern uintptr_t window_manager_ptr;
extern Vector2<float> window_size;
extern Vector2<float> playfield_size;
extern Vector2<float> playfield_position;
extern Vector2<float> client_offset;
extern Vector2<float> primary_monitor;

extern float window_ratio;
extern float playfield_ratio;
Expand Down
Binary file modified nobuild.exe
Binary file not shown.

0 comments on commit 9759cd9

Please sign in to comment.