mellon4444
Posts: 2
Joined: Mon Aug 02, 2021 4:55 pm

help!the -steadykey function!

I found the -steadykey is very useful, but it is used on keyboard only! Does not affect joystick. I want to use this function on the joystick!

Its detail is: It doesn't send input keys until after zero changes are detected between two frames. This delays the inputs for at least one frame; even if all inputs are correctly seen at once, MAME waits for the next frame to see that all the same keys are still down, before sending to the game. If the keyboard is really slow, OTOH, it might take a couple frames to send the computer which keys are down (and up). In this case, MAME waits until the changes stop coming, however many frames that takes.

I found many fighting games’ moves need badly this function (especially CPS1/CPS2/CPS3 games), if you want to use multiple buttons (A+B+C) consistently (like Zangief ’s spinning punch - Street Fighter 3 's EX moves),you should open -steadykey.

Could somebody write the code of same function for joystick? I meant why not add some code like '-steadybutton' for joystick? Thanks!
mellon4444
Posts: 2
Joined: Mon Aug 02, 2021 4:55 pm

Re: help!the -steadykey function!

i found the code of "steadykey" function is in the source file"inputdev" ( src/emu/ )

the following is a part of it ,could somebody help me edit the "inputdev" file and change -steadykey‘s target from keyboard to joystick?


//-------------------------------------------------
// apply_steadykey - apply steadykey option
//-------------------------------------------------

void input_device_keyboard::apply_steadykey() const


{
// ignore if not enabled
if (!steadykey_enabled())b
return;

// update the state of all the keys and see if any changed state
bool anything_changed = false;
for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= maxitem(); ++itemid)
{
input_device_item *itm = item(itemid);
if (itm != nullptr && itm->itemclass() == ITEM_CLASS_SWITCH)
if (downcast<input_device_switch_item &>(*itm).steadykey_changed())
anything_changed = true;
}

// if the keyboard state is stable, flush the current state
if (!anything_changed)
for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= maxitem(); ++itemid)
{
input_device_item *itm = item(itemid);
if (itm != nullptr && itm->itemclass() == ITEM_CLASS_SWITCH)
downcast<input_device_switch_item &>(*itm).steadykey_update_to_current();
}
}
mhoes
Posts: 186
Joined: Wed Oct 26, 2016 12:26 pm

Re: help!the -steadykey function!

mellon4444 wrote: Thu Aug 05, 2021 3:57 am i found the code of "steadykey" function is in the source file"inputdev" ( src/emu/ )

the following is a part of it ,could somebody help me edit the "inputdev" file and change -steadykey‘s target from keyboard to joystick?
Unfortunately, it's not as simple as you seem to think. It's not as simple as replacing 'keyboard' with 'joystick', and expect it to work. In order to achieve this, you would need to learn how to program/code (in C++), and then intensely familiarize yourself with the MAME sourcecode, and then use that knowledge to write new code all of your own.

Return to “MAME Discussion”