Skip to content

Commit

Permalink
pass osu player ptr to parse_beatmap, move start_parse_beatmap outsid…
Browse files Browse the repository at this point in the history
…e current song ptr
  • Loading branch information
Ciremun committed Jul 27, 2022
1 parent 5c5f0e3 commit e335c79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
16 changes: 7 additions & 9 deletions freedom/freedom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,6 @@ BOOL __stdcall freedom_update(HDC hDc)
uintptr_t song_str_ptr = 0;
if (internal_memory_read(g_process, current_song_ptr, &song_str_ptr))
{
if (start_parse_beatmap)
{
if (!parse_beatmap(g_process, osu_auth_base, current_beatmap))
{
FR_ERROR("couldn't parse beatmap, replay mode?");
}
target_first_circle = true;
start_parse_beatmap = false;
}
song_str_ptr += 0x80;
static uintptr_t prev_song_str_ptr = 0;
if (song_str_ptr != prev_song_str_ptr)
Expand Down Expand Up @@ -286,6 +277,13 @@ BOOL __stdcall freedom_update(HDC hDc)
static uintptr_t audio_time_ptr = internal_multi_level_pointer_dereference(g_process, osu_auth_base + audio_time_ptr_base_offset, audio_time_ptr_offsets);
static uintptr_t osu_player_ptr = internal_multi_level_pointer_dereference(g_process, osu_auth_base + osu_player_ptr_base_offset, osu_player_ptr_offsets);

if (start_parse_beatmap)
{
parse_beatmap(osu_player_ptr, current_beatmap);
target_first_circle = true;
start_parse_beatmap = false;
}

static double keydown_time = 0.0;
static double keyup_delay = 0.0;
static float fraction_modifier = 0.04f;
Expand Down
9 changes: 7 additions & 2 deletions freedom/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ void BeatmapData::clear()
hit_objects.clear();
}

bool parse_beatmap(HANDLE hProc, uintptr_t osu_auth_base, BeatmapData &beatmap_data)
bool parse_beatmap(uintptr_t osu_player_ptr, BeatmapData &beatmap_data)
{
beatmap_data.clear();

static uintptr_t osu_player_ptr = internal_multi_level_pointer_dereference(hProc, osu_auth_base + osu_player_ptr_base_offset, osu_player_ptr_offsets);
if (osu_player_ptr == 0)
return false;

uintptr_t osu_manager_ptr = **(uintptr_t **)(osu_player_ptr + 0x8);

bool replay_mode = *(bool *)(osu_manager_ptr + 0x17A);
if (replay_mode)
{
FR_INFO_FMT("skipping current beatmap: replay mode");
return false;
}

uintptr_t hit_manager_ptr = *(uintptr_t *)(osu_manager_ptr + 0x40);
uintptr_t hit_objects_list_ptr = *(uintptr_t *)(hit_manager_ptr + 0x48);
Expand Down
2 changes: 1 addition & 1 deletion include/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ struct BeatmapData
Circle current_circle();
};

bool parse_beatmap(HANDLE hProc, uintptr_t osu_auth_base, BeatmapData &beatmap_data);
bool parse_beatmap(uintptr_t osu_player_ptr, BeatmapData &beatmap_data);

0 comments on commit e335c79

Please sign in to comment.