nCine::JoystickGuid class

Parsed 16-byte GUID that identifies a joystick model.

Used to match a connected joystick against a mapping configuration.

Constructors, destructors, conversion operators

JoystickGuid()
JoystickGuid(JoystickGuidType type)
JoystickGuid(StringView string)

Public functions

void fromType(JoystickGuidType type)
Fills the GUID for a well-known layout type.
void fromString(StringView string)
Parses the GUID from its hexadecimal string representation.
auto isValid() const -> bool
Returns true if the GUID is not all zeros.
auto operator==(const JoystickGuid& guid) const -> bool

Public variables

std::uint8_t data
Raw GUID bytes.

Variable documentation

std::uint8_t nCine::JoystickGuid::data

Raw GUID bytes.

Over-aligned deliberately: fromType(), isValid() and JoyMapping::CreateJoystickGuid() all read and write these bytes four or two at a time through a std::uint32_t* / std::uint16_t*, which a plain byte array does not guarantee is legal — its own alignment is 1, so wherever the compiler happened to place a GUID could leave those accesses unaligned. That costs nothing on x86 or ARM, but MIPS and SH-4 raise an address error rather than taking a slow path, which kills the process outright (see the event-parameter read in Player::OnUpdate that did exactly that on the PSP). One alignas makes every one of those accesses well defined instead of lucky.