[Scummvm-git-logs] scummvm master -> ba1567f7d6461c46f139b54d925925a0b993f10e
spleen1981
noreply at scummvm.org
Sat Mar 25 15:29:01 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
737ff66cd3 LIBRETRO: rename speed hack option
ba1567f7d6 LIBRETRO: remove need to restart to enable settings
Commit: 737ff66cd354c7cd7851f68a42829c0379e7f170
https://github.com/scummvm/scummvm/commit/737ff66cd354c7cd7851f68a42829c0379e7f170
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2023-03-25T16:28:36+01:00
Commit Message:
LIBRETRO: rename speed hack option
Changed paths:
backends/platform/libretro/include/libretro-core-options-intl.h
backends/platform/libretro/include/libretro-core-options.h
backends/platform/libretro/src/libretro.cpp
diff --git a/backends/platform/libretro/include/libretro-core-options-intl.h b/backends/platform/libretro/include/libretro-core-options-intl.h
index 17eb258c04f..685b8522460 100644
--- a/backends/platform/libretro/include/libretro-core-options-intl.h
+++ b/backends/platform/libretro/include/libretro-core-options-intl.h
@@ -193,10 +193,10 @@ struct retro_core_option_v2_definition option_defs_it[] = {
NULL
},
{
- "scummvm_speed_hack",
- "Speed Hack (riavvio necessario)",
+ "scummvm_allow_timing_inaccuracies",
+ "Consenti inaccuratezze di timing (riavvio necessario)",
NULL,
- "Modalità che riduce significativamente le richeste di CPU consentendo lievi inaccuratezze di timing. Questo 'hack' è considerato 'sicuro' - non dovrebbe causare errori e la maggior parte delle inaccuratezze sono impercettibili. Rimane comunque un hack, e gli utenti con macchine di classe desktop dovrebbero lasciarlo disabilitato. Su hardware a basse prestazioni (vecchi device Android, computer su singola scheda), questo hack è essenziale per il funzionamento del core a velocità piena.",
+ "Consente inaccuratezze di timing che riducono significativamente le richeste di CPU. Anche se la maggior parte delle inaccuratezze sono impercettibili, in alcuni casi potrebbe introdurre problemi di sincronizzazione audio, quindi questa opzione andrebbe abilitata solo se il raggiungimento della piena velocità non è possibile in altro modo.",
NULL,
NULL,
{
diff --git a/backends/platform/libretro/include/libretro-core-options.h b/backends/platform/libretro/include/libretro-core-options.h
index eb7ed09d181..a0bdef60350 100644
--- a/backends/platform/libretro/include/libretro-core-options.h
+++ b/backends/platform/libretro/include/libretro-core-options.h
@@ -258,10 +258,10 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"0"
},
{
- "scummvm_speed_hack",
- "Speed Hack (Restart)",
+ "scummvm_allow_timing_inaccuracies",
+ "Allow Timing Inaccuracies (Restart)",
NULL,
- "Enables a speed hack that significantly reduces CPU requirements by allowing subtle timing inaccuracies. This hack is considered 'safe' - it should cause no errors, and most timing deviations are imperceptible. It remains a hack, though, and users of desktop-class machines are advised to keep it disabled. On low power hardware (weak Android devices, single board computers), this hack is essential for full speed operation of the core.",
+ "Allow timing inaccuracies that reduces CPU requirements. Though most timing deviations are imperceptible, in some cases it may introduce audio sync/timing issues, hence this option should be enabled only if full speed cannot be reached otherwise.",
NULL,
NULL,
{
@@ -269,7 +269,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
{"enabled", NULL},
{NULL, NULL},
},
-#if defined(ANDROID) || defined(DINGUX) || defined(_3DS)
+#if defined(DINGUX) || defined(_3DS)
"enabled"
#else
"disabled"
diff --git a/backends/platform/libretro/src/libretro.cpp b/backends/platform/libretro/src/libretro.cpp
index 3055f34b484..abea052f86c 100644
--- a/backends/platform/libretro/src/libretro.cpp
+++ b/backends/platform/libretro/src/libretro.cpp
@@ -176,7 +176,7 @@ static void update_variables(void) {
mouse_speed = (float)atof(var.value);
}
- var.key = "scummvm_speed_hack";
+ var.key = "scummvm_allow_timing_inaccuracies";
var.value = NULL;
speed_hack_is_enabled = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
Commit: ba1567f7d6461c46f139b54d925925a0b993f10e
https://github.com/scummvm/scummvm/commit/ba1567f7d6461c46f139b54d925925a0b993f10e
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2023-03-25T16:28:36+01:00
Commit Message:
LIBRETRO: remove need to restart to enable settings
Changed paths:
backends/platform/libretro/include/libretro-core-options-intl.h
backends/platform/libretro/include/libretro-core-options.h
backends/platform/libretro/include/os.h
backends/platform/libretro/src/libretro-os.cpp
backends/platform/libretro/src/libretro.cpp
diff --git a/backends/platform/libretro/include/libretro-core-options-intl.h b/backends/platform/libretro/include/libretro-core-options-intl.h
index 685b8522460..f49f0412369 100644
--- a/backends/platform/libretro/include/libretro-core-options-intl.h
+++ b/backends/platform/libretro/include/libretro-core-options-intl.h
@@ -194,7 +194,7 @@ struct retro_core_option_v2_definition option_defs_it[] = {
},
{
"scummvm_allow_timing_inaccuracies",
- "Consenti inaccuratezze di timing (riavvio necessario)",
+ "Consenti inaccuratezze di timing",
NULL,
"Consente inaccuratezze di timing che riducono significativamente le richeste di CPU. Anche se la maggior parte delle inaccuratezze sono impercettibili, in alcuni casi potrebbe introdurre problemi di sincronizzazione audio, quindi questa opzione andrebbe abilitata solo se il raggiungimento della piena velocità non è possibile in altro modo.",
NULL,
diff --git a/backends/platform/libretro/include/libretro-core-options.h b/backends/platform/libretro/include/libretro-core-options.h
index a0bdef60350..177c44c9bd5 100644
--- a/backends/platform/libretro/include/libretro-core-options.h
+++ b/backends/platform/libretro/include/libretro-core-options.h
@@ -259,7 +259,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"scummvm_allow_timing_inaccuracies",
- "Allow Timing Inaccuracies (Restart)",
+ "Allow Timing Inaccuracies",
NULL,
"Allow timing inaccuracies that reduces CPU requirements. Though most timing deviations are imperceptible, in some cases it may introduce audio sync/timing issues, hence this option should be enabled only if full speed cannot be reached otherwise.",
NULL,
diff --git a/backends/platform/libretro/include/os.h b/backends/platform/libretro/include/os.h
index 32a53deef81..5076fd7a9c8 100644
--- a/backends/platform/libretro/include/os.h
+++ b/backends/platform/libretro/include/os.h
@@ -71,7 +71,7 @@ extern char cmd_params_num;
extern int access(const char *path, int amode);
#endif
-OSystem *retroBuildOS(bool aEnableSpeedHack);
+OSystem *retroBuildOS();
const Graphics::Surface &getScreen();
void retroProcessMouse(retro_input_state_t aCallback, int device, float gamepad_cursor_speed, float gamepad_acceleration_time, bool analog_response_is_quadratic, int analog_deadzone, float mouse_speed);
diff --git a/backends/platform/libretro/src/libretro-os.cpp b/backends/platform/libretro/src/libretro-os.cpp
index 03364cfdcc9..4e4b249b9d7 100644
--- a/backends/platform/libretro/src/libretro-os.cpp
+++ b/backends/platform/libretro/src/libretro-os.cpp
@@ -319,6 +319,8 @@ static Common::String s_saveDir;
Common::List<Common::Event> _events;
+extern bool timing_inaccuracies_is_enabled(void);
+
class OSystem_RETRO : public EventsBaseBackend, public PaletteManager {
public:
Graphics::Surface _screen;
@@ -359,11 +361,9 @@ public:
uint32 _threadExitTime;
uint8 _threadSwitchCaller;
- bool _speed_hack_enabled;
-
Audio::MixerImpl *_mixer;
- OSystem_RETRO(bool aEnableSpeedHack) : _mousePaletteEnabled(false), _mouseVisible(false), _mouseX(0), _mouseY(0), _mouseXAcc(0.0), _mouseYAcc(0.0), _mouseHotspotX(0), _mouseHotspotY(0), _dpadXAcc(0.0), _dpadYAcc(0.0), _dpadXVel(0.0f), _dpadYVel(0.0f), _mouseKeyColor(0), _mouseDontScale(false), _joypadnumpadLast(8), _joypadnumpadActive(false), _mixer(0), _startTime(0), _threadExitTime(0), _threadSwitchCaller(0), _speed_hack_enabled(aEnableSpeedHack) {
+ OSystem_RETRO() : _mousePaletteEnabled(false), _mouseVisible(false), _mouseX(0), _mouseY(0), _mouseXAcc(0.0), _mouseYAcc(0.0), _mouseHotspotX(0), _mouseHotspotY(0), _dpadXAcc(0.0), _dpadYAcc(0.0), _dpadXVel(0.0f), _dpadYVel(0.0f), _mouseKeyColor(0), _mouseDontScale(false), _joypadnumpadLast(8), _joypadnumpadActive(false), _mixer(0), _startTime(0), _threadExitTime(0), _threadSwitchCaller(0) {
_fsFactory = new FS_SYSTEM_FACTORY();
memset(_mouseButtons, 0, sizeof(_mouseButtons));
memset(_joypadmouseButtons, 0, sizeof(_joypadmouseButtons));
@@ -501,7 +501,7 @@ public:
/* In a series of consecutive updateScreen calls, additionally switch directly to main thread when
(and if) first copyRectToScreen is called between two updateScreen. This reduces audio crackling.
Consecutive copyRectToScreen other than first are covered by thread switch triggered by pollEvent or delayMillis. */
- if (! _speed_hack_enabled) {
+ if (! timing_inaccuracies_is_enabled()) {
if (!(_threadSwitchCaller & THREAD_SWITCH_RECT) && (_threadSwitchCaller & THREAD_SWITCH_UPDATE)) {
retro_switch_to_main_thread();
_threadSwitchCaller |= THREAD_SWITCH_RECT;
@@ -547,11 +547,13 @@ public:
/* Switch directly to main thread in case of consecutive updateScreen, to avoid losing frames.
Non consecutive updateScreen are covered by thread switches triggered by pollEvent or delayMillis. */
- if (! _speed_hack_enabled && (_threadSwitchCaller & THREAD_SWITCH_UPDATE)) {
- retro_switch_to_main_thread();
- _threadSwitchCaller &= ~THREAD_SWITCH_RECT;
- } else {
- _threadSwitchCaller = THREAD_SWITCH_UPDATE;
+ if (! timing_inaccuracies_is_enabled()) {
+ if (_threadSwitchCaller & THREAD_SWITCH_UPDATE) {
+ retro_switch_to_main_thread();
+ _threadSwitchCaller &= ~THREAD_SWITCH_RECT;
+ } else {
+ _threadSwitchCaller = THREAD_SWITCH_UPDATE;
+ }
}
}
@@ -686,7 +688,7 @@ public:
// Implement 'non-blocking' sleep...
uint32 start_time = getMillis();
- if (_speed_hack_enabled) {
+ if (timing_inaccuracies_is_enabled()) {
// Use janky inaccurate method...
uint32 elapsed_time = 0;
uint32 time_remaining = msecs;
@@ -1289,8 +1291,8 @@ public:
};
-OSystem *retroBuildOS(bool aEnableSpeedHack) {
- return new OSystem_RETRO(aEnableSpeedHack);
+OSystem *retroBuildOS() {
+ return new OSystem_RETRO();
}
const Graphics::Surface &getScreen() {
diff --git a/backends/platform/libretro/src/libretro.cpp b/backends/platform/libretro/src/libretro.cpp
index abea052f86c..6a48222cf6b 100644
--- a/backends/platform/libretro/src/libretro.cpp
+++ b/backends/platform/libretro/src/libretro.cpp
@@ -72,7 +72,7 @@ static bool analog_response_is_quadratic = false;
static float mouse_speed = 1.0f;
static float gamepad_acceleration_time = 0.2f;
-static bool speed_hack_is_enabled = false;
+static bool timing_inaccuracies_enabled = false;
char cmd_params[20][200];
char cmd_params_num;
@@ -178,10 +178,10 @@ static void update_variables(void) {
var.key = "scummvm_allow_timing_inaccuracies";
var.value = NULL;
- speed_hack_is_enabled = false;
+ timing_inaccuracies_enabled = false;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
if (strcmp(var.value, "enabled") == 0)
- speed_hack_is_enabled = true;
+ timing_inaccuracies_enabled = true;
}
var.key = "scummvm_frameskip_threshold";
@@ -215,6 +215,10 @@ static void update_variables(void) {
}
}
+bool timing_inaccuracies_is_enabled(){
+ return timing_inaccuracies_enabled;
+}
+
void parse_command_params(char *cmdline) {
int j = 0;
int cmdlen = strlen(cmdline);
@@ -441,7 +445,7 @@ void retro_init(void) {
retroSetSaveDir(".");
}
- g_system = retroBuildOS(speed_hack_is_enabled);
+ g_system = retroBuildOS();
}
void retro_deinit(void) {
More information about the Scummvm-git-logs
mailing list