update gpulib_thread_if
[pcsx_rearmed.git] / frontend / plugin_lib.h
... / ...
CommitLineData
1#ifndef __PLUGIN_LIB_H__
2#define __PLUGIN_LIB_H__
3
4#define THREAD_RENDERING_OFF 0
5#define THREAD_RENDERING_SYNC 1
6#define THREAD_RENDERING_ASYNC 2
7
8enum {
9 DKEY_SELECT = 0,
10 DKEY_L3,
11 DKEY_R3,
12 DKEY_START,
13 DKEY_UP,
14 DKEY_RIGHT,
15 DKEY_DOWN,
16 DKEY_LEFT,
17 DKEY_L2,
18 DKEY_R2,
19 DKEY_L1,
20 DKEY_R1,
21 DKEY_TRIANGLE,
22 DKEY_CIRCLE,
23 DKEY_CROSS,
24 DKEY_SQUARE,
25};
26extern int in_state_gun;
27extern int in_type[8];
28extern int multitap1;
29extern int multitap2;
30extern int in_analog_left[8][2];
31extern int in_analog_right[8][2];
32extern unsigned short in_keystate[8];
33extern int in_mouse[8][2];
34
35extern int in_adev[2], in_adev_axis[2][2];
36extern int in_adev_is_nublike[2];
37extern int in_enable_vibration;
38
39extern void *pl_vout_buf;
40
41extern int g_layer_x, g_layer_y;
42extern int g_layer_w, g_layer_h;
43
44void pl_start_watchdog(void);
45void *pl_prepare_screenshot(int *w, int *h, int *bpp);
46void pl_init(void);
47void pl_switch_dispmode(void);
48void pl_force_clear(void);
49
50void pl_timing_prepare(int is_pal);
51void pl_frame_limit(void);
52
53// for communication with gpulib
54struct rearmed_cbs {
55 void (*pl_get_layer_pos)(int *x, int *y, int *w, int *h);
56 int (*pl_vout_open)(void);
57 void (*pl_vout_set_mode)(int w, int h, int raw_w, int raw_h, int bpp);
58 void (*pl_vout_flip)(const void *vram, int stride, int bgr24,
59 int x, int y, int w, int h, int dims_changed);
60 void (*pl_vout_close)(void);
61 void *(*mmap)(unsigned int size);
62 void (*munmap)(void *ptr, unsigned int size);
63 // only used by some frontends
64 void (*pl_vout_set_raw_vram)(void *vram);
65 void (*pl_set_gpu_caps)(int caps);
66 // emulation related
67 void (*gpu_state_change)(int what);
68 // some stats, for display by some plugins
69 int flips_per_sec, cpu_usage;
70 float vsps_cur; // currect vsync/s
71 // these are for gles plugin
72 unsigned int screen_w, screen_h;
73 void *gles_display, *gles_surface;
74 // gpu options
75 int frameskip;
76 int fskip_advice;
77 int fskip_force;
78 int fskip_dirty;
79 unsigned int *gpu_frame_count;
80 unsigned int *gpu_hcnt;
81 unsigned int flip_cnt; // increment manually if not using pl_vout_flip
82 unsigned int only_16bpp; // platform is 16bpp-only
83 unsigned int thread_rendering;
84 struct {
85 int allow_interlace; // 0 off, 1 on, 2 guess
86 int enhancement_enable;
87 int enhancement_no_main;
88 int allow_dithering;
89 } gpu_neon;
90 struct {
91 int iUseDither;
92 int dwActFixes;
93 float fFrameRateHz;
94 int dwFrameRateTicks;
95 } gpu_peops;
96 struct {
97 int abe_hack;
98 int no_light, no_blend;
99 int lineskip;
100 } gpu_unai_old;
101 struct {
102 int ilace_force;
103 int pixel_skip;
104 int lighting;
105 int fast_lighting;
106 int blending;
107 int dithering;
108 int scale_hires;
109 } gpu_unai;
110 struct {
111 int dwActFixes;
112 int bDrawDither, iFilterType, iFrameTexType;
113 int iUseMask, bOpaquePass, bAdvancedBlend, bUseFastMdec;
114 int iVRamSize, iTexGarbageCollection;
115 } gpu_peopsgl;
116 // misc
117 int gpu_caps;
118 int screen_centering_type;
119 int screen_centering_type_default;
120 int screen_centering_x;
121 int screen_centering_y;
122};
123
124extern struct rearmed_cbs pl_rearmed_cbs;
125
126enum centering_type { C_AUTO = 0, C_INGAME, C_BORDERLESS, C_MANUAL };
127
128enum gpu_plugin_caps {
129 GPU_CAP_OWNS_DISPLAY = (1 << 0),
130 GPU_CAP_SUPPORTS_2X = (1 << 1),
131};
132
133// platform hooks
134extern void (*pl_plat_clear)(void);
135extern void (*pl_plat_blit)(int doffs, const void *src,
136 int w, int h, int sstride, int bgr24);
137extern void (*pl_plat_hud_print)(int x, int y, const char *str, int bpp);
138
139#ifndef ARRAY_SIZE
140#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
141#endif
142
143#endif /* __PLUGIN_LIB_H__ */