Browse Source

multi_upgrade (#583)

* Clean up multi_upgrade

* Correct variable names

* Correct variable types
pull/25/head
Anders Jenbo 7 years ago committed by Robin Eklind
parent
commit
9d44169ac7
  1. 6
      DiabloUI/_temp_data.cpp
  2. 6
      DiabloUI/_temp_funcs.h
  3. 18
      DiabloUI/dirlink.cpp
  4. 14
      DiabloUI/modem.cpp
  5. 12
      DiabloUI/selgame.cpp
  6. 14
      DiabloUI/selipx.cpp
  7. 30
      Source/multi.cpp
  8. 4
      Source/multi.h
  9. 2
      Source/nthread.cpp
  10. 2
      Source/nthread.h

6
DiabloUI/_temp_data.cpp

@ -226,7 +226,7 @@ char byte_1002973C; // idb
char byte_100297BC; // idb
int dword_1002983C; // weak
int dword_10029840; // weak
int dword_10029844; // weak
int gnDlinkPlayerid; // weak
void *dword_10029848; // idb
int dword_1002984C; // weak
int disclaim_cpp_float; // weak
@ -264,7 +264,7 @@ int dword_1002A130; // weak
int dword_1002A134; // weak
int dword_1002A138; // weak
int dword_1002A13C; // weak
int dword_1002A140; // weak
int gnModemPlayerid; // weak
int dword_1002A144; // weak
int dword_1002A148; // weak
void *dword_1002A14C; // idb
@ -339,7 +339,7 @@ BYTE *selhero_buffer;
int dword_1002A49C; // weak
void *dword_1002A4A0; // idb
int dword_1002A4A4; // weak
int dword_1002A4A8; // weak
int gnIpxPlayerid; // weak
int dword_1002A4AC; // weak
int dword_1002A4B0; // weak
int dword_1002A4B4; // weak

6
DiabloUI/_temp_funcs.h

@ -165,7 +165,7 @@ void __cdecl j_DiabloUI_cpp_init();
void __cdecl DiabloUI_cpp_init();
signed int DirLink_10005CFA();
BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int a6);
BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid);
int __stdcall DirLink_10005D63(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
int __fastcall DirLink_10005EB2(HWND hDlg, int a2);
int UNKCALL DirLink_10005F1F(HWND hDlg); // idb
@ -301,7 +301,7 @@ signed int Modem_10008648();
int Modem_10008653();
int Modem_10008659();
int UNKCALL Modem_1000865F(char *); // idb
BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int a6);
BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid);
int __stdcall Modem_100086DE(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
void **UNKCALL Modem_1000879E(HWND hDlg);
BOOL UNKCALL Modem_100087DB(HWND hWnd);
@ -449,7 +449,7 @@ BOOL __stdcall UiSelHeroSingDialog(BOOL(__stdcall *fninfo)(BOOL(__stdcall *fninf
void *SelIPX_1000C610();
signed int SelIPX_1000C629();
BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int a6);
BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid);
int __stdcall SelIPX_1000C692(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb
LONG __fastcall SelIPX_1000C818(HWND hDlg, int nIDDlgItem);
HWND UNKCALL SelIPX_1000C982(HWND hDlg);

18
DiabloUI/dirlink.cpp

@ -10,7 +10,7 @@ signed int DirLink_10005CFA() { return 0; }
// 10029730: using guessed type int dword_10029730;
// ref: 0x10005D05
BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int a6) { return 0; }
BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; }
/* {
int v6; // esi
@ -18,7 +18,7 @@ BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int
dword_1002984C = a2;
dword_10029840 = a5;
dword_10029848 = a4;
dword_10029844 = a6;
gnDlinkPlayerid = playerid;
artfont_10001159();
v6 = SDlgDialogBoxParam(hInstance, "DIRLINK_DIALOG", a4[2], DirLink_10005D63, 0);
artfont_100010C8();
@ -27,7 +27,7 @@ BOOL __fastcall DirLink_10005D05(int a1, int a2, int a3, _DWORD *a4, int a5, int
// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 1002983C: using guessed type int dword_1002983C;
// 10029840: using guessed type int dword_10029840;
// 10029844: using guessed type int dword_10029844;
// 10029844: using guessed type int gnDlinkPlayerid;
// 1002984C: using guessed type int dword_1002984C;
// ref: 0x10005D63
@ -205,13 +205,13 @@ void UNKCALL DirLink_10006073(void *arg) { return; }
if ( dword_10029738 )
{
Connect_10004028((int)&v2, 128, (int)&v3, 128);
if ( SNetJoinGame(dword_10029738, &byte_1002973C, 0, &v2, &v3, dword_10029844) )
if ( SNetJoinGame(dword_10029738, &byte_1002973C, 0, &v2, &v3, gnDlinkPlayerid) )
DirLink_10006047(v1, 1);
}
} */
// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 10029738: using guessed type int dword_10029738;
// 10029844: using guessed type int dword_10029844;
// 10029844: using guessed type int gnDlinkPlayerid;
// ref: 0x100060D1
HWND UNKCALL DirLink_100060D1(HWND arg) { return 0; }
@ -275,7 +275,7 @@ int UNKCALL DirLink_10006141(void *arg) { return 0; }
dword_1002983C,
(int)&v4,
dword_10029840,
dword_10029844,
gnDlinkPlayerid,
0,
(int)&v3);
if ( result )
@ -284,7 +284,7 @@ int UNKCALL DirLink_10006141(void *arg) { return 0; }
} */
// 1002983C: using guessed type int dword_1002983C;
// 10029840: using guessed type int dword_10029840;
// 10029844: using guessed type int dword_10029844;
// 10029844: using guessed type int gnDlinkPlayerid;
// 1002984C: using guessed type int dword_1002984C;
// ref: 0x100061E1
@ -302,7 +302,7 @@ int UNKCALL DirLink_100061E1(void *arg) { return 0; }
Connect_10004028((int)&v6, 128, (int)&v7, 128);
if ( UiAuthCallback(2, (int)&v6, &v7, 0, &byte_100297BC, &v5, 256) )
{
if ( SNetJoinGame(dword_10029738, &byte_1002973C, 0, &v6, &v7, dword_10029844) )
if ( SNetJoinGame(dword_10029738, &byte_1002973C, 0, &v6, &v7, gnDlinkPlayerid) )
return DirLink_10006047(v1, 1);
if ( SErrGetLastError() == -2062548871 )
LoadStringA(hInstance, 0x32u, &Buffer, 127);
@ -320,7 +320,7 @@ int UNKCALL DirLink_100061E1(void *arg) { return 0; }
// 10010406: using guessed type _DWORD __stdcall SErrGetLastError();
// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 10029738: using guessed type int dword_10029738;
// 10029844: using guessed type int dword_10029844;
// 10029844: using guessed type int gnDlinkPlayerid;
// ref: 0x100062BF
int UNKCALL DirLink_100062BF(void *arg, int a2, char *a3, char *a4) { return 0; }

14
DiabloUI/modem.cpp

@ -116,7 +116,7 @@ int UNKCALL Modem_1000865F(char *arg) { return 0; }
} */
// ref: 0x10008680
BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int a6) { return 0; }
BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; }
/* {
int v6; // esi
@ -124,7 +124,7 @@ BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int a
dword_1002A138 = a2;
dword_1002A144 = a5;
dword_1002A14C = a4;
dword_1002A140 = a6;
gnModemPlayerid = playerid;
artfont_10001159();
v6 = SDlgDialogBoxParam(hInstance, "MODEM_DIALOG", a4[2], Modem_100086DE, 0);
artfont_100010C8();
@ -133,7 +133,7 @@ BOOL __fastcall Modem_10008680(int a1, int a2, int a3, _DWORD *a4, int a5, int a
// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 1002A138: using guessed type int dword_1002A138;
// 1002A13C: using guessed type int dword_1002A13C;
// 1002A140: using guessed type int dword_1002A140;
// 1002A140: using guessed type int gnModemPlayerid;
// 1002A144: using guessed type int dword_1002A144;
// ref: 0x100086DE
@ -320,7 +320,7 @@ int UNKCALL Modem_1000893D(HWND hWnd) { return 0; }
dword_1002A13C,
(int)&v5,
dword_1002A144,
dword_1002A140,
gnModemPlayerid,
1,
(int)&v4) )
{
@ -344,7 +344,7 @@ int UNKCALL Modem_1000893D(HWND hWnd) { return 0; }
// 1002A130: using guessed type int dword_1002A130;
// 1002A138: using guessed type int dword_1002A138;
// 1002A13C: using guessed type int dword_1002A13C;
// 1002A140: using guessed type int dword_1002A140;
// 1002A140: using guessed type int gnModemPlayerid;
// 1002A144: using guessed type int dword_1002A144;
// ref: 0x10008A38
@ -423,7 +423,7 @@ void __cdecl Modem_10008B42(char *a1) { return; }
v1 = &byte_1002A154;
if ( !dword_1002A124 )
v1 = a1;
dword_1002A120 = SNetJoinGame(0, v1, 0, &v2, &v3, dword_1002A140);
dword_1002A120 = SNetJoinGame(0, v1, 0, &v2, &v3, gnModemPlayerid);
if ( !dword_1002A120 )
dword_1002A12C = SErrGetLastError();
dword_1002A148 = 1;
@ -435,7 +435,7 @@ void __cdecl Modem_10008B42(char *a1) { return; }
// 1002A120: using guessed type int dword_1002A120;
// 1002A124: using guessed type int dword_1002A124;
// 1002A12C: using guessed type int dword_1002A12C;
// 1002A140: using guessed type int dword_1002A140;
// 1002A140: using guessed type int gnModemPlayerid;
// 1002A148: using guessed type int dword_1002A148;
// ref: 0x10008BB7

12
DiabloUI/selgame.cpp

@ -27,7 +27,7 @@ int SelGame_1000B67E() { return 0; }
// 1002A404: using guessed type int dword_1002A404;
// ref: 0x1000B684
int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, _SNETVERSIONDATA *file_info, int *a6) { return 0; }
int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, _SNETVERSIONDATA *file_info, int *playerid) { return 0; }
/* {
int v6; // eax
CHAR v8; // [esp+4h] [ebp-110h]
@ -58,18 +58,18 @@ int __stdcall UiSelectGame(int a1, _SNETPROGRAMDATA *client_info, _SNETPLAYERDAT
v17 = &v12;
v18 = &v8;
if ( SelGame_1000B671() )
return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, a6);
return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid);
v6 = SelGame_1000B67E();
switch ( v6 )
{
case 1230002254:
return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, a6);
return SelIPX_1000C634(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid);
case 1297040461:
return Modem_10008680(a1, a2, (int)&v16, (_DWORD *)a4, a5, a6);
return Modem_10008680(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid);
case 1396916812:
return DirLink_10005D05(a1, a2, (int)&v16, (_DWORD *)a4, a5, a6);
return DirLink_10005D05(a1, a2, (int)&v16, (_DWORD *)a4, a5, playerid);
}
return SNetSelectGame(a1, a2, &v16, a4, a5, a6);
return SNetSelectGame(a1, a2, &v16, a4, a5, playerid);
} */
// 10010490: using guessed type int __stdcall SNetSelectGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);

