diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 0bbbe3480..8920d2709 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -44,64 +44,65 @@ void __stdcall mainmenu_create_hero(char *a1, char *a2) pfile_create_save_file(a1, a2); } -int __stdcall mainmenu_select_hero_dialog(int u1, int u2, int u3, int u4, int mode, char *cname, int clen, char *cdesc, int cdlen, int *multi) /* fix args */ +int __stdcall mainmenu_select_hero_dialog( + const struct _SNETPROGRAMDATA *u1, + const struct _SNETPLAYERDATA *u2, + const struct _SNETUIDATA *u3, + const struct _SNETVERSIONDATA *u4, + DWORD mode, + char *cname, DWORD clen, + char *cdesc, DWORD cdlen, + BOOL *multi) { - int v10; // eax - int a6; // [esp+8h] [ebp-8h] - int a5; // [esp+Ch] [ebp-4h] - - a6 = 1; - a5 = 0; - if ( gbMaxPlayers == 1 ) - { - if ( !UiSelHeroSingDialog( - pfile_ui_set_hero_infos, - pfile_ui_save_create, - pfile_delete_save, - pfile_ui_set_class_stats, - &a5, - chr_name_str, - &gnDifficulty) ) - TermMsg("Unable to display SelHeroSing"); - if ( a5 == 2 ) - { - dword_5256E8 = 1; - goto LABEL_6; - } - dword_5256E8 = 0; - } - else if ( !UiSelHeroMultDialog( - pfile_ui_set_hero_infos, - pfile_ui_save_create, - pfile_delete_save, - pfile_ui_set_class_stats, - &a5, - &a6, - chr_name_str) ) - { - TermMsg("Can't load multiplayer dialog"); - } - if ( a5 == 4 ) - { - SErrSetLastError(1223); - return 0; - } + int v10; // eax + int a6; // [esp+8h] [ebp-8h] + int a5; // [esp+Ch] [ebp-4h] + + a6 = 1; + a5 = 0; + if (gbMaxPlayers == 1) { + if (!UiSelHeroSingDialog( + pfile_ui_set_hero_infos, + pfile_ui_save_create, + pfile_delete_save, + pfile_ui_set_class_stats, + &a5, + chr_name_str, + &gnDifficulty)) + TermMsg("Unable to display SelHeroSing"); + if (a5 == 2) { + dword_5256E8 = 1; + goto LABEL_6; + } + dword_5256E8 = 0; + } else if (!UiSelHeroMultDialog( + pfile_ui_set_hero_infos, + pfile_ui_save_create, + pfile_delete_save, + pfile_ui_set_class_stats, + &a5, + &a6, + chr_name_str)) { + TermMsg("Can't load multiplayer dialog"); + } + if (a5 == 4) { + SErrSetLastError(1223); + return 0; + } LABEL_6: - pfile_create_player_description(cdesc, cdlen); - if ( multi ) - { - if ( mode == 'BNET' ) - v10 = a6 || !plr[myplr].pBattleNet; - else - v10 = a6; - *multi = v10; - } - if ( cname ) - { - if ( clen ) - SStrCopy(cname, chr_name_str, clen); - } - return 1; + pfile_create_player_description(cdesc, cdlen); + if (multi) { + if (mode == 'BNET') + v10 = a6 || !plr[myplr].pBattleNet; + else + v10 = a6; + *multi = v10; + } + if (cname) { + if (clen) + SStrCopy(cname, chr_name_str, clen); + } + return 1; } // 5256E8: using guessed type int dword_5256E8; // 679660: using guessed type char gbMaxPlayers; diff --git a/Source/mainmenu.h b/Source/mainmenu.h index 7c75d7571..0c8ff1042 100644 --- a/Source/mainmenu.h +++ b/Source/mainmenu.h @@ -8,7 +8,15 @@ extern char chr_name_str[16]; void __cdecl mainmenu_cpp_init(); void __cdecl mainmenu_refresh_music(); void __stdcall mainmenu_create_hero(char *, char *); -int __stdcall mainmenu_select_hero_dialog(int u1, int u2, int u3, int u4, int mode, char *cname, int clen, char *cdesc, int cdlen, int *multi); +int __stdcall mainmenu_select_hero_dialog( + const struct _SNETPROGRAMDATA *u1, + const struct _SNETPLAYERDATA *u2, + const struct _SNETUIDATA *u3, + const struct _SNETVERSIONDATA *u4, + DWORD mode, // 4 chars, e.g. 'IPXN', 'BNET' etc. */ + char *cname, DWORD clen, // character name will be copied here + char *cdesc, DWORD cdlen, // character "description" will be copied here (used to advertise games) + BOOL *multi); // new character? - unsure about this void __cdecl mainmenu_loop(); int __cdecl mainmenu_single_player(); int __fastcall mainmenu_init_menu(int a1); diff --git a/Source/multi.cpp b/Source/multi.cpp index fdbf1cfd3..bfe597579 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -832,7 +832,7 @@ int __fastcall NetInit(int bSinglePlayer, int *pfExitProgram) UiData.authcallback = (void (__cdecl *)())UiAuthCallback; UiData.getdatacallback = (void (__cdecl *)())UiGetDataCallback; UiData.categorycallback = (void (__cdecl *)())UiCategoryCallback; - UiData.selectnamecallback = (void (__cdecl *)())mainmenu_select_hero_dialog; + UiData.selectnamecallback = mainmenu_select_hero_dialog; UiData.changenamecallback = (void (__cdecl *)())mainmenu_create_hero; UiData.profilebitmapcallback = UiProfileDraw; UiData.profilecallback = UiProfileCallback; diff --git a/structs.h b/structs.h index 395d8e8b8..a6e020be0 100644 --- a/structs.h +++ b/structs.h @@ -1288,7 +1288,16 @@ struct _SNETUIDATA { void(__cdecl *profilecallback)(); int profilefields; void(__cdecl *profilebitmapcallback)(); - void(__cdecl *selectnamecallback)(); + int(__stdcall *selectnamecallback)( + const struct _SNETPROGRAMDATA *, + const struct _SNETPLAYERDATA *, + const struct _SNETUIDATA *, + const struct _SNETVERSIONDATA *, + DWORD provider, /* e.g. 'IPXN', 'BNET' etc. */ + char *, DWORD, /* character name will be copied here */ + char *, DWORD, /* character "description" will be copied here (used to advertise games) */ + BOOL * /* new character? - unsure about this */ + ); void(__cdecl *changenamecallback)(); };