Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class EtecoonsJinglePatch : RomPatch
{
internal class Jingle
{
public required bool Loop { get; init; }
public required Voice Voice1 { get; init; }
public Voice? Voice2 { get; init; }
}
Expand Down Expand Up @@ -81,6 +82,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.Vanilla, new Jingle
{
Loop = false,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -117,6 +119,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.BlueBadger, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -225,6 +228,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.SMB1, new Jingle
{
Loop = false,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -256,33 +260,35 @@ public List<byte> ToBytes()
{
EtecoonsJingle.ZeldaSecret, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
[
new Note { Value = NoteValue.E4, Duration = 0x12, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.C4, Duration = 0x12, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.F3, Duration = 0x12, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.F4, Duration = 0x12, Volume = 0x70, Pan = 0x08 }
new Note { Value = NoteValue.G4, Duration = 0x14, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.Ds4, Duration = 0x14, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.Gs3, Duration = 0x14, Volume = 0x70, Pan = 0x08 },
new Note { Value = NoteValue.Gs4, Duration = 0x14, Volume = 0x70, Pan = 0x08 }
]
},
Voice2 = new Voice
{
Notes =
[
new Note { Value = NoteValue.Ds4, Duration = 0x0A, Volume = 0x00, Pan = 0x0B },
new Note { Value = NoteValue.Ds4, Duration = 0x12, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.Fs3, Duration = 0x12, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.Cs4, Duration = 0x12, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.A4, Duration = 0x12, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.A4, Duration = 0x12, Volume = 0x20, Pan = 0x0B }
new Note { Value = NoteValue.Fs4, Duration = 0x0A, Volume = 0x00, Pan = 0x0B },
new Note { Value = NoteValue.Fs4, Duration = 0x14, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.A3, Duration = 0x14, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.E4, Duration = 0x14, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.C5, Duration = 0x14, Volume = 0x70, Pan = 0x0B },
new Note { Value = NoteValue.C5, Duration = 0x14, Volume = 0x20, Pan = 0x0B }
]
}
}
},
{
EtecoonsJingle.SariasSong, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -313,6 +319,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.KQVTown, new Jingle
{
Loop = false,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -354,6 +361,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.ManbosMambo, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -391,6 +399,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.Sonic2Bonus, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -428,6 +437,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.FFVictory, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -463,6 +473,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.YICastle, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand All @@ -472,7 +483,7 @@ public List<byte> ToBytes()
new Note { Value = NoteValue.G4, Duration = 0x12, Volume = 0x60, },
new Note { Value = NoteValue.Fs4, Duration = 0x12, Volume = 0x60, },
new Note { Value = NoteValue.A4, Duration = 0x24, Volume = 0x60, },

new Note { Value = NoteValue.As4, Duration = 0x1B, Volume = 0x60, },
new Note { Value = NoteValue.C5, Duration = 0x09, Volume = 0x60, },
new Note { Value = NoteValue.As4, Duration = 0x09, Volume = 0x60, },
Expand Down Expand Up @@ -503,6 +514,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.Shadowgate, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand All @@ -514,7 +526,7 @@ public List<byte> ToBytes()
new Note { Value = NoteValue.G4, Duration = 0x0C, Volume = 0x70, },
new Note { Value = NoteValue.As4, Duration = 0x0C, Volume = 0x70, },
new Note { Value = NoteValue.D5, Duration = 0x18, Volume = 0x70, },

new Note { Value = NoteValue.E5, Duration = 0x06, Volume = 0x70, },
new Note { Value = NoteValue.F5, Duration = 0x06, Volume = 0x70, },
new Note { Value = NoteValue.E5, Duration = 0x24, Volume = 0x70, },
Expand Down Expand Up @@ -544,6 +556,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.SNAAAKE, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -589,6 +602,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.BattletoadsWin, new Jingle
{
Loop = false,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -628,6 +642,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.PizzaTime, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -656,6 +671,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.KirbyWin, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -683,6 +699,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.BuffedKirbyWin, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -710,6 +727,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.VampireKiller, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand All @@ -736,13 +754,13 @@ public List<byte> ToBytes()
[
new Note { Value = NoteValue.A3, Duration = 0x18, Volume = 0x60, Pan = 0x0B, },
new Note { Value = NoteValue.A3, Duration = 0x28, Volume = 0x60, Pan = 0x0B, },

new Note { Value = NoteValue.A3, Duration = 0x18, Volume = 0x60, Pan = 0x0B, },
new Note { Value = NoteValue.A3, Duration = 0x28, Volume = 0x60, Pan = 0x0B, },

new Note { Value = NoteValue.F3, Duration = 0x18, Volume = 0x60, Pan = 0x0B, },
new Note { Value = NoteValue.F3, Duration = 0x28, Volume = 0x60, Pan = 0x0B, },

new Note { Value = NoteValue.G3, Duration = 0x40, Volume = 0x60, Pan = 0x0B, }
]
}
Expand All @@ -751,6 +769,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.MegaManBossSelected, new Jingle
{
Loop = false,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -797,6 +816,7 @@ public List<byte> ToBytes()
{
EtecoonsJingle.ThemeOfSuperMetroid, new Jingle
{
Loop = true,
Voice1 = new Voice
{
Notes =
Expand Down Expand Up @@ -890,6 +910,19 @@ internal IEnumerable<GeneratedPatch> GetPatch(Jingle jingle)

yield return new GeneratedPatch(Snes(voice1Offset), bytes.ToArray());

if (jingle.Loop)
{
// Enable looping
yield return new GeneratedPatch(Snes(0xD33D00), [0x03]); // 0x01

// Set loop point (must be aligned with a nine-byte BRR block)
yield return new GeneratedPatch(Snes(0xD31356), [0x28, 0xD9]); // 0xDE9B

// Set ADSR envelope (Attack: 0ms, Delay: 1.2s, Sustain Level: 6/8, Sustain Rate: 1.2s)
// See: https://snes.nesdev.org/wiki/DSP_envelopes#ADSR_Envelope
yield return new GeneratedPatch(Snes(0xD35E11), [0x8F, 0xD0]); // 0xFF, 0xE0
}

// Uncomment these lines to make the uncharged power beam sound effect use the Etecoon jingle instead.
// The last two lines should make the Green Brinstar theme play at Samus's ship, which loads the right sample.
// The jingle may play louder than usual, so be sure to check how it sounds in the actual Hell room.
Expand Down