USF Frequently Asked Questions

I never really understood what "frequently asked" meant until I started getting the same email, phrased slightly differently, again and again... Here's a "best of hcs tech support" listing.
Q: Something isn't working! There's a bug in 64th Note! Waaah!
A: First, are you running the latest version of 64th Note? As of 12/24/08 the latest version is v1.2 beta 3.

Second, is Audio HLE enabled? If so you may be trying to play a USF that isn't properly supported, go to the configuration for 64th Note and disable this and see if that fixes the problem.

Third, is Auto Audio HLE enabled? Try disabling it and see if it fixes the problem. If it does, please let me know, this is actually an error and should be corrected.

Fourth, are you using an output plugin other that Nullsoft's DirectSound or WaveOut, or a media player other than Winamp? If so try enabling "Round Frequency" in the 64th Note configuration. Even with this set some output plugins are buggy and will crash of thier own accord.

If you've tried all these and still no success, read through the rest of this FAQ, then you can contact me.
Q: Why haven't you ripped [insert game name here]? It's got great music!
A: I have a finite amount of time to spend on USF ripping (and I spend far more than I should already), so there's only so many games I can even attempt, and those that appear too difficult (Donkey Kong...) might be pushed aside in favor of those that I can get done quickly.
Q: I installed 64th Note, downloaded a zipped USF archive right from your site, and tried to play the files, but it isn't working!
A: While I'm sure this isn't the only reason for this problem it's the most common:
The individual tracks are miniUSF files, which do not contain all the data for that particular song. The USFlib file contains the bulk of a song's data. When you download an archive containing miniUSFs and a USFlib and you simply try to play the tracks right from the archive 64th Note can't find the USFlib (since it is still in the archive, unextracted). You must extract all the file in the .ZIP to the same directory, then the miniUSFs should play.
Q: [track] doesn't sound quite right...
A: Occasionally tracks will be missing intros or be played at the wrong tempo. This is due to the fact that I rip from a single point in the game and simply fill in different values for the song that is playing. There are other factors that go into determining what is currently playing than simply the song number and my ripping process might miss those other bits.
Q: Will you fix this?
A: No. Maybe someone else will.
Q: What's with [insert preliminary rip name here]? Does it need tags and timing? Why isn't it online?
A: Firstly, in just about every case if a game is listed as "preliminary rip complete" the preliminary rip will be available here, possibly with some tagging and timing info.
Secondly, these sets have not yet been officially "released", that is the ripper is not yet satisfied with them. Some people are perfectionists. The USF might not be fully optimized, or it may have some imperfections, or a decent set of tags and times aren't available yet.
For reference here is the status, as of 3/20/06, and to the best of my knowledge, of the currently listed incomplete sets:
64 Trump Collection ?
AeroGauge newly released, no tags yet
Automobili Lamborghini ?, no tags
Banjo Kazooie some tracks play multiple versions of the same track at once and someone42 doesn't want to release it until that's done with
Banjo Tooie same multiple version issues as BK
BattleTanx ?
Blues Brothers 2000 may be incomplete and inefficient
Body Harvest If I get tags for this I'll release it. This was the first generic driver rip and so far the most successful, I think.
Bomberman 64: The Second Attack ?, tagless
Buck Bumble awaiting timing
Bust-A-Move '99 player bug fixed in 64th Note 1.0, now just waiting for tags?
Carmageddon 64 ?
Castlevania 64 unoptimized
Castlevania 64 - Legacy of Darkness unoptimized, part of this is that it contains tracks from the previous version which should be removed
Conker's Bad Fur Day Josh finally got this one ripped, still a bit experimental, though.
Cruisin' World ?
Donkey Kong 64 ?
Doom 64 ?
Duke Nukem: Zero Hour too much CPU
Dynamix - congrats split demo ?
Dynamix First N64 Intro no interest in a final release? some player problems
Earthworm Jim 3D some sound quality issues
Eikou no St Andrews no interest in a final release?
Fire Electric Pen unoptimized
Getter Love!! Cho Renai Party Game tagging in progress
Hybrid Heaven possibly incomplete
John Romero's Daikatana one track crashes just before end
Killer Instinct Gold reripped since the generic driver experiment, now only awaits tagging (already partially tagged)
Kirby 64 - The Crystal Shards Josh recently added an optimized version
lacmod demo completely unoptimized
Lode Runner 3D needs times
Mace - The Dark Age (generic rip) awaiting tags, further testing
Mario Golf tagging in progress
Megaman 64 tagged, the possibility exists for including certain streamed tracks
Mission: Impossible ?
Mortal Kombat 4 awaiting tags, optimization(?)
Nintama Rantarou 64 (generic rip) awaiting tags, testing
Onegai Monsters no tags, some glitches?
Pocket Monsters Stadium awaiting tags
Pokemon Stadium 2 tagging in progress, possibly incomplete
Quake 64 ?
Rayman 2 unoptimized
Robotech Crystal Dreams could use some optimization
Sim City 2000 needs tags
Snowboard Kids takes up too much CPU
Top Gear Overdrive ?
Turok 3: Shadow of Oblivion ?, needs tags
Wipeout 64 ?
Q: I'm a musician and I'd really like the samples from [game], can you get them from the USF?
A: Not directly, however I recommend that you give srip a try, it can rip the samples from a lot of N64 games.
Q: Why do I get "what's in code" errors?
Short Answer: Get a new version of the USF set from a reputable mirror (such as one listed on USF Central).

