Jump to content
DJRobX

Code change to enable SAM LE driver board support

Recommended Posts

Big thanks to DJRobX. He passed along his source code changes. This build merges in the Stern LED implementation and is up to date with official VPinMAME up to rev3987. 

** WARNING FOR PLAYERS !! **
I made some set name changes to match the set names documented in the official driver.c

This will require changing Const cGameName in VP table scripts:
Iron Man & Iron Man Vault Edition
X-Men
The Avengers

Added Iron Man V1.83. The rule set is identical to the Iron Man Vault Edition set.

For collectors, there are a couple of other set name fixes for older versions of some tables. I've included a PinMAME executable with which you can generate a dat file for use in a rom auditor.
 

 

VPinMAME_SAM_NON_PINDMD_PINDMD2_PIN2DMD_2.39.zip

Share this post


Link to post
Share on other sites

I started looking into Mustang updates, focusing on the grid area so lights 81 -97.  Here are my test observation so far.

- mt_145h only seems to work once - the first time I start the table.  If I start the table a 2nd time, the grid lights dont change state at all.  Closing table and VP and deleting NVram file make it works one time and then I have to repeat it to get the aux lights to work

- mt_145  (Mustang Pro), I don't think the aux lights work there, the grid never changes state at all, even after deleting the nvram file.

- The grid lights are not RGB so I was expected the lamp status to be 0 or 1, but I see that 0-127 values are used.  That's okay, but I have having trouble distinguishing what values should be on and what values should be off

- When I do the ROM test, flash all lamps, I monitored light 81 and it toggles between a value of 0(off) and 127(on)., so that makes sense

- However when I monitor the table attract sequence, light 81 toggle between value 2 and 0 and then next time between 64 and 66.  So in this case it seems like 2 and 64 are ON and 0 and 66 are OFF.  Not sure why I dont get 0 and 127 like in the ROM test

I have not had time to script thes changes in yet but will keep you posted. 

Share this post


Link to post
Share on other sites

0-127 is usually intensity level.   So I expect 2 would be extremely dim, and 64-66 would be half bright.   I'm only passing along the data given by the ROM, so those numbers are what I get from it.   The receiving controller may interpret it however it wishes though.   

I know why you have to reload - it only tries to apply the hack once.     I forgot that VP leaves VPM loaded (it really shouldn't, that's a bug somewhere in VP).    I'll fix that.  You shouldn't have to delete nvram though. 

 

Share this post


Link to post
Share on other sites

There are hacks in place for MT_145 and MT_145h.    I haven't tested Premium or other versions of the rom.   They will probably do the old "work after a minute" thing.   It's a little faster now that the code sends a bunch of data back to the ROM, but still too slow.   I hope someday I or someone can determine what the ROM is waiting for so we can eliminate the hack. 

 

 

Share this post


Link to post
Share on other sites

 I changed the lamp script to if lampstate = 0 then set Insert Off. If lampstate > 0 then set Insert On and the lightshow is working fine now

Here is the Mustange rom insert value to vpinmame lamp value.  Any particular reason for the values not remaining 1 to 1 ?  I can script based on the current mapping, but just wanted to mention it, in case you think the behavior is unexpected

Mustang Pro
Rom value=VPinmame Lamp value

81=81  '1 to 1 mapping
82=82  '1 to 1 mapping  
...
97=97  '1 to 1 mapping
98=103 'offset of 5
99=102 'offset of 3
100=104'offset of 4
101=105'offset of 4
102=106'offset of 4
...
108=112'offset of 4

Mustang LE - RGB inserts
109=126,127,128    'RGB insert = WHITE
110=123,124,125 'RGB insert = WHITE
111=120,121,122    'RGB insert = WHITE
112=117,118,119    'RGB insert = WHITE
113=139,140,141    'RGB insert = WHITE
114=133,134,135    'RGB insert = WHITE
115-130,131,132    'RGB insert = WHITE
116=136,137,138    'RGB insert = WHITE
117=128        'RGB Insert = Red
118=126        'RGB Insert = Green
119=127        'RGB Insert = Blue
120=125        'RGB Insert = Red
121=123        'RGB Insert = Green
122=124        'RGB Insert = Blue
123=122        'RGB Insert = Red
124=120        'RGB Insert = Green
125=121        'RGB Insert = Blue
126=119        'RGB Insert = Red
127=117        'RGB Insert = Green
128=118        'RGB Insert = Blue
129=141        'RGB Insert = Red
130=139        'RGB Insert = Green
131=140        'RGB Insert = Blue
132=135        'RGB Insert = Red
133=133        'RGB Insert = Green
134=134        'RGB Insert = Blue
135=132        'RGB Insert = Red
130=136        'RGB Insert = Green
137=131        'RGB Insert = Blue
138=138        'RGB Insert = Red
139=136        'RGB Insert = Green
140=137        'RGB Insert = Blue
141=142,143,144 'RGB insert = WHITE
142=144        'RGB Insert = Red
143=142        'RGB Insert = Gree
144=143        'RGB Insert = Blue
 

 

