#endif\r
} SPUInfo;\r
\r
-#define regAreaGet(offset) \\r
+#define regAreaRef(offset) \\r
spu.regArea[((offset) - 0xc00) >> 1]\r
+#define regAreaGet(offset) \\r
+ regAreaRef(offset)\r
#define regAreaGetCh(ch, offset) \\r
spu.regArea[(((ch) << 4) | (offset)) >> 1]\r
\r
memcpy(&sb_rvb->SB_rvb[i][j*4], pFO->rvb_sb[i], 4 * sizeof(sb_rvb->SB_rvb[i][0]));\r
spu.interpolation = pFO->interpolation;\r
}\r
+ for (i = 0; i <= 2; i += 2)\r
+ if (!regAreaGet(H_SPUcmvolL+i) && regAreaGet(H_SPUmvolL+i) < 0x8000u)\r
+ regAreaRef(H_SPUcmvolL+i) = regAreaGet(H_SPUmvolL+i) << 1;\r
\r
// repair some globals\r
for(i=0;i<=62;i+=2)\r
//-------------------------------------------------//\r
\r
case H_SPUmvolL:\r
- case H_SPUmvolR:\r
- if (val & 0x8000)\r
+ case H_SPUmvolR: {\r
+ int ofs = H_SPUcmvolL - H_SPUmvolL;\r
+ unsigned short *cur = ®AreaGet(r + ofs);\r
+ if (val & 0x8000) {\r
+ // this (for now?) lacks an update mechanism, so is instant\r
log_unhandled("w master sweep: %08lx %04x\n", reg, val);\r
+ int was_neg = (*cur >> 14) & 1;\r
+ int dec = (val >> 13) & 1;\r
+ int inv = (val >> 12) & 1;\r
+ *cur = (was_neg ^ dec ^ inv) ? 0x7fff : 0;\r
+ }\r
+ else\r
+ *cur = val << 1;\r
break;\r
+ }\r
\r
case 0x0dac:\r
if (val != 4)\r
//auxprintf("ER %d\n",val);\r
break;\r
//-------------------------------------------------//\r
- case H_SPUmvolL:\r
- //auxprintf("ML %d\n",val);\r
- break;\r
- //-------------------------------------------------//\r
- case H_SPUmvolR:\r
- //auxprintf("MR %d\n",val);\r
- break;\r
- //-------------------------------------------------//\r
case H_SPUMute1:\r
//auxprintf("M0 %04x\n",val);\r
break;\r
\r
case H_SPUMute1:\r
case H_SPUMute2:\r
- log_unhandled("r isOn: %08lx\n", reg);\r
+ log_unhandled("spu r isOn: %08lx %04x\n", reg, regAreaGet(r));\r
+ break;\r
+\r
+ case H_SPUmvolL:\r
+ case H_SPUmvolR:\r
+ log_unhandled("spu r mvol: %08lx %04x\n", reg, regAreaGet(r));\r
break;\r
\r
case 0x0dac:\r
\r
default:\r
if (r >= 0xda0)\r
- log_unhandled("spu r %08lx\n", reg);\r
+ log_unhandled("spu r %08lx %04x\n", reg, regAreaGet(r));\r
break;\r
}\r
\r
#define H_CDRight 0x0db2\r
#define H_ExtLeft 0x0db4\r
#define H_ExtRight 0x0db6\r
+#define H_SPUcmvolL 0x0db8\r
+#define H_SPUcmvolR 0x0dba\r
#define H_Reverb 0x0dc0\r
#define H_SPUPitch0 0x0c04\r
#define H_SPUPitch1 0x0c14\r
static void do_samples_finish(int *SSumLR, int ns_to,
int silentch, int decode_pos)
{
- int vol_l = ((int)regAreaGet(H_SPUmvolL) << 17) >> 17;
- int vol_r = ((int)regAreaGet(H_SPUmvolR) << 17) >> 17;
+ int vol_l = ((int)regAreaGet(H_SPUcmvolL) << 16) >> 17;
+ int vol_r = ((int)regAreaGet(H_SPUcmvolR) << 16) >> 17;
int ns;
int d;