Add overclock and sprite limit options.

This commit is contained in:
Brandon Wright 2018-08-06 15:51:35 -05:00
parent 37f6259f06
commit cf5681ad32
5 changed files with 47 additions and 3 deletions

View File

@ -827,7 +827,7 @@ static void SetupOBJ (void)
for (int i = 0; i < SNES_HEIGHT_EXTENDED; i++)
{
GFX.OBJLines[i].RTOFlags = 0;
GFX.OBJLines[i].Tiles = 34;
GFX.OBJLines[i].Tiles = Settings.MaxSpriteTilesPerLine;
for (int j = 0; j < 32; j++)
GFX.OBJLines[i].OBJ[j].Sprite = -1;
}
@ -959,7 +959,7 @@ static void SetupOBJ (void)
for (int Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++)
{
GFX.OBJLines[Y].RTOFlags = Y ? GFX.OBJLines[Y - 1].RTOFlags : 0;
GFX.OBJLines[Y].Tiles = 34;
GFX.OBJLines[Y].Tiles = Settings.MaxSpriteTilesPerLine;
uint8 FirstSprite = (PPU.FirstSprite + Y) & 0x7f;
S = FirstSprite;

View File

@ -479,7 +479,7 @@ else
endif
CXXFLAGS += $(CODE_DEFINES) $(WARNINGS_DEFINES) $(fpic)
CXXFLAGS += -DRIGHTSHIFT_IS_SAR -D__LIBRETRO__
CXXFLAGS += -DRIGHTSHIFT_IS_SAR -D__LIBRETRO__ -DALLOW_CPU_OVERCLOCK
CFLAGS = $(CXXFLAGS)
ifeq (,$(findstring msvc,$(platform)))

View File

@ -168,6 +168,8 @@ void retro_set_environment(retro_environment_t cb)
// Adding more variables and rearranging them is safe.
{ "snes9x_up_down_allowed", "Allow Opposing Directions; disabled|enabled" },
{ "snes9x_overclock_superfx", "SuperFX Overclocking; 100%|150%|200%|250%|300%|350%|400%|450%|500%|50%" },
{ "snes9x_overclock_cycles", "Reduce Slowdown (Hack, Unsafe); disabled|compatible|max" },
{ "snes9x_reduce_sprite_flicker", "Reduce Flickering (Hack, Unsafe); disabled|enabled" },
{ "snes9x_hires_blend", "Hires Blending; disabled|enabled" },
{ "snes9x_audio_interpolation", "Audio Interpolation; gaussian|cubic|sinc|none|linear" },
{ "snes9x_layer_1", "Show layer 1; enabled|disabled" },
@ -332,6 +334,36 @@ static void update_variables(void)
else
Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN;
Settings.OneClockCycle = 6;
Settings.OneSlowClockCycle = 8;
Settings.TwoClockCycles = 12;
var.key="snes9x_overclock_cycles";
var.value=NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "max") == 0)
{
Settings.OneClockCycle = 3;
Settings.OneSlowClockCycle = 3;
Settings.TwoClockCycles = 3;
}
else if (strcmp(var.value, "compatible"))
{
Settings.OneClockCycle = 4;
Settings.OneSlowClockCycle = 5;
Settings.TwoClockCycles = 6;
}
}
Settings.MaxSpriteTilesPerLine = 34;
var.key="snes9x_overclock_cycles";
var.value=NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
if (strcmp(var.value, "enabled") == 0)
Settings.MaxSpriteTilesPerLine = 60;
var.key = "snes9x_overscan";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)

View File

@ -497,6 +497,7 @@ void S9xLoadConfigFiles (char **argv, int argc)
Settings.DisableGameSpecificHacks = !conf.GetBool("Hack::EnableGameSpecificHacks", true);
Settings.BlockInvalidVRAMAccessMaster = !conf.GetBool("Hack::AllowInvalidVRAMAccess", false);
Settings.HDMATimingHack = conf.GetInt ("Hack::HDMATiming", 100);
Settings.MaxSpriteTilesPerLine = conf.GetInt ("Hack::MaxSpriteTilesPerLine", 34);
// Netplay

View File

@ -254,9 +254,15 @@
#define SNES_MAX_PAL_VCOUNTER 312
#define SNES_HCOUNTER_MAX 341
#ifndef ALLOW_CPU_OVERCLOCK
#define ONE_CYCLE 6
#define SLOW_ONE_CYCLE 8
#define TWO_CYCLES 12
#else
#define ONE_CYCLE (Settings.OneClockCycle)
#define SLOW_ONE_CYCLE (Settings.OneSlowClockCycle)
#define TWO_CYCLES (Settings.TwoClockCycles)
#endif
#define ONE_DOT_CYCLE 4
#define SNES_CYCLES_PER_SCANLINE (SNES_HCOUNTER_MAX * ONE_DOT_CYCLE)
@ -480,7 +486,12 @@ struct SSettings
bool8 UpAndDown;
bool8 OpenGLEnable;
uint32 SuperFXClockMultiplier;
int OneClockCycle;
int OneSlowClockCycle;
int TwoClockCycles;
int MaxSpriteTilesPerLine;
};
struct SSNESGameFixes