Better Input Handling and SOCD & Diagonal Direction Fix - eniva/MisSTer_Guides GitHub Wiki

Enhanced4Way Module for 2-way or 4-way systems

Many old systems like the arcade Pacman and Donkey Kong were designed with only 4-way (up down left right) inputs in mind. Diagonal inputs did not exist on their systems so they never had to decide how they should be processed.

When they are played on any controllers that can have diagonal inputs (i.e. all controllers that's not a 4-way-only joystick), they behave in an unpredictable manner, causing missed or wrong inputs.

This should NEVER be used on systems that were not 2-way/4-way only.

User Options

There are three ways to fix this problem. They are mostly personal preference so cores using this can provide a user option on the OSD.

4-Way-Only

  • None - Does not do anything. Unpredictable outcome.
  • Change Direction - Otherwise known as "Prediction", when diagonal input is received, it assumes the new direction is intended so the direction that was pressed later than the earlier direction is processed. This is the most preferred way and recommended for most systems.
  • Keep Direction - The often called "Correction" is a way to respect the earlier direction and correct it to stay on course while ignoring the new direction in the diagonal input.
  • Vertical - Always forces* to vertical directions.
  • Horizontal - Always forces* to horizontal directions.
  • Stop - This "Clear" option assumes the diagonal input is an error, and both input must be stopped to prevent any potential disasters. Some prefer this for games like Tetris.

*Forcing into one direction like this cannot prevent any movements if the opposing movement was pressed first (as we cannot predict future). It still prevents the other direction being pressed further.

2-Way-Only systems do not need User Options.

F.A.Q.

Q. Does this produce any input latency?

A. No, it simply redirects input to a new module during single clock cycle to send new processed input.

Q. How does this work on 4-way-only joysticks?

A. This has zero impact on 4-way-only controllers.

Developer Options

Enhanced4Way provides the core developer how certain inputs should be handled. These settings are not exposed to the user.

1. UP-DOWN / LEFT-RIGHT SOCD CLEANING - What to do when opposing directions are active at the same time. This is mostly for keyboards and Hitbox controllers.

  • Neutral - Sends no input
  • Force Up/Left - Most SOCD cleaners force this to "Up" for vertical. This can be set for horizontal and vertical separately.
  • Force Down-Right - Most SOCD cleaners force this to neutral. This can be set for horizontal and vertical separately

2. Perfect Diagonals - An extremely rare occurrence where the player press two or more adjacent directions at the exact same time, making it impossible to predict their intention or correct them.

  • Favor None - Sends no input
  • Favor Horizontal - Only lets the horizontal inputs through, zeroing the vertical movement.
  • Favor Vertical - Only lets the vertical inputs through, zeroing the horizontal movement.

Implementation

For users, you cannot use this unless the developer of the core implements it.

For developers, it's as easy as adding a new status user OSD option and routing your inputs. Please check its github repo for more details: fpga-controls