mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +01:00
Add option to remove per-line sprite limits
This commit is contained in:
parent
603a532be2
commit
e0ef0902e9
@ -43,6 +43,14 @@
|
|||||||
#include "md_ntsc.h"
|
#include "md_ntsc.h"
|
||||||
#include "sms_ntsc.h"
|
#include "sms_ntsc.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_NO_SPRITE_LIMIT
|
||||||
|
#define MAX_SPRITES_PER_LINE 20
|
||||||
|
#define TMS_MAX_SPRITES_PER_LINE 4
|
||||||
|
#define MODE4_MAX_SPRITES_PER_LINE 8
|
||||||
|
#define MODE5_MAX_SPRITES_PER_LINE (bitmap.viewport.w >> 4)
|
||||||
|
#define MODE5_MAX_SPRITE_PIXELS max_sprite_pixels
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** NTSC Filters ***/
|
/*** NTSC Filters ***/
|
||||||
extern md_ntsc_t *md_ntsc;
|
extern md_ntsc_t *md_ntsc;
|
||||||
extern sms_ntsc_t *sms_ntsc;
|
extern sms_ntsc_t *sms_ntsc;
|
||||||
@ -584,7 +592,7 @@ typedef struct
|
|||||||
uint16 size;
|
uint16 size;
|
||||||
} object_info_t;
|
} object_info_t;
|
||||||
|
|
||||||
static object_info_t obj_info[2][20];
|
static object_info_t obj_info[2][MAX_SPRITES_PER_LINE];
|
||||||
|
|
||||||
/* Sprite Counter */
|
/* Sprite Counter */
|
||||||
static uint8 object_count[2];
|
static uint8 object_count[2];
|
||||||
@ -3149,6 +3157,7 @@ void render_obj_m5(int line)
|
|||||||
int xpos, width;
|
int xpos, width;
|
||||||
int pixelcount = 0;
|
int pixelcount = 0;
|
||||||
int masked = 0;
|
int masked = 0;
|
||||||
|
int max_pixels = MODE5_MAX_SPRITE_PIXELS;
|
||||||
|
|
||||||
uint8 *src, *s, *lb;
|
uint8 *src, *s, *lb;
|
||||||
uint32 temp, v_line;
|
uint32 temp, v_line;
|
||||||
@ -3213,10 +3222,10 @@ void render_obj_m5(int line)
|
|||||||
lb = &linebuf[0][0x20 + xpos];
|
lb = &linebuf[0][0x20 + xpos];
|
||||||
|
|
||||||
/* Max. number of sprite pixels rendered per line */
|
/* Max. number of sprite pixels rendered per line */
|
||||||
if (pixelcount > max_sprite_pixels)
|
if (pixelcount > max_pixels)
|
||||||
{
|
{
|
||||||
/* Adjust number of pixels to draw */
|
/* Adjust number of pixels to draw */
|
||||||
width -= (pixelcount - max_sprite_pixels);
|
width -= (pixelcount - max_pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of tiles to draw */
|
/* Number of tiles to draw */
|
||||||
@ -3235,7 +3244,7 @@ void render_obj_m5(int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sprite limit */
|
/* Sprite limit */
|
||||||
if (pixelcount >= max_sprite_pixels)
|
if (pixelcount >= max_pixels)
|
||||||
{
|
{
|
||||||
/* Sprite masking is effective on next line if max pixel width is reached */
|
/* Sprite masking is effective on next line if max pixel width is reached */
|
||||||
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
||||||
@ -3258,6 +3267,7 @@ void render_obj_m5_ste(int line)
|
|||||||
int xpos, width;
|
int xpos, width;
|
||||||
int pixelcount = 0;
|
int pixelcount = 0;
|
||||||
int masked = 0;
|
int masked = 0;
|
||||||
|
int max_pixels = MODE5_MAX_SPRITE_PIXELS;
|
||||||
|
|
||||||
uint8 *src, *s, *lb;
|
uint8 *src, *s, *lb;
|
||||||
uint32 temp, v_line;
|
uint32 temp, v_line;
|
||||||
@ -3325,9 +3335,9 @@ void render_obj_m5_ste(int line)
|
|||||||
lb = &linebuf[1][0x20 + xpos];
|
lb = &linebuf[1][0x20 + xpos];
|
||||||
|
|
||||||
/* Adjust number of pixels to draw for sprite limit */
|
/* Adjust number of pixels to draw for sprite limit */
|
||||||
if (pixelcount > max_sprite_pixels)
|
if (pixelcount > max_pixels)
|
||||||
{
|
{
|
||||||
width -= (pixelcount - max_sprite_pixels);
|
width -= (pixelcount - max_pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of tiles to draw */
|
/* Number of tiles to draw */
|
||||||
@ -3346,7 +3356,7 @@ void render_obj_m5_ste(int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sprite limit */
|
/* Sprite limit */
|
||||||
if (pixelcount >= max_sprite_pixels)
|
if (pixelcount >= max_pixels)
|
||||||
{
|
{
|
||||||
/* Sprite masking is effective on next line if max pixel width is reached */
|
/* Sprite masking is effective on next line if max pixel width is reached */
|
||||||
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
||||||
@ -3376,6 +3386,7 @@ void render_obj_m5_im2(int line)
|
|||||||
int pixelcount = 0;
|
int pixelcount = 0;
|
||||||
int masked = 0;
|
int masked = 0;
|
||||||
int odd = odd_frame;
|
int odd = odd_frame;
|
||||||
|
int max_pixels = MODE5_MAX_SPRITE_PIXELS;
|
||||||
|
|
||||||
uint8 *src, *s, *lb;
|
uint8 *src, *s, *lb;
|
||||||
uint32 temp, v_line;
|
uint32 temp, v_line;
|
||||||
@ -3440,9 +3451,9 @@ void render_obj_m5_im2(int line)
|
|||||||
lb = &linebuf[0][0x20 + xpos];
|
lb = &linebuf[0][0x20 + xpos];
|
||||||
|
|
||||||
/* Adjust width for sprite limit */
|
/* Adjust width for sprite limit */
|
||||||
if (pixelcount > max_sprite_pixels)
|
if (pixelcount > max_pixels)
|
||||||
{
|
{
|
||||||
width -= (pixelcount - max_sprite_pixels);
|
width -= (pixelcount - max_pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of tiles to draw */
|
/* Number of tiles to draw */
|
||||||
@ -3461,7 +3472,7 @@ void render_obj_m5_im2(int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sprite Limit */
|
/* Sprite Limit */
|
||||||
if (pixelcount >= max_sprite_pixels)
|
if (pixelcount >= max_pixels)
|
||||||
{
|
{
|
||||||
/* Sprite masking is effective on next line if max pixel width is reached */
|
/* Sprite masking is effective on next line if max pixel width is reached */
|
||||||
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
||||||
@ -3485,6 +3496,7 @@ void render_obj_m5_im2_ste(int line)
|
|||||||
int pixelcount = 0;
|
int pixelcount = 0;
|
||||||
int masked = 0;
|
int masked = 0;
|
||||||
int odd = odd_frame;
|
int odd = odd_frame;
|
||||||
|
int max_pixels = MODE5_MAX_SPRITE_PIXELS;
|
||||||
|
|
||||||
uint8 *src, *s, *lb;
|
uint8 *src, *s, *lb;
|
||||||
uint32 temp, v_line;
|
uint32 temp, v_line;
|
||||||
@ -3552,9 +3564,9 @@ void render_obj_m5_im2_ste(int line)
|
|||||||
lb = &linebuf[1][0x20 + xpos];
|
lb = &linebuf[1][0x20 + xpos];
|
||||||
|
|
||||||
/* Adjust width for sprite limit */
|
/* Adjust width for sprite limit */
|
||||||
if (pixelcount > max_sprite_pixels)
|
if (pixelcount > max_pixels)
|
||||||
{
|
{
|
||||||
width -= (pixelcount - max_sprite_pixels);
|
width -= (pixelcount - max_pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of tiles to draw */
|
/* Number of tiles to draw */
|
||||||
@ -3573,7 +3585,7 @@ void render_obj_m5_im2_ste(int line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sprite Limit */
|
/* Sprite Limit */
|
||||||
if (pixelcount >= max_sprite_pixels)
|
if (pixelcount >= max_pixels)
|
||||||
{
|
{
|
||||||
/* Sprite masking is effective on next line if max pixel width is reached */
|
/* Sprite masking is effective on next line if max pixel width is reached */
|
||||||
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
spr_ovr = (pixelcount >= bitmap.viewport.w);
|
||||||
@ -3654,7 +3666,7 @@ void parse_satb_tms(int line)
|
|||||||
if ((ypos >= 0) && (ypos < height))
|
if ((ypos >= 0) && (ypos < height))
|
||||||
{
|
{
|
||||||
/* Sprite overflow */
|
/* Sprite overflow */
|
||||||
if (count == 4)
|
if (count == TMS_MAX_SPRITES_PER_LINE)
|
||||||
{
|
{
|
||||||
/* Flag is set only during active area */
|
/* Flag is set only during active area */
|
||||||
if (line < bitmap.viewport.h)
|
if (line < bitmap.viewport.h)
|
||||||
@ -3750,7 +3762,7 @@ void parse_satb_m4(int line)
|
|||||||
if ((ypos >= 0) && (ypos < height))
|
if ((ypos >= 0) && (ypos < height))
|
||||||
{
|
{
|
||||||
/* Sprite overflow */
|
/* Sprite overflow */
|
||||||
if (count == 8)
|
if (count == MODE4_MAX_SPRITES_PER_LINE)
|
||||||
{
|
{
|
||||||
/* Flag is set only during active area */
|
/* Flag is set only during active area */
|
||||||
if ((line >= 0) && (line < bitmap.viewport.h))
|
if ((line >= 0) && (line < bitmap.viewport.h))
|
||||||
@ -3796,7 +3808,7 @@ void parse_satb_m5(int line)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
/* max. number of rendered sprites (16 or 20 sprites per line by default) */
|
/* max. number of rendered sprites (16 or 20 sprites per line by default) */
|
||||||
int max = bitmap.viewport.w >> 4;
|
int max = MODE5_MAX_SPRITES_PER_LINE;
|
||||||
|
|
||||||
/* max. number of parsed sprites (64 or 80 sprites per line by default) */
|
/* max. number of parsed sprites (64 or 80 sprites per line by default) */
|
||||||
int total = max_sprite_pixels >> 2;
|
int total = max_sprite_pixels >> 2;
|
||||||
|
@ -543,6 +543,7 @@ static void config_default(void)
|
|||||||
#ifdef HAVE_OVERCLOCK
|
#ifdef HAVE_OVERCLOCK
|
||||||
config.overclock = 0;
|
config.overclock = 0;
|
||||||
#endif
|
#endif
|
||||||
|
config.no_sprite_limit = 0;
|
||||||
|
|
||||||
/* video options */
|
/* video options */
|
||||||
config.overscan = 0;
|
config.overscan = 0;
|
||||||
@ -1271,6 +1272,15 @@ static void check_variables(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
var.key = "genesis_plus_gx_no_sprite_limit";
|
||||||
|
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
|
||||||
|
{
|
||||||
|
if (strcmp(var.value, "disabled") == 0)
|
||||||
|
config.no_sprite_limit = 0;
|
||||||
|
else
|
||||||
|
config.no_sprite_limit = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (reinit)
|
if (reinit)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OVERCLOCK
|
#ifdef HAVE_OVERCLOCK
|
||||||
@ -1718,6 +1728,7 @@ void retro_set_environment(retro_environment_t cb)
|
|||||||
#ifdef HAVE_OVERCLOCK
|
#ifdef HAVE_OVERCLOCK
|
||||||
{ "genesis_plus_gx_overclock", "CPU speed; 100%|125%|150%|175%|200%" },
|
{ "genesis_plus_gx_overclock", "CPU speed; 100%|125%|150%|175%|200%" },
|
||||||
#endif
|
#endif
|
||||||
|
{ "genesis_plus_gx_no_sprite_limit", "Remove per-line sprite limit; disabled|enabled" },
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,6 +76,13 @@ typedef unsigned char bool;
|
|||||||
|
|
||||||
#define HAVE_YM3438_CORE
|
#define HAVE_YM3438_CORE
|
||||||
|
|
||||||
|
#define HAVE_NO_SPRITE_LIMIT
|
||||||
|
#define MAX_SPRITES_PER_LINE 80
|
||||||
|
#define TMS_MAX_SPRITES_PER_LINE (config.no_sprite_limit ? MAX_SPRITES_PER_LINE : 4)
|
||||||
|
#define MODE4_MAX_SPRITES_PER_LINE (config.no_sprite_limit ? MAX_SPRITES_PER_LINE : 8)
|
||||||
|
#define MODE5_MAX_SPRITES_PER_LINE (config.no_sprite_limit ? MAX_SPRITES_PER_LINE : (bitmap.viewport.w >> 4))
|
||||||
|
#define MODE5_MAX_SPRITE_PIXELS (config.no_sprite_limit ? MAX_SPRITES_PER_LINE * 32 : max_sprite_pixels)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int8 device;
|
int8 device;
|
||||||
@ -121,6 +128,7 @@ struct
|
|||||||
uint8 invert_mouse;
|
uint8 invert_mouse;
|
||||||
uint8 gun_cursor;
|
uint8 gun_cursor;
|
||||||
uint32 overclock;
|
uint32 overclock;
|
||||||
|
uint8 no_sprite_limit;
|
||||||
} config;
|
} config;
|
||||||
|
|
||||||
extern char GG_ROM[256];
|
extern char GG_ROM[256];
|
||||||
|
Loading…
Reference in New Issue
Block a user