14
DiabloUI/selipx.cpp

@ -17,7 +17,7 @@ signed int SelIPX_1000C629() { return 0; }
// 1002A4A4: using guessed type int dword_1002A4A4;
// ref: 0x1000C634
BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int a6) { return 0; }
BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int playerid) { return 0; }
/* {
int v6; // esi
@ -25,7 +25,7 @@ BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int
dword_1002A4AC = a2;
dword_1002A4BC = a5;
dword_1002A4A0 = a4;
dword_1002A4A8 = a6;
gnIpxPlayerid = playerid;
artfont_10001159();
v6 = SDlgDialogBoxParam(hInstance, "SELIPXGAME_DIALOG", a4[2], SelIPX_1000C692, 0);
artfont_100010C8();
@ -33,7 +33,7 @@ BOOL __fastcall SelIPX_1000C634(int a1, int a2, int a3, _DWORD *a4, int a5, int
} */
// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 1002A49C: using guessed type int dword_1002A49C;
// 1002A4A8: using guessed type int dword_1002A4A8;
// 1002A4A8: using guessed type int gnIpxPlayerid;
// 1002A4AC: using guessed type int dword_1002A4AC;
// 1002A4BC: using guessed type int dword_1002A4BC;
@ -1063,7 +1063,7 @@ HWND USERCALL SelIPX_1000D3C5(HWND hDlg, int a2) { return 0; }
dword_1002A49C,
(int)&v11,
dword_1002A4BC,
dword_1002A4A8,
gnIpxPlayerid,
0,
(int)&v10) )
{
@ -1081,7 +1081,7 @@ HWND USERCALL SelIPX_1000D3C5(HWND hDlg, int a2) { return 0; }
} */
// 1000D3C5: could not find valid save-restore pair for ebp
// 1002A49C: using guessed type int dword_1002A49C;
// 1002A4A8: using guessed type int dword_1002A4A8;
// 1002A4A8: using guessed type int gnIpxPlayerid;
// 1002A4AC: using guessed type int dword_1002A4AC;
// 1002A4BC: using guessed type int dword_1002A4BC;
@ -1168,7 +1168,7 @@ int __fastcall SelIPX_1000D5B0(int a1, int a2) { return 0; }
Connect_10004028((int)&v9, 128, (int)&v7, 128);
if ( UiAuthCallback(2, (int)&v9, &v7, 0, (char *)(v2 + 140), &v6, 256) )
{
if ( SNetJoinGame(*(_DWORD *)(v2 + 4), v2 + 12, 0, &v9, &v7, dword_1002A4A8) )
if ( SNetJoinGame(*(_DWORD *)(v2 + 4), v2 + 12, 0, &v9, &v7, gnIpxPlayerid) )
return SelIPX_1000D3A0(v10, 1);
if ( SErrGetLastError() == -2062548871 )
LoadStringA(hInstance, 0x32u, &Buffer, 127);
@ -1185,7 +1185,7 @@ int __fastcall SelIPX_1000D5B0(int a1, int a2) { return 0; }
} */
// 10010406: using guessed type _DWORD __stdcall SErrGetLastError();
// 10010430: using guessed type int __stdcall SNetJoinGame(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 1002A4A8: using guessed type int dword_1002A4A8;
// 1002A4A8: using guessed type int gnIpxPlayerid;
// ref: 0x1000D696
HWND __fastcall SelIPX_1000D696(HWND hDlg, int a2, int a3) { return 0; }