Long Answer: there was a change in the USF format around the time I started numbering the versions 0.xx instead of build xx, and this reflected what I though of as the transition into the final stage of the USF format. The change was made to reflect a complaint by Neill Corlett that the "code" section of a PSF should be valid zlib compressed data, and my noncompliance might cause inoperability with some PSF tools, which are supposed to be (and are, thanks to Neill's foresight) universal. As I genuinely didn't want to incorporate zlib compression into USF I used the fact that the "reserved" section has no restrictions on the format of its data, so I put all of the data in this section (formerly in a USF the ROM was in code and the save state was in the reserved section).

By this time, unfortunately, I had released early versions of my USF sets and 64th Note, so the obsolete player and sets were distributed to some extent. Now I could have easily added support to new versions of 64th Note to support the "old" format, but I preferred to strictly support the new, "official" version. My mistake was to provide a useless error message when an old-style file was encountered, "What's in code" is generated when the USF parser finds any data in the "code" section. The error really should read "You may be using an ancient USF, get a newer version."

Q: How can I rip USFs?
Short answer: I really, really hate to discourage anyone, but the truth is that I can barely understand the process myself, much less explain it. All the other rippers you've seen already had experience with PSF rippping or N64 hacking. I really can't even point you to anything to learn short of saying "study MIPS assembly and start hacking games".

Old official answer: Ripping USFs is a nontrivial task. The gist of it is you fiddle with an N64 ROM until you get it doing nothing but playing music, then you run it through a series of utilities I've written to remove unused data. A useful tool is the Interactive Disassembler (IDA). You can use SIG files for the N64's standard library, libultra to aid you in navigating N64 ROMs with IDA, or you can generate your own based on other libraries you might have with my N64 OBJ to PAT parser. I've also assembled a Project 64 Save State Loader for IDA which often makes analysis eaiser.

Alternate, longer answer: I've put together a walkthrough of how I ripped Killer Instinct Gold that might be helpful, learn more here.

Here's what I wrote to someone to try to describe the ripping process that I use:

I look for anything that I know might be related to music. For example in Majora's Mask I knew that there had to be a routine in the intro (where it tells the backstory) to start playing that music, so I looked for the into text, then looked for the routine that read the intro text, then worked backwards until I found the intro function, then looked through that for something that looked like a music select function. Music modifiers are useful, too, but they'll still only give you a place to start looking. When a game uses the standard audio library you can start by looking for references to al functions that have the word "Seq" (for sequence) in them. Another method involves searching for a thread that handles audio (Mario 64, for example, had only two main threads, audio and video (and a "gameplay" thread), most games are much more complicated) and looking for stuff that affects that, in Mario 64's case I made a modification to Project 64 to record all variables that the audio thread read and that helped me find what I was looking for. Threads can be found by looking for calls to osCreateThread, the a2 argument is the address of the body of the thread.

One obstacle I encounter frequently is that games generally don't have a direct connection between the song select function and the functions that actually load the music. There is generally a queue where commands to play sound effects, change volume, and play music are written to. There will be a bunch of functions that write to this, usually through a single main function that actually does the writing, and a single big function to read it, which generally uses a jump table (which has a way of screwing up automated analysis such as that done by IDA).

In my experience every game has had a single function to start playing a song, it generally takes the song number as a0 or a1. If I locate a function that I think is this I modify Project 64 so that when it hits that function it will display the arguments with a line like the following in ExecuteInterpreterOpcode:

if (PROGRAM_COUNTER==whateveraddress) DisplayError("a0: %08x a1: %08x",GPR[4].UW[0],GPR[5].UW[0]);

I then run the game and see if there is any correspondence between when songs change, what they change to, and the value of the arguments. If there seems to be a pattern I'd force the argument to a certain value and see if by doing so I can fix the song being played.

Once I've located a song select function I pretty much look for the very first time it is called, usually in a game's intro, and I try to disable everything else from running. This takes various forms: I can try to disable non-audio threads by removing their loop commands (usually an unconditional branch), change the audio thread to use a nonblocking osRecvMesg (a2 parameter is 1, I believe, either that or 0) so that it won't yield control to other threads, or I can go about removing function calls that don't affect the music.

From then on it's easy :)

For most of this analysis it will be inifnitely helpful to have IDA Pro, if you've looked through someone42's document you'll know how to find it. The .sig files for the N64 libs go in the sigs/mips subdirectory.

Maybe that'll give you someplace to start...

Q: Is an automated USF ripper or logger possible?
I don't think it could ever be fully automated (like Saptapper), but as a good many games use the standard Smashy driver it may be possible to isolate that driver and insert the data from individual games without having to go through all the deprogramming for each one. I've attempted to do this, but it seems that games use such varied methods of accessing the driver that a general purpose ripper is impractical.

As for a logger I don't know, its hard enough to tell what's needed when you're looking at the code, just logging what's relied on for music would be very difficult if you don't want monstrously huge files (think GYM). I delibrately didn't go that direction with USF.