diff --git a/3rdParty/Storm/Source/storm.cpp b/3rdParty/Storm/Source/storm.cpp index 77d37d5f7..cfb7c17e5 100644 --- a/3rdParty/Storm/Source/storm.cpp +++ b/3rdParty/Storm/Source/storm.cpp @@ -243,5 +243,7 @@ void __stdcall SDlgBeginPaint(HWND hWnd, char *a2) rVoid; void __stdcall SDlgEndPaint(HWND hWnd, char *a2) rVoid; void __stdcall SDlgSetSystemCursor(BYTE *a1, BYTE *a2, int *a3, int a4) rVoid; void __stdcall SDlgSetCursor(HWND hWnd, HCURSOR a2, int a3, int *a4) rVoid; -BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int)) rBool; +BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int, int, int, int)) rBool; BOOL __stdcall SDlgKillTimer(int a1, int a2) rBool; +BOOL __stdcall SDlgDrawBitmap(HWND hWnd, int a2, int a3, int a4, int a5, int a6, int a7) rBool; +BOOL __stdcall SDlgDialogBoxParam(HINSTANCE hInst, char *szDialog, int a3, WNDPROC func, int a5) rBool; diff --git a/3rdParty/Storm/Source/storm.def b/3rdParty/Storm/Source/storm.def index f45652b04..da801e1e6 100644 --- a/3rdParty/Storm/Source/storm.def +++ b/3rdParty/Storm/Source/storm.def @@ -59,8 +59,8 @@ EXPORTS SDlgDefDialogProc @206 NONAME SDlgDialogBoxIndirectParam @208 NONAME - ;SDlgDialogBoxParam @209 NONAME - ;SDlgDrawBitmap @210 NONAME + SDlgDialogBoxParam @209 NONAME + SDlgDrawBitmap @210 NONAME SDlgEndDialog @211 NONAME SDlgEndPaint @212 NONAME SDlgKillTimer @213 NONAME diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 26506ec84..b2fc9a868 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -1306,8 +1306,10 @@ void __stdcall SDlgBeginPaint(HWND hWnd, char *a2); void __stdcall SDlgEndPaint(HWND hWnd, char *a2); void __stdcall SDlgSetSystemCursor(BYTE *a1, BYTE *a2, int *a3, int a4); void __stdcall SDlgSetCursor(HWND hWnd, HCURSOR a2, int a3, int *a4); -BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int)); +BOOL __stdcall SDlgSetTimer(int a1, int a2, int a3, void (__stdcall *a4)(int, int, int, int)); BOOL __stdcall SDlgKillTimer(int a1, int a2); +BOOL __stdcall SDlgDrawBitmap(HWND hWnd, int a2, int a3, int a4, int a5, int a6, int a7); +BOOL __stdcall SDlgDialogBoxParam(HINSTANCE hInst, char *szDialog, int a3, WNDPROC func, int a5); #ifdef __GNUC__ } diff --git a/3rdParty/Storm/Source/storm_gcc.def b/3rdParty/Storm/Source/storm_gcc.def index f25c16241..2df6ba6e4 100644 --- a/3rdParty/Storm/Source/storm_gcc.def +++ b/3rdParty/Storm/Source/storm_gcc.def @@ -78,8 +78,10 @@ EXPORTS SDlgDefDialogProc @206 NONAME SDlgDialogBoxIndirectParam @208 NONAME - ;SDlgDialogBoxParam @209 NONAME - ;SDlgDrawBitmap @210 NONAME + SDlgDialogBoxParam @209 NONAME + SDlgDialogBoxParam@20 @209 NONAME + SDlgDrawBitmap @210 NONAME + SDlgDrawBitmap@28 @210 NONAME SDlgEndDialog @211 NONAME SDlgEndPaint @212 NONAME SDlgEndPaint@8 @212 NONAME diff --git a/DiabloUI/DiabloUI.dsp b/DiabloUI/DiabloUI.dsp index 01b736b87..99817473a 100644 --- a/DiabloUI/DiabloUI.dsp +++ b/DiabloUI/DiabloUI.dsp @@ -89,5 +89,9 @@ LINK32=link.exe SOURCE=.\diabloui.cpp # End Source File +# Begin Source File + +SOURCE=.\diabloui.res +# End Source File # End Target # End Project diff --git a/DiabloUI/_temp_data.cpp b/DiabloUI/_temp_data.cpp index d04fff88d..01f521eb0 100644 --- a/DiabloUI/_temp_data.cpp +++ b/DiabloUI/_temp_data.cpp @@ -8,10 +8,13 @@ ProfileStruct bnprofiles[4] = }; int profilemsg1[6] = { 1125, 1127, 1129, 1131, 1133, 0 }; int profilemsg2[6] = { 1126, 1128, 1130, 1132, 1134, 0 }; +int DiabEdit_cpp_float_value = 2139095040; // weak +int DiabloUI_cpp_float_value = 2139095040; // weak int doom_cpp_float_value = 2139095040; // weak int fade_cpp_float_value = 2139095040; // weak int focus_cpp_float_value = 2139095040; // weak int local_cpp_float_value = 2139095040; // weak +int Title_cpp_float_value = 2139095040; // weak int titlesnd_cpp_float_value = 2139095040; // weak int dword_10022258 = 4; // weak ProfFntStruct proffnts[4] = @@ -87,7 +90,7 @@ int dword_10023260[3] = { 1056, 1054, 0 }; int dword_1002326C[7] = { 1135, 1136, 1137, 1138, 1139, 1140, 0 }; int dword_100232D4[2] = { 1026, 0 }; int dword_100232DC[3] = { 1109, 2, 0 }; -int dword_10023340[2] = { 1067, 0 }; +int titlemsgtbl[2] = { 1067, 0 }; //data+bss int artfont_cpp_float = 0; // weak @@ -115,7 +118,7 @@ void *dword_1002942C; // idb int (__stdcall *dword_10029430)(_DWORD, _DWORD, _DWORD, _DWORD); // weak void *dword_10029434; // idb int dword_10029438[4]; // weak -char *wndtext_pointer; /* check */ +char nullcharacter; /* check */ HGDIOBJ dword_10029450; // idb int dword_10029454; // weak int dword_10029458; // weak @@ -190,15 +193,15 @@ int dword_100296FC; // weak int dword_10029700; // weak void *dword_10029704; // idb int dword_10029708; // weak -int dword_1002970C; // weak -int dword_10029710; // weak +int DiabEdit_cpp_float; // weak +int DiabloUI_cpp_float; // weak int dword_10029714; // weak -HINSTANCE hInstance; // idb -int dword_1002971C; // weak -int dword_10029720; // weak -int dword_10029724; // weak -int dword_10029728; // weak -int dword_1002972C; // weak +HINSTANCE ghUiInst; // idb +int backbmp_flag1; // weak +int backbmp_flag2; // weak +int backbmp_flag3; // weak +int app_is_active; // weak +int sgbIsSpawn; // weak int dword_10029730; // weak int dword_10029738; // weak char byte_1002973C; // idb @@ -345,8 +348,8 @@ int dword_1002A500; // weak int dword_1002A504; // weak int (*dword_1002A508)(void); // weak int dword_1002A50C; // weak -HANDLE dword_1002A510; // idb -int dword_1002A588; // weak -int dword_1002A58C; // weak +HANDLE titlePHTrans[30]; +int Title_cpp_float; // weak +int titleTransIdx; // weak int titlesnd_cpp_float; // weak void (__stdcall *gfnSoundFunction)(char *file); diff --git a/DiabloUI/_temp_funcs.h b/DiabloUI/_temp_funcs.h index 499d8af34..7c124c3ab 100644 --- a/DiabloUI/_temp_funcs.h +++ b/DiabloUI/_temp_funcs.h @@ -143,27 +143,30 @@ signed int __fastcall credits_10005736(_BYTE *a1); int __fastcall credits_10005755(int a1, int a2); -BOOL UNKCALL DiabEdit_10005765(HWND hWnd); -signed int DiabEdit_1000579B(); -ATOM DiabEdit_100057A6(); -HANDLE __fastcall DiabEdit_100057E8(int a1, int a2, HWND hWnd, UINT Msg, HANDLE hData, LPARAM lParam); -LRESULT __fastcall DiabEdit_1000591C(LPARAM lParam, unsigned short a2); -LRESULT UNKCALL DiabEdit_1000594E(LPARAM lParam); -char *__fastcall DiabEdit_10005A0A(HWND a1, unsigned char a2, int a3); -int __fastcall DiabEdit_10005AF4(LPARAM lParam, int a2, int a3); -char *__fastcall DiabEdit_10005B70(HWND hWnd, char *a2); -BOOL __fastcall DiabEdit_10005B9F(HWND hWnd, int a2); -HANDLE UNKCALL DiabEdit_10005BE7(HWND hWnd); - - -int DiabloUI_10005C2A(); -//int __stdcall UiSetBackgroundBitmap(int a1, int a2, int a3, int a4, int a5); -//int __stdcall UiSetSpawned(int a1); -//BOOL UiInitialize(); -//void *UiDestroy(); -//int __stdcall UiAppActivate(int a1); +void __fastcall DiabEdit_DoPaintBMP(HWND hWnd); +void __cdecl j_DiabEdit_cpp_init(); +void __cdecl DiabEdit_cpp_init(); +void __cdecl DiabEdit_SetupWindow(); +LRESULT __stdcall DiabEdit_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); +void __fastcall DiabEdit_SendWndCommand(HWND hWnd, WORD a2); +void __fastcall DiabEdit_GetCursorProp(HWND hWnd); +void __fastcall DiabEdit_RestrictAndLimit(HWND hWnd, WPARAM wParam, LPARAM lParam); +void __fastcall DiabEdit_SetTextAndProp(HWND hWnd, WPARAM wParam, LPARAM lParam); +void __fastcall DiabEdit_SetRestrictString(HWND hWnd, LPARAM lParam); +void __fastcall DiabEdit_SetRestrictTimer(HWND hWnd); +void __fastcall DiabEdit_RemoveAllProps(HWND hWnd); + + +int __cdecl DiabloUI_GetSpawned(); +void __stdcall UiOnPaint(int a1); +void __stdcall UiSetBackgroundBitmap(int a1, PALETTEENTRY *a2, int a3, int a4, int a5); +void __stdcall UiSetSpawned(BOOL bSpawned); +void __cdecl UiInitialize(); +void __cdecl UiDestroy(); +void __stdcall UiAppActivate(BOOL bActive); BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); -signed int DiabloUI_10005CEA(); +void __cdecl j_DiabloUI_cpp_init(); +void __cdecl DiabloUI_cpp_init(); signed int DirLink_10005CFA(); @@ -236,7 +239,7 @@ void __cdecl Fade_Range5SetZero(); void __fastcall Fade_NoInputAndArt(HWND hWnd, BOOL bShowCurs); void __fastcall Fade_SetInputWindow(HWND hWnd); void __fastcall Fade_SetFadeTimer(int nTime); -void __stdcall Fade_TimerFunctionDlg(int a1); +void __stdcall Fade_TimerFunctionDlg(int a1, int a2, int a3, int a4); void __cdecl j_Fade_cpp_init(); void __cdecl Fade_cpp_init(); @@ -253,7 +256,7 @@ void __cdecl j_Focus_cpp_init(); void __cdecl Focus_cpp_init(); void __fastcall Focus_LoadSpinner(const char *pszFileName); void __fastcall Focus_SetFocusTimer(HWND hWnd, const char *pszFileName); -void __stdcall Focus_SetFocusAndBlit(int hWnd); +void __stdcall Focus_SetFocusAndBlit(int hWnd, int a2, int a3, int a4); void __fastcall Focus_KillFocusTimer(HWND hWnd); @@ -595,20 +598,21 @@ int __fastcall SelYesNo_1000FD77(int a1, UINT a2, int a3); signed int SelYesNo_1000FDE3(); -_DWORD *UNKCALL Title_1000FDEE(HWND hWnd); -int Title_1000FEED(); -void **UNKCALL Title_1000FF0F(HWND hWnd); -HWND UNKCALL Title_1000FF51(HWND arg); -_DWORD *__fastcall Title_1000FFE8(HWND hWnd, const char *edx0); -int __fastcall Title_1001009E(HWND hWnd, const char *a2, HWND hWnda); -_DWORD *__stdcall Title_100100CB(HWND hWnd, int a2, int a3, int a4); -signed int Title_100100DC(); -void **UNKCALL Title_100100E7(HWND hWnd); -//signed int __stdcall UiTitleDialog(int a1); -int __stdcall Title_10010126(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); // idb -void UNKCALL Title_10010235(HWND hDlg); -int __fastcall Title_1001025A(HWND hWnd, int a2); -int UNKCALL Title_100102D7(void *arg); +void __fastcall Title_BlitTitleBuffer(HWND hWnd); +void __cdecl Title_DeletePhTrans(); +void __fastcall Title_FreeTransMem(HWND hWnd); +void __fastcall Title_SetTitleBMP(HWND hWnd); +void __fastcall Title_LoadTitleImage(HWND hWnd, const char *pszFileName); +void __fastcall Title_LoadImgSetTimer(HWND hWnd, const char *pszFileName); +void __stdcall Title_BlitTitleBufFnc(int hWnd, int a2, int a3, int a4); +void __cdecl j_Title_cpp_init(); +void __cdecl Title_cpp_init(); +void __fastcall Title_KillTitleTimer(HWND hWnd); +BOOL __stdcall UiTitleDialog(int a1); +LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +void __fastcall Title_KillTimerAndFree(HWND hWnd); +void __fastcall Title_LoadAllTitleImgs(HWND hWnd, int time); +void __fastcall Title_KillAndFadeDlg(HWND hWnd); void __fastcall TitleSnd_SetSoundFunction(void (__stdcall *func)(char *file)); diff --git a/DiabloUI/diabedit.cpp b/DiabloUI/diabedit.cpp index 541880be8..913695bc6 100644 --- a/DiabloUI/diabedit.cpp +++ b/DiabloUI/diabedit.cpp @@ -1,57 +1,51 @@ // ref: 0x10005765 -BOOL UNKCALL DiabEdit_10005765(HWND hWnd) { return 0; } -/* { - HWND v1; // esi +void __fastcall DiabEdit_DoPaintBMP(HWND hWnd) +{ struct tagPAINTSTRUCT Paint; // [esp+4h] [ebp-40h] - v1 = hWnd; BeginPaint(hWnd, &Paint); - SDlgDrawBitmap(v1, 1, 0, 0, 0, 0, 0); - return EndPaint(v1, &Paint); -} */ -// 1001042A: using guessed type int __stdcall SDlgDrawBitmap(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); + SDlgDrawBitmap(hWnd, 1, 0, 0, 0, 0, 0); + EndPaint(hWnd, &Paint); +} // ref: 0x1000579B -signed int DiabEdit_1000579B() { return 0; } -/* { - signed int result; // eax - - result = 2139095040; - dword_1002970C = 2139095040; - return result; -} */ -// 1002970C: using guessed type int dword_1002970C; +void __cdecl DiabEdit_cpp_init() +{ + DiabEdit_cpp_float = DiabEdit_cpp_float_value; +} +// 1001F40C: using guessed type int DiabEdit_cpp_float_value; +// 1002970C: using guessed type int DiabEdit_cpp_float; // ref: 0x100057A6 -ATOM DiabEdit_100057A6() { return 0; } -/* { +void __cdecl DiabEdit_SetupWindow() +{ WNDCLASSA WndClass; // [esp+0h] [ebp-28h] memset(&WndClass, 0, 0x28u); WndClass.style = 64; - WndClass.lpfnWndProc = (WNDPROC)DiabEdit_100057E8; + WndClass.lpfnWndProc = DiabEdit_WndProc; WndClass.hInstance = GetModuleHandleA(0); WndClass.lpszClassName = "DIABLOEDIT"; - return RegisterClassA(&WndClass); -} */ + RegisterClassA(&WndClass); +} // ref: 0x100057E8 -HANDLE __stdcall DiabEdit_100057E8(HWND hWnd, UINT Msg, HANDLE hData, LPARAM lParam) { return 0; } -/* { +LRESULT __stdcall DiabEdit_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ if ( Msg <= 0x113 ) { if ( Msg == 275 ) { - DiabEdit_1000594E((LPARAM)hWnd); + DiabEdit_GetCursorProp(hWnd); return 0; } if ( Msg == 1 ) { - DiabEdit_10005B9F(hWnd); + DiabEdit_SetRestrictTimer(hWnd); } else if ( Msg == 2 ) { - DiabEdit_10005BE7(hWnd); + DiabEdit_RemoveAllProps(hWnd); } else { @@ -59,251 +53,215 @@ HANDLE __stdcall DiabEdit_100057E8(HWND hWnd, UINT Msg, HANDLE hData, LPARAM lPa { if ( Msg == 15 ) { - DiabEdit_10005765(hWnd); + DiabEdit_DoPaintBMP(hWnd); } else { if ( Msg == 135 ) - return (HANDLE)129; + return 129; if ( Msg != 256 ) { if ( Msg == 258 ) - DiabEdit_10005A0A(hWnd, (unsigned char)hData, lParam); - return (HANDLE)DefWindowProcA(hWnd, Msg, (WPARAM)hData, lParam); + DiabEdit_RestrictAndLimit(hWnd, wParam, lParam); + return DefWindowProcA(hWnd, Msg, wParam, lParam); } - DiabEdit_10005AF4((LPARAM)hWnd, (int)hData, lParam); + DiabEdit_SetTextAndProp(hWnd, wParam, lParam); } return 0; } - DiabEdit_1000591C((LPARAM)hWnd, 1u); + DiabEdit_SendWndCommand(hWnd, 1u); } - return (HANDLE)DefWindowProcA(hWnd, Msg, (WPARAM)hData, lParam); + return DefWindowProcA(hWnd, Msg, wParam, lParam); } switch ( Msg ) { case 0x201u: SetFocus(hWnd); - return (HANDLE)DefWindowProcA(hWnd, Msg, (WPARAM)hData, lParam); + return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x400u: - SetWindowTextA(hWnd, &byte_10029448); - DiabEdit_1000591C((LPARAM)hWnd, 3u); + SetWindowTextA(hWnd, &nullcharacter); + DiabEdit_SendWndCommand(hWnd, 3u); return 0; case 0x401u: - SetPropA(hWnd, "LIMIT", hData); + SetPropA(hWnd, "LIMIT", (HANDLE)wParam); return 0; case 0x402u: - return GetPropA(hWnd, "LIMIT"); + return (LRESULT)GetPropA(hWnd, "LIMIT"); } if ( Msg != 1027 ) { if ( Msg == 1028 ) { - DiabEdit_10005B70(hWnd, (char *)lParam); + DiabEdit_SetRestrictString(hWnd, lParam); return 0; } - return (HANDLE)DefWindowProcA(hWnd, Msg, (WPARAM)hData, lParam); + return DefWindowProcA(hWnd, Msg, wParam, lParam); } - return GetPropA(hWnd, "CURSOR"); -} */ + return (LRESULT)GetPropA(hWnd, "CURSOR"); +} // ref: 0x1000591C -LRESULT __fastcall DiabEdit_1000591C(LPARAM lParam, unsigned short a2) { return 0; } -/* { - HWND v2; // esi - LPARAM v3; // ST0C_4 +void __fastcall DiabEdit_SendWndCommand(HWND hWnd, WORD a2) +{ int v4; // ST08_4 HWND v5; // eax - v2 = (HWND)lParam; - v3 = lParam; - v4 = (a2 << 16) | (unsigned short)GetWindowLongA((HWND)lParam, -12); - v5 = GetParent(v2); - return SendMessageA(v5, 0x111u, v4, v3); -} */ + v4 = (a2 << 16) | (unsigned short)GetWindowLongA(hWnd, -12); + v5 = GetParent(hWnd); + SendMessageA(v5, 0x111u, v4, (LPARAM)hWnd); +} // ref: 0x1000594E -LRESULT UNKCALL DiabEdit_1000594E(LPARAM lParam) { return 0; } -/* { - HWND v1; // ebx - LRESULT result; // eax - size_t v3; // eax - CHAR *v4; // esi - CHAR String; // [esp+Ch] [ebp-100h] - char v6[252]; // [esp+Dh] [ebp-FFh] - short v7; // [esp+109h] [ebp-3h] - char v8; // [esp+10Bh] [ebp-1h] +void __fastcall DiabEdit_GetCursorProp(HWND hWnd) +{ + size_t v2; // eax + char *v3; // esi + char String[256]; // [esp+Ch] [ebp-100h] - v1 = (HWND)lParam; - String = byte_10029448; - memset(v6, 0, sizeof(v6)); - v7 = 0; - v8 = 0; - if ( GetPropA((HWND)lParam, "CURSOR") ) + String[0] = nullcharacter; + memset(&String[1], 0, 0xFCu); + *(_WORD *)&String[253] = 0; + String[255] = 0; + if ( GetPropA(hWnd, "CURSOR") ) { - SetPropA(v1, "CURSOR", 0); - result = DiabEdit_1000591C((LPARAM)v1, 3u); + SetPropA(hWnd, "CURSOR", 0); + DiabEdit_SendWndCommand(hWnd, 3u); } else { - SetPropA(v1, "CURSOR", HANDLE_FLAG_INHERIT); - GetWindowTextA(v1, &String, 255); - HIBYTE(v7) = 0; - v3 = strlen(&String); - v6[v3] = 0; - v4 = &String + v3; - *(&String + v3) = 124; - SetWindowTextA(v1, &String); - DiabEdit_1000591C((LPARAM)v1, 3u); - *v4 = 0; - result = SetWindowTextA(v1, &String); + SetPropA(hWnd, "CURSOR", (void *)HANDLE_FLAG_INHERIT); + GetWindowTextA(hWnd, String, 255); + String[254] = 0; + v2 = strlen(String); + String[v2 + 1] = 0; + v3 = &String[v2]; + String[v2] = 124; + SetWindowTextA(hWnd, String); + DiabEdit_SendWndCommand(hWnd, 3u); + *v3 = 0; + SetWindowTextA(hWnd, String); } - return result; -} */ -// 1000594E: using guessed type char var_FF[252]; +} // ref: 0x10005A0A -char *__fastcall DiabEdit_10005A0A(HWND a1, unsigned char a2, int a3) { return 0; } -/* { - char *result; // eax - unsigned char v4; // bl +void __fastcall DiabEdit_RestrictAndLimit(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + unsigned char v3; // bl + char *v4; // eax char v5; // cl signed int v6; // eax signed int v7; // esi - char v8; // [esp+7h] [ebp-105h] - CHAR String; // [esp+8h] [ebp-104h] - char v10[252]; // [esp+9h] [ebp-103h] - short v11; // [esp+105h] [ebp-7h] - char v12; // [esp+107h] [ebp-5h] - HWND hWnd; // [esp+108h] [ebp-4h] + //char v8; // [esp+7h] [ebp-105h] + char String[256]; // [esp+8h] [ebp-104h] - hWnd = a1; - String = byte_10029448; - result = 0; - v4 = a2; - memset(v10, 0, sizeof(v10)); - v11 = 0; - v12 = 0; - if ( a2 == 8 ) + String[0] = nullcharacter; + v3 = wParam; + memset(&String[1], 0, 0xFCu); + *(_WORD *)&String[253] = 0; + String[255] = 0; + if ( (_BYTE)wParam == 8 ) goto LABEL_9; - if ( a2 < 0x20u || a2 > 0x7Eu && a2 < 0xC0u ) - return result; - result = (char *)GetPropA(hWnd, "RESTRICTED"); - if ( !result || (v5 = *result) == 0 ) + if ( (unsigned char)wParam < 0x20u || (unsigned char)wParam > 0x7Eu && (unsigned char)wParam < 0xC0u ) + return; + v4 = (char *)GetPropA(hWnd, "RESTRICTED"); + if ( !v4 || (v5 = *v4) == 0 ) { LABEL_9: - GetWindowTextA(hWnd, &String, 255); - HIBYTE(v11) = 0; - v6 = strlen(&String); + GetWindowTextA(hWnd, String, 255); + String[254] = 0; + v6 = strlen(String); v7 = v6; - if ( v4 == 8 ) + if ( v3 == 8 ) { if ( v6 ) { - *(&v8 + v6) = 0; + String[v6-1] = 0; // *(&v8 + v6) = 0; goto LABEL_14; } } else if ( v6 < (signed int)GetPropA(hWnd, "LIMIT") ) { - *(&String + v7) = v4; - v10[v7] = 0; + String[v7] = v3; + String[v7 + 1] = 0; LABEL_14: - SetWindowTextA(hWnd, &String); - return (char *)DiabEdit_1000594E((LPARAM)hWnd); + SetWindowTextA(hWnd, String); + goto LABEL_15; } - return (char *)DiabEdit_1000594E((LPARAM)hWnd); +LABEL_15: + DiabEdit_GetCursorProp(hWnd); + return; } - while ( v4 != v5 ) + while ( v3 != v5 ) { - v5 = *++result; - if ( !*result ) + v5 = *++v4; + if ( !*v4 ) goto LABEL_9; } - return result; -} */ -// 10005A0A: using guessed type char var_103[252]; +} // ref: 0x10005AF4 -int __fastcall DiabEdit_10005AF4(LPARAM lParam, int a2, int a3) { return 0; } -/* { - HWND v3; // esi - int v4; // ebx - int result; // eax - char v6; // [esp+Bh] [ebp-101h] - CHAR String; // [esp+Ch] [ebp-100h] - char v8; // [esp+Dh] [ebp-FFh] - short v9; // [esp+109h] [ebp-3h] - char v10; // [esp+10Bh] [ebp-1h] +void __fastcall DiabEdit_SetTextAndProp(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + WPARAM v4; // ebx + size_t v5; // eax + //char v6; // [esp+Bh] [ebp-101h] + char String[256]; // [esp+Ch] [ebp-100h] - v3 = (HWND)lParam; - String = byte_10029448; - memset(&v8, 0, 0xFCu); - v9 = 0; - v10 = 0; - v4 = a2; - GetWindowTextA((HWND)lParam, &String, 255); - HIBYTE(v9) = 0; - result = strlen(&String); + String[0] = nullcharacter; + memset(&String[1], 0, 0xFCu); + *(_WORD *)&String[253] = 0; + String[255] = 0; + v4 = wParam; + GetWindowTextA(hWnd, String, 255); + String[254] = 0; + v5 = strlen(String); if ( v4 == 37 ) { - if ( result ) + if ( v5 ) { - *(&v6 + result) = 0; - SetWindowTextA(v3, &String); + String[v5-1] = 0; // *(&v6 + v5) = 0; + SetWindowTextA(hWnd, String); } - result = DiabEdit_1000594E((LPARAM)v3); + DiabEdit_GetCursorProp(hWnd); } - return result; -} */ +} // ref: 0x10005B70 -char *__fastcall DiabEdit_10005B70(HWND hWnd, char *a2) { return 0; } -/* { - char *v2; // edi - char *result; // eax - char *v4; // esi +void __fastcall DiabEdit_SetRestrictString(HWND hWnd, LPARAM lParam) +{ + const char *v2; // edi + char *v3; // eax MAPDST - v2 = a2; - result = (char *)GetPropA(hWnd, "RESTRICTED"); - v4 = result; - if ( result ) + v2 = (const char *)lParam; + v3 = (char *)GetPropA(hWnd, "RESTRICTED"); + if ( v3 ) { - result = strncpy(result, v2, 0xFFu); - v4[255] = 0; + strncpy(v3, v2, 0xFFu); + v3[255] = 0; } - return result; -} */ +} // ref: 0x10005B9F -BOOL UNKCALL DiabEdit_10005B9F(HWND hWnd) { return 0; } -/* { - HWND v1; // esi - _BYTE *v2; // eax +void __fastcall DiabEdit_SetRestrictTimer(HWND hWnd) +{ + unsigned char *v2; // eax - v1 = hWnd; - SDlgSetTimer(hWnd, 1, 500, 0); - SetPropA(v1, "CURSOR", 0); - v2 = (_BYTE *)SMemAlloc(256, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 185, 0); + SDlgSetTimer((int)hWnd, 1, 500, 0); + SetPropA(hWnd, "CURSOR", 0); + v2 = (unsigned char *)SMemAlloc(0x100u, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 185, 0); *v2 = 0; - return SetPropA(v1, "RESTRICTED", v2); -} */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); + SetPropA(hWnd, "RESTRICTED", v2); +} // ref: 0x10005BE7 -HANDLE UNKCALL DiabEdit_10005BE7(HWND hWnd) { return 0; } -/* { - HWND v1; // edi - HANDLE result; // eax +void __fastcall DiabEdit_RemoveAllProps(HWND hWnd) +{ + HANDLE v2; // eax - v1 = hWnd; - SDlgKillTimer(hWnd, 1); - RemovePropA(v1, "LIMIT"); - RemovePropA(v1, "CURSOR"); - result = RemovePropA(v1, "RESTRICTED"); - if ( result ) - result = (HANDLE)SMemFree(result, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 200, 0); - return result; -} */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); + SDlgKillTimer((int)hWnd, 1); + RemovePropA(hWnd, "LIMIT"); + RemovePropA(hWnd, "CURSOR"); + v2 = RemovePropA(hWnd, "RESTRICTED"); + if ( v2 ) + SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\DiabEdit.cpp", 200, 0); +} diff --git a/DiabloUI/diabloui.cpp b/DiabloUI/diabloui.cpp index 184a0902d..7b8ebd6dc 100644 --- a/DiabloUI/diabloui.cpp +++ b/DiabloUI/diabloui.cpp @@ -66,11 +66,11 @@ // ref: 0x10005C2A -int DiabloUI_10005C2A() { return 0; } -/* { - return dword_1002972C; -} */ -// 1002972C: using guessed type int dword_1002972C; +int __cdecl DiabloUI_GetSpawned() +{ + return sgbIsSpawn; +} +// 1002972C: using guessed type int sgbIsSpawn; // ref: 0x10005C30 void __stdcall UiOnPaint(int a1) @@ -79,67 +79,52 @@ void __stdcall UiOnPaint(int a1) } // ref: 0x10005C33 -int __stdcall UiSetBackgroundBitmap(int a1, int a2, int a3, int a4, int a5) { return 0; } -/* { - dword_1002971C = a3; - dword_10029720 = a4; - dword_10029724 = a5; - return SDrawUpdatePalette(10, 236, a2 + 40, 0); -} */ -// 100103FA: using guessed type int __stdcall SDrawUpdatePalette(_DWORD, _DWORD, _DWORD, _DWORD); -// 1002971C: using guessed type int dword_1002971C; -// 10029720: using guessed type int dword_10029720; -// 10029724: using guessed type int dword_10029724; +void __stdcall UiSetBackgroundBitmap(int a1, PALETTEENTRY *a2, int a3, int a4, int a5) +{ + backbmp_flag1 = a3; + backbmp_flag2 = a4; + backbmp_flag3 = a5; + SDrawUpdatePalette(0xAu, 0xECu, a2 + 10, 0); +} +// 1002971C: using guessed type int backbmp_flag1; +// 10029720: using guessed type int backbmp_flag2; +// 10029724: using guessed type int backbmp_flag3; // ref: 0x10005C67 -int __stdcall UiSetSpawned(int a1) { return 0; } -/* { - int result; // eax - - result = a1; - dword_1002972C = a1; - return result; -} */ -// 1002972C: using guessed type int dword_1002972C; +void __stdcall UiSetSpawned(BOOL bSpawned) +{ + sgbIsSpawn = bSpawned; +} +// 1002972C: using guessed type int sgbIsSpawn; // ref: 0x10005C73 -void __cdecl UiInitialize() { return; } -//int UiInitialize() { return 0; } -/* { +void __cdecl UiInitialize() +{ dword_10029714 = 1; - TitleSnd_1001030D(); - artfont_10001098(); + TitleSnd_InitSoundFunc(); + artfont_InitAllFonts(); Connect_10002EC4(); - local_10007FD0(); - return bn_prof_100021C4(); -} */ + local_LoadArtCursor(); + bn_prof_100021C4(); +} // 10029714: using guessed type int dword_10029714; // ref: 0x10005C96 -void __cdecl UiDestroy() { return; } -//int UiDestroy() { return 0; } -/* { - int result; // eax - +void __cdecl UiDestroy() +{ bn_prof_10002247(); - local_100080AD(); - result = Connect_10002E2B(); + local_FreeArtCursor(); + Connect_10002E2B(); dword_10029714 = 0; - return result; -} */ +} // 10029714: using guessed type int dword_10029714; // ref: 0x10005CAD -void __stdcall UiAppActivate(int a1) { return; } -//int __stdcall UiAppActivate(int a1) { return 0; } -/* { - int result; // eax - - result = a1; - dword_10029728 = a1; - return result; -} */ -// 10029728: using guessed type int dword_10029728; +void __stdcall UiAppActivate(BOOL bActive) +{ + app_is_active = bActive; +} +// 10029728: using guessed type int app_is_active; // ref: 0x10005CB9 BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) @@ -148,8 +133,8 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if ( fdwReason == 1 ) { - // hInstance = hinstDLL; - DiabEdit_100057A6(); + ghUiInst = hinstDLL; + DiabEdit_SetupWindow(); local_InitUiPalette(); } } @@ -161,12 +146,9 @@ BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } // ref: 0x10005CEA -signed int DiabloUI_10005CEA() { return 0; } -/* { - signed int result; // eax - - result = 2139095040; - dword_10029710 = 2139095040; - return result; -} */ -// 10029710: using guessed type int dword_10029710; +void __cdecl DiabloUI_cpp_init() +{ + DiabloUI_cpp_float = DiabloUI_cpp_float_value; +} +// 1001F410: using guessed type int DiabloUI_cpp_float_value; +// 10029710: using guessed type int DiabloUI_cpp_float; diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index 836c2a4ad..8566bd8ef 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -29,10 +29,10 @@ struct ProfFntStruct }; void __cdecl UiDestroy(); -void __stdcall UiTitleDialog(int a1); +BOOL __stdcall UiTitleDialog(int a1); void __cdecl UiInitialize(); void __stdcall UiCopyProtError(int a1); -void __stdcall UiAppActivate(int a1); +void __stdcall UiAppActivate(BOOL bActive); int __stdcall UiValidPlayerName(char *a1); int __stdcall UiSelHeroMultDialog(void *fninfo, void *fncreate, void *fnremove, void *fnstats, int *a5, int *a6, char *name); int __stdcall UiSelHeroSingDialog(void *fninfo, void *fncreate, void *fnremove, void *fnstats, int *a5, char *name, int *difficulty); diff --git a/DiabloUI/diabloui.res b/DiabloUI/diabloui.res new file mode 100644 index 000000000..886557e2c Binary files /dev/null and b/DiabloUI/diabloui.res differ diff --git a/DiabloUI/doom.cpp b/DiabloUI/doom.cpp index 5e7f88f23..7ab14bb09 100644 --- a/DiabloUI/doom.cpp +++ b/DiabloUI/doom.cpp @@ -40,7 +40,7 @@ void __fastcall Doom_GetSetWndText(HWND hWnd, int msg, int nFont, int a4) { v6 = GetWindowLongA(v4, -21); local_SetWndLongStr(v6, String); - SetWindowTextA(v4, (LPCSTR)&wndtext_pointer); + SetWindowTextA(v4, &nullcharacter); } } } @@ -104,7 +104,7 @@ void __fastcall Doom_AllocAndSetBMP(HWND hWnd, int bmp_flags) v3[2] = Rect.bottom; *v3 = (DWORD)SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Doom.cpp", 139, 0); SetWindowLongA(hWnd, -21, (LONG)v3); - SDlgSetBitmapI(hWnd, 0, (char *)&wndtext_pointer, -1, bmp_flags, (void *)*v3, 0, v3[1], v3[2], -1); + SDlgSetBitmapI(hWnd, 0, &nullcharacter, -1, bmp_flags, (void *)*v3, 0, v3[1], v3[2], -1); } // ref: 0x1000678A @@ -167,7 +167,7 @@ void __fastcall Doom_GetSetWndTxt2(HWND hWnd, int msg, int nFont, int a4) { v5 = GetWindowLongA(v4, -21); local_SetWndLongStr(v5, String); - SetWindowTextA(v4, (LPCSTR)&wndtext_pointer); + SetWindowTextA(v4, &nullcharacter); } } } @@ -208,7 +208,7 @@ void __fastcall Doom_GetSetWndTxt3(HWND hWnd, int msg, int nFont) { v6 = GetWindowLongA(v3, -21); local_SetWndLongStr(v6, String); - SetWindowTextA(v3, (LPCSTR)&wndtext_pointer); + SetWindowTextA(v3, &nullcharacter); } } } @@ -280,7 +280,7 @@ void __fastcall Doom_GetSetWndTxt4(HWND hWnd, int msg, int nFont) { v5 = GetWindowLongA(v3, -21); local_SetWndLongStr(v5, String); - SetWindowTextA(v3, (LPCSTR)&wndtext_pointer); + SetWindowTextA(v3, &nullcharacter); } } } diff --git a/DiabloUI/fade.cpp b/DiabloUI/fade.cpp index d14c581eb..3d454eea3 100644 --- a/DiabloUI/fade.cpp +++ b/DiabloUI/fade.cpp @@ -135,7 +135,7 @@ void __fastcall Fade_SetFadeTimer(int nTime) // 10029C70: using guessed type int sgbIsFading; // ref: 0x10007420 -void __stdcall Fade_TimerFunctionDlg(int a1) +void __stdcall Fade_TimerFunctionDlg(int a1, int a2, int a3, int a4) { if ( sgbFadeRange > 5 ) { diff --git a/DiabloUI/focus.cpp b/DiabloUI/focus.cpp index 3d306af6d..51cf5fb88 100644 --- a/DiabloUI/focus.cpp +++ b/DiabloUI/focus.cpp @@ -230,7 +230,7 @@ void __fastcall Focus_SetFocusTimer(HWND hWnd, const char *pszFileName) } // ref: 0x10007804 -void __stdcall Focus_SetFocusAndBlit(int hWnd) +void __stdcall Focus_SetFocusAndBlit(int hWnd, int a2, int a3, int a4) { HWND v1; // eax diff --git a/DiabloUI/local.cpp b/DiabloUI/local.cpp index 654370b46..38f746e43 100644 --- a/DiabloUI/local.cpp +++ b/DiabloUI/local.cpp @@ -570,7 +570,7 @@ void __fastcall local_SetDiabloCursor(HWND hWnd) v3 = 0; local_SetCursorDefault(); - v2 = LoadCursorA(hInstance, "DIABLOCURSOR"); + v2 = LoadCursorA(ghUiInst, "DIABLOCURSOR"); SDlgSetCursor(hWnd, v2, 32512, &v3); } // 10010454: using guessed type int __stdcall SDlgSetCursor(_DWORD, _DWORD, _DWORD, _DWORD); diff --git a/DiabloUI/title.cpp b/DiabloUI/title.cpp index 08687c72e..5bb577151 100644 --- a/DiabloUI/title.cpp +++ b/DiabloUI/title.cpp @@ -1,352 +1,296 @@ // ref: 0x1000FDEE -_DWORD *UNKCALL Title_1000FDEE(HWND hWnd) { return 0; } -/* { - HWND v1; // esi +void __fastcall Title_BlitTitleBuffer(HWND hWnd) +{ _DWORD *v2; // edi - _DWORD *result; // eax - int v4; // eax - _DWORD *v5; // esi + int v3; // eax + HANDLE v4; // esi struct tagRECT Rect; // [esp+Ch] [ebp-18h] - HWND v7; // [esp+1Ch] [ebp-8h] HWND hWnda; // [esp+20h] [ebp-4h] - v1 = hWnd; - v7 = hWnd; v2 = (_DWORD *)GetWindowLongA(hWnd, -21); - hWnda = GetDlgItem(v1, 1043); - result = (_DWORD *)IsWindowVisible(v1); - if ( result && hWnda && v2 && *v2 && dword_1002A510[0] ) + hWnda = GetDlgItem(hWnd, 1043); + if ( IsWindowVisible(hWnd) && hWnda && v2 && *v2 && titlePHTrans[0] ) { - v4 = dword_1002A58C + 1; - dword_1002A58C = v4; - if ( !dword_1002A510[v4] || v4 >= 30 ) - dword_1002A58C = 0; + v3 = titleTransIdx + 1; + titleTransIdx = v3; + if ( !titlePHTrans[v3] || v3 >= 30 ) + titleTransIdx = 0; GetWindowRect(hWnda, &Rect); - ScreenToClient(v1, (LPPOINT)&Rect); - ScreenToClient(v7, (LPPOINT)&Rect.right); - result = GetPropA(v7, "TITLE_BUFFER"); - v5 = result; - if ( result ) + ScreenToClient(hWnd, (LPPOINT)&Rect); + ScreenToClient(hWnd, (LPPOINT)&Rect.right); + v4 = GetPropA(hWnd, "TITLE_BUFFER"); + if ( v4 ) { - SBltROP3(*result, Rect.left + *v2 + Rect.top * v2[1], result[1], result[2], result[1], v2[1], 0, 13369376); - STransBlt(*v5, 0, 0, v5[1], dword_1002A510[dword_1002A58C]); - result = (_DWORD *)InvalidateRect(hWnda, 0, 0); + SBltROP3( + *(void **)v4, + (void *)(Rect.left + *v2 + Rect.top * v2[1]), + *((_DWORD *)v4 + 1), + *((_DWORD *)v4 + 2), + *((_DWORD *)v4 + 1), + v2[1], + 0, + 0xCC0020u); + STransBlt(*(void **)v4, 0, 0, *((_DWORD *)v4 + 1), (HANDLE)titlePHTrans[titleTransIdx]); + InvalidateRect(hWnda, 0, 0); } } - return result; -} */ -// 1001036A: using guessed type int __stdcall STransBlt(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 100103F4: using guessed type int __stdcall SBltROP3(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 1002A58C: using guessed type int dword_1002A58C; +} +// 1002A58C: using guessed type int titleTransIdx; // ref: 0x1000FEED -int Title_1000FEED() { return 0; } -/* { +void __cdecl Title_DeletePhTrans() +{ int *v0; // esi - int result; // eax - v0 = dword_1002A510; + v0 = (int *)titlePHTrans; do { - result = *v0; if ( *v0 ) { - result = STransDelete(*v0); + STransDelete((HANDLE)*v0); *v0 = 0; } ++v0; } - while ( (signed int)v0 < (signed int)&dword_1002A588 ); - return result; -} */ -// 1001033A: using guessed type int __stdcall STransDelete(_DWORD); -// 1002A588: using guessed type int dword_1002A588; + while ( (signed int)v0 < (signed int)&titlePHTrans[30] ); +} // ref: 0x1000FF0F -void **UNKCALL Title_1000FF0F(HWND hWnd) { return 0; } -/* { - HWND v1; // esi - _DWORD *result; // eax - _DWORD *v3; // esi - int v4; // eax +void __fastcall Title_FreeTransMem(HWND hWnd) +{ + void **v2; // eax MAPDST + void *v4; // eax - v1 = hWnd; - Title_1000FEED(); - result = RemovePropA(v1, "TITLE_BUFFER"); - v3 = result; - if ( result ) + Title_DeletePhTrans(); + v2 = (void **)RemovePropA(hWnd, "TITLE_BUFFER"); + if ( v2 ) { - v4 = *result; + v4 = *v2; if ( v4 ) { SMemFree(v4, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 114, 0); - *v3 = 0; + *v2 = 0; } - result = (_DWORD *)SMemFree(v3, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 117, 0); + SMemFree(v2, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 117, 0); } - return result; -} */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); +} // ref: 0x1000FF51 -HWND UNKCALL Title_1000FF51(HWND arg) { return 0; } -/* { - HWND result; // eax - int *v2; // esi - int v3; // eax +void __fastcall Title_SetTitleBMP(HWND hWnd) +{ + HWND v1; // eax MAPDST + _DWORD *v2; // esi + void *v3; // eax struct tagRECT Rect; // [esp+0h] [ebp-18h] - HWND v5; // [esp+10h] [ebp-8h] - HWND hDlg; // [esp+14h] [ebp-4h] - hDlg = arg; - Title_1000FF0F(arg); - result = GetDlgItem(hDlg, 1043); - v5 = result; - if ( result ) + Title_FreeTransMem(hWnd); + v1 = GetDlgItem(hWnd, 1043); + if ( v1 ) { - GetClientRect(result, &Rect); - v2 = (int *)SMemAlloc(12, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0); + GetClientRect(v1, &Rect); + v2 = (unsigned int *)SMemAlloc(0xCu, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 134, 0); v3 = SMemAlloc(Rect.right * Rect.bottom, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 136, 8); - *v2 = v3; + *v2 = (unsigned int)v3; v2[1] = Rect.right; v2[2] = Rect.bottom; - SDlgSetBitmapI(v5, 0, 0, -1, 1, v3, 0, Rect.right, Rect.bottom, -1); - result = (HWND)SetPropA(hDlg, "TITLE_BUFFER", v2); + SDlgSetBitmapI(v1, 0, 0, -1, 1, v3, 0, Rect.right, Rect.bottom, -1); + SetPropA(hWnd, "TITLE_BUFFER", v2); } - return result; -} */ -// 10010364: using guessed type int __stdcall SMemAlloc(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010400: using guessed type int __stdcall SDlgSetBitmapI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +} // ref: 0x1000FFE8 -_DWORD *__fastcall Title_1000FFE8(HWND hWnd, int a2) { return 0; } -/* { - HWND v2; // esi +void __fastcall Title_LoadTitleImage(HWND hWnd, const char *pszFileName) +{ int v3; // edi - _DWORD *result; // eax - int v5; // esi + _DWORD *v4; // eax + _DWORD *v5; // esi int v6; // ebx - int v7; // [esp+8h] [ebp-20h] - int v8; // [esp+Ch] [ebp-1Ch] - int v9; // [esp+10h] [ebp-18h] - int v10; // [esp+14h] [ebp-14h] - char v11; // [esp+18h] [ebp-10h] - int v12; // [esp+1Ch] [ebp-Ch] - int *v13; // [esp+20h] [ebp-8h] - int v14; // [esp+24h] [ebp-4h] + int a5[4]; // [esp+8h] [ebp-20h] + int data[2]; // [esp+18h] [ebp-10h] + HANDLE *phTransOut; // [esp+20h] [ebp-8h] + BYTE *pBuffer; // [esp+24h] [ebp-4h] - v2 = hWnd; v3 = 0; - v14 = 0; - local_100078BE(a2, &v14, &v11); - result = GetPropA(v2, "TITLE_BUFFER"); - v5 = (int)result; - if ( v14 ) + pBuffer = 0; + local_LoadArtImage(pszFileName, &pBuffer, (DWORD *)data); + v4 = (unsigned int *)GetPropA(hWnd, "TITLE_BUFFER"); + v5 = v4; + if ( pBuffer ) { - if ( result ) + if ( v4 ) { - v6 = v12 / result[2]; + v6 = data[1] / v4[2]; if ( v6 > 30 ) v6 = 30; if ( v6 > 0 ) { - v13 = dword_1002A510; + phTransOut = (HANDLE *)titlePHTrans; do { - v7 = 0; - v9 = *(_DWORD *)(v5 + 4) - 1; - v8 = v3 * *(_DWORD *)(v5 + 8); - v10 = *(_DWORD *)(v5 + 8) + v8 - 1; - STransCreateI(v14, *(_DWORD *)(v5 + 4), *(_DWORD *)(v5 + 8), 8, &v7, 16777466, v13); - ++v13; + a5[0] = 0; + a5[2] = v5[1] - 1; + a5[1] = v3 * v5[2]; + a5[3] = v5[2] + a5[1] - 1; + STransCreateI(pBuffer, v5[1], v5[2], 8, (int)a5, 16777466, phTransOut); + ++phTransOut; ++v3; } while ( v3 < v6 ); } } - result = (_DWORD *)SMemFree(v14, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 197, 0); + SMemFree(pBuffer, "C:\\Src\\Diablo\\DiabloUI\\Title.cpp", 197, 0); } - dword_1002A58C = 0; - return result; -} */ -// 10010340: using guessed type int __stdcall SMemFree(_DWORD, _DWORD, _DWORD, _DWORD); -// 10010346: using guessed type int __stdcall STransCreateI(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); -// 1002A58C: using guessed type int dword_1002A58C; + titleTransIdx = 0; +} +// 1002A58C: using guessed type int titleTransIdx; // ref: 0x1001009E -int __fastcall Title_1001009E(HWND hWnd, int a2, HWND hWnda) { return 0; } -/* { - int v3; // edi - HWND v4; // esi - - v3 = a2; - v4 = hWnd; - Title_1000FF51(hWnd); - Title_1000FFE8(v4, v3); - Title_1000FDEE(v4); - return SDlgSetTimer(v4, 2, 55, Title_100100CB); -} */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); +void __fastcall Title_LoadImgSetTimer(HWND hWnd, const char *pszFileName) +{ + Title_SetTitleBMP(hWnd); + Title_LoadTitleImage(hWnd, pszFileName); + Title_BlitTitleBuffer(hWnd); + SDlgSetTimer((int)hWnd, 2, 55, Title_BlitTitleBufFnc); +} // ref: 0x100100CB -_DWORD *__stdcall Title_100100CB(HWND hWnd, int a2, int a3, int a4) { return 0; } -/* { - return Title_1000FDEE(hWnd); -} */ +void __stdcall Title_BlitTitleBufFnc(int hWnd, int a2, int a3, int a4) +{ + Title_BlitTitleBuffer((HWND)hWnd); +} // ref: 0x100100DC -signed int Title_100100DC() { return 0; } -/* { - signed int result; // eax - - result = 2139095040; - dword_1002A588 = 2139095040; - return result; -} */ -// 1002A588: using guessed type int dword_1002A588; +void __cdecl Title_cpp_init() +{ + Title_cpp_float = Title_cpp_float_value; +} +// 1001F47C: using guessed type int Title_cpp_float_value; +// 1002A588: using guessed type int Title_cpp_float; // ref: 0x100100E7 -void **UNKCALL Title_100100E7(HWND hWnd) { return 0; } -/* { +void __fastcall Title_KillTitleTimer(HWND hWnd) +{ HWND v1; // esi v1 = hWnd; - SDlgKillTimer(hWnd, 2); - return Title_1000FF0F(v1); -} */ -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); + SDlgKillTimer((int)hWnd, 2); + Title_FreeTransMem(v1); +} // ref: 0x100100FA -void __stdcall UiTitleDialog(int a1) { return; } -/* { +BOOL __stdcall UiTitleDialog(int a1) +{ int v1; // eax - artfont_10001159(); - v1 = SDrawGetFrameWindow(); - SDlgDialogBoxParam(hInstance, "TITLESCREEN_DIALOG", v1, Title_10010126, a1); + artfont_LoadAllFonts(); + v1 = (int)SDrawGetFrameWindow(); + SDlgDialogBoxParam(ghUiInst, "TITLESCREEN_DIALOG", v1, Title_MainProc, a1); return 1; -} */ -// 10010370: using guessed type int __stdcall SDlgDialogBoxParam(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); +} // 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10010126 -int __stdcall Title_10010126(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { return 0; } -/* { +LRESULT __stdcall Title_MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ HWND v5; // eax - int v6; // [esp+0h] [ebp-8h] - if ( Msg <= 0x111 ) + if ( uMsg <= 0x111 ) { - if ( Msg != 273 ) + if ( uMsg != 273 ) { - if ( Msg != 2 ) + if ( uMsg != 2 ) { - if ( Msg == 135 ) + if ( uMsg == 135 ) return 4; - if ( Msg != 256 ) + if ( uMsg != 256 ) { - if ( Msg > 0x103 ) + if ( uMsg > 0x103 ) { - if ( Msg <= 0x105 ) + if ( uMsg <= 0x105 ) { v5 = (HWND)SDrawGetFrameWindow(); - SendMessageA(v5, Msg, wParam, lParam); + SendMessageA(v5, uMsg, wParam, lParam); } - else if ( Msg == 272 ) + else if ( uMsg == 272 ) { - Title_1001025A(hWnd, lParam); + Title_LoadAllTitleImgs(hWnd, lParam); PostMessageA(hWnd, 0x7E8u, 0, 0); return 1; } } - return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); + return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam); } goto LABEL_25; } - Title_10010235(hWnd); - return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); + Title_KillTimerAndFree(hWnd); + return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam); } goto LABEL_25; } - if ( Msg != 275 ) + if ( uMsg != 275 ) { - if ( Msg != 513 && Msg != 516 ) + if ( uMsg != 513 && uMsg != 516 ) { - if ( Msg == 528 ) + if ( uMsg == 528 ) { if ( (_WORD)wParam == 513 || (_WORD)wParam == 516 ) - Title_100102D7(hWnd); + Title_KillAndFadeDlg(hWnd); } - else if ( Msg == 2024 ) + else if ( uMsg == 2024 ) { - if ( !Fade_1000739F() ) - Fade_100073FD(hWnd, v6); + if ( !Fade_CheckRange5() ) + Fade_SetFadeTimer((int)hWnd); return 0; } - return SDlgDefDialogProc(hWnd, Msg, wParam, lParam); + return (LRESULT)SDlgDefDialogProc(hWnd, uMsg, (HDC)wParam, (HWND)lParam); } LABEL_25: - Title_100102D7(hWnd); + Title_KillAndFadeDlg(hWnd); return 0; } if ( wParam == 1 ) goto LABEL_25; return 0; -} */ +} // 1001037C: using guessed type int __stdcall SDlgDefDialogProc(_DWORD, _DWORD, _DWORD, _DWORD); // 10010382: using guessed type _DWORD __stdcall SDrawGetFrameWindow(); // ref: 0x10010235 -void UNKCALL Title_10010235(HWND hDlg) { return; } -/* { - HWND v1; // esi - _DWORD *v2; // eax +void __fastcall Title_KillTimerAndFree(HWND hWnd) +{ + void **v2; // eax - v1 = hDlg; - Title_100100E7(hDlg); - Doom_10006C53(v1, (int *)&unk_10023340); - v2 = (_DWORD *)GetWindowLongA(v1, -21); - local_10007F72(v2); -} */ + Title_KillTitleTimer(hWnd); + Doom_DeleteFreeProcs(hWnd, titlemsgtbl); + v2 = (void **)GetWindowLongA(hWnd, -21); + local_FreeMemPtr(v2); +} // ref: 0x1001025A -int __fastcall Title_1001025A(HWND hWnd, int a2) { return 0; } -/* { - int v2; // ebx - HWND v3; // esi - int *v4; // edi - int result; // eax - HWND v6; // [esp+0h] [ebp-Ch] +void __fastcall Title_LoadAllTitleImgs(HWND hWnd, int time) +{ + DWORD *v4; // edi - v2 = a2; - v3 = hWnd; - v4 = (int *)local_10007F46(); - SetWindowLongA(v3, -21, (LONG)v4); + v4 = local_AllocWndLongData(); + SetWindowLongA(hWnd, -21, (LONG)v4); if ( v4 ) { - local_10007944((int)v3, 0, &byte_10029448, -1, 1, (int)"ui_art\\title.pcx", v4, v4 + 1, 0); - Fade_100073C5(v3, 0); + local_LoadArtWithPal(hWnd, 0, &nullcharacter, -1, 1, "ui_art\\title.pcx", (BYTE **)v4, v4 + 1, 0); + Fade_NoInputAndArt(hWnd, 0); } - Doom_100068AB(v3, (int *)&unk_10023340, 3); - Title_1001009E(v3, (int)"ui_art\\logo.pcx", v6); - if ( v2 ) - result = SDlgSetTimer(v3, 1, 1000 * v2, 0); + Doom_ParseWndProc3(hWnd, titlemsgtbl, 3); + Title_LoadImgSetTimer(hWnd, "ui_art\\logo.pcx"); + if ( time ) + SDlgSetTimer((int)hWnd, 1, 1000 * time, 0); else - result = SDlgSetTimer(v3, 1, 5000, 0); - return result; -} */ -// 10010412: using guessed type int __stdcall SDlgSetTimer(_DWORD, _DWORD, _DWORD, _DWORD); + SDlgSetTimer((int)hWnd, 1, 5000, 0); +} // ref: 0x100102D7 -int UNKCALL Title_100102D7(void *arg) { return 0; } -/* { - void *v1; // esi - - v1 = arg; - Fade_100073B4(); - SDlgKillTimer(v1, 1); - Fade_100072BE(10); - return SDlgEndDialog(v1, 1); -} */ -// 10010376: using guessed type int __stdcall SDlgEndDialog(_DWORD, _DWORD); -// 10010418: using guessed type int __stdcall SDlgKillTimer(_DWORD, _DWORD); +void __fastcall Title_KillAndFadeDlg(HWND hWnd) +{ + Fade_Range5SetZero(); + SDlgKillTimer((int)hWnd, 1); + Fade_UpdatePaletteRange(10); + SDlgEndDialog(hWnd, (void *)HANDLE_FLAG_INHERIT); +} diff --git a/MakefileVC b/MakefileVC index 5203750cb..82fcf5c2b 100644 --- a/MakefileVC +++ b/MakefileVC @@ -67,7 +67,7 @@ Diablo.exe: main_files $(PKWARE_OBJS) diablo.res DiabloUI/diabloui.lib 3rdParty/ $(VC_LINK) /OUT:$@ $(LINKFLAGS) $(OBJS) $(PKWARE_OBJS) diablo.res advapi32.lib gdi32.lib shell32.lib user32.lib version.lib DiabloUI/diabloui.lib 3rdParty/Storm/Source/storm.lib DiabloUI/diabloui.lib: $(DIABLOUI_OBJS) 3rdParty/Storm/Source/storm.lib - $(CL) $^ /link /LINK50COMPAT /nologo /dll /subsystem:windows /machine:I386 /LIBPATH:$(VC6_LIB_DIR) advapi32.lib gdi32.lib shell32.lib user32.lib version.lib 3rdParty/Storm/Source/storm.lib /def:"DiabloUI/diabloui.def" /out:DiabloUI/diabloui.dll + $(CL) $^ /link /LINK50COMPAT /nologo /dll /subsystem:windows /machine:I386 /LIBPATH:$(VC6_LIB_DIR) DiabloUI/diabloui.res advapi32.lib gdi32.lib shell32.lib user32.lib version.lib 3rdParty/Storm/Source/storm.lib /def:"DiabloUI/diabloui.def" /out:DiabloUI/diabloui.dll 3rdParty/Storm/Source/storm.lib: $(STORM_OBJS) $(CL) $^ /link /LINK50COMPAT /nologo /dll /subsystem:windows /machine:I386 /LIBPATH:$(VC6_LIB_DIR) /def:"3rdParty/Storm/Source/storm.def" /out:3rdParty/Storm/Source/storm.dll