From beec0c3cda92d3df1caeeb8af83ef14b05e1cf06 Mon Sep 17 00:00:00 2001 From: Jason Millard Date: Mon, 15 Jan 2024 12:35:01 -0500 Subject: [PATCH] libpinmame: add core_request_pwm_output_update calls --- src/libpinmame/libpinmame.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/libpinmame/libpinmame.cpp b/src/libpinmame/libpinmame.cpp index 7a9756cdf..1c234beaa 100644 --- a/src/libpinmame/libpinmame.cpp +++ b/src/libpinmame/libpinmame.cpp @@ -1034,7 +1034,12 @@ PINMAMEAPI int PinmameGetMaxSolenoids() PINMAMEAPI int PinmameGetSolenoid(const int solNo) { - return (_isRunning) ? vp_getSolenoid(solNo) : 0; + if (!_isRunning) + return 0; + + core_request_pwm_output_update(); + + return vp_getSolenoid(solNo); } /****************************************************** @@ -1046,6 +1051,8 @@ PINMAMEAPI int PinmameGetChangedSolenoids(PinmameSolenoidState* const p_changedS if (!_isRunning) return -1; + core_request_pwm_output_update(); + vp_tChgSols chgSols; const int count = vp_getChangedSolenoids(chgSols); if (count > 0) @@ -1068,7 +1075,12 @@ PINMAMEAPI int PinmameGetMaxLamps() PINMAMEAPI int PinmameGetLamp(const int lampNo) { - return (_isRunning) ? vp_getLamp(lampNo) : 0; + if (!_isRunning) + return 0; + + core_request_pwm_output_update(); + + return vp_getLamp(lampNo); } /****************************************************** @@ -1080,6 +1092,8 @@ PINMAMEAPI int PinmameGetChangedLamps(PinmameLampState* const p_changedStates) if (!_isRunning) return -1; + core_request_pwm_output_update(); + vp_tChgLamps chgLamps; const int count = vp_getChangedLamps(chgLamps); if (count > 0) @@ -1102,7 +1116,12 @@ PINMAMEAPI int PinmameGetMaxGIs() PINMAMEAPI int PinmameGetGI(const int giNo) { - return (_isRunning) ? vp_getGI(giNo) : 0; + if (!_isRunning) + return 0; + + core_request_pwm_output_update(); + + return vp_getGI(giNo); } /****************************************************** @@ -1114,6 +1133,8 @@ PINMAMEAPI int PinmameGetChangedGIs(PinmameGIState* const p_changedStates) if (!_isRunning) return -1; + core_request_pwm_output_update(); + vp_tChgGIs chgGIs; const int count = vp_getChangedGI(chgGIs); if (count > 0) @@ -1139,6 +1160,8 @@ PINMAMEAPI int PinmameGetChangedLEDs(const uint64_t mask, const uint64_t mask2, if (!_isRunning) return -1; + core_request_pwm_output_update(); + vp_tChgLED chgLEDs; const int count = vp_getChangedLEDs(chgLEDs, mask, mask2); if (count > 0) @@ -1258,4 +1281,4 @@ PINMAMEAPI void PinmameSetDIP(const int dipBank, const int value) PINMAMEAPI void PinmameSetUserData(const void* p_userData) { _p_userData = (void*)p_userData; -} +} \ No newline at end of file