Skip to content

Commit

Permalink
Merge pull request #291 from eriktorbjorn/mac-mi-music-final
Browse files Browse the repository at this point in the history
SCUMM: Add support for Macintosh music in Monkey Island 1 and Loom
  • Loading branch information
lordhoto committed Dec 14, 2012
2 parents ebaa3fb + d3cf4d1 commit 97d7bf9
Show file tree
Hide file tree
Showing 15 changed files with 1,147 additions and 252 deletions.
13 changes: 11 additions & 2 deletions engines/scumm/imuse/imuse.cpp
Expand Up @@ -363,7 +363,7 @@ void IMuseInternal::pause(bool paused) {
_paused = paused;
}

int IMuseInternal::save_or_load(Serializer *ser, ScummEngine *scumm) {
int IMuseInternal::save_or_load(Serializer *ser, ScummEngine *scumm, bool fixAfterLoad) {
Common::StackLock lock(_mutex, "IMuseInternal::save_or_load()");
const SaveLoadEntry mainEntries[] = {
MKLINE(IMuseInternal, _queue_end, sleUint8, VER(8)),
Expand Down Expand Up @@ -440,7 +440,16 @@ int IMuseInternal::save_or_load(Serializer *ser, ScummEngine *scumm) {
for (i = 0; i < 8; ++i)
ser->saveLoadEntries(0, volumeFaderEntries);

if (ser->isLoading()) {
// Normally, we have to fix up the data structures after loading a
// saved game. But there are cases where we don't. For instance, The
// Macintosh version of Monkey Island 1 used to convert the Mac0 music
// resources to General MIDI and play it through iMUSE as a rough
// approximation. Now it has its own player, but old savegame still
// have the iMUSE data in them. We have to skip that data, using a
// dummy iMUSE object, but since the resource is no longer recognizable
// to iMUSE, the fixup fails hard. So yes, this is a bit of a hack.

if (ser->isLoading() && fixAfterLoad) {
// Load all sounds that we need
fix_players_after_load(scumm);
fix_parts_after_load();
Expand Down
2 changes: 1 addition & 1 deletion engines/scumm/imuse/imuse.h
Expand Up @@ -62,7 +62,7 @@ class IMuse : public MusicEngine {
public:
virtual void on_timer(MidiDriver *midi) = 0;
virtual void pause(bool paused) = 0;
virtual int save_or_load(Serializer *ser, ScummEngine *scumm) = 0;
virtual int save_or_load(Serializer *ser, ScummEngine *scumm, bool fixAfterLoad = true) = 0;
virtual bool get_sound_active(int sound) const = 0;
virtual int32 doCommand(int numargs, int args[]) = 0;
virtual int clear_queue() = 0;
Expand Down
2 changes: 1 addition & 1 deletion engines/scumm/imuse/imuse_internal.h
Expand Up @@ -518,7 +518,7 @@ class IMuseInternal : public IMuse {
public:
// IMuse interface
void pause(bool paused);
int save_or_load(Serializer *ser, ScummEngine *scumm);
int save_or_load(Serializer *ser, ScummEngine *scumm, bool fixAfterLoad = true);
bool get_sound_active(int sound) const;
int32 doCommand(int numargs, int args[]);
uint32 property(int prop, uint32 value);
Expand Down
3 changes: 3 additions & 0 deletions engines/scumm/module.mk
Expand Up @@ -36,6 +36,7 @@ MODULE_OBJS := \
object.o \
palette.o \
player_apple2.o \
player_mac.o \
player_mod.o \
player_nes.o \
player_pce.o \
Expand All @@ -47,7 +48,9 @@ MODULE_OBJS := \
player_v2base.o \
player_v2cms.o \
player_v3a.o \
player_v3m.o \
player_v4a.o \
player_v5m.o \
resource_v2.o \
resource_v3.o \
resource_v4.o \
Expand Down
6 changes: 6 additions & 0 deletions engines/scumm/music.h
Expand Up @@ -24,6 +24,7 @@
#define SCUMM_MUSIC_H

#include "common/scummsys.h"
#include "engines/scumm/saveload.h"

namespace Scumm {

Expand Down Expand Up @@ -78,6 +79,11 @@ class MusicEngine {
* @return the music timer
*/
virtual int getMusicTimer() { return 0; }

/**
* Save or load the music state.
*/
virtual void saveLoadWithSerializer(Serializer *ser) {}
};

} // End of namespace Scumm
Expand Down

0 comments on commit 97d7bf9

Please sign in to comment.