Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
os_cont.h
Go to the documentation of this file.
1 
2 /*====================================================================
3  * os_cont.h
4  *
5  * Copyright 1995, Silicon Graphics, Inc.
6  * All Rights Reserved.
7  *
8  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
9  * Inc.; the contents of this file may not be disclosed to third
10  * parties, copied or duplicated in any form, in whole or in part,
11  * without the prior written permission of Silicon Graphics, Inc.
12  *
13  * RESTRICTED RIGHTS LEGEND:
14  * Use, duplication or disclosure by the Government is subject to
15  * restrictions as set forth in subdivision (c)(1)(ii) of the Rights
16  * in Technical Data and Computer Software clause at DFARS
17  * 252.227-7013, and/or in similar or successor clauses in the FAR,
18  * DOD or NASA FAR Supplement. Unpublished - rights reserved under the
19  * Copyright Laws of the United States.
20  *====================================================================*/
21 
22 /*---------------------------------------------------------------------*
23  Copyright (C) 1998 Nintendo. (Originated by SGI)
24 
25  $RCSfile: os_cont.h,v $
26  $Revision: 1.1 $
27  $Date: 1998/10/09 08:01:05 $
28  *---------------------------------------------------------------------*/
29 
30 #ifndef _OS_CONT_H_
31 #define _OS_CONT_H_
32 
33 #ifdef _LANGUAGE_C_PLUS_PLUS
34 extern "C" {
35 #endif
36 
37 #include <PR/ultratypes.h>
38 #include "os_message.h"
39 
40 
41 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
42 
43 /**************************************************************************
44  *
45  * Type definitions
46  *
47  */
48 
49 /*
50  * Structure for controllers
51  */
52 
53 typedef struct {
54  u16 type; /* Controller Type */
55  u8 status; /* Controller status */
56  u8 errno;
57 }OSContStatus;
58 
59 typedef struct {
60  u16 button;
61  s8 stick_x; /* -80 <= stick_x <= 80 */
62  s8 stick_y; /* -80 <= stick_y <= 80 */
63  u8 errno;
64 } OSContPad;
65 
66 typedef struct {
67  void *address; /* Ram pad Address: 11 bits */
68  u8 databuffer[32]; /* address of the data buffer */
69  u8 addressCrc; /* CRC code for address */
70  u8 dataCrc; /* CRC code for data */
71  u8 errno;
72 } OSContRamIo;
73 
74 
75 #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
76 
77 /**************************************************************************
78  *
79  * Global definitions
80  *
81  */
82 
83 /*
84  * Controllers number
85  */
86 
87 #ifndef _HW_VERSION_1
88 #define MAXCONTROLLERS 4
89 #else
90 #define MAXCONTROLLERS 6
91 #endif
92 
93 /* controller errors */
94 #define CONT_NO_RESPONSE_ERROR 0x8
95 #define CONT_OVERRUN_ERROR 0x4
96 #ifdef _HW_VERSION_1
97 #define CONT_FRAME_ERROR 0x2
98 #define CONT_COLLISION_ERROR 0x1
99 #endif
100 
101 /* Controller type */
102 
103 #define CONT_ABSOLUTE 0x0001
104 #define CONT_RELATIVE 0x0002
105 #define CONT_JOYPORT 0x0004
106 #define CONT_EEPROM 0x8000
107 #define CONT_EEP16K 0x4000
108 #define CONT_TYPE_MASK 0x1f07
109 #define CONT_TYPE_NORMAL 0x0005
110 #define CONT_TYPE_MOUSE 0x0002
111 #define CONT_TYPE_VOICE 0x0100
112 
113 /* Controller status */
114 
115 #define CONT_CARD_ON 0x01
116 #define CONT_CARD_PULL 0x02
117 #define CONT_ADDR_CRC_ER 0x04
118 #define CONT_EEPROM_BUSY 0x80
119 
120 /* Buttons */
121 
122 #define CONT_A 0x8000
123 #define CONT_B 0x4000
124 #define CONT_G 0x2000
125 #define CONT_START 0x1000
126 #define CONT_UP 0x0800
127 #define CONT_DOWN 0x0400
128 #define CONT_LEFT 0x0200
129 #define CONT_RIGHT 0x0100
130 #define CONT_L 0x0020
131 #define CONT_R 0x0010
132 #define CONT_E 0x0008
133 #define CONT_D 0x0004
134 #define CONT_C 0x0002
135 #define CONT_F 0x0001
136 
137 /* Nintendo's official button names */
138 
139 #define A_BUTTON CONT_A
140 #define B_BUTTON CONT_B
141 #define L_TRIG CONT_L
142 #define R_TRIG CONT_R
143 #define Z_TRIG CONT_G
144 #define START_BUTTON CONT_START
145 #define U_JPAD CONT_UP
146 #define L_JPAD CONT_LEFT
147 #define R_JPAD CONT_RIGHT
148 #define D_JPAD CONT_DOWN
149 #define U_CBUTTONS CONT_E
150 #define L_CBUTTONS CONT_C
151 #define R_CBUTTONS CONT_F
152 #define D_CBUTTONS CONT_D
153 
154 /* Controller error number */
155 
156 #define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
157 #define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
158 #define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
159 #define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
160 #define CONT_ERR_NOT_READY 12
161 #define CONT_ERR_VOICE_MEMORY 13
162 #define CONT_ERR_VOICE_WORD 14
163 #define CONT_ERR_VOICE_NO_RESPONSE 15
164 
165 
166 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
167 
168 /**************************************************************************
169  *
170  * Macro definitions
171  *
172  */
173 
174 
175 /**************************************************************************
176  *
177  * Extern variables
178  *
179  */
180 
181 
182 /**************************************************************************
183  *
184  * Function prototypes
185  *
186  */
187 
188 /* Controller interface */
189 
190 extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
191 extern s32 osContReset(OSMesgQueue *, OSContStatus *);
192 extern s32 osContStartQuery(OSMesgQueue *);
193 extern s32 osContStartReadData(OSMesgQueue *);
194 #ifndef _HW_VERSION_1
195 extern s32 osContSetCh(u8);
196 #endif
197 extern void osContGetQuery(OSContStatus *);
198 extern void osContGetReadData(OSContPad *);
199 
200 
201 #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
202 
203 #ifdef _LANGUAGE_C_PLUS_PLUS
204 }
205 #endif
206 
207 #endif /* !_OS_CONT_H_ */
void osContGetReadData(OSContPad *pad)
Definition: osContStartReadData.c:32
signed char s8
Definition: ultratypes.h:11
unsigned short int u16
Definition: ultratypes.h:14
Out of while attempting to print an unavailable message The error message file is inaccessible or has other problems Unknown Signal s An unknown signal has been caught Nested signals line but accepted as written The constant is too large to fit in a bit data type
Definition: err.english.cc:364
s32 osContInit(OSMesgQueue *mq, u8 *a1, OSContStatus *status)
Definition: osContInit.c:18
s32 osContStartReadData(OSMesgQueue *mesg)
Definition: osContStartReadData.c:13
unsigned char u8
Definition: ultratypes.h:12
signed int s32
Definition: ultratypes.h:15