GTK+: Add dangerous hacks.

This commit is contained in:
Brandon Wright 2018-08-11 19:19:04 -05:00
parent 67effe4b42
commit 0b75e2de9d
4 changed files with 110 additions and 3 deletions

View File

@ -159,6 +159,12 @@ AC_ARG_WITH(gtk2,
[],
[with_gtk2=no])
AC_ARG_ENABLE(dangerous-hacks,
[AS_HELP_STRING([--enable-dangerous-hacks],
[Allow dangerous hacks to be enabled.])],
[],
[enable_dangerous_hacks=no])
if test yes = "$with_debug" ; then
CFLAGS="$CFLAGS -g"
else
@ -386,6 +392,10 @@ if test yes = "$with_zlib"; then
], ,)
fi
if test yes = "$enable_dangerous_hacks"; then
CFLAGS="$CFLAGS -DALLOW_CPU_OVERCLOCK"
fi
dnl Check for functions
AC_CHECK_FUNC(mkstemp, [
CFLAGS="$CFLAGS -DHAVE_MKSTEMP"
@ -569,3 +579,7 @@ fi
if ! test yes = "$XBRZ"; then
echo "xBRZ filter compilation is disabled."
fi
if test yes = "$enable_dangerous_hacks"; then
echo "Dangerous hacks enabled."
fi

View File

@ -261,6 +261,12 @@ Snes9xConfig::load_defaults (void)
Settings.HDMATimingHack = 100;
Settings.SuperFXClockMultiplier = 100;
Settings.InitialSnapshotFilename[0] = '\0';
#ifdef ALLOW_CPU_OVERCLOCK
Settings.MaxSpriteTilesPerLine = 34;
Settings.OneClockCycle = 6;
Settings.OneSlowClockCycle = 8;
Settings.TwoClockCycles = 12;
#endif
#ifdef NETPLAY_SUPPORT
Settings.NetPlay = FALSE;
@ -425,6 +431,9 @@ Snes9xConfig::save_config_file (void)
xml_out_int (xml, "superfx_clock_multiplier", Settings.SuperFXClockMultiplier);
xml_out_int (xml, "upanddown", Settings.UpAndDown);
xml_out_int (xml, "remove_sprite_limit", Settings.MaxSpriteTilesPerLine == 34 ? 0 : 1);
xml_out_int (xml, "cpu_overclock", Settings.OneClockCycle == 6 ? 0 : 1);
xmlTextWriterEndElement (xml); /* preferences */
xmlTextWriterStartElement (xml, BAD_CAST "controls");
@ -923,6 +932,28 @@ Snes9xConfig::set_option (const char *name, const char *value)
{
Settings.InterpolationMethod = CLAMP (atoi (value), 0, 4);
}
else if (!strcasecmp (name, "remove_sprite_limit"))
{
if (atoi (value))
Settings.MaxSpriteTilesPerLine = 128;
else
Settings.MaxSpriteTilesPerLine = 34;
}
else if (!strcasecmp (name, "cpu_overclock"))
{
if (atoi (value))
{
Settings.OneClockCycle = 4;
Settings.OneSlowClockCycle = 5;
Settings.TwoClockCycles = 6;
}
else
{
Settings.OneClockCycle = 6;
Settings.OneSlowClockCycle = 8;
Settings.TwoClockCycles = 12;
}
}
else
{
fprintf (stderr, _("bad option name: %s\n"), name);

View File

@ -788,6 +788,14 @@ Snes9xPreferences::move_settings_to_dialog (void)
set_combo ("joypad_to_swap_with", 0);
#ifdef ALLOW_CPU_OVERCLOCK
gtk_widget_show (get_widget ("cpu_overclock"));
gtk_widget_show (get_widget ("remove_sprite_limit"));
set_check ("cpu_overclock", Settings.OneClockCycle != 6);
set_check ("remove_sprite_limit", Settings.MaxSpriteTilesPerLine != 34);
#endif
return;
}
@ -878,6 +886,30 @@ Snes9xPreferences::get_settings_from_dialog (void)
config->rewind_buffer_size = get_spin ("rewind_buffer_size");
config->rewind_granularity = get_spin ("rewind_granularity");
#ifdef ALLOW_CPU_OVERCLOCK
if (get_check ("cpu_overclock"))
{
Settings.OneClockCycle = 4;
Settings.OneSlowClockCycle = 5;
Settings.TwoClockCycles = 6;
}
else
{
Settings.OneClockCycle = 6;
Settings.OneSlowClockCycle = 8;
Settings.TwoClockCycles = 12;
}
if (get_check ("remove_sprite_limit"))
{
Settings.MaxSpriteTilesPerLine = 128;
}
else
{
Settings.MaxSpriteTilesPerLine = 34;
}
#endif
#ifdef USE_JOYSTICK
config->joystick_threshold = get_spin ("joystick_threshold");
#endif

View File

@ -4614,6 +4614,36 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cpu_overclock">
<property name="label" translatable="yes">Overclock S-CPU hack (dangerous)</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Reduce slowdown at severe accuracy cost</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="remove_sprite_limit">
<property name="label" translatable="yes">Remove sprite limit hack (dangerous)</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Will break games relying on proper behavior</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="superfx_multiplier_hbox">
<property name="visible">True</property>
@ -4653,7 +4683,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">5</property>
</packing>
</child>
<child>
@ -4695,7 +4725,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
<property name="position">6</property>
</packing>
</child>
<child>
@ -4737,7 +4767,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
<property name="position">7</property>
</packing>
</child>
</object>