The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Emulation & ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
New threads in this forum are to be approved by a moderator before they are displayed. The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old October 8th, 2010, 09:12 AM
Spiky-Eared Pichu's Avatar
Spiky-Eared Pichu
NDS Hacker/Researcher
 
Join Date: Apr 2010
Location: Barcelona, Spain
Age: 19
Gender: Male
Nature: Calm
Send a message via Windows Live Messenger to Spiky-Eared Pichu Send a message via Skype™ to Spiky-Eared Pichu
The other day I found a webpage describing how NDS .sbnk files work, but only a bit of information of them. So I will write it here and if someone knows more we can make a fully-fledged hacking tutorial.

What we know currently:

  • .SBNK files are like SoundFonts, but they only have pointers to other files that contain the instrument waveforms.
  • .SBNK files define how an instrument is played (ex: pitch, notes, pan, etc)
  • Each instrument is composed of 20 bytes:
  1. 8 bytes of "Region". I don't know what does this do, but we know that some soundbanks have it while others no.
  2. 4 bytes of unknnown information. Its value is 0100 by default.
  3. 4 bytes that define which .swav to use. The bytes are the position of the file in numerical/alphabetical order.
  4. 4 bytes that define which .swar to use. The first 2 bytes are which .swar files are used and the other 2 are the position of the file in numerical/alphabetical order.
  5. 6 bytes that define the instrument's settings. The 6 bytes are: Note number, Attack rate, Decay rate, Sustain rate, Release rate and Pan.
This is the known information for now. I still need to figure WHERE is this data found inside the .SBNK and discover what the unknown bytes are.

Information source: jul.rustedlogic.net

If you find new information, please post it here and help!
__________________
"Hacking has no limits. Don't try anything, DO IT!"

Jump into DS hacking with SDSME!


Beta 2 available!!


Reply With Quote
  #2    
Old October 21st, 2010, 05:57 PM
Team Fail's Avatar
Team Fail
 
Join Date: May 2009
Age: 18
Gender: Male
Nature: Brave
Well, I know that VGMTrans can export them as .dls files. This tutorial can explain how to extract them, and this webpage explains what they are. If we can extract them as downloadable sounds, edit them and convert them back to .sbnk files and insert them, we could hack them. Just a thought.
__________________



Team Fail

Community Supporter Collab
☆ ☆ ☆


Reply With Quote
  #3    
Old October 23rd, 2010, 07:22 AM
Spiky-Eared Pichu's Avatar
Spiky-Eared Pichu
NDS Hacker/Researcher
 
Join Date: Apr 2010
Location: Barcelona, Spain
Age: 19
Gender: Male
Nature: Calm
Send a message via Windows Live Messenger to Spiky-Eared Pichu Send a message via Skype™ to Spiky-Eared Pichu
Quote:
Originally Posted by Team Fail View Post
Well, I know that VGMTrans can export them as .dls files. This tutorial can explain how to extract them, and this webpage explains what they are. If we can extract them as downloadable sounds, edit them and convert them back to .sbnk files and insert them, we could hack them. Just a thought.
Yes, I used the .dls files to remix Pokémon music. I tried to recompile it with hex, but I have the real trouble with the offsets. If we could have them, would be able to edit the instrument data.
__________________
"Hacking has no limits. Don't try anything, DO IT!"

Jump into DS hacking with SDSME!


Beta 2 available!!


Reply With Quote
  #4    
Old October 23rd, 2010, 07:54 AM
Team Fail's Avatar
Team Fail
 
Join Date: May 2009
Age: 18
Gender: Male
Nature: Brave
Quote:
Originally Posted by Spiky-Eared Pichu View Post
Yes, I used the .dls files to remix Pokémon music. I tried to recompile it with hex, but I have the real trouble with the offsets. If we could have them, would be able to edit the instrument data.
Ha. I see someone thinks like I do. FL Studio, no? Anyways, what offsets are you after? And what are they supposed to be for? Everything you may be looking for could be in the .sdat file.
__________________



Team Fail

Community Supporter Collab
☆ ☆ ☆


Reply With Quote
  #5    
Old October 23rd, 2010, 12:24 PM
Spiky-Eared Pichu's Avatar
Spiky-Eared Pichu
NDS Hacker/Researcher
 
Join Date: Apr 2010
Location: Barcelona, Spain
Age: 19
Gender: Male
Nature: Calm
Send a message via Windows Live Messenger to Spiky-Eared Pichu Send a message via Skype™ to Spiky-Eared Pichu
The data in a SBNK is organized in two parts:

1. A list of every instrument with the offset to its data.
2. The data of the instruments. This is where it's determined which wave to use, the volume, etc.

What we don't know is WHERE is the 1st part.
__________________
"Hacking has no limits. Don't try anything, DO IT!"

Jump into DS hacking with SDSME!


Beta 2 available!!


Reply With Quote
  #6    
Old October 30th, 2010, 09:35 PM
Team Fail's Avatar
Team Fail
 
Join Date: May 2009
Age: 18
Gender: Male
Nature: Brave
Well... I looked in my hard drive and found an old download.

*Nintendo Nitro SDK*

It MAY HELP, but I need to figure out how to use it.
__________________



Team Fail

Community Supporter Collab
☆ ☆ ☆


Reply With Quote
  #7    
Old November 2nd, 2010, 06:56 AM
Orengefox's Avatar
Orengefox
Sdat Novice
 
Join Date: Aug 2010
Location: Right in front of my computer.
Age: 29
Gender: Male
Nature: Lax
Before I begin, I just want thank you for sourcing the information I put together on jul.rustedlogic.net; it's an honor

