From 78de2879b23476890019dd434178b463b649da17 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 | 11 ++++------- plugins/dfinput/main.c | 7 ------- plugins/dfsound/stdafx.h | 5 ----- plugins/gpu-gles/gpuExternals.h | 2 +- 8 files changed, 16 insertions(+), 43 deletions(-) diff --git a/frontend/main.c b/frontend/main.c index c3777ccb..d74fd742 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -718,7 +718,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 a617c24e..812e503a 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) { int pad_index = pad->requestPadIndex; pad->controllerType = in_type[pad_index]; @@ -80,7 +77,7 @@ static long PADreadPort1(PadDataS *pad) { return 0; } -static long PADreadPort2(PadDataS *pad) { +static long CALLBACK PADreadPort2(PadDataS *pad) { int pad_index = pad->requestPadIndex; pad->controllerType = in_type[pad_index]; diff --git a/include/psemu_plugin_defs.h b/include/psemu_plugin_defs.h index 545cfcab..b855eacc 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 0a25f2ea..698f5445 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 9a749081..047357ac 100644 --- a/plugins/cdrcimg/cdrcimg.c +++ b/plugins/cdrcimg/cdrcimg.c @@ -12,18 +12,15 @@ #include #include #include -#ifndef _WIN32 -#define CALLBACK -#ifndef NO_DYLIB +#if !defined(_WIN32) && !defined(NO_DYLIB) #include #endif -#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 9c19bb69..974c4ddd 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 04aa2333..96335e38 100644 --- a/plugins/dfsound/stdafx.h +++ b/plugins/dfsound/stdafx.h @@ -22,16 +22,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.5