X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fplugin.c;h=d9eb04a40be1070f06700a79daf1293c6de16af8;hp=c11a1f05a793589d1cda9273ca57bf7a7a53673f;hb=215ff9e69c0b845f24e7a3aa9faeef06d9276145;hpb=c5061935e3f7b91d889d7546b06c4515c3004cb2 diff --git a/frontend/plugin.c b/frontend/plugin.c index c11a1f05..d9eb04a4 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -11,47 +11,61 @@ #include "plugin_lib.h" #include "plugin.h" -#include "../libpcsxcore/psemu_plugin_defs.h" +#include "psemu_plugin_defs.h" #include "../libpcsxcore/system.h" #include "../plugins/cdrcimg/cdrcimg.h" +#ifndef _WIN32 +#define CALLBACK +#else +#define WIN32_LEAN_AND_MEAN +#include +#endif + static int dummy_func() { return 0; } /* SPU */ -extern long SPUopen(void); -extern long SPUinit(void); -extern long SPUshutdown(void); -extern long SPUclose(void); -extern void SPUplaySample(unsigned char); -extern void SPUwriteRegister(unsigned long, unsigned short); -extern unsigned short SPUreadRegister(unsigned long); -extern void SPUwriteDMA(unsigned short); -extern unsigned short SPUreadDMA(void); -extern void SPUwriteDMAMem(unsigned short *, int); -extern void SPUreadDMAMem(unsigned short *, int); -extern void SPUplayADPCMchannel(void *); -extern void SPUregisterCallback(void (*callback)(void)); -extern long SPUconfigure(void); -extern long SPUtest(void); -extern void SPUabout(void); -extern long SPUfreeze(unsigned int, void *); -extern void SPUasync(unsigned int); -extern void SPUplayCDDAchannel(short *, int); +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 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); /* PAD */ static long PADreadPort1(PadDataS *pad) { - pad->controllerType = PSE_PAD_TYPE_STANDARD; - pad->buttonStatus = ~keystate; + pad->controllerType = in_type1; + pad->buttonStatus = ~in_keystate; + if (in_type1 == PSE_PAD_TYPE_ANALOGPAD) { + pad->leftJoyX = in_a1[0]; + pad->leftJoyY = in_a1[1]; + pad->rightJoyX = in_a2[0]; + pad->rightJoyY = in_a2[1]; + } return 0; } static long PADreadPort2(PadDataS *pad) { - pad->controllerType = PSE_PAD_TYPE_STANDARD; - pad->buttonStatus = ~keystate >> 16; + pad->controllerType = in_type2; + pad->buttonStatus = ~in_keystate >> 16; return 0; } @@ -69,6 +83,8 @@ extern void GPUreadDataMem(uint32_t *, int); extern long GPUdmaChain(uint32_t *,uint32_t); extern void GPUupdateLace(void); extern long GPUfreeze(uint32_t, void *); +extern void GPUvBlank(int, int); +extern void GPUrearmedCallbacks(const struct rearmed_cbs *cbs); #define DUMMY(id, name) \ @@ -127,6 +143,7 @@ static const struct { DIRECT_SPU(SPUplayADPCMchannel), DIRECT_SPU(SPUfreeze), DIRECT_SPU(SPUregisterCallback), + DIRECT_SPU(SPUregisterScheduleCb), DIRECT_SPU(SPUasync), DIRECT_SPU(SPUplayCDDAchannel), /* PAD */ @@ -160,6 +177,8 @@ static const struct { DIRECT_GPU(GPUwriteDataMem), DIRECT_GPU(GPUdmaChain), DIRECT_GPU(GPUfreeze), + DIRECT_GPU(GPUvBlank), + DIRECT_GPU(GPUrearmedCallbacks), DUMMY_GPU(GPUdisplayText), /* @@ -172,7 +191,6 @@ static const struct { DIRECT_GPU(GPUshowScreenPic), */ // DIRECT_GPU(GPUclearDynarec), -// DIRECT_GPU(GPUvBlank), }; void *plugin_link(enum builtint_plugins_e id, const char *sym) @@ -245,15 +263,15 @@ pc_hook_func (GPU_readDataMem, (uint32_t *a0, int a1), (a0, a1), PC pc_hook_func_ret(long, GPU_dmaChain, (uint32_t *a0, int32_t a1), (a0, a1), PCNT_GPU) pc_hook_func (GPU_updateLace, (void), (), PCNT_GPU) -pc_hook_func (SPU_writeRegister, (unsigned long a0, unsigned short a1), (a0, a1), PCNT_SPU) +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), (a0, a1), PCNT_SPU) -pc_hook_func (SPU_readDMAMem, (unsigned short *a0, int a1), (a0, a1), 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_async, (unsigned int a0), (a0), PCNT_SPU) -pc_hook_func (SPU_playCDDAchannel, (short *a0, int a1), (a0, a1), 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) #define hook_it(name) { \ o_##name = name; \ @@ -262,8 +280,7 @@ pc_hook_func (SPU_playCDDAchannel, (short *a0, int a1), (a0, a1), P void pcnt_hook_plugins(void) { - /* test it first */ - pcnt_get(); + pcnt_init(); hook_it(GPU_writeStatus); hook_it(GPU_writeData); @@ -284,4 +301,15 @@ void pcnt_hook_plugins(void) hook_it(SPU_playCDDAchannel); } +// hooked into recompiler +void pcnt_gte_start(int op) +{ + pcnt_start(PCNT_GTE); +} + +void pcnt_gte_end(int op) +{ + pcnt_end(PCNT_GTE); +} + #endif