GPGX: add setting to disable per-line sprite limit
- resolves #3440 - includes manually cherry-picked e0ef0902e96bd9d71cb49c64505e755007e7452c
This commit is contained in:
parent
248e87b6d1
commit
589823d009
Binary file not shown.
|
@ -26,6 +26,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
bool ret = GPGXSettings.NeedsReboot(_settings, o);
|
bool ret = GPGXSettings.NeedsReboot(_settings, o);
|
||||||
_settings = o;
|
_settings = o;
|
||||||
Core.gpgx_set_draw_mask(_settings.GetDrawMask());
|
Core.gpgx_set_draw_mask(_settings.GetDrawMask());
|
||||||
|
Core.gpgx_set_sprite_limit_enabled(!_settings.NoSpriteLimit);
|
||||||
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
|
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,20 +183,32 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
set => _PadScreen320 = value;
|
set => _PadScreen320 = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DeepEqualsIgnore]
|
[DeepEqualsIgnore]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private bool _Backdrop;
|
private bool _Backdrop;
|
||||||
|
|
||||||
[DisplayName("Use custom backdrop color")]
|
[DisplayName("Use custom backdrop color")]
|
||||||
[Description("Filler when layers are off")]
|
[Description("Filler when layers are off")]
|
||||||
[DefaultValue((bool)false)]
|
[DefaultValue(false)]
|
||||||
public bool Backdrop
|
public bool Backdrop
|
||||||
{
|
{
|
||||||
get => _Backdrop;
|
get => _Backdrop;
|
||||||
set => _Backdrop = value;
|
set => _Backdrop = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DeepEqualsIgnore]
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool _noSpriteLimit;
|
||||||
|
|
||||||
|
[DisplayName("Remove Per-Line Sprite Limit")]
|
||||||
|
[Description("Removes the original sprite-per-scanline hardware limit")]
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool NoSpriteLimit
|
||||||
|
{
|
||||||
|
get => _noSpriteLimit;
|
||||||
|
set => _noSpriteLimit = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public GPGXSettings()
|
public GPGXSettings()
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
Core.gpgx_set_cdd_callback(cd_callback_handle);
|
Core.gpgx_set_cdd_callback(cd_callback_handle);
|
||||||
Core.gpgx_invalidate_pattern_cache();
|
Core.gpgx_invalidate_pattern_cache();
|
||||||
Core.gpgx_set_draw_mask(_settings.GetDrawMask());
|
Core.gpgx_set_draw_mask(_settings.GetDrawMask());
|
||||||
|
Core.gpgx_set_sprite_limit_enabled(!_settings.NoSpriteLimit);
|
||||||
UpdateVideo();
|
UpdateVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
[BizImport(CallingConvention.Cdecl)]
|
[BizImport(CallingConvention.Cdecl)]
|
||||||
public abstract void gpgx_set_draw_mask(DrawMask mask);
|
public abstract void gpgx_set_draw_mask(DrawMask mask);
|
||||||
|
[BizImport(CallingConvention.Cdecl)]
|
||||||
|
public abstract void gpgx_set_sprite_limit_enabled(bool enabled);
|
||||||
|
|
||||||
[BizImport(CallingConvention.Cdecl)]
|
[BizImport(CallingConvention.Cdecl)]
|
||||||
public abstract void gpgx_write_m68k_bus(uint addr, byte data);
|
public abstract void gpgx_write_m68k_bus(uint addr, byte data);
|
||||||
|
|
|
@ -2,7 +2,7 @@ CCFLAGS := -Icore -Iutil -Icore/m68k -Icore/z80 -Icore/input_hw \
|
||||||
-Icore/cart_hw -Icore/cart_hw/svp -Icore/sound -Icore/ntsc -Icore/cd_hw \
|
-Icore/cart_hw -Icore/cart_hw/svp -Icore/sound -Icore/ntsc -Icore/cd_hw \
|
||||||
-Wall -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast -Werror=implicit-function-declaration \
|
-Wall -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast -Werror=implicit-function-declaration \
|
||||||
-std=c99 -fomit-frame-pointer \
|
-std=c99 -fomit-frame-pointer \
|
||||||
-DLSB_FIRST -DUSE_32BPP_RENDERING -DINLINE=static\ __inline__
|
-DLSB_FIRST -DUSE_32BPP_RENDERING -DINLINE=static\ __inline__ -fcommon
|
||||||
|
|
||||||
LDFLAGS :=
|
LDFLAGS :=
|
||||||
|
|
||||||
|
|
|
@ -635,6 +635,11 @@ GPGX_EX void gpgx_set_draw_mask(int mask)
|
||||||
color_update_m5(0x00, *(uint16 *)&cram[border << 1]);
|
color_update_m5(0x00, *(uint16 *)&cram[border << 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GPGX_EX void gpgx_set_sprite_limit_enabled(int enabled)
|
||||||
|
{
|
||||||
|
config.no_sprite_limit = !enabled;
|
||||||
|
}
|
||||||
|
|
||||||
GPGX_EX void gpgx_invalidate_pattern_cache(void)
|
GPGX_EX void gpgx_invalidate_pattern_cache(void)
|
||||||
{
|
{
|
||||||
vdp_invalidate_full_cache();
|
vdp_invalidate_full_cache();
|
||||||
|
|
|
@ -595,7 +595,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];
|
||||||
|
@ -3212,6 +3212,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;
|
||||||
|
@ -3276,10 +3277,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 */
|
||||||
|
@ -3298,7 +3299,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);
|
||||||
|
@ -3321,6 +3322,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;
|
||||||
|
@ -3388,9 +3390,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 */
|
||||||
|
@ -3409,7 +3411,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);
|
||||||
|
@ -3439,6 +3441,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;
|
||||||
|
@ -3503,9 +3506,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 */
|
||||||
|
@ -3524,7 +3527,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);
|
||||||
|
@ -3548,6 +3551,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;
|
||||||
|
@ -3615,9 +3619,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 */
|
||||||
|
@ -3636,7 +3640,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);
|
||||||
|
@ -3717,7 +3721,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)
|
||||||
|
@ -3813,7 +3817,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))
|
||||||
|
@ -3859,7 +3863,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;
|
||||||
|
|
|
@ -27,14 +27,20 @@ typedef unsigned char bool;
|
||||||
#define M_PI 3.1415926535897932385
|
#define M_PI 3.1415926535897932385
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
#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
|
||||||
{
|
{
|
||||||
int8 device;
|
int8 device;
|
||||||
uint8 port;
|
uint8 port;
|
||||||
uint8 padtype;
|
uint8 padtype;
|
||||||
} t_input_config;
|
} t_input_config;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char version[16];
|
char version[16];
|
||||||
uint8 hq_fm;
|
uint8 hq_fm;
|
||||||
|
@ -64,6 +70,7 @@ struct
|
||||||
uint8 gg_extra;
|
uint8 gg_extra;
|
||||||
uint8 render;
|
uint8 render;
|
||||||
t_input_config input[MAX_INPUTS];
|
t_input_config input[MAX_INPUTS];
|
||||||
|
uint8 no_sprite_limit;
|
||||||
} config;
|
} config;
|
||||||
|
|
||||||
extern char GG_ROM[256];
|
extern char GG_ROM[256];
|
||||||
|
|
Loading…
Reference in New Issue