GPUupdateLace GPU_updateLace;
GPUinit GPU_init;
GPUshutdown GPU_shutdown;
-GPUconfigure GPU_configure;
-GPUtest GPU_test;
-GPUabout GPU_about;
GPUopen GPU_open;
GPUclose GPU_close;
GPUreadStatus GPU_readStatus;
SPUregisterScheduleCb SPU_registerScheduleCb;
SPUasync SPU_async;
SPUplayCDDAchannel SPU_playCDDAchannel;
+SPUsetCDvol SPU_setCDvol;
PADconfigure PAD1_configure;
PADabout PAD1_about;
#define LoadSym(dest, src, name, checkerr) { \
dest = (src)SysLoadSym(drv, name); \
- if (checkerr) { CheckErr(name); } else SysLibError(); \
+ if (checkerr) { CheckErr(name); } \
}
void *hGPUDriver = NULL;
hGPUDriver = SysLoadLibrary(GPUdll);
if (hGPUDriver == NULL) {
- GPU_configure = NULL;
SysMessage (_("Could not load GPU plugin %s!"), GPUdll); return -1;
}
drv = hGPUDriver;
LoadGpuSym0(showScreenPic, "GPUshowScreenPic");
LoadGpuSym0(vBlank, "GPUvBlank");
LoadGpuSym0(getScreenInfo, "GPUgetScreenInfo");
- LoadGpuSym0(configure, "GPUconfigure");
- LoadGpuSym0(test, "GPUtest");
- LoadGpuSym0(about, "GPUabout");
return 0;
}
static void *hSPUDriver = NULL;\r
static void CALLBACK SPU__registerScheduleCb(void (CALLBACK *cb)(unsigned int)) {}\r
+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);
LoadSpuSym0(registerScheduleCb, "SPUregisterScheduleCb");
LoadSpuSymN(async, "SPUasync");
LoadSpuSymN(playCDDAchannel, "SPUplayCDDAchannel");
+ LoadSpuSym0(setCDvol, "SPUsetCDvol");
return 0;
}
return;
}
- // switch to analog mode automatically after the game finishes init
- if (value == 0x42 && pads[padIndex].ds.padMode == 0)
- pads[padIndex].ds.digitalModeFrames++;
- if (pads[padIndex].ds.digitalModeFrames == 60*4) {
- pads[padIndex].ds.padMode = 1;
- pads[padIndex].ds.digitalModeFrames = 0;
- }
-
- 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) {
#endif
}
+static void adjust_analog(unsigned char *b)
+{
+ // ff8 hates 0x80 for whatever reason (broken in 2d area menus),
+ // or is this caused by something else we do wrong??
+ // Also S.C.A.R.S. treats 0x7f as turning left.
+ if (b[6] == 0x7f || b[6] == 0x80)
+ b[6] = 0x81;
+}
+
// Build response for 0x42 request Pad in port
static void PADstartPoll_(PadDataS *pad) {
switch (pad->controllerType) {
stdpar[5] = pad->rightJoyY;
stdpar[6] = pad->leftJoyX;
stdpar[7] = pad->leftJoyY;
+ adjust_analog(stdpar);
memcpy(buf, stdpar, 8);
respSize = 8;
break;
stdpar[5] = pad->rightJoyY;
stdpar[6] = pad->leftJoyX;
stdpar[7] = pad->leftJoyY;
+ adjust_analog(stdpar);
memcpy(buf, stdpar, 8);
respSize = 8;
break;
return 0;
}
+int padToggleAnalog(unsigned int index)
+{
+ int r = -1;
+
+ if (index < sizeof(pads) / sizeof(pads[0])) {
+ r = (pads[index].ds.padMode ^= 1);
+ pads[index].ds.userToggled = 1;
+ }
+ return r;
+}
+
void *hNETDriver = NULL;