Skip to content

Commit

Permalink
libpinmame: add core_request_pwm_output_update calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jsm174 committed Jan 15, 2024
1 parent 5ab6878 commit beec0c3
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/libpinmame/libpinmame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/******************************************************
Expand All @@ -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)
Expand All @@ -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);
}

/******************************************************
Expand All @@ -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)
Expand All @@ -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);
}

/******************************************************
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
}

0 comments on commit beec0c3

Please sign in to comment.