Brsar player Wii Channel by jurassicPieter at 1:13 PM EDT on September 11, 2009
I found something out that might make it possible to make a brsar player channel on your wii: the final fantasy crystal chronicles: my life as a king has lots of *.nut files. These files are plaintext script files and they also contain initializing game code, including loading graphics, menu's, and the brsar containing the music.
My attempt will be this: 1. remove all scripts which are not sound related. 2. write a new script that says to play a sequence in the brsar. 3. rebuild the wad-file. 4. install the wad file on your wii.
First tests done after figuring out how to rebuild a wad file. I changed the code to play a random sequence file of final fantasy crystal chronicles my life as a king and it works perfectly. Now let's see if i can change the brsar that is being used and pruning the scripts to sound related only.
by snakemeat at 11:37 PM EDT on September 11, 2009
Re: by jurassicPieter at 10:43 AM EDT on September 13, 2009
ok, i tried to prune the scripts as much as possible, but it seems to be more challenging than expected. Any mistake leads to a black screen and the home and reset button not responding and rebuilding the wad and installing it again on the wii is slow.
I changed the brsar for the brsar of the wii fit channel and changed the script to play a random sequence. And guess what? It plays perfectly! Now I need to find a way to edit the menu so i can make a sequence select. :)
Cool! So what mistakes were keeping it from working before?
Re: by jurassicPieter at 11:04 AM EDT on September 14, 2009
Well, if you make one script mistake the wad doesn't run at all with no error shown, so it's just time consuming to make a single change, uninstall old wad, create new wad, upload wad with ftpii to wii and then reinstall new wad.
I should check what happens if I turn on debug mode. There seems to be code for a developer menu.
All sound effects and sequences are numbered from 0 to whatever and sound effects can be played too as a bgm. Only problem I could see is replacing it with brsar's that are made in a newer version.
Plus the only thing not scripted is the start up screen and the home button menu. If you remove graphics you remove the start up screen too, so i'm stuck with a 45mb wad instead of a 1,5 mb wad for now.
by Camo Yoshi at 4:59 PM EDT on September 15, 2009
Code for developer menu is to hold down - and + when turning on the Wii.
Ok, i have changed the script and you can change the music with up and down on the d-pad.
I tested several brsar's and sadly brsars from wii disc games don't play, only channels play. It could have something to do with that ffcc life as a king only has one player object in its brsar or that the references to streams are failing.
Also i don't have enough space on my wii to test super smash bros brawl. The brsar is too big.
Might be the single player issue, could also be different brsar versions. Do the other games you try have the same version id, and can you find one with only one player?
could also use life as landlord. The game uses the same scripting. I also think it's easier to prune that game from it's graphics.
Working: System Menu(it has the virtual console, invalid disc and the gamecube channel jingle) FF CC: Life as a king (Duh) Mario Kart Channel Wii Fit Channel
Not working: animal crossing city folk big brain academy wii edition big brain academy wii edition revosamplesound.brsar(brsar_unpack and ripping_mama crash on this one and looking at the contents with hex editor it seems part of the wii sdk) mario kart wii super smash bros. brawl (too big) wii play - tanks minigame wii play - billiars minigame wii fit wii sports resorts wii sports resorts - motion plus movie
Seems very likely channels play and games don't. Especially if you look at mario kart wii and wii fit.
BTW: the wad generated runs in dolphin, but my computer is too slow for wii emulation, so the sound is very very choppy.
by arbingordon at 10:16 AM EDT on September 21, 2009
any chance of porting this script into a winamp plugin or something?
any idea how i can send the wads? because basically it's nothing more than a ff:cc life as a king mod. At least it allows us to record all sequences with line in without sound effects. I also think cd brsar's don't play because wiiware games and channels use a lesser advanced player to reduce file size. Other sound libraries i worked with use the same.
So my hope is FF:CC Crystal Bearers uses the same scripting system. Then all i have to do is get usb loader active to test it out.
I checked FF:CC Echoes of Time Wii version, but the game uses just a brsar with a sdat extension(talking about a cheap ds hack) And downloading Chocobo Dungeon to see if it uses the same scripting.
Good news! by jurassicPieter at 4:38 AM EDT on October 1, 2009
good news(and bad news) bad news: -no other game uses the same scripting system used in ff cc life as a king. -a WII/gamecube xSF file is challenging when reading dolphin's source code. To me it seems easier to make a format similar to spc that it logs all dsp messages.
good news: -after compiling dolphin myself dolphin plays the brsar player channel I made and the music plays perfectly! -to figure out why some brsars don't play i worked on a brsartool similar to sdattool. So far i made the extractor that extracted the rseq, rbnk, rwav, etc. -Now making a rebuilder. I will make it more oop, basing it on the brsarunpacker source code.
jurassicPieter said: -a WII/gamecube xSF file is challenging when reading dolphin's source code. To me it seems easier to make a format similar to spc that it logs all dsp messages.
Yes, this comes as no surprise. Why do you think we have VGM (Genesis/Gamegear, others) instead of xSF for those systems? Yes it's easier to log the data sent to the APU(s?), but generally, that's not something that's wanted. One major limitation of logging the data, is that it doesn't loop. Sure, you can loop it the way they do VGMs, but it's not the real loop point.
Also, another problem with logging the data, as opposed to using the actual in-game data, is that you can't "re-insert" that logged data into the game, or play it on original hardware (all xSF files/formats can be played on original hardware, excluding USF, because USF uses savestates to bypass the N64 initialization code, IIRC). I could be mistaken on that, but as far as I know, VGMs can't be played on original hardware.
Something else about logging the data, is that you end up with larger files than if it were ripped. Look at VGMs. They're often larger than they "need" to be. Meaning, that if they were ripped, they'd be a few KBs in size, instead of MBs. I realize that size is rarely an issue for most people these days, but I like to keep it in the forefront any way. It helps with efficiency.
I'm sure there are others who would like to join this discussion, but what it all really comes down to is this: Whoever does the work makes the choices. So, even though I may not like logged formats, I really don't have much say in the matter. I'm not going to be doing the work on this one. Nonetheless, I figured I should throw in my two cents while the opportunity presents itself. Mouser X over and out.
Glad to hear you're making progress on brsar tools, jurassicPieter! I share some of Mouser's concerns about logging, but I'm really in no position to complain as designer of one of the worst-designed non-logging emulated sound formats. With luck someone will be able to extract out the sequence player code as is commonly done in PSF and use the particular version needed in each game.
I share the concern about logging too. But when i look at the way how Dolphin is coded(most recent version preloads 1 block of 1 gig of memory for speed to start with and this fails a lot on many computers), logging seems to be better. Or at least make an elf file that plays it in gamecube mode, since the wii coding relies heavily on hacks. But i have no experience in creating or patching elf files so far.
When looking at the brsar file format making a perfectly working extractor and builder was a bit ambitious. Zero out sound effects and appending RSEQ files and changing the offsets should be doable.
I figured out the RSEQ format already. It seems to be almost the same as Nintendo DS SSEQ, except there's a LABL chunk added with labels indicating they added SSAR-like functionality in RSEQ.
RSEQ2MIDI.exe should be very likely to work. :D
edited 10:19 AM EDT October 5, 2009
edited 8:36 AM EDT October 6, 2009
RSEQ2MIDI first result by jurassicPieter at 1:43 PM EDT on October 6, 2009
Here's the result of RSEQ2MIDI when i tested it on the RSEQ containing the Hammer BGM of Super Smash Bros. Brawl. It's so close to SSEQ!
C:\Documents and Settings\Eigenaar\Bureaublad\rseq>rseq2midi "316.RSEQ" Signature: RSEQ Magic Code: feff Version: 1 File size: 384 Header size: 32 Chunk Count: 2 Subchunk DATA Subchunk LABL Sequence data: 000000a0 to 0000002c 0 SMF_ITEM_HAMMER_Begin 0 0 00000000 Mono/Poly Poly (0) 00000002 Change Tempo-19712 00000005 Program Change 1=1,0,0 00000007 Volume 120 00000009 Note with Duration C 3 [48] vel:110 dur:10 0000000c Rest 24 0000000e Note with Duration C 3 [48] vel:110 dur:10 00000011 Rest 12 00000013 Note with Duration C 3 [48] vel:110 dur:10 00000016 Rest 12 00000018 Note with Duration C 3 [48] vel:110 dur:10 0000001b Rest 24 0000001d Note with Duration C 3 [48] vel:110 dur:10 00000020 Rest 24 00000022 Note with Duration E 3 [52] vel:110 dur:10 00000025 Rest 24 00000027 Note with Duration C 3 [48] vel:110 dur:10 0000002a Rest 24 0000002c Note with Duration E 3 [52] vel:110 dur:10 0000002f Rest 24 00000031 Note with Duration C 3 [48] vel:110 dur:10 00000034 Rest 24 00000036 Note with Duration E 3 [52] vel:110 dur:10 00000039 Rest 24 0000003b Note with Duration E 3 [52] vel:110 dur:10 0000003e Rest 12 00000040 Note with Duration E 3 [52] vel:110 dur:10 00000043 Rest 12 00000045 Note with Duration E 3 [52] vel:110 dur:10 00000048 Rest 24 0000004a Note with Duration E 3 [52] vel:110 dur:10 0000004d Rest 24 0000004f Note with Duration G 3 [55] vel:110 dur:10 00000052 Rest 24 00000054 Note with Duration E 3 [52] vel:110 dur:10 00000057 Rest 24 00000059 Note with Duration G 3 [55] vel:110 dur:10 0000005c Rest 24 0000005e Note with Duration E 3 [52] vel:110 dur:10 00000061 Rest 24 00000063 Jump to 00000009 00000068 End of track 1 SMF_ITEM_HAMMER_End 104 0 00000000 End of track 2 SMF_ITEM_HAMMER_Start 0 0 00000000 Mono/Poly Poly (0) 00000002 Change Tempo-19712 00000005 Program Change 1=1,0,0 00000007 Volume 120 00000009 Note with Duration C 3 [48] vel:110 dur:10 0000000c Rest 24 0000000e Note with Duration C 3 [48] vel:110 dur:10 00000011 Rest 12 00000013 Note with Duration C 3 [48] vel:110 dur:10 00000016 Rest 12 00000018 Note with Duration C 3 [48] vel:110 dur:10 0000001b Rest 24 0000001d Note with Duration C 3 [48] vel:110 dur:10 00000020 Rest 24 00000022 Note with Duration E 3 [52] vel:110 dur:10 00000025 Rest 24 00000027 Note with Duration C 3 [48] vel:110 dur:10 0000002a Rest 24 0000002c Note with Duration E 3 [52] vel:110 dur:10 0000002f Rest 24 00000031 Note with Duration C 3 [48] vel:110 dur:10 00000034 Rest 24 00000036 Note with Duration E 3 [52] vel:110 dur:10 00000039 Rest 24 0000003b Note with Duration E 3 [52] vel:110 dur:10 0000003e Rest 12 00000040 Note with Duration E 3 [52] vel:110 dur:10 00000043 Rest 12 00000045 Note with Duration E 3 [52] vel:110 dur:10 00000048 Rest 24 0000004a Note with Duration E 3 [52] vel:110 dur:10 0000004d Rest 24 0000004f Note with Duration G 3 [55] vel:110 dur:10 00000052 Rest 24 00000054 Note with Duration E 3 [52] vel:110 dur:10 00000057 Rest 24 00000059 Note with Duration G 3 [55] vel:110 dur:10 0000005c Rest 24 0000005e Note with Duration E 3 [52] vel:110 dur:10 00000061 Rest 24 00000063 Jump to 00000009 00000068 End of track 3 SMF_ITEM_HAMMER_Track_0 0 0 00000000 Mono/Poly Poly (0) 00000002 Change Tempo-19712 00000005 Program Change 1=1,0,0 00000007 Volume 120 00000009 Note with Duration C 3 [48] vel:110 dur:10 0000000c Rest 24 0000000e Note with Duration C 3 [48] vel:110 dur:10 00000011 Rest 12 00000013 Note with Duration C 3 [48] vel:110 dur:10 00000016 Rest 12 00000018 Note with Duration C 3 [48] vel:110 dur:10 0000001b Rest 24 0000001d Note with Duration C 3 [48] vel:110 dur:10 00000020 Rest 24 00000022 Note with Duration E 3 [52] vel:110 dur:10 00000025 Rest 24 00000027 Note with Duration C 3 [48] vel:110 dur:10 0000002a Rest 24 0000002c Note with Duration E 3 [52] vel:110 dur:10 0000002f Rest 24 00000031 Note with Duration C 3 [48] vel:110 dur:10 00000034 Rest 24 00000036 Note with Duration E 3 [52] vel:110 dur:10 00000039 Rest 24 0000003b Note with Duration E 3 [52] vel:110 dur:10 0000003e Rest 12 00000040 Note with Duration E 3 [52] vel:110 dur:10 00000043 Rest 12 00000045 Note with Duration E 3 [52] vel:110 dur:10 00000048 Rest 24 0000004a Note with Duration E 3 [52] vel:110 dur:10 0000004d Rest 24 0000004f Note with Duration G 3 [55] vel:110 dur:10 00000052 Rest 24 00000054 Note with Duration E 3 [52] vel:110 dur:10 00000057 Rest 24 00000059 Note with Duration G 3 [55] vel:110 dur:10 0000005c Rest 24 0000005e Note with Duration E 3 [52] vel:110 dur:10 00000061 Rest 24 00000063 Jump to 00000009 00000068 End of track 4 SMF_ITEM_HAMMER_Track_0_LoopStart 9 0 00000000 Note with Duration C 3 [48] vel:110 dur:10 00000003 Rest 24 00000005 Note with Duration C 3 [48] vel:110 dur:10 00000008 Rest 12 0000000a Note with Duration C 3 [48] vel:110 dur:10 0000000d Rest 12 0000000f Note with Duration C 3 [48] vel:110 dur:10 00000012 Rest 24 00000014 Note with Duration C 3 [48] vel:110 dur:10 00000017 Rest 24 00000019 Note with Duration E 3 [52] vel:110 dur:10 0000001c Rest 24 0000001e Note with Duration C 3 [48] vel:110 dur:10 00000021 Rest 24 00000023 Note with Duration E 3 [52] vel:110 dur:10 00000026 Rest 24 00000028 Note with Duration C 3 [48] vel:110 dur:10 0000002b Rest 24 0000002d Note with Duration E 3 [52] vel:110 dur:10 00000030 Rest 24 00000032 Note with Duration E 3 [52] vel:110 dur:10 00000035 Rest 12 00000037 Note with Duration E 3 [52] vel:110 dur:10 0000003a Rest 12 0000003c Note with Duration E 3 [52] vel:110 dur:10 0000003f Rest 24 00000041 Note with Duration E 3 [52] vel:110 dur:10 00000044 Rest 24 00000046 Note with Duration G 3 [55] vel:110 dur:10 00000049 Rest 24 0000004b Note with Duration E 3 [52] vel:110 dur:10 0000004e Rest 24 00000050 Note with Duration G 3 [55] vel:110 dur:10 00000053 Rest 24 00000055 Note with Duration E 3 [52] vel:110 dur:10 00000058 Rest 24 0000005a Jump to 00000009 0000005f End of track
Resume of the project. I tested it on all the wii channels and a homebrew called wad creator to make wads of all my channels.
Working ff:cc life as a king ff:cc life as a landlord ff:cc life as a landlord demo internet channel mario kart channel nintendo channel pokémon rumble demo wii fit channel wii fit plus channel wii shop channel wii speak channel(except the bns file inside) wii system menu
Freezes before 'put strap on' message check mii out forecast channel mii channel news channel photo channel today&tomorrow channel all brsar's from wii iso's
Freezes when playing first song Bit.trip beat demo
and the first downloads of the wads: part 1 part 2 once you start the wad in Dolphin or if you start the channel on a softmodded PAL wii, you can use up and down on the wii remote to switch songs and use right to fade out the song. Already recorded several sequenced songs.
My next tryout is editing brsar's and inject RSEQ files in it. For that i modified the mario kart channel brsar and added 1 mb of zeroes in the file chunk where i try to fill in files, banks and sequences from different brsars. I chose the mario kart channel one because it's not too big. For example the first RSEQ sequence starts at 0x3A40 and in the INFO block there's one occurence of 0x3A40. Big chance that is the offset of the RSEQ in the info block.
edited 3:13 AM EST January 19, 2010
Questions brsar rseq by Pyrominion at 9:23 AM EST on January 21, 2010
I'm new to posting on forums and do not want to sound ignorant or too straight forward, but ill risk sounding like a script kiddie. My main goal right now is to extract the sound clips from Animal Crossing: City Folk. The main file is rv_forest.brsar and when i opened it in a hex editor i saw rseq, rwav, etc.. I had originally tried brsar_unpack 0.0, ripping_mama and letsdump knowing that most, if not all of the files would not extract. To be exact nothing extracted. I am using linux ubuntu karmic as my OS. I know enough basic shell commands to navigate and compile and write basic shell scripts. The second problem im having is the software that is being updated to recognize brsar and rseq files are for winamp and linux does not like winamp at all even on wine. I googled brsar and rseq and only 3 forums came up that even mention them and only 2 know anything about them. jurassicPieter is the furthest along i have seen when it comes to extracting rseq from brsar files and converting rseq to midi. My question for jurassicPieter is how did you capture the rseq file? was it extracted or copied from hex? if extracted, with what and is it on linux? do you have source? and may i PLEEASEEEE have a copy of what you have to extract or convert them? thanks sorry for being so long
I was working on specs, but haven't completed the entire structure and i'm not familiar with soundbank file formats. Brsar's have an almost identical structure with nintendo ds sdat files. a brsar file contains 3 subchunks: SYMB, INFO and FILE. SYMB contains mainly readable ASCII symbols of all sound, group, bank and player entries. Player entries are programming specific and probably to pick the right callback function of the game for dynamic music(which is why the brsar player wii channel crashes on them). INFO contains information of sounds, banks and file entries FILE contains a a padding of 32 zeroes and then all raw file's archived uncompressed. Though there are some junk bytes sometimes in between not sure what their function is.
As for the raw subfiles now: RWAR is like SWAR. Haven't looked at it much, but it's just an archive of RWAV files all containing a single sound file compressed in GC/WII DSP. RWSD: no idea, maybe it's like STRM files in sdat files. RBNK=SBNK: haven't checked out yet RSEQ: did most research on that the midi decoding is almost similar as nds's SSEQ. It contains 2 subchunks: DATA and LABL. DATA contains all midi sequenced data. Sequenced data is like this. A byte lower than 128 is a note event and above 127 is a sequencer instruction(rest, goto, gosub, set tempo,etc.). Except for a few changes they are the same as the nds's specs(look for kiwi.ds). the LABL chunk contains a symbol table with readable text and it has an offset that tells where the sequenced data starts in the DATA chunk. Label names are like HAMMER_START HAMMER_END HAMMER_TRACK0 HAMMER_TRACK1, for RSEQ with a single sequence or an entire archive as DOG_BARK, DOG_SING, DOG_FOOTSTEPS(like SSAR files on the ds)
BTW the rv_forest.brsar doesn't work with the brsar wad player. It's too big for a wii channel anyway. I made a very experimental buggy midi winamp plugin that can decode RSEQ's, but it sounds awful without the proper soundbank. I tested it on rv_forest.brsar myself and heard Able Sisters quite well. i should put some steps back and make the conversions tool first i guess :)
Thank you by Pyrominion at 6:51 PM EST on January 21, 2010
Thanks alot for the info i will start reading up on what i can find. Now im headed in the right direction
RWAV and RWSD both have some minimal support in vgmstream. You can extract these from .brsars with snakemeat's vgmtoolbox, which I think just picks out the files without parsing the archive at all. I've had no big problems with Winamp 2.95 on wine, I test out the Winamp builds of vgmstream there regularly. If you can't get that to work, vgmstream should build fine for you in Linux, just go to the test/ directory and run make. You can also build the audacious plugin (though this may not work in Karmic) with: ./bootstrap && ./configure && make -f Makefile.unix && sudo make -f Makefile.unix install
Requires libmpg123, libvorbis, and audacious development packages, possibly others.
GOOD News! I'm getting closer to rewriting the source for sseq2mid but i had to test the program first. Now i included a build of sseq2mid using loveemu's source file for linux and the makefile here: Linux SSEQ2MID
I extracted an rseq file from a brsar file manually with a hex editor and ran it through my program and it starts similar to the song, then in sseq2mid hex 00 - 7f are notes and 80 is a rest then the rest after that are functions. part of the way clearly after the song starts there is 8a hex and for sseq2mid it is undefined. since 80 is definately rest it cant be part of the notation so it must be a function that needs to be defined. heres a link that describes it well for those intersted. SSEQ and heres rseq2mid for now it was change all three files terms to rseq from sseq and then define offsets for functions and tags and labels and size. If anyone has any info on offsets for rseq files please post them. I need to know the rseq size offset and the amount of bytes it is, 4,6, etc.
My first brsar test program was this http://www.mediafire.com/download.php?fo0zz2gnt4a Put a brsar file in the same map, rename it to sound.brsar and run the first batch file and the files will be extracted in /brsar/file. Not sure if the junk bytes in between have a purpose.
i did some decoding of RSEQ's and figured out the wii-specific events that are not available in the kiwi.ds specifics, but i never made a program that results in rseq2mid. I can fill in the list for you.
update: trying to figure out the entire brsar file format. It creates csv files of all entries and luckily all values are byte aligned to 4 bytes. This makes some values unintentionally little endian and confusing in the csv file.
SYMB table is 90% figured out now with only 2 unknown values per symbol entry and not sure why it's such a weird structure. Could be that i decoded it incorrectly and that the entire structure is a heap structure and that the 2 unknown values are heap-related. It would explain the counter which is always 2n+1 where n is the number of entries
INFO table i figured out only the entire bank entries and the entire player entries. Halfway through sound and file entries
bank entries structure: u32 symbol entry, u32 file entry,u32 zero
player entries structure: u32 symbol entry, u8 flags,u8 bytealignment[3], u32 zero the flags seem to be game related sadly, but the last one always is 0.