ref: 8a3b5c1f7a70c74f2c7f0f0a8ff58d6ae3bda971
parent: 4e0a168533df5f36a9e255a0702ae204d69a3bc7
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Mar 14 09:22:36 EDT 2020
Use macros instead of __stdcall Wow Microsoft's documentation sucks: it constantly omits these, making you think they're just plain `__cdecl`.
--- a/src/Dialog.cpp
+++ b/src/Dialog.cpp
@@ -17,7 +17,7 @@
;
// TODO - Inaccurate stack frame
-INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
char string_buffer[104];
@@ -58,7 +58,7 @@
return FALSE;
}
-INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
(void)lParam;
@@ -102,7 +102,7 @@
return FALSE;
}
-INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
char string[100];
@@ -135,7 +135,7 @@
return FALSE;
}
-INT_PTR __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
--- a/src/Dialog.h
+++ b/src/Dialog.h
@@ -2,7 +2,7 @@
#include "WindowsWrapper.h"
-INT_PTR __stdcall VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR __stdcall DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR __stdcall DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
-INT_PTR __stdcall QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK VersionDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DebugMuteDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DebugSaveDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK QuitDialog(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
--- a/src/Input.cpp
+++ b/src/Input.cpp
@@ -59,7 +59,7 @@
// It looks like Pixel declared his functions early, so he could forward-reference
BOOL FindAndOpenDirectInputDevice(HWND hWnd);
-BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
+BOOL CALLBACK EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
BOOL InitDirectInput(HINSTANCE hinst, HWND hWnd)
{
@@ -116,7 +116,7 @@
}
// The original names for this function and its variables are unknown
-BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
+BOOL CALLBACK EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
{
static int already_ran;
static DirectInputPair *directinput_objects;
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -22,7 +22,7 @@
#include "Sound.h"
#include "Triangle.h"
-LRESULT __stdcall WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
char gModulePath[MAX_PATH];
char gDataPath[MAX_PATH];
@@ -97,7 +97,7 @@
}
// TODO - Inaccurate stack frame
-int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
(void)hPrevInstance;
(void)lpCmdLine;
@@ -441,7 +441,7 @@
}
// TODO - Inaccurate stack frame
-LRESULT __stdcall WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
BOOL window_focus;
HMENU hMenu;