RetroArch
psp_defines.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
3  * Copyright (C) 2011-2017 - Daniel De Matteis
4  *
5  * RetroArch is free software: you can redistribute it and/or modify it under the terms
6  * of the GNU General Public License as published by the Free Software Found-
7  * ation, either version 3 of the License, or (at your option) any later version.
8  *
9  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with RetroArch.
14  * If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef _PSP_DEFINES_H
18 #define _PSP_DEFINES_H
19 
20 /*============================================================
21  ERROR PROTOTYPES
22 ============================================================ */
23 
24 #ifndef SCE_OK
25 #define SCE_OK 0
26 #endif
27 
28 /*============================================================
29  DISPLAY PROTOTYPES
30 ============================================================ */
31 
32 #if defined(SN_TARGET_PSP2) || defined(VITA)
33 
34 #ifdef VITA
35 int sceClibPrintf ( const char * format, ... );
36 #define printf sceClibPrintf
37 #define PSP_DISPLAY_PIXEL_FORMAT_8888 (SCE_DISPLAY_PIXELFORMAT_A8B8G8R8)
38 #else
39 #define PSP_DISPLAY_PIXEL_FORMAT_8888 (SCE_DISPLAY_PIXELFORMAT_A8B8G8R8)
40 #endif
41 
42 #define DisplaySetFrameBuf(topaddr, bufferwidth, pixelformat, sync) sceDisplaySetFrameBuf(topaddr, sync)
43 
44 #define PSP_FB_WIDTH 960
45 #define PSP_FB_HEIGHT 544
46 #define PSP_PITCH_PIXELS 1024
47 
48 #elif defined(PSP)
49 #define DisplaySetFrameBuf(topaddr, bufferwidth, pixelformat, sync) sceDisplaySetFrameBuf(topaddr, bufferwidth, pixelformat, sync)
50 
51 #define SCE_DISPLAY_UPDATETIMING_NEXTVSYNC 1
52 
53 #define PSP_FB_WIDTH 512
54 #define PSP_FB_HEIGHT 512
55 #define PSP_PITCH_PIXELS 512
56 
57 #endif
58 
59 /*============================================================
60  INPUT PROTOTYPES
61 ============================================================ */
62 
63 #if defined(SN_TARGET_PSP2) || defined(VITA)
64 
65 #define STATE_BUTTON(state) ((state).buttons)
66 #define STATE_ANALOGLX(state) ((state).lx)
67 #define STATE_ANALOGLY(state) ((state).ly)
68 #define STATE_ANALOGRX(state) ((state).rx)
69 #define STATE_ANALOGRY(state) ((state).ry)
70 
71 #if defined(VITA)
72 #define DEFAULT_SAMPLING_MODE (SCE_CTRL_MODE_ANALOG)
73 
74 #define PSP_CTRL_LEFT SCE_CTRL_LEFT
75 #define PSP_CTRL_DOWN SCE_CTRL_DOWN
76 #define PSP_CTRL_RIGHT SCE_CTRL_RIGHT
77 #define PSP_CTRL_UP SCE_CTRL_UP
78 #define PSP_CTRL_START SCE_CTRL_START
79 #define PSP_CTRL_SELECT SCE_CTRL_SELECT
80 #define PSP_CTRL_TRIANGLE SCE_CTRL_TRIANGLE
81 #define PSP_CTRL_SQUARE SCE_CTRL_SQUARE
82 #define PSP_CTRL_CROSS SCE_CTRL_CROSS
83 #define PSP_CTRL_CIRCLE SCE_CTRL_CIRCLE
84 #define PSP_CTRL_L SCE_CTRL_L1
85 #define PSP_CTRL_R SCE_CTRL_R1
86 #define PSP_CTRL_L2 SCE_CTRL_LTRIGGER
87 #define PSP_CTRL_R2 SCE_CTRL_RTRIGGER
88 #define PSP_CTRL_L3 SCE_CTRL_L3
89 #define PSP_CTRL_R3 SCE_CTRL_R3
90 #else
91 #define DEFAULT_SAMPLING_MODE (SCE_CTRL_MODE_DIGITALANALOG)
92 
93 #define PSP_CTRL_LEFT SCE_CTRL_LEFT
94 #define PSP_CTRL_DOWN SCE_CTRL_DOWN
95 #define PSP_CTRL_RIGHT SCE_CTRL_RIGHT
96 #define PSP_CTRL_UP SCE_CTRL_UP
97 #define PSP_CTRL_START SCE_CTRL_START
98 #define PSP_CTRL_SELECT SCE_CTRL_SELECT
99 #define PSP_CTRL_TRIANGLE SCE_CTRL_TRIANGLE
100 #define PSP_CTRL_SQUARE SCE_CTRL_SQUARE
101 #define PSP_CTRL_CROSS SCE_CTRL_CROSS
102 #define PSP_CTRL_CIRCLE SCE_CTRL_CIRCLE
103 #define PSP_CTRL_L SCE_CTRL_L
104 #define PSP_CTRL_R SCE_CTRL_R
105 #endif
106 
107 #if defined(VITA)
108 #define CtrlSetSamplingMode(mode) sceCtrlSetSamplingModeExt(mode)
109 #define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositiveExt2(port, pad_data, bufs)
110 #else
111 #define CtrlSetSamplingMode(mode) sceCtrlSetSamplingMode(mode)
112 #define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositive(port, pad_data, bufs)
113 #endif
114 
115 #elif defined(PSP)
116 
117 #define PSP_CTRL_L PSP_CTRL_LTRIGGER
118 #define PSP_CTRL_R PSP_CTRL_RTRIGGER
119 
120 #define STATE_BUTTON(state) ((state).Buttons)
121 #define STATE_ANALOGLX(state) ((state).Lx)
122 #define STATE_ANALOGLY(state) ((state).Ly)
123 #define STATE_ANALOGRX(state) ((state).Rx)
124 #define STATE_ANALOGRY(state) ((state).Ry)
125 
126 #define DEFAULT_SAMPLING_MODE (PSP_CTRL_MODE_ANALOG)
127 
128 #define CtrlSetSamplingMode(mode) sceCtrlSetSamplingMode(mode)
129 #define CtrlPeekBufferPositive(port, pad_data, bufs) sceCtrlPeekBufferPositive(pad_data, bufs)
130 #endif
131 
132 #endif
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293