From 69b1485a22dc2b8a2cfe0bd10edcbaad0da0cf6e Mon Sep 17 00:00:00 2001 From: strangerke Date: Thu, 12 May 2011 01:13:57 +0200 Subject: GIT: Clean up: Suppress SVN tags, now useless --- engines/scumm/scumm.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f43aed53f7..b1198247d3 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" -- cgit v1.2.3 From 068b4a5351a5574dbfac6acff5776a0071f3f2dd Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 14:02:21 +0200 Subject: SCUMM: Move tmsk code into its own Gdi subclass --- engines/scumm/scumm.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index b1198247d3..f5187546a1 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -112,7 +112,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _currentScript(0xFF), // Let debug() work on init stage _messageDialog(0), _pauseDialog(0), _versionDialog(0) { - if (_game.platform == Common::kPlatformNES) { + if (_game.heversion > 0) { + _gdi = new GdiHE(this); + } else if (_game.platform == Common::kPlatformNES) { _gdi = new GdiNES(this); #ifdef USE_RGB_COLOR } else if (_game.features & GF_16BIT_COLOR) { -- cgit v1.2.3 From b37463fe5921420a9081aa6c5cf7588d52b41e78 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 16:03:50 +0200 Subject: SCUMM: Move class ResourceManager to its own header --- engines/scumm/scumm.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f5187546a1..70d8f0dab1 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -62,6 +62,7 @@ #include "scumm/player_v2a.h" #include "scumm/player_v3a.h" #include "scumm/player_v4a.h" +#include "scumm/resource.h" #include "scumm/he/resource_he.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v8.h" -- cgit v1.2.3 From 45e65d7ea04b10cf7bb5282bd66b8df609700a63 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 16:23:26 +0200 Subject: SCUMM: Refactor how resource (types) are srepresented Previously, we had a couple of arrays of size N (where N = number of resource types), one for each attribute of a resource type (such as as the number of resources of that type. Now, we have one array of size N, whose elements are a record aggregating all the attributes of each resource type. --- engines/scumm/scumm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 70d8f0dab1..d5c2b2eeb9 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1185,7 +1185,7 @@ Common::Error ScummEngine::init() { resetScummVars(); if (_imuse) { - _imuse->setBase(_res->address[rtSound]); + _imuse->setBase(_res->_types[rtSound].address); } if (_game.version >= 5 && _game.version <= 7) @@ -2462,7 +2462,7 @@ void ScummEngine::restart() { resetScummVars(); if (_imuse) { - _imuse->setBase(_res->address[rtSound]); + _imuse->setBase(_res->_types[rtSound].address); } // Reinit sound engine -- cgit v1.2.3 From 26efa39d2caa0b6bb7da8414382eb5643c108261 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 17:07:31 +0200 Subject: SCUMM: Document and cleanup resource type mode --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index d5c2b2eeb9..e89100688a 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1233,7 +1233,7 @@ void ScummEngine::setupScumm() { requestLoad(ConfMan.getInt("save_slot")); } - _res->allocResTypeData(rtBuffer, 0, 10, "buffer", 0); + _res->allocResTypeData(rtBuffer, 0, 10, "buffer", kDynamicResTypeMode); setupScummVars(); -- cgit v1.2.3 From 75b9deb1856bae8355403faa5f55857f3929adb6 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 18:06:30 +0200 Subject: SCUMM: Get rid of the MemBlkHeader hack This uncovered at least one potentially serious bug in the inventory code, which still needs to be investigated and fixed. --- engines/scumm/scumm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index e89100688a..22736973f7 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1185,7 +1185,7 @@ Common::Error ScummEngine::init() { resetScummVars(); if (_imuse) { - _imuse->setBase(_res->_types[rtSound].address); + _imuse->setBase(_res->_types[rtSound]._address); } if (_game.version >= 5 && _game.version <= 7) @@ -2462,7 +2462,7 @@ void ScummEngine::restart() { resetScummVars(); if (_imuse) { - _imuse->setBase(_res->_types[rtSound].address); + _imuse->setBase(_res->_types[rtSound]._address); } // Reinit sound engine -- cgit v1.2.3 From 82a6f2ee3ce1cd11c7b186b0ec728e48589445ae Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 11 May 2011 18:19:05 +0200 Subject: SCUMM: Rename ResTypeData::tag to _tag, get rid of ResTypeData::name --- engines/scumm/scumm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 22736973f7..21521d0fe6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1233,7 +1233,7 @@ void ScummEngine::setupScumm() { requestLoad(ConfMan.getInt("save_slot")); } - _res->allocResTypeData(rtBuffer, 0, 10, "buffer", kDynamicResTypeMode); + _res->allocResTypeData(rtBuffer, 0, 10, kDynamicResTypeMode); setupScummVars(); -- cgit v1.2.3 From c02420df43bec4ec523c18d8e6fdb381af29c1b5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 May 2011 11:45:42 +0200 Subject: SCUMM: Add a Resource class, refactor res code around it --- engines/scumm/scumm.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 21521d0fe6..f0b646157a 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1184,10 +1184,6 @@ Common::Error ScummEngine::init() { resetScumm(); resetScummVars(); - if (_imuse) { - _imuse->setBase(_res->_types[rtSound]._address); - } - if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); @@ -2461,10 +2457,6 @@ void ScummEngine::restart() { resetScumm(); resetScummVars(); - if (_imuse) { - _imuse->setBase(_res->_types[rtSound]._address); - } - // Reinit sound engine if (_game.version >= 5 && _game.version <= 7) _sound->setupSound(); -- cgit v1.2.3 From 4108f09543afd543fbfab86cc5f3e7f4850150a2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 May 2011 14:33:22 +0200 Subject: SCUMM: Make it clearer that SCUMM's 'restart' feature leaks like hell --- engines/scumm/scumm.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index f0b646157a..3ebacee6a5 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2418,13 +2418,16 @@ void ScummEngine::pauseGame() { } void ScummEngine::restart() { -// TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect -// this leaks memory like a sieve + // FIXME: This function *leaks memory*, and quite a lot so. For example, + // we re-init the resource manager, which causes readMAXS() to be called + // again, which allocates some memory. There are many other leaks, though. -// Fingolfin seez: An alternate way to implement restarting would be to create -// a save state right after startup ... to this end we could introduce a SaveFile -// subclass which is implemented using a memory buffer (i.e. no actual file is -// created). Then to restart we just have to load that pseudo save state. + // TODO: We should also probably be reinitting a lot more stuff. + + // Fingolfin seez: An alternate way to implement restarting would be to create + // a save state right after startup ... to this end we could introduce a SaveFile + // subclass which is implemented using a memory buffer (i.e. no actual file is + // created). Then to restart we just have to load that pseudo save state. int i; -- cgit v1.2.3 From 749a1beb350d33fb1e48494134bdca70bc8c2ad8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 13 May 2011 14:39:34 +0200 Subject: SCUMM: Remove useless allocateArrays call, and make sure all resources are properly killed upon restart --- engines/scumm/scumm.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 3ebacee6a5..6e958462b2 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2447,13 +2447,6 @@ void ScummEngine::restart() { for (i = 1; i < _numGlobalObjects; i++) clearOwnerOf(i); - // Reallocate arrays - // FIXME: This should already be called by readIndexFile. - // FIXME: regardless of that, allocateArrays and allocResTypeData leaks - // heavily, which should be fixed. - allocateArrays(); - - // Reread index (reset objectstate etc) readIndexFile(); // Reinit scumm variables -- cgit v1.2.3 From 4cbe4ede66e65ec9289811eca2f5f62285174c8d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 16 May 2011 16:35:10 +0200 Subject: COMMON: Registers RandomSources in constructor with the event recorder This also removes the dependency of engines on the event recorder header and API, and will make it easier to RandomSources that are not properly registered. --- engines/scumm/scumm.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 6e958462b2..1b7f16bdca 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -24,7 +24,6 @@ #include "common/debug-channels.h" #include "common/md5.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/system.h" #include "common/translation.h" @@ -111,7 +110,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _language(dr.language), _debugger(0), _currentScript(0xFF), // Let debug() work on init stage - _messageDialog(0), _pauseDialog(0), _versionDialog(0) { + _messageDialog(0), _pauseDialog(0), _versionDialog(0), + _rnd("scumm") + { if (_game.heversion > 0) { _gdi = new GdiHE(this); @@ -574,8 +575,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) assert(!_mainMenuDialog); _mainMenuDialog = new ScummMenuDialog(this); #endif - - g_eventRec.registerRandomSource(_rnd, "scumm"); } -- cgit v1.2.3 From 5c34e33c2c27b2b5083199b40306370d732f4e53 Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 29 Apr 2011 22:16:02 +0200 Subject: FM-TOWNS AUDIO: Some more midi driver code for FM-TOWNS monkey2 and indy4 --- engines/scumm/scumm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 1b7f16bdca..ff51158a4c 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1833,7 +1833,7 @@ void ScummEngine::setupMusic(int midi) { if (nativeMidiDriver != NULL && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && (midi & MDT_ADLIB); - if (_musicType == MDT_ADLIB || multi_midi) { + if (_musicType == MDT_ADLIB || (multi_midi && _musicType != MDT_TOWNS)) { adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB)); adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } @@ -1841,7 +1841,9 @@ void ScummEngine::setupMusic(int midi) { _imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver); if (_game.platform == Common::kPlatformFMTowns) { - _musicEngine = _townsPlayer = new Player_Towns_v2(this, _imuse, _mixer, true); + MidiDriver *townsDriver = 0; + townsDriver = (_musicType == MDT_TOWNS) ? nativeMidiDriver : MidiDriver::createMidi(MidiDriver::detectDevice(MDT_TOWNS)); + _musicEngine = _townsPlayer = new Player_Towns_v2(this, _imuse, _mixer, (MidiDriver_TOWNS*)townsDriver, true, (_musicType != MDT_TOWNS)); if (!_townsPlayer->init()) error("Failed to initialize FM-Towns audio driver"); } else { -- cgit v1.2.3 From 6845f25f541707786f81dded25485c4ff5c8d62d Mon Sep 17 00:00:00 2001 From: athrxx Date: Sat, 30 Apr 2011 15:56:18 +0200 Subject: SCUMM: Adapt code to latest FM-TOWNS audio driver changes --- engines/scumm/scumm.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index ff51158a4c..c37ff25977 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1828,24 +1828,26 @@ void ScummEngine::setupMusic(int midi) { MidiDriver *nativeMidiDriver = 0; MidiDriver *adlibMidiDriver = 0; - if (_musicType != MDT_ADLIB) + if (_musicType != MDT_ADLIB && _musicType != MDT_TOWNS) nativeMidiDriver = MidiDriver::createMidi(dev); if (nativeMidiDriver != NULL && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && (midi & MDT_ADLIB); - if (_musicType == MDT_ADLIB || (multi_midi && _musicType != MDT_TOWNS)) { + if (_musicType == MDT_ADLIB || multi_midi) { adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB)); adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } + if (_musicType == MDT_TOWNS) { + adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_TOWNS)); + adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); + } _imuse = IMuse::create(_system, nativeMidiDriver, adlibMidiDriver); if (_game.platform == Common::kPlatformFMTowns) { - MidiDriver *townsDriver = 0; - townsDriver = (_musicType == MDT_TOWNS) ? nativeMidiDriver : MidiDriver::createMidi(MidiDriver::detectDevice(MDT_TOWNS)); - _musicEngine = _townsPlayer = new Player_Towns_v2(this, _imuse, _mixer, (MidiDriver_TOWNS*)townsDriver, true, (_musicType != MDT_TOWNS)); + _musicEngine = _townsPlayer = new Player_Towns_v2(this, _mixer, _imuse, true); if (!_townsPlayer->init()) - error("Failed to initialize FM-Towns audio driver"); + error("ScummEngine::setupMusic(): Failed to initialize FM-Towns audio driver"); } else { _musicEngine = _imuse; } @@ -1857,7 +1859,6 @@ void ScummEngine::setupMusic(int midi) { _imuse->property(IMuse::PROP_GAME_ID, _game.id); if (ConfMan.hasKey("tempo")) _imuse->property(IMuse::PROP_TEMPO_BASE, ConfMan.getInt("tempo")); - // YM2162 driver can't handle midi->getPercussionChannel(), NULL shouldn't init MT-32/GM/GS if (midi != MDT_NONE) { _imuse->property(IMuse::PROP_NATIVE_MT32, _native_mt32); if (MidiDriver::getMusicType(dev) != MT_MT32) // MT-32 Emulation shouldn't be GM/GS initialized -- cgit v1.2.3 From baaae9d97a92da28ec8d8293a391cbca955cbbea Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 8 May 2011 18:19:51 +0200 Subject: SCUMM: Add missing imuse feature This adds an extra detune parameter which is assigned via sysex code 0. Most tracks don't use this (= assign a value of 0), so it isn't really a very noticeable feature. --- engines/scumm/scumm.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'engines/scumm/scumm.cpp') diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index c37ff25977..e8dd6cb548 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1833,12 +1833,8 @@ void ScummEngine::setupMusic(int midi) { if (nativeMidiDriver != NULL && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && (midi & MDT_ADLIB); - if (_musicType == MDT_ADLIB || multi_midi) { - adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB)); - adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); - } - if (_musicType == MDT_TOWNS) { - adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_TOWNS)); + if (_musicType == MDT_ADLIB || MDT_TOWNS || multi_midi) { + adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB)); adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } -- cgit v1.2.3