RetroArch
ctr_common.h
Go to the documentation of this file.
1 /* RetroArch - A frontend for libretro.
2  * Copyright (C) 2014-2017 - Ali Bouahl
3  *
4  * RetroArch is free software: you can redistribute it and/or modify it under the terms
5  * of the GNU General Public License as published by the Free Software Found-
6  * ation, either version 3 of the License, or (at your option) any later version.
7  *
8  * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  * PURPOSE. See the GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along with RetroArch.
13  * If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef CTR_COMMON_H__
17 #define CTR_COMMON_H__
18 
19 #include <retro_inline.h>
20 
21 #define COLOR_ABGR(r, g, b, a) (((unsigned)(a) << 24) | ((b) << 16) | ((g) << 8) | ((r) << 0))
22 
23 #define CTR_TOP_FRAMEBUFFER_WIDTH 400
24 #define CTR_TOP_FRAMEBUFFER_HEIGHT 240
25 
26 extern const u8 ctr_sprite_shbin[];
27 extern const u32 ctr_sprite_shbin_size;
28 
29 typedef struct
30 {
31  float v;
32  float u;
33  float y;
34  float x;
36 
37 typedef struct
38 {
39  s16 x0, y0, x1, y1;
40  s16 u0, v0, u1, v1;
41 } ctr_vertex_t;
42 
43 typedef enum
44 {
50 
51 typedef struct ctr_video
52 {
53  struct
54  {
55  struct
56  {
57  void* left;
58  void* right;
59  }top;
60  }drawbuffers;
61  void* depthbuffer;
62 
63  struct
64  {
73  }menu;
74 
77  void* texture_linear;
78  void* texture_swizzled;
79  int texture_width;
80  int texture_height;
81 
84 
85  DVLB_s* dvlb;
86  shaderProgram_s shader;
87 
89 
90  bool rgb32;
91  bool vsync;
92  bool smooth;
95  unsigned rotation;
100 
102 
103  aptHookCookie lcd_aptHook;
106 
109  volatile bool vsync_event_pending;
110 
111  struct
112  {
115  int size;
116  }vertex_cache;
117 
118 } ctr_video_t;
119 
120 typedef struct ctr_texture
121 {
122  int width;
123  int height;
126 
128  void* data;
129 } ctr_texture_t;
130 
132  int viewport_width, int viewport_height,
133  int texture_width, int texture_height)
134 {
135  vec->x = -2.0 / viewport_width;
136  vec->y = -2.0 / viewport_height;
137  vec->u = 1.0 / texture_width;
138  vec->v = -1.0 / texture_height;
139 }
140 
141 
142 #endif // CTR_COMMON_H__
int texture_height
Definition: ctr_common.h:70
Definition: ctr_common.h:120
bool ppf_event_pending
Definition: ctr_common.h:108
const u8 ctr_sprite_shbin[]
shaderProgram_s shader
Definition: ctr_common.h:86
Definition: ctr_common.h:37
struct ctr_video::@171 menu
struct ctr_texture ctr_texture_t
#define INLINE
Definition: retro_inline.h:35
struct ctr_video::@170::@173 top
int active_height
Definition: ctr_common.h:125
void * texture_swizzled
Definition: ctr_common.h:68
video_viewport_t vp
Definition: ctr_common.h:88
bool should_resize
Definition: ctr_common.h:97
ctr_vertex_t * buffer
Definition: ctr_common.h:113
int active_width
Definition: ctr_common.h:124
void * left
Definition: ctr_common.h:57
bool lcd_buttom_on
Definition: ctr_common.h:98
Definition: civetweb.c:1019
int height
Definition: ctr_common.h:123
uint32_t * display_list
Definition: ctr_common.h:65
bool vsync
Definition: ctr_common.h:91
unsigned rotation
Definition: ctr_common.h:95
enum texture_filter_type type
Definition: ctr_common.h:127
Definition: ctr_common.h:48
float x
Definition: ctr_common.h:34
struct ctr_video::@172 vertex_cache
ctr_video_mode_enum
Definition: ctr_common.h:43
DVLB_s * dvlb
Definition: ctr_common.h:85
Definition: ctr_common.h:46
int display_list_size
Definition: ctr_common.h:66
ctr_scale_vector_t scale_vector
Definition: ctr_common.h:71
GLdouble u1
Definition: glext.h:9211
void * texture_linear
Definition: ctr_common.h:67
GLfloat v0
Definition: glext.h:6701
s16 y1
Definition: ctr_common.h:39
bool smooth
Definition: ctr_common.h:92
texture_filter_type
Definition: video_defines.h:24
struct ctr_video ctr_video_t
void * empty_framebuffer
Definition: ctr_common.h:101
ctr_vertex_t * current
Definition: ctr_common.h:114
static INLINE void ctr_set_scale_vector(ctr_scale_vector_t *vec, int viewport_width, int viewport_height, int texture_width, int texture_height)
Definition: ctr_common.h:131
bool rgb32
Definition: ctr_common.h:90
int texture_width
Definition: ctr_common.h:69
Definition: ctr_common.h:29
int16_t s16
16bit signed integer
Definition: gctypes.h:23
struct ctr_video::@170 drawbuffers
int width
Definition: ctr_common.h:122
aptHookCookie lcd_aptHook
Definition: ctr_common.h:103
void * depthbuffer
Definition: ctr_common.h:61
Definition: video_driver.h:686
bool keep_aspect
Definition: ctr_common.h:96
ctr_video_mode_enum video_mode
Definition: ctr_common.h:104
float u
Definition: ctr_common.h:32
const u32 ctr_sprite_shbin_size
void * data
Definition: ctr_common.h:128
Definition: ctr_common.h:45
void * right
Definition: ctr_common.h:58
float v
Definition: ctr_common.h:31
int size
Definition: ctr_common.h:115
Definition: ctr_common.h:47
bool menu_texture_frame_enable
Definition: ctr_common.h:94
bool p3d_event_pending
Definition: ctr_common.h:107
Definition: ctr_common.h:51
uint8_t u8
8bit unsigned integer
Definition: gctypes.h:17
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
int current_buffer_top
Definition: ctr_common.h:105
bool menu_texture_enable
Definition: ctr_common.h:93
float y
Definition: ctr_common.h:33
unsigned int uint32_t
Definition: stdint.h:126
s16 v1
Definition: ctr_common.h:40
ctr_vertex_t * frame_coords
Definition: ctr_common.h:72
volatile bool vsync_event_pending
Definition: ctr_common.h:109
bool msg_rendering_enabled
Definition: ctr_common.h:99