17#define MAXCONTROLLERS 4
20#define CONT_ABSOLUTE 0x0001
21#define CONT_RELATIVE 0x0002
22#define CONT_JOYPORT 0x0004
25#define CONT_CARD_ON 0x01
26#define CONT_CARD_PULL 0x02
27#define CONT_ADDR_CRC_ER 0x04
30#define PFS_ERR_NOPACK 1
31#define PFS_ERR_NEW_PACK 2
32#define PFS_ERR_INCONSISTENT 3
33#define PFS_ERR_CONTRFAIL 4
34#define PFS_ERR_INVALID 5
35#define PFS_ERR_BAD_DATA 6
36#define PFS_DATA_FULL 7
38#define PFS_ERR_EXIST 9
39#define PFS_ERR_ID_FATAL 10
40#define PFS_ERR_DEVICE 11
50#define CONT_START 0x1000
52#define CONT_DOWN 0x0400
53#define CONT_LEFT 0x0200
54#define CONT_RIGHT 0x0100
63#define A_BUTTON CONT_A
64#define B_BUTTON CONT_B
68#define START_BUTTON CONT_START
70#define L_JPAD CONT_LEFT
71#define R_JPAD CONT_RIGHT
72#define D_JPAD CONT_DOWN
73#define U_CBUTTONS CONT_E
74#define L_CBUTTONS CONT_C
75#define R_CBUTTONS CONT_F
76#define D_CBUTTONS CONT_D
79#define CONT_NO_RESPONSE_ERROR 8
87#define CONT_ERRNO errnum
90#define CONT_ERRNO errno
94#define PFS_INITIALIZED 0x01
95#define PFS_CORRUPTED 0x02
270 OSPfs *pfs,
u16 company_code,
u32 game_code,
u8 *game_name,
u8 *ext_name,
s32 *file_no);
289 OSPfs *pfs,
s32 file_no,
u8 flag,
int offset,
int size_in_bytes,
u8 *data_buffer);
326 int file_size_in_bytes,
412#if TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU
414#define CONT_EEPROM 0x8000
416#define CONT_EEPROM_BUSY 0x80
418#define EEPROM_MAXBLOCKS 64
420#define EEPROM_BLOCK_SIZE 8
Public interface of the libultra operating system, as the game links it.
struct OSMesgQueue_s OSMesgQueue
A message queue: a ring of messages and the threads blocked sending or receiving.
s32 osEepromLongRead(OSMesgQueue *mq, u8 address, u8 *buffer, int length)
Read consecutive blocks of the EEPROM, waiting 12 ms after each block.
s32 osContInit(OSMesgQueue *mq, u8 *bitpattern, OSContStatus *data)
Wait until the controllers have powered up, then find which are present.
s32 osEepromProbe(OSMesgQueue *mq)
Find whether the cartridge has an EEPROM.
s32 osMotorStart(OSPfs *pfs)
Start the motor of a Rumble Pak.
s32 osPfsNumFiles(OSPfs *pfs, s32 *max_files, s32 *files_used)
Count the directory entries and the files that use them.
s32 osPfsDeleteFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name)
Delete a file and free its pages.
s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer)
Read a block of the EEPROM once it is no longer busy.
s32 osPfsInit(OSMesgQueue *queue, OSPfs *pfs, int channel)
Open the Controller Pak of a channel, repairing its ID if needed, and check its file system.
s32 osEepromLongWrite(OSMesgQueue *mq, u8 address, u8 *buffer, int length)
Write consecutive blocks of the EEPROM, waiting 12 ms after each block.
s32 osPfsAllocateFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, int file_size_in_bytes, s32 *file_no)
Create a file of at least the given size.
s32 osMotorInit(OSMesgQueue *mq, OSPfs *pfs, int channel)
Open the Rumble Pak of a channel and build the commands that start and stop its motor.
s32 osContStartReadData(OSMesgQueue *mq)
Start reading the buttons and sticks of every controller.
s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer)
Write a block of the EEPROM once it is no longer busy.
s32 osPfsReadWriteFile(OSPfs *pfs, s32 file_no, u8 flag, int offset, int size_in_bytes, u8 *data_buffer)
Read or write whole blocks of a file.
s32 osPfsFindFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, s32 *file_no)
Find a file by its codes, and by its names unless they are NULL.
s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern)
Find which controllers have a Controller Pak inserted.
s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used)
Return the bytes of the pages no file uses.
s32 osPfsFileState(OSPfs *pfs, s32 file_no, OSPfsState *state)
Report the size, codes and names of a file.
s32 osMotorStop(OSPfs *pfs)
Stop the motor of a Rumble Pak.
s32 osPfsChecker(OSPfs *pfs)
Remove directory entries whose page chains are broken, and rebuild the page tables from the chains th...
void osContGetReadData(OSContPad *data)
Copy the buttons and sticks of the read osContStartReadData() started.
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, int channel)
Open the Controller Pak of a channel like osPfsInit(), starting from the ID checksum of the caller's ...
s32 osPfsRepairId(OSPfs *pfs)
Read the ID block again, repairing it if needed.
The buttons and stick of a controller.
Definition os_cont.h:107
u16 button
Definition os_cont.h:108
u8 CONT_ERRNO
Definition os_cont.h:111
s8 stick_y
Definition os_cont.h:110
s8 stick_x
Definition os_cont.h:109
What osContInit() learns of a controller.
Definition os_cont.h:98
u8 status
Definition os_cont.h:101
u8 CONT_ERRNO
Definition os_cont.h:103
u16 type
Definition os_cont.h:99
What osPfsFileState() reports of a file.
Definition os_cont.h:132
char ext_name[4]
Definition os_cont.h:136
u16 company_code
Definition os_cont.h:135
char game_name[16]
Definition os_cont.h:137
u32 file_size
Definition os_cont.h:133
u32 game_code
Definition os_cont.h:134
An open Controller Pak.
Definition os_cont.h:115
OSMesgQueue * queue
Definition os_cont.h:117
u8 label[32]
Definition os_cont.h:120
int dir_table
Definition os_cont.h:125
int inode_start_page
Definition os_cont.h:126
int status
Definition os_cont.h:116
u8 activebank
Definition os_cont.h:128
int dir_size
Definition os_cont.h:122
int version
Definition os_cont.h:121
int minode_table
Definition os_cont.h:124
u8 banks
Definition os_cont.h:127
int channel
Definition os_cont.h:118
int inode_table
Definition os_cont.h:123
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
signed char s8
Definition ultratypes.h:23
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18