Share this post


Link to post
Share on other sites
Quote

Any particular reason for the values not remaining 1 to 1 ?

It's actually "dumb luck" that the "mapping" is even close in Mustang Pro.   

Take a look at Lights 141, 142, 143, and 144 on the LE for example..   That's an RGB lamp.    Notice how in the diagnostic menu you have 4 different "lamp numbers" that actually control 3 outputs.    The three "actual" lamps should be mapped to 3 colors that get blended in real time, when they're all on it's white.   The ROM itself is making "soft mappings" to a LED string, LED column.     So, no 1:1 mapping can exist.  

When you look at something like Star Trek LE, almost everything is an RGB led.   It very quickly became apparent that it doesn't make sense to try and do any sort of mapping on the VPM side.   The table really needs to handle it, just as it does on the real thing.   I just start at 80 because no Stern seems to output "native" lights over 80.  

I do some mapping to consolidate the LED strings addresses into a contiguous block starting from 80, but Mustang only has one LED string.   In short, I'm just making what the ROM gives you available.   The rest is up to you.   But it's not going to change, so it's safe to script against. 

Quote

If lampstate > 0 then set Insert On and the lightshow is working fine now

Cool.   If you want a great light show, you should try to make your table use the intensity values from the ROM.    if you check out the Star Trek LE video that Fren posted, he's implemented it fully.   It's super impressive looking! 

Share this post


Link to post
Share on other sites

I just told the script to set lamp.state = 0 if all 3 lights are 0, if any of those 3 RGB outputs have a value greater than 0, then the light is on, I think the vp light object handles the rest. Nothing fancy with intensity though I don't think you can read an intensity value, just a color value ....

actually you have me second guessing myself, because the value went to 255 I pegged it as an RGB value not an intensity value.... If you set a vp light object to be 0,0,0 it will be off, but if you set it to 0,1,0 it will be on, and not any dimmer than 0,255,0 .... it's just the color value. So, technically I don't need to tell the light to be off using the method I used, but it also means I may actually be wrong. Does the proper method require 3 VP light objects? One red, on green, one blue, and then you just set the intensity instead of the rgb color. Is that why I get more "dance club" colors than basic colors?

I get the proper R/G/B colors in game mode because it appears to be full intensity, but in attract mode it's all wrong! Oh my god! It's so wrong! I scripted it the way RGB lights actually work, not the way VP RGB lights work!

Look at the real attract mode

 

Share this post


Link to post
Share on other sites

I assume it works like RGB pixels do.    255,255,255 is full intensity white,  20,20,20 is dark gray (less intense white).   255,0,0 is full intensity red.  20,0,0 is low intensity red.      Etc...

I haven't looked at all at VP side of things to see how you're doing it.   It sounds like you are trying to derive the lightness from the RGB values (so you can specify a color separate form its intensity).    If you need to do it that way I would look into color space conversions.   e.g.

http://lodev.org/cgtutor/color.html#The_HSL_Color_Model_

You could apply this conversion then use the L value for brightness. 

 

Share this post


Link to post
Share on other sites

Thanks DJRobx and 85vett!  

Here is an updated version of 85vett's Mustang Pro Physmod 5 WIP table now with fully working Shift grid lights and Playfield signs (Mustang Store, 180, 360, Shortcut).

https://www.dropbox.com/s/e0mdp9qqkm98tgc/Mustang Pro 100116c.vpt?dl=0

REQUIRES Physmod5.exe and the latest SAM vpinmame posted here: http://vpuniverse.com/forums/forums/topic/2687-code-change-to-enable-sam-le-driver-board-support/?do=findComment&comment=31055

 

mustang.jpg

Share this post


Link to post
Share on other sites

Fren, try this

Sub SetRGBLamp(Lamp, R, G, B)   
     dim IntensityValue 
	 IntensityValue = .2126 * R + .7152 * G + .0722 * B
	 Lamp.Color = RGB(R, G, B)
	 Lamp.ColorFull = RGB(R, G, B)
	 Lamp.Intensity = IntensityValue *100 / 255
	 Lamp.State = 1
End Sub

Then, change the lamp image to be "!PF Off" so it uses the dark version.   Leave the lamp "on" all the time and let the intensity value dictate how much light shines through. 

IntensityValue will be 0-255, so you can mess around with how bright it gets by adjusting the " 100 / 255 to convert it into VP intensity values.

Of course you would use lines like this, instead of your big long IF line .. ;)

SetRGBLamp l40, Lampstate(229),Lampstate(230),Lampstate(231)

 

Share this post


