MAME 0.166 Global Inputs (2 player split screen) in MAME Module

bob.records

New member
RL Member
Hahaha, well it was a cpl yearsold, it sounded like he could send mame inputs direct in the raw system, so if anythings possible he might br able to work it out. Can you send me the bat file you are using so far and il have a good look tomorrow.
 

bleasby

RocketLauncher Developer
Developer
Raw input injection? Sounds kinky lol. What's it supposed to do?

I believe that it is a way to hook the mame raw input to inject keys sent from other programs without the need to have the direct input compiled version.
I wouldn't know for sure but I think he never shared his findings. I believe you have to create a virtual drive to do that.

But I really don't know if this is even relevant for the subject.
Did anybody even tested if when you have the global_input enabled on mame if your gamepad buttons still work on a game that is not on focus?
If they work, you can use both keyboard and gamepads normally with this option enabled, as long as you have them configured directly on mame.
If they don't work, you would need to simply use keyboard remaps instead to play with gamepads on local link games.

I believe that the real point here is:
Did anybody even tried to play MAME multiplayer games?
PLease, try to find out how to do it online, ask around on other forums, look at youtube videos, and so on.
Them when you are able to do it, with any game, just post here your findings and the steps necessary to make it work.
After that we will work on making it more easier to you and anybody else that wants to do that.
 

djvj

Administrator
Staff member
Developer
Right before I was passing out last night working on this, I attempted LAN play and could not get communication to work. It also showed me some issues with the module I still have to address. All my time was working on same PC multiplayer, which I have working great now at least, but only for 2P.

Has anyone tested different PCs on a LAN and has it working? What CLI are you sending to mame?

bob, this is what I'm testing with when launching manually:

Master:
Code:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_localhost 0.0.0.0 -comm_localport 15111 -global_inputs -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs";"\\STORINATOR\Games\MAME\MAME 0.166 CHDs;D:\Emulators\MAME\MAME\roms"
Slave1:
Code:
"mame64.exe" vr -w -cfg_directory cfg2 -nvram_directory nvram2 -comm_remotehost 127.0.0.1 -comm_remoteport 15111 -comm_localport 15112 -global_inputs -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs";"\\STORINATOR\Games\MAME\MAME 0.166 CHDs;D:\Emulators\MAME\MAME\roms"


Slave2:
Code:
"mame64.exe" vr -w -cfg_directory cfg3 -nvram_directory nvram3 -comm_remotehost 127.0.0.1 -comm_remoteport 15111 -comm_localport 15113 -global_inputs -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs";"\\STORINATOR\Games\MAME\MAME 0.166 CHDs;D:\Emulators\MAME\MAME\roms"



Now one of the slaves never connects. I can only get 2 player to work with those.
 

bob.records

New member
RL Member
Bleasby Ive tried the global-inputs command with 3gamepads and a madcatz wheel, unless mame is in focus it won't repsond. Keyboard will, but not with xpadder or joy2key. But please try something and see if you can get something to work, I'm the only person who seems to be pushing this on the net lol.

Thanks DJVJ, maybe its daisy chained, I'll have a play. Surprised you didn't think of that...... look below

win.jpg

Code:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_localport 15111 -comm_remoteport 15112  -global_inputs 

"mame64.exe" vr -w -cfg_directory cfg2 -nvram_directory nvram2 -comm_localport 15112 -comm_remoteport 15113  -global_inputs 

"mame64.exe" vr -w -cfg_directory cfg3 -nvram_directory nvram3 -comm_localport 15113 -comm_remoteport 15114 -global_inputs 

"mame64.exe" vr -w -cfg_directory cfg4 -nvram_directory nvram4 -comm_localport 15114 -comm_remoteport 15111 -global_inputs

That worked. Global inputs and port settings should be turned on after setting up the master\slave VP or its a pain and you need to choose car colour as all are defaulted to red. Going to try 8p later. = ) But 4p was laggy on my i5. I thinnk you would probably leave global inputs off the master and have that 1 set to focus. Maybe include preset nvram files as a seperate download and even use a seperate nvram (nvram1) for the master to keep it seperate.

I reckon those settings will work with all the games listed as same hardware - m1comm. I might be able to try 3 player lan here but would be a pain to setup.
 

