Skip to content

PADF_* and PADB_* constants don't represent hardware values #37

Open
@aaaaaa123456789

Description

The PADF_* and PADB_* constants have been around for a long time, but they don't describe any hardware at all. Their values represent the bitfields of the synthetic joypad value computed by some games after reading both lines of inputs and packing them into a single value; they represent convention, not hardware, and as such, they don't belong here. (This is not a statement about their utility: regardless of their value, it's a fact that there's nothing at all in the GB/GBC hardware representing the "down" D-pad button by the value $80.)

The correct values for the F series of constants for the right, left, up and down buttons are respectively 1, 2, 4 and 8, not their current values of $10, $20, $40 and $80. (The B series should be likewise adjusted.) These values overlap with the respective values for A, B, select and start: those bits also overlap in hardware, and thus the correct hardware constants should have the same values. However, changing the values of the defined constants would represent a silent incompatible change, which would be undoubtedly undesirable.
Therefore, my proposal is:

  1. Create new constants for the inputs with the correct values and different names, so they don't collide with current constants. (For instance, INPUTF_SELECT and INPUTF_UP, both equal to 4.)
  2. Announce the current constants as deprecated.
  3. Remove the current constants in the next major version.

Any thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions