[Scummvm-git-logs] scummvm master -> 329ffef42d2f383fc3974aecfb924fc4d6e619d7

AndywinXp noreply at scummvm.org
Thu Jun 29 12:09:33 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
329ffef42d SCUMM: AMIGA: Implement 50Hz mode


Commit: 329ffef42d2f383fc3974aecfb924fc4d6e619d7
    https://github.com/scummvm/scummvm/commit/329ffef42d2f383fc3974aecfb924fc4d6e619d7
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-06-29T14:09:27+02:00

Commit Message:
SCUMM: AMIGA: Implement 50Hz mode

For now this is implemented via config file only.
It will be added to the GUI as soon as the enhancements
revamping PR is merged, which includes a generic SCUMM
engine widget.
The game speed changes in this commit were verified against
the latest WinUAE version. MI1 apparently has internal routines
which keep the speed of game and music constant between PAL
and NTSC; LOOM does that only for the music. Older games
have their video and sound speed based on the main VBlank rate.
iMUSE games do their own thing as usual and already work fine :-)

Changed paths:
    engines/scumm/players/player_v2a.cpp
    engines/scumm/players/player_v3a.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/players/player_v2a.cpp b/engines/scumm/players/player_v2a.cpp
index 9a2a6221951..0772e4f6b96 100644
--- a/engines/scumm/players/player_v2a.cpp
+++ b/engines/scumm/players/player_v2a.cpp
@@ -1858,7 +1858,7 @@ Player_V2A::Player_V2A(ScummEngine *scumm, Audio::Mixer *mixer) {
 	}
 
 	_mod = new Player_MOD(mixer);
-	_mod->setUpdateProc(update_proc, this, _vm->getTimerFrequency() / 4);
+	_mod->setUpdateProc(update_proc, this, _vm->getAmigaMusicTimerFrequency() / 4);
 }
 
 Player_V2A::~Player_V2A() {
diff --git a/engines/scumm/players/player_v3a.cpp b/engines/scumm/players/player_v3a.cpp
index fcbaf1e2733..75190e36274 100644
--- a/engines/scumm/players/player_v3a.cpp
+++ b/engines/scumm/players/player_v3a.cpp
@@ -27,7 +27,7 @@
 namespace Scumm {
 
 Player_V3A::Player_V3A(ScummEngine *scumm, Audio::Mixer *mixer)
-	: Paula(true, mixer->getOutputRate(), mixer->getOutputRate() / (scumm->getTimerFrequency() / 4)),
+	: Paula(true, mixer->getOutputRate(), mixer->getOutputRate() / (scumm->getAmigaMusicTimerFrequency() / 4)),
 	  _vm(scumm),
 	  _mixer(mixer),
 	  _soundHandle(),
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 18bbd6bb0fd..a99aae21e05 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -182,6 +182,14 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 		_virtscr[i].clear();
 	}
 
+
+	if (_game.platform == Common::kPlatformAmiga) {
+		ConfMan.registerDefault("amiga_pal_system", false);
+		if (ConfMan.hasKey("amiga_pal_system", _targetName)) {
+			_isAmigaPALSystem = ConfMan.getBool("amiga_pal_system");
+		}
+	}
+
 	setTimerAndShakeFrequency();
 
 	camera.reset();
@@ -2513,8 +2521,8 @@ void ScummEngine::setTimerAndShakeFrequency() {
 		default:
 			_shakeTimerRate = _timerFrequency = 240.0;
 		}
-	} else if (_game.platform == Common::kPlatformAmiga) {
-		_shakeTimerRate = _timerFrequency = AMIGA_NTSC_VBLANK_RATE;
+	} else if (_game.platform == Common::kPlatformAmiga && _game.id != GID_MONKEY_VGA) {
+		_shakeTimerRate = _timerFrequency = _isAmigaPALSystem ? AMIGA_PAL_VBLANK_RATE : AMIGA_NTSC_VBLANK_RATE;
 	}
 }
 
@@ -2522,6 +2530,13 @@ double ScummEngine::getTimerFrequency() {
 	return _timerFrequency;
 }
 
+double ScummEngine::getAmigaMusicTimerFrequency() {
+	// Similarly to MI1, LOOM in PAL mode operates at 50Hz but the audio engine
+	// compensates the speed factor to play music at the correct speed.
+	// We simply feed the NTSC speed to the Paula audio engine to account for that.
+	return _game.id == GID_LOOM ? AMIGA_NTSC_VBLANK_RATE : _timerFrequency;
+}
+
 void ScummEngine_v0::scummLoop(int delta) {
 	VAR(VAR_IS_SOUND_RUNNING) = (_sound->_lastSound && _sound->isSoundRunning(_sound->_lastSound) != 0);
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 7c05e5db65a..1bb4b83dcdc 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -347,11 +347,11 @@ class ResourceManager;
  * at a time.
  *
  * The base rate is 50Hz for PAL systems and 60Hz for NTSC systems.
- * We're going to target the latter in here, converting it in a quarter
- * frame frequency.
+ * We're converting it in a quarter frame frequency.
  */
 
 #define AMIGA_NTSC_VBLANK_RATE 240.0
+#define AMIGA_PAL_VBLANK_RATE  200.0
 
 /**
  * Game saving/loading outcome codes
@@ -550,6 +550,7 @@ public:
 	bool _useOriginalGUI = true;
 	bool _enableAudioOverride = false;
 	bool _enableCOMISong = false;
+	bool _isAmigaPALSystem = false;
 
 	Common::Keymap *_insaneKeymap;
 
@@ -1412,6 +1413,7 @@ protected:
 
 public:
 	double getTimerFrequency();
+	double getAmigaMusicTimerFrequency(); // For setting up Players v2 and v3
 
 protected:
 	bool _shakeEnabled = false;




More information about the Scummvm-git-logs mailing list