Attachments

  • 4p vr.jpg
    4p vr.jpg
    110.6 KB · Views: 15
Last edited:

bleasby

RocketLauncher Developer
Developer
Thanks bob.records. A lot of good info on your post!

First of all, nice that you figured out the multiplayer command line.

It is sad that the gamepad commands do not work with global_input.
But your had a very good idea. The player 1 window should definetly be made active by the module so it doesn't need the global_inputs flag. That way the user could use gamepads directly configured on MAME for it and only use keyboard keys for the additional players.
 

djvj

Administrator
Staff member
Developer
Thanks bob, I'll check it out in a bit. I actually did think of doing that, but I figured it would never work because it just didn't make sense in my head a slave would receive packets when it's set to slave...That's the job of a master is what I thought...At least you tried it lol!

It works! yay, thanks a ton, now to rewrite the module logic!

Now just need someone to test LAN play and post results/CLI.
 
Last edited:

djvj

Administrator
Staff member
Developer
Logic rewritten to support 3+ players and now 3P launching perfect :)
 

Attachments

  • 20151014042433.jpg
    20151014042433.jpg
    279.9 KB · Views: 13

bob.records

New member
RL Member
Great news........time for everyone to dig out their spare keyboards !!!

I will have a look at LAN tonight as this seems the only viable option to play with game pads.
 
Last edited:

djvj

Administrator
Staff member
Developer
Cool bob. In the meantime, I have some more stuff to work on in the module that I hope to have done soon.
 

bleasby

RocketLauncher Developer
Developer
Saw this relating to Raw Input but definitely over my head how it can be implemented.
http://www.codeproject.com/Articles/185522/Using-the-Raw-Input-API-to-Process-Joystick-Input

This could be useful only if someone wants to dig in modifying the mame source code.

The thing is, I believe that mame uses the raw input for mouse and keyboards, but I am not sure if they use it for joysticks.
As the global_input option only works with keyboards, this could be the case.
Our objective would be to convince someone to change the mame source code to add support for joysticks when global_inputs is enabled.
I did not took a look at the mame soruce, but the way I see there are two ways of doing that: either by using the already implemented joystick read functions on the global inputs option or by adding the raw input api to read joysticks like it is done to keyboards. It is on the second option that this article could prove useful.

Anyway, the alternative to not change the mame source code is to develop a keymapper capable of sending raw inputs to mame. This is what I mentioned before that seamed to be what HeadKaze had acomplished. As I mentioned before, I believe this is only possible to be done by creating a hand made driver.

Either way, implementing the above options are way ahead of my knowledge, so I would recomend to use a clever keyboard mapping for these games meanwhile nobody else comes with the solution.
 

djvj

Administrator
Staff member
Developer
so got some new info from dgame over on byoac, and that layout only forks for 3p bob. It's doesn't scale 4p+. Should have tested it before finishing the rewrite...oh well. Back to the drawing board.

Here is how you can get 8p and even 8p + 2 live:


So for three cars it would be:
Code:
#  = nvram/car
L  = localport
R  = receive
Rp = remoteport
Tx = transmit


3 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 3 yellow (slave)


vformula3.bat
start /b mame.exe vformula -nvram_directory nvram1 -localport 15111 -remoteport 15112 -w 
start /b mame.exe vformula -nvram_directory nvram2 -localport 15113 -remoteport 15111 -w 
start /b mame.exe vformula -nvram_directory nvram3 -localport 15112 -remoteport 15113 -w

For 8 cars:
Code:
vformula9.bat
start /b mame.exe vformula -nvram_directory nvram1 -localport 15111 -remoteport 15112 -w 
start /b mame.exe vformula -nvram_directory nvram2 -localport 15113 -remoteport 15111 -w 
start /b mame.exe vformula -nvram_directory nvram3 -localport 15112 -remoteport 15114 -w 
start /b mame.exe vformula -nvram_directory nvram4 -localport 15115 -remoteport 15113 -w 
start /b mame.exe vformula -nvram_directory nvram5 -localport 15114 -remoteport 15116 -w 
start /b mame.exe vformula -nvram_directory nvram6 -localport 15117 -remoteport 15115 -w 
start /b mame.exe vformula -nvram_directory nvram7 -localport 15116 -remoteport 15118 -w 
start /b mame.exe vformula -nvram_directory nvram8 -localport 15119 -remoteport 15117 -w 
start /b mame.exe vformula -nvram_directory nvram9 -localport 15118 -remoteport 15119 -w 


