| 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 | int fskip_force; |
| 77 | int fskip_dirty; |
| 78 | unsigned int *gpu_frame_count; |
| 79 | unsigned int *gpu_hcnt; |
| 80 | unsigned int flip_cnt; // increment manually if not using pl_vout_flip |
| 81 | unsigned int only_16bpp; // platform is 16bpp-only |
| 82 | unsigned int thread_rendering; |
| 83 | struct { |
| 84 | int allow_interlace; // 0 off, 1 on, 2 guess |
| 85 | int enhancement_enable; |
| 86 | int enhancement_no_main; |
| 87 | int allow_dithering; |
| 88 | int enhancement_tex_adj; |
| 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 | |
| 124 | extern struct rearmed_cbs pl_rearmed_cbs; |
| 125 | |
| 126 | enum centering_type { C_AUTO = 0, C_INGAME, C_BORDERLESS, C_MANUAL }; |
| 127 | |
| 128 | enum gpu_plugin_caps { |
| 129 | GPU_CAP_OWNS_DISPLAY = (1 << 0), |
| 130 | GPU_CAP_SUPPORTS_2X = (1 << 1), |
| 131 | }; |
| 132 | |
| 133 | // platform hooks |
| 134 | extern void (*pl_plat_clear)(void); |
| 135 | extern void (*pl_plat_blit)(int doffs, const void *src, |
| 136 | int w, int h, int sstride, int bgr24); |
| 137 | extern 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__ */ |