Skip to content

Commit

Permalink
do not read song ptr if menu is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciremun committed Aug 4, 2022
1 parent d355a13 commit 00b8b27
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions freedom/freedom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,33 +213,6 @@ BOOL __stdcall freedom_update(HDC hDc)
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

static char song_name_u8[128] = {'F', 'r', 'e', 'e', 'd', 'o', 'm', '\0'};
if (selected_song_ptr)
{
uintptr_t song_str_ptr = 0;
if (internal_memory_read(g_process, selected_song_ptr, &song_str_ptr))
{
song_str_ptr += 0x80;
static uintptr_t prev_song_str_ptr = 0;
if (song_str_ptr != prev_song_str_ptr)
{
uintptr_t song_str = 0;
if (internal_memory_read(g_process, song_str_ptr, &song_str))
{
song_str += 0x4;
uint32_t song_str_length = 0;
if (internal_memory_read(g_process, song_str, &song_str_length))
{
song_str += 0x4;
int bytes_written = WideCharToMultiByte(CP_UTF8, 0, (wchar_t *)song_str, song_str_length, song_name_u8, 127, 0, 0);
song_name_u8[bytes_written] = '\0';
}
}
}
prev_song_str_ptr = song_str_ptr;
}
}

if (start_parse_beatmap)
{
parse_beatmap(osu_manager_ptr, current_beatmap);
Expand Down Expand Up @@ -323,6 +296,33 @@ BOOL __stdcall freedom_update(HDC hDc)
if (!cfg_mod_menu_visible)
goto frame_end;

static char song_name_u8[128] = {'F', 'r', 'e', 'e', 'd', 'o', 'm', '\0'};
if (selected_song_ptr)
{
uintptr_t song_str_ptr = 0;
if (internal_memory_read(g_process, selected_song_ptr, &song_str_ptr))
{
song_str_ptr += 0x80;
static uintptr_t prev_song_str_ptr = 0;
if (song_str_ptr != prev_song_str_ptr)
{
uintptr_t song_str = 0;
if (internal_memory_read(g_process, song_str_ptr, &song_str))
{
song_str += 0x4;
uint32_t song_str_length = 0;
if (internal_memory_read(g_process, song_str, &song_str_length))
{
song_str += 0x4;
int bytes_written = WideCharToMultiByte(CP_UTF8, 0, (wchar_t *)song_str, song_str_length, song_name_u8, 127, 0, 0);
song_name_u8[bytes_written] = '\0';
}
}
}
prev_song_str_ptr = song_str_ptr;
}
}

ImGuiIO &io = ImGui::GetIO();
ImGui::PushFont(font);

Expand Down

0 comments on commit 00b8b27

Please sign in to comment.