NBA2K13 - Music Tool - Song Skipping Fix Example

A hub for everything related to NBA 2K13 modding. Releases, previews, requests, and other modding discussion belongs here.

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby ConfigSys on Mon Jun 17, 2013 2:31 pm

Great job nesa24
you are my hero!
please continue with your great work.
ConfigSys
 
Posts: 254
Joined: Fri Dec 01, 2006 10:06 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 4:13 pm

Leftos wrote:nesa24, well done. It's nice to see programmers around the forum. You should be releasing the source code of your tools, maybe someone could help you directly. Since you're using .NET, I was able to take a look at what you're doing through your decompiled source code, and from the information you've given, I was able to replace the first seconds of Mercy with the first seconds of any song on my computer, just like you did. Now if you can figure out how the different chunks are placed inside the .bin file, you could be making a song import/export tool in no time. I don't understand if you've already figured that out from your posts, but I hope you have.

To everyone else...
Like nesa24 said, the files are in WMAv2, 32kbps, Stereo, 44.1 KHz, 16bit. To get any song on your PC to that format, you use xWMAEncode. xWMAEncode is part of Microsoft's DirectX SDK, and can be found here: http://www.mediafire.com/download/zccl8 ... Encode.exe. You run it by putting it anywhere and running it through the command line like this:
Code: Select all
xWMAEncode -b 32000 mysong.wav mysong.xma

You can also decode xWMA files like so:
Code: Select all
xWMAEncode mysong.xma mysong.wav


Once you encode a file to xWMA, open it in any hex-editor, and find the "data" header. After the ASCII codes for "data" is the size of the rest of the file in 4 bytes, and then the actual song data. So, what nesa24 has done so far is grab a chunk of that song data and throw it right into jukeboxmusic.bin at decimal offset 96 to replace the start of Mercy.

Problem is, we need to figure out the size of those chunks (is it 4K? 8K? Something else?) and their offsets inside the .bin files. Once we do, we can replace the songs. As for the chunk size, I'd say 8192 bytes (8KB) is a candidate, since that number is what's inside bytes 92-95 in jukeboxmusic.bin. Could be wrong though.


Full code of BETA002/BETA001
Writen in C#

Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Media;

namespace NBA_Music_Tool___BETA
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            ofd.FileName = "nodata";

        }

        OpenFileDialog ofd = new OpenFileDialog();


        private void pictureBox10_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

       

        byte[] musictowrite = { };
       
        private void button1_Click(object sender, EventArgs e)
        {
            ofd.Title = "Select jukeboxmusic.bin to patch";
            ofd.Filter = "jukeboxmusic.bin(*.bin)|*.bin";
            ofd.ShowDialog();
            if (ofd.SafeFileName=="jukeboxmusic.bin")
            {
                this.button2.Enabled = true;
                this.button4.Enabled = true;
                this.button6.Enabled = true;
            }
           
        }

        string readmus = Directory.GetCurrentDirectory() + "\\temp.dat";
        string readmus2 = Directory.GetCurrentDirectory() + "\\temp2.dat";
        string readmus3 = Directory.GetCurrentDirectory() + "\\temp3.dat";
        private void button2_Click(object sender, EventArgs e)
        {           
            musictowrite = ReadAllBytes(readmus);
            button3.Enabled = true;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            BinaryWriter bw = new BinaryWriter(File.Open(ofd.FileName, FileMode.Open, FileAccess.ReadWrite));
            bw.BaseStream.Position = 0x00000060;         
            bw.Write(musictowrite);
            bw.Flush();
            bw.Close();
            button3.Enabled = false;
        }     



        public byte[] ReadAllBytes(string fileName)
        {
            byte[] buffer = null;
            using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
            {
                buffer = new byte[fs.Length];
                fs.Read(buffer, 0, (int)fs.Length);
            }
            return buffer;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            musictowrite = ReadAllBytes(readmus2);
            button3.Enabled = true;
        }

        private void button6_Click(object sender, EventArgs e)
        {           
            musictowrite = ReadAllBytes(readmus3);
           
            button3.Enabled = true;
        }



About chuck sizes i did figure it out and posted 15/15/2013
nesa24 wrote:http://www.mediafire.com/view/?nwx266fczakbl64 <<<< Read TXT