At some point I'll be updating the NSMB Sound & Music Hacking Guide with some newer information regarding *.sbnk files. Although I'm not quite sure when, I'm more than happy to share it with you guys now seeing as we got a topic for it.

So we know that *.sbnk files define how an instrument is played (ex: pitch, notes, pan, etc) and that each defined instrument is composed of 20 bytes. This however isn't the case if it has what is called a "Region" in which case, the defined information is then composed of more than 40 bytes. For the defined information containing a "Region"; here's how it's structured:

1. The first 16 bytes is referred to as a "Region". These "Regions" only exist if the *.sbnk file wants to define more than one instrument for a particular channel within an *.sseq file. To get an idea of what I mean; say I pressed a single key on a Synthesizer which in turn plays a trumpet sound but instead of wanting to play just a trumpet sound on it's own, I tell the Synthesizer to play a trumpet and a clarinet sound at the same time for that single key. Well this is what an *.sbnk file is doing when it uses a "Region". Again, a "Region" will only exist if an *.sbnk file wants to to define more than one instrument for a particular channel within an *.sseq file.

2. The next 4 bytes of information which its value is 0100 by default will only exist if there is a "Region". This default value always appears before the actual 20 bytes of information which is the defined instrument. So if the "Region" is using two defined instruments, there will be two 0100 default values (one for each 20 bytes of information which is the defined instrument).

3. Finally we have the 20 bytes of information which defines the instrument. The first 4 bytes define which *.swav to use. The next 4 bytes define which *.swar to use. And finally, the last 12 bytes that define the instrument's settings. These always appear right after the 0100 default value assuming a "Region" is being used. If there is no "Region", then there is no 0100 default value before the actual 20 bytes of information which defines the instrument. In such cases where there is no "Region" in the information, the *.sbnk file defines how an instrument is played using just the actual 20 bytes of information alone.

If you want to locate certain bits of information within an *.sbnk file, my suggestion would be to use NDS Editor 0.1 (kiwi.ds). Load the NDS game onto the program, locate it's *.sdat file, upload the *.sdat file onto the program, pick an *.sbnk file you want to read, check/tick the box next to that *.sbnk file and click the "Dump Selected" button. It'll then create a *.txt with all the information contained in that *.sbnk file. You can even do this to *.swar files to see how many *.swav files it has and where. Same goes for *.ssar files if you want to know how many *.sseq files it's using and where.

Here's an example of an *.sbnk file that's been dumped using the NDS Editor 0.1 (kiwi.ds) and how it associates to the information you see using a Hex Editor. Hope all that made sense as well as being helpful
Attached Images
File Type: png SBNKFileDump1.png‎ (15.2 KB, 31 views)
File Type: png SBNKHEX1.png‎ (25.6 KB, 27 views)
__________________
NSMB DS Sound & Music Hacking Guide - An extensive guide on how to hack the sound & music to New Super Mario Bros DS.

NSMB DS Sound & Music Hack v1.4 - My latest New Super Mario Bros DS hack which contains different music and sounds.

Orengefox @ DeviantArt - My Deviant Art site which consists of all my general artwork.
Reply With Quote
  #8    
Old November 2nd, 2010, 08:17 AM
Spiky-Eared Pichu's Avatar
Spiky-Eared Pichu
NDS Hacker/Researcher
 
Join Date: Apr 2010
Location: Barcelona, Spain
Age: 19
Gender: Male
Nature: Calm
Send a message via Windows Live Messenger to Spiky-Eared Pichu Send a message via Skype™ to Spiky-Eared Pichu
Thank you, now we know more things. I'm trying to edit a .sbnk from Pokémon Diamond, but I'm facing two problems:

1. NDS Editor doesn't work for me. When I open a file it says "Could not open file". To get the file dumps, I had to ask help to a friend (Sphark) who dumped and sent me the .sbnk dumps.

2. I am trying to replace a .sbnk with a bigger one, and you know what happens. I and Sphark have researched for the way an .sdat is read and we have made some progress: VGMTrans, Crystal Tile 2, etc read the new data, but the game does not.
__________________
"Hacking has no limits. Don't try anything, DO IT!"

Jump into DS hacking with SDSME!


Beta 2 available!!


Reply With Quote
  #9    
Old November 28th, 2010, 10:07 PM
Team Fail's Avatar
Team Fail
 
Join Date: May 2009
Age: 18
Gender: Male
Nature: Brave
Well, why don't we look at VGMTrans' sourcecode? If it has the code to convert SBNK -> DLS, why don't we make it reverse the operation and make it into a separate running program?
__________________



Team Fail

Community Supporter Collab
☆ ☆ ☆


Reply With Quote
  #10    
Old November 29th, 2010, 04:32 AM
Spiky-Eared Pichu's Avatar
Spiky-Eared Pichu
NDS Hacker/Researcher
 
Join Date: Apr 2010
Location: Barcelona, Spain
Age: 19
Gender: Male
Nature: Calm
Send a message via Windows Live Messenger to Spiky-Eared Pichu Send a message via Skype™ to Spiky-Eared Pichu
...

I didn't know that VGMTrans was open-source. Yes, we can try to "mod" it so it does the reverse operation, but I'm not a computer programmer. I can try to do it, but I don't know what will happen...
__________________
"Hacking has no limits. Don't try anything, DO IT!"

Jump into DS hacking with SDSME!


Beta 2 available!!


Reply With Quote
Reply
Quick Reply

Sponsored Links


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 02:03 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.