Starship/include/PR/controller.h

52 lines
1.2 KiB
C
Raw Normal View History

2023-10-16 18:27:39 +03:00
#ifndef PR_CONTROLLER_H
#define PR_CONTROLLER_H
#include "global.h"
#include "PR/os.h"
2023-10-16 19:34:03 +03:00
typedef struct {
/* 0x00 */ u8 align;
/* 0x01 */ u8 txsize;
/* 0x02 */ u8 rxsize;
/* 0x03 */ u8 poll;
/* 0x04 */ u8 typeh;
/* 0x05 */ u8 typel;
/* 0x06 */ u8 status;
/* 0x07 */ u8 align1;
} __OSContRequestHeader; // size = 0x8
2023-10-16 19:32:30 +03:00
// Joybus commands
2023-10-16 18:27:39 +03:00
#define CONT_CMD_REQUEST_STATUS 0
2023-10-16 19:32:30 +03:00
#define CONT_CMD_READ_BUTTON 1
#define CONT_CMD_READ_PAK 2
#define CONT_CMD_WRITE_PAK 3
#define CONT_CMD_READ_EEPROM 4
#define CONT_CMD_WRITE_EEPROM 5
#define CONT_CMD_READ36_VOICE 9
#define CONT_CMD_WRITE20_VOICE 10
#define CONT_CMD_READ2_VOICE 11
#define CONT_CMD_WRITE4_VOICE 12
#define CONT_CMD_SWRITE_VOICE 13
#define CONT_CMD_CHANNEL_RESET 0xFD
#define CONT_CMD_RESET 0xFF
#define UNK(n) 500000 * (u64)(n) / 1000000
2023-10-16 18:27:39 +03:00
typedef struct
{
u32 ramarray[15];
u32 pifstatus;
} OSPifRam;
extern u32 __osContinitialized;
extern u8 __osMaxControllers;
extern u8 __osContLastCmd;
extern OSPifRam __osContPifRam;
extern OSMesgQueue __osEepromTimerQ;
extern OSMesg __osEepromTimerMsg;
2023-10-16 19:34:03 +03:00
void __osPackRequestData(u8 poll);
2023-10-16 19:36:10 +03:00
void __osContGetInitData(u8* pattern, OSContStatus* data);
2023-10-16 19:34:03 +03:00
2023-10-16 19:32:30 +03:00
#endif