About song sizes (end of song chuck) i figure it out on and posted on 19/05/2013
nesa24 wrote:every chunk/section has a number that is at offset 24 with it of an chunk
Chunks of 1st song
00000000
00003A62
000074C4
0000AF26
0000E988
000123EA
00015E4C
000198AE
0001D310
00020D72
000247D4
00028236
0002BC98
0002F6FA
0003315C
00036BBE
0003A620
0003E082
00041AE4
00045546
00048FA8
0004CA0A
0005046C
00053ECE
00057930
0005B392
0005EDF4
00062856
000662B8
00069D1A
0006D77C
000711DE
00074C40
000786A2
0007C104
0007FB66
000835C8
0008702A
0008AA8C
0008E4EE
00091F50
000959B2
00099414
0009CE76
000A08D8
000A433A
000A7D9C
000AB7FE
000AF260
000B2CC2
000B6724
000BA186
000BDBE8
000C164A
000C50AC
000C8B0E
000CC570



Splited first 3 songs 20/05/2013
nesa24 wrote:840KB is 1st song
1095KB is 2nd song
615KB is 3rd song
http://www.mediafire.com/?t1o89c7g0280tr4 <<< Song separated 1-2-3 ( from start of jukeboxmusic.bin )


I tought its ADPCM but something was wrong
Than i contacted ADPCM expert http://oezmen.eu and he told me it isnt ADPCM its some kind of xWMA/WMA...

WMAv2, 32kbps, Stereo, 44.1 KHz, 16bit

Well i posted its 31kbps with a reason and that is that i couldnt get 32kbps to work
I used AIFF MP3 Converter and it didnt have 32 only 31
But glad that 31/32kbps both work


As i posted before i am short on time (worked 30mins max per day) so any tool from me will have to wait for 1-2months maybe

Maybe faster but now when people know format/codec it will be much easier to make a tool and figureout chants/commentary....

And thanks all
:lol:
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Hiteshom on Mon Jun 17, 2013 4:32 pm

^Holy crap! please repeat in 2nd grader language. lol. that's pretty sweet though, excited for this, hopefully Leftos can actually help out on the tool though. Awesome work!
User avatar
Hiteshom
 
Posts: 499
Joined: Mon Jun 25, 2012 9:47 am
Location: Salt Lake City, Utah

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby wody on Mon Jun 17, 2013 4:38 pm

:applaud: :applaud: :applaud: :applaud:
User avatar
wody
 
Posts: 1002
Joined: Fri Jul 10, 2009 12:42 pm

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 6:40 pm

