no more crash in menu, only once you select a song :(

This commit is contained in:
CrazyRedMachine 2024-04-21 01:38:15 +02:00
parent 2e94df0984
commit 06957c8340

View File

@ -90,7 +90,7 @@ void (*add_song_in_list)();
void (*categ_inject_songlist)();
struct songlist_struct_s *new_song_list = NULL;
void get_subcateg_size_impl()
void get_subcateg_size_impl_old()
{
__asm("push edx\n");
__asm("mov _idx, eax\n");
@ -106,6 +106,53 @@ void get_subcateg_size_impl()
__asm("pop edx\n");
}
uint32_t tmp_array_begin;
uint32_t tmp_array_end;
uint32_t tmp_zone;
void get_subcateg_size_impl()
{
//on ecrit dans la zone d'où la fonction habituelle lit, p'tet ça marchera
__asm("push ebx\n");
__asm("push edx\n");
__asm("push eax\n");
__asm("push ecx\n");
__asm("mov _idx, eax\n");
__asm("lea eax, dword ptr [eax+eax*2]");
__asm("lea ecx, dword ptr [ecx+eax*8+0x1D8C]");
__asm("mov _tmp_zone, ecx");
__asm("pop ecx\n");
__asm("pop eax\n");
tmp_size = subcategories[idx-2].size;
// tmp_categ_ptr = (uint32_t)&(subcategories[idx]);
// tmp_songlist_ptr = (uint32_t)&(subcategories[idx].songlist);
new_song_list = (struct songlist_struct_s*) songlist_struct_addr;
// new_song_list = (struct songlist_struct_s*) calloc(1, sizeof(struct songlist_struct_s));
tmp_array_begin = (uint32_t)&(subcategories[idx-2].songlist[0]);
new_song_list->array_start = tmp_array_begin;
tmp_array_end = (uint32_t)&(subcategories[idx-2].songlist[tmp_size]);
new_song_list->array_end = tmp_array_end;
__asm("push ecx");
__asm("push edx");
__asm("mov ecx, _tmp_zone");
__asm("mov edx, _tmp_array_end");
__asm("mov dword ptr ds:[ecx+0x10], edx");
__asm("mov edx, _tmp_array_begin");
__asm("mov dword ptr ds:[ecx+0xC], edx");
__asm("pop edx");
__asm("pop ecx");
__asm("mov eax, [_tmp_size]");
__asm("mov ecx, _new_song_list");
__asm("pop edx\n");
__asm("pop ebx\n");
}
void get_subcateg_name_impl()
{
__asm("push ecx\n");