From 029e681c394691e626aab685eacad0610b6048ad Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 30 Aug 2022 02:58:32 +0300 Subject: [PATCH] plugins: try to untangle the CALLBACK mess on ARM it doesn't matter so calling conventions were never maintained, so just get rid of __stdcall --- frontend/main.c | 2 +- frontend/plugin.c | 13 +++++-------- include/psemu_plugin_defs.h | 4 ++++ libpcsxcore/plugins.h | 15 +-------------- plugins/cdrcimg/cdrcimg.c | 9 ++++----- plugins/dfinput/main.c | 7 ------- plugins/dfsound/stdafx.h | 5 ----- plugins/gpu-gles/gpuExternals.h | 2 +- 8 files changed, 16 insertions(+), 41 deletions(-) diff --git a/frontend/main.c b/frontend/main.c index 23436450..671068d3 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -712,7 +712,7 @@ void SysRunGui() { printf("SysRunGui\n"); } -static void dummy_lace() +static void CALLBACK dummy_lace() { } diff --git a/frontend/plugin.c b/frontend/plugin.c index d9eb04a4..196c9802 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -15,14 +15,11 @@ #include "../libpcsxcore/system.h" #include "../plugins/cdrcimg/cdrcimg.h" -#ifndef _WIN32 +// this can't be __stdcall like it was in PSEmu API as too many functions are mixed up +#undef CALLBACK #define CALLBACK -#else -#define WIN32_LEAN_AND_MEAN -#include -#endif -static int dummy_func() { +static long CALLBACK dummy_func() { return 0; } @@ -49,7 +46,7 @@ extern void CALLBACK SPUasync(unsigned int, unsigned int); extern int CALLBACK SPUplayCDDAchannel(short *, int); /* PAD */ -static long PADreadPort1(PadDataS *pad) +static long CALLBACK PADreadPort1(PadDataS *pad) { pad->controllerType = in_type1; pad->buttonStatus = ~in_keystate; @@ -62,7 +59,7 @@ static long PADreadPort1(PadDataS *pad) return 0; } -static long PADreadPort2(PadDataS *pad) +static long CALLBACK PADreadPort2(PadDataS *pad) { pad->controllerType = in_type2; pad->buttonStatus = ~in_keystate >> 16; diff --git a/include/psemu_plugin_defs.h b/include/psemu_plugin_defs.h index 99866540..fa626272 100644 --- a/include/psemu_plugin_defs.h +++ b/include/psemu_plugin_defs.h @@ -5,6 +5,10 @@ extern "C" { #endif +// this can't be __stdcall like it was in PSEmu API as too many functions are mixed up +#undef CALLBACK +#define CALLBACK + // header version #define _PPDK_HEADER_VERSION 3 diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h index e3bffc77..34f062e2 100644 --- a/libpcsxcore/plugins.h +++ b/libpcsxcore/plugins.h @@ -25,21 +25,10 @@ extern "C" { #endif #include "psxcommon.h" +#include "psemu_plugin_defs.h" //#define ENABLE_SIO1API 1 -#ifndef _WIN32 - -typedef void* HWND; -#define CALLBACK - -#else - -#define WIN32_LEAN_AND_MEAN -#include - -#endif - typedef long (CALLBACK *GPUopen)(unsigned long *, char *, char *); typedef long (CALLBACK *SPUopen)(void); typedef long (CALLBACK *PADopen)(unsigned long *); @@ -47,8 +36,6 @@ typedef long (CALLBACK *NETopen)(unsigned long *); typedef long (CALLBACK *SIO1open)(unsigned long *); #include "spu.h" - -#include "psemu_plugin_defs.h" #include "decode_xa.h" int LoadPlugins(); diff --git a/plugins/cdrcimg/cdrcimg.c b/plugins/cdrcimg/cdrcimg.c index 91cf1cad..22545162 100644 --- a/plugins/cdrcimg/cdrcimg.c +++ b/plugins/cdrcimg/cdrcimg.c @@ -12,16 +12,15 @@ #include #include #include -#ifndef _WIN32 -#define CALLBACK +#if !defined(_WIN32) && !defined(NO_DYLIB) #include -#else -#define WIN32_LEAN_AND_MEAN -#include #endif #include "cdrcimg.h" +#undef CALLBACK +#define CALLBACK + #define PFX "cdrcimg: " #define err(f, ...) fprintf(stderr, PFX f, ##__VA_ARGS__) diff --git a/plugins/dfinput/main.c b/plugins/dfinput/main.c index 475ea073..937f7882 100644 --- a/plugins/dfinput/main.c +++ b/plugins/dfinput/main.c @@ -8,13 +8,6 @@ * See the COPYING file in the top-level directory. */ -#ifndef _WIN32 -#define CALLBACK -#else -#define WIN32_LEAN_AND_MEAN -#include -#endif - #include "main.h" unsigned char CurPad, CurByte, CurCmd, CmdLen; diff --git a/plugins/dfsound/stdafx.h b/plugins/dfsound/stdafx.h index 7e220290..82b0d7e5 100644 --- a/plugins/dfsound/stdafx.h +++ b/plugins/dfsound/stdafx.h @@ -19,16 +19,11 @@ #include #include -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#else #undef CALLBACK #define CALLBACK #define DWORD unsigned int #define LOWORD(l) ((unsigned short)(l)) #define HIWORD(l) ((unsigned short)(((unsigned int)(l) >> 16) & 0xFFFF)) -#endif #ifndef INLINE #define INLINE static inline diff --git a/plugins/gpu-gles/gpuExternals.h b/plugins/gpu-gles/gpuExternals.h index 12601672..0a8acf59 100644 --- a/plugins/gpu-gles/gpuExternals.h +++ b/plugins/gpu-gles/gpuExternals.h @@ -288,7 +288,7 @@ extern unsigned char gl_vy[8]; extern OGLVertex vertex[4]; extern short sprtY,sprtX,sprtH,sprtW; #ifdef _WINDOWS -extern HWND hWWindow; +//extern HWND hWWindow; #endif extern BOOL bIsFirstFrame; extern int iWinSize; -- 2.39.2