psl1ght
A free SDK for Sony's PS3 console
move.h
1 #ifndef __LV2_MOVE_H__
2 #define __LV2_MOVE_H__
3 
4 #include <ppu-types.h>
5 #include <vec_types.h>
6 #include <spurs/types.h>
7 
8 #define MOVE_VERSION 2
9 #define MAX_MOVES 4
10 #define EXTERNAL_PORT_DATA_SIZE 32
11 
12 #define GEM_TRACKING_POSITION_TRACKED 1
13 #define GEM_TRACKING_VISIBLE 2
14 
15 #define STATE_CURRENT_TIME 0
16 #define STATE_LATEST_IMAGE_TIME 1
17 #define STATE_SPECIFY_TIME 2
18 
19 #define GEM_AUTO_WHITE_BALANCE 1
20 #define GEM_GAMMA_BOOST 2
21 #define GEM_COMBINE_PREVIOUS_INPUT_FRAME 4
22 #define GEM_FILTER_OUTLIER_PIXELS 8
23 
24 #define GEM_INERTIAL_LATEST 0
25 #define GEM_INERTIAL_PREVIOUS 1
26 #define GEM_INERTIAL_NEXT 2
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 typedef enum
34 {
35  GEM_NO_VIDEO_OUTPUT=1,
36  GEM_RGBA_640x480,
37  GEM_YUV_640x480,
38  GEM_YUV422_640x480,
39  GEM_YUV411_640x480,
40  GEM_RGBA_320x240,
41  GEM_BAYER_RESTORED,
42  GEM_BAYER_RESTORED_RGGB,
43  GEM_BAYER_RESTORED_RASTERIZED
44 } gemVideoConvertFormatEnum;
45 
46 typedef struct _gem_ext_port_data
47 {
48  u16 isconnected;
49 
50  unsigned int : 8; /* reserved */
51  /* Button information */
52  /* 0: UP, 1: DOWN */
53  unsigned int BTN_LEFT : 1;
54  unsigned int BTN_DOWN : 1;
55  unsigned int BTN_RIGHT : 1;
56  unsigned int BTN_UP : 1;
57  unsigned int BTN_START : 1;
58  unsigned int BTN_R3 : 1;
59  unsigned int BTN_L3 : 1;
60  unsigned int BTN_SELECT : 1;
61 
62  unsigned int : 8; /* reserved */
63  unsigned int BTN_SQUARE : 1;
64  unsigned int BTN_CROSS : 1;
65  unsigned int BTN_CIRCLE : 1;
66  unsigned int BTN_TRIANGLE : 1;
67  unsigned int BTN_R1 : 1;
68  unsigned int BTN_L1 : 1;
69  unsigned int BTN_R2 : 1;
70  unsigned int BTN_L2 : 1;
71 
72  /* Analog nub information */
73  /* 0x0000 - 0x00FF */
74  unsigned int ANA_R_H : 16;
75  unsigned int ANA_R_V : 16;
76  unsigned int ANA_L_H : 16;
77  unsigned int ANA_L_V : 16;
78 
79  u8 data[5];
81 
82 typedef struct _gem_pad_data
83 {
84  u16 buttons;
85  u16 ANA_T;
86 } gemPadData;
87 
88 typedef struct _gem_state
89 {
90  vec_float4 pos;
91  vec_float4 vel;
92  vec_float4 accel;
93  vec_float4 quat;
94  vec_float4 angvel;
95  vec_float4 angaccel;
96  vec_float4 handle_pos;
97  vec_float4 handle_vel;
98  vec_float4 handle_accel;
99  gemPadData paddata;
100  gemExtPortData extportdata;
101  system_time_t time;
102  f32 temperature;
103  f32 camera_pitch_angle;
104  u32 tracking;
105 } gemState;
106 
107 typedef struct _gem_attribute
108 {
109  u32 version;
110  u32 max;
111  void * memory ATTRIBUTE_PRXPTR; //pointer to memory to use for gem lib, if you specify null it will automatically allocate for you
112  Spurs *spurs ATTRIBUTE_PRXPTR; //pointer to Spurs object
113  u8 spu_priorities[8];
114 } gemAttribute;
115 
116 typedef struct _gem_cam_state
117 {
118  s32 exposure;
119  f32 exposure_time;
120  f32 gain;
121  f32 pitch_angle;
122  f32 pitch_angle_estimate;
124 
125 typedef struct _gem_img_state {
126  system_time_t frame_time;
127  system_time_t time;
128  f32 u;
129  f32 v;
130  f32 r;
131  f32 projectionx;
132  f32 projectiony;
133  f32 distance;
134  u8 visible;
135  u8 r_valid;
136 } gemImageState;
137 
138 typedef struct _gem_info
139 {
140  u32 max;
141  u32 connected;
142  u32 status[MAX_MOVES];
143  u32 port[MAX_MOVES];
144 } gemInfo;
145 
146 
148  s32 version; // set to MOVE_VERSION
149  gemVideoConvertFormatEnum format;
150  s32 conversion;
151  f32 gain;
152  f32 red_gain;
153  f32 green_gain;
154  f32 blue_gain;
155  void *buffer_memory ATTRIBUTE_PRXPTR;
156  void *video_data_out ATTRIBUTE_PRXPTR;
157  u8 alpha;
159 
160 typedef struct _gem_inertial_state
161 {
162  vec_float4 accelerometer;
163  vec_float4 gyro;
164  vec_float4 accelerometer_bias;
165  vec_float4 gyro_bias;
166  gemPadData pad;
167  gemExtPortData ext;
168  system_time_t time;
169  s32 counter;
170  f32 temperature;
172 
173 s32 gemGetEnvironmentLightingColor(f32* r, f32* g, f32* b);
174 s32 gemUpdateStart(const void* camera_frame, system_time_t timestamp);
175 s32 gemInit(const gemAttribute* attr);
176 s32 gemGetTrackerHue(u32 num, u32* hue);
177 s32 gemConvertVideoFinish();
178 s32 gemEnableMagnetometer(u32 num, s32 enable);
179 s32 gemGetRGB(u32 num, f32* r, f32* g, f32* b);
180 s32 gemWriteExternalPort(u32 num, u8 data[EXTERNAL_PORT_DATA_SIZE]);
181 
182 //hues points to an array that can hold 360 boolean values, my assumption is 360 bytes or 360 chars.
183 s32 gemGetAllTrackableHues(u8* hues);
184 s32 gemGetMemorySize(s32 max);
185 s32 gemUpdateFinish();
186 s32 gemEnableCameraPitchAngleCorrection(s32 enable);
187 
188 s32 gemGetRumble(u32 num, u8* intensity);
189 s32 gemSetRumble(u32 num, u8 intensity);
190 
191 s32 gemGetState(u32 num, u32 timeflag, system_time_t time, gemState* state);
192 
193 s32 gemGetAccelerometerPositionInDevice(u32 num, vec_float4* pos);
194 s32 gemConvertVideoStart(const void* frame);
195 
196 s32 gemFilterState(u32 num, u32 enable);
197 s32 gemSetYaw(u32 num, vec_float4 zdir);
198 s32 gemGetCameraState(gemCameraState* state);
199 
200 s32 gemTrackHues(const u32* req_hues, u32* res_hues);
201 
202 s32 gemGetImageState(u32 num, gemImageState* state);
203 
204 s32 gemClearStatusFlags(u32 num, u64 mask);
205 
206 s32 gemGetInfo(gemInfo* info);
207 
208 s32 gemPrepareCamera(s32 maxexposure, f32 quality);
209 
210 s32 gemCalibrate(u32 num);
211 
212 s32 gemGetHuePixels(const void* frame, u32 hue, u8* pixels);
213 s32 gemPrepareVideoConvert(const gemVideoConvertAttribute* attr);
214 s32 gemHSVtoRGB(f32 h, f32 s, f32 v, f32* r, f32* g, f32* b);
215 s32 gemForceRGB(u32 num, f32 r, f32 g, f32 b);
216 s32 gemGetInertialState(u32 num, u32 flag, system_time_t time, gemInertialState* inertial);
217 s32 gemReset(u32 num);
218 s32 gemEnd();
219 s32 gemInvalidateCalibration(u32 num);
220 s32 gemIsTrackableHue(u32 hue);
221 s32 gemGetStatusFlags(u32 num, u64* flags);
222 
223 
224 #ifdef __cplusplus
225  }
226 #endif
227 
228 #endif
Definition: move.h:116
Definition: move.h:160
Definition: move.h:82
Definition: move.h:88
Definition: move.h:147
Definition: move.h:125
Definition: move.h:46
Definition: move.h:138
Definition: move.h:107