Opened 17 years ago

Closed 17 years ago

Last modified 13 months ago

#8086 closed patch

SysEx parsing for Sam & Max

Reported by: SF/jamieson630 Owned by: SF/ender
Priority: normal Component: Engine: SCUMM
Keywords: Cc:
Game: Sam and Max


The included patch adds support for MIDI SysEx code 1,
which is used extensively (99% of SysEx usage) in Sam
& Max.

As far as I can tell, SysEx code 1 is the Sam & Max
equivalent to maybe_jump. This implementation properly
handles unconditional jumps (cmd = 0), as well as track
jumps (SysEx code 0, also used for vastly different
purposes by Monkey2). I haven't observed any case
where a cmd-based jump takes place, but that may be
because some scripting hooks are not in place yet.

(That said, it's also entirely possible that SysEx code 0
is doubling as a marker, because it DOES show up at
the beginning of every measure, in music that is
supposed to seamlessly transition to something else
based on the user's actions. Much like the markers in
Monkey2. This is something to look into.)

Although I'm not sure the parser implementation is
complete (or entirely correct for situations I haven't
observed yet), I'm putting this out here because it DOES
fix (1) the problem of no music looping in Sam & Max,
and (2) the large period of silence that occurs before
each new song starts playing.

Ticket imported from: #620944. Ticket imported from: patches/191.

Attachments (2)

imuse.samnmax.diff (2.7 KB ) - added by SF/jamieson630 17 years ago.
Patch against 1.45 (October 9)
imuse.samnmax2.diff (2.6 KB ) - added by SF/jamieson630 17 years ago.
Revisions to the patch

Download all attachments as: .zip

Change History (8)

by SF/jamieson630, 17 years ago

Attachment: imuse.samnmax.diff added

Patch against 1.45 (October 9)

comment:1 by SF/ender, 17 years ago

Owner: set to SF/ender

comment:2 by SF/ender, 17 years ago

While it does seem like a massive improvement on what we already have.. it
has a fatal bug (at least during adlib emulation)...

Play through Sam and Max, just let the whole intro sequence run. If you
don't escape out of it, the previous tracks will continue playing! This results
in a very very nasty mess of sound.

Once this is fixed, I'll apply it :)

BTW, could Sam and Max imuse command 15 (IMuseInternal::do_command,
param == 0) have something to do with these sysex markers? It seems to
be used to control transitions, but I never worked out exactly WHAT it's
supposed to jump to..

by SF/jamieson630, 17 years ago

Attachment: imuse.samnmax2.diff added

Revisions to the patch

comment:3 by SF/jamieson630, 17 years ago

Ender, the bug you mentioned is consistent in any sound
system, not just Adlib.

I've posted a revised patch. The SysEx code 0 is not right at all,
so I removed it, but the code 1 implementation for maybe_jump
seems fine. I'll do SysEx code 0 as a separate patch, once I can
figure out how in the world it's being used. Right now there's
just a note in the patch about SysEx code 0, that's all.

I'm looking into do_command calls to see how script functions
might relate to S&M's use of SysEx command 0. Separate patch
for any discoveries there.

comment:4 by SF/ender, 17 years ago

Closing this :)

Good work.

comment:5 by SF/ender, 17 years ago

Status: newclosed

comment:6 by digitall, 13 months ago

Component: Engine: SCUMM
Game: Sam and Max
Note: See TracTickets for help on using tickets.