30
Source/multi.cpp

@ -7,7 +7,7 @@ TBuffer sgHiPriBuf;
char szPlayerDescript[128];
short sgwPackPlrOffsetTbl[MAX_PLRS];
PkPlayerStruct netplr[MAX_PLRS];
char sgbPlayerTurnBitTbl[MAX_PLRS];
BYTE sgbPlayerTurnBitTbl[MAX_PLRS];
char sgbPlayerLeftGameTbl[MAX_PLRS];
int sgbSentThisCycle; // idb
int dword_678628; // weak
@ -888,7 +888,7 @@ int __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA
}
// 679660: using guessed type char gbMaxPlayers;
int __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *a4)
BOOL __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *pfExitProgram)
{
_SNETPLAYERDATA *v4; // ebx
signed int i; // edi
@ -902,7 +902,7 @@ int __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *
type = 0;
if (byte_678640) {
if (!UiSelectProvider(0, (_SNETPROGRAMDATA *)a2, v4, ui_info, &fileinfo, &type)
&& (!i || SErrGetLastError() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(a4))) {
&& (!i || SErrGetLastError() != STORM_ERROR_REQUIRES_UPGRADE || !multi_upgrade(pfExitProgram))) {
return 0;
}
if (type == 'BNET')
@ -925,23 +925,25 @@ int __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *
// 678640: using guessed type char byte_678640;
// 679660: using guessed type char gbMaxPlayers;
int __fastcall multi_upgrade(int *a1)
BOOL __fastcall multi_upgrade(int *pfExitProgram)
{
int *v1; // esi
int result; // eax
int status; // [esp+4h] [ebp-4h]
BOOL result;
int status;
v1 = a1;
SNetPerformUpgrade((LPDWORD)&status);
result = 1;
result = TRUE;
if (status && status != 1) {
if (status == 2) {
*v1 = 1;
} else if (status == -1) {
DrawDlg("Network upgrade failed");
if (status != 2) {
if (status == -1) {
DrawDlg("Network upgrade failed");
}
} else {
*pfExitProgram = 1;
}
result = 0;
result = FALSE;
}
return result;
}

4
Source/multi.h

@ -48,8 +48,8 @@ void __fastcall multi_send_pinfo(int pnum, char cmd);
int __fastcall InitNewSeed(int newseed);
void __cdecl SetupLocalCoords();
int __fastcall multi_init_single(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info);
int __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *a4);
int __fastcall multi_upgrade(int *a1);
BOOL __fastcall multi_init_multi(_SNETPROGRAMDATA *client_info, _SNETPLAYERDATA *user_info, _SNETUIDATA *ui_info, int *pfExitProgram);
BOOL __fastcall multi_upgrade(int *pfExitProgram);
void __fastcall multi_player_joins(int pnum, TCmdPlrInfoHdr *cmd, int a3);
/* rdata */

2
Source/nthread.cpp

@ -147,7 +147,7 @@ void __cdecl nthread_set_turn_upper_bit()
}
// 679754: using guessed type int turn_upper_bit;
void __fastcall nthread_start(BOOLEAN set_turn_upper_bit)
void __fastcall nthread_start(BOOL set_turn_upper_bit)
{
char *err; // eax
unsigned int largestMsgSize; // esi

2
Source/nthread.h

@ -22,7 +22,7 @@ void __fastcall nthread_terminate_game(const char *pszFcn);
int __fastcall nthread_send_and_recv_turn(int cur_turn, int turn_delta);
int __fastcall nthread_recv_turns(int *pfSendAsync);
void __cdecl nthread_set_turn_upper_bit();
void __fastcall nthread_start(BOOLEAN set_turn_upper_bit);
void __fastcall nthread_start(BOOL set_turn_upper_bit);
unsigned int __stdcall nthread_handler(void *a1);
void __cdecl nthread_cleanup();
void __fastcall nthread_ignore_mutex(BOOL bStart);

Loading…
Cancel
Save