2016-04-08 15:03:52 +00:00
|
|
|
#ifndef __RSX_INTF_H__
|
|
|
|
#define __RSX_INTF_H__
|
|
|
|
|
|
|
|
#include "libretro.h"
|
2016-04-10 02:26:12 +00:00
|
|
|
|
2017-10-17 05:19:21 +00:00
|
|
|
#define SOUND_FREQUENCY 44100
|
2020-02-14 20:03:12 +00:00
|
|
|
|
2020-03-08 03:33:32 +00:00
|
|
|
/* NTSC content on NTSC clock, PAL content on PAL clock. */
|
2020-02-14 20:03:12 +00:00
|
|
|
#define FPS_NTSC_INTERLACED 59.940
|
|
|
|
#define FPS_NTSC_NONINTERLACED 59.826
|
|
|
|
#define FPS_PAL_INTERLACED 50.000
|
|
|
|
#define FPS_PAL_NONINTERLACED 49.761
|
2017-10-17 05:19:21 +00:00
|
|
|
|
2020-03-08 03:33:32 +00:00
|
|
|
/* Note: It is possible for the PlayStation GPU to output NTSC
|
|
|
|
* on PAL GPU clock and vice versa, but this is unsupported in
|
|
|
|
* Mednafen/Beetle PSX. The values below are provided for
|
|
|
|
* completion but are not guaranteed to be correct.
|
|
|
|
*/
|
|
|
|
#if 0
|
|
|
|
#define FPS_NTSC_ON_PAL_INTERLACED 59.393
|
|
|
|
#define FPS_NTSC_ON_PAL_NONINTERLACED 59.280
|
|
|
|
#define FPS_PAL_ON_NTSC_INTERLACED 50.460
|
|
|
|
#define FPS_PAL_ON_NTSC_NONINTERLACED 50.219
|
|
|
|
#endif
|
|
|
|
|
2016-04-08 15:03:52 +00:00
|
|
|
enum rsx_renderer_type
|
|
|
|
{
|
|
|
|
RSX_SOFTWARE = 0,
|
|
|
|
RSX_OPENGL,
|
2017-07-29 17:51:06 +00:00
|
|
|
RSX_VULKAN
|
2016-04-08 15:03:52 +00:00
|
|
|
};
|
|
|
|
|
2020-02-15 05:59:08 +00:00
|
|
|
enum force_renderer_type
|
|
|
|
{
|
|
|
|
AUTO = 0,
|
|
|
|
FORCE_OPENGL,
|
|
|
|
FORCE_VULKAN
|
|
|
|
};
|
|
|
|
|
2016-04-16 12:27:47 +00:00
|
|
|
enum blending_modes
|
|
|
|
{
|
2017-10-17 05:19:21 +00:00
|
|
|
BLEND_MODE_OPAQUE = -1,
|
|
|
|
BLEND_MODE_AVERAGE = 0,
|
|
|
|
BLEND_MODE_ADD = 1,
|
|
|
|
BLEND_MODE_SUBTRACT = 2,
|
|
|
|
BLEND_MODE_ADD_FOURTH = 3
|
2016-04-16 12:27:47 +00:00
|
|
|
};
|
|
|
|
|
2019-11-02 14:20:00 +00:00
|
|
|
enum width_modes
|
|
|
|
{
|
2019-11-15 14:51:10 +00:00
|
|
|
WIDTH_MODE_256 = 0,
|
|
|
|
WIDTH_MODE_320,
|
|
|
|
WIDTH_MODE_512,
|
|
|
|
WIDTH_MODE_640,
|
|
|
|
WIDTH_MODE_368
|
2019-11-02 14:20:00 +00:00
|
|
|
};
|
|
|
|
|
2020-02-27 03:05:15 +00:00
|
|
|
enum height_modes
|
|
|
|
{
|
|
|
|
HEIGHT_MODE_240 = 0,
|
|
|
|
HEIGHT_MODE_480
|
|
|
|
};
|
|
|
|
|
2017-07-29 00:36:19 +00:00
|
|
|
void rsx_intf_set_environment(retro_environment_t cb);
|
|
|
|
void rsx_intf_set_video_refresh(retro_video_refresh_t cb);
|
|
|
|
void rsx_intf_get_system_av_info(struct retro_system_av_info *info);
|
|
|
|
|
2019-06-16 20:00:13 +00:00
|
|
|
bool rsx_intf_open(bool is_pal, bool force_software);
|
2017-07-29 00:36:19 +00:00
|
|
|
void rsx_intf_close(void);
|
|
|
|
void rsx_intf_refresh_variables(void);
|
|
|
|
void rsx_intf_prepare_frame(void);
|
2019-12-13 02:41:29 +00:00
|
|
|
void rsx_intf_finalize_frame(const void *fb, unsigned width,
|
2017-10-17 05:19:21 +00:00
|
|
|
unsigned height, unsigned pitch);
|
2017-07-29 00:36:19 +00:00
|
|
|
|
|
|
|
void rsx_intf_set_tex_window(uint8_t tww, uint8_t twh,
|
2017-10-17 05:19:21 +00:00
|
|
|
uint8_t twx, uint8_t twy);
|
2017-07-29 00:36:19 +00:00
|
|
|
|
|
|
|
void rsx_intf_set_mask_setting(uint32_t mask_set_or, uint32_t mask_eval_and);
|
|
|
|
void rsx_intf_set_draw_offset(int16_t x, int16_t y);
|
|
|
|
void rsx_intf_set_draw_area(uint16_t x0, uint16_t y0,
|
2017-10-17 05:19:21 +00:00
|
|
|
uint16_t x1, uint16_t y1);
|
2020-02-15 01:10:53 +00:00
|
|
|
void rsx_intf_set_vram_framebuffer_coords(uint32_t xstart, uint32_t ystart);
|
2019-11-02 14:20:00 +00:00
|
|
|
void rsx_intf_set_horizontal_display_range(uint16_t x1, uint16_t x2);
|
|
|
|
void rsx_intf_set_vertical_display_range(uint16_t y1, uint16_t y2);
|
2020-02-24 07:42:04 +00:00
|
|
|
void rsx_intf_set_display_mode(bool depth_24bpp,
|
2019-10-18 21:03:45 +00:00
|
|
|
bool is_pal,
|
2019-11-02 14:20:00 +00:00
|
|
|
bool is_480i,
|
|
|
|
int width_mode); //enum
|
2017-07-29 00:36:19 +00:00
|
|
|
|
|
|
|
void rsx_intf_push_triangle(float p0x, float p0y, float p0w,
|
|
|
|
float p1x, float p1y, float p1w,
|
|
|
|
float p2x, float p2y, float p2w,
|
2017-10-17 05:19:21 +00:00
|
|
|
uint32_t c0, uint32_t c1, uint32_t c2,
|
2017-07-29 00:36:19 +00:00
|
|
|
uint16_t t0x, uint16_t t0y,
|
|
|
|
uint16_t t1x, uint16_t t1y,
|
2019-12-13 02:41:29 +00:00
|
|
|
uint16_t t2x, uint16_t t2y,
|
2019-11-15 14:51:10 +00:00
|
|
|
uint16_t min_u, uint16_t min_v,
|
|
|
|
uint16_t max_u, uint16_t max_v,
|
2017-07-29 00:36:19 +00:00
|
|
|
uint16_t texpage_x, uint16_t texpage_y,
|
|
|
|
uint16_t clut_x, uint16_t clut_y,
|
|
|
|
uint8_t texture_blend_mode,
|
|
|
|
uint8_t depth_shift,
|
|
|
|
bool dither,
|
2019-11-15 14:51:10 +00:00
|
|
|
/* This is really an `enum blending_modes`
|
|
|
|
* but I don't want to deal with enums in the
|
|
|
|
* FFI */
|
2017-07-29 00:36:19 +00:00
|
|
|
int blend_mode,
|
|
|
|
uint32_t mask_test,
|
|
|
|
uint32_t set_mask);
|
|
|
|
|
|
|
|
void rsx_intf_push_quad(float p0x, float p0y, float p0w,
|
|
|
|
float p1x, float p1y, float p1w,
|
|
|
|
float p2x, float p2y, float p2w,
|
|
|
|
float p3x, float p3y, float p3w,
|
|
|
|
uint32_t c0,
|
|
|
|
uint32_t c1,
|
|
|
|
uint32_t c2,
|
|
|
|
uint32_t c3,
|
|
|
|
uint16_t t0x, uint16_t t0y,
|
|
|
|
uint16_t t1x, uint16_t t1y,
|
|
|
|
uint16_t t2x, uint16_t t2y,
|
|
|
|
uint16_t t3x, uint16_t t3y,
|
2019-11-15 14:51:10 +00:00
|
|
|
uint16_t min_u, uint16_t min_v,
|
|
|
|
uint16_t max_u, uint16_t max_v,
|
2017-07-29 00:36:19 +00:00
|
|
|
uint16_t texpage_x, uint16_t texpage_y,
|
|
|
|
uint16_t clut_x, uint16_t clut_y,
|
|
|
|
uint8_t texture_blend_mode,
|
|
|
|
uint8_t depth_shift,
|
|
|
|
bool dither,
|
|
|
|
int blend_mode,
|
|
|
|
uint32_t mask_test,
|
|
|
|
uint32_t set_mask);
|
|
|
|
|
|
|
|
void rsx_intf_push_line(int16_t p0x, int16_t p0y,
|
|
|
|
int16_t p1x, int16_t p1y,
|
|
|
|
uint32_t c0,
|
|
|
|
uint32_t c1,
|
|
|
|
bool dither,
|
2017-10-17 05:19:21 +00:00
|
|
|
/* This is really an `enum blending_modes`
|
|
|
|
* but I don't want to deal with enums in the FFI */
|
2017-07-29 00:36:19 +00:00
|
|
|
int blend_mode,
|
|
|
|
uint32_t mask_test,
|
|
|
|
uint32_t set_mask);
|
|
|
|
|
2019-11-15 14:51:10 +00:00
|
|
|
void rsx_intf_load_image(uint16_t x, uint16_t y,
|
|
|
|
uint16_t w, uint16_t h,
|
|
|
|
uint16_t *vram,
|
|
|
|
uint32_t mask_test,
|
|
|
|
uint32_t set_mask);
|
2017-07-29 00:36:19 +00:00
|
|
|
|
2018-12-14 15:24:50 +00:00
|
|
|
bool rsx_intf_read_vram(uint16_t x, uint16_t y,
|
|
|
|
uint16_t w, uint16_t h,
|
|
|
|
uint16_t *vram);
|
|
|
|
|
2017-07-29 00:36:19 +00:00
|
|
|
void rsx_intf_fill_rect(uint32_t color,
|
|
|
|
uint16_t x, uint16_t y,
|
|
|
|
uint16_t w, uint16_t h);
|
|
|
|
|
|
|
|
void rsx_intf_copy_rect(uint16_t src_x, uint16_t src_y,
|
|
|
|
uint16_t dst_x, uint16_t dst_y,
|
2017-10-17 05:19:21 +00:00
|
|
|
uint16_t w, uint16_t h,
|
|
|
|
uint32_t mask_test, uint32_t set_mask);
|
2017-07-29 00:36:19 +00:00
|
|
|
|
|
|
|
enum rsx_renderer_type rsx_intf_is_type(void);
|
|
|
|
|
|
|
|
void rsx_intf_toggle_display(bool status);
|
|
|
|
|
|
|
|
bool rsx_intf_has_software_renderer(void);
|
2016-06-01 06:10:21 +00:00
|
|
|
|
2020-03-01 07:53:26 +00:00
|
|
|
double rsx_common_get_timing_fps(void);
|
|
|
|
|
2020-02-27 03:05:15 +00:00
|
|
|
float rsx_common_get_aspect_ratio(bool pal_content, bool crop_overscan,
|
|
|
|
int first_visible_scanline, int last_visible_scanline,
|
|
|
|
int aspect_ratio_setting, bool vram_override, bool widescreen_override);
|
|
|
|
|
2020-02-15 01:10:53 +00:00
|
|
|
#endif /*__RSX_H__*/
|