X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=frontend%2Fplugin.c;h=33f3c8d76e4d15fb1cebcb5a82da9f9e24b29a35;hb=ba86ff938a6b17c171dd68ebdf897ca3e30550f8;hp=acc560116e4b42380cca6e3493f59c4554e1da91;hpb=61c4962abc49e430aabea5e565d93436a57cfa0a;p=pcsx_rearmed.git diff --git a/frontend/plugin.c b/frontend/plugin.c index acc56011..33f3c8d7 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; } @@ -31,54 +28,77 @@ extern long CALLBACK SPUopen(void); extern long CALLBACK SPUinit(void); extern long CALLBACK SPUshutdown(void); extern long CALLBACK SPUclose(void); -extern void CALLBACK SPUplaySample(unsigned char); extern void CALLBACK SPUwriteRegister(unsigned long, unsigned short, unsigned int); extern unsigned short CALLBACK SPUreadRegister(unsigned long); -extern void CALLBACK SPUwriteDMA(unsigned short); -extern unsigned short CALLBACK SPUreadDMA(void); extern void CALLBACK SPUwriteDMAMem(unsigned short *, int, unsigned int); extern void CALLBACK SPUreadDMAMem(unsigned short *, int, unsigned int); -extern void CALLBACK SPUplayADPCMchannel(void *); +extern void CALLBACK SPUplayADPCMchannel(void *, unsigned int, int); extern void CALLBACK SPUregisterCallback(void (*cb)(void)); extern void CALLBACK SPUregisterScheduleCb(void (*cb)(unsigned int)); -extern long CALLBACK SPUconfigure(void); -extern long CALLBACK SPUtest(void); -extern void CALLBACK SPUabout(void); extern long CALLBACK SPUfreeze(unsigned int, void *, unsigned int); extern void CALLBACK SPUasync(unsigned int, unsigned int); -extern int CALLBACK SPUplayCDDAchannel(short *, int); +extern int CALLBACK SPUplayCDDAchannel(short *, int, unsigned int, int); /* PAD */ +static long CALLBACK PADreadPort1(PadDataS *pad) { + int pad_index = pad->requestPadIndex; - -// Lecture du port de la playstation, etat des boutons lu à cette endroit ! -// Distribution des manettes en fonction du port. Si 2, une sur chacun des ports. -// Si supérieur a deux on en connecte 4 sur port 1 et le reste sur port 2 -static long PADreadPort1(PadDataS *pad, int pad_index) -{ pad->controllerType = in_type[pad_index]; pad->buttonStatus = ~in_keystate[pad_index]; - //pad->buttonStatus = ~in_keystate; - if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON) { - pad->leftJoyX = in_analog_left[pad_index][0]; - pad->leftJoyY = in_analog_left[pad_index][1]; - pad->rightJoyX = in_analog_right[pad_index][0]; - pad->rightJoyY = in_analog_right[pad_index][1]; - } + + if (multitap1 == 1) + pad->portMultitap = 1; + else + pad->portMultitap = 0; + + if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGJOY || in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON || in_type[pad_index] == PSE_PAD_TYPE_GUNCON) + { + pad->leftJoyX = in_analog_left[pad_index][0]; + pad->leftJoyY = in_analog_left[pad_index][1]; + pad->rightJoyX = in_analog_right[pad_index][0]; + pad->rightJoyY = in_analog_right[pad_index][1]; + + pad->absoluteX = in_analog_left[pad_index][0]; + pad->absoluteY = in_analog_left[pad_index][1]; + } + + if (in_type[pad_index] == PSE_PAD_TYPE_MOUSE) + { + pad->moveX = in_mouse[pad_index][0]; + pad->moveY = in_mouse[pad_index][1]; + } + return 0; } -static long PADreadPort2(PadDataS *pad) -{ - pad->controllerType = in_type[4]; - pad->buttonStatus = ~in_keystate[4]; - //pad->buttonStatus = ~in_keystate >> 16; - if (in_type[4] == PSE_PAD_TYPE_ANALOGPAD || in_type[4] == PSE_PAD_TYPE_NEGCON) { - pad->leftJoyX = in_analog_left[4][0]; - pad->leftJoyY = in_analog_left[4][1]; - pad->rightJoyX = in_analog_right[4][0]; - pad->rightJoyY = in_analog_right[4][1]; +static long CALLBACK PADreadPort2(PadDataS *pad) { + int pad_index = pad->requestPadIndex; + + pad->controllerType = in_type[pad_index]; + pad->buttonStatus = ~in_keystate[pad_index]; + + if (multitap2 == 1) + pad->portMultitap = 2; + else + pad->portMultitap = 0; + + if (in_type[pad_index] == PSE_PAD_TYPE_ANALOGJOY || in_type[pad_index] == PSE_PAD_TYPE_ANALOGPAD || in_type[pad_index] == PSE_PAD_TYPE_NEGCON || in_type[pad_index] == PSE_PAD_TYPE_GUNCON) + { + pad->leftJoyX = in_analog_left[pad_index][0]; + pad->leftJoyY = in_analog_left[pad_index][1]; + pad->rightJoyX = in_analog_right[pad_index][0]; + pad->rightJoyY = in_analog_right[pad_index][1]; + + pad->absoluteX = in_analog_left[pad_index][0]; + pad->absoluteY = in_analog_left[pad_index][1]; } + + if (in_type[pad_index] == PSE_PAD_TYPE_MOUSE) + { + pad->moveX = in_mouse[pad_index][0]; + pad->moveY = in_mouse[pad_index][1]; + } + return 0; } @@ -139,18 +159,12 @@ static const struct { DUMMY_CDR(CDRreadCDDA), DUMMY_CDR(CDRgetTE), /* SPU */ - DIRECT_SPU(SPUconfigure), - DIRECT_SPU(SPUabout), DIRECT_SPU(SPUinit), DIRECT_SPU(SPUshutdown), - DIRECT_SPU(SPUtest), DIRECT_SPU(SPUopen), DIRECT_SPU(SPUclose), -// DIRECT_SPU(SPUplaySample), // unused? DIRECT_SPU(SPUwriteRegister), DIRECT_SPU(SPUreadRegister), - DIRECT_SPU(SPUwriteDMA), - DIRECT_SPU(SPUreadDMA), DIRECT_SPU(SPUwriteDMAMem), DIRECT_SPU(SPUreadDMAMem), DIRECT_SPU(SPUplayADPCMchannel), @@ -203,7 +217,6 @@ static const struct { DIRECT_GPU(GPUgetScreenPic), DIRECT_GPU(GPUshowScreenPic), */ -// DIRECT_GPU(GPUclearDynarec), }; void *plugin_link(enum builtint_plugins_e id, const char *sym) @@ -278,13 +291,11 @@ pc_hook_func (GPU_updateLace, (void), (), PCNT_GPU) pc_hook_func (SPU_writeRegister, (unsigned long a0, unsigned short a1, uint32_t a2), (a0, a1, a2), PCNT_SPU) pc_hook_func_ret(unsigned short,SPU_readRegister, (unsigned long a0), (a0), PCNT_SPU) -pc_hook_func (SPU_writeDMA, (unsigned short a0), (a0), PCNT_SPU) -pc_hook_func_ret(unsigned short,SPU_readDMA, (void), (), PCNT_SPU) pc_hook_func (SPU_writeDMAMem, (unsigned short *a0, int a1, uint32_t a2), (a0, a1, a2), PCNT_SPU) pc_hook_func (SPU_readDMAMem, (unsigned short *a0, int a1, uint32_t a2), (a0, a1, a2), PCNT_SPU) -pc_hook_func (SPU_playADPCMchannel, (void *a0), (a0), PCNT_SPU) +pc_hook_func (SPU_playADPCMchannel, (void *a0, unsigned int a1, int a2), (a0, a1, a2), PCNT_SPU) pc_hook_func (SPU_async, (uint32_t a0, uint32_t a1), (a0, a1), PCNT_SPU) -pc_hook_func_ret(int, SPU_playCDDAchannel, (short *a0, int a1), (a0, a1), PCNT_SPU) +pc_hook_func_ret(int, SPU_playCDDAchannel, (short *a0, int a1, unsigned int a2, int a3), (a0, a1, a2, a3), PCNT_SPU) #define hook_it(name) { \ o_##name = name; \ @@ -305,8 +316,6 @@ void pcnt_hook_plugins(void) hook_it(GPU_updateLace); hook_it(SPU_writeRegister); hook_it(SPU_readRegister); - hook_it(SPU_writeDMA); - hook_it(SPU_readDMA); hook_it(SPU_writeDMAMem); hook_it(SPU_readDMAMem); hook_it(SPU_playADPCMchannel);