git subrepo clone https://github.com/libretro/libretro-common.git deps/libretro-common
[pcsx_rearmed.git] / deps / libretro-common / include / defines / ps3_defines.h
1 /* Copyright (C) 2010-2021 The RetroArch team
2  *
3  * ---------------------------------------------------------------------------------------
4  * The following license statement only applies to this file (ps3_defines.h).
5  * ---------------------------------------------------------------------------------------
6  *
7  * Permission is hereby granted, free of charge,
8  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22
23 #ifndef _PS3_DEFINES_H
24 #define _PS3_DEFINES_H
25
26 /*============================================================
27         AUDIO PROTOTYPES
28 ============================================================ */
29
30 #ifdef __PSL1GHT__
31 #include <audio/audio.h>
32 #include <sys/thread.h>
33
34 #include <sys/event_queue.h>
35 #include <lv2/mutex.h>
36 #include <lv2/cond.h>
37
38 /*forward decl. for audioAddData */
39 extern int audioAddData(uint32_t portNum, float *data,
40       uint32_t frames, float volume);
41
42 #define PS3_SYS_NO_TIMEOUT 0
43 #define param_attrib attrib
44
45 #else
46 #include <sdk_version.h>
47 #include <cell/audio.h>
48 #include <sys/event.h>
49 #include <sys/synchronization.h>
50
51 #define numChannels nChannel
52 #define numBlocks nBlock
53 #define param_attrib attr
54
55 #define audioQuit cellAudioQuit 
56 #define audioInit cellAudioInit
57 #define audioPortStart cellAudioPortStart
58 #define audioPortOpen cellAudioPortOpen
59 #define audioPortClose cellAudioPortClose
60 #define audioPortStop cellAudioPortStop
61 #define audioPortParam CellAudioPortParam
62 #define audioPortOpen cellAudioPortOpen
63 #define audioAddData cellAudioAddData
64
65 /* event queue functions */
66 #define sysEventQueueReceive sys_event_queue_receive
67 #define audioSetNotifyEventQueue cellAudioSetNotifyEventQueue
68 #define audioRemoveNotifyEventQueue cellAudioRemoveNotifyEventQueue
69 #define audioCreateNotifyEventQueue cellAudioCreateNotifyEventQueue
70
71 #define sysLwCondCreate sys_lwcond_create
72 #define sysLwCondDestroy sys_lwcond_destroy
73 #define sysLwCondWait sys_lwcond_wait
74 #define sysLwCondSignal sys_lwcond_signal
75
76 #define sysLwMutexDestroy sys_lwmutex_destroy
77 #define sysLwMutexLock sys_lwmutex_lock
78 #define sysLwMutexUnlock sys_lwmutex_unlock
79 #define sysLwMutexCreate sys_lwmutex_create
80
81 #define AUDIO_BLOCK_SAMPLES CELL_AUDIO_BLOCK_SAMPLES
82 #define SYSMODULE_NET CELL_SYSMODULE_NET
83 #define PS3_SYS_NO_TIMEOUT SYS_NO_TIMEOUT
84
85 #define sys_lwmutex_attr_t sys_lwmutex_attribute_t 
86 #define sys_lwcond_attr_t sys_lwcond_attribute_t 
87 #define sys_sem_t sys_semaphore_t
88
89 #define sysGetSystemTime sys_time_get_system_time
90 #define sysModuleLoad cellSysmoduleLoadModule
91 #define sysModuleUnload cellSysmoduleUnloadModule
92
93 #define netInitialize sys_net_initialize_network
94
95 #endif
96
97 /*============================================================
98         INPUT PAD PROTOTYPES
99 ============================================================ */
100
101 #ifdef __PSL1GHT__
102 #include <io/pad.h>
103 #define CELL_PAD_CAPABILITY_SENSOR_MODE      4
104 #define CELL_PAD_SETTING_SENSOR_ON           4
105 #define CELL_PAD_STATUS_ASSIGN_CHANGES       2
106 #define CELL_PAD_BTN_OFFSET_DIGITAL1         2
107 #define CELL_PAD_BTN_OFFSET_DIGITAL2         3
108 #define CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_X   4
109 #define CELL_PAD_BTN_OFFSET_ANALOG_RIGHT_Y   5
110 #define CELL_PAD_BTN_OFFSET_ANALOG_LEFT_X    6
111 #define CELL_PAD_BTN_OFFSET_ANALOG_LEFT_Y    7
112 #define CELL_PAD_BTN_OFFSET_PRESS_RIGHT      8
113 #define CELL_PAD_BTN_OFFSET_PRESS_LEFT       9
114 #define CELL_PAD_BTN_OFFSET_PRESS_UP         10
115 #define CELL_PAD_BTN_OFFSET_PRESS_DOWN       11
116 #define CELL_PAD_BTN_OFFSET_PRESS_TRIANGLE   12
117 #define CELL_PAD_BTN_OFFSET_PRESS_CIRCLE     13
118 #define CELL_PAD_BTN_OFFSET_PRESS_CROSS      14
119 #define CELL_PAD_BTN_OFFSET_PRESS_SQUARE     15
120 #define CELL_PAD_BTN_OFFSET_PRESS_L1         16
121 #define CELL_PAD_BTN_OFFSET_PRESS_R1         17
122 #define CELL_PAD_BTN_OFFSET_PRESS_L2         18
123 #define CELL_PAD_BTN_OFFSET_PRESS_R2         19
124 #define CELL_PAD_BTN_OFFSET_SENSOR_X         20
125 #define CELL_PAD_BTN_OFFSET_SENSOR_Y         21
126 #define CELL_PAD_BTN_OFFSET_SENSOR_Z         22
127 #define CELL_PAD_BTN_OFFSET_SENSOR_G         23
128 #define CELL_PAD_CTRL_LEFT          (128)
129 #define CELL_PAD_CTRL_DOWN          (64)
130 #define CELL_PAD_CTRL_RIGHT         (32)
131 #define CELL_PAD_CTRL_UP            (16)
132 #define CELL_PAD_CTRL_START         (8)
133 #define CELL_PAD_CTRL_R3            (4)
134 #define CELL_PAD_CTRL_L3            (2)
135 #define CELL_PAD_CTRL_SELECT        (1)
136 #define CELL_PAD_CTRL_SQUARE        (128)
137 #define CELL_PAD_CTRL_CROSS         (64)
138 #define CELL_PAD_CTRL_CIRCLE        (32)
139 #define CELL_PAD_CTRL_TRIANGLE      (16)
140 #define CELL_PAD_CTRL_R1            (8)
141 #define CELL_PAD_CTRL_L1            (4)
142 #define CELL_PAD_CTRL_R2            (2)
143 #define CELL_PAD_CTRL_L2            (1)
144 #define CELL_PAD_CTRL_LDD_PS        (1)
145 #define CELL_PAD_STATUS_CONNECTED   (1)
146 #define CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN
147 #define CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS  (1)
148 #define CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CIRCLE (0)
149 #define now_connect connected
150 #define CellPadActParam padActParam
151 #define cellPadSetPortSetting ioPadSetPortSetting
152 #define cellSysutilGetSystemParamInt sysUtilGetSystemParamInt
153 #define cellPadSetActDirect ioPadSetActDirect
154 #define CellPadInfo2 padInfo2
155 #define cellPadGetInfo2 ioPadGetInfo2
156 #define CellPadData padData
157 #define cellPadGetData ioPadGetData
158 #define cellPadInit ioPadInit 
159 #define cellPadEnd ioPadEnd
160 #else
161 #include <cell/pad.h>
162 #define padInfo2 CellPadInfo2
163 #define padData CellPadData
164 #define ioPadGetInfo2 cellPadGetInfo2 
165 #define ioPadGetData cellPadGetData
166 #define ioPadInit cellPadInit
167 #define ioPadEnd cellPadEnd
168 #define ioPadSetPortSetting cellPadSetPortSetting 
169 #endif
170
171 /*============================================================
172         INPUT MOUSE PROTOTYPES
173 ============================================================ */
174
175 #ifdef HAVE_MOUSE
176
177 #ifdef __PSL1GHT__
178 #include <io/mouse.h>
179
180 /* define ps3 mouse structs */
181 #define CellMouseInfo mouseInfo
182 #define CellMouseData mouseData
183
184 /* define all the ps3 mouse functions */
185 #define cellMouseInit ioMouseInit
186 #define cellMouseGetData ioMouseGetData
187 #define cellMouseEnd ioMouseEnd
188 #define cellMouseGetInfo ioMouseGetInfo
189
190 /* PSL1GHT does not define these in its header */
191 #define CELL_MOUSE_BUTTON_1 (UINT64_C(1) << 0) /* Button 1 */
192 #define CELL_MOUSE_BUTTON_2 (UINT64_C(1) << 1) /* Button 2 */
193 #define CELL_MOUSE_BUTTON_3 (UINT64_C(1) << 2) /* Button 3 */
194 #define CELL_MOUSE_BUTTON_4 (UINT64_C(1) << 3) /* Button 4 */
195 #define CELL_MOUSE_BUTTON_5 (UINT64_C(1) << 4) /* Button 5 */
196 #define CELL_MOUSE_BUTTON_6 (UINT64_C(1) << 5) /* Button 6 */
197 #define CELL_MOUSE_BUTTON_7 (UINT64_C(1) << 6) /* Button 7 */
198 #define CELL_MOUSE_BUTTON_8 (UINT64_C(1) << 7) /* Button 8 */
199
200 #else
201 #include <cell/mouse.h>
202 #define mouseInfo CellMouseInfo
203 #define mouseData CellMouseData
204
205 #define ioMouseInit cellMouseInit
206 #define ioMouseGetData cellMouseGetData
207 #define ioMouseEnd cellMouseEnd
208 #define ioMouseGetInfo cellMouseGetInfo
209 #endif
210
211 #endif
212
213 /*============================================================
214         INPUT KEYBOARD PROTOTYPES
215 ============================================================ */
216
217 #ifdef __PSL1GHT__
218 #include <io/kb.h>
219
220 #define CELL_KB_RMODE_INPUTCHAR KB_RMODE_INPUTCHAR
221 #define CELL_KB_CODETYPE_RAW    KB_CODETYPE_RAW
222
223 #define cellKbData KbData
224 #define cellKbInfo KbInfo
225
226 #define cellKbSetCodeType ioKbSetCodeType
227 #define cellKbSetReadMode ioKbSetReadMode
228 #define cellKbInit ioKbInit
229 #define cellKbGetInfo ioKbGetInfo
230 #define cellKbRead ioKbRead
231 #else
232 #include <cell/keyboard.h>
233
234 #define KB_RMODE_INPUTCHAR CELL_KB_RMODE_INPUTCHAR
235 #define KB_CODETYPE_RAW    CELL_KB_CODETYPE_RAW
236
237 #define KbInfo cellKbInfo
238
239 #define ioKbSetCodeType cellKbSetCodeType
240 #define ioKbSetReadMode cellKbSetReadMode
241 #define ioKbInit cellKbInit
242 #define ioKbGetInfo cellKbGetInfo
243 #define ioKbRead cellKbRead
244
245 /* Keyboard RAWDAT Key code (can't be converted to ASCII codes) */
246 #define KB_RAWKEY_NO_EVENT                      0x00
247 #define KB_RAWKEY_E_ROLLOVER                    0x01
248 #define KB_RAWKEY_E_POSTFAIL                    0x02
249 #define KB_RAWKEY_E_UNDEF                       0x03
250 #define KB_RAWKEY_ESCAPE                        0x29
251 #define KB_RAWKEY_106_KANJI                     0x35    /* The half-width/full width Kanji key code */
252 #define KB_RAWKEY_CAPS_LOCK                     0x39
253 #define KB_RAWKEY_F1                            0x3a
254 #define KB_RAWKEY_F2                            0x3b
255 #define KB_RAWKEY_F3                            0x3c
256 #define KB_RAWKEY_F4                            0x3d
257 #define KB_RAWKEY_F5                            0x3e
258 #define KB_RAWKEY_F6                            0x3f
259 #define KB_RAWKEY_F7                            0x40
260 #define KB_RAWKEY_F8                            0x41
261 #define KB_RAWKEY_F9                            0x42
262 #define KB_RAWKEY_F10                           0x43
263 #define KB_RAWKEY_F11                           0x44
264 #define KB_RAWKEY_F12                           0x45
265 #define KB_RAWKEY_PRINTSCREEN                   0x46
266 #define KB_RAWKEY_SCROLL_LOCK                   0x47
267 #define KB_RAWKEY_PAUSE                         0x48
268 #define KB_RAWKEY_INSERT                        0x49
269 #define KB_RAWKEY_HOME                          0x4a
270 #define KB_RAWKEY_PAGE_UP                       0x4b
271 #define KB_RAWKEY_DELETE                        0x4c
272 #define KB_RAWKEY_END                           0x4d
273 #define KB_RAWKEY_PAGE_DOWN                     0x4e
274 #define KB_RAWKEY_RIGHT_ARROW                   0x4f
275 #define KB_RAWKEY_LEFT_ARROW                    0x50
276 #define KB_RAWKEY_DOWN_ARROW                    0x51
277 #define KB_RAWKEY_UP_ARROW                      0x52
278 #define KB_RAWKEY_NUM_LOCK                      0x53
279 #define KB_RAWKEY_APPLICATION                   0x65    /* Application key code */
280 #define KB_RAWKEY_KANA                          0x88    /* Katakana/Hiragana/Romaji key code */
281 #define KB_RAWKEY_HENKAN                        0x8a    /* Conversion key code */
282 #define KB_RAWKEY_MUHENKAN                      0x8b    /* No Conversion key code */
283
284 /* Keyboard RAW Key Code definition */
285 #define KB_RAWKEY_A                             0x04
286 #define KB_RAWKEY_B                             0x05
287 #define KB_RAWKEY_C                             0x06
288 #define KB_RAWKEY_D                             0x07
289 #define KB_RAWKEY_E                             0x08
290 #define KB_RAWKEY_F                             0x09
291 #define KB_RAWKEY_G                             0x0A
292 #define KB_RAWKEY_H                             0x0B
293 #define KB_RAWKEY_I                             0x0C
294 #define KB_RAWKEY_J                             0x0D
295 #define KB_RAWKEY_K                             0x0E
296 #define KB_RAWKEY_L                             0x0F
297 #define KB_RAWKEY_M                             0x10
298 #define KB_RAWKEY_N                             0x11
299 #define KB_RAWKEY_O                             0x12
300 #define KB_RAWKEY_P                             0x13
301 #define KB_RAWKEY_Q                             0x14
302 #define KB_RAWKEY_R                             0x15
303 #define KB_RAWKEY_S                             0x16
304 #define KB_RAWKEY_T                             0x17
305 #define KB_RAWKEY_U                             0x18
306 #define KB_RAWKEY_V                             0x19
307 #define KB_RAWKEY_W                             0x1A
308 #define KB_RAWKEY_X                             0x1B
309 #define KB_RAWKEY_Y                             0x1C
310 #define KB_RAWKEY_Z                             0x1D
311 #define KB_RAWKEY_1                             0x1E
312 #define KB_RAWKEY_2                             0x1F
313 #define KB_RAWKEY_3                             0x20
314 #define KB_RAWKEY_4                             0x21
315 #define KB_RAWKEY_5                             0x22
316 #define KB_RAWKEY_6                             0x23
317 #define KB_RAWKEY_7                             0x24
318 #define KB_RAWKEY_8                             0x25
319 #define KB_RAWKEY_9                             0x26
320 #define KB_RAWKEY_0                             0x27
321 #define KB_RAWKEY_ENTER                         0x28
322 #define KB_RAWKEY_ESC                           0x29
323 #define KB_RAWKEY_BS                            0x2A
324 #define KB_RAWKEY_TAB                           0x2B
325 #define KB_RAWKEY_SPACE                         0x2C
326 #define KB_RAWKEY_MINUS                         0x2D
327 #define KB_RAWKEY_EQUAL_101                     0x2E    /* = and + */
328 #define KB_RAWKEY_ACCENT_CIRCONFLEX_106         0x2E    /* ^ and ~ */
329 #define KB_RAWKEY_LEFT_BRACKET_101              0x2F    /* [ */
330 #define KB_RAWKEY_ATMARK_106                    0x2F    /* @ */
331 #define KB_RAWKEY_RIGHT_BRACKET_101             0x30    /* ] */
332 #define KB_RAWKEY_LEFT_BRACKET_106              0x30    /* [ */
333 #define KB_RAWKEY_BACKSLASH_101                 0x31    /* \ and | */
334 #define KB_RAWKEY_RIGHT_BRACKET_106             0x32    /* ] */
335 #define KB_RAWKEY_SEMICOLON                     0x33    /* ; */
336 #define KB_RAWKEY_QUOTATION_101                 0x34    /* ' and " */
337 #define KB_RAWKEY_COLON_106                     0x34    /* : and * */
338 #define KB_RAWKEY_COMMA                         0x36
339 #define KB_RAWKEY_PERIOD                        0x37
340 #define KB_RAWKEY_SLASH                         0x38
341 #define KB_RAWKEY_CAPS_LOCK                     0x39
342 #define KB_RAWKEY_KPAD_NUMLOCK                  0x53
343 #define KB_RAWKEY_KPAD_SLASH                    0x54
344 #define KB_RAWKEY_KPAD_ASTERISK                 0x55
345 #define KB_RAWKEY_KPAD_MINUS                    0x56
346 #define KB_RAWKEY_KPAD_PLUS                     0x57
347 #define KB_RAWKEY_KPAD_ENTER                    0x58
348 #define KB_RAWKEY_KPAD_1                        0x59
349 #define KB_RAWKEY_KPAD_2                        0x5A
350 #define KB_RAWKEY_KPAD_3                        0x5B
351 #define KB_RAWKEY_KPAD_4                        0x5C
352 #define KB_RAWKEY_KPAD_5                        0x5D
353 #define KB_RAWKEY_KPAD_6                        0x5E
354 #define KB_RAWKEY_KPAD_7                        0x5F
355 #define KB_RAWKEY_KPAD_8                        0x60
356 #define KB_RAWKEY_KPAD_9                        0x61
357 #define KB_RAWKEY_KPAD_0                        0x62
358 #define KB_RAWKEY_KPAD_PERIOD                   0x63
359 #define KB_RAWKEY_BACKSLASH_106                 0x87
360 #define KB_RAWKEY_YEN_106                       0x89
361
362 #define KB_CODETYPE_RAW CELL_KB_CODETYPE_RAW
363
364 /*! \brief Keyboard Led State. */
365 typedef struct KbLed
366 {
367         union
368    {
369       uint32_t leds;
370       struct
371       {
372          uint32_t reserved         : 27;        /*!< \brief Reserved MSB */
373          uint32_t kana             : 1; /*!< \brief LED Kana 0:OFF 1:ON Bit4 */
374          uint32_t compose               : 1;    /*!< \brief LED Compose 0:OFF 1:ON Bit3 */
375          uint32_t scroll_lock   : 1;    /*!< \brief LED Scroll Lock 0:OFF 1:ON Bit2 */
376          uint32_t caps_lock     : 1;    /*!< \brief LED Caps Lock 0:OFF 1:ON Bit1 */
377          uint32_t num_lock         : 1; /*!< \brief LED Num Lock 0:OFF 1:ON Bit0 LSB */
378       }_KbLedS;
379    }_KbLedU;
380 } KbLed;
381
382
383 /*! \brief Keyboard Modifier Key State. */
384 typedef struct KbMkey
385 {
386    union
387    {
388       uint32_t mkeys;
389       struct
390       {
391          uint32_t reserved         : 24;        /*!< \brief Reserved MSB */
392          uint32_t r_win            : 1; /*!< \brief Modifier Key Right WIN 0:OFF 1:ON Bit7 */
393          uint32_t r_alt            : 1; /*!< \brief Modifier Key Right ALT 0:OFF 1:ON Bit6 */
394          uint32_t r_shift               : 1;    /*!< \brief Modifier Key Right SHIFT 0:OFF 1:ON Bit5 */         
395          uint32_t r_ctrl                : 1;    /*!< \brief Modifier Key Right CTRL 0:OFF 1:ON Bit4 */
396          uint32_t l_win            : 1; /*!< \brief Modifier Key Left WIN 0:OFF 1:ON Bit3 */
397          uint32_t l_alt            : 1; /*!< \brief Modifier Key Left ALT 0:OFF 1:ON Bit2 */
398          uint32_t l_shift               : 1;    /*!< \brief Modifier Key Left SHIFT 0:OFF 1:ON Bit1 */
399          uint32_t l_ctrl                : 1;    /*!< \brief Modifier Key Left CTRL 0:OFF 1:ON Bit0 LSB */
400          /* For Macintosh Keyboard ALT & WIN correspond respectively to OPTION & APPLE keys */
401       }_KbMkeyS;
402    }_KbMkeyU;
403 } KbMkey;
404
405 /*! \brief Keyboard input data data structure. */
406 typedef struct KbData
407 {
408         KbLed led;                                      /*!< \brief Keyboard Led State */
409         KbMkey mkey;                            /*!< \brief Keyboard Modifier Key State */
410         int32_t  nb_keycode;                            /*!< \brief Number of key codes (0 equal no data) */
411         uint16_t keycode[MAX_KEYCODES]; /*!< \brief Keycode values */
412 } KbData;
413 #endif
414
415 /*============================================================
416         OSK PROTOTYPES
417 ============================================================ */
418
419 #ifdef __PSL1GHT__
420 #include <sysutil/osk.h>
421 /* define all the OSK functions */
422 #define pOskLoadAsync oskLoadAsync
423 #define pOskSetLayoutMode oskSetLayoutMode
424 #define pOskSetKeyLayoutOption oskSetKeyLayoutOption
425 #define pOskGetSize oskGetSize
426 #define pOskDisableDimmer oskDisableDimmer
427 #define pOskAbort oskAbort
428 #define pOskUnloadAsync oskUnloadAsync
429
430 /* define OSK structs / types */
431 #define sys_memory_container_t sys_mem_container_t
432 #define CellOskDialogPoint oskPoint
433 #define CellOskDialogInputFieldInfo oskInputFieldInfo
434 #define CellOskDialogCallbackReturnParam oskCallbackReturnParam
435 #define CellOskDialogParam oskParam
436
437 #define osk_allowed_panels allowedPanels
438 #define osk_prohibit_flags prohibitFlags
439
440 #define osk_inputfield_message message
441 #define osk_inputfield_starttext startText
442 #define osk_inputfield_max_length maxLength
443 #define osk_callback_return_param res
444 #define osk_callback_num_chars len
445 #define osk_callback_return_string str
446
447 /* define the OSK defines */
448 #define CELL_OSKDIALOG_10KEY_PANEL OSK_10KEY_PANEL
449 #define CELL_OSKDIALOG_FULLKEY_PANEL OSK_FULLKEY_PANEL
450 #define CELL_OSKDIALOG_LAYOUTMODE_X_ALIGN_CENTER OSK_LAYOUTMODE_HORIZONTAL_ALIGN_CENTER
451 #define CELL_OSKDIALOG_LAYOUTMODE_Y_ALIGN_TOP OSK_LAYOUTMODE_VERTICAL_ALIGN_TOP
452 #define CELL_OSKDIALOG_PANELMODE_NUMERAL OSK_PANEL_TYPE_NUMERAL
453 #define CELL_OSKDIALOG_PANELMODE_NUMERAL_FULL_WIDTH OSK_PANEL_TYPE_NUMERAL_FULL_WIDTH
454 #define CELL_OSKDIALOG_PANELMODE_ALPHABET OSK_PANEL_TYPE_ALPHABET
455 #define CELL_OSKDIALOG_PANELMODE_ENGLISH OSK_PANEL_TYPE_ENGLISH
456 #define CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK (0)
457 #define CELL_OSKDIALOG_INPUT_FIELD_RESULT_CANCELED (1)
458 #define CELL_OSKDIALOG_INPUT_FIELD_RESULT_ABORT (2)
459 #define CELL_OSKDIALOG_INPUT_FIELD_RESULT_NO_INPUT_TEXT (3)
460 #define CELL_OSKDIALOG_STRING_SIZE (512)
461 #else
462 #include <sysutil/sysutil_oskdialog.h>
463 /* define all the OSK functions */
464 #define pOskLoadAsync cellOskDialogLoadAsync
465 #define pOskSetLayoutMode cellOskDialogSetLayoutMode
466 #define pOskSetKeyLayoutOption cellOskDialogSetKeyLayoutOption
467 #define pOskGetSize cellOskDialogGetSize
468 #define pOskDisableDimmer cellOskDialogDisableDimmer
469 #define pOskAbort cellOskDialogAbort
470 #define pOskUnloadAsync cellOskDialogUnloadAsync
471
472 /* define OSK structs / types */
473 #define osk_allowed_panels allowOskPanelFlg
474 #define osk_prohibit_flags prohibitFlgs
475 #define osk_inputfield_message message
476 #define osk_inputfield_starttext init_text
477 #define osk_inputfield_max_length limit_length
478 #define osk_callback_return_param result
479 #define osk_callback_num_chars numCharsResultString
480 #define osk_callback_return_string pResultString
481 #endif
482
483 /*============================================================
484         JPEG/PNG DECODING/ENCODING PROTOTYPES
485 ============================================================ */
486
487 #ifdef __PSL1GHT__
488
489 #define spu_enable enable
490 #define stream_select stream
491 #define color_alpha alpha
492 #define color_space space
493 #define output_mode mode
494 #define output_bytes_per_line bytes_per_line
495 #define output_width width
496 #define output_height height
497
498 #define CELL_OK 0
499 #define PTR_NULL 0
500
501 #else
502 /* define the JPEG/PNG struct member names */
503 #define spu_enable spuThreadEnable
504 #define ppu_prio ppuThreadPriority
505 #define spu_prio spuThreadPriority
506 #define malloc_func cbCtrlMallocFunc
507 #define malloc_arg cbCtrlMallocArg
508 #define free_func cbCtrlFreeFunc
509 #define free_arg cbCtrlFreeArg
510 #define stream_select srcSelect
511 #define file_name fileName
512 #define file_offset fileOffset
513 #define file_size fileSize
514 #define stream_ptr streamPtr
515 #define stream_size streamSize
516 #define down_scale downScale
517 #define color_alpha outputColorAlpha
518 #define color_space outputColorSpace
519 #define cmd_ptr commandPtr
520 #define quality method
521 #define output_mode outputMode
522 #define output_bytes_per_line outputBytesPerLine
523 #define output_width outputWidth
524 #define output_height outputHeight
525 #define bit_depth outputBitDepth
526 #define pack_flag outputPackFlag
527 #define alpha_select outputAlphaSelect
528
529 #define PTR_NULL NULL
530
531 #endif
532
533 /*============================================================
534         TIMER PROTOTYPES
535 ============================================================ */
536
537 #ifdef __PSL1GHT__
538 #define sys_timer_usleep usleep
539 #endif
540
541 /*============================================================
542         THREADING PROTOTYPES
543 ============================================================ */
544
545 #ifdef __PSL1GHT__
546 #include <sys/thread.h>
547
548 /* FIXME - not sure if this is correct -> FIXED! 1 and not 0 */
549 #define SYS_THREAD_CREATE_JOINABLE THREAD_JOINABLE
550
551 #else
552 #include <sys/ppu_thread.h>
553
554 #define SYS_PROCESS_SPAWN_STACK_SIZE_1M SYS_PROCESS_PRIMARY_STACK_SIZE_1M 
555 #define SYS_THREAD_CREATE_JOINABLE SYS_PPU_THREAD_CREATE_JOINABLE
556
557 #define sysThreadCreate sys_ppu_thread_create 
558 #define sysThreadJoin sys_ppu_thread_join 
559 #define sysThreadExit sys_ppu_thread_exit 
560
561 #define sysProcessExit sys_process_exit 
562 #define sysProcessExitSpawn2 sys_game_process_exitspawn 
563
564 #endif
565
566 /*============================================================
567         MEMORY PROTOTYPES
568 ============================================================ */
569
570 #ifndef __PSL1GHT__
571 #define sysMemContainerCreate sys_memory_container_create 
572 #define sysMemContainerDestroy sys_memory_container_destroy 
573 #endif
574
575 /*============================================================
576         RSX PROTOTYPES
577 ============================================================ */
578
579 #ifdef __PSL1GHT__
580 #include <sysutil/video.h>
581 #define CELL_GCM_FALSE GCM_FALSE
582 #define CELL_GCM_TRUE GCM_TRUE
583
584 #define CELL_GCM_ONE GCM_ONE
585 #define CELL_GCM_ZERO GCM_ZERO
586 #define CELL_GCM_ALWAYS GCM_ALWAYS
587
588 #define CELL_GCM_LOCATION_LOCAL GCM_LOCATION_RSX
589 #define CELL_GCM_LOCATION_MAIN GCM_LOCATION_CELL
590
591 #define CELL_GCM_MAX_RT_DIMENSION (4096)
592
593 #define CELL_GCM_TEXTURE_LINEAR_NEAREST GCM_TEXTURE_LINEAR_MIPMAP_NEAREST
594 #define CELL_GCM_TEXTURE_LINEAR_LINEAR GCM_TEXTURE_LINEAR_MIPMAP_LINEAR
595 #define CELL_GCM_TEXTURE_NEAREST_LINEAR GCM_TEXTURE_NEAREST_MIPMAP_LINEAR
596 #define CELL_GCM_TEXTURE_NEAREST_NEAREST GCM_TEXTURE_NEAREST_MIPMAP_NEAREST
597 #define CELL_GCM_TEXTURE_NEAREST GCM_TEXTURE_NEAREST
598 #define CELL_GCM_TEXTURE_LINEAR GCM_TEXTURE_LINEAR
599
600 #define CELL_GCM_TEXTURE_A8R8G8B8 GCM_TEXTURE_FORMAT_A8R8G8B8
601 #define CELL_GCM_TEXTURE_R5G6B5 GCM_TEXTURE_FORMAT_R5G6B5
602 #define CELL_GCM_TEXTURE_A1R5G5B5 GCM_TEXTURE_FORMAT_A1R5G5B5
603
604 #define CELL_GCM_TEXTURE_CLAMP_TO_EDGE GCM_TEXTURE_CLAMP_TO_EDGE
605
606 #define CELL_GCM_TEXTURE_MAX_ANISO_1 GCM_TEXTURE_MAX_ANISO_1
607 #define CELL_GCM_TEXTURE_CONVOLUTION_QUINCUNX GCM_TEXTURE_CONVOLUTION_QUINCUNX
608 #define CELL_GCM_TEXTURE_ZFUNC_NEVER GCM_TEXTURE_ZFUNC_NEVER
609
610 #define CELL_GCM_DISPLAY_HSYNC GCM_FLIP_HSYNC
611 #define CELL_GCM_DISPLAY_VSYNC GCM_FLIP_VSYNC
612
613 #define CELL_GCM_CLEAR_R GCM_CLEAR_R
614 #define CELL_GCM_CLEAR_G GCM_CLEAR_G
615 #define CELL_GCM_CLEAR_B GCM_CLEAR_B
616 #define CELL_GCM_CLEAR_A GCM_CLEAR_A
617
618 #define CELL_GCM_FUNC_ADD GCM_FUNC_ADD
619
620 #define CELL_GCM_SMOOTH (0x1D01)
621 #define CELL_GCM_DEBUG_LEVEL2 2
622
623 #define CELL_GCM_COMPMODE_DISABLED 0
624
625 #define CELL_GCM_TRANSFER_LOCAL_TO_LOCAL 0
626
627 #define CELL_GCM_TEXTURE_REMAP_ORDER_XYXY (0)
628 #define CELL_GCM_TEXTURE_REMAP_ORDER_XXXY (1)
629
630 #define CELL_GCM_TEXTURE_UNSIGNED_REMAP_NORMAL (0)
631
632 #define CELL_GCM_TEXTURE_REMAP_FROM_A (0)
633 #define CELL_GCM_TEXTURE_REMAP_FROM_R (1)
634 #define CELL_GCM_TEXTURE_REMAP_FROM_G (2)
635 #define CELL_GCM_TEXTURE_REMAP_FROM_B (3)
636
637 #define CELL_GCM_TEXTURE_REMAP_ZERO (0)
638 #define CELL_GCM_TEXTURE_REMAP_ONE (1)
639 #define CELL_GCM_TEXTURE_REMAP_REMAP (2)
640
641 #define CELL_GCM_MAX_TEXIMAGE_COUNT (16)
642
643 #define CELL_GCM_TEXTURE_WRAP (1)
644
645 #define CELL_GCM_TEXTURE_NR (0x00)
646 #define CELL_GCM_TEXTURE_LN (0x20)
647
648 #define CELL_GCM_TEXTURE_B8 (0x81)
649
650 #define CELL_RESC_720x480 RESC_720x480
651 #define CELL_RESC_720x576 RESC_720x576
652 #define CELL_RESC_1280x720 RESC_1280x720
653 #define CELL_RESC_1920x1080 RESC_1920x1080
654
655 #define CELL_RESC_FULLSCREEN RESC_FULLSCREEN
656 #define CELL_RESC_PANSCAN RESC_PANSCAN
657 #define CELL_RESC_LETTERBOX RESC_LETTERBOX
658 #define CELL_RESC_CONSTANT_VRAM RESC_CONSTANT_VRAM
659 #define CELL_RESC_MINIMUM_GPU_LOAD RESC_MINIMUM_GPU_LOAD
660
661 #define CELL_RESC_PAL_50 RESC_PAL_50
662 #define CELL_RESC_PAL_60_DROP RESC_PAL_60_DROP
663 #define CELL_RESC_PAL_60_INTERPOLATE RESC_PAL_60_INTERPOLATE
664 #define CELL_RESC_PAL_60_INTERPOLATE_30_DROP RESC_PAL_60_INTERPOLATE_30_DROP
665 #define CELL_RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE RESC_PAL_60_INTERPOLATE_DROP_FLEXIBLE
666
667 #define CELL_RESC_INTERLACE_FILTER RESC_INTERLACE_FILTER
668 #define CELL_RESC_NORMAL_BILINEAR RESC_NORMAL_BILINEAR
669
670 #define CELL_RESC_ELEMENT_HALF RESC_ELEMENT_HALF
671
672 #define CELL_VIDEO_OUT_ASPECT_AUTO VIDEO_ASPECT_AUTO
673 #define CELL_VIDEO_OUT_ASPECT_4_3 VIDEO_ASPECT_4_3
674 #define CELL_VIDEO_OUT_ASPECT_16_9 VIDEO_ASPECT_16_9
675
676 #define CELL_VIDEO_OUT_RESOLUTION_480 VIDEO_RESOLUTION_480
677 #define CELL_VIDEO_OUT_RESOLUTION_576 VIDEO_RESOLUTION_576
678 #define CELL_VIDEO_OUT_RESOLUTION_720 VIDEO_RESOLUTION_720
679 #define CELL_VIDEO_OUT_RESOLUTION_1080 VIDEO_RESOLUTION_1080
680 #define CELL_VIDEO_OUT_RESOLUTION_960x1080 VIDEO_RESOLUTION_960x1080
681 #define CELL_VIDEO_OUT_RESOLUTION_1280x1080 VIDEO_RESOLUTION_1280x1080
682 #define CELL_VIDEO_OUT_RESOLUTION_1440x1080 VIDEO_RESOLUTION_1440x1080
683 #define CELL_VIDEO_OUT_RESOLUTION_1600x1080 VIDEO_RESOLUTION_1600x1080
684
685 #define CELL_VIDEO_OUT_SCAN_MODE_PROGRESSIVE VIDEO_SCANMODE_PROGRESSIVE
686
687 #define CELL_VIDEO_OUT_PRIMARY VIDEO_PRIMARY
688
689 #define CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_X8R8G8B8 VIDEO_BUFFER_FORMAT_XRGB
690 #define CELL_VIDEO_OUT_BUFFER_COLOR_FORMAT_R16G16B16X16_FLOAT VIDEO_BUFFER_FORMAT_FLOAT
691
692 #define CellGcmSurface gcmSurface
693 #define CellGcmTexture gcmTexture
694 #define CellGcmContextData _gcmCtxData
695 #define CellGcmConfig gcmConfiguration
696 #define CellVideoOutConfiguration videoConfiguration
697 #define CellVideoOutResolution videoResolution
698 #define CellVideoOutState videoState
699
700 #define CellRescInitConfig rescInitConfig
701 #define CellRescSrc rescSrc
702 #define CellRescBufferMode rescBufferMode
703
704 #define resolutionId resolution
705 #define memoryFrequency memoryFreq
706 #define coreFrequency coreFreq
707
708 #define cellGcmFinish rsxFinish
709
710 #define cellGcmGetFlipStatus gcmGetFlipStatus
711 #define cellGcmResetFlipStatus gcmResetFlipStatus
712 #define cellGcmSetWaitFlip gcmSetWaitFlip
713 #define cellGcmSetDebugOutputLevel gcmSetDebugOutputLevel
714 #define cellGcmSetDisplayBuffer gcmSetDisplayBuffer
715 #define cellGcmSetGraphicsHandler gcmSetGraphicsHandler
716 #define cellGcmSetFlipHandler gcmSetFlipHandler
717 #define cellGcmSetVBlankHandler gcmSetVBlankHandler
718 #define cellGcmGetConfiguration gcmGetConfiguration
719 #define cellGcmSetJumpCommand rsxSetJumpCommand
720 #define cellGcmFlush rsxFlushBuffer
721 #define cellGcmSetFlipMode gcmSetFlipMode
722 #define cellGcmSetFlip gcmSetFlip
723 #define cellGcmGetLabelAddress gcmGetLabelAddress
724 #define cellGcmUnbindTile gcmUnbindTile
725 #define cellGcmBindTile gcmBindTile
726 #define cellGcmSetTileInfo gcmSetTileInfo
727 #define cellGcmAddressToOffset gcmAddressToOffset
728
729 #define cellRescCreateInterlaceTable rescCreateInterlaceTable
730 #define cellRescSetDisplayMode rescSetDisplayMode
731 #define cellRescGetNumColorBuffers rescGetNumColorBuffers
732 #define cellRescGetBufferSize rescGetBufferSize
733 #define cellRescSetBufferAddress rescSetBufferAddress
734 #define cellRescGetFlipStatus rescGetFlipStatus
735 #define cellRescResetFlipStatus rescResetFlipStatus
736 #define cellRescSetConvertAndFlip rescSetConvertAndFlip
737 #define cellRescSetVBlankHandler rescSetVBlankHandler
738 #define cellRescSetFlipHandler rescSetFlipHandler
739 #define cellRescAdjustAspectRatio rescAdjustAspectRatio
740 #define cellRescSetWaitFlip rescSetWaitFlip
741 #define cellRescSetSrc rescSetSrc
742 #define cellRescInit rescInit
743 #define cellRescExit rescExit
744
745 #define cellVideoOutConfigure videoConfigure
746 #define cellVideoOutGetState videoGetState
747 #define cellVideoOutGetResolution videoGetResolution
748 #define cellVideoOutGetResolutionAvailability videoGetResolutionAvailability
749
750 #define cellGcmSetViewportInline rsxSetViewport
751 #define cellGcmSetReferenceCommandInline rsxSetReferenceCommand
752 #define cellGcmSetBlendEquationInline rsxSetBlendEquation
753 #define cellGcmSetWriteBackEndLabelInline rsxSetWriteBackendLabel
754 #define cellGcmSetWaitLabelInline rsxSetWaitLabel
755 #define cellGcmSetDepthTestEnableInline rsxSetDepthTestEnable
756 #define cellGcmSetScissorInline rsxSetScissor
757 #define cellGcmSetBlendEnableInline rsxSetBlendEnable
758 #define cellGcmSetClearColorInline rsxSetClearColor
759 #define cellGcmSetBlendFuncInline rsxSetBlendFunc
760 #define cellGcmSetBlendColorInline rsxSetBlendColor
761 #define cellGcmSetTextureFilterInline rsxTextureFilter
762 #define cellGcmSetTextureControlInline rsxTextureControl
763 #define cellGcmSetCullFaceEnableInline rsxSetCullFaceEnable
764 #define cellGcmSetShadeModeInline rsxSetShadeModel
765 #define cellGcmSetTransferImage rsxSetTransferImage
766 #define cellGcmSetBlendColor rsxSetBlendColor
767 #define cellGcmSetBlendEquation rsxSetBlendEquation
768 #define cellGcmSetBlendFunc rsxSetBlendFunc
769 #define cellGcmSetClearColor rsxSetClearColor
770 #define cellGcmSetScissor rsxSetScissor
771 #define celGcmSetInvalidateVertexCache(fifo) rsxInvalidateTextureCache(fifo, GCM_INVALIDATE_VERTEX_TEXTURE)
772 #else
773 #define cellGcmSetTransferImage cellGcmSetTransferImageInline
774 #define celGcmSetInvalidateVertexCache cellGcmSetInvalidateVertexCacheInline
775 #define rsxInit cellGcmInit
776 #define rsxInvalidateTextureCache(a, b) cellGcmSetInvalidateVertexCache(a)
777 #define rsxTextureControl cellGcmSetTextureControlInline
778 #define rsxSetBlendEnable cellGcmSetBlendEnableInline 
779 #endif
780
781 /*============================================================
782         NETWORK PROTOTYPES
783 ============================================================ */
784
785 #ifdef __PSL1GHT__
786 #include <net/netctl.h>
787
788 #define cellNetCtlInit netCtlInit
789 #define cellNetCtlGetState netCtlGetState
790 #define cellNetCtlTerm netCtlTerm
791
792 #define CELL_NET_CTL_STATE_IPObtained NET_CTL_STATE_IPObtained
793 #else
794 #define netCtlInit cellNetCtlInit
795 #define netCtlGetState cellNetCtlGetState
796 #define netCtlTerm cellNetCtlTerm
797 #define NET_CTL_STATE_IPObtained CELL_NET_CTL_STATE_IPObtained
798 #endif
799
800 /*============================================================
801         NET PROTOTYPES
802 ============================================================ */
803
804 #if defined(HAVE_NETWORKING)
805 #ifdef __PSL1GHT__
806 #include <net/net.h>
807
808 #define socketselect select
809 #define socketclose close
810
811 #define sys_net_initialize_network netInitialize
812 #define sys_net_finalize_network netFinalizeNetwork
813 #else
814 #include <netex/net.h>
815 #include <np.h>
816 #include <np/drm.h>
817
818 #define netInitialize sys_net_initialize_network
819 #define netFinalizeNetwork sys_net_finalize_network
820 #endif
821 #endif
822
823 /*============================================================
824         SYSUTIL PROTOTYPES
825 ============================================================ */
826
827 #ifdef __PSL1GHT__
828 #include <sysutil/game.h>
829 #define CellGameContentSize sysGameContentSize
830 #define cellGameContentPermit sysGameContentPermit
831 #define cellGameBootCheck sysGameBootCheck
832
833 #define CELL_GAME_ATTRIBUTE_APP_HOME   (UINT64_C(1) <<1) /* boot from / app_home/PS3_GAME */
834 #define CELL_GAME_DIRNAME_SIZE                  32
835
836 #define CELL_GAME_GAMETYPE_SYS          0
837 #define CELL_GAME_GAMETYPE_DISC         1
838 #define CELL_GAME_GAMETYPE_HDD          2
839 #define CELL_GAME_GAMETYPE_GAMEDATA     3
840 #define CELL_GAME_GAMETYPE_HOME         4
841
842 #endif
843
844 #if defined(HAVE_SYSUTILS)
845 #ifdef __PSL1GHT__
846 #include <sysutil/sysutil.h>
847
848 #define CELL_SYSUTIL_REQUEST_EXITGAME SYSUTIL_EXIT_GAME
849
850 #define cellSysutilRegisterCallback sysUtilRegisterCallback
851 #define cellSysutilCheckCallback sysUtilCheckCallback
852 #else
853 #include <sysutil/sysutil_screenshot.h>
854 #include <sysutil/sysutil_common.h>
855 #include <sysutil/sysutil_gamecontent.h>
856 #endif
857 #endif
858
859 #if(CELL_SDK_VERSION > 0x340000)
860 #include <sysutil/sysutil_bgmplayback.h>
861 #endif
862
863 /*============================================================
864         SYSMODULE PROTOTYPES
865 ============================================================ */
866
867 #if defined(HAVE_SYSMODULES)
868 #ifdef __PSL1GHT__
869 #include <sysmodule/sysmodule.h>
870
871 #define CELL_SYSMODULE_IO SYSMODULE_IO
872 #define CELL_SYSMODULE_FS SYSMODULE_FS
873 #define CELL_SYSMODULE_NET SYSMODULE_NET
874 #define CELL_SYSMODULE_SYSUTIL_NP SYSMODULE_SYSUTIL_NP
875 #define CELL_SYSMODULE_JPGDEC SYSMODULE_JPGDEC
876 #define CELL_SYSMODULE_PNGDEC SYSMODULE_PNGDEC
877 #define CELL_SYSMODULE_FONT SYSMODULE_FONT
878 #define CELL_SYSMODULE_FREETYPE SYSMODULE_FREETYPE
879 #define CELL_SYSMODULE_FONTFT SYSMODULE_FONTFT
880
881 #define cellSysmoduleLoadModule sysModuleLoad
882 #define cellSysmoduleUnloadModule sysModuleUnload
883
884 #else
885 #include <cell/sysmodule.h>
886
887 #define sysModuleLoad cellSysmoduleLoadModule
888 #define sysModuleUnload cellSysmoduleUnloadModule
889 #define SYSMODULE_NET CELL_SYSMODULE_NET
890 #endif
891 #endif
892
893 /*============================================================
894         FS PROTOTYPES
895 ============================================================ */
896 #define FS_SUCCEEDED 0
897 #define FS_TYPE_DIR 1
898 #ifdef __PSL1GHT__
899 #include <lv2/sysfs.h>
900 #ifndef O_RDONLY
901 #define O_RDONLY SYS_O_RDONLY
902 #endif
903 #ifndef O_WRONLY
904 #define O_WRONLY SYS_O_WRONLY
905 #endif
906 #ifndef O_CREAT
907 #define O_CREAT SYS_O_CREAT
908 #endif
909 #ifndef O_TRUNC
910 #define O_TRUNC SYS_O_TRUNC
911 #endif
912 #ifndef O_RDWR
913 #define O_RDWR SYS_O_RDWR
914 #endif
915 #else
916 #include <cell/cell_fs.h>
917 #ifndef O_RDONLY
918 #define O_RDONLY CELL_FS_O_RDONLY
919 #endif
920 #ifndef O_WRONLY
921 #define O_WRONLY CELL_FS_O_WRONLY
922 #endif
923 #ifndef O_CREAT
924 #define O_CREAT CELL_FS_O_CREAT
925 #endif
926 #ifndef O_TRUNC
927 #define O_TRUNC CELL_FS_O_TRUNC
928 #endif
929 #ifndef O_RDWR
930 #define O_RDWR CELL_FS_O_RDWR
931 #endif
932 #ifndef sysFsStat
933 #define sysFsStat cellFsStat
934 #endif
935 #ifndef sysFSDirent
936 #define sysFSDirent CellFsDirent
937 #endif
938 #ifndef sysFsOpendir
939 #define sysFsOpendir cellFsOpendir
940 #endif
941 #ifndef sysFsReaddir
942 #define sysFsReaddir cellFsReaddir
943 #endif
944 #ifndef sysFSDirent
945 #define sysFSDirent CellFsDirent
946 #endif
947 #ifndef sysFsClosedir
948 #define sysFsClosedir cellFsClosedir
949 #endif
950 #endif
951
952 #endif