nesa24, 32kbps is right. Use xWMAEncode from MS' DirectX SDK like I said in my post and you'll be able to convert any .WAV file (as long as it's 44.1KHz Stereo) in a format that is compatible to be thrown into jukeboxmusic.bin. But yeah, whatever works depending on the tool you're using.

Thanks for getting all your posts together; I had seen them, I just had no idea whether any of your findings later meant that the info in those posts was inaccurate now.

I'll give it a try again today, see if I can use your research to replace Mercy in full.

What I don't understand is this:

every chunk/section has a number that is at offset 24 with it of an chunk


To replace Mercy's first seconds you went to decimal offset 96 (0x60). You're saying the first chunk is at 0x0, next one is at 0x3A62. Have you figured out if the data is offset by 0x60 each time? So, for the second chunk, should I start at 0x3AC2?

EDIT: So, I pasted some more of the song at 0x3AC2 and got it to play, but it skipped a bit between the first and second chunk, so I think I might've pasted more in the 1st chunk than it can take. Have you figured out how much of each chunk (for example the 1st that is at 0x0, data starts at 0x60 and the whole chunk ends at 0x3A61) should be pasted with song data? Is it 4K? The way you have it each chunk is 14946. You skip the first 96 bytes so you have 14850 bytes left (0x60 to 0x3A61). Do you know how much of that area starting from 0x60 should be filled with song data?
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Krizzy on Mon Jun 17, 2013 7:06 pm

DAMNNN!! This will be a great contribution!!! thank you nesa24 :bowdown: :bowdown2: :applaud:
SC30 & DR01
Image Image
User avatar
Krizzy
 
Posts: 61
Joined: Tue May 21, 2013 9:12 pm

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 7:15 pm

Leftos wrote:
every chunk/section has a number that is at offset 24 with it of an chunk


To replace Mercy's first seconds you went to decimal offset 96 (0x60). You're saying the first chunk is at 0x0, next one is at 0x3A62. Have you figured out if the data is offset by 0x60 each time? So, for the second chunk, should I start at 0x3AC2?

EDIT: So, I pasted some more of the song at 0x3AC2 and got it to play, but it skipped a bit between the first and second chunk, so I think I might've pasted more in the 1st chunk than it can take. Have you figured out how much of each chunk (for example the 1st that is at 0x0, data starts at 0x60 and the whole chunk ends at 0x3A61) should be pasted with song data? Is it 4K? The way you have it each chunk is 14946. You skip the first 96 bytes so you have 14850 bytes left (0x60 to 0x3A61). Do you know how much of that area starting from 0x60 should be filled with song data?


0x60 is ofset for my program to write dat files dat files not song
take a look at temp1/tem2/temp3

All are same until 0x1B
So its 0x60+0x1B=0x0000007B
Second chunk of song should start at 0x00003ADD

Not 100% sure
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Reaperwolverine on Mon Jun 17, 2013 7:27 pm

Great work man. Kudos.
Maybe You Don't Remember How NASTY Vince Carter used to be....

Image

Frederic Weis Does.
User avatar
Reaperwolverine
 
Posts: 111
Joined: Fri Apr 26, 2013 7:24 pm

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 7:30 pm

Okay, so the first time you replace the first 28 bytes (0x1B) at 0x60 with the first 28 bytes from the dat file, and then copy in chunks, one at 0x7B, one at 0x3ADD, one at 0x753F, etc. Do you know how much starting at 0x7B we should fill up before jumping to the next chunk at 0x3ADD? 4096 bytes? More?

EDIT: To make this a bit simpler...

You have a big DAT file that has a xWMA song you want to put into jukeboxmusic.bin.

You get its first 28 bytes, paste them at 0x60 in jukebox.
Now you're at 0x7B. You grab X amount of bytes from the dat, paste them in jukebox.
You jump to the next chunk, which starts at 0x3A62, but you figure the first 0x60 + 0x1B = 0x7B bytes must be a header of sorts. So you jump to 0x3ADD, grab X amount of bytes from the dat, paste them in jukebox.

Correct me if I'm wrong in my assumptions. I tried that, and it doesn't work. The first chunk gets in (although I'm not sure how many bytes is the correct X), but once that gets played Mercy starts skipping, and I may hear some bits of the song I tried to import intermittently in there. So we need to figure out how chunking works in more detail. Where should the 1st chunk end (as far as where we stop pasting before 0x3A62) and where should we start pasting once we're in the 2nd chunk.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 7:46 pm

Leftos wrote:Okay, so the first time you replace the first 28 bytes (0x1B) at 0x60 with the first 28 bytes from the dat file, and then copy in chunks, one at 0x7B, one at 0x3ADD, one at 0x753F, etc. Do you know how much starting at 0x7B we should fill up before jumping to the next chunk at 0x3ADD? 4096 bytes? More?


Lets go this way mate
Open temp3.dat
Insert 00 at start before 0700000EFFFE
so you get 000700000EFFFE

Select all bytes (00003A03 is size)
Paste(replace bytes) first at 0000005F (0x60-0x1) until 0x00003A62 (0x00003A03 is size)
Jump to 00003AC1 (0x00003A62 + 0x60-0x1) paste(replace bytes) again until 0x000074C4 (0x00003A03 is size)

0x000074C4 is 2x00003A62 ( you know that just for others)

Save and get in game
You will hear me say PES-PES
2times=2chunks

So change/replace only bytes after chuck +0x59 (0x60-0x1)


Sorry if there is any confusion
I am from Serbia and we are :crazyeyes: :crazyeyes:
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 7:56 pm

Yeah, but you're replacing the same chunk with its headers or whatever. I'm asking whether you're able to replace the 2nd chunk of mercy with a 2nd chunk of YOUR file, as in, not you saying "PES", but whatever comes afterwards. The dat file you provided was too short to have 2 or more chunks itself, so here's another one that's longer: http://www.mediafire.com/download/btd5c ... fm/bfg.dat

See if you can figure how you can get, say, 2, 3, 4 chunks of the dat file into jukeboxmusic.bin so that they play in-game continuously and without skipping, and we're golden.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 8:28 pm

Leftos wrote:Yeah, but you're replacing the same chunk with its headers or whatever. I'm asking whether you're able to replace the 2nd chunk of mercy with a 2nd chunk of YOUR file, as in, not you saying "PES", but whatever comes afterwards. The dat file you provided was too short to have 2 or more chunks itself, so here's another one that's longer: http://www.mediafire.com/download/btd5c ... fm/bfg.dat

See if you can figure how you can get, say, 2, 3, 4 chunks of the dat file into jukeboxmusic.bin so that they play in-game continuously and without skipping, and we're golden.


http://www.mediafire.com/?1k8jy0bwmhidxob
Replace at
0x00003AC1 (0x00003A62+0x5F)

Its same as temp3 from beta002 with 00 inserted at start
Use it on default jukeboxmusic.bin and you will hear pes at second section of mercy

Its raw data in temp and no header replaced in jukeboxmusic
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 8:38 pm

Yeah, I understand that, but we need to figure out how to replace, for example, chunks 1 and 2 of Mercy in jukeboxmusic.bin with continuous chunks from a converted audio file. The one I posted a link of is a whole song converted to xWMA and stripped of its headers to be like your .dat files.

We need to figure out how to take contiguous parts of a converted song and replace continuous parts of Mercy. I haven't managed to do that yet.

Your files (temp.dat, etc.) are very small, they're not long enough to see if we can get a song to play continuously inside NBA 2K. That's why I gave you a link to a long song.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 8:44 pm

will try later
and update tool
busy now
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Spandex_ on Mon Jun 17, 2013 9:50 pm

Leftos wrote:Yeah, I understand that, but we need to figure out how to replace, for example, chunks 1 and 2 of Mercy in jukeboxmusic.bin with continuous chunks from a converted audio file. The one I posted a link of is a whole song converted to xWMA and stripped of its headers to be like your .dat files.

We need to figure out how to take contiguous parts of a converted song and replace continuous parts of Mercy. I haven't managed to do that yet.

Your files (temp.dat, etc.) are very small, they're not long enough to see if we can get a song to play continuously inside NBA 2K. That's why I gave you a link to a long song.


sir leftos, what if you guys use 4 bit rather than 8 bit. maybe it would compress the codes or something easier would come up.
"The best has yet to come."


Image
User avatar
Spandex_
Mamba Mentaility
 
Posts: 267
Joined: Sun May 05, 2013 11:27 am
Location: Philippines

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Patr1ck on Mon Jun 17, 2013 9:54 pm

Keep in mind that part of the chunk could be index data for seeking.
Patr1ck
Administrator
Administrator
 
Posts: 13323
Joined: Thu May 19, 2005 5:54 pm
Location: Pasadena, California, US

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Spandex_ on Mon Jun 17, 2013 10:06 pm

Pdub wrote:Keep in mind that part of the chunk could be index data for seeking.


Sir, is it just me or does the codes seem like increasing everytime with equal values?. I mean, what if there's a pattern like 00000000 - 00003A62 then from 00003A62 - 000074C4 and so on. it's like the codes are being multiplied by a certain value.
"The best has yet to come."


Image
User avatar
Spandex_
Mamba Mentaility
 
Posts: 267
Joined: Sun May 05, 2013 11:27 am
Location: Philippines

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 10:36 pm

Leftos wrote:Yeah, I understand that, but we need to figure out how to replace, for example, chunks 1 and 2 of Mercy in jukeboxmusic.bin with continuous chunks from a converted audio file.


I have just used your uploaded song (that you striped) and connected it with realy small milisec skipping

Connected first 5 chunks and it worked almost perfecto
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 11:11 pm

Leftos wrote:Yeah, but you're replacing the same chunk with its headers or whatever. I'm asking whether you're able to replace the 2nd chunk of mercy with a 2nd chunk of YOUR file, as in, not you saying "PES", but whatever comes afterwards. The dat file you provided was too short to have 2 or more chunks itself, so here's another one that's longer: http://www.mediafire.com/download/btd5c ... fm/bfg.dat

See if you can figure how you can get, say, 2, 3, 4 chunks of the dat file into jukeboxmusic.bin so that they play in-game continuously and without skipping, and we're golden.


Here it is
Connected chunks (5) and rest is mercy
No skipping or volume/speed issue...
Leftos Song First 5 chunks
:cheeky:

Now only converter/writer is task and i have that on mind one i can
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 11:17 pm

No skipping at all? That's great. Can you tell me the exact procedure (as in which parts you copied from the .dat to which parts of the .bin and anything else you did)? I could help you get the tool done faster, if you want. I had already started building something that would copy segments of .dat into the .bin, I just need to know the correct offsets and lengths.

Converting should be easy. Chain decode the MP3 to WAV and then encode it to xWMA via xWMAEncode, strip everything until the "data" header + 4 bytes, and start copying from there. That's what I did to get you the song I gave you. Only thing that's left is to know how much we copy out of the .dat file for each chunk and where to place it in the .bin file and we're golden (although we'll probably have to make the songs the same durations as the originals, but that's a small price to pay :P).
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 11:40 pm

Leftos wrote:No skipping at all? That's great. Can you tell me the exact procedure (as in which parts you copied from the .dat to which parts of the .bin and anything else you did)? I could help you get the tool done faster, if you want. I had already started building something that would copy segments of .dat into the .bin, I just need to know the correct offsets and lengths.


First added 00 at start of your dat file
than copied 3A03 from start of it (ends with F6B37006) at 0x00003A03 to jukeboxmusic.bin 0x0000005F until 0x00003A62 <<<< first section
than copied from dat 0x00003A03(A49BE602) until 0x00007405(AE72977A) to jukeboxmusic.bin 0x00003AC2 until 0x000074C4 <<<< second section
than copied from dat 0x00007405(4885ACBB) until 0x0000AE07(1CA462E6) to jukeboxmusic.bin 0x00007524 until 0x0000AF26 <<<< third section

and so on

and now skipping fix

save jukebox
go to start of file
every section start +0x0000003A has some values
change them to be in order 01 02 03 04 05

default from +39
A000 00004001 0000C001 00004002 0000C002 00004003 0000E003 0000A004 00006005 00002006
look at my file +39
A001 00004002 0000C003 00004004 0000C005 00004006 0000E007 0000A008 00006009 0000200A

once you change them to 01 02 03 04 05 06... it wont skip or have volume issue
and thats it
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Mon Jun 17, 2013 11:47 pm

Okay, that's good, detailed information. I'll try to have something done in the next hours, see if I can make the tool to automate the replacement of the whole Mercy song with another one, for starters.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby nesa24 on Mon Jun 17, 2013 11:56 pm

:mrgreen:
All men dream: but not equally.
Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible.
This I did.
User avatar
nesa24
 
Posts: 313
Joined: Sun Mar 04, 2012 3:43 am

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Tue Jun 18, 2013 12:14 am

Okay, I'll have to go out for a couple of hours, but I'll keep working on it. I've automated your procedure nesa24, here's the code, and it works perfectly:

Code: Select all
var ms = new MemoryStream(File.ReadAllBytes(@"E:\temp\2kmusic\bfg.dat"));
var bw = new BinaryWriter(File.Open(@"D:\Games\NBA 2K13\jukeboxmusic.bin", FileMode.Open, FileAccess.Write));
bw.BaseStream.Position = 0;

const int ChunkSize = 14946;
const int Count = 14850;
var buf = new byte[Count];
for (int i = 0; i < 10; i++)
{
   bw.BaseStream.Position += 58L;
   for (int j = 0; j < 10; j++)
   {
      bw.Write((byte)(j + 1));
      bw.BaseStream.Position += 3;
   }
   bw.BaseStream.Position -= 2;
   ms.Read(buf, 0, Count);
   bw.Write(buf);
   bw.Flush();
}
bw.Close();
ms.Close();


Add that to a button, change the upper limit of the outer for-loop (the one that's using i) to replace more or less of the song, and you're golden. Essentially, if you set the upper-limit of i to the number of chunks in the original Mercy song and find a song that fits Mercy perfectly in duration, you should be able to use this code to fully replace Mercy. Then, it's just a minor adjustment to the starting position to the BaseStream and the upper-limit of i to replace any other song. So, get the number of chunks of each song and its duration, and we have the tool done within the day.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

Re: NBA2K13 - Music Tool - Beta 002 - Solved Sound Issue

Postby Leftos on Tue Jun 18, 2013 12:26 am

Actually, nesa24, here you go: http://www.mediafire.com/download/1tkf4 ... o_Test1.7z

Run it, play around with the number of chunks, replace bfg.dat with a dat of your own, choose other offsets to replace another song, it should all work.

Source code: http://www.mediafire.com/download/0c14b ... 2KAudio.7z

First 7z has the compiled EXE (needs .NET 4.5), second 7z has the source code. Have fun, I'll be back to do more.

NOTE: Both bfg.dat and jukeboxmusic.bin need to be in the same folder as the NBA2KAudio.exe for now. I'll make sure to use my magic to make this a much better tool, this is what I could do in the span of 10 minutes. Both the Starting Offset and Number of Chunks need to be in Decimal (Base 10), not Hex. Starting Offset for Mercy is 0. As you can see in the code, it automatically jumps to where it should replace the seeking numbers and then to where it should replace the data.
Eleftherios "Leftos" Aslanoglou
NBA 2K AI Software Engineer
Visual Concepts Entertainment / 2K Sports

Used to be "That Tools Guy" around here during the good ol' days. Although you probably remember me as your favorite Podcast host.
User avatar
Leftos
I'm The Pipeline, The Pipeline Is Me
NBA 2K Developer
 
Posts: 5223
Joined: Sun Jun 07, 2009 7:44 am
Location: Novato, CA, USA

PreviousNext

Return to NBA 2K13 Modding

Who is online

Users browsing this forum: No registered users and 4 guests