Link to post
Share on other sites
27 minutes ago, CarnyPriest said:

Whatever is available can be downloaded here.


Sent from my iPhone using Tapatalk

I appreciate the assistance but there's enough evidence to suggest that there are earlier roms than 141 for the LE... The different attract mode is the biggest giveaway (everything from 141 onward has the sweeping color fades as seen in my video) --- many videos on youtube show a different attract mode.

Here's a screenshot showing 1.3

iqGKTF2.png

Share this post


Link to post
Share on other sites
18 minutes ago, DJRobX said:

Fren, try this


Sub SetRGBLamp(Lamp, R, G, B)   
     dim IntensityValue 
	 IntensityValue = .2126 * R + .7152 * G + .0722 * B
	 Lamp.Color = RGB(R, G, B)
	 Lamp.ColorFull = RGB(R, G, B)
	 Lamp.Intensity = IntensityValue *100 / 255
	 Lamp.State = 1
End Sub

Then, change the lamp image to be "!PF Off" so it uses the dark version.   Leave the lamp "on" all the time and let the intensity value dictate how much light shines through. 

IntensityValue will be 0-255, so you can mess around with how bright it gets by adjusting the " 100 / 255 to convert it into VP intensity values.

Of course you would use lines like this, instead of your big long IF line .. ;)


SetRGBLamp l40, Lampstate(229),Lampstate(230),Lampstate(231)

 

Thanks script work

fyi !PF Off is a different playfield image, I wouldn't recommend using that with mine :) It's from 85vetts table so not the redraw

I'm sure you already fixed the script but you can use this to quickly copy and paste any changes https://docs.google.com/spreadsheets/d/1s4ouYMJerlQFokz83jcp27Fmq13qfK74IdDgpOHvIUs/edit?usp=sharing

Share this post


Link to post
Share on other sites

Ha no, I had only done one as an experiment.    I'm glad I didn't, seeing as you have that nice spreadsheet to automate the rest. :)

Once moved to SetRGBLamp, and the playfield objects switched to the dark versions, we can play around more with the color math to get it to more precisely match the real tables.  

Oh and thanks GTXJoe for the updated Mustang table!    So nice to see a real table come to life after staring at test data. :)

 

Share this post


Link to post
Share on other sites
1 hour ago, freneticamnesic said:

I appreciate the assistance but there's enough evidence to suggest that there are earlier roms than 141 for the LE... The different attract mode is the biggest giveaway (everything from 141 onward has the sweeping color fades as seen in my video) --- many videos on youtube show a different attract mode.

Here's a screenshot showing 1.3

iqGKTF2.png

Yes, I'm well aware of what has been documented. What I am saying is that I'm not hiding anything in the back of the store. If I have it, I've uploaded it. This is the earliest I have:

1.3 was the initial release, so it probably only appeared in the shipped game and would have to be dumped from a game that still has it. It's the code updates that appear on the Stern website. 

Share this post


Link to post
Share on other sites

Here's a current build of ST LE for testing purposes or anyone interested in trying it out. There's probably a couple bugs though I can't think of any. There may be a handful of things missing, off the top of my head I think just a bunch of flashers. They will be added soon but don't affect gameplay so not a huge deal to me yet.

Lasers are in there, vengeance movement scripted, gates are scripted, left kicker and scoop are scripted, left outlane kickback is scripted, RGBs are scripted, the warp chaser lights and enterprise cabinet side chasers are scripted. Switched over the ramps to the LE style ramps (wireform) to accommodate the left scoop. Tweaked the physics a bit, changed the sounds. I haven't made a new apron yet but the lights are kind of laid over the top so you get some of the effect.

I think the laser is pretty sweet, I adapted a demo script gtxjoe had made for moving balls in a circle and applied it to 120 VP light objects that circle the playfield. I don't really know how to get to the mode, I do know that if I complete a mode stack (3 of the same mode) it will come up quicker, so give that a try and see if you can get the laser to turn on. 

This has been fun, a needed distraction...

DJRobX has done some amazing shit the past few weeks.

https://www.dropbox.com/s/24df19sl29fr70v/stle 100116a.rar?dl=0

Share this post


Link to post
Share on other sites
2 hours ago, DJRobX said:

This table is some amazing shit too!   Teamwork!   Thanks Fren! 

 

I started to post that sol41 wasn't working but ran the rom test and it's actually 59? Any reason sol41 through sol 46 are shifted +18?

41 = 59

42 = 60

43 = 61

44 = 62

45 = 63

46 = 64

Share this post


Link to post
Share on other sites
On 9/30/2016 at 4:40 AM, CarnyPriest said:

This will require changing Const cGameName in VP table scripts:
Iron Man & Iron Man Vault Edition
X-Men
The Avengers

Thanks, Carny... where can we find the new names?  I can't seem to find them in the readme file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×