#  = nvram/car
L  = localport
R  = receive
Rp = remoteport
Tx = transmit


2 L Rp
# R Tx
1 1 2 red (master)
2 2 1 blue (slave)


3 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 3 yellow (slave)


4 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 4 3 green (slave)


5 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 5 black (slave)


6 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 6 black (slave)
6 6 5 pink (slave)


7 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 6 black (slave)
6 7 5 pink (slave)
7 6 7 skyblue (slave)


8 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 6 black (slave)
6 7 5 pink (slave)
7 6 8 skyblue (slave)
8 8 7 orange (slave)


9 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 6 black (slave)
6 7 5 pink (slave)
7 6 8 skyblue (slave)
8 9 7 orange (slave)
9 8 9 red(live)


0 L Rp
# R Tx
1 1 2 red (master)
2 3 1 blue (slave)
3 2 4 yellow (slave)
4 5 3 green (slave)
5 4 6 black (slave)
6 7 5 pink (slave)
7 6 8 skyblue (slave)
8 9 7 orange (slave)
9 8 0 red(live)
0 0 9 blue(live)

I'm not quite seeing the pattern yet, but haven't had time to look too much into it. I need to be able to write this into a loop that scales from 1 to 8p.

It has a pattern, sort of zigzag of remote being 2 more, then 2 less than the local, but not all players follow that.


ok, hold on, scratch all that, it did work...I just got 4p all linked together with bob's port logic...I just forgot to update nvram on the later players.

Bleasby, I am going to need help with supporting upto 8 cars across the desktop res (multi-mon should be taken into account as well)
 
Last edited:

bob.records

New member
RL Member
Thanks Bleasby for summarizing all that, I looked at the mame code and no easy fix seemed apparent, I didn't think it would but was curious. Fingers crossed someone picks up the challenge.

DJVJ - looks good but I don't understand it 100%
1. - Dont the ports have to circle back round to the original from the last one. When I tested last night if they wern't in order it didn't load 4 player. Like 2-3, 3-4, 4-5, 5-2.

2. - I quess by layout fork you mean split screens layout - thats a shame, doesnt m2 do 4player. Cant imagine 8 player would work smooth or screens be big enough to make playable, unless on a projector (ME) but still be choppy. So maybe limit to 4 untill quantum processors are released = )

3. Does the other text in the code you posted mean you can pre-set the car colour n slame\master settings from cli ? if so thats COOL or isit just for reference.

4. Not sure about the last 2 lines I quess your referring to split screen setup again, little I know on that sorry. Again 8p on 1 pc is extreme.

And finally , (drum roll)

Lan worked first time, I tried 2 player, kept it simple and ignored all port settings and just set the IPs. Will try 3 player soon and feedback.

"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_remotehost 192.168.0.7
2p lan.png

Looking at the m1comm cmd box the ports are the same on both machines 15112 so only ip needs to change.
 
Last edited:

bleasby

RocketLauncher Developer
Developer
Wow. This is getting nice!!!

I will take a look on the best way to add 8 players support and multimonitors on the split screen function.

Maybe I should take a look also on adding multimonitors bezel support. Lets see what I do about that.

Sent from my GT-I9000B using Tapatalk 2
 

bob.records

New member
RL Member
So 3player lan works fine with VR as test, booted into race mode.

I only set ips in the bat, master to slave 1, slave 1 to slave 2 and slave 2 to master. All seem to use 15112 as the port and listen on 0.0.0.0 as default.

3p lan.png

Also people will need new rom file, m1comm.zip from 166 to work
 
Last edited:

bob.records

New member
RL Member
I think as lan play seems more realistic (control issue) making this easily useable for the masses seems to me essential. I can imagine a people making a seperate wheel for net play, incorperating a chat room before launch so to config from there depeding on the setup would be epic. Even more so if its works well over the net, id be happy to test to see if so, im from uk so ok speeds.

Thanks again for the work you guys do, this my way of paying you back for the rom mapping help =)

