Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
09178 Core Minor Always 5 days ago 5 days ago
Tester AlienPainter View Status Public Platform MAME (Official Binary)
Assigned To Resolution Invalid report OS Windows 10/11 (64-bit)
Status [?] Closed Driver
Version 0.276 Fixed in Version Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary 09178: Driver input port / Lua functionality issue: Driver input port / Lua functionality issue possible with High / Low status
Description This is my first report so I hope it has enough detail.
I am developing a script/GUI that makes creating Mame Lay files very quickly. As part of the system I have developed a system to include "instruction cards" on the left and right of the MAME game window. As part of the Lay file I include a Lua script at the bottom which allows the user to cycle through the included instruction cards for both Player 1 and Player 2. The script uses the hardcoded inputs rather than using a wrapper like Rocketlauncher does. My purposes was to extend the function of MAME in Retrobat. I quickly realised that this would also work for anyone using MAME.

In my LUA script it holds the data like this:

-- Variables for Player 1 Inputs (Left)
local player1_start_IOPORT = "SYSTEM"
local player1_start_BITPORT = 0x08
local player1_keyup_IOPORT = "P1"
local player1_keyup_BITPORT = 0x04
local player1_keydown_IOPORT = "P1"
local player1_keydown_BITPORT = 0x08

-- Variables for Player 2 Inputs (Right)
local player2_start_IOPORT = "SYSTEM"
local player2_start_BITPORT = 0x10
local player2_keyup_IOPORT = "P2"
local player2_keyup_BITPORT = 0x04
local player2_keydown_IOPORT = "P2"
local player2_keydown_BITPORT = 0x08

The script should only cycle if the Start button and another button is held down e.g. Up/Down Left/Right or B1/B2
However, I have successfully done 500 games so far and around another 85 have a behaviour where the start button is not needed to trigger the cycling of the artwork. This is obviously an issue during game play as they cycle with ingame button pressing.

Airwolf is just one of these games. It's data is above.
Steps To Reproduce When I run the rom it displays the artwork included from the created Lay file. This includes the P1 and P2 Instruction cards.
When I press Start (The 1 key" and Up or down (Arrow keys for P1) I expect the artwork to cycle upon each combination button press. However, some roms cycle when only Up or down or left and right of B1 or B2 are pressed.

I am not sure if the is due to the lines in the driver cpp.

Airwolf = Kyugo.cpp
PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 )

PORT_START("P1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )

Is the Active HIGH the issue as on the other drivers that don't have an issue are LOW. Is there a work around?
Additional Information Here are a small list of roms with similar issues.

3in1semi
3stooges
8ballact
anteater
arabian
argusg
armorcar
astdelux
asteroid
asylum
atlantis
azurian
blkhole
bombjack
bongo
brutforc
calipso
calorie
checkman
cookbib2
cookbib3
curvebal

I have spent alot of hours developing this system and I would love to solve this issue with your help. I am entering the correct details per rom into an excel document. The data is read per rom when the lay files are created. If you have a fast way of getting the correct ports for each rom I would love to know the fastest way. It is a labour of love!

Could you please offer me some advice on how to tackle any roms that use Dials/Steering wheels\guns for my purpose of cycling?

any advice appreciated.
Github Commit
Flags
Regression Version
Affected Sets / Systems Driver input port / Lua functionality issue
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
9
User avatar
No.23305
Robbbert
Moderator
5 days ago
This doesn't seem to be a bug per se.

I'll set this to "Direction Needed" from the devs.
User avatar
No.23306
hap
Developer
5 days ago
JJ, this is a bug report of your own luascript, not MAME?
Nothing's wrong with airwolf's input ports.
User avatar
No.23307
AlienPainter
Tester
5 days ago
I was hoping a dev could confirm if the annomoly was due to the HIGH / Low Status in the CPP files and if there was a recommended way to be able to use the combination keys in LUA. This is the only reason I could find that may affect the script. I hoped this would be a very simple query for the Devs. I wasn't sure the best way to raise this issue as the Devs would have the best knowledge of why some have High and Some have Low. Again, any advice is appreciated.
User avatar
No.23308
AlienPainter
Tester
5 days ago
To Hap,

I agree with your comments but hoped there was a work around the issue I describe with roms like Airwolf ignoring the combination requirement.
User avatar
No.23309
hap
Developer
5 days ago
ACTIVE_HIGH/LOW is according to how the emulated hardware is wired up.

ACTIVE_HIGH: game reads input port -> 1 = button held down, 0 = button not held down
ACTIVE_LOW: game reads input port -> 0 = button held down, 1 = button not held down
User avatar
No.23310
AlienPainter
Tester
5 days ago
@ Happ,

So is there a way to emulate a combination key press on systems that use HIgh instead of Low using Lua scriptting?
User avatar
No.23311
hap
Developer
5 days ago
I don't know, I haven't seen your lua script other than the little bit above with variable declarations.
IO port field set_value(1) will 'press' a button no matter if it's active low or high.

Anyway, good luck writing LUA scripts. This is not a MAME bug, closing report.
User avatar
No.23312
AlienPainter
Tester
5 days ago
Thanks for your help and advice.
Where is best to discuss this issue so I can finish my script?
User avatar
No.23313
hap
Developer
5 days ago
It's not up to me which is 'best'.
Surely you already know some of these discussion forums?:

https://forums.bannister.org/ubbthreads.php?ubb=postlist&Board=1&page=1
https://github.com/orgs/mamedev/discussions
https://old.reddit.com/r/MAME/
https://www.mameworld.info/ubbthreads/ubbthreads.php?Cat=