SMPS in Sonic & Knuckles Collection

Discussion in 'Showroom Archive' started by MainMemory, May 4, 2014.

Thread Status:
Not open for further replies.
  1. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    The HQ music hack is great, but I've wondered if it would be possible to play the original SMPS music. A few days ago, ValleyBell pointed me to the source code of SMPSPlay and over the course of several days we were able to hack together something that played only S3K's music and worked with S&KC.

    You can download SMPSOUT.DLL here. To use it, simply extract it to Sonic & Knuckles Collection's install folder, and rename it to MIDIOUT.DLL (or MIDIOUTX.DLL to use it as a fallback for the HQ music hack).

    Features:

    • SMPS playback by ValleyBell
    • Plays Sonic 3's midboss theme in Sonic 3 mode
    • Speed shoes and special stage speedups work perfectly
    • Doesn't make S&KC run faster than it's supposed to
    The source code is up on Sonic Retro's GitHub, and I may add support for an INI file specifying whether to play the S3 or S&K version of applicable songs.
    Requires Visual C++ 2010 Runtime.
     
    Last edited by a moderator: May 6, 2014
  2. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    This is fantastic. I was expecting an SMPS rendition of the unused song (#44) as an easter egg, but I see you used that slot in another way.


    Btw, it's worth mentioning that it requires msvcr100.dll, I didn't have it installed on my laptop at first, not sure in which Operating Systems it's already included with, but having a link here will save time to whoever else lacks it :)
     
  3. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    There might be room for it in a future release.

    Sorry for not mentioning that it needs Visual C++ 2010, I didn't think that someone might not have it.
     
    Last edited by a moderator: May 4, 2014
  4. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    I've updated the DLL with two new features: track selection via INI, and fadeouts.

    The INI file should be named SMPSOUT.ini, and may contain the following entries:

    TitleScreenTrack=S3 or S&K

    MidbossTrack=S3 or S&K

    KnucklesTrack=S3 or S&K

    1UpTrack=S3 or S&K

    InvincibilityTrack=S3 or S&K

    AllClearTrack=S3 or S&K

    CreditsTrack=S3 or S&K



    Edit: Fixed S&K Knuckles' theme.
     
    Last edited by a moderator: May 5, 2014
  5. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Thanks to Tiddles, I have added SMPS versions of the S&KC music, and the credits song from the Sonic 3C prototype. As it is now, the SMPSOUT.ini file format looks like this:

    TitleScreenTrack=S3 or S&K
    CarnivalNight1Track=MD or PC
    CarnivalNight2Track=MD or PC
    IceCap1Track=MD or PC
    IceCap2Track=MD or PC
    LaunchBase1Track=MD or PC
    LaunchBase2Track=MD or PC
    MidbossTrack=S3 or S&K
    KnucklesTrack=S3, S&K or PC
    ContinueTrack=S3 or S&K
    CompetitionMenuTrack=MD or PC
    1UpTrack=S3 or S&K
    InvincibilityTrack=S3, S&K or PC (uses unused track)
    AllClearTrack=S3 or S&K
    CreditsTrack=S3, S&K, S3C or PCI have also added per-game settings. Any settings in a section named [s3K], [s&K] or [s3] will only be in effect when playing those games, and all settings in the root section will always be in effect unless overridden by a per-game setting.
    The S&KC tracks have been left out of the source code on GitHub at Tiddles' request.

    Edit: I've fixed IceCap 2's track selection and added the S3 Continue theme at Tiddles' request.
     
    Last edited by a moderator: May 7, 2014
  6. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    ValleyBell has done a bit of work recently which has resulted in a new feature: by setting the BGM mode to FM Synthesizer in RUNSONIC.EXE and adding the line FMDrums=True in SMPSOUT.ini, you will get FM drums instead of DAC drums.

    Additionally he has added some new tracks:

    • A version of S3's invincibility based on S&KC's version of that track, available with InvincibilityTrack=S3PC.
    • The credits music from the 0525 S&K prototype, available with CreditsTrack=S&K0525.
    • The all clear music from the 0525 S&K prototype, available with AllClearTrack=S&K0525.
    • The title screen music from the 0525 S&K prototype, available with TitleScreenTrack=S&K0525.
    Additionally, I have added a feature myself: for any track, you can specify Random to have it play a random track from the available options.
     
  7. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    One last feature from me: for any track (including ones that previously had no options) you can specify MIDI to have it fall back on the original MIDI track, as long as the original MIDIOUT.DLL is named MIDIOUTY.DLL. This makes it possible to have the HQ music mod fall back on the SMPS music mod, which itself falls back on the original MIDI tracks.
     
  8. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Since the contest is nearly over, I suppose I should make an update post.

    When I entered this in the contest, I figured I should add a new feature for it, and chose to go for Sonic 3D music, because it's the same SMPS version as S3K with a few different DAC samples. So ValleyBell got the coding set up and I added in the tracks where I felt appropriate.

    I also added a new feature to the config tool: song previews.

    [​IMG]

    With this feature, it's now possible for people without S&KC to download the mod and just listen via the config tool, and it's possible for any program that supports C interop to use SMPSOUT.DLL to play music.

    I also recorded a couple new videos:
     
  9. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    This could actually become a stand alone tool, being to play (and maybe one day edit?) Sonic music. I'll check it out when I can.
     
  10. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    SMPSPlay is already a standalone tool.
     
  11. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Early today, ValleyBell made a commit that enabled the player to play S1 and S2 music. As I went about adding the new music in, I realized that the method for adding a song was really dumb, requiring editing no less than five places in the code. So I wrote a program to parse a couple of INI files for song info and generate the necessary data structures, then added in all the music from S1, S2 and S2Beta. Then I updated SMPSCFG to use the ini files too. Unfortunately it appears there is a bug that causes S2Beta songs to crash S&KC, but not SMPSCFG (or the SMPSPlay program), and since ValleyBell just left for a two week vacation, I had to remove them by way of commenting them out. I fixed the bug and added the S2Beta music.

    TL;DR S&KC SMPS Player can now play all the music from Sonic 1 and Sonic 2.

    Potential future features:

    • Music resume after 1-Up (current SMPSPlay supports it, SMPSOUT's driver will need updating)
    • SMPS sound effects (again, driver will need updating)
     
    Last edited by a moderator: Sep 20, 2014
  12. Slash

    Slash Well-Known Member Member

    Joined:
    Aug 12, 2013
    Messages:
    52
    There is a problem with Spring Yard Zone's music where one of the instruments will be way for ahead of the other instruments.
     
    Last edited by a moderator: Sep 21, 2014
  13. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    I've fixed the issue, thanks to ValleyBell.
     
  14. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Can it load raw sonic 1 smps bin files? If so, i might actually have a use for this!
     
  15. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    That depends on whether you have Microsoft Visual C++ 2010 Express or later. I'm not planning on allowing external SMPS files, but it's now easier than ever to add them in to a custom build (although any such build will lack the S&KC songs because Tiddles doesn't want them to be public), you just have to edit the ini files in SMPSOUTData and rebuild the project. Those same ini files are used by the SMPSCFG program as well.
     
  16. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    So, that last post? Well...

    New Features:

    • Separate Super Sonic track
    • Custom songs
    For custom songs, simply create a file named songs_cust.ini in the S&KC folder with the same format as songs.ini, and every song specified in that INI will be available as an option for every track.Example:

    Code:
    [mysong] ; this will be the name it uses in the config tool/file
    Type=S1 ; or S2, S2B, S3, SK, S3D
    Offset=0000 ; hex number, S1 format songs are always 0, others depend on the song's location in ROM/RAM
    File=mysong.bin ; must be uncompressed, songs with nonexistent files are skipped
     
  17. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    This is my new favourite thing ever, I knew you were awesome but you just went a step beyond awesome.


    Just wondering, any chance to get customisable DAC entries?


    Also, there seems to be a small bug in the previewer:

    [​IMG]


    Even with the INI file properly filled, it seems to play the wrong songs. ALZ plays ctlucca, TTZGF is correct, MagicMan plays ALZ, and ctlucca (below the screenshot) plays Magic Man. This only happens in the previewer, as the songs are correct once in game.


    edit: also², maybe I am stupid, but I can't find how to change the Super Sonic track
     
    Last edited by a moderator: Sep 24, 2014
  18. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    The only explanation I can come up with is that the C++ INI parser is inserting the groups in a different order than the C# code. I didn't get it happening with three songs, but I've attempted to fix it anyway, so let me know if it works.

    The missing Super Sonic track options are entirely my fault, I forgot to update the copies of the INIs in the archive.
     
  19. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
  20. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    New features:

    • Separate settings for: S&K/S3K endings, Data Select, Special Stage result, Blue Sphere result, Blue Sphere title, Blue Sphere difficulty, Time Attack records
    • New options for "By Zone" and "By Character"
    When a track in the S3K section has ByZone set, it will play the selected song for the track in the S3 section in S3 zones and the selected song for the track in the S&K section for S&K zones.When a track in the S3K section has ByCharacter set, it will play the selected song for the track in the S3 section when playing as Sonic and/or Tails and the selected song for the track in the S&K section when playing as Knuckles.
     
Thread Status:
Not open for further replies.