From 039876b8d00a94cfb5108f9d876d4bc98f9e27bb Mon Sep 17 00:00:00 2001 From: Vincent Bousquet Date: Fri, 2 Feb 2024 13:22:18 +0100 Subject: [PATCH] PWM: Fix (legacy) modulated solenoids for generation other than WPC --- src/wpc/vpintf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wpc/vpintf.c b/src/wpc/vpintf.c index 101e90d48..d3ff80751 100644 --- a/src/wpc/vpintf.c +++ b/src/wpc/vpintf.c @@ -124,13 +124,14 @@ int vp_getChangedLamps(vp_tChgLamps chgStat) { int vp_getChangedSolenoids(vp_tChgSols chgStat) { int ii, idx = 0; - if (coreGlobals.nSolenoids && ( - (options.usemodsol & CORE_MODOUT_ENABLE_PHYSOUT) - || ((core_gameData->gen & GEN_ALLWPC) && (options.usemodsol & CORE_MODOUT_ENABLE_MODSOL)) )) + // The backward compatibility is not perfect here: mod sol was only available for a bunch of gnerations, and would limit modulation to the first 32 solenoids + if (coreGlobals.nSolenoids && (options.usemodsol & (CORE_MODOUT_ENABLE_PHYSOUT | CORE_MODOUT_ENABLE_MODSOL))) { float state[CORE_MODOUT_SOL_MAX]; core_getAllPhysicSols(state); for (ii = 0; ii < coreGlobals.nSolenoids; ii++) { + if ((options.usemodsol == CORE_MODOUT_ENABLE_MODSOL) && coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + ii].type == CORE_MODOUT_BULB_44_6_3V_AC_REV) + state[ii] = 1.0f - state[ii]; UINT8 v = saturatedByte(state[ii]); if (v != locals.lastPhysicsOutput[CORE_MODOUT_SOL0 + ii]) { chgStat[idx].solNo = ii + 1;