Browse Source

Use WNDPROC type for window procedures (#162)

pull/4/head
nomdenom 8 years ago committed by Robin Eklind
parent
commit
f3fc93491a
  1. 12
      Source/diablo.cpp
  2. 4
      Source/diablo.h
  3. 8
      Source/init.cpp
  4. 4
      Source/init.h

12
Source/diablo.cpp

@ -153,7 +153,7 @@ void __fastcall run_game_loop(int uMsg)
bool v5; // zf
//int v6; // eax
signed int v7; // [esp+8h] [ebp-24h]
LRESULT (__stdcall *saveProc)(HWND, UINT, WPARAM, LPARAM); // [esp+Ch] [ebp-20h]
WNDPROC saveProc; // [esp+Ch] [ebp-20h]
struct tagMSG msg; // [esp+10h] [ebp-1Ch]
nthread_ignore_mutex(1);
@ -662,16 +662,16 @@ LABEL_10:
// 646D00: using guessed type char qtextflag;
// 6AA705: using guessed type char stextflag;
LRESULT __stdcall DisableInputWndProc(HWND hWnd, int uMsg, int wParam, int lParam)
LRESULT __stdcall DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
bool v5; // zf
if ( uMsg <= (unsigned int)WM_LBUTTONDOWN )
if ( uMsg <= WM_LBUTTONDOWN )
{
if ( uMsg != WM_LBUTTONDOWN )
{
if ( uMsg >= (unsigned int)WM_KEYFIRST
&& (uMsg <= (unsigned int)WM_CHAR
if ( uMsg >= WM_KEYFIRST
&& (uMsg <= WM_CHAR
|| uMsg == WM_SYSKEYDOWN
|| uMsg == WM_SYSCOMMAND
|| uMsg == WM_MOUSEFIRST) )
@ -724,7 +724,7 @@ LABEL_23:
}
// 525748: using guessed type char sgbMouseDown;
int __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if ( uMsg > WM_LBUTTONDOWN )
{

4
Source/diablo.h

@ -48,8 +48,8 @@ void __cdecl diablo_init_screen();
HWND __fastcall diablo_find_window(LPCSTR lpClassName);
void __fastcall diablo_reload_process(HMODULE hModule);
int __cdecl PressEscKey();
LRESULT __stdcall DisableInputWndProc(HWND hWnd, int uMsg, int wParam, int lParam);
int __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT __stdcall DisableInputWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT __stdcall GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
bool __fastcall LeftMouseDown(int a1);
bool __cdecl TryIconCurs();
void __cdecl LeftMouseUp();

8
Source/init.cpp

@ -8,7 +8,7 @@ int window_activated; // weak
char diablo_exe_path[260];
void *unused_mpq;
char patch_rt_mpq_path[260];
LRESULT (__stdcall *CurrentProc)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
WNDPROC CurrentProc;
void *diabdat_mpq;
char diabdat_mpq_path[260];
void *patch_rt_mpq;
@ -515,11 +515,11 @@ LRESULT __stdcall init_redraw_window(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
return result;
}
LRESULT (__stdcall *SetWindowProc(void *func))(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WNDPROC __stdcall SetWindowProc(WNDPROC func)
{
LRESULT (__stdcall *result)(HWND, UINT, WPARAM, LPARAM); // eax
WNDPROC result; // eax
result = CurrentProc;
CurrentProc = (LRESULT (__stdcall *)(HWND, UINT, WPARAM, LPARAM))func;
CurrentProc = func;
return result;
}

4
Source/init.h

@ -8,7 +8,7 @@ extern int window_activated; // weak
extern char diablo_exe_path[260];
extern void *unused_mpq;
extern char patch_rt_mpq_path[260];
extern LRESULT (__stdcall *CurrentProc)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern WNDPROC CurrentProc;
extern void *diabdat_mpq;
extern char diabdat_mpq_path[260];
extern void *patch_rt_mpq;
@ -32,7 +32,7 @@ void __cdecl init_get_file_info();
LRESULT __stdcall init_palette(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
void __fastcall init_activate_window(HWND hWnd, bool activated);
LRESULT __stdcall init_redraw_window(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT (__stdcall *SetWindowProc(void *func))(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
WNDPROC __stdcall SetWindowProc(WNDPROC func);
/* data */
extern int init_inf; // weak

Loading…
Cancel
Save