-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PWM: new implementation #186
Conversation
Wow, this is amazing! From the looks of it, I think all I need to do is modify and I should be good on the standalone side. |
There is another thing to be consider for LibPinMame: you are using OnSolenoid events. I just ported the code for it but I think this could be adapted to benefit for the change, for example by directly processing events for SOL_2_STATE while delaying the other to VBlank (as they are now). This should improve the latency quite a lot if event are directly processed |
I forgot to share the updated core.vbs for VPX that ease using this (I will commit it to VPX when VPM will have th efeature integrated): |
Supports variable rate data writing/integration Supports high frequency controller using a linear PWM preintegration applied on high frequency data before physics model Supports strobed/PWM lamp matrix Supports Alphanumeric segment dimming (not yet exposed to VPinMame) Extended to all GI & Solenoids outputs, including aux board Allow output definition from PinMame driver as well as from client app This commits includes implementations for the following drivers: WPC, S11, Sega/Stern Whitestar, Stern S.A.M., Capcom, GTS3 This commits also contains the physic hardware definition for the following games: all Capcoms, all WPC, most SAM, GNR, LOTR This commits also contains an improved Capcom driver with better timings, needed to get correct lamp fading.
c455396
to
66b97fc
Compare
Great! |
..oh, and some text for the whatsnews, please.. Thanks! |
Whatsnew update (directly in commit, I force pushed it) |
Ooopss, you were fast :) my force push was after the merge. |
Really? Only GTS3 seems to be, but what about these? Line 818 in 419c336
Line 1176 in 419c336
Line 735 in 419c336
Line 1250 in 419c336
|
Hi guys,
this change in core.c will lead to a lamp matrix 8 times the size as it was before:
- for (ii = 0; ii < CORE_CUSTLAMPCOL + core_gameData->hw.lampCol; ii++) {
+ int nCols = coreGlobals.nLamps ? (coreGlobals.nLamps + 7) >> 3 : CORE_CUSTLAMPCOL + core_gameData->hw.lampCol * 8;
+ for (ii = 0; ii < nCols; ii++) {
Was that intentional, or is it a mistake (actually I hope for the latter)???
Cheers,
Gerrit
|
I may have miss something. The aim of this code (which is present for all drivers) is to move to the root gamedef:
Then I use the name of the root game definition. I don't see the difference with GTS3. |
It's a bug! Thanks for spotting, I will remove the |
Whoops, you're completely right. Sorry for the noise.. :/ |
It's already in there: #188 Regarding engaging the beta, I had a look yesterday evening to dimmed segment (for GTS3 and WPC) and it seems more simple than I expected. I implemented it for GTS3, just hadn't time to do the full thing (only the driver part for now, not the PinMame display, and VPinMame interface). Also, I finally had access to a bunch of Gottlieb schematics which will allow to add some definitions of physics outputs to GTS3 tables. So, perhaps wait until this week-end for the beta |
Oh my, seems my brain is still in xmas mode ;) Then i'll also wait some more, cause this sounds like an extremely cool feature to have.. |
@vbousquet thanks for working on this and for pinging me. |
The new implementation replace modulated solenoids that were implemented for WPC and SAM, so it changes WPC as well. |
@toxie dimmed segments added. They seem to fully work in PinMame but there is no API for this in VPinMame, so they are not available on VPX / B2S hwich is a bit sad. I also modified the implementation to only update outputs on request (very very basic lazy multithreading support) since the load was a bit heavier with the segments (there are a lot of them). @jsm174 this may cause isssue with libpinmame since I don't know the threading model of LibPinMame, therefore I did not do anything and it just rely on the default calls to And forgot to say, it's in here: #190 |
@vbousquet, for vpx standalone, there's a runner thread, but everything else should work like the normal controller. So I'm guessing I will need to just call and do the same for all the other functions? |
Great stuff! |
Yes, this is what schedules the update. So all calls coming from another thread should call it (it is thread safe). This design has the benefit of nearly 0 synchronization cost but the drawback that the data returned is always late (the one updated asynchronously from the last request, except for outputs that do not perform integration at all like 2 state solenoids). If the update request is not called regularly, this may lead to not perfectly smooth fading. I tested it and it never happened to me so I kept this since it lower the CPU load (16 times lower) but if we find issue, we can get back to the systematic update every 1ms (the CPU load with this is still around 5% for a 10 year old computer so... but with the 640 alpha segments of a GTS3 around 9% of these 5% CPU time is spent in the output integrators).
Thanks! this needs to be merged though: #190
My feeling is that the arch and the API needs to have a global evolution since the way we interface VPX and VPM has the following drawbacks from my point of view:
So, we have a few options here:
|
Hi again, now in the console version all solenoids numbers logged to screen have a value 1 less, so sol#1 will write out "0", sol#2 will write "1", and so on. This is due to a change in core.c, lines 1500 and 1532 (ii starts with a value of 0, before it was 1). Or, alternatively, just put: and in both cases. |
This is a rewrite of the preliminary PWM support I added at the beginning of the 3.6 phase. While using it, quite a few limitations arise, so I rewrote it to:
In turn, the rewrite led me to create a sort fo generalized physic output support, then port to it, trying to unify drivers around it. This led to remove (after porting them to the new physic output system) the following implementation:
This commits includes implementations for the following drivers:
While testing, it appeared that timings were wrong for Capcom hardware, so this commits also contains an improved Capcom driver with better timings (better U16 emulation, fix to MC68k core,...), needed to get correct lamp fading.
This commits also contains the physic hardware definition for the following games: all Capcoms, all WPC, most SAM, GNR for S11, LOTR for Whitestar, none of the GTS3.
The aim would be to have all the physic device connected to binary outputs defined on the PinMame side but it is too much work to be done straight away. Since the implementation allows to define physics device at runtime (for mods & variants), this also allows to define the missing hardware directly from the user application if we do not gather all the info for 3.6.
Using the new implementation is fairly straightforward (at least for games with hardware already defined): just set SolMask(2) = 6, then changed lamps / solenoids / gi will be 0..255 value relating to the main characteristic of the output (relative brightness for bulbs & LEDs).
Since this is a deep change, I think there will be bugs I jave missed, so this would benefit for large user testing. Also, @mkalkbrenner @jsm174 I tried to keep things clean for PPUC and LibPinMame (and PROC) but since I don't use them, the testing is fairly low.