2019-08-25 06:46:40 +02:00
|
|
|
#ifndef _ULTRA64_CONTROLLER_INTERNAL_H_
|
|
|
|
#define _ULTRA64_CONTROLLER_INTERNAL_H_
|
|
|
|
#include <types.h>
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-06-02 18:44:34 +02:00
|
|
|
u8 padOrEnd;
|
|
|
|
u8 txLen;
|
|
|
|
u8 rxLen; //includes errno
|
|
|
|
u8 command;
|
2019-08-25 06:46:40 +02:00
|
|
|
u16 button;
|
|
|
|
s8 rawStickX;
|
|
|
|
s8 rawStickY;
|
|
|
|
} OSContPackedRead;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-06-02 18:44:34 +02:00
|
|
|
u8 padOrEnd;
|
|
|
|
u8 txLen;
|
|
|
|
u8 rxLen;
|
|
|
|
u8 command;
|
|
|
|
u8 data1;
|
|
|
|
u8 data2;
|
|
|
|
u8 data3;
|
|
|
|
u8 data4;
|
2019-08-25 06:46:40 +02:00
|
|
|
} OSContPackedRequest;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
OSContPackedRead read;
|
|
|
|
OSContPackedRequest request;
|
2020-04-03 20:57:26 +02:00
|
|
|
u32 as_raw[2];
|
2019-08-25 06:46:40 +02:00
|
|
|
} OSContPackedStruct;
|
|
|
|
|
2020-04-03 20:57:26 +02:00
|
|
|
#ifdef AVOID_UB
|
|
|
|
// Fix the OSContPackedStruct array
|
2020-06-02 18:44:34 +02:00
|
|
|
extern OSContPackedStruct _osContCmdBuf[8];
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2020-04-03 20:57:26 +02:00
|
|
|
// And fix the last element
|
2020-06-02 18:44:34 +02:00
|
|
|
#define _osContPifCtrl _osContCmdBuf[7].as_raw[1]
|
2020-04-03 20:57:26 +02:00
|
|
|
#else
|
|
|
|
// Original OSContPackedStruct definitions
|
2020-06-02 18:44:34 +02:00
|
|
|
extern OSContPackedStruct _osContCmdBuf[7];
|
|
|
|
extern u32 _osContPifCtrl;
|
2020-04-03 20:57:26 +02:00
|
|
|
#endif
|
2019-08-25 06:46:40 +02:00
|
|
|
|
|
|
|
#endif
|