X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fplugins.c;h=bab152c68df7b3d602ac514f846538d13343d941;hb=5c07678c305dbf81aa85f95f900f50863da8d668;hp=75e1f5fbef3d8c9d40d30003d104fb7667d85dce;hpb=e5241564f4444496f51f4de9bf533b1d910449ec;p=pcsx_rearmed.git diff --git a/libpcsxcore/plugins.c b/libpcsxcore/plugins.c index 75e1f5fb..bab152c6 100644 --- a/libpcsxcore/plugins.c +++ b/libpcsxcore/plugins.c @@ -86,6 +86,7 @@ SPUregisterCallback SPU_registerCallback; SPUregisterScheduleCb SPU_registerScheduleCb; SPUasync SPU_async; SPUplayCDDAchannel SPU_playCDDAchannel; +SPUsetCDvol SPU_setCDvol; PADconfigure PAD1_configure; PADabout PAD1_about; @@ -179,7 +180,7 @@ static const char *err; #define LoadSym(dest, src, name, checkerr) { \ dest = (src)SysLoadSym(drv, name); \ - if (checkerr) { CheckErr(name); } else SysLibError(); \ + if (checkerr) { CheckErr(name); } \ } void *hGPUDriver = NULL; @@ -313,13 +314,15 @@ static int LoadCDRplugin(const char *CDRdll) { static void *hSPUDriver = NULL; static void CALLBACK SPU__registerScheduleCb(void (CALLBACK *cb)(unsigned int)) {} +static void CALLBACK SPU__setCDvol(unsigned char ll, unsigned char lr, + unsigned char rl, unsigned char rr, unsigned int cycle) {} #define LoadSpuSym1(dest, name) \ LoadSym(SPU_##dest, SPU##dest, name, TRUE); #define LoadSpuSym0(dest, name) \ LoadSym(SPU_##dest, SPU##dest, name, FALSE); \ - if (SPU_##dest == NULL) SPU_##dest = (SPU##dest) SPU__##dest; + if (SPU_##dest == NULL) SPU_##dest = SPU__##dest; #define LoadSpuSymN(dest, name) \ LoadSym(SPU_##dest, SPU##dest, name, FALSE); @@ -346,6 +349,7 @@ static int LoadSPUplugin(const char *SPUdll) { LoadSpuSym0(registerScheduleCb, "SPUregisterScheduleCb"); LoadSpuSymN(async, "SPUasync"); LoadSpuSymN(playCDDAchannel, "SPUplayCDDAchannel"); + LoadSpuSym0(setCDvol, "SPUsetCDvol"); return 0; } @@ -490,9 +494,28 @@ static void initBufForRequest(int padIndex, char value) { return; } - if ((u32)(frame_counter - pads[padIndex].ds.lastUseFrame) > 60u + if ((u32)(frame_counter - pads[padIndex].ds.lastUseFrame) > 2*60u + && pads[padIndex].ds.configModeUsed && !Config.hacks.dualshock_init_analog) + { + //SysPrintf("Pad reset\n"); pads[padIndex].ds.padMode = 0; // according to nocash + pads[padIndex].ds.autoAnalogTried = 0; + } + else if (pads[padIndex].ds.padMode == 0 && value == CMD_READ_DATA_AND_VIBRATE + && pads[padIndex].ds.configModeUsed + && !pads[padIndex].ds.configMode + && !pads[padIndex].ds.userToggled) + { + if (pads[padIndex].ds.autoAnalogTried == 16) { + // auto-enable for convenience + SysPrintf("Auto-enabling dualshock analog mode.\n"); + pads[padIndex].ds.padMode = 1; + pads[padIndex].ds.autoAnalogTried = 255; + } + else if (pads[padIndex].ds.autoAnalogTried < 16) + pads[padIndex].ds.autoAnalogTried++; + } pads[padIndex].ds.lastUseFrame = frame_counter; switch (value) { @@ -988,8 +1011,10 @@ int padToggleAnalog(unsigned int index) { int r = -1; - if (index < sizeof(pads) / sizeof(pads[0])) + if (index < sizeof(pads) / sizeof(pads[0])) { r = (pads[index].ds.padMode ^= 1); + pads[index].ds.userToggled = 1; + } return r; }