Sonic and Sega Retro Message Board: S3&K Collection (PC) HQ music hack [upd v1.3] - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 6 Pages +
  • 1
  • 2
  • 3
  • Last ►
    Locked
    Locked Forum

S3&K Collection (PC) HQ music hack [upd v1.3] Not music itself, but a hack enabling HQ music inside the game

#1 User is offline angryzor 

Posted 15 April 2011 - 09:31 PM

  • Posts: 27
  • Joined: 14-April 11
  • Gender:Male
  • Project:S&KC HQ Music
[UPDATED] Current version: 1.3

Hello, I'm new here, and though I've been lurking here for a long time, I decided to join after I saw Felik's post in ValleyBell's S&K MIDI tool thread:

Quote

I wish mp3 or ogg could be ported to S3&K PC using this :( I've got plenty of high quality remixes I'd like to hear in my S3&K.

This seemed like a fun quick hack and the only alternative was college work, so I gave it a try.

Thus, I present to you my Sonic 3 & Knuckles Collection (PC) HQ Audio hack.
It allows you to replace any of the built-in MIDI music tracks with your own custom file in the MP3/OGG/MP2/MP1/AIFF/XM/MOD/IT/S3M/UMX/MTM or any format supported by vgmstream (see below). Any tracks you don't specify just fall back to the standard MIDI track. It basically just emulates the standard MIDI engine, but plays your HQ files instead.
It also scales up the tempo of your music during speed mode and special stages.

Download link: http://www.mediafire...eabcdhbhza6ozan
Quick video demo: http://www.mediafire...b5lhg1nvd5g4b61
Source code: https://github.com/a.../bass-vgmstream

Some technical data for anyone who might be interested:

A custom MIDIOUT.DLL dll should expose a C function GetMidiInterface that takes no parameters.
It should return a pointer to a MidiInterfaceClass:

class MidiInterfaceClass
{
public:
	virtual bool initialize(HWND hwnd) = 0; // hwnd = game window
	virtual bool load_song(unsigned char id, unsigned int bgmmode) = 0; // id = song to be played + 1 (well, +1 compared to the sound test id, it's the ID of the song in the MIDIOUT.DLL's resources); bgmmode = 0 for FM synth, 1 for General MIDI
	virtual bool play_song() = 0;
	virtual bool stop_song() = 0;
	virtual bool pause_song() = 0;
	virtual bool unpause_song() = 0;
	virtual bool set_song_tempo(unsigned int pct) = 0; // pct = percentage of delay between beats the song should be set to. lower = faster tempo
};


Just derive from that class and overwrite the virtual methods. The game doesn't notify you when the user closes it, which may cause a problem. I hooked WM_DESTROY to mitigate that.

Changelog
v1.3:
  • Added support for FLAC
  • Added fade-outs
  • Added error messages
  • Added config options: "FadeOutDuration" & "ShowErrorMessages"

v1.2 (not a critical upgrade, just more formats and bloat):
  • Now using vgmstream to play a large number of game music formats: 2dx, aax, acm, adpcm, aix, adp, ads, adx, afc, ahx, aifc, agsc, amts, as4, asd, asf, ast, asr, ass, aud, aus, baka, bh2pcm, bg00, bgw, bmdx, brstm, brstmspm, ccc, cfn, cnk, dcs, de2, dsp, dtk, dvi, dxh, eam, emff, enth, classy gentleman, filp, fsb, gbts, gca, gcm, gcw, genh, gms, gsb, hgc1, hps, hwas, idvi, idsp, ikm, ild, int, lps, isd, ivaud, ivb, joe, kces, kcey, kraw, leg, lwav, logg, matx, mcg, msvp, mwv, mi4, mib, mic, mihb, mpdsp, mus, musc, musx, mss, ndp, npsf, nwa, omu, p2bt, pcm, pnb, pos, psh, psw, raw, rkv, rnd, rrds, rsd, rsf, rstm, rwar, rwav, rws, rwsd, rwx, rxw, sad, sap, sd9, sdt, seg, sfl, sfs, sl3, sli, smp, snd, sng, spd, sps, spsd, spw, ss2, ss3, ss7, stma, str, strm, sts, ssm, svag, svs, swav, swd, tec, thp, tk5, tydsp, um3, vag, vas, vb, vig, vgs, vpk, vs, vsf, waa, wac, wad, wam, wavm, wii, wp2, wsd, wsi, wvs, xa, xa2, xa30, xmu, xsf, xss, xvas, xwav, xwb, ydsp, ymf, zsd & zwdsp
  • Added "IgnorePauseCommands" config option

v1.1:
  • Using static linking for the VC++ runtime now. This should avoid problems where people do not have the MSVC++ 2010 runtime installed (msvcr100.dll) as it is built into the program.
  • General support for looping tracks
  • Fixed a bug where an event track would loop like normal music
  • Fixed a bug where tracks did not report to the game that they have finished playing and need the music to kick back in

This post has been edited by angryzor: 10 May 2014 - 11:02 AM

#2 User is offline nineko 

Posted 16 April 2011 - 02:55 AM

  • I am the Holy Cat
  • Posts: 5341
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
This... this... just... wow :O

#3 User is offline LordOfSquad 

Posted 16 April 2011 - 10:14 AM

  • don't get butthurt if your get memed on
  • Posts: 4056
  • Joined: 19-February 08
  • Gender:Male
  • Location:Winnipeg, MB
  • Project:Scriptwriting, working, dying.
  • Wiki edits:1
This is perfect. Now I can use that Sonic R3masters thing I did in game. Thanks a lot, man!

#4 User is offline MarkeyJester 

Posted 16 April 2011 - 10:59 AM

  • Clouded in obscurity.
  • Posts: 1595
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Ahh interesting, so we'll start seeing PC S3K hacks with full quality music? I have no rejections to this, fabulous work! =)

Also welcome to Retro =P

#5 User is offline MainMemory 

Posted 16 April 2011 - 11:10 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
This is very nice, although I'd like to see support for looping music, either by intro and loop files, or a format which supports looping (like ADX).

I'd also like to see a disassembly or decompilation of the original MIDIOUT.DLL for the SVN, if you have one.

#6 User is offline angryzor 

Posted 16 April 2011 - 05:01 PM

  • Posts: 27
  • Joined: 14-April 11
  • Gender:Male
  • Project:S&KC HQ Music
QUOTE (LordOfSquad @ Apr 16 2011, 05:14 PM)
This is perfect. Now I can use that Sonic R3masters thing I did in game. Thanks a lot, man!

My pleasure!

QUOTE (MarkeyJester @ Apr 16 2011, 05:59 PM)
Ahh interesting, so we'll start seeing PC S3K hacks with full quality music? I have no rejections to this, fabulous work! =)

Also welcome to Retro =P

Well, I certainly hope so, and thank you!

QUOTE (MainMemory @ Apr 16 2011, 06:10 PM)
This is very nice, although I'd like to see support for looping music, either by intro and loop files, or a format which supports looping (like ADX).

I'd also like to see a disassembly or decompilation of the original MIDIOUT.DLL for the SVN, if you have one.

Ok, I'll see what I can do to add looped music. I'll start out with the ADX approach, and will add multi-file loops if it doesn't mess up my code too much.
Looping MODs work already, by the way.

I have a disassembly. Didn't delve too deep into it as I only needed to know how it interfaces with the main program, but I did identify a fair amount of the functions.
It's an IDA 5.5 database, I hope that works for you: http://www.mediafire.com/?4axpk6oy3waytb3.

#7 User is offline Naean 

Posted 16 April 2011 - 05:06 PM

  • Avid Drawer & I.C.T. Enthusiast
  • Posts: 353
  • Joined: 25-February 09
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic The Hedgehog 5
  • Wiki edits:24
Is the SnKC HD Audio.rar file download working? I cannot get it to download, even though I can download other files from MediaFire....

#8 User is offline angryzor 

Posted 16 April 2011 - 05:07 PM

  • Posts: 27
  • Joined: 14-April 11
  • Gender:Male
  • Project:S&KC HQ Music
QUOTE (Naean @ Apr 17 2011, 12:06 AM)
Is the SnKC HD Audio.rar file download working? I cannot get it to download, even though I can download other files from MediaFire....

Works perfectly here... Try http://node.angryzor.com/~rtytgat/SnKC HD Audio.rar
This post has been edited by angryzor: 16 April 2011 - 05:09 PM

#9 User is offline Naean 

Posted 16 April 2011 - 05:42 PM

  • Avid Drawer & I.C.T. Enthusiast
  • Posts: 353
  • Joined: 25-February 09
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic The Hedgehog 5
  • Wiki edits:24
QUOTE (angryzor @ Apr 16 2011, 11:07 PM)
QUOTE (Naean @ Apr 17 2011, 12:06 AM)
Is the SnKC HD Audio.rar file download working? I cannot get it to download, even though I can download other files from MediaFire....

Works perfectly here... Try http://node.angryzor.com/~rtytgat/SnKC HD Audio.rar

MediaFire download works fine for me now; I don't know why it wasn't working before. Thanks anyway! smile.png

#10 User is offline Naean 

Posted 16 April 2011 - 06:21 PM

  • Avid Drawer & I.C.T. Enthusiast
  • Posts: 353
  • Joined: 25-February 09
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic The Hedgehog 5
  • Wiki edits:24
Wow, this is fucking awesome. Brilliant work man, seriously. This is a really kick ass tool.
This post has been edited by Naean: 16 April 2011 - 06:30 PM

#11 User is offline ValleyBell 

Posted 17 April 2011 - 03:59 AM

  • Posts: 204
  • Joined: 08-September 10
  • Gender:Male
  • Project:researching SMPS sound drivers
  • Wiki edits:10
Great work! I just played Hydrocity with the Hydropolis Zone music from Sonicesque II and it works very well.
I was even able to swap the songs while the game was running.

#12 User is offline SonicVaan 

Posted 17 April 2011 - 04:54 AM

  • The probably one and only cybergoth in this community. '_'
  • Posts: 378
  • Joined: 16-May 08
  • Gender:Male
  • Location:Germany, Cologne
  • Project:Betatesting, Various hacking projects, programming synthesizers, music production
  • Wiki edits:52
Uhh, I don't seem to get it work. I have done the stuff which has been mentioned in the readme. But it doesn't work.
Anyone mind explaining it to me, please? =P

#13 User is offline Peruant 

Posted 17 April 2011 - 09:00 AM

  • Just dropping in through gaps
  • Posts: 250
  • Joined: 02-September 07
  • Gender:Male
  • Location:Paterson , New Jersey
  • Project:College
QUOTE (SonicVaan @ Apr 17 2011, 04:54 AM)
Uhh, I don't seem to get it work. I have done the stuff which has been mentioned in the readme. But it doesn't work.
Anyone mind explaining it to me, please? =P


Try renaming the song file to something short. I had to rename mine for it to work.

#14 User is offline angryzor 

Posted 17 April 2011 - 09:03 AM

  • Posts: 27
  • Joined: 14-April 11
  • Gender:Male
  • Project:S&KC HQ Music
QUOTE (SonicVaan @ Apr 17 2011, 11:54 AM)
Uhh, I don't seem to get it work. I have done the stuff which has been mentioned in the readme. But it doesn't work.
Anyone mind explaining it to me, please? =P

If Peruant's suggestion doesn't work, please post as much info as you can about how you're using it (screenshot of your game/songs folder, content of the ini, ...)

QUOTE (Peruant @ Apr 17 2011, 04:00 PM)
QUOTE (SonicVaan @ Apr 17 2011, 04:54 AM)
Uhh, I don't seem to get it work. I have done the stuff which has been mentioned in the readme. But it doesn't work.
Anyone mind explaining it to me, please? =P


Try renaming the song file to something short. I had to rename mine for it to work.

This isn't normal... What name did it have originally?

#15 User is offline Peruant 

Posted 17 April 2011 - 09:27 AM

  • Just dropping in through gaps
  • Posts: 250
  • Joined: 02-September 07
  • Gender:Male
  • Location:Paterson , New Jersey
  • Project:College
Well I'm running into the same problem as Vaan is now. Guess I only got Angel Island Act 1 to work.

edit: Weird. It's picky with certain songs then it'll work and the filename didn't have to be shorten.
This post has been edited by Peruant: 17 April 2011 - 09:53 AM

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last ►
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users