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