Closed rdagger closed 10 months ago
Here's the relevant commit https://github.com/mamedev/mame/commit/7a0645cfdd01fa136353117a78d3188ed253e84c
I'm not familiar with PORT_CONFNAME, I assume this might be a physical jumper on the board (Inverter circuit) and not necessarily a dip switch. We could probably set this up with a fake dip though and install a write handler.
Found this info as well.
The cocktail model uses the same PCB as the upright model.
The cocktail harness has a jumper wire from J20 Pin7 to Pin 19 that controls the video inverter circuit.
Source: https://www.arcade-history.com/?n=asteroids-cocktail-model&page=detail&id=36869
Here's the relevant commit mamedev/mame@7a0645c
I'm not familiar with PORT_CONFNAME, I assume this might be a physical jumper on the board (Inverter circuit) and not necessarily a dip switch. We could probably set this up with a fake dip though and install a write handler.
Yeah i've not bumped into code such as this before either "just as well likely" as you said fake ports with a trampoline which hooks to the video code to allow the flip or not toggle is what ya need most likely.
Easier said than done though eh maybe another driver with a similar scheme might point you in the correct direction.?? certainly after searching the MAME src i see no other drivers as yet using this exact same hookup style.
EDIT Sometimes FBN can help give some pointers if this fix has been added there.?? as like us they'd have to rework the same code to fit within their structure.
Made a little progress on this. It seems we need to setup flipping for dvg. Avg already has flipping so I hung off of some of that code.... It's hotwired as of now for testing that is. I installed a write handler to catch the player selection bit and read a fake dip switch to enable the flip. As a concept, this is working but the flip from top to bottom is off, cutting off the score header. Just need to figure why it's getting offset then hook up the controller ports and this should be good. Any help on the flip alignment issue would be appreciated.
https://github.com/libretro/mame2003-plus-libretro/compare/master...Roid
fix is here https://github.com/grant2258/mame2003-plus-libretro/tree/ast
The reason for the offset was here just wasn't calculating the visible area properly.
Thanks I'll give it a go, do you think we should change the avg code like you have for all games or just this one case? Not sure if it will impact any other games
wont break anything just cuts off the invisible area was just done wrong.
Sounds like a win win then 👍
Btw does current mame even have cocktail controls or are they still sharing the p1 set?
no sure youll probably need to tie in with @rdagger for the details
Added screen flipping for asteroids, not deluxe cab though..haven't found the player selection bit for that one yet. Still sharing one input set, though I think current mame shares too. https://github.com/libretro/mame2003-plus-libretro/commit/d850ce57880291775ea976303b242e8567f8da4e
@rdagger can you confirm if current mame has separate controls for cocktail mode? Or did they just enable screen flipping?
@mahoneyt944 as far as I know mame currently doesn't implement separate controls, but it should because the cocktail cabinets had separate controls.
@mahoneyt944 there is a lot of information on this thread: https://forum.arcadecontrols.com/index.php/topic,168028.0.html
Interesting read, yeah it appears that they are sharing a port and using grounding tricks to get the extra buttons or something to that effect. I'll look into hooking up a p2 set.
I hooked up cocktail controls for asteroids. Let me know how it works for you. https://github.com/libretro/mame2003-plus-libretro/commit/ee4c13520c80884324364d5d70c3c4c9fe0d4567
Deluxe still not implemented though.
@mahoneyt944 it works, great job! The screen flips. The player 2 controls work as expected and don't interfere with the other player's ship.
There is 1 very small bug. The start button LEDs no longer function properly. Before when you insert a coin the player 1 LED would blink and if you inserted a second coin the player 2 LED would also blink. Now both LEDs are constantly illuminated.
Interesting, that might be the bit I'm hooked onto...though I'm not sure what the actual machine does in this odd configuration. I think once i get deluxe working I might have a better method for hooking .
Edit: yes my hook is essentially unhooking the original write after init which is what handles the LEDs. I'll fix that soon.
https://github.com/libretro/mame2003-plus-libretro/commit/c7bcc47d11c9c0a94d810f84d0b9d825b44cd65b this should fix the leds
@mahoneyt944 you fixed the LED bug! 🚀 Your contribution made my day. Thanks a ton!
No problem, I will try to get the deluxe working as well. Still need to figure out the bits for that cab though to hook properly.
For asteroids, I simply found a bit that seems to follow which players turns it is, then used a little logic to read our fake dip switch. For astroids deluxe, it should follow this same method and all the code should pretty much drop in. Problem is I haven't been able to find a bit that toggles with the players turn, there's probably an easy way to find such a bit...maybe in debug, hex editor or cheat engine. @grant2258 , @arcadez2003 do either of you have any ideas to find this bit for deluxe? Maybe we can dump the memory before and after a player turn changes or something?
looking at the latest mame source its offset 4 bit 7 so address 0x3c04 bit 7 so data & 128 at that address should get you what your looking for.
Thanks I'll try it out
On a second look I think I tried 0x80 already, it's the LED light which flashes when coins go in. I'll plug in everything and retest though since I may not have been in the right port.
@grant2258 yup that did the trick, deluxe is now working too 😄 https://github.com/libretro/mame2003-plus-libretro/commit/25f3e820111e1ff0c51eb220fd7aa52f5dca70d4
Asteroids is "data&0x04" correct? I found this bit without using documentation. I was just looking at deluxe in current mame and I see this:
The <4> is the offset, but how did you get bit 7?
Asteroids would be this:
So 3202? But again how did you verify the bit? I guess 4 since it works.
@mahoneyt944 Asteroids Deluxe works, thanks again!
I only looked what deluxe is doing bit seven is set here https://github.com/mamedev/mame/blob/d750435f57639e6e5ed314793595853c2d975b86/src/mame/atari/asteroid.cpp#L457.
Well I think it's safe to close this, as both games are now fully supported in cocktail mode 👍
@mahoneyt944 i've been back working with the advanceMAME core again of late and whatya know...... https://github.com/amadvance/advancemame/commit/321fb1ac82b49c678481ef297a0581ca36239bc7 Wish i'd spotted that earlier as maybe it would have given some pointers and saved ya some time anyway you got it sorted in the end so no harm done.
@arcadez2003 lol thanks. Yeah many ways to get there. But if it works it works . It was fun to figure it out anyhow.
Asteroids and Asteroids Deluxe are missing the cabinet dip switch for cocktail mode and the player 2 controls. I believe this was fixed in mame v0.198.