Also nuff respect to Sailsat n Haze for making any of this possible
 
Last edited:

djvj

Administrator
Staff member
Developer
Here's 8p, all same pc, until bleasby figures out the code to divide 8 screens, it will only show 4 for now, but you can see the position shows 5th/8 etc.
 

Attachments

  • 20151014145248.jpg
    20151014145248.jpg
    267.8 KB · Views: 19

bleasby

RocketLauncher Developer
Developer
already done djvj, just read the post that I made on the developer section and post a screenshot so we could see that running. :)
 

djvj

Administrator
Staff member
Developer
So I just realized a huge issue with getting LAN/WAN play to work with more than 2P. Due to how the master/slave ports have to connect, there is no way to automate this as I can see.

So in a normal PC game, one person plays as the host or server, in our case the master. Everyone else would connect to him, using his listening port and his LAN/WAN IP. In link games, each consecutive player would connect to the player before him, so P2 connects to P1, P3 connects to P2, P4 connects to P3, etc.

Essentially each person is also a server.to the next player. With about 10 seconds to get everyone connected upon booting the game, it makes it mostly impossible to simply start a game and multiple ppl connect and start going head-to-head. How is one supposed to know which player he is and what IP to connect to? How is the next person to know hey, don't connect to the master, but connect to P2 or P3? For the moment, this is impossible to do in RL. I have ideas on how to make this work, but it would involve RL running it's own network so different RLs around could talk to each other. This would require a ton of research, testing and implementing to make this work.

Basically don't plan on getting LAN with 3+ players to work easily.

One more problem that affects both local link and LAN play, nvram settings. Because you have to set ahead of time the master/slave, among many other settings need to match, if one person has different settings, the connection just won't work. Now, I have a solution for this that RL can automate. I already implemented it where it reads current nvram and adjusts link mode automatically.

Current issues with this:
Changing any setting in nvram, changes a 2-byte crc in the nvram also, which gets calculated depending on what all the settings are in nvram. So if I change one setting outside and run the game, it resets the car color to red. Meaning there would be a race with a whole bunch of red cars all the time. Because I'm not good with cryptography, I don't know how this crc is calculated. If someone can figure this out (I can give hex locations to show you where to look), then the crc can be calculated and written correctly. Either that, or I can enforce some settings with link mode is played, forcing each person to, for example, USA region, normal difficulty, freeplay, etc. I can store all these in the module and the crc values for those combinations of settings, one for each car color. Then users can set the car color as a module setting and it will work. It's just going to be a lot of work getting all these hex values to build a database in the module...then this has to be done for each linked game...!! This is just a lot of work I don't feel like doing and I'm probably one of the few who understands this.



So 3player lan works fine with VR as test, booted into race mode.

I only set ips in the bat, master to slave 1, slave 1 to slave 2 and slave 2 to master. All seem to use 15112 as the port and listen on 0.0.0.0 as default.

Also people will need new rom file, m1comm.zip from 166 to work

Bob, I don't quite understand how this could work, why was it even using 15112 as a default? Do you have that set in your mame.ini or something? I need specific cli for each player, like was the master using a remotehost switch at all?

I tried setting only remotehost ips for 2p and I watch the console on the master keeps saying connect to 192.168.1.6:15112 over and over until the slave starts talking. Then the master basically locks up and stops ranging. The slave keeps ranging but very slow and nothing ever starts. I added the executable to the firewall, so I don't think that's it. Plus it's getting through because the master stops ranging once the slave starts talking.

master:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_remotehost 192.168.1.6 -global_inputs -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs"

slave:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_remotehost 192.168.1.5 -global_inputs -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs"

NM, windows firewall on the master pc was still blocking it, turning off private firewall allowed it to connect. Let me see why it's still blocking mame. I see now, it was set to udp. Once I set to tcp it worked with firewall on.

Setting ports also worked:

master:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_remotehost 192.168.1.6 -comm_remoteport 15111 -comm_localport 16111 -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs"

slave:
"mame64.exe" vr -w -cfg_directory cfg -nvram_directory nvram -comm_remotehost 192.168.1.5 -comm_remoteport 16111 -comm_localport 15111 -rompath "\\STORINATOR\Games\MAME\MAME 0.166 ROMs"
 
Last edited:
Top